From 706d76422ef7360f2ffbe2d6050acbbffa475861 Mon Sep 17 00:00:00 2001 From: "Friedrich W. H. Kossebau" Date: Thu, 12 Mar 2015 23:44:09 +0100 Subject: [PATCH 01/24] Add supports for custom test setups in TransformationTests similiar code as in OperationTests --- webodf/tests/ops/TransformationTests.js | 49 +++++++++++++++++++------ 1 file changed, 37 insertions(+), 12 deletions(-) diff --git a/webodf/tests/ops/TransformationTests.js b/webodf/tests/ops/TransformationTests.js index bd5d616b..26690fc1 100644 --- a/webodf/tests/ops/TransformationTests.js +++ b/webodf/tests/ops/TransformationTests.js @@ -32,7 +32,7 @@ */ ops.TransformationTests = function TransformationTests(runner) { "use strict"; - var r = runner, t, tests, + var self = this, r = runner, t, tests, opsTestHelper = new ops.OperationTestHelper(); function serialize(element) { @@ -308,14 +308,16 @@ ops.TransformationTests = function TransformationTests(runner) { /** * @param {!string} name * @param {!Element} element - * @return {!{before, opspecsA, opspecsB, after}} + * @return {!{isFailing, setup, before, opspecsA, opspecsB, after}} */ function parseTest(name, element) { var before = element.getElementsByTagName("before")[0], opsAElement = element.getElementsByTagName("opsA")[0], opsBElement = element.getElementsByTagName("opsB")[0], after = element.getElementsByTagName("after")[0], - isFailing = element.getAttribute("isFailing") === "true"; + hasSetup = element.getAttribute("hasSetup") === "true", + isFailing = element.getAttribute("isFailing") === "true", + setup; runtime.assert(Boolean(before), "Expected in " + name + "."); runtime.assert(checkWhitespace(before), "Unexpanded test:s element or text:c attribute found in " + name + "."); @@ -324,8 +326,13 @@ ops.TransformationTests = function TransformationTests(runner) { runtime.assert(Boolean(after), "Expected in " + name + "."); runtime.assert(checkWhitespace(after), "Unexpanded test:s element or text:c attribute found in " + name + "."); opsTestHelper.removeInsignificantTextNodes(element); + setup = self.setUps.hasOwnProperty(name) ? self.setUps[name]() : null; + if (hasSetup) { + runtime.assert(Boolean(setup), "Required setup for " + name + " was not found."); + } return { isFailing: isFailing, + setup : setup, before: before, opspecsA: parseOpspecs(name, opsAElement), opspecsB: parseOpspecs(name, opsBElement), @@ -396,9 +403,16 @@ ops.TransformationTests = function TransformationTests(runner) { return getOfficeNSElement(element, "meta"); } - function compareOpsExecution(opspecs, transformedOpspecs, before, after) { - var odfContainer, - odtDocument, + /** + * @param {!Array.} opspecs + * @param {!Array.} transformedOpspecs + * @param {!Element} before + * @param {!Element} after + * @param {?{setUp:!function(), tearDown:!function()}} setup + * @return {undefined} + */ + function compareOpsExecution(opspecs, transformedOpspecs, before, after, setup) { + var odtDocument, text, textbefore = getOfficeTextElement(before), textafter = getOfficeTextElement(after), @@ -412,12 +426,12 @@ ops.TransformationTests = function TransformationTests(runner) { i, op; - odfContainer = new odf.OdfContainer(odf.OdfContainer.DocumentType.TEXT, null); - t.odfcanvas.setOdfContainer(odfContainer); + t.odfContainer = new odf.OdfContainer(odf.OdfContainer.DocumentType.TEXT, null); + t.odfcanvas.setOdfContainer(t.odfContainer); odtDocument = new ops.OdtDocument(t.odfcanvas); text = odtDocument.getRootNode(); - styles = odfContainer.rootElement.styles; - meta = /**@type{!Element}*/(odfContainer.rootElement.meta); + styles = t.odfContainer.rootElement.styles; + meta = /**@type{!Element}*/(t.odfContainer.rootElement.meta); runtime.assert(Boolean(meta), "Missing !"); // inject test data @@ -428,6 +442,9 @@ ops.TransformationTests = function TransformationTests(runner) { copyChildNodes(meta, metabefore); } copyChildNodes(text, textbefore); + if (setup) { + setup.setUp(); + } // execute opspecs for (i = 0; i < opspecs.length; i += 1) { @@ -489,6 +506,9 @@ ops.TransformationTests = function TransformationTests(runner) { t.text = t.after = "OK"; } r.shouldBe(t, "t.text", "t.after"); + if (setup) { + setup.tearDown(); + } } function runTest(test) { @@ -497,8 +517,8 @@ ops.TransformationTests = function TransformationTests(runner) { t.transformResult = transformer.transform(cloneSpecs(test.opspecsA), cloneSpecs(test.opspecsB)); r.shouldBeNonNull(t, "t.transformResult"); if (t.transformResult) { - compareOpsExecution(test.opspecsA, t.transformResult.opSpecsB, test.before, test.after); - compareOpsExecution(test.opspecsB, t.transformResult.opSpecsA, test.before, test.after); + compareOpsExecution(test.opspecsA, t.transformResult.opSpecsB, test.before, test.after, test.setup); + compareOpsExecution(test.opspecsB, t.transformResult.opSpecsA, test.before, test.after, test.setup); } } @@ -568,6 +588,11 @@ ops.TransformationTests = function TransformationTests(runner) { return [ ]; }; + + /*jslint emptyblock: true*/ + this.setUps = { + }; + /*jslint emptyblock: false*/ }; ops.TransformationTests.prototype.description = function () { From 69ac4062de675f89031d6b9f2a50ba2bd7312220 Mon Sep 17 00:00:00 2001 From: "Friedrich W. H. Kossebau" Date: Wed, 18 Mar 2015 18:15:11 +0100 Subject: [PATCH 02/24] Add noop transformations against AddAnnotation & RemoveAnnotation --- webodf/lib/ops/OperationTransformMatrix.js | 39 +++ webodf/tests/ops/TransformationTests.js | 22 +- webodf/tests/ops/transformationtests.xml | 338 +++++++++++++++++++++ 3 files changed, 397 insertions(+), 2 deletions(-) diff --git a/webodf/lib/ops/OperationTransformMatrix.js b/webodf/lib/ops/OperationTransformMatrix.js index c4a743ca..5088a2d0 100644 --- a/webodf/lib/ops/OperationTransformMatrix.js +++ b/webodf/lib/ops/OperationTransformMatrix.js @@ -1488,6 +1488,26 @@ ops.OperationTransformMatrix = function OperationTransformMatrix() { */ transformations; transformations = { + "AddAnnotation": { +// "AddAnnotation": passUnchanged, + "AddCursor": passUnchanged, + "AddMember": passUnchanged, + "AddStyle": passUnchanged, +// "ApplyDirectStyling": passUnchanged, +// "InsertText": passUnchanged, +// "MergeParagraph": passUnchanged, +// "MoveCursor": passUnchanged, +// "RemoveAnnotation": passUnchanged, + "RemoveCursor": passUnchanged, + "RemoveMember": passUnchanged, + "RemoveStyle": passUnchanged, +// "RemoveText": passUnchanged, +// "SetParagraphStyle": passUnchanged, +// "SplitParagraph": passUnchanged, + "UpdateMember": passUnchanged, + "UpdateMetadata": passUnchanged, + "UpdateParagraphStyle": passUnchanged + }, "AddCursor": { "AddCursor": passUnchanged, "AddMember": passUnchanged, @@ -1496,6 +1516,7 @@ ops.OperationTransformMatrix = function OperationTransformMatrix() { "InsertText": passUnchanged, "MergeParagraph": passUnchanged, "MoveCursor": passUnchanged, + "RemoveAnnotation": passUnchanged, "RemoveCursor": passUnchanged, "RemoveMember": passUnchanged, "RemoveStyle": passUnchanged, @@ -1512,6 +1533,7 @@ ops.OperationTransformMatrix = function OperationTransformMatrix() { "InsertText": passUnchanged, "MergeParagraph": passUnchanged, "MoveCursor": passUnchanged, + "RemoveAnnotation": passUnchanged, "RemoveCursor": passUnchanged, "RemoveStyle": passUnchanged, "RemoveText": passUnchanged, @@ -1526,6 +1548,7 @@ ops.OperationTransformMatrix = function OperationTransformMatrix() { "InsertText": passUnchanged, "MergeParagraph": passUnchanged, "MoveCursor": passUnchanged, + "RemoveAnnotation": passUnchanged, "RemoveCursor": passUnchanged, "RemoveMember": passUnchanged, "RemoveStyle": transformAddStyleRemoveStyle, @@ -1541,6 +1564,7 @@ ops.OperationTransformMatrix = function OperationTransformMatrix() { "InsertText": transformApplyDirectStylingInsertText, "MergeParagraph": transformApplyDirectStylingMergeParagraph, "MoveCursor": passUnchanged, +// "RemoveAnnotation": passUnchanged, "RemoveCursor": passUnchanged, "RemoveMember": passUnchanged, "RemoveStyle": passUnchanged, @@ -1555,6 +1579,7 @@ ops.OperationTransformMatrix = function OperationTransformMatrix() { "InsertText": transformInsertTextInsertText, "MergeParagraph": transformInsertTextMergeParagraph, "MoveCursor": transformInsertTextMoveCursor, +// "RemoveAnnotation": passUnchanged, "RemoveCursor": passUnchanged, "RemoveMember": passUnchanged, "RemoveStyle": passUnchanged, @@ -1568,6 +1593,7 @@ ops.OperationTransformMatrix = function OperationTransformMatrix() { "MergeParagraph": { "MergeParagraph": transformMergeParagraphMergeParagraph, "MoveCursor": transformMergeParagraphMoveCursor, +// "RemoveAnnotation": passUnchanged, "RemoveCursor": passUnchanged, "RemoveMember": passUnchanged, "RemoveStyle": passUnchanged, @@ -1580,6 +1606,7 @@ ops.OperationTransformMatrix = function OperationTransformMatrix() { }, "MoveCursor": { "MoveCursor": passUnchanged, +// "RemoveAnnotation": passUnchanged, "RemoveCursor": transformMoveCursorRemoveCursor, "RemoveMember": passUnchanged, "RemoveStyle": passUnchanged, @@ -1590,6 +1617,18 @@ ops.OperationTransformMatrix = function OperationTransformMatrix() { "UpdateMetadata": passUnchanged, "UpdateParagraphStyle": passUnchanged }, + "RemoveAnnotation": { +// "RemoveAnnotation": passUnchanged, + "RemoveCursor": passUnchanged, + "RemoveMember": passUnchanged, + "RemoveStyle": passUnchanged, +// "RemoveText": passUnchanged, + "SetParagraphStyle": passUnchanged, +// "SplitParagraph": passUnchanged, + "UpdateMember": passUnchanged, + "UpdateMetadata": passUnchanged, + "UpdateParagraphStyle": passUnchanged + }, "RemoveCursor": { "RemoveCursor": transformRemoveCursorRemoveCursor, "RemoveMember": passUnchanged, diff --git a/webodf/tests/ops/TransformationTests.js b/webodf/tests/ops/TransformationTests.js index 26690fc1..93ebeb0f 100644 --- a/webodf/tests/ops/TransformationTests.js +++ b/webodf/tests/ops/TransformationTests.js @@ -590,9 +590,27 @@ ops.TransformationTests = function TransformationTests(runner) { }; /*jslint emptyblock: true*/ - this.setUps = { - }; + function linkAnnotationEndToStart() { + return { + setUp: function () { + var rootElement = t.odfContainer.rootElement, + annotation = rootElement.getElementsByTagNameNS(odf.Namespaces.officens, "annotation")[0], + annotationEnd = rootElement.getElementsByTagNameNS(odf.Namespaces.officens, "annotation-end")[0]; + annotation.annotationEndElement = annotationEnd; + }, + tearDown: function () {} + }; + } /*jslint emptyblock: false*/ + + this.setUps = { + "RemoveAnnotationAddCursor" : linkAnnotationEndToStart, + "RemoveAnnotationAddStyle" : linkAnnotationEndToStart, + "RemoveAnnotationRemoveCursor" : linkAnnotationEndToStart, + "RemoveAnnotationRemoveStyle" : linkAnnotationEndToStart, + "RemoveAnnotationUpdateMetadata" : linkAnnotationEndToStart, + "RemoveAnnotationUpdateParagraphStyle" : linkAnnotationEndToStart + }; }; ops.TransformationTests.prototype.description = function () { diff --git a/webodf/tests/ops/transformationtests.xml b/webodf/tests/ops/transformationtests.xml index cae358a0..722185e8 100644 --- a/webodf/tests/ops/transformationtests.xml +++ b/webodf/tests/ops/transformationtests.xml @@ -1989,4 +1989,342 @@ 2013-08-05T12:34:07.061Z + + + + + ab + + + + + + + + + + + + + Alice + 2013-08-05T12:34:07.061Z + + + + + + ab + + + + + + + + ab + + + + + + + + + + + + + + Alice + 2013-08-05T12:34:07.061Z + + + + + + ab + + + + + + + ab + + + + + + + + + + + + + + Alice + 2013-08-05T12:34:07.061Z + + + + + + ab + + + + + + + + ab + + + + + + + + + + + + + + Alice + 2013-08-05T12:34:07.061Z + + + + + + ab + + + + + + Eve2013-08-05T12:34:07.061Z + + ab + + + + + + + + + + + Bob2013-08-05T12:34:07.061Z + + + Alice + 2013-08-05T12:34:07.061Z + + + + + + ab + + + + + + + + ab + + + + + + + + + + + + + + Alice + 2013-08-05T12:34:07.061Z + + + + + + ab + + + + + + + + + Alice + 2013-08-05T12:34:07.061Z + + + + + + ab + + + + + + + + + + + ab + + + + + + + + + Alice + 2013-08-05T12:34:07.061Z + + + + + + ab + + + + + + + + + + + + ab + + + + + + + + Alice + 2013-08-05T12:34:07.061Z + + + + + + ab + + + + + + + + + + + + ab + + + + + + + + + Alice + 2013-08-05T12:34:07.061Z + + + + + + ab + + + + + + + + + + + + ab + + + + + + Eve2013-08-05T12:34:07.061Z + + + Alice + 2013-08-05T12:34:07.061Z + + + + + + ab + + + + + + + + + + Bob2013-08-05T12:34:07.061Z + + ab + + + + + + + + + Alice + 2013-08-05T12:34:07.061Z + + + + + + ab + + + + + + + + + + + + ab + + + From db51dfdfe8c4c005d65f09d1c9ab39af824b0729 Mon Sep 17 00:00:00 2001 From: "Friedrich W. H. Kossebau" Date: Wed, 18 Mar 2015 18:24:10 +0100 Subject: [PATCH 03/24] Add transformAddAnnotationInsertText --- webodf/lib/manifest.json | 1 + webodf/lib/ops/OperationTransformMatrix.js | 28 ++- webodf/tests/ops/transformationtests.xml | 216 +++++++++++++++++++++ 3 files changed, 243 insertions(+), 2 deletions(-) diff --git a/webodf/lib/manifest.json b/webodf/lib/manifest.json index bfd636c5..c77685bd 100644 --- a/webodf/lib/manifest.json +++ b/webodf/lib/manifest.json @@ -505,6 +505,7 @@ "ops.OperationFactory" ], "ops.OperationTransformMatrix": [ + "ops.OpAddAnnotation", "ops.OpAddStyle", "ops.OpApplyDirectStyling", "ops.OpInsertText", diff --git a/webodf/lib/ops/OperationTransformMatrix.js b/webodf/lib/ops/OperationTransformMatrix.js index 5088a2d0..c1be6796 100644 --- a/webodf/lib/ops/OperationTransformMatrix.js +++ b/webodf/lib/ops/OperationTransformMatrix.js @@ -273,6 +273,30 @@ ops.OperationTransformMatrix = function OperationTransformMatrix() { /* Transformation methods */ + /** + * @param {!ops.OpAddAnnotation.Spec} addAnnotationSpec + * @param {!ops.OpInsertText.Spec} insertTextSpec + * @return {?{opSpecsA:!Array., opSpecsB:!Array.}} + */ + function transformAddAnnotationInsertText(addAnnotationSpec, insertTextSpec) { + if (insertTextSpec.position <= addAnnotationSpec.position) { + addAnnotationSpec.position += insertTextSpec.text.length; + } else { + if (addAnnotationSpec.length) { + if (insertTextSpec.position <= addAnnotationSpec.position + addAnnotationSpec.length) { + addAnnotationSpec.length += 1; + } + } + // 2, because 1 for pos inside annotation comment, 1 for new pos before annotated range + insertTextSpec.position += 2; + } + + return { + opSpecsA: [addAnnotationSpec], + opSpecsB: [insertTextSpec] + }; + } + /** * @param {!ops.OpAddStyle.Spec} addStyleSpec * @param {!ops.OpRemoveStyle.Spec} removeStyleSpec @@ -1494,7 +1518,7 @@ ops.OperationTransformMatrix = function OperationTransformMatrix() { "AddMember": passUnchanged, "AddStyle": passUnchanged, // "ApplyDirectStyling": passUnchanged, -// "InsertText": passUnchanged, + "InsertText": transformAddAnnotationInsertText, // "MergeParagraph": passUnchanged, // "MoveCursor": passUnchanged, // "RemoveAnnotation": passUnchanged, @@ -1623,7 +1647,7 @@ ops.OperationTransformMatrix = function OperationTransformMatrix() { "RemoveMember": passUnchanged, "RemoveStyle": passUnchanged, // "RemoveText": passUnchanged, - "SetParagraphStyle": passUnchanged, +// "SetParagraphStyle": passUnchanged, // "SplitParagraph": passUnchanged, "UpdateMember": passUnchanged, "UpdateMetadata": passUnchanged, diff --git a/webodf/tests/ops/transformationtests.xml b/webodf/tests/ops/transformationtests.xml index 722185e8..3ac3afa9 100644 --- a/webodf/tests/ops/transformationtests.xml +++ b/webodf/tests/ops/transformationtests.xml @@ -2046,6 +2046,222 @@ + + + + abc + + + + + + + + + + + + Va + Alice + 2013-08-05T12:34:07.061Z + + + + + + bc + + + + + + + abc + + + + + + + + + + + + Va + Alice + 2013-08-05T12:34:07.061Z + + + + + + bc + + + + + + + abc + + + + + + + + + + + + aV + Alice + 2013-08-05T12:34:07.061Z + + + + + + bc + + + + + + + abc + + + + + + + + + + + + aV + Alice + 2013-08-05T12:34:07.061Z + + + + + + bc + + + + + + + abcd + + + + + + + + + + + + a + Alice + 2013-08-05T12:34:07.061Z + + + + + + bVcd + + + + + + + abc + + + + + + + + + + + + a + Alice + 2013-08-05T12:34:07.061Z + + + + + + bVc + + + + + + + abc + + + + + + + + + + + + a + Alice + 2013-08-05T12:34:07.061Z + + + + + + bcV + + + + + + + abc + + + + + + + + + + + + a + Alice + 2013-08-05T12:34:07.061Z + + + + + + bcV + + + From f9f24a6fcc28518456710f1c076dab52355408be Mon Sep 17 00:00:00 2001 From: "Friedrich W. H. Kossebau" Date: Wed, 18 Mar 2015 22:26:39 +0100 Subject: [PATCH 04/24] Add transformAddAnnotationMoveCursor --- webodf/lib/ops/OperationTransformMatrix.js | 29 +- webodf/tests/ops/transformationtests.xml | 896 +++++++++++++++++++++ 2 files changed, 924 insertions(+), 1 deletion(-) diff --git a/webodf/lib/ops/OperationTransformMatrix.js b/webodf/lib/ops/OperationTransformMatrix.js index c1be6796..74d36edc 100644 --- a/webodf/lib/ops/OperationTransformMatrix.js +++ b/webodf/lib/ops/OperationTransformMatrix.js @@ -297,6 +297,33 @@ ops.OperationTransformMatrix = function OperationTransformMatrix() { }; } + /** + * @param {!ops.OpAddAnnotation.Spec} addAnnotationSpec + * @param {!ops.OpMoveCursor.Spec} moveCursorSpec + * @return {?{opSpecsA:!Array., opSpecsB:!Array.}} + */ + function transformAddAnnotationMoveCursor(addAnnotationSpec, moveCursorSpec) { + var isMoveCursorSpecRangeInverted = invertMoveCursorSpecRangeOnNegativeLength(moveCursorSpec); + + // adapt movecursor spec to inserted positions + if (addAnnotationSpec.position < moveCursorSpec.position) { + // 2, because 1 for pos inside annotation comment, 1 for new pos before annotated range + moveCursorSpec.position += 2; + } else if (addAnnotationSpec.position < moveCursorSpec.position + moveCursorSpec.length) { + // 2, because 1 for pos inside annotation comment, 1 for new pos before annotated range + moveCursorSpec.length += 2; + } + + if (isMoveCursorSpecRangeInverted) { + invertMoveCursorSpecRange(moveCursorSpec); + } + + return { + opSpecsA: [addAnnotationSpec], + opSpecsB: [moveCursorSpec] + }; + } + /** * @param {!ops.OpAddStyle.Spec} addStyleSpec * @param {!ops.OpRemoveStyle.Spec} removeStyleSpec @@ -1520,7 +1547,7 @@ ops.OperationTransformMatrix = function OperationTransformMatrix() { // "ApplyDirectStyling": passUnchanged, "InsertText": transformAddAnnotationInsertText, // "MergeParagraph": passUnchanged, -// "MoveCursor": passUnchanged, + "MoveCursor": transformAddAnnotationMoveCursor, // "RemoveAnnotation": passUnchanged, "RemoveCursor": passUnchanged, "RemoveMember": passUnchanged, diff --git a/webodf/tests/ops/transformationtests.xml b/webodf/tests/ops/transformationtests.xml index 3ac3afa9..ed676c19 100644 --- a/webodf/tests/ops/transformationtests.xml +++ b/webodf/tests/ops/transformationtests.xml @@ -2262,6 +2262,902 @@ + + + + abc + + + + + + + + + + + + + a + Alice + 2013-08-05T12:34:07.061Z + + + + + + bc + + + + + + + abc + + + + + + + + + + + + + a + Alice + 2013-08-05T12:34:07.061Z + + + + + + bc + + + + + + + abc + + + + + + + + + + + + + a + Alice + 2013-08-05T12:34:07.061Z + + + + + + bc + + + + + + + abc + + + + + + + + + + + + + a + Alice + 2013-08-05T12:34:07.061Z + + + + + + bc + + + + + + + abcd + + + + + + + + + + + + + a + Alice + 2013-08-05T12:34:07.061Z + + + + + + bcd + + + + + + + abcd + + + + + + + + + + + + + a + Alice + 2013-08-05T12:34:07.061Z + + + + + + bcd + + + + + + + abcd + + + + + + + + + + + + + a + Alice + 2013-08-05T12:34:07.061Z + + + + + + bcd + + + + + + + abcd + + + + + + + + + + + + + a + Alice + 2013-08-05T12:34:07.061Z + + + + + + bcd + + + + + + + abc + + + + + + + + + + + + + a + Alice + 2013-08-05T12:34:07.061Z + + + + + + bc + + + + + + + abc + + + + + + + + + + + + + a + Alice + 2013-08-05T12:34:07.061Z + + + + + + bc + + + + + + + abcd + + + + + + + + + + + + + a + Alice + 2013-08-05T12:34:07.061Z + + + + + + bcd + + + + + + + abcd + + + + + + + + + + + + + a + Alice + 2013-08-05T12:34:07.061Z + + + + + + bcd + + + + + + + abcd + + + + + + + + + + + + + a + Alice + 2013-08-05T12:34:07.061Z + + + + + + bcd + + + + + + + abcd + + + + + + + + + + + + + a + Alice + 2013-08-05T12:34:07.061Z + + + + + + bcd + + + + + + + abcd + + + + + + + + + + + + + a + Alice + 2013-08-05T12:34:07.061Z + + + + + + bcd + + + + + + + abcd + + + + + + + + + + + + + a + Alice + 2013-08-05T12:34:07.061Z + + + + + + bcd + + + + + + + abcd + + + + + + + + + + + + + a + Alice + 2013-08-05T12:34:07.061Z + + + + + + bcd + + + + + + + abcd + + + + + + + + + + + + + a + Alice + 2013-08-05T12:34:07.061Z + + + + + + bcd + + + + + + + abcd + + + + + + + + + + + + + a + Alice + 2013-08-05T12:34:07.061Z + + + + + + bcd + + + + + + + abc + + + + + + + + + + + + + a + Alice + 2013-08-05T12:34:07.061Z + + + + + + bc + + + + + + + abc + + + + + + + + + + + + + a + Alice + 2013-08-05T12:34:07.061Z + + + + + + bc + + + + + + + abcd + + + + + + + + + + + + + a + Alice + 2013-08-05T12:34:07.061Z + + + + + + bcd + + + + + + + abcd + + + + + + + + + + + + + a + Alice + 2013-08-05T12:34:07.061Z + + + + + + bcd + + + + + + + abcd + + + + + + + + + + + + + a + Alice + 2013-08-05T12:34:07.061Z + + + + + + bcd + + + + + + + abc + + + + + + + + + + + + + a + Alice + 2013-08-05T12:34:07.061Z + + + + + + bc + + + + + + + abc + + + + + + + + + + + + + a + Alice + 2013-08-05T12:34:07.061Z + + + + + + bc + + + + + + + abc + + + + + + + + + + + + + a + Alice + 2013-08-05T12:34:07.061Z + + + + + + bc + + + + + + + abcd + + + + + + + + + + + + + a + Alice + 2013-08-05T12:34:07.061Z + + + + + + bcd + + + + + + + abcd + + + + + + + + + + + + + a + Alice + 2013-08-05T12:34:07.061Z + + + + + + bcd + + + + + + + abcd + + + + + + + + + + + + + a + Alice + 2013-08-05T12:34:07.061Z + + + + + + bcd + + + + + + + abcd + + + + + + + + + + + + + a + Alice + 2013-08-05T12:34:07.061Z + + + + + + bcd + + + + + + + abcd + + + + + + + + + + + + + a + Alice + 2013-08-05T12:34:07.061Z + + + + + + bcd + + + From bf89109feb06012261ce9a4b92996db8bd7aa896 Mon Sep 17 00:00:00 2001 From: "Friedrich W. H. Kossebau" Date: Thu, 19 Mar 2015 13:30:00 +0100 Subject: [PATCH 05/24] Add transformAddAnnotationSplitParagraph --- webodf/lib/ops/OperationTransformMatrix.js | 30 ++- webodf/tests/ops/transformationtests.xml | 216 +++++++++++++++++++++ 2 files changed, 245 insertions(+), 1 deletion(-) diff --git a/webodf/lib/ops/OperationTransformMatrix.js b/webodf/lib/ops/OperationTransformMatrix.js index 74d36edc..c9cbf27c 100644 --- a/webodf/lib/ops/OperationTransformMatrix.js +++ b/webodf/lib/ops/OperationTransformMatrix.js @@ -324,6 +324,34 @@ ops.OperationTransformMatrix = function OperationTransformMatrix() { }; } + /** + * @param {!ops.OpAddAnnotation.Spec} addAnnotationSpec + * @param {!ops.OpSplitParagraph.Spec} splitParagraphSpec + * @return {?{opSpecsA:!Array., opSpecsB:!Array.}} + */ + function transformAddAnnotationSplitParagraph(addAnnotationSpec, splitParagraphSpec) { + if (addAnnotationSpec.position < splitParagraphSpec.sourceParagraphPosition) { + splitParagraphSpec.sourceParagraphPosition += 2; + } + + if (splitParagraphSpec.position <= addAnnotationSpec.position) { + addAnnotationSpec.position += 1; + } else { + if (addAnnotationSpec.length) { + if (splitParagraphSpec.position <= addAnnotationSpec.position + addAnnotationSpec.length) { + addAnnotationSpec.length += 1; + } + } + // 2, because 1 for pos inside annotation comment, 1 for new pos before annotated range + splitParagraphSpec.position += 2; + } + + return { + opSpecsA: [addAnnotationSpec], + opSpecsB: [splitParagraphSpec] + }; + } + /** * @param {!ops.OpAddStyle.Spec} addStyleSpec * @param {!ops.OpRemoveStyle.Spec} removeStyleSpec @@ -1554,7 +1582,7 @@ ops.OperationTransformMatrix = function OperationTransformMatrix() { "RemoveStyle": passUnchanged, // "RemoveText": passUnchanged, // "SetParagraphStyle": passUnchanged, -// "SplitParagraph": passUnchanged, + "SplitParagraph": transformAddAnnotationSplitParagraph, "UpdateMember": passUnchanged, "UpdateMetadata": passUnchanged, "UpdateParagraphStyle": passUnchanged diff --git a/webodf/tests/ops/transformationtests.xml b/webodf/tests/ops/transformationtests.xml index ed676c19..6c42921e 100644 --- a/webodf/tests/ops/transformationtests.xml +++ b/webodf/tests/ops/transformationtests.xml @@ -3215,6 +3215,222 @@ + + + + abc + + + + + + + + + + + + a + Alice + 2013-08-05T12:34:07.061Z + + + + + + bc + + + + + + + abc + + + + + + + + + + + + a + Alice + 2013-08-05T12:34:07.061Z + + + + + + bc + + + + + + + abc + + + + + + + + + + + + a + Alice + 2013-08-05T12:34:07.061Z + + + + + + bc + + + + + + + abc + + + + + + + + + + + + a + Alice + 2013-08-05T12:34:07.061Z + + + + + + bc + + + + + + + abcd + + + + + + + + + + + + a + Alice + 2013-08-05T12:34:07.061Z + + + + + + bcd + + + + + + + abc + + + + + + + + + + + + a + Alice + 2013-08-05T12:34:07.061Z + + + + + + bc + + + + + + + abc + + + + + + + + + + + + a + Alice + 2013-08-05T12:34:07.061Z + + + + + + bc + + + + + + + abc + + + + + + + + + + + + a + Alice + 2013-08-05T12:34:07.061Z + + + + + + bc + + + Eve2013-08-05T12:34:07.061Z From f156d9e27a0b2ef1f348ac73970c5068e583a2a9 Mon Sep 17 00:00:00 2001 From: "Friedrich W. H. Kossebau" Date: Thu, 19 Mar 2015 15:27:13 +0100 Subject: [PATCH 06/24] Add transformAddAnnotationSetParagraphStyle --- webodf/lib/ops/OperationTransformMatrix.js | 18 +- webodf/tests/ops/transformationtests.xml | 207 ++++++++++++++++++++- 2 files changed, 217 insertions(+), 8 deletions(-) diff --git a/webodf/lib/ops/OperationTransformMatrix.js b/webodf/lib/ops/OperationTransformMatrix.js index c9cbf27c..ae124344 100644 --- a/webodf/lib/ops/OperationTransformMatrix.js +++ b/webodf/lib/ops/OperationTransformMatrix.js @@ -324,6 +324,22 @@ ops.OperationTransformMatrix = function OperationTransformMatrix() { }; } + /** + * @param {!ops.OpAddAnnotation.Spec} addAnnotationSpec + * @param {!ops.OpSetParagraphStyle.Spec} setParagraphStyleSpec + * @return {?{opSpecsA:!Array., opSpecsB:!Array.}} + */ + function transformAddAnnotationSetParagraphStyle(addAnnotationSpec, setParagraphStyleSpec) { + if (addAnnotationSpec.position < setParagraphStyleSpec.position) { + setParagraphStyleSpec.position += 2; + } + + return { + opSpecsA: [addAnnotationSpec], + opSpecsB: [setParagraphStyleSpec] + }; + } + /** * @param {!ops.OpAddAnnotation.Spec} addAnnotationSpec * @param {!ops.OpSplitParagraph.Spec} splitParagraphSpec @@ -1581,7 +1597,7 @@ ops.OperationTransformMatrix = function OperationTransformMatrix() { "RemoveMember": passUnchanged, "RemoveStyle": passUnchanged, // "RemoveText": passUnchanged, -// "SetParagraphStyle": passUnchanged, + "SetParagraphStyle": transformAddAnnotationSetParagraphStyle, "SplitParagraph": transformAddAnnotationSplitParagraph, "UpdateMember": passUnchanged, "UpdateMetadata": passUnchanged, diff --git a/webodf/tests/ops/transformationtests.xml b/webodf/tests/ops/transformationtests.xml index 6c42921e..ebd3d458 100644 --- a/webodf/tests/ops/transformationtests.xml +++ b/webodf/tests/ops/transformationtests.xml @@ -2017,6 +2017,7 @@ + @@ -2046,6 +2047,7 @@ + @@ -2262,6 +2264,7 @@ + @@ -2934,7 +2937,7 @@ - + abc @@ -2990,7 +2993,7 @@ - + abc @@ -3018,7 +3021,7 @@ - + abcd @@ -3046,7 +3049,7 @@ - + abcd @@ -3074,7 +3077,7 @@ - + abcd @@ -3102,7 +3105,7 @@ - + abcd @@ -3130,7 +3133,7 @@ - + abcd @@ -3158,6 +3161,7 @@ + @@ -3186,6 +3190,7 @@ + @@ -3215,6 +3220,192 @@ + + + + abc + + + + + + + + + + a + Alice + 2013-08-05T12:34:07.061Z + + + + + + bc + + + + + abc + + + + + + + + + + a + Alice + 2013-08-05T12:34:07.061Z + + + + + + bc + + + + + abc + + + + + + + + + + + Alice + 2013-08-05T12:34:07.061Z + + + + + + abc + + + + + abc + + + + + + + + + + + Alice + 2013-08-05T12:34:07.061Z + + + + + + abc + + + + + abc + + + + + + + + + + a + Alice + 2013-08-05T12:34:07.061Z + + + + + + bc + + + + + ab + + + + + + + + + + a + Alice + 2013-08-05T12:34:07.061Z + + + + + + b + + + + + ab + + + + + + + + + + a + Alice + 2013-08-05T12:34:07.061Z + + + + + + b + + + + + ab + + + + + + + + + + a + Alice + 2013-08-05T12:34:07.061Z + + + + + + b + + + @@ -3431,6 +3622,7 @@ + Eve2013-08-05T12:34:07.061Z @@ -3460,6 +3652,7 @@ + From 63c19e91a06f224e171404eb542c49d206b365b5 Mon Sep 17 00:00:00 2001 From: "Friedrich W. H. Kossebau" Date: Thu, 19 Mar 2015 18:19:17 +0100 Subject: [PATCH 07/24] Add transformAddAnnotationApplyDirectStyling --- webodf/lib/ops/OperationTransformMatrix.js | 20 +- webodf/tests/ops/transformationtests.xml | 490 +++++++++++++++++++++ 2 files changed, 509 insertions(+), 1 deletion(-) diff --git a/webodf/lib/ops/OperationTransformMatrix.js b/webodf/lib/ops/OperationTransformMatrix.js index ae124344..da17cc07 100644 --- a/webodf/lib/ops/OperationTransformMatrix.js +++ b/webodf/lib/ops/OperationTransformMatrix.js @@ -273,6 +273,24 @@ ops.OperationTransformMatrix = function OperationTransformMatrix() { /* Transformation methods */ + /** + * @param {!ops.OpAddAnnotation.Spec} addAnnotationSpec + * @param {!ops.OpApplyDirectStyling.Spec} applyDirectStylingSpec + * @return {?{opSpecsA:!Array., opSpecsB:!Array.}} + */ + function transformAddAnnotationApplyDirectStyling(addAnnotationSpec, applyDirectStylingSpec) { + if (addAnnotationSpec.position <= applyDirectStylingSpec.position) { + applyDirectStylingSpec.position += 2; + } else if (addAnnotationSpec.position <= applyDirectStylingSpec.position + applyDirectStylingSpec.length) { + applyDirectStylingSpec.length += 2; + } + + return { + opSpecsA: [addAnnotationSpec], + opSpecsB: [applyDirectStylingSpec] + }; + } + /** * @param {!ops.OpAddAnnotation.Spec} addAnnotationSpec * @param {!ops.OpInsertText.Spec} insertTextSpec @@ -1588,7 +1606,7 @@ ops.OperationTransformMatrix = function OperationTransformMatrix() { "AddCursor": passUnchanged, "AddMember": passUnchanged, "AddStyle": passUnchanged, -// "ApplyDirectStyling": passUnchanged, + "ApplyDirectStyling": transformAddAnnotationApplyDirectStyling, "InsertText": transformAddAnnotationInsertText, // "MergeParagraph": passUnchanged, "MoveCursor": transformAddAnnotationMoveCursor, diff --git a/webodf/tests/ops/transformationtests.xml b/webodf/tests/ops/transformationtests.xml index ebd3d458..13f66b08 100644 --- a/webodf/tests/ops/transformationtests.xml +++ b/webodf/tests/ops/transformationtests.xml @@ -2048,6 +2048,496 @@ + + + + abcd + + + + + + + + + + + + + ab + Alice + 2013-08-05T12:34:07.061Z + + + + + + cd + + + + + + abcd + + + + + + + + + + + + + ab + Alice + 2013-08-05T12:34:07.061Z + + + + + + cd + + + + + + abcd + + + + + + + + + + + + + a + Alice + 2013-08-05T12:34:07.061Z + + + + + + bcd + + + + + + abcd + + + + + + + + + + + + + a + Alice + 2013-08-05T12:34:07.061Z + + + + + + bcd + + + + + + abcd + + + + + + + + + + + + + a + Alice + 2013-08-05T12:34:07.061Z + + + + + + bcd + + + + + + abcd + + + + + + + + + + + + + a + Alice + 2013-08-05T12:34:07.061Z + + + + + + bcd + + + + fails, because the order of office:annotation-end and /text:span is random, needs to be defined + + + abcd + + + + + + + + + + + + + a + Alice + 2013-08-05T12:34:07.061Z + + + + + + bcd + + + + + + abcd + + + + + + + + + + + + + a + Alice + 2013-08-05T12:34:07.061Z + + + + + + bcd + + + + + + abcd + + + + + + + + + + + + + a + Alice + 2013-08-05T12:34:07.061Z + + + + + + bcd + + + + + + abcd + + + + + + + + + + + + + a + Alice + 2013-08-05T12:34:07.061Z + + + + + + bcd + + + + fails, because the order of office:annotation-end and /text:span is random, needs to be defined + + + abcd + + + + + + + + + + + + + a + Alice + 2013-08-05T12:34:07.061Z + + + + + + bcd + + + + + + abcd + + + + + + + + + + + + + a + Alice + 2013-08-05T12:34:07.061Z + + + + + + bcd + + + + + + abcd + + + + + + + + + + + + + a + Alice + 2013-08-05T12:34:07.061Z + + + + + + bcd + + + + + + abcd + + + + + + + + + + + + + a + Alice + 2013-08-05T12:34:07.061Z + + + + + + bcd + + + + fails, because the order of office:annotation-end and /text:span is random, needs to be defined + + + abcd + + + + + + + + + + + + + a + Alice + 2013-08-05T12:34:07.061Z + + + + + + bcd + + + + + + abcd + + + + + + + + + + + + + a + Alice + 2013-08-05T12:34:07.061Z + + + + + + bcd + + + + + + abcd + + + + + + + + + + + + + a + Alice + 2013-08-05T12:34:07.061Z + + + + + + bcd + + + + + + abcd + + + + + + + + + + + + + a + Alice + 2013-08-05T12:34:07.061Z + + + + + + bcd + + + From 7d5bdf27dd995678365adad2c0a57771e0cc67a1 Mon Sep 17 00:00:00 2001 From: "Friedrich W. H. Kossebau" Date: Thu, 19 Mar 2015 19:29:53 +0100 Subject: [PATCH 08/24] fixup transformAddAnnotationInsertText --- webodf/lib/ops/OperationTransformMatrix.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/webodf/lib/ops/OperationTransformMatrix.js b/webodf/lib/ops/OperationTransformMatrix.js index da17cc07..3a87ca6f 100644 --- a/webodf/lib/ops/OperationTransformMatrix.js +++ b/webodf/lib/ops/OperationTransformMatrix.js @@ -302,7 +302,7 @@ ops.OperationTransformMatrix = function OperationTransformMatrix() { } else { if (addAnnotationSpec.length) { if (insertTextSpec.position <= addAnnotationSpec.position + addAnnotationSpec.length) { - addAnnotationSpec.length += 1; + addAnnotationSpec.length += insertTextSpec.text.length; } } // 2, because 1 for pos inside annotation comment, 1 for new pos before annotated range From f4b49d8993b69d3aa3753baf9e8db510a2039bb0 Mon Sep 17 00:00:00 2001 From: "Friedrich W. H. Kossebau" Date: Fri, 20 Mar 2015 17:44:08 +0100 Subject: [PATCH 09/24] add transformAddAnnotationMergeParagraph --- webodf/lib/ops/OperationTransformMatrix.js | 31 ++- webodf/tests/ops/transformationtests.xml | 298 +++++++++++++++++++++ 2 files changed, 328 insertions(+), 1 deletion(-) diff --git a/webodf/lib/ops/OperationTransformMatrix.js b/webodf/lib/ops/OperationTransformMatrix.js index 3a87ca6f..5ab46019 100644 --- a/webodf/lib/ops/OperationTransformMatrix.js +++ b/webodf/lib/ops/OperationTransformMatrix.js @@ -315,6 +315,35 @@ ops.OperationTransformMatrix = function OperationTransformMatrix() { }; } + /** + * @param {!ops.OpAddAnnotation.Spec} addAnnotationSpec + * @param {!ops.OpMergeParagraph.Spec} mergeParagraphSpec + * @return {?{opSpecsA:!Array., opSpecsB:!Array.}} + */ + function transformAddAnnotationMergeParagraph(addAnnotationSpec, mergeParagraphSpec) { + if (mergeParagraphSpec.sourceStartPosition <= addAnnotationSpec.position) { + addAnnotationSpec.position -= 1; + } else { + if (addAnnotationSpec.length) { + if (mergeParagraphSpec.sourceStartPosition <= addAnnotationSpec.position + addAnnotationSpec.length) { + addAnnotationSpec.length -= 1; + } + } + + // 2, because 1 for pos inside annotation comment, 1 for new pos before annotated range + mergeParagraphSpec.sourceStartPosition += 2; + + if (addAnnotationSpec.position < mergeParagraphSpec.destinationStartPosition) { + mergeParagraphSpec.destinationStartPosition += 2; + } + } + + return { + opSpecsA: [addAnnotationSpec], + opSpecsB: [mergeParagraphSpec] + }; + } + /** * @param {!ops.OpAddAnnotation.Spec} addAnnotationSpec * @param {!ops.OpMoveCursor.Spec} moveCursorSpec @@ -1608,7 +1637,7 @@ ops.OperationTransformMatrix = function OperationTransformMatrix() { "AddStyle": passUnchanged, "ApplyDirectStyling": transformAddAnnotationApplyDirectStyling, "InsertText": transformAddAnnotationInsertText, -// "MergeParagraph": passUnchanged, + "MergeParagraph": transformAddAnnotationMergeParagraph, "MoveCursor": transformAddAnnotationMoveCursor, // "RemoveAnnotation": passUnchanged, "RemoveCursor": passUnchanged, diff --git a/webodf/tests/ops/transformationtests.xml b/webodf/tests/ops/transformationtests.xml index 13f66b08..53e95097 100644 --- a/webodf/tests/ops/transformationtests.xml +++ b/webodf/tests/ops/transformationtests.xml @@ -2755,6 +2755,304 @@ + + + + abcd + + + + + + + + + + + + ab + Alice + 2013-08-05T12:34:07.061Z + + + + + + cd + + + + + + + abcd + + + + + + + + + + + + ab + Alice + 2013-08-05T12:34:07.061Z + + + + + + cd + + + + + + + abc + + + + + + + + + + + + a + Alice + 2013-08-05T12:34:07.061Z + + + + + + bc + + + + + + + abc + + + + + + + + + + + + a + Alice + 2013-08-05T12:34:07.061Z + + + + + + bc + + + + + + + abcd + + + + + + + + + + + + a + Alice + 2013-08-05T12:34:07.061Z + + + + + + bcd + + + + + + + abcd + + + + + + + + + + + + a + Alice + 2013-08-05T12:34:07.061Z + + + + + + bcd + + + + + + + abcd + + + + + + + + + + + + a + Alice + 2013-08-05T12:34:07.061Z + + + + + + bcd + + + + + + + abcd + + + + + + + + + + + + a + Alice + 2013-08-05T12:34:07.061Z + + + + + + bcd + + + + + + + abc + + + + + + + + + + + + a + Alice + 2013-08-05T12:34:07.061Z + + + + + + bc + + + + + + + abc + + + + + + + + + + + + a + Alice + 2013-08-05T12:34:07.061Z + + + + + + bc + + + + + + + abcd + + + + + + + + + + + + a + Alice + 2013-08-05T12:34:07.061Z + + + + + + bcd + + + + From a23d98a53f77aabb79f5e07a26abe23d00efa102 Mon Sep 17 00:00:00 2001 From: "Friedrich W. H. Kossebau" Date: Tue, 24 Mar 2015 12:36:56 +0100 Subject: [PATCH 10/24] Add transformAddAnnotationRemoveText --- webodf/lib/ops/OperationTransformMatrix.js | 63 ++- webodf/tests/ops/transformationtests.xml | 487 +++++++++++++++++++++ 2 files changed, 546 insertions(+), 4 deletions(-) diff --git a/webodf/lib/ops/OperationTransformMatrix.js b/webodf/lib/ops/OperationTransformMatrix.js index 5ab46019..b3519e70 100644 --- a/webodf/lib/ops/OperationTransformMatrix.js +++ b/webodf/lib/ops/OperationTransformMatrix.js @@ -300,7 +300,7 @@ ops.OperationTransformMatrix = function OperationTransformMatrix() { if (insertTextSpec.position <= addAnnotationSpec.position) { addAnnotationSpec.position += insertTextSpec.text.length; } else { - if (addAnnotationSpec.length) { + if (addAnnotationSpec.length !== undefined) { if (insertTextSpec.position <= addAnnotationSpec.position + addAnnotationSpec.length) { addAnnotationSpec.length += insertTextSpec.text.length; } @@ -324,7 +324,7 @@ ops.OperationTransformMatrix = function OperationTransformMatrix() { if (mergeParagraphSpec.sourceStartPosition <= addAnnotationSpec.position) { addAnnotationSpec.position -= 1; } else { - if (addAnnotationSpec.length) { + if (addAnnotationSpec.length !== undefined) { if (mergeParagraphSpec.sourceStartPosition <= addAnnotationSpec.position + addAnnotationSpec.length) { addAnnotationSpec.length -= 1; } @@ -371,6 +371,61 @@ ops.OperationTransformMatrix = function OperationTransformMatrix() { }; } + /** + * @param {!ops.OpAddAnnotation.Spec} addAnnotationSpec + * @param {!ops.OpRemoveText.Spec} removeTextSpec + * @return {?{opSpecsA:!Array., opSpecsB:!Array.}} + */ + function transformAddAnnotationRemoveText(addAnnotationSpec, removeTextSpec) { + var removeTextSpecPosition = removeTextSpec.position, + removeTextSpecEnd = removeTextSpec.position + removeTextSpec.length, + annotationSpecEnd, + helperOpspec, + addAnnotationSpecResult = [addAnnotationSpec], + removeTextSpecResult = [removeTextSpec]; + + // adapt removeTextSpec + if (addAnnotationSpec.position <= removeTextSpec.position) { + // 2, because 1 for pos inside annotation comment, 1 for new pos before annotated range + removeTextSpec.position += 2; + } else if (addAnnotationSpec.position < removeTextSpecEnd) { + // we have to split the removal into two ops, before and after the annotation start + removeTextSpec.length = addAnnotationSpec.position - removeTextSpec.position; + helperOpspec = { + optype: "RemoveText", + memberid: removeTextSpec.memberid, + timestamp: removeTextSpec.timestamp, + position: addAnnotationSpec.position + 2, + length: removeTextSpecEnd - addAnnotationSpec.position + }; + removeTextSpecResult.unshift(helperOpspec); // helperOp first, so its position is not affected by the real op + } + + // adapt addAnnotationSpec (using already changed removeTextSpec and new helperOpspec, be aware) + if (removeTextSpec.position + removeTextSpec.length <= addAnnotationSpec.position) { + addAnnotationSpec.position -= removeTextSpec.length; + if ((addAnnotationSpec.length !== undefined) && helperOpspec) { + if (helperOpspec.length >= addAnnotationSpec.length) { + addAnnotationSpec.length = 0; + } else { + addAnnotationSpec.length -= helperOpspec.length; + } + } + } else if (addAnnotationSpec.length !== undefined) { + annotationSpecEnd = addAnnotationSpec.position + addAnnotationSpec.length; + if (removeTextSpecEnd <= annotationSpecEnd) { + addAnnotationSpec.length -= removeTextSpec.length; + } else if (removeTextSpecPosition < annotationSpecEnd) { + addAnnotationSpec.length = removeTextSpecPosition - addAnnotationSpec.position; + } + } + + return { + opSpecsA: addAnnotationSpecResult, + opSpecsB: removeTextSpecResult + }; + } + /** * @param {!ops.OpAddAnnotation.Spec} addAnnotationSpec * @param {!ops.OpSetParagraphStyle.Spec} setParagraphStyleSpec @@ -400,7 +455,7 @@ ops.OperationTransformMatrix = function OperationTransformMatrix() { if (splitParagraphSpec.position <= addAnnotationSpec.position) { addAnnotationSpec.position += 1; } else { - if (addAnnotationSpec.length) { + if (addAnnotationSpec.length !== undefined) { if (splitParagraphSpec.position <= addAnnotationSpec.position + addAnnotationSpec.length) { addAnnotationSpec.length += 1; } @@ -1643,7 +1698,7 @@ ops.OperationTransformMatrix = function OperationTransformMatrix() { "RemoveCursor": passUnchanged, "RemoveMember": passUnchanged, "RemoveStyle": passUnchanged, -// "RemoveText": passUnchanged, + "RemoveText": transformAddAnnotationRemoveText, "SetParagraphStyle": transformAddAnnotationSetParagraphStyle, "SplitParagraph": transformAddAnnotationSplitParagraph, "UpdateMember": passUnchanged, diff --git a/webodf/tests/ops/transformationtests.xml b/webodf/tests/ops/transformationtests.xml index 53e95097..abc92b07 100644 --- a/webodf/tests/ops/transformationtests.xml +++ b/webodf/tests/ops/transformationtests.xml @@ -4009,6 +4009,493 @@ + + + + abcd + + + + + + + + + + + + b + Alice + 2013-08-05T12:34:07.061Z + + + + + + cd + + + + + + + abcd + + + + + + + + + + + + b + Alice + 2013-08-05T12:34:07.061Z + + + + + + cd + + + + + + + abcd + + + + + + + + + + + + + Alice + 2013-08-05T12:34:07.061Z + + + + + + cd + + + + + + + abcd + + + + + + + + + + + + + Alice + 2013-08-05T12:34:07.061Z + + + + + + cd + + + + + + + abcd + + + + + + + + + + + + a + Alice + 2013-08-05T12:34:07.061Z + + + + + + d + + + + + + + abcd + + + + + + + + + + + + a + Alice + 2013-08-05T12:34:07.061Z + + + + + + d + + + + + + + abcde + + + + + + + + + + + + a + Alice + 2013-08-05T12:34:07.061Z + + + + + + e + + + + + + + abcde + + + + + + + + + + + + a + Alice + 2013-08-05T12:34:07.061Z + + + + + + + + + + + + + abcd + + + + + + + + + + + + a + Alice + 2013-08-05T12:34:07.061Z + + + + + + cd + + + + + + + abcd + + + + + + + + + + + + a + Alice + 2013-08-05T12:34:07.061Z + + + + + + cd + + + + + + + abcd + + + + + + + + + + + + a + Alice + 2013-08-05T12:34:07.061Z + + + + + + d + + + + + + + abcd + + + + + + + + + + + + a + Alice + 2013-08-05T12:34:07.061Z + + + + + + + + + + + + + abcde + + + + + + + + + + + + a + Alice + 2013-08-05T12:34:07.061Z + + + + + + bde + + + + + + + abcde + + + + + + + + + + + + a + Alice + 2013-08-05T12:34:07.061Z + + + + + + bde + + + + + + + abcde + + + + + + + + + + + + a + Alice + 2013-08-05T12:34:07.061Z + + + + + + be + + + + + + + abcde + + + + + + + + + + + + a + Alice + 2013-08-05T12:34:07.061Z + + + + + + b + + + + + + + abcd + + + + + + + + + + + + a + Alice + 2013-08-05T12:34:07.061Z + + + + + + bc + + + + + + + abcde + + + + + + + + + + + + a + Alice + 2013-08-05T12:34:07.061Z + + + + + + bcd + + + + abc From 419eb547886f5b1a2df59fd4af85ea43f1f83d99 Mon Sep 17 00:00:00 2001 From: "Friedrich W. H. Kossebau" Date: Wed, 25 Mar 2015 11:47:06 +0100 Subject: [PATCH 11/24] Add transformApplyDirectStylingRemoveAnnotation --- webodf/lib/manifest.json | 1 + webodf/lib/ops/OperationTransformMatrix.js | 35 +- webodf/tests/ops/TransformationTests.js | 17 + webodf/tests/ops/transformationtests.xml | 512 +++++++++++++++++++++ 4 files changed, 564 insertions(+), 1 deletion(-) diff --git a/webodf/lib/manifest.json b/webodf/lib/manifest.json index c77685bd..57576a10 100644 --- a/webodf/lib/manifest.json +++ b/webodf/lib/manifest.json @@ -511,6 +511,7 @@ "ops.OpInsertText", "ops.OpMergeParagraph", "ops.OpMoveCursor", + "ops.OpRemoveAnnotation", "ops.OpRemoveCursor", "ops.OpRemoveStyle", "ops.OpRemoveText", diff --git a/webodf/lib/ops/OperationTransformMatrix.js b/webodf/lib/ops/OperationTransformMatrix.js index b3519e70..f235d0b4 100644 --- a/webodf/lib/ops/OperationTransformMatrix.js +++ b/webodf/lib/ops/OperationTransformMatrix.js @@ -660,6 +660,39 @@ ops.OperationTransformMatrix = function OperationTransformMatrix() { }; } + /** + * @param {!ops.OpApplyDirectStyling.Spec} applyDirectStylingSpec + * @param {!ops.OpRemoveAnnotation.Spec} removeAnnotationSpec + * @return {?{opSpecsA:!Array., opSpecsB:!Array.}} + */ + function transformApplyDirectStylingRemoveAnnotation(applyDirectStylingSpec, removeAnnotationSpec) { + var pointA = applyDirectStylingSpec.position, + pointB = applyDirectStylingSpec.position + applyDirectStylingSpec.length, + removeAnnotationEnd = removeAnnotationSpec.position + removeAnnotationSpec.length, + applyDirectStylingSpecResult = [applyDirectStylingSpec], + removeAnnotationSpecResult = [removeAnnotationSpec]; + + // check if inside removed annotation + if (removeAnnotationSpec.position <= pointA && pointB <= removeAnnotationEnd) { + applyDirectStylingSpecResult = []; + } else { + // adapt applyDirectStyling spec to removed annotation content + if (removeAnnotationEnd < pointA) { + pointA -= removeAnnotationSpec.length + 2; + } + if (removeAnnotationEnd < pointB) { + pointB -= removeAnnotationSpec.length + 2; + } + applyDirectStylingSpec.position = pointA; + applyDirectStylingSpec.length = pointB - pointA; + } + + return { + opSpecsA: applyDirectStylingSpecResult, + opSpecsB: removeAnnotationSpecResult + }; + } + /** * @param {!ops.OpApplyDirectStyling.Spec} applyDirectStylingSpec * @param {!ops.OpRemoveText.Spec} removeTextSpec @@ -1761,7 +1794,7 @@ ops.OperationTransformMatrix = function OperationTransformMatrix() { "InsertText": transformApplyDirectStylingInsertText, "MergeParagraph": transformApplyDirectStylingMergeParagraph, "MoveCursor": passUnchanged, -// "RemoveAnnotation": passUnchanged, + "RemoveAnnotation": transformApplyDirectStylingRemoveAnnotation, "RemoveCursor": passUnchanged, "RemoveMember": passUnchanged, "RemoveStyle": passUnchanged, diff --git a/webodf/tests/ops/TransformationTests.js b/webodf/tests/ops/TransformationTests.js index 93ebeb0f..dc37b793 100644 --- a/webodf/tests/ops/TransformationTests.js +++ b/webodf/tests/ops/TransformationTests.js @@ -606,6 +606,23 @@ ops.TransformationTests = function TransformationTests(runner) { this.setUps = { "RemoveAnnotationAddCursor" : linkAnnotationEndToStart, "RemoveAnnotationAddStyle" : linkAnnotationEndToStart, + "RemoveAnnotationApplyDirectStyling_{_}_[_]" : linkAnnotationEndToStart, + "RemoveAnnotationApplyDirectStyling_{_}[_]" : linkAnnotationEndToStart, + "RemoveAnnotationApplyDirectStyling_{_[}_]" : linkAnnotationEndToStart, + "RemoveAnnotationApplyDirectStyling_{_[_}_]" : linkAnnotationEndToStart, + "RemoveAnnotationApplyDirectStyling_{_[_}]" : linkAnnotationEndToStart, + "RemoveAnnotationApplyDirectStyling_{_[_]_}" : linkAnnotationEndToStart, + "RemoveAnnotationApplyDirectStyling_{[}_]" : linkAnnotationEndToStart, + "RemoveAnnotationApplyDirectStyling_{[_}_]" : linkAnnotationEndToStart, + "RemoveAnnotationApplyDirectStyling_{[_}]" : linkAnnotationEndToStart, + "RemoveAnnotationApplyDirectStyling_{[_]_}" : linkAnnotationEndToStart, + "RemoveAnnotationApplyDirectStyling_[{_}_]" : linkAnnotationEndToStart, + "RemoveAnnotationApplyDirectStyling_[{_}]_" : linkAnnotationEndToStart, + "RemoveAnnotationApplyDirectStyling_[{_]_}" : linkAnnotationEndToStart, + "RemoveAnnotationApplyDirectStyling_[_{_}_]" : linkAnnotationEndToStart, + "RemoveAnnotationApplyDirectStyling_[_{_}]" : linkAnnotationEndToStart, + "RemoveAnnotationApplyDirectStyling_[_{_]_}" : linkAnnotationEndToStart, + "RemoveAnnotationApplyDirectStyling_[_{]_}" : linkAnnotationEndToStart, "RemoveAnnotationRemoveCursor" : linkAnnotationEndToStart, "RemoveAnnotationRemoveStyle" : linkAnnotationEndToStart, "RemoveAnnotationUpdateMetadata" : linkAnnotationEndToStart, diff --git a/webodf/tests/ops/transformationtests.xml b/webodf/tests/ops/transformationtests.xml index abc92b07..633f0a8f 100644 --- a/webodf/tests/ops/transformationtests.xml +++ b/webodf/tests/ops/transformationtests.xml @@ -5012,6 +5012,518 @@ + + + + + + ab + Alice + 2013-08-05T12:34:07.061Z + + + AA + + + cd + + + + + + + + + + + + + + abcd + + + + + + + + ab + Alice + 2013-08-05T12:34:07.061Z + + + AA + + + cd + + + + + + + + + + + + + + abcd + + + + + + + + ab + Alice + 2013-08-05T12:34:07.061Z + + + AA + + + cd + + + + + + + + + + + + + + abcd + + + + + + + + a + Alice + 2013-08-05T12:34:07.061Z + + + AA + + + bcd + + + + + + + + + + + + + + abcd + + + + + + + + ab + Alice + 2013-08-05T12:34:07.061Z + + + AA + + + cd + + + + + + + + + + + + + + abcd + + + + + + + + ab + Alice + 2013-08-05T12:34:07.061Z + + + AA + + + cd + + + + + + + + + + + + + + abcd + + + + + + + + a + Alice + 2013-08-05T12:34:07.061Z + + + AA + + + bcd + + + + + + + + + + + + + + abcd + + + + + + + + a + Alice + 2013-08-05T12:34:07.061Z + + + AA + + + bcd + + + + + + + + + + + + + + abcd + + + + + + + + a + Alice + 2013-08-05T12:34:07.061Z + + + AA + + + bcd + + + + + + + + + + + + + + abcd + + + + + + + + a + Alice + 2013-08-05T12:34:07.061Z + + + AA + + + bcde + + + + + + + + + + + + + + abcde + + + + + + + + a + Alice + 2013-08-05T12:34:07.061Z + + + AA + + + bcd + + + + + + + + + + + + + + abcd + + + + + + + + a + Alice + 2013-08-05T12:34:07.061Z + + + AA + + + bcd + + + + + + + + + + + + + + abcd + + + + + + + + a + Alice + 2013-08-05T12:34:07.061Z + + + AA + + + bcd + + + + + + + + + + + + + + abcd + + + + + + + + a + Alice + 2013-08-05T12:34:07.061Z + + + AA + + + bcde + + + + + + + + + + + + + + abcde + + + + + + + + a + Alice + 2013-08-05T12:34:07.061Z + + + AA + + + bcde + + + + + + + + + + + + + + abcde + + + + + + + + a + Alice + 2013-08-05T12:34:07.061Z + + + AA + + + bcde + + + + + + + + + + + + + + abcde + + + + + + + + a + Alice + 2013-08-05T12:34:07.061Z + + + AA + + + bcde + + + + + + + + + + + + + + abcde + + + + From 773ff97d8baf145200c0bdf4a452fe35f5299d07 Mon Sep 17 00:00:00 2001 From: "Friedrich W. H. Kossebau" Date: Wed, 25 Mar 2015 12:23:02 +0100 Subject: [PATCH 12/24] Move bookkeeping about setup method to test description --- webodf/tests/ops/TransformationTests.js | 30 ++------------- webodf/tests/ops/transformationtests.xml | 47 ++++++++++++------------ 2 files changed, 28 insertions(+), 49 deletions(-) diff --git a/webodf/tests/ops/TransformationTests.js b/webodf/tests/ops/TransformationTests.js index dc37b793..6eeebb96 100644 --- a/webodf/tests/ops/TransformationTests.js +++ b/webodf/tests/ops/TransformationTests.js @@ -315,7 +315,7 @@ ops.TransformationTests = function TransformationTests(runner) { opsAElement = element.getElementsByTagName("opsA")[0], opsBElement = element.getElementsByTagName("opsB")[0], after = element.getElementsByTagName("after")[0], - hasSetup = element.getAttribute("hasSetup") === "true", + setupName = element.getAttribute("setup"), isFailing = element.getAttribute("isFailing") === "true", setup; @@ -326,8 +326,8 @@ ops.TransformationTests = function TransformationTests(runner) { runtime.assert(Boolean(after), "Expected in " + name + "."); runtime.assert(checkWhitespace(after), "Unexpanded test:s element or text:c attribute found in " + name + "."); opsTestHelper.removeInsignificantTextNodes(element); - setup = self.setUps.hasOwnProperty(name) ? self.setUps[name]() : null; - if (hasSetup) { + setup = self.setUps.hasOwnProperty(setupName) ? self.setUps[setupName]() : null; + if (setupName) { runtime.assert(Boolean(setup), "Required setup for " + name + " was not found."); } return { @@ -604,29 +604,7 @@ ops.TransformationTests = function TransformationTests(runner) { /*jslint emptyblock: false*/ this.setUps = { - "RemoveAnnotationAddCursor" : linkAnnotationEndToStart, - "RemoveAnnotationAddStyle" : linkAnnotationEndToStart, - "RemoveAnnotationApplyDirectStyling_{_}_[_]" : linkAnnotationEndToStart, - "RemoveAnnotationApplyDirectStyling_{_}[_]" : linkAnnotationEndToStart, - "RemoveAnnotationApplyDirectStyling_{_[}_]" : linkAnnotationEndToStart, - "RemoveAnnotationApplyDirectStyling_{_[_}_]" : linkAnnotationEndToStart, - "RemoveAnnotationApplyDirectStyling_{_[_}]" : linkAnnotationEndToStart, - "RemoveAnnotationApplyDirectStyling_{_[_]_}" : linkAnnotationEndToStart, - "RemoveAnnotationApplyDirectStyling_{[}_]" : linkAnnotationEndToStart, - "RemoveAnnotationApplyDirectStyling_{[_}_]" : linkAnnotationEndToStart, - "RemoveAnnotationApplyDirectStyling_{[_}]" : linkAnnotationEndToStart, - "RemoveAnnotationApplyDirectStyling_{[_]_}" : linkAnnotationEndToStart, - "RemoveAnnotationApplyDirectStyling_[{_}_]" : linkAnnotationEndToStart, - "RemoveAnnotationApplyDirectStyling_[{_}]_" : linkAnnotationEndToStart, - "RemoveAnnotationApplyDirectStyling_[{_]_}" : linkAnnotationEndToStart, - "RemoveAnnotationApplyDirectStyling_[_{_}_]" : linkAnnotationEndToStart, - "RemoveAnnotationApplyDirectStyling_[_{_}]" : linkAnnotationEndToStart, - "RemoveAnnotationApplyDirectStyling_[_{_]_}" : linkAnnotationEndToStart, - "RemoveAnnotationApplyDirectStyling_[_{]_}" : linkAnnotationEndToStart, - "RemoveAnnotationRemoveCursor" : linkAnnotationEndToStart, - "RemoveAnnotationRemoveStyle" : linkAnnotationEndToStart, - "RemoveAnnotationUpdateMetadata" : linkAnnotationEndToStart, - "RemoveAnnotationUpdateParagraphStyle" : linkAnnotationEndToStart + "linkAnnotationEndToStart" : linkAnnotationEndToStart }; }; diff --git a/webodf/tests/ops/transformationtests.xml b/webodf/tests/ops/transformationtests.xml index 633f0a8f..e40aeb2e 100644 --- a/webodf/tests/ops/transformationtests.xml +++ b/webodf/tests/ops/transformationtests.xml @@ -4958,7 +4958,7 @@ - + @@ -4984,7 +4984,8 @@ - + + @@ -5013,7 +5014,7 @@ - + @@ -5043,7 +5044,7 @@ - + @@ -5073,7 +5074,7 @@ - + @@ -5103,7 +5104,7 @@ - + @@ -5133,7 +5134,7 @@ - + @@ -5163,7 +5164,7 @@ - + @@ -5193,7 +5194,7 @@ - + @@ -5223,7 +5224,7 @@ - + @@ -5253,7 +5254,7 @@ - + @@ -5283,7 +5284,7 @@ - + @@ -5313,7 +5314,7 @@ - + @@ -5343,7 +5344,7 @@ - + @@ -5373,7 +5374,7 @@ - + @@ -5403,7 +5404,7 @@ - + @@ -5433,7 +5434,7 @@ - + @@ -5463,7 +5464,7 @@ - + @@ -5493,7 +5494,7 @@ - + @@ -5524,7 +5525,7 @@ - + @@ -5551,7 +5552,7 @@ - + @@ -5579,7 +5580,7 @@ - + Eve2013-08-05T12:34:07.061Z @@ -5607,7 +5608,7 @@ - + From 1b9fdca1bf60f1f51da79b26452223fdd68e6f98 Mon Sep 17 00:00:00 2001 From: "Friedrich W. H. Kossebau" Date: Wed, 25 Mar 2015 13:15:33 +0100 Subject: [PATCH 13/24] Add transformInsertTextRemoveAnnotation --- webodf/lib/ops/OperationTransformMatrix.js | 32 ++- webodf/tests/ops/transformationtests.xml | 235 +++++++++++++++++++++ 2 files changed, 266 insertions(+), 1 deletion(-) diff --git a/webodf/lib/ops/OperationTransformMatrix.js b/webodf/lib/ops/OperationTransformMatrix.js index f235d0b4..34741eba 100644 --- a/webodf/lib/ops/OperationTransformMatrix.js +++ b/webodf/lib/ops/OperationTransformMatrix.js @@ -833,6 +833,36 @@ ops.OperationTransformMatrix = function OperationTransformMatrix() { }; } + /** + * @param {!ops.OpInsertText.Spec} insertTextSpec + * @param {!ops.OpRemoveAnnotation.Spec} removeAnnotationSpec + * @return {?{opSpecsA:!Array., opSpecsB:!Array.}} + */ + function transformInsertTextRemoveAnnotation(insertTextSpec, removeAnnotationSpec) { + var insertTextSpecPosition = insertTextSpec.position, + removeAnnotationEnd = removeAnnotationSpec.position + removeAnnotationSpec.length, + insertTextSpecResult = [insertTextSpec], + removeAnnotationSpecResult = [removeAnnotationSpec]; + + // check if inside removed annotation + if (removeAnnotationSpec.position <= insertTextSpecPosition && insertTextSpecPosition <= removeAnnotationEnd) { + insertTextSpecResult = []; + removeAnnotationSpec.length += insertTextSpec.text.length; + } else { + // adapt insertText spec to removed annotation content + if (removeAnnotationEnd < insertTextSpec.position) { + insertTextSpec.position -= removeAnnotationSpec.length + 2; + } else { + removeAnnotationSpec.position += insertTextSpec.text.length; + } + } + + return { + opSpecsA: insertTextSpecResult, + opSpecsB: removeAnnotationSpecResult + }; + } + /** * @param {!ops.OpInsertText.Spec} insertTextSpec * @param {!ops.OpRemoveText.Spec} removeTextSpec @@ -1809,7 +1839,7 @@ ops.OperationTransformMatrix = function OperationTransformMatrix() { "InsertText": transformInsertTextInsertText, "MergeParagraph": transformInsertTextMergeParagraph, "MoveCursor": transformInsertTextMoveCursor, -// "RemoveAnnotation": passUnchanged, + "RemoveAnnotation": transformInsertTextRemoveAnnotation, "RemoveCursor": passUnchanged, "RemoveMember": passUnchanged, "RemoveStyle": passUnchanged, diff --git a/webodf/tests/ops/transformationtests.xml b/webodf/tests/ops/transformationtests.xml index e40aeb2e..fe4d3bfd 100644 --- a/webodf/tests/ops/transformationtests.xml +++ b/webodf/tests/ops/transformationtests.xml @@ -5525,6 +5525,241 @@ + + + + a + Alice + 2013-08-05T12:34:07.061Z + + + AA + + + bcd + + + + + + + + + + + Vabcd + + + + + + + a + Alice + 2013-08-05T12:34:07.061Z + + + AA + + + bcd + + + + + + + + + + + aVbcd + + + + + + + a + Alice + 2013-08-05T12:34:07.061Z + + + AA + + + bcd + + + + + + + + + + + abcd + + + + + + + a + Alice + 2013-08-05T12:34:07.061Z + + + AA + + + bcd + + + + + + + + + + + abcd + + + + + + + a + Alice + 2013-08-05T12:34:07.061Z + + + AA + + + bcd + + + + + + + + + + + abcd + + + + + + + a + Alice + 2013-08-05T12:34:07.061Z + + + AA + + + bcd + + + + + + + + + + + aVbcd + + + + + + + a + Alice + 2013-08-05T12:34:07.061Z + + + AA + + + bcd + + + + + + + + + + + abVcd + + + + + + + a + Alice + 2013-08-05T12:34:07.061Z + + + AA + + + bcd + + + + + + + + + + + abcVd + + + + + + + a + Alice + 2013-08-05T12:34:07.061Z + + + AA + + + bcd + + + + + + + + + + + abcdV + + + + From f3f495b8324237f3608da4689cd1152f9fcafbc1 Mon Sep 17 00:00:00 2001 From: "Friedrich W. H. Kossebau" Date: Wed, 25 Mar 2015 13:23:11 +0100 Subject: [PATCH 14/24] Add transformMergeParagraphRemoveAnnotation --- webodf/lib/ops/OperationTransformMatrix.js | 35 +++- webodf/tests/ops/transformationtests.xml | 183 +++++++++++++++++++++ 2 files changed, 217 insertions(+), 1 deletion(-) diff --git a/webodf/lib/ops/OperationTransformMatrix.js b/webodf/lib/ops/OperationTransformMatrix.js index 34741eba..b7b4ad87 100644 --- a/webodf/lib/ops/OperationTransformMatrix.js +++ b/webodf/lib/ops/OperationTransformMatrix.js @@ -1055,6 +1055,39 @@ ops.OperationTransformMatrix = function OperationTransformMatrix() { }; } + /** + * @param {!ops.OpMergeParagraph.Spec} mergeParagraphSpec + * @param {!ops.OpRemoveAnnotation.Spec} removeAnnotationSpec + * @return {?{opSpecsA:!Array., opSpecsB:!Array.}} + */ + function transformMergeParagraphRemoveAnnotation(mergeParagraphSpec, removeAnnotationSpec) { + var removeAnnotationEnd = removeAnnotationSpec.position + removeAnnotationSpec.length, + mergeParagraphSpecResult = [mergeParagraphSpec], + removeAnnotationSpecResult = [removeAnnotationSpec]; + + // check if inside removed annotation + if (removeAnnotationSpec.position <= mergeParagraphSpec.destinationStartPosition && mergeParagraphSpec.sourceStartPosition <= removeAnnotationEnd) { + mergeParagraphSpecResult = []; + removeAnnotationSpec.length -= 1; + } else { + if (mergeParagraphSpec.sourceStartPosition < removeAnnotationSpec.position) { + removeAnnotationSpec.position -= 1; + } else { + if (removeAnnotationEnd < mergeParagraphSpec.destinationStartPosition) { + mergeParagraphSpec.destinationStartPosition -= removeAnnotationSpec.length + 2; + } + if (removeAnnotationEnd < mergeParagraphSpec.sourceStartPosition) { + mergeParagraphSpec.sourceStartPosition -= removeAnnotationSpec.length + 2; + } + } + } + + return { + opSpecsA: mergeParagraphSpecResult, + opSpecsB: removeAnnotationSpecResult + }; + } + /** * @param {!ops.OpMergeParagraph.Spec} mergeParagraphSpec * @param {!ops.OpRemoveText.Spec} removeTextSpec @@ -1853,7 +1886,7 @@ ops.OperationTransformMatrix = function OperationTransformMatrix() { "MergeParagraph": { "MergeParagraph": transformMergeParagraphMergeParagraph, "MoveCursor": transformMergeParagraphMoveCursor, -// "RemoveAnnotation": passUnchanged, + "RemoveAnnotation": transformMergeParagraphRemoveAnnotation, "RemoveCursor": passUnchanged, "RemoveMember": passUnchanged, "RemoveStyle": passUnchanged, diff --git a/webodf/tests/ops/transformationtests.xml b/webodf/tests/ops/transformationtests.xml index fe4d3bfd..a85257cc 100644 --- a/webodf/tests/ops/transformationtests.xml +++ b/webodf/tests/ops/transformationtests.xml @@ -5760,6 +5760,189 @@ + + + + ab + Alice + 2013-08-05T12:34:07.061Z + + + AA + + + cd + + + + + + + + + + + abcd + + + + + + + a + Alice + 2013-08-05T12:34:07.061Z + + + AA + + + bcd + + + + + + + + + + + abcd + + + + + + + a + Alice + 2013-08-05T12:34:07.061Z + + + AA + + + bcd + + + + + + + + + + + abcd + + + + + + + a + Alice + 2013-08-05T12:34:07.061Z + + + AA + + + bcd + + + + + + + + + + + abcd + + + + + + + a + Alice + 2013-08-05T12:34:07.061Z + + + AA + + + bcd + + + + + + + + + + + abcd + + + + + + + a + Alice + 2013-08-05T12:34:07.061Z + + + AA + + + bcd + + + + + + + + + + + abcd + + + + + + + a + Alice + 2013-08-05T12:34:07.061Z + + + AA + + + bcd + + + + + + + + + + + abcd + + + + From a00e838764cf2f20afc31f5cc08f44947c0c8155 Mon Sep 17 00:00:00 2001 From: "Friedrich W. H. Kossebau" Date: Wed, 25 Mar 2015 14:47:11 +0100 Subject: [PATCH 15/24] Add transformMoveCursorRemoveAnnotation --- webodf/lib/ops/OperationTransformMatrix.js | 33 +- webodf/tests/ops/transformationtests.xml | 919 +++++++++++++++++++++ 2 files changed, 951 insertions(+), 1 deletion(-) diff --git a/webodf/lib/ops/OperationTransformMatrix.js b/webodf/lib/ops/OperationTransformMatrix.js index b7b4ad87..0ee5c081 100644 --- a/webodf/lib/ops/OperationTransformMatrix.js +++ b/webodf/lib/ops/OperationTransformMatrix.js @@ -1405,6 +1405,37 @@ ops.OperationTransformMatrix = function OperationTransformMatrix() { }; } + /** + * @param {!ops.OpMoveCursor.Spec} moveCursorSpec + * @param {!ops.OpRemoveAnnotation.Spec} removeAnnotationSpec + * @return {?{opSpecsA:!Array., opSpecsB:!Array.}} + */ + function transformMoveCursorRemoveAnnotation(moveCursorSpec, removeAnnotationSpec) { + var isMoveCursorSpecRangeInverted = invertMoveCursorSpecRangeOnNegativeLength(moveCursorSpec), + moveCursorSpecEnd = moveCursorSpec.position + moveCursorSpec.length, + removeAnnotationEnd = removeAnnotationSpec.position + removeAnnotationSpec.length; + + // check if inside removed annotation + if (removeAnnotationSpec.position <= moveCursorSpec.position && moveCursorSpecEnd <= removeAnnotationEnd) { + moveCursorSpec.position = removeAnnotationSpec.position - 1; + moveCursorSpec.length = 0; + } else { + if (removeAnnotationEnd < moveCursorSpec.position) { + moveCursorSpec.position -= removeAnnotationSpec.length + 2; + } else if (removeAnnotationEnd < moveCursorSpecEnd) { + moveCursorSpec.length -= removeAnnotationSpec.length + 2; + } + if (isMoveCursorSpecRangeInverted) { + invertMoveCursorSpecRange(moveCursorSpec); + } + } + + return { + opSpecsA: [moveCursorSpec], + opSpecsB: [removeAnnotationSpec] + }; + } + /** * @param {!ops.OpMoveCursor.Spec} moveCursorSpec * @param {!ops.OpRemoveCursor.Spec} removeCursorSpec @@ -1899,7 +1930,7 @@ ops.OperationTransformMatrix = function OperationTransformMatrix() { }, "MoveCursor": { "MoveCursor": passUnchanged, -// "RemoveAnnotation": passUnchanged, + "RemoveAnnotation": transformMoveCursorRemoveAnnotation, "RemoveCursor": transformMoveCursorRemoveCursor, "RemoveMember": passUnchanged, "RemoveStyle": passUnchanged, diff --git a/webodf/tests/ops/transformationtests.xml b/webodf/tests/ops/transformationtests.xml index a85257cc..378dd6ed 100644 --- a/webodf/tests/ops/transformationtests.xml +++ b/webodf/tests/ops/transformationtests.xml @@ -5943,6 +5943,925 @@ + + + + a + Alice + 2013-08-05T12:34:07.061Z + + + AA + + + bcd + + + + + + + + + + + + abcd + + + + + + + ab + Alice + 2013-08-05T12:34:07.061Z + + + AA + + + cde + + + + + + + + + + + + abcde + + + + + + + ab + Alice + 2013-08-05T12:34:07.061Z + + + AA + + + cde + + + + + + + + + + + + abcde + + + + + + + ab + Alice + 2013-08-05T12:34:07.061Z + + + AA + + + cde + + + + + + + + + + + + abcde + + + + + + + ab + Alice + 2013-08-05T12:34:07.061Z + + + AA + + + cde + + + + + + + + + + + + abcde + + + + + + + ab + Alice + 2013-08-05T12:34:07.061Z + + + AA + + + cde + + + + + + + + + + + + abcde + + + + + + + ab + Alice + 2013-08-05T12:34:07.061Z + + + AA + + + cde + + + + + + + + + + + + abcde + + + + + + + a + Alice + 2013-08-05T12:34:07.061Z + + + AA + + + bcd + + + + + + + + + + + + abcd + + + + + + + a + Alice + 2013-08-05T12:34:07.061Z + + + AA + + + bcd + + + + + + + + + + + + abcd + + + + + + + a + Alice + 2013-08-05T12:34:07.061Z + + + AA + + + bcd + + + + + + + + + + + + abcd + + + + + + + a + Alice + 2013-08-05T12:34:07.061Z + + + AA + + + bcd + + + + + + + + + + + + abcd + + + + + + + a + Alice + 2013-08-05T12:34:07.061Z + + + AA + + + bcd + + + + + + + + + + + + abcd + + + + + + + a + Alice + 2013-08-05T12:34:07.061Z + + + AA + + + bcd + + + + + + + + + + + + abcd + + + + + + + a + Alice + 2013-08-05T12:34:07.061Z + + + AA + + + bcd + + + + + + + + + + + + abcd + + + + + + + a + Alice + 2013-08-05T12:34:07.061Z + + + AA + + + bcd + + + + + + + + + + + + abcd + + + + + + + a + Alice + 2013-08-05T12:34:07.061Z + + + AA + + + bcd + + + + + + + + + + + + abcd + + + + + + + a + Alice + 2013-08-05T12:34:07.061Z + + + AA + + + bcd + + + + + + + + + + + + abcd + + + + + + + a + Alice + 2013-08-05T12:34:07.061Z + + + AA + + + bcd + + + + + + + + + + + + abcd + + + + + + + a + Alice + 2013-08-05T12:34:07.061Z + + + AA + + + bcd + + + + + + + + + + + + abcd + + + + + + + a + Alice + 2013-08-05T12:34:07.061Z + + + AA + + + bcd + + + + + + + + + + + + abcd + + + + + + + a + Alice + 2013-08-05T12:34:07.061Z + + + AA + + + bcd + + + + + + + + + + + + abcd + + + + + + + a + Alice + 2013-08-05T12:34:07.061Z + + + AA + + + bcd + + + + + + + + + + + + abcd + + + + + + + a + Alice + 2013-08-05T12:34:07.061Z + + + AA + + + bcd + + + + + + + + + + + + abcd + + + + + + + a + Alice + 2013-08-05T12:34:07.061Z + + + AA + + + bcd + + + + + + + + + + + + abcd + + + + + + + a + Alice + 2013-08-05T12:34:07.061Z + + + AA + + + bcd + + + + + + + + + + + + abcd + + + + + + + a + Alice + 2013-08-05T12:34:07.061Z + + + AA + + + bcd + + + + + + + + + + + + abcd + + + + + + + a + Alice + 2013-08-05T12:34:07.061Z + + + AA + + + bcd + + + + + + + + + + + + abcd + + + + + + + a + Alice + 2013-08-05T12:34:07.061Z + + + AA + + + bcd + + + + + + + + + + + + abcd + + + + + + + a + Alice + 2013-08-05T12:34:07.061Z + + + AA + + + bcd + + + + + + + + + + + + abcd + + + + + + + a + Alice + 2013-08-05T12:34:07.061Z + + + AA + + + bcd + + + + + + + + + + + + abcd + + + + + + + a + Alice + 2013-08-05T12:34:07.061Z + + + AA + + + bcd + + + + + + + + + + + + abcd + + + + + + + a + Alice + 2013-08-05T12:34:07.061Z + + + AA + + + bcd + + + + + + + + + + + + abcd + + + + + + + a + Alice + 2013-08-05T12:34:07.061Z + + + AA + + + bcd + + + + + + + + + + + + abcd + + + + + + + a + Alice + 2013-08-05T12:34:07.061Z + + + AA + + + bcd + + + + + + + + + + + + abcd + + + + From 10a3553a9dcb5068bfdd2abe9185d8f61df83da8 Mon Sep 17 00:00:00 2001 From: "Friedrich W. H. Kossebau" Date: Wed, 25 Mar 2015 15:12:01 +0100 Subject: [PATCH 16/24] Add transformRemoveAnnotationSplitParagraph --- webodf/lib/ops/OperationTransformMatrix.js | 34 ++- webodf/tests/ops/transformationtests.xml | 237 +++++++++++++++++++++ 2 files changed, 270 insertions(+), 1 deletion(-) diff --git a/webodf/lib/ops/OperationTransformMatrix.js b/webodf/lib/ops/OperationTransformMatrix.js index 0ee5c081..9f5618f1 100644 --- a/webodf/lib/ops/OperationTransformMatrix.js +++ b/webodf/lib/ops/OperationTransformMatrix.js @@ -1524,6 +1524,38 @@ ops.OperationTransformMatrix = function OperationTransformMatrix() { }; } + /** + * @param {!ops.OpRemoveAnnotation.Spec} removeAnnotationSpec + * @param {!ops.OpSplitParagraph.Spec} splitParagraphSpec + * @return {?{opSpecsA:!Array., opSpecsB:!Array.}} + */ + function transformRemoveAnnotationSplitParagraph(removeAnnotationSpec, splitParagraphSpec) { + var splitParagraphSpecPosition = splitParagraphSpec.position, + removeAnnotationEnd = removeAnnotationSpec.position + removeAnnotationSpec.length, + removeAnnotationSpecResult = [removeAnnotationSpec], + splitParagraphSpecResult = [splitParagraphSpec]; + + // check if inside removed annotation + if (removeAnnotationSpec.position <= splitParagraphSpecPosition && splitParagraphSpecPosition <= removeAnnotationEnd) { + splitParagraphSpecResult = []; + removeAnnotationSpec.length += 1; + } else { + if (removeAnnotationEnd < splitParagraphSpec.sourceParagraphPosition) { + splitParagraphSpec.sourceParagraphPosition -= removeAnnotationSpec.length + 2; + } + if (removeAnnotationEnd < splitParagraphSpecPosition) { + splitParagraphSpec.position -= removeAnnotationSpec.length + 2; + } else { + removeAnnotationSpec.position += 1; + } + } + + return { + opSpecsA: removeAnnotationSpecResult, + opSpecsB: splitParagraphSpecResult + }; + } + /** * @param {!ops.OpRemoveCursor.Spec} removeCursorSpecA * @param {!ops.OpRemoveCursor.Spec} removeCursorSpecB @@ -1948,7 +1980,7 @@ ops.OperationTransformMatrix = function OperationTransformMatrix() { "RemoveStyle": passUnchanged, // "RemoveText": passUnchanged, // "SetParagraphStyle": passUnchanged, -// "SplitParagraph": passUnchanged, + "SplitParagraph": transformRemoveAnnotationSplitParagraph, "UpdateMember": passUnchanged, "UpdateMetadata": passUnchanged, "UpdateParagraphStyle": passUnchanged diff --git a/webodf/tests/ops/transformationtests.xml b/webodf/tests/ops/transformationtests.xml index 378dd6ed..e929857e 100644 --- a/webodf/tests/ops/transformationtests.xml +++ b/webodf/tests/ops/transformationtests.xml @@ -6889,6 +6889,7 @@ + @@ -6917,6 +6918,242 @@ + + + + + a + Alice + 2013-08-05T12:34:07.061Z + + + AA + + + bcd + + + + + + + + + + + abcd + + + + + + + a + Alice + 2013-08-05T12:34:07.061Z + + + AA + + + bcd + + + + + + + + + + + abcd + + + + + + + a + Alice + 2013-08-05T12:34:07.061Z + + + AA + + + bcd + + + + + + + + + + + abcd + + + + + + + a + Alice + 2013-08-05T12:34:07.061Z + + + AA + + + bcd + + + + + + + + + + + abcd + + + + + + + a + Alice + 2013-08-05T12:34:07.061Z + + + AA + + + bcd + + + + + + + + + + + abcd + + + + + + + a + Alice + 2013-08-05T12:34:07.061Z + + + AA + + + bcd + + + + + + + + + + + abcd + + + + + + + a + Alice + 2013-08-05T12:34:07.061Z + + + AA + + + bcd + + + + + + + + + + + abcd + + + + + + + a + Alice + 2013-08-05T12:34:07.061Z + + + AA + + + bcd + + + + + + + + + + + abcd + + + + + + + a + Alice + 2013-08-05T12:34:07.061Z + + + AA + + + bcd + + + + + + + + + + + abcd + + + + Eve2013-08-05T12:34:07.061Z From ad38426eb43b9287497df9b9999757e8b0c3489f Mon Sep 17 00:00:00 2001 From: "Friedrich W. H. Kossebau" Date: Wed, 25 Mar 2015 16:37:11 +0100 Subject: [PATCH 17/24] Add transformRemoveAnnotationSetParagraphStyle --- webodf/lib/ops/OperationTransformMatrix.js | 28 +++++- webodf/tests/ops/transformationtests.xml | 105 +++++++++++++++++++++ 2 files changed, 132 insertions(+), 1 deletion(-) diff --git a/webodf/lib/ops/OperationTransformMatrix.js b/webodf/lib/ops/OperationTransformMatrix.js index 9f5618f1..406079a8 100644 --- a/webodf/lib/ops/OperationTransformMatrix.js +++ b/webodf/lib/ops/OperationTransformMatrix.js @@ -1524,6 +1524,32 @@ ops.OperationTransformMatrix = function OperationTransformMatrix() { }; } + /** + * @param {!ops.OpRemoveAnnotation.Spec} removeAnnotationSpec + * @param {!ops.OpSetParagraphStyle.Spec} setParagraphStyleSpec + * @return {?{opSpecsA:!Array., opSpecsB:!Array.}} + */ + function transformRemoveAnnotationSetParagraphStyle(removeAnnotationSpec, setParagraphStyleSpec) { + var setParagraphStyleSpecPosition = setParagraphStyleSpec.position, + removeAnnotationEnd = removeAnnotationSpec.position + removeAnnotationSpec.length, + removeAnnotationSpecResult = [removeAnnotationSpec], + setParagraphStyleSpecResult = [setParagraphStyleSpec]; + + // check if inside removed annotation + if (removeAnnotationSpec.position <= setParagraphStyleSpecPosition && setParagraphStyleSpecPosition <= removeAnnotationEnd) { + setParagraphStyleSpecResult = []; + } else { + if (removeAnnotationEnd < setParagraphStyleSpecPosition) { + setParagraphStyleSpec.position -= removeAnnotationSpec.length + 2; + } + } + + return { + opSpecsA: removeAnnotationSpecResult, + opSpecsB: setParagraphStyleSpecResult + }; + } + /** * @param {!ops.OpRemoveAnnotation.Spec} removeAnnotationSpec * @param {!ops.OpSplitParagraph.Spec} splitParagraphSpec @@ -1979,7 +2005,7 @@ ops.OperationTransformMatrix = function OperationTransformMatrix() { "RemoveMember": passUnchanged, "RemoveStyle": passUnchanged, // "RemoveText": passUnchanged, -// "SetParagraphStyle": passUnchanged, + "SetParagraphStyle": transformRemoveAnnotationSetParagraphStyle, "SplitParagraph": transformRemoveAnnotationSplitParagraph, "UpdateMember": passUnchanged, "UpdateMetadata": passUnchanged, diff --git a/webodf/tests/ops/transformationtests.xml b/webodf/tests/ops/transformationtests.xml index e929857e..9ec98e8a 100644 --- a/webodf/tests/ops/transformationtests.xml +++ b/webodf/tests/ops/transformationtests.xml @@ -6919,6 +6919,111 @@ + + + + a + Alice + 2013-08-05T12:34:07.061Z + + + AA + + + bcd + + + + + + + + + + + abcd + + + + + + + + Alice + 2013-08-05T12:34:07.061Z + + + AA + + + abcd + + + + + + + + + + + abcd + + + + + + + a + Alice + 2013-08-05T12:34:07.061Z + + + AA + + + bcd + + + + + + + + + + + abcd + + + + + + + a + Alice + 2013-08-05T12:34:07.061Z + + + AA + + + bcd + + + + + + + + + + + abcd + + + + From 50b0213b3c65d3a9e3453502afa945aa1a710672 Mon Sep 17 00:00:00 2001 From: "Friedrich W. H. Kossebau" Date: Wed, 25 Mar 2015 18:10:47 +0100 Subject: [PATCH 18/24] Add transformRemoveAnnotationRemoveText --- webodf/lib/ops/OperationTransformMatrix.js | 34 +- webodf/tests/ops/transformationtests.xml | 443 +++++++++++++++++++++ 2 files changed, 476 insertions(+), 1 deletion(-) diff --git a/webodf/lib/ops/OperationTransformMatrix.js b/webodf/lib/ops/OperationTransformMatrix.js index 406079a8..007dba5b 100644 --- a/webodf/lib/ops/OperationTransformMatrix.js +++ b/webodf/lib/ops/OperationTransformMatrix.js @@ -1524,6 +1524,38 @@ ops.OperationTransformMatrix = function OperationTransformMatrix() { }; } + /** + * @param {!ops.OpRemoveAnnotation.Spec} removeAnnotationSpec + * @param {!ops.OpRemoveText.Spec} removeTextSpec + * @return {?{opSpecsA:!Array., opSpecsB:!Array.}} + */ + function transformRemoveAnnotationRemoveText(removeAnnotationSpec, removeTextSpec) { + var removeAnnotationEnd = removeAnnotationSpec.position + removeAnnotationSpec.length, + removeTextSpecEnd = removeTextSpec.position + removeTextSpec.length, + removeAnnotationSpecResult = [removeAnnotationSpec], + removeTextSpecResult = [removeTextSpec]; + + // check if inside removed annotation + if (removeAnnotationSpec.position <= removeTextSpec.position && removeTextSpecEnd <= removeAnnotationEnd) { + removeTextSpecResult = []; + removeAnnotationSpec.length -= removeTextSpec.length; + } else { + if (removeTextSpecEnd < removeAnnotationSpec.position) { + removeAnnotationSpec.position -= removeTextSpec.length; + } else if (removeTextSpec.position < removeAnnotationSpec.position) { + removeAnnotationSpec.position = removeTextSpec.position + 1; + removeTextSpec.length -= removeAnnotationSpec.length + 2; + } else { + removeTextSpec.position -= removeAnnotationSpec.length + 2; + } + } + + return { + opSpecsA: removeAnnotationSpecResult, + opSpecsB: removeTextSpecResult + }; + } + /** * @param {!ops.OpRemoveAnnotation.Spec} removeAnnotationSpec * @param {!ops.OpSetParagraphStyle.Spec} setParagraphStyleSpec @@ -2004,7 +2036,7 @@ ops.OperationTransformMatrix = function OperationTransformMatrix() { "RemoveCursor": passUnchanged, "RemoveMember": passUnchanged, "RemoveStyle": passUnchanged, -// "RemoveText": passUnchanged, + "RemoveText": transformRemoveAnnotationRemoveText, "SetParagraphStyle": transformRemoveAnnotationSetParagraphStyle, "SplitParagraph": transformRemoveAnnotationSplitParagraph, "UpdateMember": passUnchanged, diff --git a/webodf/tests/ops/transformationtests.xml b/webodf/tests/ops/transformationtests.xml index 9ec98e8a..828d6d38 100644 --- a/webodf/tests/ops/transformationtests.xml +++ b/webodf/tests/ops/transformationtests.xml @@ -6919,6 +6919,449 @@ + + + + ab + Alice + 2013-08-05T12:34:07.061Z + + + + + + cde + + + + + + + + + + + bcde + + + + + + + ab + Alice + 2013-08-05T12:34:07.061Z + + + AA + + + cde + + + + + + + + + + + cde + + + + + + + ab + Alice + 2013-08-05T12:34:07.061Z + + + AA + + + cde + + + + + + + + + + + cde + + + + + + + ab + Alice + 2013-08-05T12:34:07.061Z + + + AA + + + cde + + + + + + + + + + + de + + + + + + + ab + Alice + 2013-08-05T12:34:07.061Z + + + AA + + + cde + + + + + + + + + + + e + + + + + + + ab + Alice + 2013-08-05T12:34:07.061Z + + + AA + + + cde + + + + + + + + + + + + + + + + + + ab + Alice + 2013-08-05T12:34:07.061Z + + + AA + + + cde + + + + + + + + + + + abcde + + + + + + + ab + Alice + 2013-08-05T12:34:07.061Z + + + AA + + + cde + + + + + + + + + + + abcde + + + + + + + ab + Alice + 2013-08-05T12:34:07.061Z + + + AAA + + + cde + + + + + + + + + + + abcde + + + + + + + ab + Alice + 2013-08-05T12:34:07.061Z + + + AA + + + cde + + + + + + + + + + + abcde + + + + + + + ab + Alice + 2013-08-05T12:34:07.061Z + + + AA + + + cde + + + + + + + + + + + abde + + + + + + + ab + Alice + 2013-08-05T12:34:07.061Z + + + AA + + + cde + + + + + + + + + + + abe + + + + + + + ab + Alice + 2013-08-05T12:34:07.061Z + + + AA + + + cde + + + + + + + + + + + ab + + + + + + + ab + Alice + 2013-08-05T12:34:07.061Z + + + AA + + + cdef + + + + + + + + + + + abcef + + + + + + + ab + Alice + 2013-08-05T12:34:07.061Z + + + AA + + + cdef + + + + + + + + + + + abcf + + + + + + + ab + Alice + 2013-08-05T12:34:07.061Z + + + AA + + + cdef + + + + + + + + + + + abc + + + + + + + ab + Alice + 2013-08-05T12:34:07.061Z + + + AA + + + cdef + + + + + + + + + + + abcde + + + + From 298e09ae03956a3111a17a0bfca36fb1c32bd9d1 Mon Sep 17 00:00:00 2001 From: "Friedrich W. H. Kossebau" Date: Thu, 26 Mar 2015 15:27:16 +0100 Subject: [PATCH 19/24] Add Alice & Bob as default members in TransformationTests --- webodf/tests/manifest.json | 1 + webodf/tests/ops/TransformationTests.js | 7 ++ webodf/tests/ops/transformationtests.xml | 109 ----------------------- 3 files changed, 8 insertions(+), 109 deletions(-) diff --git a/webodf/tests/manifest.json b/webodf/tests/manifest.json index f550e119..cac860cd 100644 --- a/webodf/tests/manifest.json +++ b/webodf/tests/manifest.json @@ -245,6 +245,7 @@ "odf.Namespaces", "odf.OdfCanvas", "odf.OdfContainer", + "ops.Member", "ops.OdtDocument", "ops.Operation", "ops.OperationFactory", diff --git a/webodf/tests/ops/TransformationTests.js b/webodf/tests/ops/TransformationTests.js index 6eeebb96..a3e55ea1 100644 --- a/webodf/tests/ops/TransformationTests.js +++ b/webodf/tests/ops/TransformationTests.js @@ -429,6 +429,13 @@ ops.TransformationTests = function TransformationTests(runner) { t.odfContainer = new odf.OdfContainer(odf.OdfContainer.DocumentType.TEXT, null); t.odfcanvas.setOdfContainer(t.odfContainer); odtDocument = new ops.OdtDocument(t.odfcanvas); + ["Alice", "Bob"].forEach(function(name) { + var properties = new ops.MemberProperties(); + properties.color = "black"; + properties.fullName = name; + properties.imageUrl = ""; + odtDocument.addMember(new ops.Member(name, properties)); + }); text = odtDocument.getRootNode(); styles = t.odfContainer.rootElement.styles; meta = /**@type{!Element}*/(t.odfContainer.rootElement.meta); diff --git a/webodf/tests/ops/transformationtests.xml b/webodf/tests/ops/transformationtests.xml index 828d6d38..5eb0225c 100644 --- a/webodf/tests/ops/transformationtests.xml +++ b/webodf/tests/ops/transformationtests.xml @@ -1997,7 +1997,6 @@ - @@ -2026,7 +2025,6 @@ - @@ -2054,7 +2052,6 @@ abcd - @@ -2081,7 +2078,6 @@ abcd - @@ -2108,7 +2104,6 @@ abcd - @@ -2135,7 +2130,6 @@ abcd - @@ -2162,7 +2156,6 @@ abcd - @@ -2189,7 +2182,6 @@ abcd - @@ -2217,7 +2209,6 @@ abcd - @@ -2244,7 +2235,6 @@ abcd - @@ -2271,7 +2261,6 @@ abcd - @@ -2298,7 +2287,6 @@ abcd - @@ -2326,7 +2314,6 @@ abcd - @@ -2353,7 +2340,6 @@ abcd - @@ -2380,7 +2366,6 @@ abcd - @@ -2407,7 +2392,6 @@ abcd - @@ -2435,7 +2419,6 @@ abcd - @@ -2462,7 +2445,6 @@ abcd - @@ -2489,7 +2471,6 @@ abcd - @@ -2516,7 +2497,6 @@ abcd - @@ -2545,7 +2525,6 @@ - @@ -2572,7 +2551,6 @@ - @@ -2599,7 +2577,6 @@ - @@ -2626,7 +2603,6 @@ - @@ -2653,7 +2629,6 @@ - @@ -2680,7 +2655,6 @@ - @@ -2707,7 +2681,6 @@ - @@ -2734,7 +2707,6 @@ - @@ -2762,7 +2734,6 @@ - @@ -2789,7 +2760,6 @@ - @@ -2816,7 +2786,6 @@ - @@ -2843,7 +2812,6 @@ - @@ -2870,7 +2838,6 @@ - @@ -2897,7 +2864,6 @@ - @@ -2924,7 +2890,6 @@ - @@ -2951,7 +2916,6 @@ - @@ -2978,7 +2942,6 @@ - @@ -3005,7 +2968,6 @@ - @@ -3032,7 +2994,6 @@ - @@ -3060,7 +3021,6 @@ - @@ -3088,7 +3048,6 @@ - @@ -3116,7 +3075,6 @@ - @@ -3144,7 +3102,6 @@ - @@ -3172,7 +3129,6 @@ - @@ -3200,7 +3156,6 @@ - @@ -3228,7 +3183,6 @@ - @@ -3256,7 +3210,6 @@ - @@ -3284,7 +3237,6 @@ - @@ -3312,7 +3264,6 @@ - @@ -3340,7 +3291,6 @@ - @@ -3368,7 +3318,6 @@ - @@ -3396,7 +3345,6 @@ - @@ -3424,7 +3372,6 @@ - @@ -3452,7 +3399,6 @@ - @@ -3480,7 +3426,6 @@ - @@ -3508,7 +3453,6 @@ - @@ -3536,7 +3480,6 @@ - @@ -3564,7 +3507,6 @@ - @@ -3592,7 +3534,6 @@ - @@ -3620,7 +3561,6 @@ - @@ -3648,7 +3588,6 @@ - @@ -3676,7 +3615,6 @@ - @@ -3704,7 +3642,6 @@ - @@ -3732,7 +3669,6 @@ - @@ -3760,7 +3696,6 @@ - @@ -3788,7 +3723,6 @@ - @@ -3816,7 +3750,6 @@ - @@ -3844,7 +3777,6 @@ - @@ -3872,7 +3804,6 @@ - @@ -3900,7 +3831,6 @@ - @@ -3928,7 +3858,6 @@ - @@ -3957,7 +3886,6 @@ - @@ -3987,7 +3915,6 @@ - @@ -4016,7 +3943,6 @@ - @@ -4043,7 +3969,6 @@ - @@ -4070,7 +3995,6 @@ - @@ -4097,7 +4021,6 @@ - @@ -4124,7 +4047,6 @@ - @@ -4151,7 +4073,6 @@ - @@ -4178,7 +4099,6 @@ - @@ -4205,7 +4125,6 @@ - @@ -4232,7 +4151,6 @@ - @@ -4259,7 +4177,6 @@ - @@ -4286,7 +4203,6 @@ - @@ -4313,7 +4229,6 @@ - @@ -4340,7 +4255,6 @@ - @@ -4367,7 +4281,6 @@ - @@ -4394,7 +4307,6 @@ - @@ -4421,7 +4333,6 @@ - @@ -4448,7 +4359,6 @@ - @@ -4475,7 +4385,6 @@ - @@ -4501,7 +4410,6 @@ abc - @@ -4524,7 +4432,6 @@ abc - @@ -4547,7 +4454,6 @@ abc - @@ -4570,7 +4476,6 @@ abc - @@ -4593,7 +4498,6 @@ abc - @@ -4616,7 +4520,6 @@ ab - @@ -4639,7 +4542,6 @@ ab - @@ -4662,7 +4564,6 @@ ab - @@ -4688,7 +4589,6 @@ - @@ -4715,7 +4615,6 @@ - @@ -4742,7 +4641,6 @@ - @@ -4769,7 +4667,6 @@ - @@ -4796,7 +4693,6 @@ - @@ -4823,7 +4719,6 @@ - @@ -4850,7 +4745,6 @@ - @@ -4877,7 +4771,6 @@ - @@ -4906,7 +4799,6 @@ - @@ -4936,7 +4828,6 @@ - From 28759392117d7d2e93c8b1c100fdcb522c633f94 Mon Sep 17 00:00:00 2001 From: "Friedrich W. H. Kossebau" Date: Thu, 26 Mar 2015 17:22:36 +0100 Subject: [PATCH 20/24] Add transformAddAnnotationAddAnnotation --- webodf/lib/ops/OperationTransformMatrix.js | 33 ++- webodf/tests/ops/transformationtests.xml | 277 +++++++++++++++++++++ 2 files changed, 309 insertions(+), 1 deletion(-) diff --git a/webodf/lib/ops/OperationTransformMatrix.js b/webodf/lib/ops/OperationTransformMatrix.js index 007dba5b..2ade657d 100644 --- a/webodf/lib/ops/OperationTransformMatrix.js +++ b/webodf/lib/ops/OperationTransformMatrix.js @@ -273,6 +273,37 @@ ops.OperationTransformMatrix = function OperationTransformMatrix() { /* Transformation methods */ + /** + * @param {!ops.OpAddAnnotation.Spec} addAnnotationSpecA + * @param {!ops.OpAddAnnotation.Spec} addAnnotationSpecB + * @param {!boolean} hasAPriority + * @return {?{opSpecsA:!Array., opSpecsB:!Array.}} + */ + function transformAddAnnotationAddAnnotation(addAnnotationSpecA, addAnnotationSpecB, hasAPriority) { + var firstAnnotationSpec, secondAnnotationSpec; + + if (addAnnotationSpecA.position < addAnnotationSpecB.position) { + firstAnnotationSpec = addAnnotationSpecA; + secondAnnotationSpec = addAnnotationSpecB; + } else if (addAnnotationSpecB.position < addAnnotationSpecA.position) { + firstAnnotationSpec = addAnnotationSpecB; + secondAnnotationSpec = addAnnotationSpecA; + } else { + firstAnnotationSpec = hasAPriority ? addAnnotationSpecA : addAnnotationSpecB; + secondAnnotationSpec = hasAPriority ? addAnnotationSpecB : addAnnotationSpecA; + } + + if (secondAnnotationSpec.position < firstAnnotationSpec.position + firstAnnotationSpec.length) { + firstAnnotationSpec.length += 2; + } + secondAnnotationSpec.position += 2; + + return { + opSpecsA: [addAnnotationSpecA], + opSpecsB: [addAnnotationSpecB] + }; + } + /** * @param {!ops.OpAddAnnotation.Spec} addAnnotationSpec * @param {!ops.OpApplyDirectStyling.Spec} applyDirectStylingSpec @@ -1903,7 +1934,7 @@ ops.OperationTransformMatrix = function OperationTransformMatrix() { transformations; transformations = { "AddAnnotation": { -// "AddAnnotation": passUnchanged, + "AddAnnotation": transformAddAnnotationAddAnnotation, "AddCursor": passUnchanged, "AddMember": passUnchanged, "AddStyle": passUnchanged, diff --git a/webodf/tests/ops/transformationtests.xml b/webodf/tests/ops/transformationtests.xml index 5eb0225c..39096642 100644 --- a/webodf/tests/ops/transformationtests.xml +++ b/webodf/tests/ops/transformationtests.xml @@ -1990,6 +1990,283 @@ + + + + abcde + + + + + + + + + + + + Bob + 2013-08-05T12:34:07.061Z + + + + + + abc + Alice + 2013-08-05T12:34:07.061Z + + + + + + de + + + + + Order of office:annotation and office:annotation-end at same position not defined + + + abcde + + + + + + + + + + + a + Bob + 2013-08-05T12:34:07.061Z + + + + + + bc + Alice + 2013-08-05T12:34:07.061Z + + + + + + de + + + + + + + abcde + + + + + + + + + + + ab + Bob + 2013-08-05T12:34:07.061Z + + + + + + c + Alice + 2013-08-05T12:34:07.061Z + + + + + + de + + + + + Order of multiple office:annotation-end at same position not defined + + + abcde + + + + + + + + + + + ab + Bob + 2013-08-05T12:34:07.061Z + + + + + + c + Alice + 2013-08-05T12:34:07.061Z + + + + + + de + + + + + + + abcdef + + + + + + + + + + + ab + Bob + 2013-08-05T12:34:07.061Z + + + + + + c + Alice + 2013-08-05T12:34:07.061Z + + + + + + def + + + + + Order of office:annotation and office:annotation-end at same position not defined + + + abcde + + + + + + + + + + + ab + Bob + 2013-08-05T12:34:07.061Z + + + + + + + Alice + 2013-08-05T12:34:07.061Z + + + + + + cde + + + + + + + abcde + + + + + + + + + + + ab + Bob + 2013-08-05T12:34:07.061Z + + + + + + + Alice + 2013-08-05T12:34:07.061Z + + + + + + cde + + + + + Order of multiple office:annotation-end at same position not defined + + + abcde + + + + + + + + + + + ab + Bob + 2013-08-05T12:34:07.061Z + + + + + + + Alice + 2013-08-05T12:34:07.061Z + + + + + + cde + + + + From 0327e69611909ca8015b4e2582d97906a99bbeaa Mon Sep 17 00:00:00 2001 From: "Friedrich W. H. Kossebau" Date: Thu, 26 Mar 2015 18:24:02 +0100 Subject: [PATCH 21/24] Support multiple annotations in TransformationTests' linkAnnotationEndToStart --- webodf/tests/ops/TransformationTests.js | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/webodf/tests/ops/TransformationTests.js b/webodf/tests/ops/TransformationTests.js index a3e55ea1..6fdb1fa9 100644 --- a/webodf/tests/ops/TransformationTests.js +++ b/webodf/tests/ops/TransformationTests.js @@ -601,9 +601,18 @@ ops.TransformationTests = function TransformationTests(runner) { return { setUp: function () { var rootElement = t.odfContainer.rootElement, - annotation = rootElement.getElementsByTagNameNS(odf.Namespaces.officens, "annotation")[0], - annotationEnd = rootElement.getElementsByTagNameNS(odf.Namespaces.officens, "annotation-end")[0]; - annotation.annotationEndElement = annotationEnd; + annotationElements = rootElement.getElementsByTagNameNS(odf.Namespaces.officens, "annotation"), + annotationEndElements = rootElement.getElementsByTagNameNS(odf.Namespaces.officens, "annotation-end"), + annotations = {}, + i, name; + for (i = 0; i < annotationElements.length; i += 1) { + name = annotationElements[i].getAttributeNS(odf.Namespaces.officens, "name"); + annotations[name] = annotationElements[i]; + } + for (i = 0; i < annotationEndElements.length; i += 1) { + name = annotationEndElements[i].getAttributeNS(odf.Namespaces.officens, "name"); + annotations[name].annotationEndElement = annotationEndElements[i]; + } }, tearDown: function () {} }; From 19a3ffce2d426dd45ad7318ef1d1310061b94269 Mon Sep 17 00:00:00 2001 From: "Friedrich W. H. Kossebau" Date: Thu, 26 Mar 2015 18:38:28 +0100 Subject: [PATCH 22/24] Add transformRemoveAnnotationRemoveAnnotation --- webodf/lib/ops/OperationTransformMatrix.js | 29 +- webodf/tests/ops/transformationtests.xml | 333 +++++++++++++++++++++ 2 files changed, 361 insertions(+), 1 deletion(-) diff --git a/webodf/lib/ops/OperationTransformMatrix.js b/webodf/lib/ops/OperationTransformMatrix.js index 2ade657d..a947141b 100644 --- a/webodf/lib/ops/OperationTransformMatrix.js +++ b/webodf/lib/ops/OperationTransformMatrix.js @@ -1555,6 +1555,33 @@ ops.OperationTransformMatrix = function OperationTransformMatrix() { }; } + /** + * @param {!ops.OpRemoveAnnotation.Spec} removeAnnotationSpecA + * @param {!ops.OpRemoveAnnotation.Spec} removeAnnotationSpecB + * @return {?{opSpecsA:!Array., opSpecsB:!Array.}} + */ + function transformRemoveAnnotationRemoveAnnotation(removeAnnotationSpecA, removeAnnotationSpecB) { + var removeAnnotationSpecAResult = [removeAnnotationSpecA], + removeAnnotationSpecBResult = [removeAnnotationSpecB]; + + // check if removing the same annotation + if (removeAnnotationSpecA.position === removeAnnotationSpecB.position && removeAnnotationSpecA.length === removeAnnotationSpecB.length) { + removeAnnotationSpecAResult = []; + removeAnnotationSpecBResult = []; + } else { + if (removeAnnotationSpecA.position < removeAnnotationSpecB.position) { + removeAnnotationSpecB.position -= removeAnnotationSpecA.length + 2; + } else { + removeAnnotationSpecA.position -= removeAnnotationSpecB.length + 2; + } + } + + return { + opSpecsA: removeAnnotationSpecAResult, + opSpecsB: removeAnnotationSpecBResult + }; + } + /** * @param {!ops.OpRemoveAnnotation.Spec} removeAnnotationSpec * @param {!ops.OpRemoveText.Spec} removeTextSpec @@ -2063,7 +2090,7 @@ ops.OperationTransformMatrix = function OperationTransformMatrix() { "UpdateParagraphStyle": passUnchanged }, "RemoveAnnotation": { -// "RemoveAnnotation": passUnchanged, + "RemoveAnnotation": transformRemoveAnnotationRemoveAnnotation, "RemoveCursor": passUnchanged, "RemoveMember": passUnchanged, "RemoveStyle": passUnchanged, diff --git a/webodf/tests/ops/transformationtests.xml b/webodf/tests/ops/transformationtests.xml index 39096642..ca60661a 100644 --- a/webodf/tests/ops/transformationtests.xml +++ b/webodf/tests/ops/transformationtests.xml @@ -7030,6 +7030,339 @@ + + + + a + Bob + 2013-08-05T12:34:07.061Z + + + AA + + + bc + Alice + 2013-08-05T12:34:07.061Z + + + AA + + + d + + + + + + + + + + + abcd + + + + + + + a + Bob + 2013-08-05T12:34:07.061Z + + + AA + + + bc + Alice + 2013-08-05T12:34:07.061Z + + + AA + + + d + + + + + + + + + + + abcd + + + + + + + a + Bob + 2013-08-05T12:34:07.061Z + + + AA + + + b + Alice + 2013-08-05T12:34:07.061Z + + + AA + + + cd + + + + + + + + + + + abcd + + + + + + + a + Bob + 2013-08-05T12:34:07.061Z + + + AA + + + b + Alice + 2013-08-05T12:34:07.061Z + + + AA + + + cd + + + + + + + + + + + abcd + + + + + + + a + Bob + 2013-08-05T12:34:07.061Z + + + AA + + + b + Alice + 2013-08-05T12:34:07.061Z + + + AA + + + cd + + + + + + + + + + + abcd + + + + + + + a + Bob + 2013-08-05T12:34:07.061Z + + + AA + + + + Alice + 2013-08-05T12:34:07.061Z + + + AA + + + bcd + + + + + + + + + + + abcd + + + + + + + a + Bob + 2013-08-05T12:34:07.061Z + + + AA + + + + Alice + 2013-08-05T12:34:07.061Z + + + AA + + + bcd + + + + + + + + + + + abcd + + + + + + + a + Bob + 2013-08-05T12:34:07.061Z + + + AA + + + + Alice + 2013-08-05T12:34:07.061Z + + + AA + + + bcd + + + + + + + + + + + abcd + + + + + + + a + Bob + 2013-08-05T12:34:07.061Z + + + AA + + + + Alice + 2013-08-05T12:34:07.061Z + + + AA + + + bcd + + + + + + + + + + + abcd + + + + + + + a + Alice + 2013-08-05T12:34:07.061Z + + + AA + + + bcd + + + + + + + + + + + abcd + + + + From 0a13b44fd353177d5507b868d626378a3a16222f Mon Sep 17 00:00:00 2001 From: "Friedrich W. H. Kossebau" Date: Fri, 27 Mar 2015 11:21:12 +0100 Subject: [PATCH 23/24] Add transformAddAnnotationRemoveAnnotation --- webodf/lib/ops/OperationTransformMatrix.js | 26 +- webodf/tests/ops/transformationtests.xml | 545 +++++++++++++++++++++ 2 files changed, 570 insertions(+), 1 deletion(-) diff --git a/webodf/lib/ops/OperationTransformMatrix.js b/webodf/lib/ops/OperationTransformMatrix.js index a947141b..bfd28073 100644 --- a/webodf/lib/ops/OperationTransformMatrix.js +++ b/webodf/lib/ops/OperationTransformMatrix.js @@ -402,6 +402,30 @@ ops.OperationTransformMatrix = function OperationTransformMatrix() { }; } + /** + * @param {!ops.OpAddAnnotation.Spec} addAnnotationSpec + * @param {!ops.OpRemoveAnnotation.Spec} removeAnnotationSpec + * @return {?{opSpecsA:!Array., opSpecsB:!Array.}} + */ + function transformAddAnnotationRemoveAnnotation(addAnnotationSpec, removeAnnotationSpec) { + // adapt movecursor spec to inserted positions + if (addAnnotationSpec.position < removeAnnotationSpec.position) { + if (removeAnnotationSpec.position < addAnnotationSpec.position + addAnnotationSpec.length) { + addAnnotationSpec.length -= removeAnnotationSpec.length + 2; + } + // 2, because 1 for pos inside annotation comment, 1 for new pos before annotated range + removeAnnotationSpec.position += 2; + } else { + // 2, because 1 for pos inside annotation comment, 1 for new pos before annotated range + addAnnotationSpec.position -= removeAnnotationSpec.length + 2; + } + + return { + opSpecsA: [addAnnotationSpec], + opSpecsB: [removeAnnotationSpec] + }; + } + /** * @param {!ops.OpAddAnnotation.Spec} addAnnotationSpec * @param {!ops.OpRemoveText.Spec} removeTextSpec @@ -1969,7 +1993,7 @@ ops.OperationTransformMatrix = function OperationTransformMatrix() { "InsertText": transformAddAnnotationInsertText, "MergeParagraph": transformAddAnnotationMergeParagraph, "MoveCursor": transformAddAnnotationMoveCursor, -// "RemoveAnnotation": passUnchanged, + "RemoveAnnotation": transformAddAnnotationRemoveAnnotation, "RemoveCursor": passUnchanged, "RemoveMember": passUnchanged, "RemoveStyle": passUnchanged, diff --git a/webodf/tests/ops/transformationtests.xml b/webodf/tests/ops/transformationtests.xml index ca60661a..d8a8f4bd 100644 --- a/webodf/tests/ops/transformationtests.xml +++ b/webodf/tests/ops/transformationtests.xml @@ -4213,6 +4213,551 @@ + + + + a + Bob + 2013-08-05T12:34:07.061Z + + + AA + + + bcde + + + + + + + + + + + abc + Alice + 2013-08-05T12:34:07.061Z + + + + + + de + + + + + + + a + Bob + 2013-08-05T12:34:07.061Z + + + AA + + + bcde + + + + + + + + + + + abc + Alice + 2013-08-05T12:34:07.061Z + + + + + + de + + + + + + + a + Bob + 2013-08-05T12:34:07.061Z + + + AA + + + bcde + + + + + + + + + + + ab + Alice + 2013-08-05T12:34:07.061Z + + + + + + cde + + + + + + + a + Bob + 2013-08-05T12:34:07.061Z + + + AA + + + bcde + + + + + + + + + + + ab + Alice + 2013-08-05T12:34:07.061Z + + + + + + cde + + + + + + + a + Bob + 2013-08-05T12:34:07.061Z + + + AA + + + bcde + + + + + + + + + + + ab + Alice + 2013-08-05T12:34:07.061Z + + + + + + cde + + + + + + + ab + Bob + 2013-08-05T12:34:07.061Z + + + AA + + + cde + + + + + + + + + + + ab + Alice + 2013-08-05T12:34:07.061Z + + + + + + cde + + + + + + + ab + Bob + 2013-08-05T12:34:07.061Z + + + AA + + + cde + + + + + + + + + + + ab + Alice + 2013-08-05T12:34:07.061Z + + + + + + cde + + + + + + + ab + Bob + 2013-08-05T12:34:07.061Z + + + AA + + + cde + + + + + + + + + + + ab + Alice + 2013-08-05T12:34:07.061Z + + + + + + cde + + + + + + + ab + Bob + 2013-08-05T12:34:07.061Z + + + AA + + + cde + + + + + + + + + + + ab + Alice + 2013-08-05T12:34:07.061Z + + + + + + cde + + + + + + + abc + Bob + 2013-08-05T12:34:07.061Z + + + AA + + + de + + + + + + + + + + + ab + Alice + 2013-08-05T12:34:07.061Z + + + + + + cde + + + + + + + ab + Bob + 2013-08-05T12:34:07.061Z + + + AA + + + cde + + + + + + + + + + + a + Alice + 2013-08-05T12:34:07.061Z + + + + + + bcde + + + + + + + ab + Bob + 2013-08-05T12:34:07.061Z + + + AA + + + cde + + + + + + + + + + + a + Alice + 2013-08-05T12:34:07.061Z + + + + + + bcde + + + + + + + ab + Bob + 2013-08-05T12:34:07.061Z + + + AA + + + cde + + + + + + + + + + + a + Alice + 2013-08-05T12:34:07.061Z + + + + + + bcde + + + + + + + abc + Bob + 2013-08-05T12:34:07.061Z + + + AA + + + de + + + + + + + + + + + a + Alice + 2013-08-05T12:34:07.061Z + + + + + + bcde + + + + + + + abc + Bob + 2013-08-05T12:34:07.061Z + + + AA + + + de + + + + + + + + + + + a + Alice + 2013-08-05T12:34:07.061Z + + + + + + bcde + + + + + + + abc + Bob + 2013-08-05T12:34:07.061Z + + + AA + + + de + + + + + + + + + + + a + Alice + 2013-08-05T12:34:07.061Z + + + + + + bcde + + + + From b4854727b32dbd9215590a3a135d51013d78bf9e Mon Sep 17 00:00:00 2001 From: "Friedrich W. H. Kossebau" Date: Fri, 27 Mar 2015 11:40:13 +0100 Subject: [PATCH 24/24] Remove unstablefeature flag from annotations in Wodo.CollabTextEditor --- programs/editor/wodocollabtexteditor.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/programs/editor/wodocollabtexteditor.js b/programs/editor/wodocollabtexteditor.js index 540cb4cb..f744f344 100644 --- a/programs/editor/wodocollabtexteditor.js +++ b/programs/editor/wodocollabtexteditor.js @@ -179,7 +179,7 @@ window.Wodo = window.Wodo || (function () { imageEditingEnabled = isEnabled(editorOptions.imageEditingEnabled, true), hyperlinkEditingEnabled = isEnabled(editorOptions.hyperlinkEditingEnabled, true), reviewModeEnabled = isEnabled(editorOptions.reviewModeEnabled, true), - annotationsEnabled = reviewModeEnabled || isEnabled(editorOptions.annotationsEnabled, true), + annotationsEnabled = reviewModeEnabled || isEnabled(editorOptions.annotationsEnabled), undoRedoEnabled = false, // no proper mechanism yet for collab zoomingEnabled = isEnabled(editorOptions.zoomingEnabled), //