mirror of
https://github.com/google/blockly.git
synced 2026-01-10 18:37:09 +01:00
Fixing no-category toolboxes so they populate immediately, rather (#1255)
than on a timeout.
This commit is contained in:
@@ -90,24 +90,20 @@ blocklyApp.ToolboxModalService = ng.core.Class({
|
||||
);
|
||||
this.computeCategoriesForCreateNewGroupModal_();
|
||||
} else {
|
||||
// A timeout seems to be needed in order for the .children accessor to
|
||||
// work correctly.
|
||||
var that = this;
|
||||
setTimeout(function() {
|
||||
// If there are no top-level categories, we create a single category
|
||||
// containing all the top-level blocks.
|
||||
var tmpWorkspace = new Blockly.Workspace();
|
||||
Array.from(toolboxXmlElt.children).forEach(function(topLevelNode) {
|
||||
Blockly.Xml.domToBlock(tmpWorkspace, topLevelNode);
|
||||
});
|
||||
|
||||
that.allToolboxCategories = [{
|
||||
categoryName: '',
|
||||
blocks: tmpWorkspace.topBlocks_
|
||||
}];
|
||||
|
||||
that.computeCategoriesForCreateNewGroupModal_();
|
||||
// If there are no top-level categories, we create a single category
|
||||
// containing all the top-level blocks.
|
||||
var tmpWorkspace = new Blockly.Workspace();
|
||||
Array.from(toolboxXmlElt.children).forEach(function(topLevelNode) {
|
||||
Blockly.Xml.domToBlock(tmpWorkspace, topLevelNode);
|
||||
});
|
||||
|
||||
that.allToolboxCategories = [{
|
||||
categoryName: '',
|
||||
blocks: tmpWorkspace.topBlocks_
|
||||
}];
|
||||
|
||||
that.computeCategoriesForCreateNewGroupModal_();
|
||||
}
|
||||
},
|
||||
computeCategoriesForCreateNewGroupModal_: function() {
|
||||
|
||||
Reference in New Issue
Block a user