mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-11-15 10:35:48 +00:00
Merge "autosave: Don't store initial document state until first change"
This commit is contained in:
commit
e7d7d5bab1
|
@ -437,6 +437,7 @@ ve.init.mw.ArticleTarget.prototype.documentReady = function () {
|
||||||
*/
|
*/
|
||||||
ve.init.mw.ArticleTarget.prototype.surfaceReady = function () {
|
ve.init.mw.ArticleTarget.prototype.surfaceReady = function () {
|
||||||
var name, i, triggers,
|
var name, i, triggers,
|
||||||
|
target = this,
|
||||||
accessKeyPrefix = $.fn.updateTooltipAccessKeys.getAccessKeyPrefix().replace( /-/g, '+' ),
|
accessKeyPrefix = $.fn.updateTooltipAccessKeys.getAccessKeyPrefix().replace( /-/g, '+' ),
|
||||||
accessKeyModifiers = new ve.ui.Trigger( accessKeyPrefix + '-' ).modifiers,
|
accessKeyModifiers = new ve.ui.Trigger( accessKeyPrefix + '-' ).modifiers,
|
||||||
surfaceModel = this.getSurface().getModel();
|
surfaceModel = this.getSurface().getModel();
|
||||||
|
@ -476,7 +477,10 @@ ve.init.mw.ArticleTarget.prototype.surfaceReady = function () {
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// ...otherwise store this document state for later recovery
|
// ...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
|
// Start auto-saving transactions
|
||||||
surfaceModel.startStoringChanges();
|
surfaceModel.startStoringChanges();
|
||||||
|
|
Loading…
Reference in a new issue