mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-09-25 11:16:51 +00:00
Don't let double-clicking the save button trigger a save
Tapping the toolbar save button while the save dialog is open triggers a save because of the accesskey. It shouldn't save on a double-tap, because that's easy to accidentally do / trigger on a slow device. Bug: T230816 Depends-On: I4c3afce9d57c9bca737272b40b9a4862b5794bac Change-Id: I1925b1b97de6a811f73196b616ec09a2c30c336f
This commit is contained in:
parent
6295afa92b
commit
593d26b4ab
|
@ -1987,10 +1987,10 @@ ve.init.mw.ArticleTarget.prototype.updateToolbarSaveButtonState = function () {
|
|||
* @fires saveWorkflowBegin
|
||||
*/
|
||||
ve.init.mw.ArticleTarget.prototype.showSaveDialog = function ( action, checkboxName ) {
|
||||
var checkbox, currentWindow,
|
||||
var checkbox, currentWindow, openPromise,
|
||||
target = this;
|
||||
|
||||
if ( !this.isSaveable() ) {
|
||||
if ( !this.isSaveable() || this.saveDialogIsOpening ) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -2004,6 +2004,8 @@ ve.init.mw.ArticleTarget.prototype.showSaveDialog = function ( action, checkboxN
|
|||
return;
|
||||
}
|
||||
|
||||
this.saveDialogIsOpening = true;
|
||||
|
||||
this.emit( 'saveWorkflowBegin' );
|
||||
|
||||
// Preload the serialization
|
||||
|
@ -2034,6 +2036,7 @@ ve.init.mw.ArticleTarget.prototype.showSaveDialog = function ( action, checkboxN
|
|||
( action === 'review' && !data.canReview ) ||
|
||||
( action === 'preview' && !data.canPreview )
|
||||
) {
|
||||
target.saveDialogIsOpening = false;
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -2051,7 +2054,12 @@ ve.init.mw.ArticleTarget.prototype.showSaveDialog = function ( action, checkboxN
|
|||
}
|
||||
|
||||
// Open the dialog
|
||||
windowAction.open( 'mwSave', data, action );
|
||||
openPromise = windowAction.open( 'mwSave', data, action );
|
||||
if ( openPromise ) {
|
||||
openPromise.always( function () {
|
||||
target.saveDialogIsOpening = false;
|
||||
} );
|
||||
}
|
||||
} );
|
||||
};
|
||||
|
||||
|
|
|
@ -46,7 +46,7 @@ ve.ui.MWSaveTool.static.autoAddToGroup = false;
|
|||
*/
|
||||
ve.ui.MWSaveTool.prototype.onUpdateState = function () {
|
||||
var wasSaveable = !this.isDisabled(),
|
||||
isSaveable = ve.init.target.isSaveable();
|
||||
isSaveable = ve.init.target && ve.init.target.isSaveable();
|
||||
|
||||
// This could be a ve.ui.WindowTool that becomes active
|
||||
// when the save dialog is open, but onUpdateState is
|
||||
|
|
Loading…
Reference in a new issue