Merge "Improve diff description on gallery nodes"

This commit is contained in:
jenkins-bot 2018-04-04 16:50:03 +00:00 committed by Gerrit Code Review
commit 242eb68b96
2 changed files with 30 additions and 0 deletions

View file

@ -120,6 +120,15 @@ ve.dm.MWGalleryImageNode.static.toDomElements = function ( data, doc ) {
return [ li ];
};
ve.dm.MWGalleryImageNode.static.describeChange = function ( key ) {
// These attributes are computed
if ( key === 'src' || key === 'width' || key === 'height' ) {
return null;
}
// Parent method
return ve.dm.MWGalleryImageNode.super.static.describeChange.apply( this, arguments );
};
/* Methods */
/**

View file

@ -79,6 +79,27 @@ ve.dm.MWGalleryNode.static.toDomElements = function ( data, doc ) {
return [ ul ];
};
ve.dm.MWGalleryNode.static.describeChanges = function ( attributeChanges, attributes ) {
// Only do a comparison on the 'mw.attrs' attribute
if ( attributeChanges.mw ) {
return ve.dm.MWGalleryNode.super.static.describeChanges.call(
this,
ve.ui.DiffElement.static.compareAttributes( attributeChanges.mw.from.attrs || {}, attributeChanges.mw.to.attrs || {} ),
attributes
);
}
return [];
};
ve.dm.MWGalleryNode.static.describeChange = function ( key ) {
// Caption diff is shown in the DOM
if ( key === 'caption' ) {
return null;
}
// Parent method
return ve.dm.MWGalleryNode.super.static.describeChange.apply( this, arguments );
};
/* Methods */
/**