revert commit
This commit is contained in:
parent
9c02fa1ec6
commit
4e2b57d46a
@ -27,7 +27,7 @@
|
|||||||
<!-- Matomo Image Tracker-->
|
<!-- Matomo Image Tracker-->
|
||||||
<img
|
<img
|
||||||
src="https://piwik.sensebox.kaufen/matomo.php?idsite=9&rec=1"
|
src="https://piwik.sensebox.kaufen/matomo.php?idsite=9&rec=1"
|
||||||
style="border: 0"
|
style="border: 0; display: none"
|
||||||
alt=""
|
alt=""
|
||||||
/>
|
/>
|
||||||
<!-- End Matomo -->
|
<!-- End Matomo -->
|
||||||
|
@ -20,17 +20,8 @@ class BlocklyWindow extends Component {
|
|||||||
|
|
||||||
componentDidMount() {
|
componentDidMount() {
|
||||||
const workspace = Blockly.getMainWorkspace();
|
const workspace = Blockly.getMainWorkspace();
|
||||||
if (!this.props.initialXml) {
|
this.props.onChangeWorkspace({});
|
||||||
if (this.props.workspaceXML !== "") {
|
this.props.clearStats();
|
||||||
Blockly.Xml.clearWorkspaceAndLoadFromXml(
|
|
||||||
Blockly.Xml.textToDom(this.props.workspaceXML),
|
|
||||||
workspace
|
|
||||||
);
|
|
||||||
} else {
|
|
||||||
this.props.onChangeWorkspace({});
|
|
||||||
this.props.clearStats();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
workspace.addChangeListener((event) => {
|
workspace.addChangeListener((event) => {
|
||||||
this.props.onChangeWorkspace(event);
|
this.props.onChangeWorkspace(event);
|
||||||
// switch on that a block is displayed disabled or not depending on whether it is correctly connected
|
// switch on that a block is displayed disabled or not depending on whether it is correctly connected
|
||||||
@ -39,7 +30,6 @@ class BlocklyWindow extends Component {
|
|||||||
Blockly.Events.disableOrphans(event);
|
Blockly.Events.disableOrphans(event);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
Blockly.svgResize(workspace);
|
Blockly.svgResize(workspace);
|
||||||
const zoomToFit = new ZoomToFitControl(workspace);
|
const zoomToFit = new ZoomToFitControl(workspace);
|
||||||
zoomToFit.init();
|
zoomToFit.init();
|
||||||
@ -55,7 +45,6 @@ class BlocklyWindow extends Component {
|
|||||||
if (!xml) xml = initialXml;
|
if (!xml) xml = initialXml;
|
||||||
Blockly.Xml.domToWorkspace(Blockly.Xml.textToDom(xml), workspace);
|
Blockly.Xml.domToWorkspace(Blockly.Xml.textToDom(xml), workspace);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (props.language !== this.props.language) {
|
if (props.language !== this.props.language) {
|
||||||
// change language
|
// change language
|
||||||
if (!xml) xml = initialXml;
|
if (!xml) xml = initialXml;
|
||||||
@ -130,14 +119,12 @@ BlocklyWindow.propTypes = {
|
|||||||
onChangeWorkspace: PropTypes.func.isRequired,
|
onChangeWorkspace: PropTypes.func.isRequired,
|
||||||
clearStats: PropTypes.func.isRequired,
|
clearStats: PropTypes.func.isRequired,
|
||||||
renderer: PropTypes.string.isRequired,
|
renderer: PropTypes.string.isRequired,
|
||||||
language: PropTypes.string.isRequired,
|
language: PropTypes.string.isRequired
|
||||||
workspaceXML: PropTypes.string.isRequired,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const mapStateToProps = (state) => ({
|
const mapStateToProps = (state) => ({
|
||||||
renderer: state.general.renderer,
|
renderer: state.general.renderer,
|
||||||
language: state.general.language.Blockly,
|
language: state.general.language
|
||||||
workspaceXML: state.workspace.code.xml,
|
|
||||||
});
|
});
|
||||||
|
|
||||||
export default connect(mapStateToProps, { onChangeWorkspace, clearStats })(
|
export default connect(mapStateToProps, { onChangeWorkspace, clearStats })(
|
||||||
|
@ -114,7 +114,7 @@ class Home extends Component {
|
|||||||
<div className='blocklyWindow'>
|
<div className='blocklyWindow'>
|
||||||
{this.props.project ?
|
{this.props.project ?
|
||||||
< BlocklyWindow blocklyCSS={{ height: '80vH' }} initialXml={this.props.project.xml} />
|
< BlocklyWindow blocklyCSS={{ height: '80vH' }} initialXml={this.props.project.xml} />
|
||||||
: < BlocklyWindow blocklyCSS={{ height: '80vH' }}/>
|
: < BlocklyWindow blocklyCSS={{ height: '80vH' }} />
|
||||||
}
|
}
|
||||||
</div>
|
</div>
|
||||||
</Grid>
|
</Grid>
|
||||||
@ -141,14 +141,12 @@ Home.propTypes = {
|
|||||||
clearStats: PropTypes.func.isRequired,
|
clearStats: PropTypes.func.isRequired,
|
||||||
workspaceName: PropTypes.func.isRequired,
|
workspaceName: PropTypes.func.isRequired,
|
||||||
message: PropTypes.object.isRequired,
|
message: PropTypes.object.isRequired,
|
||||||
statistics: PropTypes.bool.isRequired,
|
statistics: PropTypes.bool.isRequired
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const mapStateToProps = state => ({
|
const mapStateToProps = state => ({
|
||||||
message: state.message,
|
message: state.message,
|
||||||
statistics: state.general.statistics,
|
statistics: state.general.statistics
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user