@node-projects/web-component-designer-codeview-monaco 0.1.25 → 0.1.26
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,7 +125,6 @@ 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 = {
|
|
@@ -245,7 +227,6 @@ export class CodeViewMonaco extends BaseCustomWebComponentLazyAppend {
|
|
|
245
227
|
if (this._monacoEditor)
|
|
246
228
|
this._monacoEditor.setValue(code);
|
|
247
229
|
CodeViewMonaco.monacoLib.editor.setModelLanguage(this._monacoEditor.getModel(), this.language);
|
|
248
|
-
CodeViewMonaco.monacoLib.editor.setTheme(this.theme);
|
|
249
230
|
this._disableSelectionAfterUpd = false;
|
|
250
231
|
}
|
|
251
232
|
}
|
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.26",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/widgets/codeView/code-view-monaco.js",
|
|
7
7
|
"author": "jochen.kuehner@gmx.de",
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
"dependencies": {
|
|
15
15
|
"monaco-editor": ">=0.30.0",
|
|
16
16
|
"@node-projects/base-custom-webcomponent": ">=0.19.0",
|
|
17
|
-
"@node-projects/web-component-designer": ">=0.1.
|
|
17
|
+
"@node-projects/web-component-designer": ">=0.1.137"
|
|
18
18
|
},
|
|
19
19
|
"repository": {
|
|
20
20
|
"type": "git",
|