summaryrefslogtreecommitdiff
path: root/public/js/syncscroll.js
diff options
context:
space:
mode:
authorWu Cheng-Han2015-09-25 18:05:50 +0800
committerWu Cheng-Han2015-09-25 18:05:50 +0800
commitfa957db272f0adb2d3bc1f881c91de9b1ccee6f0 (patch)
treebe7846fad8200e556fe709bbaa68a283270dce68 /public/js/syncscroll.js
parent11c4a0404e1542a40dfff3f4e13fe1db78829d07 (diff)
Updated updateView, now will updateHistory in editor changes event, support preventSyncScroll and workaround editor might scroll to no where on changes in the doc bottom
Diffstat (limited to 'public/js/syncscroll.js')
-rw-r--r--public/js/syncscroll.js6
1 files changed, 6 insertions, 0 deletions
diff --git a/public/js/syncscroll.js b/public/js/syncscroll.js
index a9eafe48..143e668e 100644
--- a/public/js/syncscroll.js
+++ b/public/js/syncscroll.js
@@ -139,6 +139,8 @@ md.renderer.rules.code = function (tokens, idx /*, options, env */ ) {
return '<code>' + Remarkable.utils.escapeHtml(tokens[idx].content) + '</code>';
};
+var preventSyncScroll = false;
+
//var editorScrollThrottle = 100;
var buildMapThrottle = 100;
@@ -299,6 +301,10 @@ function getEditorLineNoByTop(top) {
function syncScrollToView(event, _lineNo) {
if (currentMode != modeType.both) return;
+ if (preventSyncScroll) {
+ preventSyncScroll = false;
+ return;
+ }
var lineNo, posTo;
var scrollInfo = editor.getScrollInfo();
if (!scrollMap || !lineHeightMap) {