mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-11-15 10:35:48 +00:00
Add a hook so GuidedTour, etc. can know when save button is clickable
Change-Id: I9b8ef8a193810c5e7275a61ba1a874d378c8b030
This commit is contained in:
parent
131e8988b5
commit
d62c12ce7b
|
@ -820,10 +820,14 @@ ve.init.mw.ViewPageTarget.prototype.checkForWikitextWarning = function () {
|
||||||
* Re-evaluate whether the toolbar save button should be disabled or not.
|
* Re-evaluate whether the toolbar save button should be disabled or not.
|
||||||
*/
|
*/
|
||||||
ve.init.mw.ViewPageTarget.prototype.updateToolbarSaveButtonState = function () {
|
ve.init.mw.ViewPageTarget.prototype.updateToolbarSaveButtonState = function () {
|
||||||
|
var isDisabled;
|
||||||
|
|
||||||
this.edited = this.surface.getModel().hasBeenModified();
|
this.edited = this.surface.getModel().hasBeenModified();
|
||||||
// Disable the save button if we have no history or if the sanity check is not finished
|
// Disable the save button if we have no history or if the sanity check is not finished
|
||||||
this.toolbarSaveButton.setDisabled( ( !this.edited && !this.restoring ) || !this.sanityCheckFinished );
|
isDisabled = ( !this.edited && !this.restoring ) || !this.sanityCheckFinished;
|
||||||
|
this.toolbarSaveButton.setDisabled( isDisabled );
|
||||||
this.toolbarSaveButton.$element.toggleClass( 've-init-mw-viewPageTarget-waiting', !this.sanityCheckFinished );
|
this.toolbarSaveButton.$element.toggleClass( 've-init-mw-viewPageTarget-waiting', !this.sanityCheckFinished );
|
||||||
|
mw.hook( 've.toolbarSaveButton.stateChanged' ).fire( isDisabled );
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in a new issue