@worktile/theia 20.2.11 → 20.2.13

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.
@@ -10,7 +10,7 @@ import { cloneDeep, map, every, assign, defaults, groupBy, uniq, isEqual } from
10
10
  export { assign, cloneDeep, debounce, defaults, groupBy, isEqual, map, uniq } from 'lodash';
11
11
  import { Editor, Element, Span, Range, Path, Node, Point, Text, Transforms, Operation, createEditor } from 'slate';
12
12
  import * as i4 from 'slate-angular';
13
- import { FAKE_LEFT_BLOCK_CARD_OFFSET, FAKE_RIGHT_BLOCK_CARD_OFFSET, getClipboardData, AngularEditor, hotkeys, getPlainText as getPlainText$1, createClipboardData, setClipboardData, BaseElementComponent, IS_SAFARI, ELEMENT_TO_COMPONENT, SlateModule, getBlockCardByNativeElement, SLATE_BLOCK_CARD_CLASS_NAME, EDITOR_TO_VIRTUAL_SCROLL_SELECTION, BaseElementFlavour, hasBlockCard, isCardLeft, ELEMENT_KEY_TO_HEIGHTS, getCachedHeightByElement, isDebug, debugLog, DEFAULT_ELEMENT_HEIGHT, DefaultTextFlavour, defaultScrollSelectionIntoView, getDataTransferClipboard, SLATE_DEBUG_KEY, withAngular } from 'slate-angular';
13
+ import { FAKE_LEFT_BLOCK_CARD_OFFSET, FAKE_RIGHT_BLOCK_CARD_OFFSET, getClipboardData, AngularEditor, hotkeys, getPlainText as getPlainText$1, createClipboardData, setClipboardData, BaseElementComponent, IS_SAFARI, ELEMENT_TO_COMPONENT, SlateModule, getBlockCardByNativeElement, SLATE_BLOCK_CARD_CLASS_NAME, EDITOR_TO_VIRTUAL_SCROLL_SELECTION, BaseElementFlavour, hasBlockCard, isCardLeft, getCachedHeightByElement, isDebug, debugLog, cacheHeightByElement, DEFAULT_ELEMENT_HEIGHT, DefaultTextFlavour, defaultScrollSelectionIntoView, getDataTransferClipboard, SLATE_DEBUG_KEY, withAngular } from 'slate-angular';
14
14
  import { HistoryEditor, withHistory } from 'slate-history';
15
15
  import { NODE_TO_PARENT, NODE_TO_INDEX, NODE_TO_ELEMENT, DOMEditor, EDITOR_TO_ELEMENT } from 'slate-dom';
16
16
  import { TheiaConverter } from '@atinc/selene';
@@ -7229,9 +7229,7 @@ class TheCode extends TheBaseElement {
7229
7229
  this.useMode();
7230
7230
  this.useAutoWrap();
7231
7231
  this.useHeight();
7232
- if (this.isCollapsedAndNonReadonly) {
7233
- this.useAutofocus();
7234
- }
7232
+ this.useAutofocus();
7235
7233
  }
7236
7234
  codeChange($event) {
7237
7235
  this.isHightLight = false;
@@ -7272,7 +7270,9 @@ class TheCode extends TheBaseElement {
7272
7270
  this.options = { ...this.options, readonly: this.readonly, cursorBlinkRate: this.readonly ? -1 : 500 };
7273
7271
  }
7274
7272
  useAutofocus() {
7275
- this.options = { ...this.options, autofocus: this.readonly ? false : true };
7273
+ if (this.isCollapsedAndNonReadonly && Range.isCollapsed(this.editor.selection)) {
7274
+ this.options = { ...this.options, autofocus: this.readonly ? false : true };
7275
+ }
7276
7276
  }
7277
7277
  onResize({ height }) {
7278
7278
  this.resizeHeight = height;
@@ -14431,14 +14431,6 @@ class TheImage extends TheBaseElement {
14431
14431
  }
14432
14432
  super.ngOnDestroy();
14433
14433
  }
14434
- cacheImageHeight(height) {
14435
- if (!AngularEditor.isEnabledVirtualScroll(this.editor)) {
14436
- return;
14437
- }
14438
- const heights = ELEMENT_KEY_TO_HEIGHTS.get(this.editor);
14439
- const key = AngularEditor.findKey(this.editor, this.element);
14440
- heights.set(key.id, height);
14441
- }
14442
14434
  setImageMinHeight() {
14443
14435
  if (!AngularEditor.isEnabledVirtualScroll(this.editor)) {
14444
14436
  return;
@@ -14449,9 +14441,6 @@ class TheImage extends TheBaseElement {
14449
14441
  if (blockCard) {
14450
14442
  const minHeight = realHeight - ROOT_ELEMENT_MARGIN_BOTTOM;
14451
14443
  blockCard.style.minHeight = minHeight + 'px';
14452
- // if (isDebug) {
14453
- // debugLog('warn', 'setImageMinHeight in blockCard, realHeight(cache): ', realHeight, this.element.key, 'minHeight: ', minHeight);
14454
- // }
14455
14444
  }
14456
14445
  else {
14457
14446
  if (isDebug) {
@@ -14461,7 +14450,7 @@ class TheImage extends TheBaseElement {
14461
14450
  }
14462
14451
  else {
14463
14452
  if (isDebug) {
14464
- debugLog('warn', 'image render and can not find cache height', this.element.key, this.editor.children.indexOf(this.element));
14453
+ debugLog('warn', 'image render and no cache height', this.element.key, 'index: ', this.editor.children.indexOf(this.element));
14465
14454
  }
14466
14455
  }
14467
14456
  }
@@ -14630,7 +14619,6 @@ class TheImage extends TheBaseElement {
14630
14619
  width: this.imageEntry.width,
14631
14620
  height: this.imageEntry.height
14632
14621
  }, { at: this.selection });
14633
- this.cacheImageHeight(this.calcHeight());
14634
14622
  }
14635
14623
  }
14636
14624
  cancelUpload() {
@@ -14719,26 +14707,10 @@ class TheImage extends TheBaseElement {
14719
14707
  this.naturalWidth = img.naturalWidth;
14720
14708
  this.naturalHeight = img.naturalHeight;
14721
14709
  if (AngularEditor.isEnabledVirtualScroll(this.editor)) {
14722
- // if (isDebug) {
14723
- // const realHeight = this.getRealHeight();
14724
- // debugLog('warn', 'imageLoaded, realHeight: ', realHeight, this.element.key, this.editor.children.indexOf(this.element));
14725
- // }
14726
14710
  this.imageLoadedCacheHeightTimer = setTimeout(() => {
14727
- // if (isDebug) {
14728
- // const realHeight = this.getRealHeight();
14729
- // debugLog(
14730
- // 'warn',
14731
- // 'imageLoaded, realHeight setTimeout period: ',
14732
- // realHeight,
14733
- // this.element.key,
14734
- // 'index: ',
14735
- // this.editor.children.indexOf(this.element)
14736
- // );
14737
- // }
14738
14711
  const result = this.clearMinHeight();
14739
- if (!result) {
14740
- this.cacheImageHeight(this.calcHeight());
14741
- }
14712
+ const height = this.calcHeight();
14713
+ cacheHeightByElement(this.editor, this.element, height);
14742
14714
  }, 0);
14743
14715
  }
14744
14716
  }