@@ -131,18 +131,13 @@ ops.OdtDocument = function OdtDocument(odfCanvas) {
131131 var odfContainer = odfCanvas . odfContainer ( ) ,
132132 rootNode ;
133133
134- eventNotifier . unsubscribe ( ops . OdtDocument . signalStepsInserted , stepsTranslator . handleStepsInserted ) ;
135- eventNotifier . unsubscribe ( ops . OdtDocument . signalStepsRemoved , stepsTranslator . handleStepsRemoved ) ;
136-
137134 // TODO Replace with a neater hack for reloading the Odt tree
138135 // Once this is fixed, SelectionView.addOverlays can be removed
139136 odfContainer . setRootElement ( documentElement ) ;
140137 odfCanvas . setOdfContainer ( odfContainer , true ) ;
141138 odfCanvas . refreshCSS ( ) ;
142139 rootNode = getRootNode ( ) ;
143140 stepsTranslator = new ops . OdtStepsTranslator ( rootNode , createPositionIterator ( rootNode ) , filter , 500 ) ;
144- eventNotifier . subscribe ( ops . OdtDocument . signalStepsInserted , stepsTranslator . handleStepsInserted ) ;
145- eventNotifier . subscribe ( ops . OdtDocument . signalStepsRemoved , stepsTranslator . handleStepsRemoved ) ;
146141 } ;
147142
148143 /**
@@ -939,6 +934,30 @@ ops.OdtDocument = function OdtDocument(odfCanvas) {
939934 callback ( ) ;
940935 } ;
941936
937+ /**
938+ * Process steps being inserted into the document. Will emit a steps inserted signal on
939+ * behalf of the caller
940+ * @param {!{position: !number} } args
941+ * @return {undefined }
942+ */
943+ this . handleStepsInserted = function ( args ) {
944+ stepsTranslator . handleStepsInserted ( args ) ;
945+ // signal not used in webodf, but 3rd-party (NVivo)
946+ self . emit ( ops . OdtDocument . signalStepsInserted , args ) ;
947+ } ;
948+
949+ /**
950+ * Process steps being removed from the document. Will emit a steps removed signal on
951+ * behalf of the caller
952+ * @param {!{position: !number} } args
953+ * @return {undefined }
954+ */
955+ this . handleStepsRemoved = function ( args ) {
956+ stepsTranslator . handleStepsRemoved ( args ) ;
957+ // signal not used in webodf, but 3rd-party (NVivo)
958+ self . emit ( ops . OdtDocument . signalStepsRemoved , args ) ;
959+ } ;
960+
942961 /**
943962 * @return {undefined }
944963 */
@@ -948,8 +967,6 @@ ops.OdtDocument = function OdtDocument(odfCanvas) {
948967 filter = new ops . TextPositionFilter ( ) ;
949968 stepUtils = new odf . StepUtils ( ) ;
950969 stepsTranslator = new ops . OdtStepsTranslator ( rootNode , createPositionIterator ( rootNode ) , filter , 500 ) ;
951- eventNotifier . subscribe ( ops . OdtDocument . signalStepsInserted , stepsTranslator . handleStepsInserted ) ;
952- eventNotifier . subscribe ( ops . OdtDocument . signalStepsRemoved , stepsTranslator . handleStepsRemoved ) ;
953970 eventNotifier . subscribe ( ops . OdtDocument . signalOperationEnd , handleOperationExecuted ) ;
954971 eventNotifier . subscribe ( ops . OdtDocument . signalProcessingBatchEnd , core . Task . processTasks ) ;
955972 }
0 commit comments