mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-01 13:54:35 +03:00
Auto-save post at 60 second intervals
Refs #4259 - Auto-save the post at least once in any 60 second interval where there have been changes.
This commit is contained in:
parent
4067bfe4c1
commit
5de2cb4471
@ -195,6 +195,7 @@ var EditorControllerMixin = Ember.Mixin.create(MarkerManager, {
|
|||||||
prevStatus = this.get('status'),
|
prevStatus = this.get('status'),
|
||||||
isNew = this.get('isNew'),
|
isNew = this.get('isNew'),
|
||||||
autoSaveId = this.get('autoSaveId'),
|
autoSaveId = this.get('autoSaveId'),
|
||||||
|
timedSaveId = this.get('timedSaveId'),
|
||||||
self = this,
|
self = this,
|
||||||
psmController = this.get('controllers.post-settings-menu'),
|
psmController = this.get('controllers.post-settings-menu'),
|
||||||
promise;
|
promise;
|
||||||
@ -206,6 +207,11 @@ var EditorControllerMixin = Ember.Mixin.create(MarkerManager, {
|
|||||||
this.set('autoSaveId', null);
|
this.set('autoSaveId', null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (timedSaveId) {
|
||||||
|
Ember.run.cancel(timedSaveId);
|
||||||
|
this.set('timedSaveId', null);
|
||||||
|
}
|
||||||
|
|
||||||
self.notifications.closePassive();
|
self.notifications.closePassive();
|
||||||
|
|
||||||
// ensure an incomplete tag is finalised before save
|
// ensure an incomplete tag is finalised before save
|
||||||
@ -319,10 +325,13 @@ var EditorControllerMixin = Ember.Mixin.create(MarkerManager, {
|
|||||||
|
|
||||||
autoSave: function () {
|
autoSave: function () {
|
||||||
if (this.get('model.isDraft')) {
|
if (this.get('model.isDraft')) {
|
||||||
var autoSaveId;
|
var autoSaveId,
|
||||||
|
timedSaveId;
|
||||||
|
|
||||||
|
timedSaveId = Ember.run.throttle(this, 'send', 'save', {silent: true, disableNProgress: true}, 60000, false);
|
||||||
|
this.set('timedSaveId', timedSaveId);
|
||||||
|
|
||||||
autoSaveId = Ember.run.debounce(this, 'send', 'save', {silent: true, disableNProgress: true}, 3000);
|
autoSaveId = Ember.run.debounce(this, 'send', 'save', {silent: true, disableNProgress: true}, 3000);
|
||||||
|
|
||||||
this.set('autoSaveId', autoSaveId);
|
this.set('autoSaveId', autoSaveId);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
Loading…
Reference in New Issue
Block a user