Divec has uploaded a new change for review.

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

Change subject: Forcibly reapply selection on insertion annotation change, to 
move between unicorns
......................................................................

Forcibly reapply selection on insertion annotation change, to move between 
unicorns

Change-Id: Id740f2a40a825f1aa3113fe79507546682862b93
---
M src/ce/ve.ce.Surface.js
1 file changed, 15 insertions(+), 4 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/VisualEditor/VisualEditor 
refs/changes/25/304325/1

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: newchange
Gerrit-Change-Id: Id740f2a40a825f1aa3113fe79507546682862b93
Gerrit-PatchSet: 1
Gerrit-Project: VisualEditor/VisualEditor
Gerrit-Branch: master
Gerrit-Owner: Divec <da...@troi.org>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to