Fix serialization of blockInfo mutation property to XML

This commit is contained in:
Karishma Chadha 2019-04-23 11:44:45 -04:00
parent a27ea76d25
commit 297047a6b9

View file

@ -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 += '>';