diff --git a/ghost/admin/views/editor.js b/ghost/admin/views/editor.js index 3e89b03235..827f631d45 100644 --- a/ghost/admin/views/editor.js +++ b/ghost/admin/views/editor.js @@ -167,7 +167,6 @@ this.initMarkdown(); this.renderPreview(); - // TODO: Debounce this.$('.CodeMirror-scroll').on('scroll', this.syncScroll); // Shadow on Markdown if scrolled @@ -200,7 +199,7 @@ }, - syncScroll: function (e) { + syncScroll: _.debounce(function (e) { var $codeViewport = $(e.target), $previewViewport = $('.entry-preview-content'), $codeContent = $('.CodeMirror-sizer'), @@ -214,7 +213,7 @@ // apply new scroll $previewViewport.scrollTop(previewPostition); - }, + }, 50), // This updates the editor preview panel. // Currently gets called on every key press.