@@ -437,15 +437,24 @@ ops.OdtDocument = function OdtDocument(odfCanvas) {
437437 return { textNode : lastTextNode , offset : nodeOffset } ;
438438 }
439439
440+ /**
441+ * @param {!ops.Operation } op
442+ * @return {undefined }
443+ */
444+ this . prepareOperationExecution = function ( op ) {
445+ eventNotifier . emit ( ops . OdtDocument . signalOperationStart , op ) ;
446+ } ;
447+
440448 /**
441449 * Called after an operation is executed, this
442450 * function will check if the operation is an
443451 * 'edit', and in that case will update the
444452 * document's metadata, such as dc:creator,
445453 * meta:editing-cycles, and dc:creator.
446454 * @param {!ops.Operation } op
455+ * @return {undefined }
447456 */
448- function handleOperationExecuted ( op ) {
457+ this . finishOperationExecution = function ( op ) {
449458 var opspec = op . spec ( ) ,
450459 memberId = opspec . memberid ,
451460 date = new Date ( opspec . timestamp ) . toISOString ( ) ,
@@ -487,9 +496,14 @@ ops.OdtDocument = function OdtDocument(odfCanvas) {
487496 }
488497
489498 lastEditingOp = op ;
490- self . emit ( ops . OdtDocument . signalMetadataUpdated , changedMetadata ) ;
491499 }
492- }
500+
501+ eventNotifier . emit ( ops . OdtDocument . signalOperationEnd , op ) ;
502+
503+ if ( op . isEdit ) {
504+ eventNotifier . emit ( ops . OdtDocument . signalMetadataUpdated , changedMetadata ) ;
505+ }
506+ } ;
493507
494508 /**
495509 * Upgrades literal whitespaces (' ') to <text:s> </text:s>,
@@ -979,7 +993,6 @@ ops.OdtDocument = function OdtDocument(odfCanvas) {
979993 filter = new ops . TextPositionFilter ( ) ;
980994 stepUtils = new odf . StepUtils ( ) ;
981995 stepsTranslator = new ops . OdtStepsTranslator ( rootNode , createPositionIterator ( rootNode ) , filter , 500 ) ;
982- eventNotifier . subscribe ( ops . OdtDocument . signalOperationEnd , handleOperationExecuted ) ;
983996 eventNotifier . subscribe ( ops . OdtDocument . signalProcessingBatchEnd , core . Task . processTasks ) ;
984997 }
985998 init ( ) ;
0 commit comments