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 WindowControls from './WindowControls'
import WidthHandler from './WidthHandler'
import {
COLORS,
@ -223,7 +224,15 @@ class Carbon extends React.PureComponent {
<div className="alpha eliminateOnRender" />
<div className="bg" />
</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>

@ -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={
<WidthHandler
innerRef={this.carbonNode}
onChange={this.updateWidth}
onChangeComplete={this.sync}
paddingHorizontal={config.paddingHorizontal}
paddingVertical={config.paddingVertical}
/>
}
>
{code != null ? code : DEFAULT_CODE}
</Carbon>

@ -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({
</div>
)
}
export default React.memo(WidthHandler)

Loading…
Cancel
Save