@node-projects/web-component-designer-codeview-monaco 0.1.25 → 0.1.27
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.
|
@@ -3,7 +3,6 @@ import { IActivateable, ICodeView, InstanceServiceContainer, IStringPosition, IU
|
|
|
3
3
|
import type * as monacoType from 'monaco-editor';
|
|
4
4
|
export declare class CodeViewMonaco extends BaseCustomWebComponentLazyAppend implements ICodeView, IActivateable, IUiCommandHandler {
|
|
5
5
|
#private;
|
|
6
|
-
private static _initalized;
|
|
7
6
|
static monacoLib: {
|
|
8
7
|
editor: typeof monacoType.editor;
|
|
9
8
|
Range: typeof monacoType.Range;
|
|
@@ -40,7 +39,6 @@ export declare class CodeViewMonaco extends BaseCustomWebComponentLazyAppend imp
|
|
|
40
39
|
static loadMonacoEditorViaRequire(path?: string): Promise<void>;
|
|
41
40
|
static loadMonacoEditorViaImport(): Promise<void>;
|
|
42
41
|
static setMonacoLibrary(monaco: any): void;
|
|
43
|
-
static initMonacoEditor(monaco: any): void;
|
|
44
42
|
constructor();
|
|
45
43
|
ready(): Promise<void>;
|
|
46
44
|
focusEditor(): void;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
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
|
-
static _initalized;
|
|
5
4
|
static monacoLib;
|
|
6
5
|
dispose() {
|
|
7
6
|
this._monacoEditor?.dispose();
|
|
@@ -11,7 +10,7 @@ export class CodeViewMonaco extends BaseCustomWebComponentLazyAppend {
|
|
|
11
10
|
onTextChanged = new TypedEvent();
|
|
12
11
|
language = 'html';
|
|
13
12
|
singleRow = false;
|
|
14
|
-
_theme = '
|
|
13
|
+
_theme = 'vs';
|
|
15
14
|
get theme() {
|
|
16
15
|
return this._theme;
|
|
17
16
|
}
|
|
@@ -114,22 +113,6 @@ export class CodeViewMonaco extends BaseCustomWebComponentLazyAppend {
|
|
|
114
113
|
static setMonacoLibrary(monaco) {
|
|
115
114
|
CodeViewMonaco.monacoLib = monaco;
|
|
116
115
|
}
|
|
117
|
-
static initMonacoEditor(monaco) {
|
|
118
|
-
if (!CodeViewMonaco._initalized) {
|
|
119
|
-
CodeViewMonaco._initalized = true;
|
|
120
|
-
monaco.editor.defineTheme('webComponentDesignerTheme', {
|
|
121
|
-
base: 'vs',
|
|
122
|
-
inherit: true,
|
|
123
|
-
//@ts-ignore
|
|
124
|
-
rules: [{ background: 'EDF9FA' }],
|
|
125
|
-
colors: {
|
|
126
|
-
'editor.selectionBackground': '#add6ff',
|
|
127
|
-
'editor.inactiveSelectionBackground': '#add6ff'
|
|
128
|
-
}
|
|
129
|
-
});
|
|
130
|
-
}
|
|
131
|
-
monaco.editor.setTheme('webComponentDesignerTheme');
|
|
132
|
-
}
|
|
133
116
|
constructor() {
|
|
134
117
|
super();
|
|
135
118
|
this._restoreCachedInititalValues();
|
|
@@ -142,11 +125,11 @@ export class CodeViewMonaco extends BaseCustomWebComponentLazyAppend {
|
|
|
142
125
|
this._editor = this._getDomElement('container');
|
|
143
126
|
//@ts-ignore
|
|
144
127
|
CodeViewMonaco.monacoLib ??= window.monaco;
|
|
145
|
-
CodeViewMonaco.initMonacoEditor(CodeViewMonaco.monacoLib);
|
|
146
128
|
const resizeObserver = new ResizeObserver(() => {
|
|
147
129
|
if (this._editor.offsetWidth > 0) {
|
|
148
130
|
let options = {
|
|
149
131
|
automaticLayout: true,
|
|
132
|
+
theme: this._theme,
|
|
150
133
|
language: this.language,
|
|
151
134
|
value: this.#code,
|
|
152
135
|
fixedOverflowWidgets: true,
|
|
@@ -244,8 +227,8 @@ export class CodeViewMonaco extends BaseCustomWebComponentLazyAppend {
|
|
|
244
227
|
this._disableSelectionAfterUpd = true;
|
|
245
228
|
if (this._monacoEditor)
|
|
246
229
|
this._monacoEditor.setValue(code);
|
|
230
|
+
CodeViewMonaco.monacoLib.editor.setTheme(this._theme);
|
|
247
231
|
CodeViewMonaco.monacoLib.editor.setModelLanguage(this._monacoEditor.getModel(), this.language);
|
|
248
|
-
CodeViewMonaco.monacoLib.editor.setTheme(this.theme);
|
|
249
232
|
this._disableSelectionAfterUpd = false;
|
|
250
233
|
}
|
|
251
234
|
}
|
package/package.json
CHANGED
|
@@ -1,23 +1,24 @@
|
|
|
1
|
-
{
|
|
2
|
-
"description": "web-component-designer addon: Code Editor using Monaco",
|
|
3
|
-
"name": "@node-projects/web-component-designer-codeview-monaco",
|
|
4
|
-
"version": "0.1.
|
|
5
|
-
"type": "module",
|
|
6
|
-
"main": "./dist/widgets/codeView/code-view-monaco.js",
|
|
7
|
-
"author": "jochen.kuehner@gmx.de",
|
|
8
|
-
"license": "MIT",
|
|
9
|
-
"scripts": {
|
|
10
|
-
"tsc": "tsc",
|
|
11
|
-
"build": "tsc",
|
|
12
|
-
"
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
"
|
|
17
|
-
"@node-projects/
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
"
|
|
22
|
-
|
|
23
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"description": "web-component-designer addon: Code Editor using Monaco",
|
|
3
|
+
"name": "@node-projects/web-component-designer-codeview-monaco",
|
|
4
|
+
"version": "0.1.27",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "./dist/widgets/codeView/code-view-monaco.js",
|
|
7
|
+
"author": "jochen.kuehner@gmx.de",
|
|
8
|
+
"license": "MIT",
|
|
9
|
+
"scripts": {
|
|
10
|
+
"tsc": "tsc",
|
|
11
|
+
"build": "tsc",
|
|
12
|
+
"link": "npm link",
|
|
13
|
+
"prepublishOnly": "npm run build"
|
|
14
|
+
},
|
|
15
|
+
"dependencies": {
|
|
16
|
+
"monaco-editor": ">=0.49.0",
|
|
17
|
+
"@node-projects/base-custom-webcomponent": ">=0.19.0",
|
|
18
|
+
"@node-projects/web-component-designer": ">=0.1.137"
|
|
19
|
+
},
|
|
20
|
+
"repository": {
|
|
21
|
+
"type": "git",
|
|
22
|
+
"url": "git+https://github.com/node-projects/web-component-designer.git"
|
|
23
|
+
}
|
|
24
|
+
}
|