app/assets/htmls/gs-element-blockly.html in gobstones-blockly-0.16.0 vs app/assets/htmls/gs-element-blockly.html in gobstones-blockly-0.17.0
- old
+ new
@@ -5996,10 +5996,12 @@
*/
_createToolbox: function() {
const primitiveProcedures = this._getPrimitiveNames(this.primitiveProcedures);
const primitiveFunctions = this._getPrimitiveNames(this.primitiveFunctions);
+ this.setDefaultToolbox(this.toolbox && this.toolbox.defaultToolbox);
+
let tree = this._defaultToolboxTree();
let toolbox = [];
if (this.toolbox) {
let visibles = this._homogenizeIDs(this.toolbox.visible);
@@ -6402,12 +6404,17 @@
validToolboxIDs: function() {
return this._validToolboxIDsFrom(this._defaultToolboxTree());
},
setDefaultToolbox: function(xml) {
- this.$$('#toolbox').innerHTML = xml;
+ if (xml && !this._toolboxBackup)
+ this._toolboxBackup = this.$$('#toolbox').innerHTML;
- const toolboxXml = `<xml>${xml}</xml>`;
+ const newXml = xml || this._toolboxBackup;
+ if (!newXml) return;
+
+ this.$$('#toolbox').innerHTML = newXml;
+ const toolboxXml = `<xml>${newXml}</xml>`;
this.workspace.updateToolbox(toolboxXml);
},
/**
* Recursively defined. Gets a list of user-readable objects describing the
\ No newline at end of file