Remove checkEditorScrollbar workaround since CodeMirror 5.15.3 already fixed this issue, refer to CodeMirror #3896

This commit is contained in:
Cheng-Han, Wu 2016-06-01 14:37:51 +08:00
parent fb70833bc5
commit f32dee3796
1 changed files with 3 additions and 11 deletions

View File

@ -795,7 +795,7 @@ function checkEditorStyle() {
if (scrollbarStyle == 'overlay' || currentMode == modeType.both) { if (scrollbarStyle == 'overlay' || currentMode == modeType.both) {
ui.area.codemirrorScroll.css('height', desireHeight + 'px'); ui.area.codemirrorScroll.css('height', desireHeight + 'px');
ui.area.codemirrorScroll.css('min-height', ''); ui.area.codemirrorScroll.css('min-height', '');
checkEditorScrollbar(); editor.refresh();
} else if (scrollbarStyle == 'native') { } else if (scrollbarStyle == 'native') {
ui.area.codemirrorScroll.css('height', ''); ui.area.codemirrorScroll.css('height', '');
ui.area.codemirrorScroll.css('min-height', desireHeight + 'px'); ui.area.codemirrorScroll.css('min-height', desireHeight + 'px');
@ -835,7 +835,7 @@ function checkEditorStyle() {
ui.area.view.scroll(); ui.area.view.scroll();
}); });
} }
checkEditorScrollbar(); editor.refresh();
} }
}); });
ui.area.resize.handle = $('.ui-resizable-handle'); ui.area.resize.handle = $('.ui-resizable-handle');
@ -876,14 +876,6 @@ function checkSyncToggle() {
} }
} }
function checkEditorScrollbar() {
// workaround simple scroll bar knob
// will get wrong position when editor height changed
var scrollInfo = editor.getScrollInfo();
editor.scrollTo(null, scrollInfo.top - 1);
editor.scrollTo(null, scrollInfo.top);
}
function checkTocStyle() { function checkTocStyle() {
//toc right //toc right
var paddingRight = parseFloat(ui.area.markdown.css('padding-right')); var paddingRight = parseFloat(ui.area.markdown.css('padding-right'));
@ -2510,7 +2502,7 @@ editor.on('changes', function (cm, changes) {
viewportMargin = newViewportMargin; viewportMargin = newViewportMargin;
windowResize(); windowResize();
} }
checkEditorScrollbar(); editor.refresh();
}); });
editor.on('focus', function (cm) { editor.on('focus', function (cm) {
for (var i = 0; i < onlineUsers.length; i++) { for (var i = 0; i < onlineUsers.length; i++) {