diff --git a/client/modules/IDE/pages/IDEView.js b/client/modules/IDE/pages/IDEView.js index 312bbc8f..a6c4b7c9 100644 --- a/client/modules/IDE/pages/IDEView.js +++ b/client/modules/IDE/pages/IDEView.js @@ -17,6 +17,12 @@ import { getFile, getHTMLFile, getJSFiles, getCSSFiles, setSelectedFile } from ' import SplitPane from 'react-split-pane'; class IDEView extends React.Component { + constructor(props) { + super(props); + this._handleConsolePaneOnDragFinished = this._handleConsolePaneOnDragFinished.bind(this); + this._handleSidebarPaneOnDragFinished = this._handleSidebarPaneOnDragFinished.bind(this); + } + componentDidMount() { if (this.props.params.project_id) { const id = this.props.params.project_id; @@ -29,6 +35,19 @@ class IDEView extends React.Component { this.autosaveInterval = setInterval(this.props.saveProject, 30000); } } + + this.consoleSize = this.props.ide.consoleIsExpanded ? 180 : 29; + this.sidebarSize = this.props.ide.sidebarIsExpanded ? 180 : 20; + } + + componentWillUpdate(nextProps) { + if (this.props.ide.consoleIsExpanded !== nextProps.ide.consoleIsExpanded) { + this.consoleSize = nextProps.ide.consoleIsExpanded ? 180 : 29; + } + + if (this.props.ide.sidebarIsExpanded !== nextProps.ide.sidebarIsExpanded) { + this.sidebarSize = nextProps.ide.sidebarIsExpanded ? 180 : 20; + } } componentDidUpdate(prevProps) { @@ -53,6 +72,22 @@ class IDEView extends React.Component { this.autosaveInterval = null; } + _handleConsolePaneOnDragFinished() { + this.consoleSize = this.refs.consolePane.state.draggedSize; + this.refs.consolePane.setState({ + resized: false, + draggedSize: undefined, + }); + } + + _handleSidebarPaneOnDragFinished() { + this.sidebarSize = this.refs.sidebarPane.state.draggedSize; + this.refs.sidebarPane.setState({ + resized: false, + draggedSize: undefined + }); + } + render() { return (
@@ -88,7 +123,13 @@ class IDEView extends React.Component { setAutosave={this.props.setAutosave} />
- + (this.refs.overlay.style.display = 'block')} onDragFinished={() => (this.refs.overlay.style.display = 'none')} > - +