Divec has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/254424

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(-)


  git pull ssh://gerrit.wikimedia.org:29418/VisualEditor/VisualEditor 
refs/changes/24/254424/1

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: newchange
Gerrit-Change-Id: I92840962f5cc8e6de75775eb796edf8fa6ebe0c7
Gerrit-PatchSet: 1
Gerrit-Project: VisualEditor/VisualEditor
Gerrit-Branch: master
Gerrit-Owner: Divec <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to