@@ -783,12 +783,7 @@ function checkEditorStyle() {
783
783
if ( scrollbarStyle == 'overlay' || currentMode == modeType . both ) {
784
784
ui . area . codemirrorScroll . css ( 'height' , desireHeight + 'px' ) ;
785
785
ui . area . codemirrorScroll . css ( 'min-height' , '' ) ;
786
- // workaround simple scroll bar knob
787
- // will get wrong position when editor height changed
788
- var scrollInfo = editor . getScrollInfo ( ) ;
789
- preventSyncScroll = true ;
790
- editor . scrollTo ( null , scrollInfo . top - 1 ) ;
791
- editor . scrollTo ( null , scrollInfo . top ) ;
786
+ checkEditorScrollbar ( ) ;
792
787
} else if ( scrollbarStyle == 'native' ) {
793
788
ui . area . codemirrorScroll . css ( 'height' , '' ) ;
794
789
ui . area . codemirrorScroll . css ( 'min-height' , desireHeight + 'px' ) ;
@@ -806,6 +801,15 @@ function checkEditorStyle() {
806
801
} ) ;
807
802
}
808
803
804
+ function checkEditorScrollbar ( ) {
805
+ // workaround simple scroll bar knob
806
+ // will get wrong position when editor height changed
807
+ var scrollInfo = editor . getScrollInfo ( ) ;
808
+ preventSyncScroll = true ;
809
+ editor . scrollTo ( null , scrollInfo . top - 1 ) ;
810
+ editor . scrollTo ( null , scrollInfo . top ) ;
811
+ }
812
+
809
813
function checkTocStyle ( ) {
810
814
//toc right
811
815
var paddingRight = parseFloat ( ui . area . markdown . css ( 'padding-right' ) ) ;
@@ -2216,6 +2220,7 @@ editor.on('changes', function (cm, changes) {
2216
2220
viewportMargin = newViewportMargin ;
2217
2221
windowResize ( ) ;
2218
2222
}
2223
+ checkEditorScrollbar ( ) ;
2219
2224
} ) ;
2220
2225
editor . on ( 'focus' , function ( cm ) {
2221
2226
for ( var i = 0 ; i < onlineUsers . length ; i ++ ) {
0 commit comments