@node-projects/web-component-designer-codeview-monaco 0.1.14 → 0.1.16

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.
@@ -25,6 +25,7 @@ export declare class CodeViewMonaco extends BaseCustomWebComponentLazyAppend imp
25
25
  private _editor;
26
26
  private _instanceServiceContainer;
27
27
  private _disableSelection;
28
+ private _disableSelectionAfterUpd;
28
29
  static readonly style: CSSStyleSheet;
29
30
  static readonly template: HTMLTemplateElement;
30
31
  executeCommand(command: IUiCommand): void;
@@ -31,6 +31,7 @@ export class CodeViewMonaco extends BaseCustomWebComponentLazyAppend {
31
31
  _editor;
32
32
  _instanceServiceContainer;
33
33
  _disableSelection;
34
+ _disableSelectionAfterUpd;
34
35
  static style = css `
35
36
  :host {
36
37
  display: block;
@@ -154,7 +155,7 @@ export class CodeViewMonaco extends BaseCustomWebComponentLazyAppend {
154
155
  this._monacoEditor.onDidChangeCursorPosition(e => {
155
156
  const offset = this._monacoEditor.getModel().getOffsetAt(e.position);
156
157
  let debounce = false;
157
- if (this._instanceServiceContainer && !debounce) {
158
+ if (this._instanceServiceContainer && !debounce && !this._disableSelectionAfterUpd) {
158
159
  debounce = true;
159
160
  this._disableSelection = true;
160
161
  setTimeout(() => {
@@ -187,10 +188,12 @@ export class CodeViewMonaco extends BaseCustomWebComponentLazyAppend {
187
188
  this.code = code;
188
189
  this._instanceServiceContainer = instanceServiceContainer;
189
190
  if (this._monacoEditor) {
191
+ this._disableSelectionAfterUpd = true;
190
192
  if (this._monacoEditor)
191
193
  this._monacoEditor.setValue(code);
192
194
  CodeViewMonaco.monacoLib.editor.setModelLanguage(this._monacoEditor.getModel(), this.language);
193
195
  CodeViewMonaco.monacoLib.editor.setTheme(this.theme);
196
+ this._disableSelectionAfterUpd = false;
194
197
  }
195
198
  }
196
199
  getText() {
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.14",
4
+ "version": "0.1.16",
5
5
  "type": "module",
6
6
  "main": "./dist/widgets/codeView/code-view-monaco.js",
7
7
  "author": "jochen.kuehner@gmx.de",