@@ -511,6 +511,8 @@ function checkResponsive() {
511511 emitUserStatus ( ) ;
512512}
513513
514+ var lastEditorWidth = 0 ;
515+
514516function checkEditorStyle ( ) {
515517 var scrollbarStyle = editor . getOption ( 'scrollbarStyle' ) ;
516518 if ( scrollbarStyle == 'overlay' || currentMode == modeType . both ) {
@@ -531,6 +533,15 @@ function checkEditorStyle() {
531533 //set sizer height to make it at least height as editor
532534 var editorSizerHeight = ui . area . edit . height ( ) - ( statusBar ? statusBar . outerHeight ( ) : 0 ) ;
533535 $ ( '.CodeMirror-sizer' ) . css ( 'height' , editorSizerHeight + 'px' ) ;
536+ //make editor resizable
537+ ui . area . edit . resizable ( {
538+ handles : 'e' ,
539+ maxWidth : $ ( window ) . width ( ) * 0.7 ,
540+ minWidth : $ ( window ) . width ( ) * 0.2 ,
541+ stop : function ( e ) {
542+ lastEditorWidth = ui . area . edit . width ( ) ;
543+ }
544+ } ) ;
534545}
535546
536547function checkTocStyle ( ) {
@@ -657,7 +668,7 @@ function changeMode(type) {
657668 ui . area . codemirror . addClass ( scrollClass ) ;
658669 ui . area . edit . addClass ( responsiveClass ) . show ( ) ;
659670 ui . area . view . addClass ( scrollClass ) ;
660- ui . area . view . addClass ( responsiveClass ) . show ( ) ;
671+ ui . area . view . show ( ) ;
661672 break ;
662673 }
663674 if ( currentMode != modeType . view && visibleLG ) {
@@ -685,6 +696,17 @@ function changeMode(type) {
685696 } else {
686697 $ ( document . body ) . css ( 'background-color' , ui . area . codemirror . css ( 'background-color' ) ) ;
687698 }
699+ //check resizable editor style
700+ if ( currentMode == modeType . both ) {
701+ if ( lastEditorWidth > 0 )
702+ ui . area . edit . css ( 'width' , lastEditorWidth + 'px' ) ;
703+ else
704+ ui . area . edit . css ( 'width' , '' ) ;
705+ ui . area . edit . find ( '.ui-resizable-handle' ) . show ( ) ;
706+ } else {
707+ ui . area . edit . css ( 'width' , '' ) ;
708+ ui . area . edit . find ( '.ui-resizable-handle' ) . hide ( ) ;
709+ }
688710
689711 windowResizeInner ( ) ;
690712
0 commit comments