mirror of
https://github.com/google/blockly.git
synced 2026-01-08 09:30:06 +01:00
Allow flights to be initially expanded in toolbox.
This commit is contained in:
@@ -184,36 +184,5 @@ Blockly.Workspace.prototype.fireChangeEvent = function() {
|
||||
// NOP.
|
||||
};
|
||||
|
||||
/**
|
||||
* Modify the block tree on the existing toolbox.
|
||||
* @param {Node|string} tree DOM tree of blocks, or text representation of same.
|
||||
*/
|
||||
Blockly.Workspace.prototype.updateToolbox = function(tree) {
|
||||
tree = Blockly.parseToolboxTree_(tree);
|
||||
if (!tree) {
|
||||
if (this.options.languageTree) {
|
||||
throw 'Can\'t nullify an existing toolbox.';
|
||||
}
|
||||
// No change (null to null).
|
||||
return;
|
||||
}
|
||||
if (!this.options.languageTree) {
|
||||
throw 'Existing toolbox is null. Can\'t create new toolbox.';
|
||||
}
|
||||
if (this.options.hasCategories) {
|
||||
if (!this.toolbox_) {
|
||||
throw 'Existing toolbox has no categories. Can\'t change mode.';
|
||||
}
|
||||
this.options.languageTree = tree;
|
||||
this.toolbox_.populate_(tree);
|
||||
} else {
|
||||
if (!this.flyout_) {
|
||||
throw 'Existing toolbox has categories. Can\'t change mode.';
|
||||
}
|
||||
this.options.languageTree = tree;
|
||||
this.flyout_.show(tree.childNodes);
|
||||
}
|
||||
};
|
||||
|
||||
// Export symbols that would otherwise be renamed by Closure compiler.
|
||||
Blockly.Workspace.prototype['clear'] = Blockly.Workspace.prototype.clear;
|
||||
|
||||
Reference in New Issue
Block a user