jenkins-bot has submitted this change and it was merged. Change subject: Emit context change when any annotations change, not just covered. ......................................................................
Emit context change when any annotations change, not just covered. The clear styling tool needs to know if any annotations exist in the selection, so emitting a context change only when the covered annotations set changes is insufficient. Bug: T105013 Change-Id: I4af411379be385b1350117718bd549205a756304 --- M src/dm/ve.dm.Surface.js 1 file changed, 6 insertions(+), 6 deletions(-) Approvals: Divec: Looks good to me, approved jenkins-bot: Verified diff --git a/src/dm/ve.dm.Surface.js b/src/dm/ve.dm.Surface.js index c8b801e..a722ee8 100644 --- a/src/dm/ve.dm.Surface.js +++ b/src/dm/ve.dm.Surface.js @@ -31,7 +31,7 @@ this.undoIndex = 0; this.historyTrackingInterval = null; this.insertionAnnotations = new ve.dm.AnnotationSet( this.getDocument().getStore() ); - this.coveredAnnotations = new ve.dm.AnnotationSet( this.getDocument().getStore() ); + this.selectedAnnotations = new ve.dm.AnnotationSet( this.getDocument().getStore() ); this.enabled = true; this.transacting = false; this.queueingContextChanges = false; @@ -559,7 +559,7 @@ */ ve.dm.Surface.prototype.setSelection = function ( selection ) { var left, right, leftAnnotations, rightAnnotations, insertionAnnotations, - startNode, selectedNode, range, coveredAnnotations, + startNode, selectedNode, range, selectedAnnotations, branchNodes = {}, selectionChange = false, contextChange = false, @@ -611,12 +611,12 @@ if ( !linearData.isContentOffset( right ) ) { right = -1; } - coveredAnnotations = linearData.getAnnotationsFromOffset( range.start ); + selectedAnnotations = linearData.getAnnotationsFromOffset( range.start ); } else { // Get annotations from the first character of the range left = linearData.getNearestContentOffset( range.start ); right = linearData.getNearestContentOffset( range.end ); - coveredAnnotations = linearData.getAnnotationsFromRange( range ); + selectedAnnotations = linearData.getAnnotationsFromRange( range, true ); } if ( left === -1 ) { // No content offset to our left, use empty set @@ -647,8 +647,8 @@ contextChange = true; } - if ( coveredAnnotations && !coveredAnnotations.compareTo( this.coveredAnnotations ) ) { - this.coveredAnnotations = coveredAnnotations; + if ( selectedAnnotations && !selectedAnnotations.compareTo( this.selectedAnnotations ) ) { + this.selectedAnnotations = selectedAnnotations; contextChange = true; } -- To view, visit https://gerrit.wikimedia.org/r/223307 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: I4af411379be385b1350117718bd549205a756304 Gerrit-PatchSet: 2 Gerrit-Project: VisualEditor/VisualEditor Gerrit-Branch: master Gerrit-Owner: Esanders <esand...@wikimedia.org> Gerrit-Reviewer: Catrope <roan.katt...@gmail.com> Gerrit-Reviewer: Divec <da...@troi.org> Gerrit-Reviewer: jenkins-bot <> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits