|
|
|
@ -39,7 +39,8 @@ class Embed extends React.Component {
|
|
|
|
|
...DEFAULT_SETTINGS,
|
|
|
|
|
code: DEFAULT_CODE,
|
|
|
|
|
mounted: false,
|
|
|
|
|
readOnly: true
|
|
|
|
|
readOnly: true,
|
|
|
|
|
key: 0
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
snippet = {}
|
|
|
|
@ -54,6 +55,11 @@ class Embed extends React.Component {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// TODO fix state!
|
|
|
|
|
this.i = setTimeout(() => {
|
|
|
|
|
this.setState(s => ({ key: s.key + 1 }))
|
|
|
|
|
}, 10)
|
|
|
|
|
|
|
|
|
|
this.setState(
|
|
|
|
|
{
|
|
|
|
|
...this.snippet,
|
|
|
|
@ -66,6 +72,10 @@ class Embed extends React.Component {
|
|
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
componentWillUnmount() {
|
|
|
|
|
clearInterval(this.i)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ref = React.createRef()
|
|
|
|
|
|
|
|
|
|
postMessage = () => {
|
|
|
|
@ -101,6 +111,7 @@ class Embed extends React.Component {
|
|
|
|
|
<Page theme={this.state.theme}>
|
|
|
|
|
{this.state.mounted && (
|
|
|
|
|
<Carbon
|
|
|
|
|
key={this.state.key}
|
|
|
|
|
ref={this.ref}
|
|
|
|
|
config={this.state}
|
|
|
|
|
readOnly={this.state.readOnly}
|
|
|
|
|