mirror of
https://github.com/google/blockly.git
synced 2026-01-09 10:00:09 +01:00
Merge pull request #322 from rachel-fenichel/bugfix/toolbox_parsing_2
Blockly.parseToolboxTree_ -> Blockly.Options.parseToolboxTree
This commit is contained in:
@@ -45,7 +45,7 @@ Blockly.Options = function(options) {
|
||||
var hasDisable = false;
|
||||
var hasSounds = false;
|
||||
} else {
|
||||
var languageTree = Blockly.Options.parseToolboxTree_(options['toolbox']);
|
||||
var languageTree = Blockly.Options.parseToolboxTree(options['toolbox']);
|
||||
var hasCategories = Boolean(languageTree &&
|
||||
languageTree.getElementsByTagName('category').length);
|
||||
var hasTrashcan = options['trashcan'];
|
||||
@@ -93,7 +93,7 @@ Blockly.Options = function(options) {
|
||||
this.comments = hasComments;
|
||||
this.disable = hasDisable;
|
||||
this.readOnly = readOnly;
|
||||
this.maxBlocks = options['maxBlocks'] || Infinity;
|
||||
this.maxBlocks = options['maxBlocks'] || Infinity;
|
||||
this.pathToMedia = pathToMedia;
|
||||
this.hasCategories = hasCategories;
|
||||
this.hasScrollbars = hasScrollbars;
|
||||
@@ -192,9 +192,8 @@ Blockly.Options.parseGridOptions_ = function(options) {
|
||||
* Parse the provided toolbox tree into a consistent DOM format.
|
||||
* @param {Node|string} tree DOM tree of blocks, or text representation of same.
|
||||
* @return {Node} DOM tree of blocks, or null.
|
||||
* @private
|
||||
*/
|
||||
Blockly.Options.parseToolboxTree_ = function(tree) {
|
||||
Blockly.Options.parseToolboxTree = function(tree) {
|
||||
if (tree) {
|
||||
if (typeof tree != 'string') {
|
||||
if (typeof XSLTProcessor == 'undefined' && tree.outerHTML) {
|
||||
|
||||
@@ -29,6 +29,7 @@ goog.provide('Blockly.WorkspaceSvg');
|
||||
// TODO(scr): Fix circular dependencies
|
||||
// goog.require('Blockly.Block');
|
||||
goog.require('Blockly.ConnectionDB');
|
||||
goog.require('Blockly.Options');
|
||||
goog.require('Blockly.ScrollbarPair');
|
||||
goog.require('Blockly.Trashcan');
|
||||
goog.require('Blockly.Workspace');
|
||||
@@ -937,7 +938,7 @@ Blockly.WorkspaceSvg.prototype.playAudio = function(name, opt_volume) {
|
||||
* @param {Node|string} tree DOM tree of blocks, or text representation of same.
|
||||
*/
|
||||
Blockly.WorkspaceSvg.prototype.updateToolbox = function(tree) {
|
||||
tree = Blockly.parseToolboxTree_(tree);
|
||||
tree = Blockly.Options.parseToolboxTree(tree);
|
||||
if (!tree) {
|
||||
if (this.options.languageTree) {
|
||||
throw 'Can\'t nullify an existing toolbox.';
|
||||
|
||||
Reference in New Issue
Block a user