mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-11-15 02:23:58 +00:00
Update for deprecation of OOjs UI openWindow/closeWindow promise
Bug: T166729 Change-Id: I95b85a8c0d488993c11da74e1d856fef6cf0ebb4
This commit is contained in:
parent
c9d9361c5b
commit
4f55d8066e
|
@ -653,9 +653,7 @@
|
|||
$( 'body' ).append( windowManager.$element );
|
||||
windowManager.addWindows( [ switchWindow ] );
|
||||
windowManager.openWindow( switchWindow )
|
||||
.then( function ( opened ) { return opened; } )
|
||||
.then( function ( closing ) { return closing; } )
|
||||
.then( function ( data ) {
|
||||
.closed.then( function ( data ) {
|
||||
var oldUri;
|
||||
// TODO: windowManager.destroy()?
|
||||
if ( data && data.action === 'keep' ) {
|
||||
|
@ -978,9 +976,7 @@
|
|||
editingTabDialog = new mw.libs.ve.EditingTabDialog();
|
||||
windowManager.addWindows( [ editingTabDialog ] );
|
||||
windowManager.openWindow( editingTabDialog )
|
||||
.then( function ( opened ) { return opened; } )
|
||||
.then( function ( closing ) { return closing; } )
|
||||
.then( function ( data ) {
|
||||
.closed.then( function ( data ) {
|
||||
// Detach the temporary window manager
|
||||
windowManager.destroy();
|
||||
|
||||
|
@ -1072,9 +1068,7 @@
|
|||
editor: 'source'
|
||||
}
|
||||
)
|
||||
.then( function ( opened ) { return opened; } )
|
||||
.then( function ( closing ) { return closing; } )
|
||||
.then( function ( data ) {
|
||||
.closed.then( function ( data ) {
|
||||
windowManager.destroy();
|
||||
if ( data && data.action === 'switch-ve' ) {
|
||||
init.activateVe( 'visual' );
|
||||
|
|
|
@ -342,9 +342,7 @@ ve.init.mw.DesktopArticleTarget.prototype.loadSuccess = function () {
|
|||
this.editingTabDialog = new mw.libs.ve.EditingTabDialog();
|
||||
windowManager.addWindows( [ this.editingTabDialog ] );
|
||||
windowManager.openWindow( this.editingTabDialog )
|
||||
.then( function ( opened ) { return opened; } )
|
||||
.then( function ( closing ) { return closing; } )
|
||||
.then( function ( data ) {
|
||||
.closed.then( function ( data ) {
|
||||
// Detach the temporary window manager
|
||||
windowManager.destroy();
|
||||
|
||||
|
@ -570,16 +568,13 @@ ve.init.mw.DesktopArticleTarget.prototype.deactivate = function ( noDialog, trac
|
|||
this.emit( 'deactivate' );
|
||||
this.cancel( trackMechanism );
|
||||
} else {
|
||||
this.getSurface().dialogs.openWindow( 'cancelconfirm' ).then( function ( opened ) {
|
||||
opened.then( function ( closing ) {
|
||||
closing.then( function ( data ) {
|
||||
if ( data && data.action === 'discard' ) {
|
||||
target.emit( 'deactivate' );
|
||||
target.cancel( trackMechanism );
|
||||
}
|
||||
} );
|
||||
this.getSurface().dialogs.openWindow( 'cancelconfirm' )
|
||||
.closed.then( function ( data ) {
|
||||
if ( data && data.action === 'discard' ) {
|
||||
target.emit( 'deactivate' );
|
||||
target.cancel( trackMechanism );
|
||||
}
|
||||
} );
|
||||
} );
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -1089,7 +1084,7 @@ ve.init.mw.DesktopArticleTarget.prototype.teardownSurface = function () {
|
|||
if ( this.saveDialog ) {
|
||||
if ( this.saveDialog.isOpened() ) {
|
||||
// If the save dialog is still open (from saving) close it
|
||||
promises.push( this.saveDialog.close() );
|
||||
promises.push( this.saveDialog.close().closed );
|
||||
}
|
||||
// Release the reference
|
||||
this.saveDialog = null;
|
||||
|
|
|
@ -2131,13 +2131,7 @@ ve.init.mw.ArticleTarget.prototype.maybeShowWelcomeDialog = function () {
|
|||
editor: this.getDefaultMode()
|
||||
}
|
||||
)
|
||||
.then( function ( opened ) {
|
||||
return opened;
|
||||
} )
|
||||
.then( function ( closing ) {
|
||||
return closing;
|
||||
} )
|
||||
.then( function ( data ) {
|
||||
.closed.then( function ( data ) {
|
||||
target.welcomeDialogPromise.resolve();
|
||||
target.welcomeDialog = null;
|
||||
// switchToWikitextEditor and switchToVisualEditor are actually
|
||||
|
@ -2254,11 +2248,7 @@ ve.init.mw.ArticleTarget.prototype.switchToVisualEditor = function () {
|
|||
$( 'body' ).append( windowManager.$element );
|
||||
windowManager.addWindows( [ switchWindow ] );
|
||||
windowManager.openWindow( switchWindow, { mode: 'simple' } )
|
||||
.then( function ( opened ) {
|
||||
return opened;
|
||||
} )
|
||||
.then( function ( closing ) { return closing; } )
|
||||
.then( function ( data ) {
|
||||
.closed.then( function ( data ) {
|
||||
if ( data && data.action === 'discard' ) {
|
||||
target.section = null;
|
||||
target.reloadSurface( 'visual' );
|
||||
|
|
|
@ -390,16 +390,12 @@ ve.ui.MWTemplateDialog.prototype.checkRequiredParameters = function () {
|
|||
'visualeditor-dialog-transclusion-required-parameter-dialog-title',
|
||||
blankRequired.length
|
||||
)
|
||||
} ).then( function ( opened ) {
|
||||
opened.then( function ( closing ) {
|
||||
closing.then( function ( data ) {
|
||||
if ( data.action === 'ok' ) {
|
||||
deferred.resolve();
|
||||
} else {
|
||||
deferred.reject();
|
||||
}
|
||||
} );
|
||||
} );
|
||||
} ).closed.then( function ( data ) {
|
||||
if ( data.action === 'ok' ) {
|
||||
deferred.resolve();
|
||||
} else {
|
||||
deferred.reject();
|
||||
}
|
||||
} );
|
||||
} else {
|
||||
deferred.resolve();
|
||||
|
@ -433,7 +429,7 @@ ve.ui.MWTemplateDialog.prototype.getActionProcess = function ( action ) {
|
|||
}
|
||||
|
||||
return modelPromise.then( function () {
|
||||
dialog.close( { action: action } ).always( dialog.popPending.bind( dialog ) );
|
||||
dialog.close( { action: action } ).closed.always( dialog.popPending.bind( dialog ) );
|
||||
} );
|
||||
} ).always( deferred.resolve );
|
||||
|
||||
|
|
Loading…
Reference in a new issue