mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-03-04 02:01:58 -05:00
Merge pull request #297 from matthojo/Editor-Scrolling
Debounce scrolling on editor
This commit is contained in:
commit
7031ce1169
1 changed files with 2 additions and 3 deletions
|
@ -221,7 +221,6 @@
|
||||||
this.initMarkdown();
|
this.initMarkdown();
|
||||||
this.renderPreview();
|
this.renderPreview();
|
||||||
|
|
||||||
// TODO: Debounce
|
|
||||||
this.$('.CodeMirror-scroll').on('scroll', this.syncScroll);
|
this.$('.CodeMirror-scroll').on('scroll', this.syncScroll);
|
||||||
|
|
||||||
// Shadow on Markdown if scrolled
|
// Shadow on Markdown if scrolled
|
||||||
|
@ -254,7 +253,7 @@
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
syncScroll: function (e) {
|
syncScroll: _.debounce(function (e) {
|
||||||
var $codeViewport = $(e.target),
|
var $codeViewport = $(e.target),
|
||||||
$previewViewport = $('.entry-preview-content'),
|
$previewViewport = $('.entry-preview-content'),
|
||||||
$codeContent = $('.CodeMirror-sizer'),
|
$codeContent = $('.CodeMirror-sizer'),
|
||||||
|
@ -268,7 +267,7 @@
|
||||||
|
|
||||||
// apply new scroll
|
// apply new scroll
|
||||||
$previewViewport.scrollTop(previewPostition);
|
$previewViewport.scrollTop(previewPostition);
|
||||||
},
|
}, 50),
|
||||||
|
|
||||||
// This updates the editor preview panel.
|
// This updates the editor preview panel.
|
||||||
// Currently gets called on every key press.
|
// Currently gets called on every key press.
|
||||||
|
|
Loading…
Add table
Reference in a new issue