@worktile/theia 21.0.0-next.2 → 21.0.0

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.
@@ -7147,12 +7147,7 @@ class TheCode extends TheBaseElement {
7147
7147
  onContextChange() {
7148
7148
  super.onContextChange();
7149
7149
  if (this.initialized) {
7150
- if (this.isCollapsedAndNonReadonly && !isMobileMode(this.editor)) {
7151
- this.openToolbar();
7152
- }
7153
- else {
7154
- this.closeToolbar();
7155
- }
7150
+ this.useToolbar();
7156
7151
  if (this.options().readonly !== this.readonly) {
7157
7152
  this.useReadonly();
7158
7153
  }
@@ -7197,6 +7192,10 @@ class TheCode extends TheBaseElement {
7197
7192
  }
7198
7193
  });
7199
7194
  });
7195
+ setTimeout(() => {
7196
+ this.useAutofocus();
7197
+ this.useToolbar();
7198
+ }, 0);
7200
7199
  }
7201
7200
  initMaxHeight() {
7202
7201
  this.maxHeight = isPrintMode(this.editor) ? 0 : CODEMIRROR_DEFAULT_MAX_HEIGHT - CODEMIRROR_PADDING_TOP * 2;
@@ -7230,7 +7229,6 @@ class TheCode extends TheBaseElement {
7230
7229
  this.useMode();
7231
7230
  this.useAutoWrap();
7232
7231
  this.useHeight();
7233
- this.useAutofocus();
7234
7232
  }
7235
7233
  codeChange($event) {
7236
7234
  this.isHightLight = false;
@@ -7259,7 +7257,6 @@ class TheCode extends TheBaseElement {
7259
7257
  useAutoWrap() {
7260
7258
  const isPrint = isPrintMode(this.editor);
7261
7259
  const lineWrapping = isPrint ? true : this.element.autoWrap || false;
7262
- console.log('options', { ...this.options(), lineWrapping });
7263
7260
  this.options.set({ ...this.options(), lineWrapping });
7264
7261
  }
7265
7262
  useHeight() {
@@ -7272,10 +7269,18 @@ class TheCode extends TheBaseElement {
7272
7269
  this.options.set({ ...this.options(), readonly: this.readonly, cursorBlinkRate: this.readonly ? -1 : 500 });
7273
7270
  }
7274
7271
  useAutofocus() {
7275
- if (this.isCollapsedAndNonReadonly && Range.isCollapsed(this.editor.selection)) {
7272
+ if (this.isCollapsedAndNonReadonly) {
7276
7273
  this.options.set({ ...this.options(), autofocus: this.readonly ? false : true });
7277
7274
  }
7278
7275
  }
7276
+ useToolbar() {
7277
+ if (this.isCollapsedAndNonReadonly && !isMobileMode(this.editor)) {
7278
+ this.openToolbar();
7279
+ }
7280
+ else {
7281
+ this.closeToolbar();
7282
+ }
7283
+ }
7279
7284
  onResize({ height }) {
7280
7285
  this.resizeHeight = height;
7281
7286
  this.maxHeight = height;