diff --git a/core/client/components/gh-codemirror.js b/core/client/components/gh-codemirror.js index c65fee6d410f..6e289344ab17 100644 --- a/core/client/components/gh-codemirror.js +++ b/core/client/components/gh-codemirror.js @@ -21,8 +21,7 @@ var onChangeHandler = function (cm, changeObj) { cm.component.set('value', cm.getValue()); - // Send an action notifying a 5 second pause in typing/changes. - Ember.run.debounce(component, 'sendAction', 'typingPause', 3000); + component.sendAction('typingPause'); }; var onScrollHandler = function (cm) { diff --git a/core/client/mixins/editor-base-controller.js b/core/client/mixins/editor-base-controller.js index 762c7669effe..f557bd059e87 100644 --- a/core/client/mixins/editor-base-controller.js +++ b/core/client/mixins/editor-base-controller.js @@ -194,9 +194,16 @@ var EditorControllerMixin = Ember.Mixin.create(MarkerManager, { var status = this.get('willPublish') ? 'published' : 'draft', prevStatus = this.get('status'), isNew = this.get('isNew'), + autoSaveId = this.get('autoSaveId'), self = this; + options = options || {}; + if(autoSaveId) { + Ember.run.cancel(autoSaveId); + this.set('autoSaveId', null); + } + self.notifications.closePassive(); // ensure an incomplete tag is finalised before save @@ -296,13 +303,17 @@ var EditorControllerMixin = Ember.Mixin.create(MarkerManager, { autoSave: function () { 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 () { if (this.get('isNew')) { - this.send('autoSave'); + this.send('save', {silent: true, disableNProgress: true}); } } } diff --git a/core/test/functional/base.js b/core/test/functional/base.js index 8974e056cb3f..cdf554bd657b 100644 --- a/core/test/functional/base.js +++ b/core/test/functional/base.js @@ -247,7 +247,7 @@ casper.on('remote.message', function (msg) { // output any errors casper.on('error', function (msg, trace) { casper.echoConcise('ERROR, ' + msg, 'ERROR'); - if (trace) { + if (trace && trace[0]) { casper.echoConcise('file: ' + trace[0].file, 'WARNING'); casper.echoConcise('line: ' + trace[0].line, 'WARNING'); casper.echoConcise('function: ' + trace[0]['function'], 'WARNING'); @@ -258,7 +258,7 @@ casper.on('error', function (msg, trace) { // output any page errors casper.on('page.error', function (msg, trace) { casper.echoConcise('PAGE ERROR: ' + msg, 'ERROR'); - if (trace) { + if (trace && trace[0]) { casper.echoConcise('file: ' + trace[0].file, 'WARNING'); casper.echoConcise('line: ' + trace[0].line, 'WARNING'); casper.echoConcise('function: ' + trace[0]['function'], 'WARNING'); diff --git a/package.json b/package.json index 867b46f3db93..a3089a63d189 100644 --- a/package.json +++ b/package.json @@ -69,6 +69,7 @@ "devDependencies": { "blanket": "~1.1.6", "bower": "~1.3.10", + "ember-template-compiler": "1.7.0", "grunt": "~0.4.5", "grunt-cli": "~0.1.13", "grunt-autoprefixer": "1.0.1",