Skip to content

Commit f32dee3

Browse files
committed
Remove checkEditorScrollbar workaround since CodeMirror 5.15.3 already fixed this issue, refer to CodeMirror #3896
1 parent fb70833 commit f32dee3

1 file changed

Lines changed: 3 additions & 11 deletions

File tree

public/js/index.js

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -795,7 +795,7 @@ function checkEditorStyle() {
795795
if (scrollbarStyle == 'overlay' || currentMode == modeType.both) {
796796
ui.area.codemirrorScroll.css('height', desireHeight + 'px');
797797
ui.area.codemirrorScroll.css('min-height', '');
798-
checkEditorScrollbar();
798+
editor.refresh();
799799
} else if (scrollbarStyle == 'native') {
800800
ui.area.codemirrorScroll.css('height', '');
801801
ui.area.codemirrorScroll.css('min-height', desireHeight + 'px');
@@ -835,7 +835,7 @@ function checkEditorStyle() {
835835
ui.area.view.scroll();
836836
});
837837
}
838-
checkEditorScrollbar();
838+
editor.refresh();
839839
}
840840
});
841841
ui.area.resize.handle = $('.ui-resizable-handle');
@@ -876,14 +876,6 @@ function checkSyncToggle() {
876876
}
877877
}
878878

879-
function checkEditorScrollbar() {
880-
// workaround simple scroll bar knob
881-
// will get wrong position when editor height changed
882-
var scrollInfo = editor.getScrollInfo();
883-
editor.scrollTo(null, scrollInfo.top - 1);
884-
editor.scrollTo(null, scrollInfo.top);
885-
}
886-
887879
function checkTocStyle() {
888880
//toc right
889881
var paddingRight = parseFloat(ui.area.markdown.css('padding-right'));
@@ -2510,7 +2502,7 @@ editor.on('changes', function (cm, changes) {
25102502
viewportMargin = newViewportMargin;
25112503
windowResize();
25122504
}
2513-
checkEditorScrollbar();
2505+
editor.refresh();
25142506
});
25152507
editor.on('focus', function (cm) {
25162508
for (var i = 0; i < onlineUsers.length; i++) {

0 commit comments

Comments
 (0)