@worktile/theia 20.2.3 → 20.2.4

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, getRealHeightByElement, 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, ELEMENT_KEY_TO_HEIGHTS, getCachedHeightByElement, isDebug, debugLog, 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';
@@ -10128,7 +10128,7 @@ class TheTable extends TheBaseElement {
10128
10128
  this.listenSelectstartEvent();
10129
10129
  this.listenTableContextMenuEvent();
10130
10130
  this.listenTableWrapperScroll();
10131
- this.subscribeScrollContainerScroll(this.tableWrapperLeft);
10131
+ this.subscribeScrollContainerScroll();
10132
10132
  this.initHorizontalScrollbar();
10133
10133
  if (isPrintMode) {
10134
10134
  this.cdr.markForCheck();
@@ -10188,15 +10188,12 @@ class TheTable extends TheBaseElement {
10188
10188
  }
10189
10189
  return { height, top };
10190
10190
  }
10191
- subscribeScrollContainerScroll(tableWrapperLeft) {
10191
+ subscribeScrollContainerScroll() {
10192
10192
  this.ngZone.runOutsideAngular(() => {
10193
10193
  this.contextService.containerScrolled$
10194
10194
  .pipe(takeUntil(this.destroy$), map$1(entires => {
10195
10195
  const { event, direction } = entires;
10196
10196
  if (direction === ScrollDirection.X) {
10197
- const { left } = this.nativeElement.getBoundingClientRect();
10198
- this.isScrolledXOfScrollContainer = tableWrapperLeft !== left;
10199
- this.tableWrapperLeft = left;
10200
10197
  this.setHeaderRowShadow();
10201
10198
  this.setStickyElementLeftStyle();
10202
10199
  }
@@ -10235,7 +10232,7 @@ class TheTable extends TheBaseElement {
10235
10232
  }
10236
10233
  }
10237
10234
  updateFreezeState() {
10238
- this.isFreezeRow = this.freezeRowPipe.transform(this.element, this.tablePluginOptions, this.editor);
10235
+ this.isFreezeRow = this.freezeRowPipe.transform(this.element, this.tablePluginOptions, this.editor) && this.children.length > 1;
10239
10236
  this.isFreezeColumn = this.freezeColumnPipe.transform(this.element, this.tablePluginOptions, this.tableWrapperWidth, this.editor);
10240
10237
  }
10241
10238
  setTableHeaderStyle() {
@@ -10283,8 +10280,10 @@ class TheTable extends TheBaseElement {
10283
10280
  }
10284
10281
  else {
10285
10282
  if (this.readonly) {
10286
- cellsWidth = getColumnsWidth(headerRow);
10287
- gridColumns = getGridColumns(headerRow, cellsWidth);
10283
+ // 预览模式且没有colgroup,使用数据行的宽度计算固定列宽
10284
+ const dataRow = this.tbodyElement.nativeElement.childNodes[1];
10285
+ cellsWidth = getColumnsWidth(dataRow);
10286
+ gridColumns = getGridColumns(dataRow, cellsWidth);
10288
10287
  }
10289
10288
  else {
10290
10289
  const columnCount = this.element.children[0].children.length;
@@ -10723,9 +10722,11 @@ class TheTable extends TheBaseElement {
10723
10722
  const cornerControl = this.cornerControl.nativeElement;
10724
10723
  const rowControl = this.rowControlsButtonWrapper.first?.nativeElement;
10725
10724
  const buffer = this.isInTable ? -TABLE_CONTROL : 0;
10726
- if (this.isStickyTop && this.isScrolledXOfScrollContainer) {
10725
+ if (this.isStickyTop) {
10726
+ this.getWrapperWidthAndLeft();
10727
+ const controlButtonBorder = 1;
10727
10728
  stickyRows.forEach((element) => {
10728
- this.renderer.setStyle(element, 'left', `${this.tableWrapperLeft}px`);
10729
+ this.renderer.setStyle(element, 'left', `${this.tableWrapperLeft + (this.readonly ? 0 : this.getColControlButtonWidth() - controlButtonBorder)}px`);
10729
10730
  });
10730
10731
  this.renderer.setStyle(cornerControl, 'left', `${this.tableWrapperLeft + buffer}px`);
10731
10732
  rowControl && this.renderer.setStyle(rowControl, 'left', `${this.tableWrapperLeft + buffer}px`);
@@ -14390,7 +14391,7 @@ class TheImage extends TheBaseElement {
14390
14391
  if (!AngularEditor.isEnabledVirtualScroll(this.editor)) {
14391
14392
  return;
14392
14393
  }
14393
- const realHeight = getRealHeightByElement(this.editor, this.element);
14394
+ const realHeight = getCachedHeightByElement(this.editor, this.element);
14394
14395
  if (realHeight) {
14395
14396
  const blockCard = getBlockCardByNativeElement(this.nativeElement);
14396
14397
  if (blockCard) {
@@ -14577,7 +14578,7 @@ class TheImage extends TheBaseElement {
14577
14578
  width: this.imageEntry.width,
14578
14579
  height: this.imageEntry.height
14579
14580
  }, { at: this.selection });
14580
- this.cacheImageHeight(this.getRealHeight());
14581
+ this.cacheImageHeight(this.calcHeight());
14581
14582
  }
14582
14583
  }
14583
14584
  cancelUpload() {
@@ -14684,7 +14685,7 @@ class TheImage extends TheBaseElement {
14684
14685
  // }
14685
14686
  const result = this.clearMinHeight();
14686
14687
  if (!result) {
14687
- this.cacheImageHeight(this.getRealHeight());
14688
+ this.cacheImageHeight(this.calcHeight());
14688
14689
  }
14689
14690
  }, 0);
14690
14691
  }