summaryrefslogtreecommitdiff
path: root/public
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--public/js/index.js25
-rw-r--r--public/js/syncscroll.js6
2 files changed, 17 insertions, 14 deletions
diff --git a/public/js/index.js b/public/js/index.js
index 832e0d15..8671af46 100644
--- a/public/js/index.js
+++ b/public/js/index.js
@@ -721,15 +721,17 @@ function windowResizeInner(callback) {
//refresh editor
if (loaded) {
if (editor.getOption('scrollbarStyle') === 'native') {
- clearMap();
- if (editorHasFocus()) {
- syncScrollToView();
- } else {
- syncScrollToEdit();
- }
- updateScrollspy();
- if (callback && typeof callback === 'function')
- callback();
+ setTimeout(function () {
+ clearMap();
+ if (editorHasFocus()) {
+ syncScrollToView();
+ } else {
+ syncScrollToEdit();
+ }
+ updateScrollspy();
+ if (callback && typeof callback === 'function')
+ callback();
+ }, 1);
} else {
// force it load all docs at once to prevent scroll knob blink
editor.setOption('viewportMargin', Infinity);
@@ -1030,6 +1032,11 @@ function changeMode(type) {
preventSyncScrollToEdit = 2;
syncScrollToView();
}
+
+ if (lastMode == modeType.both && currentMode != modeType.both) {
+ preventSyncScrollToView = false;
+ preventSyncScrollToEdit = false;
+ }
if (lastMode != modeType.edit && currentMode == modeType.edit) {
editor.refresh();
diff --git a/public/js/syncscroll.js b/public/js/syncscroll.js
index 9d0bbe02..53070fc4 100644
--- a/public/js/syncscroll.js
+++ b/public/js/syncscroll.js
@@ -120,11 +120,7 @@ var viewScrollingDebounce = 200;
var editScrolling = false;
var editScrollingDebounce = 200;
-if (editor.getOption('scrollbarStyle') === 'native') {
- ui.area.codemirrorScroll.on('scroll', _.throttle(syncScrollToView, editScrollThrottle));
-} else {
- editor.on('scroll', _.throttle(syncScrollToView, editScrollThrottle));
-}
+ui.area.codemirrorScroll.on('scroll', _.throttle(syncScrollToView, editScrollThrottle));
ui.area.view.on('scroll', _.throttle(syncScrollToEdit, viewScrollThrottle));
var scrollMap, lineHeightMap, viewTop, viewBottom;