From eab2b728e938268667375bafb532ea8d1ea0b7dc Mon Sep 17 00:00:00 2001 From: Ed Sanders Date: Wed, 31 Oct 2018 13:38:05 +0000 Subject: [PATCH] Use upstream AbandonEditDialog Bug: T192333 Depends-On: Ib581528363a3fe5461529515835bd7fb1ce66e56 Change-Id: I206366e096aafc02102357648b9f85f879479500 --- extension.json | 8 +--- i18n/ve-mw/en.json | 4 -- i18n/ve-mw/qqq.json | 4 -- .../ve-mw/init/ve.init.mw.ArticleTarget.js | 7 ++- .../ui/dialogs/ve.ui.MWCancelConfirmDialog.js | 43 ------------------- 5 files changed, 8 insertions(+), 58 deletions(-) delete mode 100644 modules/ve-mw/ui/dialogs/ve.ui.MWCancelConfirmDialog.js diff --git a/extension.json b/extension.json index 12ea54d33f..92fc219c43 100644 --- a/extension.json +++ b/extension.json @@ -662,7 +662,8 @@ "ext.visualEditor.core", "ext.visualEditor.mwcore", "ext.visualEditor.mwextensions", - "ext.visualEditor.mwsave" + "ext.visualEditor.mwsave", + "mediawiki.widgets.AbandonEditDialog" ], "messages": [ "accesskey-save", @@ -1434,7 +1435,6 @@ "modules/ve-mw/ui/dialogs/ve.ui.MWExtensionDialog.js", "modules/ve-mw/ui/dialogs/ve.ui.MWExtensionPreviewDialog.js", "modules/ve-mw/ui/dialogs/ve.ui.MWCommandHelpDialog.js", - "modules/ve-mw/ui/dialogs/ve.ui.MWCancelConfirmDialog.js", "modules/ve-mw/ui/dialogs/ve.ui.MWWikitextSwitchConfirmDialog.js", "modules/ve-mw/ui/widgets/ve.ui.MWPreTextInputWidget.js", "modules/ve-mw/ui/dialogs/ve.ui.MWPreDialog.js", @@ -1571,10 +1571,6 @@ "visualeditor-toolbar-savedialog", "visualeditor-toolbar-savedialog-short", "visualeditor-version-label", - "visualeditor-viewpage-savewarning", - "visualeditor-viewpage-savewarning-discard", - "visualeditor-viewpage-savewarning-keep", - "visualeditor-viewpage-savewarning-title", "visualeditor-wikitext-progress", "visualeditor-wikitext-warning-title" ], diff --git a/i18n/ve-mw/en.json b/i18n/ve-mw/en.json index 36363a07d9..6d9c2a54a1 100644 --- a/i18n/ve-mw/en.json +++ b/i18n/ve-mw/en.json @@ -406,10 +406,6 @@ "visualeditor-toolbar-savedialog-short": "Save", "visualeditor-usernamespacepagelink": "Project:User namespace", "visualeditor-version-label": "Version", - "visualeditor-viewpage-savewarning": "Are you sure you want to leave editing mode without saving first?", - "visualeditor-viewpage-savewarning-discard": "Discard edits", - "visualeditor-viewpage-savewarning-keep": "Continue editing", - "visualeditor-viewpage-savewarning-title": "Are you sure?", "visualeditor-wikitext-progress": "Converting wikitext", "visualeditor-wikitext-warning": "You are using the visual editor - [[{{MediaWiki:visualeditor-wikitext-warning-link}}|wikitext]] does not work here. To switch to source editing at any time without losing your changes, click on the switch button.", "visualeditor-wikitext-warning-link": "mediawikiwiki:Special:MyLanguage/Help:Formatting", diff --git a/i18n/ve-mw/qqq.json b/i18n/ve-mw/qqq.json index b6c2a4717d..2833ffcc03 100644 --- a/i18n/ve-mw/qqq.json +++ b/i18n/ve-mw/qqq.json @@ -420,10 +420,6 @@ "visualeditor-toolbar-savedialog-short": "Short label text for button to open save dialog on width-restricted devices\n{{Identical|Save}}", "visualeditor-usernamespacepagelink": "Name of a page describing the user namespace (NS2) in this project.\n{{doc-important|Do not translate \"Project\"; it is automatically converted to the wiki's project namespace.}}", "visualeditor-version-label": "Label text for version number\n{{Identical|Version}}", - "visualeditor-viewpage-savewarning": "Text shown when the user tries to leave the editor without saving their changes.\n\nFollowed by the following buttons:\n* {{msg-mw|Visualeditor-viewpage-savewarning-discard}}\n* {{msg-mw|Visualeditor-viewpage-savewarning-keep}}", - "visualeditor-viewpage-savewarning-discard": "Text shown on the button which closes VE and discards changes when the user confirms that they want to leave the editor.\n\nPreceded by the prompt {{msg-mw|Visualeditor-viewpage-savewarning}}.\n\nFollowed by the button {{msg-mw|Visualeditor-viewpage-savewarning-keep}}.", - "visualeditor-viewpage-savewarning-keep": "Text shown on the button which does not do anything when the user decides that they do not want to leave the editor.\n\nPreceded by the button {{msg-mw|Visualeditor-viewpage-savewarning-discard}}.", - "visualeditor-viewpage-savewarning-title": "Title of the dialog shown when the user tries to leave the editor without saving their changes.\n\nFollowed by the following buttons:\n* {{msg-mw|Visualeditor-viewpage-savewarning-discard}}\n* {{msg-mw|Visualeditor-viewpage-savewarning-keep}}\n{{Identical|Are you sure?}}", "visualeditor-wikitext-progress": "Label for progress bar shown while converting pasted wikitext.", "visualeditor-wikitext-warning": "Contents of notification displayed when Wikitext has been detected.\n\nRefers to:\n* {{msg-mw|Visualeditor-wikitext-warning-link}}\n* {{msg-mw|Visualeditor-toolbar-cancel}}\n* {{msg-mw|Visualeditor-mweditmodesource-title}}\nSee also:\n* {{msg-mw|Visualeditor-beta-warning}}", "visualeditor-wikitext-warning-link": "Link to page describing what Wikitext is.\n\nUsed in:\n* {{msg-mw|Visualeditor-wikitext-warning}}.\n\nTranslate to a title where most wikis in the language you're translating to have one such help page; if they don't have one, you can use [[mw:Special:MyLanguage/Help:Formatting]] as target.", diff --git a/modules/ve-mw/init/ve.init.mw.ArticleTarget.js b/modules/ve-mw/init/ve.init.mw.ArticleTarget.js index 3a5abebd73..fa9bd93600 100644 --- a/modules/ve-mw/init/ve.init.mw.ArticleTarget.js +++ b/modules/ve-mw/init/ve.init.mw.ArticleTarget.js @@ -1981,7 +1981,7 @@ ve.init.mw.ArticleTarget.prototype.tryTeardown = function ( noPrompt, trackMecha if ( noPrompt || !this.edited ) { return this.teardown( trackMechanism ); } else { - return this.getSurface().dialogs.openWindow( 'cancelconfirm' ) + return this.getSurface().dialogs.openWindow( 'abandonedit' ) .closed.then( function ( data ) { if ( data && data.action === 'discard' ) { return target.teardown( trackMechanism ); @@ -2670,3 +2670,8 @@ ve.init.mw.ArticleTarget.prototype.renderCategories = function ( categoryItems ) return $output; } ); }; + +/* Registration */ + +// Used in tryTeardown +ve.ui.windowFactory.register( mw.widgets.AbandonEditDialog ); diff --git a/modules/ve-mw/ui/dialogs/ve.ui.MWCancelConfirmDialog.js b/modules/ve-mw/ui/dialogs/ve.ui.MWCancelConfirmDialog.js deleted file mode 100644 index 9b39705246..0000000000 --- a/modules/ve-mw/ui/dialogs/ve.ui.MWCancelConfirmDialog.js +++ /dev/null @@ -1,43 +0,0 @@ -/*! - * VisualEditor user interface MWCancelConfirmDialog class. - * - * @copyright 2011-2018 VisualEditor Team and others; see AUTHORS.txt - * @license The MIT License (MIT); see LICENSE.txt - */ - -/** - * Dialog for letting the user choose how to switch to wikitext mode. - * - * @class - * @extends OO.ui.MessageDialog - * - * @constructor - * @param {Object} [config] Configuration options - */ -ve.ui.MWCancelConfirmDialog = function VeUiMWCancelConfirmDialog( config ) { - // Parent constructor - ve.ui.MWCancelConfirmDialog.super.call( this, config ); -}; - -/* Inheritance */ - -OO.inheritClass( ve.ui.MWCancelConfirmDialog, OO.ui.MessageDialog ); - -/* Static Properties */ - -ve.ui.MWCancelConfirmDialog.static.name = 'cancelconfirm'; - -ve.ui.MWCancelConfirmDialog.static.title = - OO.ui.deferMsg( 'visualeditor-viewpage-savewarning-title' ); - -ve.ui.MWCancelConfirmDialog.static.message = - OO.ui.deferMsg( 'visualeditor-viewpage-savewarning' ); - -ve.ui.MWCancelConfirmDialog.static.actions = [ - { action: 'discard', label: OO.ui.deferMsg( 'visualeditor-viewpage-savewarning-discard' ), flags: [ 'primary', 'destructive' ] }, - { action: 'keep', label: OO.ui.deferMsg( 'visualeditor-viewpage-savewarning-keep' ), flags: 'safe' } -]; - -/* Registration */ - -ve.ui.windowFactory.register( ve.ui.MWCancelConfirmDialog );