From debdcb9907700471b4f605bd233a374cc4e6de8a Mon Sep 17 00:00:00 2001 From: Christopher Allen Date: Fri, 13 May 2022 15:00:52 +0100 Subject: [PATCH] fix!(xml): Make appendDomToWorkspace take only WorkspaceSvg (#6162) Turns out if one runs tsc on files in core/, the output will cause Closure Compiler to detect type errors that were not detected previously, despite apparently only whitespace changes between tsc's input and output. In this case, it detects that you can't call .getBlocksBoundingBox on a Workspace object. appendDomToWorkspace rearranges blocks on the workspace and is only relevant to rendered workspaces. If you use this function in headless mode, switch to using domToWorkspace instead. BREAKING CHANGE: have appendDomToWorkspace take a WorkspaceSvg instead of a Workspace as its second parameter. --- core/xml.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/xml.js b/core/xml.js index cd5b9ebb9..7d85cca86 100644 --- a/core/xml.js +++ b/core/xml.js @@ -529,7 +529,7 @@ exports.domToWorkspace = domToWorkspace; * Decode an XML DOM and create blocks on the workspace. Position the new * blocks immediately below prior blocks, aligned by their starting edge. * @param {!Element} xml The XML DOM. - * @param {!Workspace} workspace The workspace to add to. + * @param {!WorkspaceSvg} workspace The workspace to add to. * @return {!Array} An array containing new block IDs. * @alias Blockly.Xml.appendDomToWorkspace */