initial implementation of typed variables
This commit is contained in:
@@ -35,10 +35,12 @@ import { Card } from '@material-ui/core';
|
||||
Blockly.setLocale(locale);
|
||||
|
||||
class BlocklyComponent extends React.Component {
|
||||
|
||||
constructor(props) {
|
||||
super(props);
|
||||
this.blocklyDiv = React.createRef();
|
||||
this.toolbox = React.createRef();
|
||||
this.state = {workspace: undefined};
|
||||
}
|
||||
|
||||
componentDidMount() {
|
||||
@@ -50,6 +52,7 @@ class BlocklyComponent extends React.Component {
|
||||
...rest
|
||||
},
|
||||
);
|
||||
this.setState({workspace: this.primaryWorkspace})
|
||||
|
||||
if (initialXml) {
|
||||
Blockly.Xml.domToWorkspace(Blockly.Xml.textToDom(initialXml), this.primaryWorkspace);
|
||||
@@ -65,11 +68,9 @@ class BlocklyComponent extends React.Component {
|
||||
}
|
||||
|
||||
render() {
|
||||
|
||||
|
||||
return <React.Fragment>
|
||||
<Card ref={this.blocklyDiv} id="blocklyDiv" style={this.props.style ? this.props.style : {}}/>
|
||||
<Toolbox toolbox={this.toolbox} />
|
||||
<Toolbox toolbox={this.toolbox} workspace={this.state.workspace} />
|
||||
</React.Fragment>;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user