summaryrefslogtreecommitdiff
path: root/public/js
diff options
context:
space:
mode:
authorCheng-Han, Wu2016-06-17 15:57:34 +0800
committerCheng-Han, Wu2016-06-17 15:57:34 +0800
commit2c58b05d058e264f1222874ac163613ca94437c5 (patch)
treecce42fc2a71db5d01d7952e513e15e339c4086f0 /public/js
parent3498b9fae9db90ca248dc1d3438cf61715d66959 (diff)
Revert f32dee3796777b71333b4020535e789352900b82, because workaround has better performance and they might needed in some cases
Diffstat (limited to 'public/js')
-rw-r--r--public/js/index.js13
1 files changed, 11 insertions, 2 deletions
diff --git a/public/js/index.js b/public/js/index.js
index d6efbef2..e873e732 100644
--- a/public/js/index.js
+++ b/public/js/index.js
@@ -795,7 +795,7 @@ function checkEditorStyle() {
if (scrollbarStyle == 'overlay' || currentMode == modeType.both) {
ui.area.codemirrorScroll.css('height', desireHeight + 'px');
ui.area.codemirrorScroll.css('min-height', '');
- editor.refresh();
+ checkEditorScrollbar();
} else if (scrollbarStyle == 'native') {
ui.area.codemirrorScroll.css('height', '');
ui.area.codemirrorScroll.css('min-height', desireHeight + 'px');
@@ -835,7 +835,7 @@ function checkEditorStyle() {
ui.area.view.scroll();
});
}
- editor.refresh();
+ checkEditorScrollbar();
}
});
ui.area.resize.handle = $('.ui-resizable-handle');
@@ -876,6 +876,14 @@ 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() {
//toc right
var paddingRight = parseFloat(ui.area.markdown.css('padding-right'));
@@ -2509,6 +2517,7 @@ editor.on('changes', function (cm, changes) {
viewportMargin = newViewportMargin;
windowResize();
}
+ checkEditorScrollbar();
});
editor.on('focus', function (cm) {
for (var i = 0; i < onlineUsers.length; i++) {