Call initsvg after loading field. (#4296)

This commit is contained in:
Monica Kozbial
2020-09-21 10:06:43 -07:00
committed by GitHub
parent 96e8fc794e
commit c6bea7c51b

View File

@@ -651,6 +651,7 @@ Blockly.Xml.domToBlockHeadless_ = function(xmlBlock, workspace) {
}
}
var callInitSvg = false;
var name = xmlChild.getAttribute('name');
var xmlChildElement = /** @type {!Element} */ (xmlChild);
switch (xmlChild.nodeName.toLowerCase()) {
@@ -660,7 +661,7 @@ Blockly.Xml.domToBlockHeadless_ = function(xmlBlock, workspace) {
block.domToMutation(xmlChildElement);
if (block.initSvg) {
// Mutation may have added some elements that need initializing.
block.initSvg();
callInitSvg = true;
}
}
break;
@@ -748,6 +749,11 @@ Blockly.Xml.domToBlockHeadless_ = function(xmlBlock, workspace) {
}
}
if (callInitSvg) {
// InitSvg needs to be called after variable fields are loaded.
block.initSvg();
}
var inline = xmlBlock.getAttribute('inline');
if (inline) {
block.setInputsInline(inline == 'true');