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