@@ -434,15 +434,24 @@ ops.OdtDocument = function OdtDocument(odfCanvas) {
434434 return { textNode : lastTextNode , offset : nodeOffset } ;
435435 }
436436
437+ /**
438+ * @param {!ops.Operation } op
439+ * @return {undefined }
440+ */
441+ this . prepareOperationExecution = function ( op ) {
442+ eventNotifier . emit ( ops . OdtDocument . signalOperationStart , op ) ;
443+ } ;
444+
437445 /**
438446 * Called after an operation is executed, this
439447 * function will check if the operation is an
440448 * 'edit', and in that case will update the
441449 * document's metadata, such as dc:creator,
442450 * meta:editing-cycles, and dc:creator.
443451 * @param {!ops.Operation } op
452+ * @return {undefined }
444453 */
445- function handleOperationExecuted ( op ) {
454+ this . finishOperationExecution = function ( op ) {
446455 var opspec = op . spec ( ) ,
447456 memberId = opspec . memberid ,
448457 date = new Date ( opspec . timestamp ) . toISOString ( ) ,
@@ -484,9 +493,14 @@ ops.OdtDocument = function OdtDocument(odfCanvas) {
484493 }
485494
486495 lastEditingOp = op ;
487- self . emit ( ops . OdtDocument . signalMetadataUpdated , changedMetadata ) ;
488496 }
489- }
497+
498+ eventNotifier . emit ( ops . OdtDocument . signalOperationEnd , op ) ;
499+
500+ if ( op . isEdit ) {
501+ eventNotifier . emit ( ops . OdtDocument . signalMetadataUpdated , changedMetadata ) ;
502+ }
503+ } ;
490504
491505 /**
492506 * Upgrades literal whitespaces (' ') to <text:s> </text:s>,
@@ -976,7 +990,6 @@ ops.OdtDocument = function OdtDocument(odfCanvas) {
976990 filter = new ops . TextPositionFilter ( ) ;
977991 stepUtils = new odf . StepUtils ( ) ;
978992 stepsTranslator = new ops . OdtStepsTranslator ( rootNode , createPositionIterator ( rootNode ) , filter , 500 ) ;
979- eventNotifier . subscribe ( ops . OdtDocument . signalOperationEnd , handleOperationExecuted ) ;
980993 eventNotifier . subscribe ( ops . OdtDocument . signalProcessingBatchEnd , core . Task . processTasks ) ;
981994 }
982995 init ( ) ;
0 commit comments