undo some changes

main
Mike Fix 2 years ago
parent c1d021abc5
commit 5f752c28e8
No known key found for this signature in database
GPG Key ID: 1D85E862314CA79F

@ -11,6 +11,7 @@ hljs.registerLanguage('javascript', javascript)
import { Spinner } from './Spinner' import { Spinner } from './Spinner'
import WindowControls from './WindowControls' import WindowControls from './WindowControls'
import WidthHandler from './WidthHandler'
import { import {
COLORS, COLORS,
@ -223,7 +224,15 @@ class Carbon extends React.PureComponent {
<div className="alpha eliminateOnRender" /> <div className="alpha eliminateOnRender" />
<div className="bg" /> <div className="bg" />
</div> </div>
{this.props.widthHandler}
{/* TODO pass in this child as a prop to Carbon */}
<WidthHandler
innerRef={this.props.innerRef}
onChange={this.props.updateWidth}
onChangeComplete={this.props.updateWidthConfirm}
paddingHorizontal={config.paddingHorizontal}
paddingVertical={config.paddingVertical}
/>
</div> </div>
)} )}
</div> </div>

@ -17,7 +17,6 @@ import ShareMenu from './ShareMenu'
import CopyMenu from './CopyMenu' import CopyMenu from './CopyMenu'
import Themes from './Themes' import Themes from './Themes'
import FontFace from './FontFace' import FontFace from './FontFace'
import WidthHandler from './WidthHandler'
import LanguageIcon from './svg/Language' import LanguageIcon from './svg/Language'
import { import {
LANGUAGES, LANGUAGES,
@ -401,19 +400,12 @@ class Editor extends React.Component {
ref={this.carbonNode} ref={this.carbonNode}
config={this.state} config={this.state}
onChange={this.updateCode} onChange={this.updateCode}
updateWidth={this.updateWidth}
updateWidthConfirm={this.sync}
loading={this.state.loading} loading={this.state.loading}
theme={theme} theme={theme}
titleBar={titleBar} titleBar={titleBar}
onTitleBarChange={this.updateTitleBar} onTitleBarChange={this.updateTitleBar}
widthHandler={
<WidthHandler
innerRef={this.carbonNode}
onChange={this.updateWidth}
onChangeComplete={this.sync}
paddingHorizontal={config.paddingHorizontal}
paddingVertical={config.paddingVertical}
/>
}
> >
{code != null ? code : DEFAULT_CODE} {code != null ? code : DEFAULT_CODE}
</Carbon> </Carbon>

@ -13,7 +13,7 @@ function clamp(value, min, max) {
return value return value
} }
function WidthHandler({ export default function WidthHandler({
innerRef, innerRef,
onChange, onChange,
onChangeComplete, onChangeComplete,
@ -81,5 +81,3 @@ function WidthHandler({
</div> </div>
) )
} }
export default React.memo(WidthHandler)

Loading…
Cancel
Save