mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-11-28 22:43:30 +03:00
Merge pull request #4324 from jaswilli/timed-save
Auto-save post at 60 second intervals
This commit is contained in:
commit
644f922510
@ -198,6 +198,7 @@ EditorControllerMixin = Ember.Mixin.create(MarkerManager, {
|
||||
prevStatus = this.get('status'),
|
||||
isNew = this.get('isNew'),
|
||||
autoSaveId = this.get('autoSaveId'),
|
||||
timedSaveId = this.get('timedSaveId'),
|
||||
self = this,
|
||||
psmController = this.get('controllers.post-settings-menu'),
|
||||
promise;
|
||||
@ -209,6 +210,11 @@ EditorControllerMixin = Ember.Mixin.create(MarkerManager, {
|
||||
this.set('autoSaveId', null);
|
||||
}
|
||||
|
||||
if (timedSaveId) {
|
||||
Ember.run.cancel(timedSaveId);
|
||||
this.set('timedSaveId', null);
|
||||
}
|
||||
|
||||
self.notifications.closePassive();
|
||||
|
||||
// ensure an incomplete tag is finalised before save
|
||||
@ -329,10 +335,13 @@ EditorControllerMixin = Ember.Mixin.create(MarkerManager, {
|
||||
|
||||
autoSave: function () {
|
||||
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);
|
||||
|
||||
this.set('autoSaveId', autoSaveId);
|
||||
}
|
||||
},
|
||||
|
Loading…
Reference in New Issue
Block a user