@node-projects/web-component-designer-htmlparserservice-nodehtmlparser 0.1.8 → 0.1.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -66,8 +66,24 @@ export class NodeHtmlParserService {
66
66
  element.style.pointerEvents = 'auto';
67
67
  element.draggable = false; //even if it should be true, for better designer exp.
68
68
  for (let c of item.childNodes) {
69
- let di = this._createDesignItemsRecursive(c, serviceContainer, instanceServiceContainer, element instanceof SVGElement ? 'http://www.w3.org/2000/svg' : null, snippet, positionOffset);
69
+ let ns = namespace;
70
+ if (element instanceof SVGSVGElement)
71
+ ns = 'http://www.w3.org/2000/svg';
72
+ else if (element instanceof SVGForeignObjectElement)
73
+ ns = null;
74
+ else if (element instanceof MathMLElement)
75
+ ns = 'http://www.w3.org/1998/Math/MathML';
76
+ let di = this._createDesignItemsRecursive(c, serviceContainer, instanceServiceContainer, ns, snippet, positionOffset);
70
77
  designItem._insertChildInternal(di);
78
+ if (di.node instanceof HTMLTemplateElement && di.getAttribute('shadowrootmode') == 'open') {
79
+ try {
80
+ const shadow = designItem.node.attachShadow({ mode: 'open' });
81
+ shadow.appendChild(di.node.content.cloneNode(true));
82
+ }
83
+ catch (err) {
84
+ console.error("error attaching shadowdom", err);
85
+ }
86
+ }
71
87
  }
72
88
  }
73
89
  else if (item.nodeType == 3) {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "description": "web-component-designer addon: Parser Service using the Node HTML Parser",
3
3
  "name": "@node-projects/web-component-designer-htmlparserservice-nodehtmlparser",
4
- "version": "0.1.8",
4
+ "version": "0.1.10",
5
5
  "type": "module",
6
6
  "main": "./dist/service/htmlParserService/NodeHtmlParserService.js",
7
7
  "author": "jochen.kuehner@gmx.de",