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.
This commit is contained in:
Christopher Allen
2022-05-13 15:00:52 +01:00
committed by GitHub
parent 3e19aded39
commit debdcb9907

View File

@@ -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<string>} An array containing new block IDs.
* @alias Blockly.Xml.appendDomToWorkspace
*/