forked from marva/sumorobot-web
fix resuming blocks and code
This commit is contained in:
parent
9dc0f1f989
commit
44da136962
@ -186,6 +186,15 @@ window.addEventListener('load', function() {
|
|||||||
var xml = Blockly.Xml.textToDom(getLocalStorageItem('sumorobot.blockly'));
|
var xml = Blockly.Xml.textToDom(getLocalStorageItem('sumorobot.blockly'));
|
||||||
// Resume the blocks
|
// Resume the blocks
|
||||||
Blockly.Xml.domToWorkspace(xml, workspace);
|
Blockly.Xml.domToWorkspace(xml, workspace);
|
||||||
|
// For the code processor
|
||||||
|
sumorobot.setBlocklyCode(Blockly.Python.workspaceToCode(workspace));
|
||||||
|
// Show the code in the ace editor, filter out block IDs
|
||||||
|
readOnlyCodingEditor.setValue('\n' + sumorobot.getBlocklyCode().replace(/;;.{20}/g, ''));
|
||||||
|
readOnlyCodingEditor.clearSelection();
|
||||||
|
// Disable the if condition block in the toolbox if it's already used
|
||||||
|
if (/if/.test(sumorobot.getBlocklyCode())) {
|
||||||
|
workspace.updateToolbox(document.getElementById('toolbox_no_if'));
|
||||||
|
}
|
||||||
|
|
||||||
// On Blockly code change
|
// On Blockly code change
|
||||||
function onCodeChanged(event) {
|
function onCodeChanged(event) {
|
||||||
|
Loading…
Reference in New Issue
Block a user