Fix cancelling of extension inspectors

* Don't insert/update/remove nodes on cancel in MWExtensionInspector
* Don't forget to popStaging on cancel in MWLiveExtensionInspector

Bug: T110992
Change-Id: I1e30206595e304eb502c7e745bf5e00d145d12d7
This commit is contained in:
Alex Monk 2015-09-02 02:32:11 +01:00
parent 2462889843
commit a02d8573b4
2 changed files with 11 additions and 6 deletions

View file

@ -124,12 +124,14 @@ ve.ui.MWExtensionInspector.prototype.getReadyProcess = function ( data ) {
ve.ui.MWExtensionInspector.prototype.getTeardownProcess = function ( data ) {
return ve.ui.MWExtensionInspector.super.prototype.getTeardownProcess.call( this, data )
.first( function () {
if ( this.constructor.static.allowedEmpty || this.input.getInnerValue() !== '' ) {
this.insertOrUpdateNode();
} else if ( this.selectedNode && !this.constructor.static.allowedEmpty ) {
// Content has been emptied on a node which isn't allowed to
// be empty, so delete it.
this.removeNode();
if ( data && data.action === 'done' ) {
if ( this.constructor.static.allowedEmpty || this.input.getInnerValue() !== '' ) {
this.insertOrUpdateNode();
} else if ( this.selectedNode && !this.constructor.static.allowedEmpty ) {
// Content has been emptied on a node which isn't allowed to
// be empty, so delete it.
this.removeNode();
}
}
}, this );
};

View file

@ -64,6 +64,9 @@ ve.ui.MWLiveExtensionInspector.prototype.getTeardownProcess = function ( data )
return ve.ui.MWLiveExtensionInspector.super.prototype.getTeardownProcess.call( this, data )
.first( function () {
this.input.off( 'change', this.onChangeHandler );
if ( data === undefined ) { // cancel
this.getFragment().getSurface().popStaging();
}
}, this );
};