mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-11-24 06:24:08 +00:00
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:
parent
2462889843
commit
a02d8573b4
|
@ -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 );
|
||||
};
|
||||
|
|
|
@ -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 );
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in a new issue