diff --git a/components/Carbon.js b/components/Carbon.js index 1d82c43..be5f2f4 100644 --- a/components/Carbon.js +++ b/components/Carbon.js @@ -11,6 +11,7 @@ hljs.registerLanguage('javascript', javascript) import { Spinner } from './Spinner' import WindowControls from './WindowControls' +import WidthHandler from './WidthHandler' import { COLORS, @@ -223,7 +224,15 @@ class Carbon extends React.PureComponent {
- {this.props.widthHandler} + + {/* TODO pass in this child as a prop to Carbon */} +
)} diff --git a/components/Editor.js b/components/Editor.js index 79d13fe..4af47fe 100644 --- a/components/Editor.js +++ b/components/Editor.js @@ -17,7 +17,6 @@ import ShareMenu from './ShareMenu' import CopyMenu from './CopyMenu' import Themes from './Themes' import FontFace from './FontFace' -import WidthHandler from './WidthHandler' import LanguageIcon from './svg/Language' import { LANGUAGES, @@ -401,19 +400,12 @@ class Editor extends React.Component { ref={this.carbonNode} config={this.state} onChange={this.updateCode} + updateWidth={this.updateWidth} + updateWidthConfirm={this.sync} loading={this.state.loading} theme={theme} titleBar={titleBar} onTitleBarChange={this.updateTitleBar} - widthHandler={ - - } > {code != null ? code : DEFAULT_CODE} diff --git a/components/WidthHandler.js b/components/WidthHandler.js index be5caac..820707e 100644 --- a/components/WidthHandler.js +++ b/components/WidthHandler.js @@ -13,7 +13,7 @@ function clamp(value, min, max) { return value } -function WidthHandler({ +export default function WidthHandler({ innerRef, onChange, onChangeComplete, @@ -81,5 +81,3 @@ function WidthHandler({ ) } - -export default React.memo(WidthHandler)