VisualEditor: Ignore id when getting hash object

Because the id doesn't affect the rendering of a
math node, it is not needed in the hash object.
Also removed event listener from the id input for
the same reason.

Bug: T112466
Change-Id: I4da07cb7c112ce9ab449a060132856a2d054e57f
This commit is contained in:
Thalia 2015-09-14 16:38:10 +01:00 committed by Alex Monk
parent 4c66f92413
commit dc3b663e3b
3 changed files with 18 additions and 3 deletions

View File

@ -34,7 +34,9 @@ ve.ce.MWMathNode.static.primaryCommandName = 'math';
/* Methods */
/** */
/**
* @inheritdoc
*/
ve.ce.MWMathNode.prototype.onSetup = function () {
// Parent method
ve.ce.MWMathNode.super.prototype.onSetup.call( this );

View File

@ -33,6 +33,21 @@ ve.dm.MWMathNode.static.tagName = 'img';
ve.dm.MWMathNode.static.extensionName = 'math';
/* Static methods */
/**
* @inheritdoc
*/
ve.dm.MWMathNode.static.getHashObject = function ( dataElement ) {
// Parent method
var hashObject = ve.dm.MWMathNode.super.static.getHashObject.call( this, dataElement );
// The id does not affect the rendering.
if ( hashObject.mw.attrs ) {
delete hashObject.mw.attrs.id;
}
return hashObject;
};
/* Registration */
ve.dm.modelRegistry.register( ve.dm.MWMathNode );

View File

@ -98,7 +98,6 @@ ve.ui.MWMathInspector.prototype.getSetupProcess = function ( data ) {
var display = this.selectedNode.getAttribute( 'mw' ).attrs.display || 'default';
this.displaySelect.selectItemByData( display );
this.displaySelect.on( 'choose', this.onChangeHandler );
this.idInput.on( 'change', this.onChangeHandler );
}, this );
};
@ -109,7 +108,6 @@ ve.ui.MWMathInspector.prototype.getTeardownProcess = function ( data ) {
return ve.ui.MWMathInspector.super.prototype.getTeardownProcess.call( this, data )
.first( function () {
this.displaySelect.off( 'choose', this.onChangeHandler );
this.idInput.off( 'change', this.onChangeHandler );
}, this );
};