@@ -165,18 +165,13 @@ ops.OdtDocument = function OdtDocument(odfCanvas) {
165165 var odfContainer = odfCanvas . odfContainer ( ) ,
166166 rootNode ;
167167
168- eventNotifier . unsubscribe ( ops . OdtDocument . signalStepsInserted , stepsTranslator . handleStepsInserted ) ;
169- eventNotifier . unsubscribe ( ops . OdtDocument . signalStepsRemoved , stepsTranslator . handleStepsRemoved ) ;
170-
171168 // TODO Replace with a neater hack for reloading the Odt tree
172169 // Once this is fixed, SelectionView.addOverlays can be removed
173170 odfContainer . setRootElement ( documentElement ) ;
174171 odfCanvas . setOdfContainer ( odfContainer , true ) ;
175172 odfCanvas . refreshCSS ( ) ;
176173 rootNode = getRootNode ( ) ;
177174 stepsTranslator = new ops . OdtStepsTranslator ( rootNode , createPositionIterator ( rootNode ) , filter , 500 ) ;
178- eventNotifier . subscribe ( ops . OdtDocument . signalStepsInserted , stepsTranslator . handleStepsInserted ) ;
179- eventNotifier . subscribe ( ops . OdtDocument . signalStepsRemoved , stepsTranslator . handleStepsRemoved ) ;
180175 } ;
181176
182177 /**
@@ -942,6 +937,30 @@ ops.OdtDocument = function OdtDocument(odfCanvas) {
942937 callback ( ) ;
943938 } ;
944939
940+ /**
941+ * Process steps being inserted into the document. Will emit a steps inserted signal on
942+ * behalf of the caller
943+ * @param {!{position: !number} } args
944+ * @return {undefined }
945+ */
946+ this . handleStepsInserted = function ( args ) {
947+ stepsTranslator . handleStepsInserted ( args ) ;
948+ // signal not used in webodf, but 3rd-party (NVivo)
949+ self . emit ( ops . OdtDocument . signalStepsInserted , args ) ;
950+ } ;
951+
952+ /**
953+ * Process steps being removed from the document. Will emit a steps removed signal on
954+ * behalf of the caller
955+ * @param {!{position: !number} } args
956+ * @return {undefined }
957+ */
958+ this . handleStepsRemoved = function ( args ) {
959+ stepsTranslator . handleStepsRemoved ( args ) ;
960+ // signal not used in webodf, but 3rd-party (NVivo)
961+ self . emit ( ops . OdtDocument . signalStepsRemoved , args ) ;
962+ } ;
963+
945964 /**
946965 * @return {undefined }
947966 */
@@ -951,8 +970,6 @@ ops.OdtDocument = function OdtDocument(odfCanvas) {
951970 filter = new ops . TextPositionFilter ( ) ;
952971 stepUtils = new odf . StepUtils ( ) ;
953972 stepsTranslator = new ops . OdtStepsTranslator ( rootNode , createPositionIterator ( rootNode ) , filter , 500 ) ;
954- eventNotifier . subscribe ( ops . OdtDocument . signalStepsInserted , stepsTranslator . handleStepsInserted ) ;
955- eventNotifier . subscribe ( ops . OdtDocument . signalStepsRemoved , stepsTranslator . handleStepsRemoved ) ;
956973 eventNotifier . subscribe ( ops . OdtDocument . signalOperationEnd , handleOperationExecuted ) ;
957974 eventNotifier . subscribe ( ops . OdtDocument . signalProcessingBatchEnd , core . Task . processTasks ) ;
958975 }
0 commit comments