Remove gDSFP in Carbon (#477)

* remove gDSFP in Carbon

* add comment
main
Michael Fix 6 years ago committed by GitHub
parent a0b1c29727
commit c22a8e2a0d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -28,7 +28,7 @@ class Carbon extends PureComponent {
super(props)
this.state = {
language: props.config.language
...handleLanguageChange(this.props.children, this.props)
}
this.handleTitleBarChange = this.handleTitleBarChange.bind(this)
@ -38,8 +38,6 @@ class Carbon extends PureComponent {
}
componentDidMount() {
this.setState(handleLanguageChange(this.props.children, this.props))
const ro = new ResizeObserver(entries => {
const cr = entries[0].contentRect
this.props.onAspectRatioChange(cr.width / cr.height)
@ -47,10 +45,6 @@ class Carbon extends PureComponent {
ro.observe(this.exportContainerNode)
}
static getDerivedStateFromProps(newProps) {
return handleLanguageChange(newProps.children, newProps) || null
}
codeUpdated(newCode) {
this.handleLanguageChange(newCode, this.props)
this.props.updateCode(newCode)

@ -311,7 +311,9 @@ class Editor extends React.Component {
isOver={isOver || canDrop}
title={`Drop your file here to import ${isOver ? '✋' : '✊'}`}
>
{/*key ensures Carbon's internal language state is updated when it's changed by Dropdown*/}
<Carbon
key={this.state.language}
config={this.state}
updateCode={this.updateCode}
onAspectRatioChange={this.updateAspectRatio}

Loading…
Cancel
Save