mirror of https://github.com/status-im/codimd.git
Workaround editor might have wrong doc height and wrong simple scroll bar knob position when editor height changed
This commit is contained in:
parent
b996f801cc
commit
b347ea5414
|
@ -786,10 +786,18 @@ 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', '');
|
||||||
|
// 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') {
|
} 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');
|
||||||
}
|
}
|
||||||
|
// workaround editor will have wrong doc height when editor height changed
|
||||||
|
editor.setSize(null, ui.area.edit.height());
|
||||||
//make editor resizable
|
//make editor resizable
|
||||||
ui.area.edit.resizable({
|
ui.area.edit.resizable({
|
||||||
handles: 'e',
|
handles: 'e',
|
||||||
|
|
Loading…
Reference in New Issue