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