@node-projects/web-component-designer-codeview-monaco 0.1.23 → 0.1.24
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.
|
@@ -178,6 +178,7 @@ export class CodeViewMonaco extends BaseCustomWebComponentLazyAppend {
|
|
|
178
178
|
if (selectionTimeout) {
|
|
179
179
|
clearTimeout(selectionTimeout);
|
|
180
180
|
selectionTimeout = null;
|
|
181
|
+
this._disableSelection = false;
|
|
181
182
|
}
|
|
182
183
|
disableCursorChange = true;
|
|
183
184
|
setTimeout(() => {
|
|
@@ -192,6 +193,7 @@ export class CodeViewMonaco extends BaseCustomWebComponentLazyAppend {
|
|
|
192
193
|
if (selectionTimeout) {
|
|
193
194
|
clearTimeout(selectionTimeout);
|
|
194
195
|
selectionTimeout = null;
|
|
196
|
+
this._disableSelection = false;
|
|
195
197
|
}
|
|
196
198
|
disableCursorChange = true;
|
|
197
199
|
setTimeout(() => {
|
|
@@ -202,14 +204,16 @@ export class CodeViewMonaco extends BaseCustomWebComponentLazyAppend {
|
|
|
202
204
|
});
|
|
203
205
|
});
|
|
204
206
|
this._monacoEditor.onDidChangeCursorPosition(e => {
|
|
205
|
-
const
|
|
207
|
+
const sel = this._monacoEditor.getSelection();
|
|
208
|
+
const offsetStart = this._monacoEditor.getModel().getOffsetAt(sel.getStartPosition());
|
|
209
|
+
const offsetEnd = this._monacoEditor.getModel().getOffsetAt(sel.getEndPosition());
|
|
206
210
|
if (this._instanceServiceContainer && !this._disableSelectionAfterUpd && !disableCursorChange) {
|
|
207
211
|
this._disableSelection = true;
|
|
208
212
|
if (selectionTimeout)
|
|
209
213
|
clearTimeout(selectionTimeout);
|
|
210
214
|
selectionTimeout = setTimeout(() => {
|
|
211
215
|
selectionTimeout = null;
|
|
212
|
-
this._instanceServiceContainer.selectionService.setSelectionByTextRange(
|
|
216
|
+
this._instanceServiceContainer.selectionService.setSelectionByTextRange(offsetStart, offsetEnd);
|
|
213
217
|
this._disableSelection = false;
|
|
214
218
|
}, 50);
|
|
215
219
|
}
|
|
@@ -249,7 +253,7 @@ export class CodeViewMonaco extends BaseCustomWebComponentLazyAppend {
|
|
|
249
253
|
return this._monacoEditor.getValue();
|
|
250
254
|
}
|
|
251
255
|
setSelection(position) {
|
|
252
|
-
if (this._monacoEditor && !this._disableSelection) {
|
|
256
|
+
if (this._monacoEditor && !this._disableSelection && position) {
|
|
253
257
|
let model = this._monacoEditor.getModel();
|
|
254
258
|
let point1 = model.getPositionAt(position.start);
|
|
255
259
|
let point2 = model.getPositionAt(position.start + position.length);
|
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.24",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/widgets/codeView/code-view-monaco.js",
|
|
7
7
|
"author": "jochen.kuehner@gmx.de",
|