@node-projects/web-component-designer-codeview-monaco 0.1.19 → 0.1.22
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.
|
@@ -11,13 +11,14 @@ export declare class CodeViewMonaco extends BaseCustomWebComponentLazyAppend imp
|
|
|
11
11
|
dispose(): void;
|
|
12
12
|
canvasElement: HTMLElement;
|
|
13
13
|
elementsToPackages: Map<string, string>;
|
|
14
|
-
code: string;
|
|
15
14
|
onTextChanged: TypedEvent<string>;
|
|
16
15
|
language: string;
|
|
17
16
|
singleRow: boolean;
|
|
18
17
|
private _theme;
|
|
19
18
|
get theme(): string;
|
|
20
19
|
set theme(value: string);
|
|
20
|
+
get code(): string;
|
|
21
|
+
set code(v: string);
|
|
21
22
|
get readOnly(): boolean;
|
|
22
23
|
set readOnly(v: boolean);
|
|
23
24
|
static readonly properties: {
|
|
@@ -8,7 +8,6 @@ export class CodeViewMonaco extends BaseCustomWebComponentLazyAppend {
|
|
|
8
8
|
}
|
|
9
9
|
canvasElement;
|
|
10
10
|
elementsToPackages;
|
|
11
|
-
code;
|
|
12
11
|
onTextChanged = new TypedEvent();
|
|
13
12
|
language = 'html';
|
|
14
13
|
singleRow = false;
|
|
@@ -22,6 +21,17 @@ export class CodeViewMonaco extends BaseCustomWebComponentLazyAppend {
|
|
|
22
21
|
CodeViewMonaco.monacoLib ??= window.monaco;
|
|
23
22
|
CodeViewMonaco.monacoLib.editor.setTheme(value);
|
|
24
23
|
}
|
|
24
|
+
#code = null;
|
|
25
|
+
get code() {
|
|
26
|
+
if (this._monacoEditor)
|
|
27
|
+
return this._monacoEditor.getModel().getValue();
|
|
28
|
+
return null;
|
|
29
|
+
}
|
|
30
|
+
set code(v) {
|
|
31
|
+
this.#code = v;
|
|
32
|
+
if (this._monacoEditor)
|
|
33
|
+
this._monacoEditor.getModel().setValue(v);
|
|
34
|
+
}
|
|
25
35
|
#readOnly = false;
|
|
26
36
|
get readOnly() {
|
|
27
37
|
return this.#readOnly;
|
|
@@ -138,19 +148,12 @@ export class CodeViewMonaco extends BaseCustomWebComponentLazyAppend {
|
|
|
138
148
|
let options = {
|
|
139
149
|
automaticLayout: true,
|
|
140
150
|
language: this.language,
|
|
141
|
-
value: this
|
|
151
|
+
value: this.#code,
|
|
142
152
|
fixedOverflowWidgets: true,
|
|
143
153
|
minimap: {
|
|
144
154
|
size: 'fill'
|
|
145
155
|
},
|
|
146
|
-
readOnly: this.#readOnly
|
|
147
|
-
scrollbar: {
|
|
148
|
-
useShadows: false,
|
|
149
|
-
verticalHasArrows: true,
|
|
150
|
-
horizontalHasArrows: true,
|
|
151
|
-
vertical: 'visible',
|
|
152
|
-
horizontal: 'visible'
|
|
153
|
-
}
|
|
156
|
+
readOnly: this.#readOnly
|
|
154
157
|
};
|
|
155
158
|
if (this.singleRow) {
|
|
156
159
|
options.minimap.enabled = false;
|
|
@@ -160,6 +163,14 @@ export class CodeViewMonaco extends BaseCustomWebComponentLazyAppend {
|
|
|
160
163
|
options.lineDecorationsWidth = 0;
|
|
161
164
|
options.lineNumbersMinChars = 0;
|
|
162
165
|
}
|
|
166
|
+
else {
|
|
167
|
+
options.scrollbar = {};
|
|
168
|
+
options.scrollbar.useShadows = false;
|
|
169
|
+
options.scrollbar.verticalHasArrows = true;
|
|
170
|
+
options.scrollbar.horizontalHasArrows = true;
|
|
171
|
+
options.scrollbar.vertical = 'visible';
|
|
172
|
+
options.scrollbar.horizontal = 'visible';
|
|
173
|
+
}
|
|
163
174
|
this._monacoEditor = CodeViewMonaco.monacoLib.editor.create(this._editor, options);
|
|
164
175
|
let selectionTimeout;
|
|
165
176
|
let disableCursorChange;
|
|
@@ -221,7 +232,7 @@ export class CodeViewMonaco extends BaseCustomWebComponentLazyAppend {
|
|
|
221
232
|
this._monacoEditor.layout();
|
|
222
233
|
}
|
|
223
234
|
update(code, instanceServiceContainer) {
|
|
224
|
-
this
|
|
235
|
+
this.#code = code;
|
|
225
236
|
this._instanceServiceContainer = instanceServiceContainer;
|
|
226
237
|
if (this._monacoEditor) {
|
|
227
238
|
this._disableSelectionAfterUpd = true;
|
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.22",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/widgets/codeView/code-view-monaco.js",
|
|
7
7
|
"author": "jochen.kuehner@gmx.de",
|