diff --git a/core/utils/toolbox.js b/core/utils/toolbox.js index 51ffdc7eb..40e9fe78b 100644 --- a/core/utils/toolbox.js +++ b/core/utils/toolbox.js @@ -17,12 +17,11 @@ goog.module('Blockly.utils.toolbox'); goog.module.declareLegacyNamespace(); -/** @suppress {extraRequire} */ -goog.require('Blockly.constants'); -goog.require('Blockly.Xml'); +const {IE} = goog.require('Blockly.utils.userAgent'); +const {textToDom} = goog.require('Blockly.Xml'); -goog.requireType('Blockly.ToolboxCategory'); -goog.requireType('Blockly.ToolboxSeparator'); +const {CssConfig: CategoryCssConfig} = goog.requireType('Blockly.ToolboxCategory'); +const {CssConfig: SeparatorCssConfig} = goog.requireType('Blockly.ToolboxSeparator'); /** @@ -43,7 +42,7 @@ let BlockInfo; * kind:string, * id:(string|undefined), * gap:(number|undefined), - * cssconfig:(!Blockly.ToolboxSeparator.CssConfig|undefined) + * cssconfig:(!SeparatorCssConfig|undefined) * }} */ let SeparatorInfo; @@ -84,7 +83,7 @@ let ButtonOrLabelInfo; * id:(string|undefined), * categorystyle:(string|undefined), * colour:(string|undefined), - * cssconfig:(!Blockly.ToolboxCategory.CssConfig|undefined), + * cssconfig:(!CategoryCssConfig|undefined), * hidden:(string|undefined) * }} */ @@ -98,7 +97,7 @@ let StaticCategoryInfo; * id:(string|undefined), * categorystyle:(string|undefined), * colour:(string|undefined), - * cssconfig:(!Blockly.ToolboxCategory.CssConfig|undefined), + * cssconfig:(!CategoryCssConfig|undefined), * hidden:(string|undefined) * }} */ @@ -387,7 +386,7 @@ const addAttributes = function(node, obj) { const parseToolboxTree = function(toolboxDef) { if (toolboxDef) { if (typeof toolboxDef != 'string') { - if (Blockly.utils.userAgent.IE && toolboxDef.outerHTML) { + if (IE && toolboxDef.outerHTML) { // In this case the tree will not have been properly built by the // browser. The HTML will be contained in the element, but it will // not have the proper DOM structure since the browser doesn't support @@ -398,7 +397,7 @@ const parseToolboxTree = function(toolboxDef) { } } if (typeof toolboxDef == 'string') { - toolboxDef = Blockly.Xml.textToDom(toolboxDef); + toolboxDef = textToDom(toolboxDef); if (toolboxDef.nodeName.toLowerCase() != 'xml') { throw TypeError('Toolbox should be an document.'); } diff --git a/tests/deps.js b/tests/deps.js index 0654ec508..81507d9de 100644 --- a/tests/deps.js +++ b/tests/deps.js @@ -187,7 +187,7 @@ goog.addDependency('../../core/utils/string.js', ['Blockly.utils.string'], []); goog.addDependency('../../core/utils/style.js', ['Blockly.utils.style'], ['Blockly.utils.Coordinate', 'Blockly.utils.Size']); goog.addDependency('../../core/utils/svg.js', ['Blockly.utils.Svg'], []); goog.addDependency('../../core/utils/svg_paths.js', ['Blockly.utils.svgPaths'], []); -goog.addDependency('../../core/utils/toolbox.js', ['Blockly.utils.toolbox'], ['Blockly.Xml', 'Blockly.constants'], {'lang': 'es6', 'module': 'goog'}); +goog.addDependency('../../core/utils/toolbox.js', ['Blockly.utils.toolbox'], ['Blockly.Xml', 'Blockly.utils.userAgent'], {'lang': 'es6', 'module': 'goog'}); goog.addDependency('../../core/utils/useragent.js', ['Blockly.utils.userAgent'], ['Blockly.utils.global']); goog.addDependency('../../core/utils/xml.js', ['Blockly.utils.xml'], []); goog.addDependency('../../core/variable_map.js', ['Blockly.VariableMap'], ['Blockly.Events', 'Blockly.Events.VarDelete', 'Blockly.Events.VarRename', 'Blockly.Msg', 'Blockly.utils', 'Blockly.utils.object']);