Fix abandon edit warning message

This message was upstreamed to core and later renamed.

Use the upstreamed dialog itself when switching sections.

Bug: T222525
Change-Id: Ibd2d75ec503e92b5ddec2105f762b0c9f0dc96fb
This commit is contained in:
Ed Sanders 2019-05-06 14:57:51 -05:00
parent 0bc3c81978
commit c035073cf9
3 changed files with 6 additions and 2 deletions

View file

@ -438,6 +438,7 @@
"creating", "creating",
"editing", "editing",
"lastmodifiedat", "lastmodifiedat",
"mw-widgets-abandonedit",
"redirectpagesub", "redirectpagesub",
"subject", "subject",
"visualeditor-loadwarning", "visualeditor-loadwarning",

View file

@ -1502,7 +1502,7 @@ ve.init.mw.DesktopArticleTarget.prototype.onBeforeUnload = function () {
mw.user.options.get( 'useeditwarning' ) mw.user.options.get( 'useeditwarning' )
) { ) {
// Return our message // Return our message
return ve.msg( 'visualeditor-viewpage-savewarning' ); return ve.msg( 'mw-widgets-abandonedit' );
} }
}; };

View file

@ -2404,7 +2404,10 @@ ve.init.mw.ArticleTarget.prototype.switchToWikitextSection = function ( section,
return; return;
} }
if ( !noConfirm && this.edited && mw.user.options.get( 'useeditwarning' ) ) { if ( !noConfirm && this.edited && mw.user.options.get( 'useeditwarning' ) ) {
promise = OO.ui.confirm( mw.msg( 'visualeditor-viewpage-savewarning' ) ); promise = this.getSurface().dialogs.openWindow( 'abandonedit' )
.closed.then( function ( data ) {
return data && data.action === 'discard';
} );
} else { } else {
promise = $.Deferred().resolve( true ).promise(); promise = $.Deferred().resolve( true ).promise();
} }