Add a hook so GuidedTour, etc. can know when save button is clickable

Change-Id: I9b8ef8a193810c5e7275a61ba1a874d378c8b030
This commit is contained in:
Matthew Flaschen 2014-05-25 15:13:51 -04:00
parent 131e8988b5
commit d62c12ce7b

View file

@ -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 );
}; };
/** /**