@node-projects/web-component-designer 0.0.241 → 0.0.242

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.
@@ -30,6 +30,7 @@ export class CodeViewAce extends BaseCustomWebComponentLazyAppend {
30
30
  `;
31
31
  constructor() {
32
32
  super();
33
+ this._restoreCachedInititalValues();
33
34
  this.style.display = 'block';
34
35
  this._editor = document.createElement("div");
35
36
  this._editor.style.height = '100%';
@@ -8,6 +8,7 @@ export declare class CodeViewCodeMirror extends BaseCustomWebComponentLazyAppend
8
8
  elementsToPackages: Map<string, string>;
9
9
  code: string;
10
10
  onTextChanged: TypedEvent<string>;
11
+ mode: string;
11
12
  private _codeMirrorEditor;
12
13
  private _editor;
13
14
  static readonly style: CSSStyleSheet;
@@ -5,6 +5,7 @@ export class CodeViewCodeMirror extends BaseCustomWebComponentLazyAppend {
5
5
  elementsToPackages;
6
6
  code;
7
7
  onTextChanged = new TypedEvent();
8
+ mode = 'xml';
8
9
  _codeMirrorEditor;
9
10
  _editor;
10
11
  static style = css `
@@ -19,13 +20,20 @@ export class CodeViewCodeMirror extends BaseCustomWebComponentLazyAppend {
19
20
  </div>`;
20
21
  constructor() {
21
22
  super();
23
+ this._restoreCachedInititalValues();
22
24
  //@ts-ignore
23
- if (window.importShim)
25
+ if (window.importShim) {
24
26
  //@ts-ignore
25
- importShim("codemirror/lib/codemirror.css", { assert: { type: 'css' } }).then(x => this.shadowRoot.adoptedStyleSheets = [x.default, this.constructor.style]);
26
- else
27
+ importShim("codemirror/lib/codemirror.css", { assert: { type: 'css' } }).then(x => this.shadowRoot.adoptedStyleSheets = [x.default, ...this.shadowRoot.adoptedStyleSheets]);
27
28
  //@ts-ignore
28
- import("codemirror/lib/codemirror.css", { assert: { type: 'css' } }).then(x => this.shadowRoot.adoptedStyleSheets = [x.default, this.constructor.style]);
29
+ importShim("codemirror/addon/fold/foldgutter.css", { assert: { type: 'css' } }).then(x => this.shadowRoot.adoptedStyleSheets = [x.default, ...this.shadowRoot.adoptedStyleSheets]);
30
+ }
31
+ else {
32
+ //@ts-ignore
33
+ import("codemirror/lib/codemirror.css", { assert: { type: 'css' } }).then(x => this.shadowRoot.adoptedStyleSheets = [x.default, ...this.shadowRoot.adoptedStyleSheets]);
34
+ //@ts-ignore
35
+ import("codemirror/addon/fold/foldgutter.css", { assert: { type: 'css' } }).then(x => this.shadowRoot.adoptedStyleSheets = [x.default, ...this.shadowRoot.adoptedStyleSheets]);
36
+ }
29
37
  this.style.display = 'block';
30
38
  this._editor = this._getDomElement('textarea');
31
39
  }
@@ -80,9 +88,14 @@ export class CodeViewCodeMirror extends BaseCustomWebComponentLazyAppend {
80
88
  const config = {
81
89
  tabSize: 3,
82
90
  lineNumbers: true,
83
- mode: 'xml',
91
+ mode: this.mode,
92
+ //@ts-ignore
93
+ htmlMode: true,
94
+ lineWrapping: true,
84
95
  //@ts-ignore
85
- htmlMode: true
96
+ extraKeys: { "Ctrl-Q": function (cm) { cm.foldCode(cm.getCursor()); } },
97
+ foldGutter: true,
98
+ gutters: ["CodeMirror-linenumbers", "CodeMirror-foldgutter"]
86
99
  };
87
100
  //@ts-ignore
88
101
  this._codeMirrorEditor = CodeMirror(this._editor, config);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "description": "A UI designer for Polymer apps",
3
3
  "name": "@node-projects/web-component-designer",
4
- "version": "0.0.241",
4
+ "version": "0.0.242",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
7
7
  "author": "",