@node-projects/web-component-designer-codeview-monaco 0.1.28 → 0.1.30
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.
|
@@ -7,6 +7,7 @@ export declare class CodeViewMonaco extends BaseCustomWebComponentLazyAppend imp
|
|
|
7
7
|
editor: typeof monacoType.editor;
|
|
8
8
|
Range: typeof monacoType.Range;
|
|
9
9
|
};
|
|
10
|
+
private _disableSelectionAfterSel;
|
|
10
11
|
dispose(): void;
|
|
11
12
|
canvasElement: HTMLElement;
|
|
12
13
|
elementsToPackages: Map<string, string>;
|
|
@@ -2,6 +2,7 @@ import { BaseCustomWebComponentLazyAppend, css, cssFromString, html, TypedEvent
|
|
|
2
2
|
import { CommandType } from '@node-projects/web-component-designer';
|
|
3
3
|
export class CodeViewMonaco extends BaseCustomWebComponentLazyAppend {
|
|
4
4
|
static monacoLib;
|
|
5
|
+
_disableSelectionAfterSel;
|
|
5
6
|
dispose() {
|
|
6
7
|
this._monacoEditor?.dispose();
|
|
7
8
|
}
|
|
@@ -190,7 +191,7 @@ export class CodeViewMonaco extends BaseCustomWebComponentLazyAppend {
|
|
|
190
191
|
const sel = this._monacoEditor.getSelection();
|
|
191
192
|
const offsetStart = this._monacoEditor.getModel().getOffsetAt(sel.getStartPosition());
|
|
192
193
|
const offsetEnd = this._monacoEditor.getModel().getOffsetAt(sel.getEndPosition());
|
|
193
|
-
if (this._instanceServiceContainer && !this._disableSelectionAfterUpd && !disableCursorChange) {
|
|
194
|
+
if (this._instanceServiceContainer && !this._disableSelectionAfterUpd && !this._disableSelectionAfterSel && !disableCursorChange) {
|
|
194
195
|
this._disableSelection = true;
|
|
195
196
|
if (selectionTimeout)
|
|
196
197
|
clearTimeout(selectionTimeout);
|
|
@@ -236,15 +237,17 @@ export class CodeViewMonaco extends BaseCustomWebComponentLazyAppend {
|
|
|
236
237
|
return this._monacoEditor.getValue();
|
|
237
238
|
}
|
|
238
239
|
setSelection(position) {
|
|
239
|
-
if (this._monacoEditor && !this._disableSelection && position) {
|
|
240
|
-
this.
|
|
240
|
+
if (this._monacoEditor && !this._disableSelection && !this._disableSelectionAfterSel && position) {
|
|
241
|
+
this._disableSelectionAfterSel = true;
|
|
241
242
|
let model = this._monacoEditor.getModel();
|
|
242
243
|
let point1 = model.getPositionAt(position.start);
|
|
243
244
|
let point2 = model.getPositionAt(position.start + position.length);
|
|
244
245
|
setTimeout(() => {
|
|
245
246
|
this._monacoEditor.setSelection({ startLineNumber: point1.lineNumber, startColumn: point1.column, endLineNumber: point2.lineNumber, endColumn: point2.column });
|
|
246
247
|
this._monacoEditor.revealRangeInCenterIfOutsideViewport(new CodeViewMonaco.monacoLib.Range(point1.lineNumber, point1.column, point2.lineNumber, point2.column), 1);
|
|
247
|
-
|
|
248
|
+
setTimeout(() => {
|
|
249
|
+
this._disableSelectionAfterSel = false;
|
|
250
|
+
}, 50);
|
|
248
251
|
}, 50);
|
|
249
252
|
}
|
|
250
253
|
}
|
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.30",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/widgets/codeView/code-view-monaco.js",
|
|
7
7
|
"author": "jochen.kuehner@gmx.de",
|