jenkins-bot has submitted this change and it was merged.
Change subject: Rerender ContentBranchNodes when the selection anchor leaves
......................................................................
Rerender ContentBranchNodes when the selection anchor leaves
This causes unicorns to disappear, hopefully allowing us to
get rid of some of the bookkeeping previously used to make that
happen.
It will also clean up redundant chimeras, once we start using those.
Change-Id: I95632cdab95f430540e2ed682a706d6cf371077f
---
M src/ce/ve.ce.Surface.js
M src/ce/ve.ce.SurfaceObserver.js
2 files changed, 36 insertions(+), 3 deletions(-)
Approvals:
Catrope: Looks good to me, approved
jenkins-bot: Verified
diff --git a/src/ce/ve.ce.Surface.js b/src/ce/ve.ce.Surface.js
index 7bdca14..41ca24b 100644
--- a/src/ce/ve.ce.Surface.js
+++ b/src/ce/ve.ce.Surface.js
@@ -80,6 +80,7 @@
this.surfaceObserver.connect( this, {
contentChange: 'onSurfaceObserverContentChange',
rangeChange: 'onSurfaceObserverRangeChange',
+ branchNodeChange: 'onSurfaceObserverBranchNodeChange',
slugEnter: 'onSurfaceObserverSlugEnter'
} );
this.model.connect( this, {
@@ -2013,6 +2014,21 @@
};
/**
+ * Handle branch node change events.
+ *
+ * @see ve.ce.SurfaceObserver#pollOnce
+ *
+ * @method
+ * @param {ve.ce.BranchNode} oldBranchNode Node from which the range anchor
has just moved
+ * @param {ve.ce.BranchNode} newBranchNode Node into which the range anchor
has just moved
+ */
+ve.ce.Surface.prototype.onSurfaceObserverBranchNodeChange = function (
oldBranchNode ) {
+ if ( oldBranchNode instanceof ve.ce.ContentBranchNode ) {
+ oldBranchNode.renderContents();
+ }
+};
+
+/**
* Handle selection change events.
*
* @see ve.ce.SurfaceObserver#pollOnce
diff --git a/src/ce/ve.ce.SurfaceObserver.js b/src/ce/ve.ce.SurfaceObserver.js
index 185c82c..368e593 100644
--- a/src/ce/ve.ce.SurfaceObserver.js
+++ b/src/ce/ve.ce.SurfaceObserver.js
@@ -51,9 +51,18 @@
*/
/**
- * When #poll observes a change in the document and the new
- * selection does not equal as the last known selection, this event
- * is emitted (before the properties are updated).
+ * When #poll observes a change in the document and the new selection anchor
+ * branch node does not equal the last known one, this event is emitted.
+ *
+ * @event branchNodeChange
+ * @param {ve.ce.BranchNode} oldBranchNode
+ * @param {ve.ce.BranchNode} newBranchNode
+ */
+
+/**
+ * When #poll observes a change in the document and the new selection does
+ * not equal the last known selection, this event is emitted (before the
+ * properties are updated).
*
* @event rangeChange
* @param {ve.Range|null} oldRange Old range
@@ -247,6 +256,14 @@
);
}
+ if ( newState.branchNodeChanged ) {
+ this.emit(
+ 'branchNodeChange',
+ ( oldState && oldState.node && oldState.node.root ?
oldState.node : null ),
+ newState.node
+ );
+ }
+
if ( newState.selectionChanged && emitChanges ) {
this.emit(
'rangeChange',
--
To view, visit https://gerrit.wikimedia.org/r/171494
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I95632cdab95f430540e2ed682a706d6cf371077f
Gerrit-PatchSet: 8
Gerrit-Project: VisualEditor/VisualEditor
Gerrit-Branch: master
Gerrit-Owner: Divec <[email protected]>
Gerrit-Reviewer: Catrope <[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