@worktile/theia 20.1.0-next.14 → 20.1.0-next.15

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, assign, defaults, groupBy, uniq, isEqual } from 'lodash
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, 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, ELEMENT_KEY_TO_HEIGHTS, getRealHeightByElement, 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';
@@ -14383,13 +14383,12 @@ class TheImage extends TheBaseElement {
14383
14383
  if (!AngularEditor.isEnabledVirtualScroll(this.editor)) {
14384
14384
  return;
14385
14385
  }
14386
- const heights = ELEMENT_KEY_TO_HEIGHTS.get(this.editor);
14387
- const key = AngularEditor.findKey(this.editor, this.element);
14388
- if (heights && heights.get(key.id)) {
14386
+ const realHeight = getRealHeightByElement(this.editor, this.element, 0);
14387
+ if (realHeight > 0) {
14389
14388
  const blockCard = getBlockCardByNativeElement(this.nativeElement);
14390
14389
  if (blockCard) {
14391
14390
  const style = getComputedStyle(blockCard);
14392
- blockCard.style.minHeight = heights.get(key.id) - parseFloat(style.marginTop) - parseFloat(style.marginBottom) + 'px';
14391
+ blockCard.style.minHeight = realHeight - parseFloat(style.marginTop) - parseFloat(style.marginBottom) + 'px';
14393
14392
  }
14394
14393
  }
14395
14394
  }
@@ -14398,8 +14397,12 @@ class TheImage extends TheBaseElement {
14398
14397
  return;
14399
14398
  }
14400
14399
  const blockCard = getBlockCardByNativeElement(this.nativeElement);
14401
- if (blockCard) {
14400
+ if (blockCard && blockCard.style.minHeight) {
14402
14401
  blockCard.style.minHeight = '';
14402
+ return true;
14403
+ }
14404
+ else {
14405
+ return false;
14403
14406
  }
14404
14407
  }
14405
14408
  setImagePluginOptions() {
@@ -14639,13 +14642,15 @@ class TheImage extends TheBaseElement {
14639
14642
  .withPositions([bottomPosition]);
14640
14643
  }
14641
14644
  imageLoaded(event) {
14642
- this.clearMinHeight();
14643
14645
  const img = event.target;
14644
14646
  this.naturalWidth = img.naturalWidth;
14645
14647
  this.naturalHeight = img.naturalHeight;
14646
14648
  if (AngularEditor.isEnabledVirtualScroll(this.editor)) {
14647
14649
  this.imageLoadedCacheHeightTimer = setTimeout(() => {
14648
- this.cacheImageHeight(this.getRealHeight());
14650
+ const result = this.clearMinHeight();
14651
+ if (!result) {
14652
+ this.cacheImageHeight(this.getRealHeight());
14653
+ }
14649
14654
  }, 0);
14650
14655
  }
14651
14656
  }