@node-projects/web-component-designer-codeview-monaco 0.1.27 → 0.1.29
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,13 +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
|
+
if (this._monacoEditor && !this._disableSelection && !this._disableSelectionAfterSel && position) {
|
|
241
|
+
this._disableSelectionAfterSel = true;
|
|
240
242
|
let model = this._monacoEditor.getModel();
|
|
241
243
|
let point1 = model.getPositionAt(position.start);
|
|
242
244
|
let point2 = model.getPositionAt(position.start + position.length);
|
|
243
245
|
setTimeout(() => {
|
|
244
246
|
this._monacoEditor.setSelection({ startLineNumber: point1.lineNumber, startColumn: point1.column, endLineNumber: point2.lineNumber, endColumn: point2.column });
|
|
245
247
|
this._monacoEditor.revealRangeInCenterIfOutsideViewport(new CodeViewMonaco.monacoLib.Range(point1.lineNumber, point1.column, point2.lineNumber, point2.column), 1);
|
|
248
|
+
setTimeout(() => {
|
|
249
|
+
this._disableSelectionAfterSel = false;
|
|
250
|
+
}, 50);
|
|
246
251
|
}, 50);
|
|
247
252
|
}
|
|
248
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.29",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/widgets/codeView/code-view-monaco.js",
|
|
7
7
|
"author": "jochen.kuehner@gmx.de",
|