mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-11-28 08:10:35 +00:00
autosave: Don't store initial document state until first change
1. It wastes valuable time during setup. 2. If a user reloads the page without making changes we should give them the latest html from the server to minimise the chance of an edit conflict. Change-Id: I9a1f8cfd65ef2552fe2c3d6d2bbf975851b52003
This commit is contained in:
parent
a8b91c1e33
commit
11ac2736a1
|
@ -437,6 +437,7 @@ ve.init.mw.ArticleTarget.prototype.documentReady = function () {
|
|||
*/
|
||||
ve.init.mw.ArticleTarget.prototype.surfaceReady = function () {
|
||||
var name, i, triggers,
|
||||
target = this,
|
||||
accessKeyPrefix = $.fn.updateTooltipAccessKeys.getAccessKeyPrefix().replace( /-/g, '+' ),
|
||||
accessKeyModifiers = new ve.ui.Trigger( accessKeyPrefix + '-' ).modifiers,
|
||||
surfaceModel = this.getSurface().getModel();
|
||||
|
@ -476,7 +477,10 @@ ve.init.mw.ArticleTarget.prototype.surfaceReady = function () {
|
|||
}
|
||||
} else {
|
||||
// ...otherwise store this document state for later recovery
|
||||
this.storeDocState( this.originalHtml );
|
||||
// Wait for the first change before doing this.
|
||||
surfaceModel.once( 'undoStackChange', function () {
|
||||
target.storeDocState( target.originalHtml );
|
||||
} );
|
||||
}
|
||||
// Start auto-saving transactions
|
||||
surfaceModel.startStoringChanges();
|
||||
|
|
Loading…
Reference in a new issue