Don't build out save dialog when initializing editor

The save dialog DOM is pretty big, so building it on demand
like every other dialog out there seems like a good idea.

Change-Id: I02077c3e45f01d3467d41616eb879bd1d608a82b
This commit is contained in:
Roan Kattouw 2013-11-15 13:34:59 -08:00 committed by Catrope
parent 35e20d954f
commit 080b4380fa

View file

@ -231,7 +231,6 @@ ve.init.mw.ViewPageTarget.prototype.onLoad = function ( doc ) {
this.attachToolbarButtons(); this.attachToolbarButtons();
this.restoreScrollPosition(); this.restoreScrollPosition();
this.restoreEditSection(); this.restoreEditSection();
this.setupSaveDialog();
this.setupBeforeUnloadHandler(); this.setupBeforeUnloadHandler();
this.$document[0].focus(); this.$document[0].focus();
this.activating = false; this.activating = false;
@ -611,7 +610,12 @@ ve.init.mw.ViewPageTarget.prototype.onSerializeError = function ( jqXHR, status
ve.track( 'performance.user.reviewError', { 'duration': ve.now() - this.timings.saveDialogReview } ); ve.track( 'performance.user.reviewError', { 'duration': ve.now() - this.timings.saveDialogReview } );
} }
alert( ve.msg( 'visualeditor-serializeerror', status ) ); alert( ve.msg( 'visualeditor-serializeerror', status ) );
// It's possible to get here while the save dialog has never been opened (if the user uses
// the switch to source mode option)
if ( this.saveDialog ) {
this.saveDialog.$loadingIcon.hide(); this.saveDialog.$loadingIcon.hide();
}
}; };
/** /**
@ -1235,8 +1239,12 @@ ve.init.mw.ViewPageTarget.prototype.showSaveDialog = function () {
} }
this.prepareCacheKey( this.docToSave ); this.prepareCacheKey( this.docToSave );
if ( !this.saveDialog ) {
this.setupSaveDialog();
}
this.saveDialog.setSanityCheck( this.sanityCheckVerified ); this.saveDialog.setSanityCheck( this.sanityCheckVerified );
this.surface.getDialogs().getWindow( 'mwSave' ).open(); this.saveDialog.open();
this.timings.saveDialogOpen = ve.now(); this.timings.saveDialogOpen = ve.now();
ve.track( 'behavior.lastTransactionTillSaveDialogOpen', { ve.track( 'behavior.lastTransactionTillSaveDialogOpen', {
'duration': this.timings.saveDialogOpen - this.timings.lastTransaction 'duration': this.timings.saveDialogOpen - this.timings.lastTransaction