fix: html factory grab object children ex. svg

This commit is contained in:
Michal Szczepanski 2023-03-07 01:09:38 +01:00
parent 8fc7738f20
commit 75ad1043d0
2 changed files with 13 additions and 0 deletions

@ -7,6 +7,7 @@
"scripts": {
"dev": "parcel watch src/manifest.json --host localhost --target pinmenote-dev --no-cache",
"dev:ff": "parcel build src/manifest.json --target pinmenote-firefox-dev --no-cache --detailed-report 0",
"build": "npm run prod && npm run prod:ff",
"prod": "parcel build src/manifest.json --target pinmenote-prod --no-cache --detailed-report 0",
"prod:ff": "parcel build src/manifest.json --target pinmenote-firefox-prod --no-cache --detailed-report 0",
"lint": "eslint --ext .ts,.tsx src/",

@ -167,6 +167,18 @@ export class HtmlFactory {
fnConsoleLog('PROBLEM fnComputeHtmlContent !!!', node.nodeType);
}
}
// Fix object element children
if (ref instanceof HTMLObjectElement && ref.contentDocument) {
const children = Array.from(ref.contentDocument.childNodes);
for (const node of children) {
if (node.nodeType === Node.ELEMENT_NODE) {
const computed = await this.computeHtmlIntermediateData(node as Element);
html += computed.html;
}
}
}
html += `</${tagName}>`;
return {