Skip to content

Commit 3718238

Browse files
committed
Fixed editor changes will cause syncScrollToView
1 parent 85078fd commit 3718238

2 files changed

Lines changed: 5 additions & 6 deletions

File tree

public/js/index.js

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2139,10 +2139,6 @@ editor.on('paste', function() {
21392139
});
21402140
editor.on('changes', function (cm, changes) {
21412141
updateHistory();
2142-
preventSyncScroll = true;
2143-
var scrollInfo = editor.getScrollInfo();
2144-
editor.scrollTo(null, scrollInfo.top - 1);
2145-
editor.scrollTo(null, scrollInfo.top);
21462142
var docLength = editor.getValue().length;
21472143
//workaround for big documents
21482144
var newViewportMargin = 20;

public/js/syncscroll.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,8 +115,11 @@ var viewScrollingDelay = 200;
115115
var viewScrollingTimer = null;
116116

117117
//editor.on('scroll', _.throttle(syncScrollToView, editorScrollThrottle));
118-
editor.on('scroll', syncScrollToView);
119-
ui.area.codemirrorScroll.on('scroll', syncScrollToView);
118+
if (editor.getOption('scrollbarStyle') === 'native') {
119+
ui.area.codemirrorScroll.on('scroll', syncScrollToView);
120+
} else {
121+
editor.on('scroll', syncScrollToView);
122+
}
120123
ui.area.view.on('scroll', function () {
121124
viewScrolling = true;
122125
clearTimeout(viewScrollingTimer);

0 commit comments

Comments
 (0)