@node-projects/web-component-designer-htmlparserservice-base-custom-webcomponent 0.1.4 → 0.1.5

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.
@@ -13,17 +13,23 @@ export class BaseCustomWebcomponentParserService {
13
13
  const sourceFile = this.parseTypescriptFile(code);
14
14
  let htmlCode = "";
15
15
  let cssStyle = "";
16
+ let positionOffset = 0;
17
+ //let cssOffset = 0;
16
18
  //@ts-ignore
17
19
  const nodes = findAllNodesOfKind(sourceFile, ts.SyntaxKind.TaggedTemplateExpression);
18
20
  for (let nd of nodes) {
19
- if (nd.tag.escapedText == 'html' && nd.parent.name.escapedText == "template")
21
+ if (nd.tag.escapedText == 'html' && nd.parent.name.escapedText == "template") {
22
+ positionOffset = nd.pos;
20
23
  htmlCode = nd.template.rawText;
21
- if (nd.tag.escapedText == 'css' && nd.parent.name.escapedText == "style")
24
+ }
25
+ if (nd.tag.escapedText == 'css' && nd.parent.name.escapedText == "style") {
26
+ //cssOffset = nd.pos;
22
27
  cssStyle = nd.template.rawText;
28
+ }
23
29
  }
24
30
  if (cssStyle)
25
31
  instanceServiceContainer.stylesheetService.setStylesheets([{ name: 'css', content: cssStyle }]);
26
- return this.htmlParser.parse(htmlCode, serviceContainer, instanceServiceContainer, parseSnippet);
32
+ return this.htmlParser.parse(htmlCode, serviceContainer, instanceServiceContainer, parseSnippet, positionOffset);
27
33
  }
28
34
  writeBack(code, html, css, newLineCrLf) {
29
35
  const sourceFile = this.parseTypescriptFile(code);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "description": "web-component-designer addon: Parser Service for Templates inside of BaseCustomWebcomponent",
3
3
  "name": "@node-projects/web-component-designer-htmlparserservice-base-custom-webcomponent",
4
- "version": "0.1.4",
4
+ "version": "0.1.5",
5
5
  "type": "module",
6
6
  "main": "./dist/service/htmlParserService/BaseCustomWebcomponentParserService.js",
7
7
  "author": "jochen.kuehner@gmx.de",