jenkins-bot has submitted this change and it was merged. Change subject: Forcibly reapply selection on insertion annotation change, to move between unicorns ......................................................................
Forcibly reapply selection on insertion annotation change, to move between unicorns Bug: T142754 Change-Id: Id740f2a40a825f1aa3113fe79507546682862b93 --- M src/ce/ve.ce.Surface.js 1 file changed, 15 insertions(+), 4 deletions(-) Approvals: DLynch: Looks good to me, approved Jforrester: Looks good to me, but someone else must approve jenkins-bot: Verified Objections: Divec: There's a problem with this change, please improve diff --git a/src/ce/ve.ce.Surface.js b/src/ce/ve.ce.Surface.js index f22fc36..3b960ca 100644 --- a/src/ce/ve.ce.Surface.js +++ b/src/ce/ve.ce.Surface.js @@ -2563,7 +2563,7 @@ return; } // Must re-apply the selection after re-rendering - this.showModelSelection(); + this.forceShowModelSelection(); this.surfaceObserver.pollOnceNoCallback(); }; @@ -3261,12 +3261,23 @@ }; /** - * Apply a DM selection to the DOM + * Apply a DM selection to the DOM, even if the old DOM selection is different but DM-equivalent * * @method * @return {boolean} Whether the selection actually changed */ -ve.ce.Surface.prototype.showModelSelection = function () { +ve.ce.Surface.prototype.forceShowModelSelection = function () { + return this.showModelSelection( true ); +}; + +/** + * Apply a DM selection to the DOM + * + * @method + * @param {boolean} [force] Replace the DOM selection if it is different but DM-equivalent + * @return {boolean} Whether the selection actually changed + */ +ve.ce.Surface.prototype.showModelSelection = function ( force ) { var selection, changed, modelRange, impliedModelRange; if ( this.deactivated ) { @@ -3283,7 +3294,7 @@ return false; } modelRange = selection.getModel().getRange(); - if ( this.documentView.documentNode.$element.get( 0 ).contains( + if ( !force && this.documentView.documentNode.$element.get( 0 ).contains( this.nativeSelection.focusNode ) ) { // See whether the model range implied by the DOM selection is already equal to -- To view, visit https://gerrit.wikimedia.org/r/304325 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: Id740f2a40a825f1aa3113fe79507546682862b93 Gerrit-PatchSet: 2 Gerrit-Project: VisualEditor/VisualEditor Gerrit-Branch: master Gerrit-Owner: Divec <da...@troi.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