mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-09-24 10:48:42 +00:00
Merge "Fix JS error trying to access this.saveDialog from switch to source mode code path"
This commit is contained in:
commit
5825389447
|
@ -109,7 +109,6 @@ ve.init.mw.ViewPageTarget = function VeInitMwViewPageTarget() {
|
|||
'showChanges': 'onShowChanges',
|
||||
'showChangesError': 'onShowChangesError',
|
||||
'noChanges': 'onNoChanges',
|
||||
'serializeComplete': 'onSerializeComplete',
|
||||
'serializeError': 'onSerializeError',
|
||||
'sanityCheckComplete': 'updateToolbarSaveButtonState'
|
||||
} );
|
||||
|
@ -593,20 +592,6 @@ ve.init.mw.ViewPageTarget.prototype.onShowChanges = function ( diffHtml ) {
|
|||
this.saveDialog.setDiffAndReview( diffHtml );
|
||||
};
|
||||
|
||||
/**
|
||||
* Handle Serialize event.
|
||||
*
|
||||
* @method
|
||||
* @param {string} wikitext
|
||||
*/
|
||||
ve.init.mw.ViewPageTarget.prototype.onSerializeComplete = function ( wikitext ) {
|
||||
// Invalidate the viewer wikitext on next change
|
||||
this.surface.getModel().getDocument().once( 'transact',
|
||||
ve.bind( this.saveDialog.clearDiff, this.saveDialog )
|
||||
);
|
||||
this.saveDialog.setDiffAndReview( $( '<pre>' ).text( wikitext ) );
|
||||
};
|
||||
|
||||
/**
|
||||
* Handle failed show changes event.
|
||||
*
|
||||
|
@ -780,13 +765,27 @@ ve.init.mw.ViewPageTarget.prototype.onSaveDialogReview = function () {
|
|||
// Has no callback, handled via target.onShowChanges
|
||||
this.showChanges( this.docToSave );
|
||||
} else {
|
||||
this.serialize( this.docToSave, ve.bind( this.onSerialize, this ) );
|
||||
this.serialize( this.docToSave, ve.bind( this.onSaveDialogReviewComplete, this ) );
|
||||
}
|
||||
} else {
|
||||
this.saveDialog.swapPanel( 'review' );
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Handle completed serialize request for diff views for new page creations.
|
||||
*
|
||||
* @method
|
||||
* @param {string} wikitext
|
||||
*/
|
||||
ve.init.mw.ViewPageTarget.prototype.onSaveDialogReviewComplete = function ( wikitext ) {
|
||||
// Invalidate the viewer wikitext on next change
|
||||
this.surface.getModel().getDocument().once( 'transact',
|
||||
ve.bind( this.saveDialog.clearDiff, this.saveDialog )
|
||||
);
|
||||
this.saveDialog.setDiffAndReview( $( '<pre>' ).text( wikitext ) );
|
||||
};
|
||||
|
||||
/**
|
||||
* Try to save the current document.
|
||||
* @fires saveInitiated
|
||||
|
|
Loading…
Reference in a new issue