mirror of
https://github.com/scratchfoundation/scratch-vm.git
synced 2024-12-24 23:12:24 -05:00
Fix serialization of blockInfo mutation property to XML
This commit is contained in:
parent
a27ea76d25
commit
297047a6b9
1 changed files with 7 additions and 1 deletions
|
@ -1108,8 +1108,14 @@ class Blocks {
|
||||||
let mutationString = `<${mutation.tagName}`;
|
let mutationString = `<${mutation.tagName}`;
|
||||||
for (const prop in mutation) {
|
for (const prop in mutation) {
|
||||||
if (prop === 'children' || prop === 'tagName') continue;
|
if (prop === 'children' || prop === 'tagName') continue;
|
||||||
const mutationValue = (typeof mutation[prop] === 'string') ?
|
let mutationValue = (typeof mutation[prop] === 'string') ?
|
||||||
xmlEscape(mutation[prop]) : mutation[prop];
|
xmlEscape(mutation[prop]) : mutation[prop];
|
||||||
|
|
||||||
|
// Handle dynamic extension blocks
|
||||||
|
if (prop === 'blockInfo') {
|
||||||
|
mutationValue = xmlEscape(JSON.stringify(mutation[prop]));
|
||||||
|
}
|
||||||
|
|
||||||
mutationString += ` ${prop}="${mutationValue}"`;
|
mutationString += ` ${prop}="${mutationValue}"`;
|
||||||
}
|
}
|
||||||
mutationString += '>';
|
mutationString += '>';
|
||||||
|
|
Loading…
Reference in a new issue