Actually clear diff viewer after closing save dialog and changing document

The window refactor removed the 'teardown' event from windows,
but ViewPageTarget was still listening to this event on the save dialog.
Instead, use the opening promise to be notified when the save dialog
closes and call onSaveDialogClose() at that time.

Change-Id: I31a9a359eb14a56b214a1240db08632bda6bc8b9
This commit is contained in:
Roan Kattouw 2014-07-25 13:12:35 -07:00
parent af91451ddd
commit a6d94256d8

View file

@ -1214,8 +1214,7 @@ ve.init.mw.ViewPageTarget.prototype.showSaveDialog = function () {
this.saveDialog.connect( this, {
'save': 'saveDocument',
'review': 'onSaveDialogReview',
'resolve': 'onSaveDialogResolveConflict',
'teardown': 'onSaveDialogTeardown'
'resolve': 'onSaveDialogResolveConflict'
} );
// Setup edit summary and checkboxes
this.saveDialog.setEditSummary( this.initialEditSummary );
@ -1226,7 +1225,11 @@ ve.init.mw.ViewPageTarget.prototype.showSaveDialog = function () {
this.saveDialog.open(
this.surface.getModel().getFragment(),
{ 'dir': this.surface.getModel().getDocument().getLang() }
);
)
// Call onSaveDialogClose() when the save dialog starts closing
.always( ve.bind( function ( opened ) {
opened.always( ve.bind( this.onSaveDialogClose, this ) );
}, this ) );
this.emit( 'saveWorkflowBegin' );
}.bind( this ) );
};
@ -1236,7 +1239,7 @@ ve.init.mw.ViewPageTarget.prototype.showSaveDialog = function () {
*
* @fires saveWorkflowEnd
*/
ve.init.mw.ViewPageTarget.prototype.onSaveDialogTeardown = function () {
ve.init.mw.ViewPageTarget.prototype.onSaveDialogClose = function () {
// Clear the cached HTML and cache key once the document changes
var clear = function () {
this.docToSave = null;