summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCheng-Han, Wu2016-04-20 16:17:24 +0800
committerCheng-Han, Wu2016-04-20 16:17:24 +0800
commitb347ea5414e20f3cc3ef9d0e42fceea0c417fd9f (patch)
treee968447675290359ae0a869b3ab10cff5bb7e9a4
parentb996f801cc2b464b70e4cbf07944f2379f6552be (diff)
Workaround editor might have wrong doc height and wrong simple scroll bar knob position when editor height changed
-rw-r--r--public/js/index.js8
1 files changed, 8 insertions, 0 deletions
diff --git a/public/js/index.js b/public/js/index.js
index b40836f3..6cbaf066 100644
--- a/public/js/index.js
+++ b/public/js/index.js
@@ -786,10 +786,18 @@ function checkEditorStyle() {
if (scrollbarStyle == 'overlay' || currentMode == modeType.both) {
ui.area.codemirrorScroll.css('height', desireHeight + 'px');
ui.area.codemirrorScroll.css('min-height', '');
+ // workaround simple scroll bar knob
+ // will get wrong position when editor height changed
+ var scrollInfo = editor.getScrollInfo();
+ preventSyncScroll = true;
+ editor.scrollTo(null, scrollInfo.top - 1);
+ editor.scrollTo(null, scrollInfo.top);
} else if (scrollbarStyle == 'native') {
ui.area.codemirrorScroll.css('height', '');
ui.area.codemirrorScroll.css('min-height', desireHeight + 'px');
}
+ // workaround editor will have wrong doc height when editor height changed
+ editor.setSize(null, ui.area.edit.height());
//make editor resizable
ui.area.edit.resizable({
handles: 'e',