@worktile/theia 20.1.0-next.4 → 20.1.0-next.5

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, BaseElementFlavour, hasBlockCard, isCardLeft, DefaultTextFlavour, defaultScrollSelectionIntoView, getDataTransferClipboard, JUST_NOW_UPDATED_VIRTUAL_VIEW, 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, BaseElementFlavour, hasBlockCard, isCardLeft, ELEMENT_KEY_TO_HEIGHTS, DefaultTextFlavour, defaultScrollSelectionIntoView, getDataTransferClipboard, JUST_NOW_UPDATED_VIRTUAL_VIEW, 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';
@@ -14340,6 +14340,10 @@ class TheImage extends TheBaseElement {
14340
14340
  this.subscribeMouseUp();
14341
14341
  this.subscribeImageUploadingState();
14342
14342
  }
14343
+ afterViewInit() {
14344
+ super.afterViewInit();
14345
+ this.setImageMinHeight();
14346
+ }
14343
14347
  onContextChange() {
14344
14348
  super.onContextChange();
14345
14349
  if (this.initialized && !isMobileMode(this.editor)) {
@@ -14359,6 +14363,28 @@ class TheImage extends TheBaseElement {
14359
14363
  }
14360
14364
  super.ngOnDestroy();
14361
14365
  }
14366
+ cacheImageHeight(height) {
14367
+ const heights = ELEMENT_KEY_TO_HEIGHTS.get(this.editor);
14368
+ const key = AngularEditor.findKey(this.editor, this.element);
14369
+ heights.set(key.id, height);
14370
+ }
14371
+ setImageMinHeight() {
14372
+ const heights = ELEMENT_KEY_TO_HEIGHTS.get(this.editor);
14373
+ const key = AngularEditor.findKey(this.editor, this.element);
14374
+ if (heights && heights.get(key.id)) {
14375
+ const blockCard = getBlockCardByNativeElement(this.nativeElement);
14376
+ if (blockCard) {
14377
+ const style = getComputedStyle(blockCard);
14378
+ blockCard.style.minHeight = heights.get(key.id) - parseFloat(style.marginTop) - parseFloat(style.marginBottom) + 'px';
14379
+ }
14380
+ }
14381
+ }
14382
+ clearMinHeight() {
14383
+ const blockCard = getBlockCardByNativeElement(this.nativeElement);
14384
+ if (blockCard) {
14385
+ blockCard.style.minHeight = '';
14386
+ }
14387
+ }
14362
14388
  setImagePluginOptions() {
14363
14389
  this.imagePluginOptions = getPluginOptions(this.editor, PluginKeys.image);
14364
14390
  }
@@ -14511,6 +14537,7 @@ class TheImage extends TheBaseElement {
14511
14537
  width: this.imageEntry.width,
14512
14538
  height: this.imageEntry.height
14513
14539
  }, { at: this.selection });
14540
+ this.cacheImageHeight(this.getRealHeight());
14514
14541
  }
14515
14542
  }
14516
14543
  cancelUpload() {
@@ -14595,9 +14622,13 @@ class TheImage extends TheBaseElement {
14595
14622
  .withPositions([bottomPosition]);
14596
14623
  }
14597
14624
  imageLoaded(event) {
14625
+ this.clearMinHeight();
14598
14626
  const img = event.target;
14599
14627
  this.naturalWidth = img.naturalWidth;
14600
14628
  this.naturalHeight = img.naturalHeight;
14629
+ setTimeout(() => {
14630
+ this.cacheImageHeight(this.getRealHeight());
14631
+ }, 0);
14601
14632
  }
14602
14633
  imageError(event) {
14603
14634
  const img = event.target;