mirror of https://github.com/status-im/codimd.git
Fixed editor changes will cause syncScrollToView
This commit is contained in:
parent
85078fd328
commit
3718238277
|
@ -2139,10 +2139,6 @@ editor.on('paste', function() {
|
||||||
});
|
});
|
||||||
editor.on('changes', function (cm, changes) {
|
editor.on('changes', function (cm, changes) {
|
||||||
updateHistory();
|
updateHistory();
|
||||||
preventSyncScroll = true;
|
|
||||||
var scrollInfo = editor.getScrollInfo();
|
|
||||||
editor.scrollTo(null, scrollInfo.top - 1);
|
|
||||||
editor.scrollTo(null, scrollInfo.top);
|
|
||||||
var docLength = editor.getValue().length;
|
var docLength = editor.getValue().length;
|
||||||
//workaround for big documents
|
//workaround for big documents
|
||||||
var newViewportMargin = 20;
|
var newViewportMargin = 20;
|
||||||
|
|
|
@ -115,8 +115,11 @@ var viewScrollingDelay = 200;
|
||||||
var viewScrollingTimer = null;
|
var viewScrollingTimer = null;
|
||||||
|
|
||||||
//editor.on('scroll', _.throttle(syncScrollToView, editorScrollThrottle));
|
//editor.on('scroll', _.throttle(syncScrollToView, editorScrollThrottle));
|
||||||
editor.on('scroll', syncScrollToView);
|
if (editor.getOption('scrollbarStyle') === 'native') {
|
||||||
ui.area.codemirrorScroll.on('scroll', syncScrollToView);
|
ui.area.codemirrorScroll.on('scroll', syncScrollToView);
|
||||||
|
} else {
|
||||||
|
editor.on('scroll', syncScrollToView);
|
||||||
|
}
|
||||||
ui.area.view.on('scroll', function () {
|
ui.area.view.on('scroll', function () {
|
||||||
viewScrolling = true;
|
viewScrolling = true;
|
||||||
clearTimeout(viewScrollingTimer);
|
clearTimeout(viewScrollingTimer);
|
||||||
|
|
Loading…
Reference in New Issue