@@ -94,6 +94,7 @@ export default class App extends Component {
9494 title : '' ,
9595 externalLibs : { js : '' , css : '' } ,
9696 } ,
97+ isEditorCollapsed : false ,
9798 } ;
9899 this . defaultSettings = {
99100 preserveLastCode : true ,
@@ -758,6 +759,25 @@ BookLibService.Borrow(id) {
758759 this . toggleLayout ( layoutId ) ;
759760 }
760761
762+ async toggleEditorCollapse ( ) {
763+ await this . setState ( {
764+ isEditorCollapsed : ! this . state . isEditorCollapsed ,
765+ } ) ;
766+
767+ // Apply CSS class to body to control layout
768+ if ( this . state . isEditorCollapsed ) {
769+ document . body . classList . add ( 'editor-collapsed' ) ;
770+ } else {
771+ document . body . classList . remove ( 'editor-collapsed' ) ;
772+ }
773+
774+ mixpanel . track ( {
775+ event : 'toggleEditorCollapse' ,
776+ category : 'ui' ,
777+ label : this . state . isEditorCollapsed ? 'collapsed' : 'expanded' ,
778+ } ) ;
779+ }
780+
761781 // Calculates the sizes of html, css & js code panes.
762782 getCodePaneSizes ( ) {
763783 var sizes ;
@@ -1661,6 +1681,7 @@ BookLibService.Borrow(id) {
16611681 openCheatSheet = { this . openCheatSheet . bind ( this ) }
16621682 onUpdateImage = { this . onUpdateImage . bind ( this ) }
16631683 currentItem = { this . state . currentItem }
1684+ currentLayoutMode = { this . state . currentLayoutMode }
16641685 onLogin = { this . loginBtnClickHandler . bind ( this ) }
16651686 externalLibCount = { this . state . externalLibCount }
16661687 openBtnHandler = { this . openBtnClickHandler . bind ( this ) }
@@ -1679,6 +1700,8 @@ BookLibService.Borrow(id) {
16791700 user = { this . state . user }
16801701 settingsBtnClickHandler = { this . handleSettingsBtnClick . bind ( this ) }
16811702 unsavedEditCount = { this . state . unsavedEditCount }
1703+ isEditorCollapsed = { this . state . isEditorCollapsed }
1704+ onToggleEditorCollapse = { this . toggleEditorCollapse . bind ( this ) }
16821705 />
16831706 ) }
16841707 { this . isEmbed && (
@@ -1709,6 +1732,8 @@ BookLibService.Borrow(id) {
17091732 this ,
17101733 ) }
17111734 layoutBtnClickHandler = { this . layoutBtnClickHandler . bind ( this ) }
1735+ isEditorCollapsed = { this . state . isEditorCollapsed }
1736+ onToggleEditorCollapse = { this . toggleEditorCollapse . bind ( this ) }
17121737 />
17131738 { this . isEmbed ? null : (
17141739 < Footer
0 commit comments