From b347ea5414e20f3cc3ef9d0e42fceea0c417fd9f Mon Sep 17 00:00:00 2001 From: "Cheng-Han, Wu" Date: Wed, 20 Apr 2016 16:17:24 +0800 Subject: [PATCH] Workaround editor might have wrong doc height and wrong simple scroll bar knob position when editor height changed --- public/js/index.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/public/js/index.js b/public/js/index.js index b40836f..6cbaf06 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',