mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-02-24 23:48:13 -05:00
parent
768e335735
commit
133aff0626
2 changed files with 14 additions and 4 deletions
|
@ -21,8 +21,7 @@ var onChangeHandler = function (cm, changeObj) {
|
||||||
|
|
||||||
cm.component.set('value', cm.getValue());
|
cm.component.set('value', cm.getValue());
|
||||||
|
|
||||||
// Send an action notifying a 5 second pause in typing/changes.
|
component.sendAction('typingPause');
|
||||||
Ember.run.debounce(component, 'sendAction', 'typingPause', 3000);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
var onScrollHandler = function (cm) {
|
var onScrollHandler = function (cm) {
|
||||||
|
|
|
@ -194,9 +194,16 @@ var EditorControllerMixin = Ember.Mixin.create(MarkerManager, {
|
||||||
var status = this.get('willPublish') ? 'published' : 'draft',
|
var status = this.get('willPublish') ? 'published' : 'draft',
|
||||||
prevStatus = this.get('status'),
|
prevStatus = this.get('status'),
|
||||||
isNew = this.get('isNew'),
|
isNew = this.get('isNew'),
|
||||||
|
autoSaveId = this.get('autoSaveId'),
|
||||||
self = this;
|
self = this;
|
||||||
|
|
||||||
options = options || {};
|
options = options || {};
|
||||||
|
|
||||||
|
if(autoSaveId) {
|
||||||
|
Ember.run.cancel(autoSaveId);
|
||||||
|
this.set('autoSaveId', null);
|
||||||
|
}
|
||||||
|
|
||||||
self.notifications.closePassive();
|
self.notifications.closePassive();
|
||||||
|
|
||||||
// ensure an incomplete tag is finalised before save
|
// ensure an incomplete tag is finalised before save
|
||||||
|
@ -296,13 +303,17 @@ var EditorControllerMixin = Ember.Mixin.create(MarkerManager, {
|
||||||
|
|
||||||
autoSave: function () {
|
autoSave: function () {
|
||||||
if (this.get('model.isDraft')) {
|
if (this.get('model.isDraft')) {
|
||||||
this.send('save', {silent: true, disableNProgress: true});
|
var autoSaveId;
|
||||||
|
|
||||||
|
autoSaveId = Ember.run.debounce(this, 'send', 'save', {silent: true, disableNProgress: true}, 3000);
|
||||||
|
|
||||||
|
this.set('autoSaveId', autoSaveId);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
autoSaveNew: function () {
|
autoSaveNew: function () {
|
||||||
if (this.get('isNew')) {
|
if (this.get('isNew')) {
|
||||||
this.send('autoSave');
|
this.send('save', {silent: true, disableNProgress: true});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue