jenkins-bot has submitted this change and it was merged.
Change subject: Do not skip past adjacent unicorn in different branch node
......................................................................
Do not skip past adjacent unicorn in different branch node
Bug: T118876
Change-Id: I92840962f5cc8e6de75775eb796edf8fa6ebe0c7
---
M src/ce/ve.ce.BranchNode.js
M src/ce/ve.ce.Document.js
2 files changed, 19 insertions(+), 5 deletions(-)
Approvals:
Jforrester: Looks good to me, approved
jenkins-bot: Verified
diff --git a/src/ce/ve.ce.BranchNode.js b/src/ce/ve.ce.BranchNode.js
index f107bc5..54220b0 100644
--- a/src/ce/ve.ce.BranchNode.js
+++ b/src/ce/ve.ce.BranchNode.js
@@ -337,6 +337,7 @@
return this.slugNodes[ i + 1 ] || null;
}
}
+ return null;
};
/**
diff --git a/src/ce/ve.ce.Document.js b/src/ce/ve.ce.Document.js
index fc78b8a..a11e7d4 100644
--- a/src/ce/ve.ce.Document.js
+++ b/src/ce/ve.ce.Document.js
@@ -58,14 +58,20 @@
var nao, currentNode, nextNode, previousNode;
// Get the un-unicorn-adjusted result. If it is:
- // - just before pre unicorn, then return the cursor location just
after it
- // - just after the post unicorn, then return the cursor location just
before it
- // - anywhere else, then return the result unmodified
+ // - just before pre unicorn (in same branch node), return cursor
location just after it
+ // - just after post unicorn (in same branch node), return cursor
location just before it
+ // - anywhere else, return the result unmodified
+ /**
+ * Get the next DOM node in document order within the same
.ve-ce-branchNode
+ *
+ * @param {Node} node The current node
+ * @return {Node|null} The next node
+ */
function getNext( node ) {
while ( node.nextSibling === null ) {
node = node.parentNode;
- if ( node === null ) {
+ if ( !node || node.classList.contains(
've-ce-branchNode' ) ) {
return null;
}
}
@@ -75,10 +81,17 @@
}
return node;
}
+
+ /**
+ * Get the previous DOM node in document order within the same
.ve-ce-branchNode
+ *
+ * @param {Node} node The current node
+ * @return {Node|null} The previous node
+ */
function getPrevious( node ) {
while ( node.previousSibling === null ) {
node = node.parentNode;
- if ( node === null ) {
+ if ( !node || node.classList.contains(
've-ce-branchNode' ) ) {
return null;
}
}
--
To view, visit https://gerrit.wikimedia.org/r/254424
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I92840962f5cc8e6de75775eb796edf8fa6ebe0c7
Gerrit-PatchSet: 1
Gerrit-Project: VisualEditor/VisualEditor
Gerrit-Branch: master
Gerrit-Owner: Divec <[email protected]>
Gerrit-Reviewer: Divec <[email protected]>
Gerrit-Reviewer: Esanders <[email protected]>
Gerrit-Reviewer: Jforrester <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits