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

Change subject: Don't strip HTML attributes from inspected links
......................................................................


Don't strip HTML attributes from inspected links

When you inspect a link, then close the inspector immediately,
nothing should change. However, AnnotationInspector was comparing
the generated annotation and the existing annotation by hash, and so
would consider an annotation with htmlAttributes different from
one without. This meant that inspecting a Parsoid-generated link
and then closing the inspector would cause a transaction to be
processed that removes the htmlAttributes from the annotation.

I believe a similar issue also existed for annotations with attributes
like origTitle and hrefPrefix, although I didn't reproduce this.

The fix is to have AnnotationInspector compare annotations by the
hash of their comparableObjects, rather than their hashObjects.

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

Approvals:
  Esanders: 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 773e01f..29e34f9 100644
--- a/modules/ve/ui/inspectors/ve.ui.AnnotationInspector.js
+++ b/modules/ve/ui/inspectors/ve.ui.AnnotationInspector.js
@@ -133,7 +133,7 @@
        // Note we don't set the 'all' flag here - any non-annotated content 
will be annotated on close
        this.initialAnnotation = this.getMatchingAnnotations( fragment ).get( 0 
);
        this.initialAnnotationHash = this.initialAnnotation ?
-               OO.getHash( this.initialAnnotation ) : null;
+               OO.getHash( this.initialAnnotation.getComparableObject() ) : 
null;
 };
 
 /**
@@ -161,7 +161,7 @@
                if ( this.initialSelection.isCollapsed() ) {
                        insert = true;
                }
-               if ( OO.getHash( annotation ) !== this.initialAnnotationHash ) {
+               if ( OO.getHash( annotation.getComparableObject() ) !== 
this.initialAnnotationHash ) {
                        if ( this.isNewAnnotation ) {
                                undo = true;
                        } else {

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I848ffc2b7e7b2c67754a0ece3af105ffafa837ec
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/VisualEditor
Gerrit-Branch: master
Gerrit-Owner: Catrope <[email protected]>
Gerrit-Reviewer: Esanders <[email protected]>
Gerrit-Reviewer: Mooeypoo <[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