@node-projects/web-component-designer-codeview-monaco 0.1.3 → 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.
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { BaseCustomWebComponentLazyAppend, css, html, TypedEvent } from '@node-projects/base-custom-webcomponent';
|
|
1
|
+
import { BaseCustomWebComponentLazyAppend, css, cssFromString, html, TypedEvent } from '@node-projects/base-custom-webcomponent';
|
|
2
2
|
import { CommandType } from '@node-projects/web-component-designer';
|
|
3
3
|
export class CodeViewMonaco extends BaseCustomWebComponentLazyAppend {
|
|
4
4
|
static _initalized;
|
|
5
5
|
//@ts-ignore
|
|
6
|
-
static monacoLib
|
|
6
|
+
static monacoLib;
|
|
7
7
|
dispose() {
|
|
8
8
|
this._monacoEditor?.dispose();
|
|
9
9
|
}
|
|
@@ -76,7 +76,7 @@ export class CodeViewMonaco extends BaseCustomWebComponentLazyAppend {
|
|
|
76
76
|
//@ts-ignore
|
|
77
77
|
require(['vs/editor/editor.main'], () => {
|
|
78
78
|
//@ts-ignore
|
|
79
|
-
CodeViewMonaco.monacoLib = monaco;
|
|
79
|
+
CodeViewMonaco.monacoLib = window.monaco;
|
|
80
80
|
resolve();
|
|
81
81
|
});
|
|
82
82
|
});
|
|
@@ -112,8 +112,10 @@ export class CodeViewMonaco extends BaseCustomWebComponentLazyAppend {
|
|
|
112
112
|
this._parseAttributesToProperties();
|
|
113
113
|
//@ts-ignore
|
|
114
114
|
let style = await import("monaco-editor/min/vs/editor/editor.main.css", { assert: { type: 'css' } });
|
|
115
|
-
this.shadowRoot.adoptedStyleSheets = [style
|
|
115
|
+
this.shadowRoot.adoptedStyleSheets = [cssFromString(style), this.constructor.style];
|
|
116
116
|
this._editor = this._getDomElement('container');
|
|
117
|
+
//@ts-ignore
|
|
118
|
+
CodeViewMonaco.monacoLib ??= window.monaco;
|
|
117
119
|
const resizeObserver = new ResizeObserver(() => {
|
|
118
120
|
if (this._editor.offsetWidth > 0) {
|
|
119
121
|
this._monacoEditor = CodeViewMonaco.monacoLib.editor.create(this._editor, {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"description": "web-component-designer addon: Code Editor using Monaco",
|
|
3
3
|
"name": "@node-projects/web-component-designer-codeview-monaco",
|
|
4
|
-
"version": "0.1.
|
|
4
|
+
"version": "0.1.5",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/widgets/codeView/code-view-monaco.js",
|
|
7
7
|
"author": "jochen.kuehner@gmx.de",
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
},
|
|
14
14
|
"dependencies": {
|
|
15
15
|
"monaco-editor": "^0.43.0",
|
|
16
|
-
"@node-projects/base-custom-webcomponent": "^0.
|
|
16
|
+
"@node-projects/base-custom-webcomponent": "^0.18.1",
|
|
17
17
|
"@node-projects/web-component-designer": "^0.1.1"
|
|
18
18
|
},
|
|
19
19
|
"repository": {
|