Skip to content

Commit 964f381

Browse files
author
Friedrich W. H. Kossebau
committed
Let events about added/removed steps part be part of operation event stack
1 parent 5bde046 commit 964f381

File tree

9 files changed

+55
-12
lines changed

9 files changed

+55
-12
lines changed

webodf/lib/ops/OdtDocument.js

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -991,8 +991,6 @@ ops.OdtDocument = function OdtDocument(odfCanvas) {
991991
*/
992992
this.handleStepsInserted = function(args) {
993993
stepsTranslator.handleStepsInserted(args);
994-
// signal not used in webodf, but 3rd-party (NVivo)
995-
eventNotifier.emit(ops.OdtDocument.signalStepsInserted, args);
996994
};
997995

998996
/**
@@ -1003,8 +1001,6 @@ ops.OdtDocument = function OdtDocument(odfCanvas) {
10031001
*/
10041002
this.handleStepsRemoved = function(args) {
10051003
stepsTranslator.handleStepsRemoved(args);
1006-
// signal not used in webodf, but 3rd-party (NVivo)
1007-
eventNotifier.emit(ops.OdtDocument.signalStepsRemoved, args);
10081004
};
10091005

10101006
/**

webodf/lib/ops/OpAddAnnotation.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,11 @@ ops.OpAddAnnotation = function OpAddAnnotation() {
161161
}
162162
insertNodeAtPosition(odtDocument, annotation, position);
163163
odtDocument.handleStepsInserted({position: position});
164+
// signal not used in webodf, but 3rd-party (NVivo)
165+
events.push({
166+
eventid: ops.OdtDocument.signalStepsInserted,
167+
args: { position: position }
168+
});
164169

165170
// Move the cursor inside the new annotation,
166171
// by selecting the paragraph's range.

webodf/lib/ops/OpInsertImage.js

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,8 @@ ops.OpInsertImage = function OpInsertImage() {
8686
var odtDocument = /**@type{ops.OdtDocument}*/(document),
8787
odfCanvas = odtDocument.getOdfCanvas(),
8888
domPosition = odtDocument.getTextNodeAtStep(position, memberid),
89-
textNode, refNode, paragraphElement, frameElement;
89+
textNode, refNode, paragraphElement, frameElement,
90+
events = [];
9091

9192
if (!domPosition) {
9293
return null;
@@ -99,6 +100,11 @@ ops.OpInsertImage = function OpInsertImage() {
99100
frameElement = createFrameElement(odtDocument.getDOMDocument());
100101
textNode.parentNode.insertBefore(frameElement, refNode);
101102
odtDocument.handleStepsInserted({position: position});
103+
// signal not used in webodf, but 3rd-party (NVivo)
104+
events.push({
105+
eventid: ops.OdtDocument.signalStepsInserted,
106+
args: { position: position }
107+
});
102108

103109
// clean up any empty text node which was created by odtDocument.getTextNodeAtStep
104110
if (textNode.length === 0) {
@@ -109,14 +115,16 @@ ops.OpInsertImage = function OpInsertImage() {
109115
odfCanvas.refreshCSS();
110116
odfCanvas.rerenderAnnotations();
111117

112-
return [{
118+
events.push({
113119
eventid: ops.OdtDocument.signalParagraphChanged,
114120
args: {
115121
paragraphElement: paragraphElement,
116122
memberId: memberid,
117123
timeStamp: timestamp
118124
}
119-
}];
125+
});
126+
127+
return events;
120128
};
121129

122130
/**

webodf/lib/ops/OpInsertTable.js

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,8 @@ ops.OpInsertTable = function OpInsertTable() {
149149
domPosition = odtDocument.getTextNodeAtStep(position),
150150
rootNode = odtDocument.getRootNode(),
151151
previousSibling,
152-
tableNode;
152+
tableNode,
153+
events = [];
153154

154155
if (domPosition) {
155156
tableNode = createTableNode(odtDocument.getDOMDocument());
@@ -159,17 +160,24 @@ ops.OpInsertTable = function OpInsertTable() {
159160
rootNode.insertBefore(tableNode, previousSibling.nextSibling);
160161
// The parent table counts for 1 position, and 1 paragraph is added per cell
161162
odtDocument.handleStepsInserted({position: position});
163+
// signal not used in webodf, but 3rd-party (NVivo)
164+
events.push({
165+
eventid: ops.OdtDocument.signalStepsInserted,
166+
args: { position: position }
167+
});
162168

163169
odtDocument.getOdfCanvas().refreshSize();
164170
odtDocument.getOdfCanvas().rerenderAnnotations();
165-
return [{
171+
events.push({
166172
eventid: ops.OdtDocument.signalTableAdded,
167173
args: {
168174
tableElement: tableNode,
169175
memberId: memberid,
170176
timeStamp: timestamp
171177
}
172-
}];
178+
});
179+
180+
return events;
173181
}
174182
return null;
175183
};

webodf/lib/ops/OpInsertText.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,11 @@ ops.OpInsertText = function OpInsertText() {
189189
}
190190

191191
odtDocument.handleStepsInserted({position: position});
192+
// signal not used in webodf, but 3rd-party (NVivo)
193+
events.push({
194+
eventid: ops.OdtDocument.signalStepsInserted,
195+
args: { position: position }
196+
});
192197

193198
if (cursor && moveCursor) {
194199
// Explicitly place the cursor in the desired position after insertion

webodf/lib/ops/OpMergeParagraph.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -246,6 +246,11 @@ ops.OpMergeParagraph = function OpMergeParagraph() {
246246

247247
// Merging removes a single step between the boundary of the two paragraphs
248248
odtDocument.handleStepsRemoved({position: sourceStartPosition - 1});
249+
// signal not used in webodf, but 3rd-party (NVivo)
250+
events.push({
251+
eventid: ops.OdtDocument.signalStepsRemoved,
252+
args: { position: sourceStartPosition - 1 }
253+
});
249254

250255
// Downgrade trailing spaces at the end of the destination paragraph, and the beginning of the source paragraph.
251256
// These are the only two places that might need downgrading as a result of the merge.

webodf/lib/ops/OpRemoveAnnotation.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,8 @@ ops.OpRemoveAnnotation = function OpRemoveAnnotation() {
5959
iterator = odtDocument.getIteratorAtPosition(position),
6060
container = iterator.container(),
6161
annotationNode,
62-
annotationEnd;
62+
annotationEnd,
63+
events = [];
6364

6465
while (!(container.namespaceURI === odf.Namespaces.officens
6566
&& container.localName === 'annotation')) {
@@ -92,11 +93,16 @@ ops.OpRemoveAnnotation = function OpRemoveAnnotation() {
9293
}
9394
// The specified position is the first walkable step in the annotation. The position is always just before the first point of change
9495
odtDocument.handleStepsRemoved({position: position > 0 ? position - 1 : position});
96+
// signal not used in webodf, but 3rd-party (NVivo)
97+
events.push({
98+
eventid: ops.OdtDocument.signalStepsRemoved,
99+
args: { position: position > 0 ? position - 1 : position }
100+
});
95101

96102
odtDocument.getOdfCanvas().rerenderAnnotations();
97103
odtDocument.fixCursorPositions();
98104

99-
return [];
105+
return events;
100106
};
101107

102108
/**

webodf/lib/ops/OpRemoveText.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,11 @@ ops.OpRemoveText = function OpRemoveText() {
9494
});
9595

9696
odtDocument.handleStepsRemoved({position: position});
97+
// signal not used in webodf, but 3rd-party (NVivo)
98+
events.push({
99+
eventid: ops.OdtDocument.signalStepsRemoved,
100+
args: { position: position }
101+
});
97102
odtDocument.downgradeWhitespacesAtPosition(position);
98103
odtDocument.fixCursorPositions();
99104
odtDocument.getOdfCanvas().refreshSize();

webodf/lib/ops/OpSplitParagraph.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,11 @@ ops.OpSplitParagraph = function OpSplitParagraph() {
171171
domPosition.textNode.parentNode.removeChild(domPosition.textNode);
172172
}
173173
odtDocument.handleStepsInserted({position: position});
174+
// signal not used in webodf, but 3rd-party (NVivo)
175+
events.push({
176+
eventid: ops.OdtDocument.signalStepsInserted,
177+
args: { position: position }
178+
});
174179

175180
if (cursor && moveCursor) {
176181
odtDocument.moveCursor(memberid, position + 1, 0);

0 commit comments

Comments
 (0)