mirror of
https://github.com/google/blockly.git
synced 2026-01-09 18:10:08 +01:00
Call initsvg after loading field. (#4296)
This commit is contained in:
@@ -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');
|
||||
|
||||
Reference in New Issue
Block a user