jenkins-bot has submitted this change and it was merged. Change subject: Handle selection changes even when not dragging. ......................................................................
Handle selection changes even when not dragging. Move the drag test into a dedicated mousemove handler that polyfills selectionchange. Previously, links were not getting activated on mobile. Bug: T136795 Change-Id: Iabec6a6ad9c8482ed97ada9a5eb07c75b611109a --- M src/ce/ve.ce.RangeState.js M src/ce/ve.ce.Surface.js 2 files changed, 12 insertions(+), 13 deletions(-) Approvals: DLynch: Looks good to me, approved Jforrester: Looks good to me, but someone else must approve jenkins-bot: Verified diff --git a/src/ce/ve.ce.RangeState.js b/src/ce/ve.ce.RangeState.js index 27a7ef6..6ba6b04 100644 --- a/src/ce/ve.ce.RangeState.js +++ b/src/ce/ve.ce.RangeState.js @@ -127,14 +127,14 @@ this.branchNodeChanged = ( old && old.node ) !== this.node; // Compute text/hash/textState, for change comparison - if ( selectionOnly && !anchorNodeChanged ) { - this.text = old.text; - this.hash = old.hash; - this.textState = old.textState; - } else if ( !this.node ) { + if ( !this.node ) { this.text = null; this.hash = null; this.textState = null; + } else if ( selectionOnly && !anchorNodeChanged ) { + this.text = old.text; + this.hash = old.hash; + this.textState = old.textState; } else { this.text = ve.ce.getDomText( this.node.$element[ 0 ] ); this.hash = ve.ce.getDomHash( this.node.$element[ 0 ] ); diff --git a/src/ce/ve.ce.Surface.js b/src/ce/ve.ce.Surface.js index 1fdbf16..7153fd3 100644 --- a/src/ce/ve.ce.Surface.js +++ b/src/ce/ve.ce.Surface.js @@ -143,10 +143,13 @@ if ( this.hasSelectionChangeEvents ) { this.$document.on( 'selectionchange', this.onDocumentSelectionChangeDebounced ); } else { - // fake selection change events; mousemove gets optimized away if we're not dragging - // mousedown needs to run after nativemousedown, because otherwise the selection hasn't - // finished changing - this.$documentNode.on( 'mousemove', this.onDocumentSelectionChangeDebounced ); + // Fake selection change events with mousemove if dragging + this.$documentNode.on( 'mousemove', function () { + if ( surface.dragging ) { + this.onDocumentSelectionChangeDebounced(); + } + } ); + // mousedown needs to run after native mousedown action has changed the selection this.eventSequencer.after( { mousedown: this.onDocumentSelectionChangeDebounced } ); @@ -811,10 +814,6 @@ * @param {jQuery.Event} e Selection change event */ ve.ce.Surface.prototype.onDocumentSelectionChange = function () { - if ( !this.dragging ) { - // Optimisation - return; - } this.fixupCursorPosition( 0, this.dragging ); this.updateActiveLink(); this.surfaceObserver.pollOnceSelection(); -- To view, visit https://gerrit.wikimedia.org/r/286157 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: Iabec6a6ad9c8482ed97ada9a5eb07c75b611109a Gerrit-PatchSet: 7 Gerrit-Project: VisualEditor/VisualEditor Gerrit-Branch: master Gerrit-Owner: Esanders <esand...@wikimedia.org> Gerrit-Reviewer: DLynch <dly...@wikimedia.org> Gerrit-Reviewer: Divec <da...@troi.org> Gerrit-Reviewer: Esanders <esand...@wikimedia.org> Gerrit-Reviewer: Jforrester <jforres...@wikimedia.org> Gerrit-Reviewer: jenkins-bot <> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits