jenkins-bot has submitted this change and it was merged.

Change subject: Fix covering annotations logic
......................................................................


Fix covering annotations logic

The previous code was only working in some cases by a combination
of state variables not being reset and good luck.

The new logic clears and re-applies a annotation iff:
* the initial annotation was non-covering
* OR the initial annotation was null
* OR the initial annotation is not comparable to the current annotation

Bug: 63386
Change-Id: Idd5cce0715acf61d8d39fd9180cf54ee5715d9bd
---
M modules/ve/ui/inspectors/ve.ui.AnnotationInspector.js
1 file changed, 8 insertions(+), 2 deletions(-)

Approvals:
  Trevor Parscal: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/modules/ve/ui/inspectors/ve.ui.AnnotationInspector.js 
b/modules/ve/ui/inspectors/ve.ui.AnnotationInspector.js
index 579710b..00ea59c 100644
--- a/modules/ve/ui/inspectors/ve.ui.AnnotationInspector.js
+++ b/modules/ve/ui/inspectors/ve.ui.AnnotationInspector.js
@@ -205,9 +205,11 @@
                if ( this.initialSelection.isCollapsed() ) {
                        insert = true;
                }
+               // Check if the initial annotation has changed, or didn't cover 
the whole fragment to begin with
                if (
-                       this.initialAnnotationIsCovering ||
-                       ( this.initialAnnotation && 
this.initialAnnotation.compareTo( annotation ) )
+                       !this.initialAnnotationIsCovering ||
+                       !this.initialAnnotation ||
+                       !this.initialAnnotation.compareTo( annotation )
                ) {
                        if ( this.isNewAnnotation ) {
                                undo = true;
@@ -256,6 +258,10 @@
        }
 
        // Reset state
+       this.previousSelection = null;
+       this.initialSelection = null;
+       this.initialAnnotation = null;
+       this.initialAnnotationIsCovering = false;
        this.isNewAnnotation = false;
 
        // Parent method

-- 
To view, visit https://gerrit.wikimedia.org/r/125019
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Idd5cce0715acf61d8d39fd9180cf54ee5715d9bd
Gerrit-PatchSet: 1
Gerrit-Project: VisualEditor/VisualEditor
Gerrit-Branch: master
Gerrit-Owner: Esanders <[email protected]>
Gerrit-Reviewer: Trevor Parscal <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to