Added hyperlink support for text elements

This commit is contained in:
lli
2013-12-13 17:40:21 +11:00
parent aced247fdd
commit 05f41bac2f
8 changed files with 512 additions and 19 deletions
+18 -15
View File
@@ -309,19 +309,6 @@ set(UNTYPEDLIBJSFILES
lib/ops/OdtCursor.js
lib/ops/OdtDocument.js
lib/ops/Operation.js
lib/xmldom/RelaxNG.js
lib/xmldom/RelaxNG2.js
lib/gui/Caret.js
lib/gui/EventManager.js
lib/gui/ShadowCursor.js
lib/gui/UndoManager.js
lib/gui/UndoStateRules.js
lib/ops/EditInfo.js
lib/ops/OpAddAnnotation.js
lib/ops/OpAddCursor.js
lib/ops/OpAddMember.js
lib/ops/OpAddStyle.js
lib/ops/OpApplyDirectStyling.js
lib/ops/OpInsertImage.js
lib/ops/OpInsertTable.js
lib/ops/OpInsertText.js
@@ -329,6 +316,7 @@ set(UNTYPEDLIBJSFILES
lib/ops/OpRemoveAnnotation.js
lib/ops/OpRemoveBlob.js
lib/ops/OpRemoveCursor.js
lib/ops/OpRemoveHyperlink.js
lib/ops/OpRemoveMember.js
lib/ops/OpRemoveStyle.js
lib/ops/OpRemoveText.js
@@ -338,20 +326,35 @@ set(UNTYPEDLIBJSFILES
lib/ops/OpUpdateMember.js
lib/ops/OpUpdateMetadata.js
lib/ops/OpUpdateParagraphStyle.js
lib/xmldom/RelaxNG.js
lib/xmldom/RelaxNG2.js
lib/gui/Caret.js
lib/gui/EventManager.js
lib/gui/PlainTextPasteboard.js
lib/gui/ShadowCursor.js
lib/gui/UndoManager.js
lib/gui/UndoStateRules.js
lib/ops/EditInfo.js
lib/ops/OpAddAnnotation.js
lib/ops/OpAddCursor.js
lib/ops/OpAddMember.js
lib/ops/OpAddStyle.js
lib/ops/OpApplyDirectStyling.js
lib/ops/OpApplyHyperlink.js
lib/ops/OperationFactory.js
lib/ops/OperationRouter.js
lib/ops/OperationTransformMatrix.js
lib/ops/OperationTransformer.js
lib/ops/TrivialOperationRouter.js
lib/gui/EditInfoMarker.js
lib/gui/PlainTextPasteboard.js
lib/gui/SelectionView.js
lib/gui/SelectionViewManager.js
lib/gui/TrivialUndoManager.js
lib/ops/OperationTransformer.js
lib/ops/Session.js
lib/gui/AnnotationController.js
lib/gui/DirectParagraphStyler.js
lib/gui/DirectTextStyler.js
lib/gui/HyperlinkManager.js
lib/gui/ImageManager.js
lib/gui/TextManipulator.js
lib/gui/SessionController.js
+173
View File
@@ -0,0 +1,173 @@
/**
* Copyright (C) 2013 KO GmbH <copyright@kogmbh.com>
*
* @licstart
* The JavaScript code in this page is free software: you can redistribute it
* and/or modify it under the terms of the GNU Affero General Public License
* (GNU AGPL) as published by the Free Software Foundation, either version 3 of
* the License, or (at your option) any later version. The code is distributed
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU AGPL for more details.
*
* As additional permission under GNU AGPL version 3 section 7, you
* may distribute non-source (e.g., minimized or compacted) forms of
* that code without the copy of the GNU GPL normally required by
* section 4, provided you include this license notice and a URL
* through which recipients can access the Corresponding Source.
*
* As a special exception to the AGPL, any HTML file which merely makes function
* calls to this code, and for that purpose includes it by reference shall be
* deemed a separate work for copyright law purposes. In addition, the copyright
* holders of this code give you permission to combine this code with free
* software libraries that are released under the GNU LGPL. You may copy and
* distribute such a system following the terms of the GNU AGPL for this code
* and the LGPL for the libraries. If you modify this code, you may extend this
* exception to your version of the code, but you are not obligated to do so.
* If you do not wish to do so, delete this exception statement from your
* version.
*
* This license applies to this entire compilation.
* @licend
* @source: http://www.webodf.org/
* @source: http://gitorious.org/webodf/webodf/
*/
/*global runtime, core, gui, Node, ops, odf */
runtime.loadClass("odf.OdfUtils");
/**
* @constructor
* @param {!ops.Session} session
* @param {!string} inputMemberId
*/
gui.HyperlinkManager = function HyperlinkManager(session, inputMemberId) {
"use strict";
var odfUtils = new odf.OdfUtils(),
odtDocument = session.getOdtDocument();
/**
* Convert the current selection into a hyperlink
* @param {!string} hyperlink Hyperlink to insert
* @param {!string=} insertionText Optional text to insert as the text content for the hyperlink.
* Note, the insertion text will not replace the existing selection content.
*/
function addHyperlink(hyperlink, insertionText) {
var selection = odtDocument.getCursorSelection(inputMemberId),
op = new ops.OpApplyHyperlink(),
operations = [];
if (selection.length === 0 || insertionText) {
insertionText = insertionText || hyperlink;
op = new ops.OpInsertText();
op.init({
memberid: inputMemberId,
position: selection.position,
text: insertionText
});
selection.length = insertionText.length;
operations.push(op);
}
op = new ops.OpApplyHyperlink();
op.init({
memberid: inputMemberId,
position: selection.position,
length: selection.length,
hyperlink: hyperlink
});
operations.push(op);
session.enqueue(operations);
}
this.addHyperlink = addHyperlink;
/**
* Remove all hyperlinks within the current selection. If a range of text is selected,
* this will only unlink the selection. If the current selection is collapsed within a
* link, that entire link will be removed.
*/
function removeHyperlinks() {
var iterator = gui.SelectionMover.createPositionIterator(odtDocument.getRootNode()),
selectedRange = odtDocument.getCursor(inputMemberId).getSelectedRange(),
links = odfUtils.getHyperlinkElements(selectedRange),
removeEntireLink = selectedRange.collapsed && links.length === 1,
domRange = odtDocument.getDOM().createRange(),
operations = [],
cursorRange, firstLink, lastLink, offset, op;
if (links.length === 0) {
return;
}
// Remove any links that overlap with the current selection
links.forEach(function (link) {
domRange.selectNodeContents(link);
cursorRange = odtDocument.convertDomToCursorRange({
anchorNode: /**@type{!Node}*/(domRange.startContainer),
anchorOffset: domRange.startOffset,
focusNode: /**@type{!Node}*/(domRange.endContainer),
focusOffset: domRange.endOffset
});
op = new ops.OpRemoveHyperlink();
op.init({
memberid: inputMemberId,
position: cursorRange.position,
length: cursorRange.length
});
operations.push(op);
});
if (!removeEntireLink) {
// Re-add any leading or trailing links that were only partially selected
firstLink = /**@type{!Element}*/(links[0]);
if (selectedRange.comparePoint(firstLink, 0) === -1) {
domRange.setStart(firstLink, 0);
domRange.setEnd(selectedRange.startContainer, selectedRange.startOffset);
cursorRange = odtDocument.convertDomToCursorRange({
anchorNode: /**@type{!Node}*/(domRange.startContainer),
anchorOffset: domRange.startOffset,
focusNode: /**@type{!Node}*/(domRange.endContainer),
focusOffset: domRange.endOffset
});
if (cursorRange.length > 0) {
op = new ops.OpApplyHyperlink();
op.init({
memberid: inputMemberId,
position: cursorRange.position,
length: cursorRange.length,
hyperlink: odfUtils.getHyperlinkTarget(firstLink)
});
operations.push(op);
}
}
lastLink = /**@type{!Element}*/(links[links.length - 1]);
iterator.moveToEndOfNode(lastLink);
offset = iterator.unfilteredDomOffset();
if (selectedRange.comparePoint(lastLink, offset) === 1) {
domRange.setStart(selectedRange.endContainer, selectedRange.endOffset);
domRange.setEnd(lastLink, offset);
cursorRange = odtDocument.convertDomToCursorRange({
anchorNode: /**@type{!Node}*/(domRange.startContainer),
anchorOffset: domRange.startOffset,
focusNode: /**@type{!Node}*/(domRange.endContainer),
focusOffset: domRange.endOffset
});
if (cursorRange.length > 0) {
op = new ops.OpApplyHyperlink();
op.init({
memberid: inputMemberId,
position: cursorRange.position,
length: cursorRange.length,
hyperlink: odfUtils.getHyperlinkTarget(lastLink)
});
operations.push(op);
}
}
}
session.enqueue(operations);
domRange.detach();
}
this.removeHyperlinks = removeHyperlinks;
};
+10 -2
View File
@@ -50,6 +50,7 @@ runtime.loadClass("gui.Clipboard");
runtime.loadClass("gui.DirectTextStyler");
runtime.loadClass("gui.DirectParagraphStyler");
runtime.loadClass("gui.KeyboardHandler");
runtime.loadClass("gui.HyperlinkManager");
runtime.loadClass("gui.ImageManager");
runtime.loadClass("gui.ImageSelector");
runtime.loadClass("gui.TextManipulator");
@@ -107,7 +108,8 @@ gui.SessionController = (function () {
drawShadowCursorTask,
redrawRegionSelectionTask,
pasteHandler = new gui.PlainTextPasteboard(odtDocument, inputMemberId),
clickCount = 0;
clickCount = 0,
hyperlinkManager = new gui.HyperlinkManager(session, inputMemberId);
runtime.assert(window !== null,
"Expected to be run in an environment which has a global window, like a browser.");
@@ -1126,7 +1128,6 @@ gui.SessionController = (function () {
return undoManager;
};
/**
* @returns {?gui.AnnotationController}
*/
@@ -1148,6 +1149,13 @@ gui.SessionController = (function () {
return directParagraphStyler;
};
/**
* @returns {!gui.HyperlinkManager}
*/
this.getHyperlinkManager = function () {
return hyperlinkManager;
};
/**
* @returns {!gui.ImageManager}
*/
+25
View File
@@ -111,6 +111,15 @@
"gui/EventManager.js": [
"ops/OdtDocument.js"
],
"gui/HyperlinkManager.js": [
"gui/SelectionMover.js",
"odf/OdfUtils.js",
"ops/OpApplyHyperlink.js",
"ops/OpInsertText.js",
"ops/OpMoveCursor.js",
"ops/OpRemoveHyperlink.js",
"ops/Session.js"
],
"gui/ImageManager.js": [
"odf/Namespaces.js",
"odf/ObjectNameGenerator.js",
@@ -164,6 +173,7 @@
"gui/DirectParagraphStyler.js",
"gui/DirectTextStyler.js",
"gui/EventManager.js",
"gui/HyperlinkManager.js",
"gui/ImageManager.js",
"gui/ImageSelector.js",
"gui/KeyboardHandler.js",
@@ -362,6 +372,13 @@
"ops/OdtDocument.js",
"ops/Operation.js"
],
"ops/OpApplyHyperlink.js": [
"core/DomUtils.js",
"odf/Namespaces.js",
"odf/OdfUtils.js",
"ops/OdtDocument.js",
"ops/Operation.js"
],
"ops/OpInsertImage.js": [
"odf/Namespaces.js",
"ops/OdtDocument.js",
@@ -392,6 +409,12 @@
"ops/OpRemoveCursor.js": [
"ops/Operation.js"
],
"ops/OpRemoveHyperlink.js": [
"core/DomUtils.js",
"odf/OdfUtils.js",
"ops/OdtDocument.js",
"ops/Operation.js"
],
"ops/OpRemoveMember.js": [
"ops/Member.js",
"ops/OdtDocument.js",
@@ -444,6 +467,7 @@
"ops/OpAddMember.js",
"ops/OpAddStyle.js",
"ops/OpApplyDirectStyling.js",
"ops/OpApplyHyperlink.js",
"ops/OpInsertImage.js",
"ops/OpInsertTable.js",
"ops/OpInsertText.js",
@@ -451,6 +475,7 @@
"ops/OpRemoveAnnotation.js",
"ops/OpRemoveBlob.js",
"ops/OpRemoveCursor.js",
"ops/OpRemoveHyperlink.js",
"ops/OpRemoveMember.js",
"ops/OpRemoveStyle.js",
"ops/OpRemoveText.js",
+131
View File
@@ -0,0 +1,131 @@
/**
* @license
* Copyright (C) 2012-2013 KO GmbH <copyright@kogmbh.com>
*
* @licstart
* The JavaScript code in this page is free software: you can redistribute it
* and/or modify it under the terms of the GNU Affero General Public License
* (GNU AGPL) as published by the Free Software Foundation, either version 3 of
* the License, or (at your option) any later version. The code is distributed
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU AGPL for more details.
*
* As additional permission under GNU AGPL version 3 section 7, you
* may distribute non-source (e.g., minimized or compacted) forms of
* that code without the copy of the GNU GPL normally required by
* section 4, provided you include this license notice and a URL
* through which recipients can access the Corresponding Source.
*
* As a special exception to the AGPL, any HTML file which merely makes function
* calls to this code, and for that purpose includes it by reference shall be
* deemed a separate work for copyright law purposes. In addition, the copyright
* holders of this code give you permission to combine this code with free
* software libraries that are released under the GNU LGPL. You may copy and
* distribute such a system following the terms of the GNU AGPL for this code
* and the LGPL for the libraries. If you modify this code, you may extend this
* exception to your version of the code, but you are not obligated to do so.
* If you do not wish to do so, delete this exception statement from your
* version.
*
* This license applies to this entire compilation.
* @licend
* @source: http://www.webodf.org/
* @source: http://gitorious.org/webodf/webodf/
*/
/*global ops, odf, core, runtime, Node */
runtime.loadClass("core.DomUtils");
runtime.loadClass("odf.OdfUtils");
/**
* @constructor
* @implements ops.Operation
*/
ops.OpApplyHyperlink = function OpApplyHyperlink() {
"use strict";
var memberid, timestamp, position, length, hyperlink,
domUtils = new core.DomUtils(),
odfUtils = new odf.OdfUtils();
this.init = function (data) {
memberid = data.memberid;
timestamp = data.timestamp;
position = data.position;
length = data.length;
hyperlink = data.hyperlink;
};
this.isEdit = true;
function createHyperlink(document, hyperlink) {
var node = document.createElementNS(odf.Namespaces.textns, 'text:a');
node.setAttributeNS(odf.Namespaces.xlinkns, 'xlink:type', 'simple');
node.setAttributeNS(odf.Namespaces.xlinkns, 'xlink:href', hyperlink);
return node;
}
function isPartOfLink(node) {
while (node) {
if (odfUtils.isHyperlink(node)) {
return true;
}
node = node.parentNode;
}
return false;
}
// TODO: support adding image link
this.execute = function (odtDocument) {
var ownerDocument = odtDocument.getDOM(),
range = odtDocument.convertCursorToDomRange(position, length),
boundaryNodes = domUtils.splitBoundaries(range),
modifiedParagraphs = [],
textNodes = odfUtils.getTextNodes(range, false);
if (textNodes.length === 0) {
return false;
}
textNodes.forEach(function (node) {
var linkNode,
paragraph = odfUtils.getParagraphElement(node);
runtime.assert(isPartOfLink(node) === false, "The given range should not contain any link.");
// TODO there could be a small efficiency gain by merging adjacent text nodes into a single hyperlink parent.
// This is probably only a corner case however and there are not likely to be major repercussions for not doing it
linkNode = createHyperlink(ownerDocument, hyperlink);
node.parentNode.insertBefore(linkNode, node);
linkNode.appendChild(node);
odtDocument.getOdfCanvas().registerLink(linkNode);
if (modifiedParagraphs.indexOf(paragraph) === -1) {
modifiedParagraphs.push(paragraph);
}
});
boundaryNodes.forEach(domUtils.normalizeTextNodes);
range.detach();
odtDocument.getOdfCanvas().refreshSize();
odtDocument.getOdfCanvas().rerenderAnnotations();
modifiedParagraphs.forEach(function (paragraph) {
odtDocument.emit(ops.OdtDocument.signalParagraphChanged, {
paragraphElement: paragraph,
memberId: memberid,
timeStamp: timestamp
});
});
return true;
};
this.spec = function () {
return {
optype: "ApplyHyperlink",
memberid: memberid,
timestamp: timestamp,
position: position,
length: length,
hyperlink: hyperlink
};
};
};
+87
View File
@@ -0,0 +1,87 @@
/**
* @license
* Copyright (C) 2012-2013 KO GmbH <copyright@kogmbh.com>
*
* @licstart
* The JavaScript code in this page is free software: you can redistribute it
* and/or modify it under the terms of the GNU Affero General Public License
* (GNU AGPL) as published by the Free Software Foundation, either version 3 of
* the License, or (at your option) any later version. The code is distributed
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU AGPL for more details.
*
* As additional permission under GNU AGPL version 3 section 7, you
* may distribute non-source (e.g., minimized or compacted) forms of
* that code without the copy of the GNU GPL normally required by
* section 4, provided you include this license notice and a URL
* through which recipients can access the Corresponding Source.
*
* As a special exception to the AGPL, any HTML file which merely makes function
* calls to this code, and for that purpose includes it by reference shall be
* deemed a separate work for copyright law purposes. In addition, the copyright
* holders of this code give you permission to combine this code with free
* software libraries that are released under the GNU LGPL. You may copy and
* distribute such a system following the terms of the GNU AGPL for this code
* and the LGPL for the libraries. If you modify this code, you may extend this
* exception to your version of the code, but you are not obligated to do so.
* If you do not wish to do so, delete this exception statement from your
* version.
*
* This license applies to this entire compilation.
* @licend
* @source: http://www.webodf.org/
* @source: http://gitorious.org/webodf/webodf/
*/
/*global ops, odf, core, runtime */
runtime.loadClass("core.DomUtils");
runtime.loadClass("odf.OdfUtils");
/**
* @constructor
* @implements ops.Operation
*/
ops.OpRemoveHyperlink = function OpRemoveHyperlink() {
"use strict";
var memberid, timestamp, position, length,
domUtils = new core.DomUtils(),
odfUtils = new odf.OdfUtils();
this.init = function (data) {
memberid = data.memberid;
timestamp = data.timestamp;
position = data.position;
length = data.length;
};
this.isEdit = true;
this.execute = function (odtDocument) {
var range = odtDocument.convertCursorToDomRange(position, length),
links = odfUtils.getHyperlinkElements(range),
node;
runtime.assert(links.length === 1, "The given range should only contain a single link.");
node = domUtils.mergeIntoParent(links[0]);
range.detach();
odtDocument.getOdfCanvas().refreshSize();
odtDocument.emit(ops.OdtDocument.signalParagraphChanged, {
paragraphElement: odfUtils.getParagraphElement(node),
memberId: memberid,
timeStamp: timestamp
});
odtDocument.getOdfCanvas().rerenderAnnotations();
return true;
};
this.spec = function () {
return {
optype: "RemoveHyperlink",
memberid: memberid,
timestamp: timestamp,
position: position,
length: length
};
};
};
+5 -1
View File
@@ -63,6 +63,8 @@ runtime.loadClass("ops.OpRemoveStyle");
runtime.loadClass("ops.OpAddAnnotation");
runtime.loadClass("ops.OpRemoveAnnotation");
runtime.loadClass("ops.OpUpdateMetadata");
runtime.loadClass("ops.OpApplyHyperlink");
runtime.loadClass("ops.OpRemoveHyperlink");
/**
* @constructor
@@ -128,7 +130,9 @@ ops.OperationFactory = function OperationFactory() {
RemoveCursor : constructor(ops.OpRemoveCursor),
AddAnnotation : constructor(ops.OpAddAnnotation),
RemoveAnnotation : constructor(ops.OpRemoveAnnotation),
UpdateMetadata: constructor(ops.OpUpdateMetadata)
UpdateMetadata: constructor(ops.OpUpdateMetadata),
ApplyHyperlink: constructor(ops.OpApplyHyperlink),
RemoveHyperlink: constructor(ops.OpRemoveHyperlink)
};
}
+63 -1
View File
@@ -568,6 +568,20 @@
</ops>
<after><office:text><text:p text:style-name="B">efgh</text:p></office:text></after>
</test>
<test name="Remove_deleteLink1">
<before><office:text><text:p><text:a xlink:type="simple" xlink:href="http://www.hello.com"><text:span>Hello</text:span></text:a></text:p></office:text></before>
<ops>
<op optype="RemoveText" position="0" length="5"/>
</ops>
<after><office:text><text:p/></office:text></after>
</test>
<test name="Remove_deleteLink2">
<before><office:text><text:p><text:span><text:a xlink:type="simple" xlink:href="http://www.hello.com">Hello</text:a><text:a xlink:type="simple" xlink:href="http://www.world.com">World</text:a></text:span></text:p></office:text></before>
<ops>
<op optype="RemoveText" position="4" length="6"/>
</ops>
<after><office:text><text:p><text:span><text:a xlink:type="simple" xlink:href="http://www.hello.com">Hell</text:a></text:span></text:p></office:text></after>
</test>
<test name="Remove_deleteNearSpace">
<before><office:text><text:p>AB</text:p><text:p><text:s> </text:s><text:span>CD</text:span></text:p></office:text></before>
<ops>
@@ -1396,5 +1410,53 @@
<office:meta><meta:editing-cycles>1</meta:editing-cycles><dc:creator>Alice</dc:creator><dc:date>2013-08-05T12:34:07.061Z</dc:date></office:meta><office:text></office:text>
</after>
</test>
<test name="ApplyHyperlink_WithinSpan">
<before><office:text><text:p><text:span>Hello</text:span></text:p></office:text></before>
<ops>
<op optype="ApplyHyperlink" memberid="Alice" position="1" length="3" hyperlink="link1" />
</ops>
<after><office:text><text:p><text:span>H<text:a xlink:type="simple" xlink:href="link1">ell</text:a>o</text:span></text:p></office:text></after>
</test>
<test name="ApplyHyperlink_AcrossTwoSpan">
<before><office:text><text:p><text:span>Hello</text:span><text:span>World</text:span></text:p></office:text></before>
<ops>
<op optype="ApplyHyperlink" memberid="Alice" position="1" length="8" hyperlink="link1" />
</ops>
<after><office:text><text:p><text:span>H<text:a xlink:type="simple" xlink:href="link1">ello</text:a></text:span><text:span><text:a xlink:type="simple" xlink:href="link1">Worl</text:a>d</text:span></text:p></office:text></after>
</test>
<test name="ApplyHyperlink_AfterLink">
<before><office:text><text:p><text:a xlink:type="simple" xlink:href="link1">hello</text:a>world</text:p></office:text></before>
<ops>
<op optype="ApplyHyperlink" memberid="Alice" position="5" length="5" hyperlink="link2" />
</ops>
<after><office:text><text:p><text:a xlink:type="simple" xlink:href="link1">hello</text:a><text:a xlink:type="simple" xlink:href="link2">world</text:a></text:p></office:text></after>
</test>
<test name="ApplyHyperlink_BeforeLink">
<before><office:text><text:p>world<text:a xlink:type="simple" xlink:href="link1">hello</text:a></text:p></office:text></before>
<ops>
<op optype="ApplyHyperlink" memberid="Alice" position="0" length="5" hyperlink="link2" />
</ops>
<after><office:text><text:p><text:a xlink:type="simple" xlink:href="link2">world</text:a><text:a xlink:type="simple" xlink:href="link1">hello</text:a></text:p></office:text></after>
</test>
<test name="RemoveHyperlink_SingleLink">
<before><office:text><text:p><text:a xlink:type="simple" xlink:href="link1"><text:span>Hello</text:span><text:span>World</text:span></text:a></text:p></office:text></before>
<ops>
<op optype="RemoveHyperlink" memberid="Alice" position="1" length="8" />
</ops>
<after><office:text><text:p><text:span>Hello</text:span><text:span>World</text:span></text:p></office:text></after>
</test>
<test name="RemoveHyperlink_AfterLink">
<before><office:text><text:p><text:a xlink:type="simple" xlink:href="link1">hello</text:a><text:a xlink:type="simple" xlink:href="link2">world</text:a></text:p></office:text></before>
<ops>
<op optype="RemoveHyperlink" memberid="Alice" position="5" length="5" />
</ops>
<after><office:text><text:p><text:a xlink:type="simple" xlink:href="link1">hello</text:a>world</text:p></office:text></after>
</test>
<test name="RemoveHyperlink_BeforeLink">
<before><office:text><text:p><text:a xlink:type="simple" xlink:href="link1">hello</text:a><text:a xlink:type="simple" xlink:href="link2">world</text:a></text:p></office:text></before>
<ops>
<op optype="RemoveHyperlink" memberid="Alice" position="0" length="5" />
</ops>
<after><office:text><text:p>hello<text:a xlink:type="simple" xlink:href="link2">world</text:a></text:p></office:text></after>
</test>
</tests>