forked from marva/sumorobot-web
update blockly
This commit is contained in:
@@ -183,10 +183,14 @@ window.addEventListener('load', function() {
|
||||
Blockly.svgResize(workspace);
|
||||
|
||||
// Retrieve the blocks
|
||||
var xml = Blockly.Xml.textToDom(getLocalStorageItem('sumorobot.blockly'));
|
||||
// Resume the blocks
|
||||
Blockly.Xml.domToWorkspace(xml, workspace);
|
||||
|
||||
var code = getLocalStorageItem('sumorobot.blockly');
|
||||
// When there is code
|
||||
if (code) {
|
||||
// Convert it to XML
|
||||
var xml = Blockly.Xml.textToDom(code);
|
||||
// Resume the blocks from the XML
|
||||
Blockly.Xml.domToWorkspace(xml, workspace);
|
||||
}
|
||||
// On Blockly code change
|
||||
function onCodeChanged(event) {
|
||||
// When the if condition block was created
|
||||
@@ -229,13 +233,13 @@ window.addEventListener('load', function() {
|
||||
}
|
||||
}
|
||||
|
||||
// Add a change listener to Blockly
|
||||
// Add the change listener to Blockly
|
||||
workspace.addChangeListener(onCodeChanged);
|
||||
|
||||
// Set a click listener on the document
|
||||
$(document).click(function(e) {
|
||||
// Get the event target
|
||||
var target = e.target;
|
||||
|
||||
// When control_if block is in use
|
||||
if (controlBlockId != '') {
|
||||
// When the user clicks anywhere outside the mutator and not on the mutator icon
|
||||
|
Reference in New Issue
Block a user