mirror of
https://github.com/chinchang/web-maker.git
synced 2025-07-28 01:00:13 +02:00
Show preview dimension when resizing the main split. fixes #317
This commit is contained in:
@@ -9,9 +9,10 @@ import CodeMirror from '../CodeMirror';
|
||||
import { Console } from './Console';
|
||||
import { deferred } from '../deferred';
|
||||
import CssSettingsModal from './CssSettingsModal';
|
||||
import { PreviewDimension } from './PreviewDimension.jsx';
|
||||
const minCodeWrapSize = 33;
|
||||
|
||||
/* global htmlCodeEl, jsCodeEl, cssCodeEl, logCountEl
|
||||
/* global htmlCodeEl
|
||||
*/
|
||||
|
||||
export default class ContentWrap extends Component {
|
||||
@@ -22,6 +23,7 @@ export default class ContentWrap extends Component {
|
||||
isCssSettingsModalOpen: false,
|
||||
logs: []
|
||||
};
|
||||
|
||||
this.updateTimer = null;
|
||||
this.updateDelay = 500;
|
||||
this.htmlMode = HtmlModes.HTML;
|
||||
@@ -425,6 +427,12 @@ export default class ContentWrap extends Component {
|
||||
}
|
||||
this.updateSplits();
|
||||
}
|
||||
mainSplitDragHandler() {
|
||||
this.previewDimension.update({
|
||||
w: this.frame.clientWidth,
|
||||
h: this.frame.clientHeight
|
||||
});
|
||||
}
|
||||
codeSplitDragStart() {
|
||||
document.body.classList.add('is-dragging');
|
||||
}
|
||||
@@ -636,6 +644,8 @@ export default class ContentWrap extends Component {
|
||||
}
|
||||
|
||||
render() {
|
||||
log('contentwrap update');
|
||||
|
||||
return (
|
||||
<SplitPane
|
||||
class="content-wrap flex flex-grow"
|
||||
@@ -645,6 +655,7 @@ export default class ContentWrap extends Component {
|
||||
direction={
|
||||
this.props.currentLayoutMode === 2 ? 'vertical' : 'horizontal'
|
||||
}
|
||||
onDrag={this.mainSplitDragHandler.bind(this)}
|
||||
onDragEnd={this.mainSplitDragEndHandler.bind(this)}
|
||||
>
|
||||
<SplitPane
|
||||
@@ -846,6 +857,9 @@ export default class ContentWrap extends Component {
|
||||
id="demo-frame"
|
||||
allowfullscreen
|
||||
/>
|
||||
|
||||
<PreviewDimension ref={comp => (this.previewDimension = comp)} />
|
||||
|
||||
<Console
|
||||
logs={this.state.logs}
|
||||
isConsoleOpen={this.state.isConsoleOpen}
|
||||
|
Reference in New Issue
Block a user