@worktile/theia 20.1.0-next.15 → 20.1.0-next.16
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, getRealHeightByElement, 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, isDebug, debugLog, 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';
|
|
@@ -5227,7 +5227,6 @@ const TABLE_BORDER = 1;
|
|
|
5227
5227
|
const TABLE_PADDING = 8;
|
|
5228
5228
|
const TABLE_CONTROL = 11;
|
|
5229
5229
|
const TABLE_NUMBER_COLUMN = 45;
|
|
5230
|
-
const TABLE_HORIZONTAL_SCROLL_HEIGHT = 16; // table component horizontal scrollbar height
|
|
5231
5230
|
const TableWithStickyRowClass = 'the-table-with-sticky-row';
|
|
5232
5231
|
var FullscreenState;
|
|
5233
5232
|
(function (FullscreenState) {
|
|
@@ -9938,6 +9937,8 @@ class TheTable extends TheBaseElement {
|
|
|
9938
9937
|
setTimeout(() => {
|
|
9939
9938
|
this.afterRowControlsUpdate();
|
|
9940
9939
|
}, 0);
|
|
9940
|
+
// 表格数据变化,更新横向滚动条
|
|
9941
|
+
this.updateHorizontalScrollbar();
|
|
9941
9942
|
}, 0);
|
|
9942
9943
|
this.isFreezeRow = this.freezeRowPipe.transform(this.element, this.tablePluginOptions);
|
|
9943
9944
|
this.isFreezeColumn = this.freezeColumnPipe.transform(this.element, this.tablePluginOptions, this.tableWrapperWidth);
|
|
@@ -9949,8 +9950,6 @@ class TheTable extends TheBaseElement {
|
|
|
9949
9950
|
this.theTableContextMenuService.closeContextMenu();
|
|
9950
9951
|
this.tableStore.isExistSelectedCell && this.tableStore.clearSelectedCells();
|
|
9951
9952
|
}
|
|
9952
|
-
// 表格数据变化,更新横向滚动条
|
|
9953
|
-
this.updateHorizontalScrollbar();
|
|
9954
9953
|
}
|
|
9955
9954
|
}
|
|
9956
9955
|
// 需要等待内容更新后,才可以执行 useRowControls,否则获取的高度可能不正确
|
|
@@ -9986,7 +9985,6 @@ class TheTable extends TheBaseElement {
|
|
|
9986
9985
|
this.destroy$ = new Subject();
|
|
9987
9986
|
this.rowControls = [];
|
|
9988
9987
|
this.colControls = [];
|
|
9989
|
-
this.isMouseOverTable = false;
|
|
9990
9988
|
this.getOutletParent = () => {
|
|
9991
9989
|
return this.tbodyElement.nativeElement;
|
|
9992
9990
|
};
|
|
@@ -10659,6 +10657,8 @@ class TheTable extends TheBaseElement {
|
|
|
10659
10657
|
fromEvent(this.tableWrapper.nativeElement, 'scroll')
|
|
10660
10658
|
.pipe(takeUntil(this.destroy$))
|
|
10661
10659
|
.subscribe(() => {
|
|
10660
|
+
const scrollbarContainer = this.horizontalScrollbarContainer.nativeElement;
|
|
10661
|
+
scrollbarContainer.scrollLeft = this.tableWrapper.nativeElement.scrollLeft;
|
|
10662
10662
|
this.setTableScrollingShadow();
|
|
10663
10663
|
this.updateStickyRowScrollLeft();
|
|
10664
10664
|
this.setHeaderRowShadow();
|
|
@@ -10688,7 +10688,7 @@ class TheTable extends TheBaseElement {
|
|
|
10688
10688
|
const buffer = this.isInTable ? -TABLE_CONTROL : 0;
|
|
10689
10689
|
if (this.isStickyTop && this.isScrolledXOfScrollContainer) {
|
|
10690
10690
|
stickyRows.forEach((element) => {
|
|
10691
|
-
this.renderer.setStyle(element, 'left', `${this.tableWrapperLeft
|
|
10691
|
+
this.renderer.setStyle(element, 'left', `${this.tableWrapperLeft}px`);
|
|
10692
10692
|
});
|
|
10693
10693
|
this.renderer.setStyle(cornerControl, 'left', `${this.tableWrapperLeft + buffer}px`);
|
|
10694
10694
|
rowControl && this.renderer.setStyle(rowControl, 'left', `${this.tableWrapperLeft + buffer}px`);
|
|
@@ -10718,58 +10718,9 @@ class TheTable extends TheBaseElement {
|
|
|
10718
10718
|
if (!this.horizontalScrollbarContainer || !this.horizontalScrollbarContent) {
|
|
10719
10719
|
return;
|
|
10720
10720
|
}
|
|
10721
|
-
this.bindTableMouseEvents();
|
|
10722
10721
|
this.bindScrollbarEvents();
|
|
10723
10722
|
this.updateHorizontalScrollbar();
|
|
10724
10723
|
}
|
|
10725
|
-
// 绑定鼠标和滚轮事件,用于处理表格横向滚动条显隐
|
|
10726
|
-
bindTableMouseEvents() {
|
|
10727
|
-
if (!this.nativeElement) {
|
|
10728
|
-
return;
|
|
10729
|
-
}
|
|
10730
|
-
// 鼠标移入表格时,更新滚动条是否显示固定
|
|
10731
|
-
fromEvent(this.nativeElement, 'mouseenter')
|
|
10732
|
-
.pipe(takeUntil(this.destroy$))
|
|
10733
|
-
.subscribe(() => {
|
|
10734
|
-
this.isMouseOverTable = true;
|
|
10735
|
-
this.updateHorizontalScrollbar();
|
|
10736
|
-
});
|
|
10737
|
-
fromEvent(this.nativeElement, 'mouseleave')
|
|
10738
|
-
.pipe(takeUntil(this.destroy$))
|
|
10739
|
-
.subscribe(() => {
|
|
10740
|
-
this.isMouseOverTable = false;
|
|
10741
|
-
this.updateHorizontalScrollbar();
|
|
10742
|
-
});
|
|
10743
|
-
// 在表格上的滚轮滚动监听,处理滚动过程中超过可视范围滚动条的显隐
|
|
10744
|
-
// 页面的垂直滚动由使用方的页面决定,表格组件无法准确获取,这里通过监听滚轮实现
|
|
10745
|
-
fromEvent(this.nativeElement, 'wheel', { passive: false })
|
|
10746
|
-
.pipe(takeUntil(this.destroy$))
|
|
10747
|
-
.subscribe((event) => {
|
|
10748
|
-
// 只有在鼠标在表格上时才处理
|
|
10749
|
-
if (!this.isMouseOverTable) {
|
|
10750
|
-
return;
|
|
10751
|
-
}
|
|
10752
|
-
const isHorizontalScroll = Math.abs(event.deltaX) > Math.abs(event.deltaY) || event.shiftKey;
|
|
10753
|
-
if (isHorizontalScroll && this.horizontalScrollbarContainer) {
|
|
10754
|
-
event.preventDefault();
|
|
10755
|
-
let deltaX = event.deltaX;
|
|
10756
|
-
// 如果是 Shift + 滚轮,将垂直滚动转换为横向滚动
|
|
10757
|
-
if (event.shiftKey && Math.abs(event.deltaY) > Math.abs(event.deltaX)) {
|
|
10758
|
-
deltaX = event.deltaY;
|
|
10759
|
-
}
|
|
10760
|
-
const scrollbarContainer = this.horizontalScrollbarContainer.nativeElement;
|
|
10761
|
-
const newScrollLeft = Math.max(0, Math.min(scrollbarContainer.scrollLeft + deltaX, scrollbarContainer.scrollWidth - scrollbarContainer.clientWidth));
|
|
10762
|
-
// 同步滚动到滚动条
|
|
10763
|
-
scrollbarContainer.scrollLeft = newScrollLeft;
|
|
10764
|
-
}
|
|
10765
|
-
else {
|
|
10766
|
-
// 纵向滚动,需要延迟执行是否需要固定滚动条
|
|
10767
|
-
setTimeout(() => {
|
|
10768
|
-
this.updateScrollbarFixedState();
|
|
10769
|
-
}, 100);
|
|
10770
|
-
}
|
|
10771
|
-
});
|
|
10772
|
-
}
|
|
10773
10724
|
// 监听横向滚动条滚动事件
|
|
10774
10725
|
bindScrollbarEvents() {
|
|
10775
10726
|
if (!this.horizontalScrollbarContainer || !this.horizontalScrollbarContent) {
|
|
@@ -10786,38 +10737,27 @@ class TheTable extends TheBaseElement {
|
|
|
10786
10737
|
});
|
|
10787
10738
|
}
|
|
10788
10739
|
updateHorizontalScrollbar() {
|
|
10789
|
-
this.
|
|
10790
|
-
this.updateScrollbarVisibility();
|
|
10740
|
+
this.setScrollbarWidth();
|
|
10791
10741
|
this.updateScrollbarFixedState();
|
|
10792
10742
|
}
|
|
10793
|
-
|
|
10794
|
-
this.
|
|
10795
|
-
}
|
|
10796
|
-
// 更新横向滚动条可见性
|
|
10797
|
-
updateScrollbarVisibility() {
|
|
10798
|
-
if (!this.tableWrapper || !this.horizontalScrollbarContainer || !this.horizontalScrollbarContent) {
|
|
10743
|
+
setScrollbarWidth() {
|
|
10744
|
+
if (!this.tableWrapper || !this.horizontalScrollbarContent) {
|
|
10799
10745
|
return;
|
|
10800
10746
|
}
|
|
10801
10747
|
const tableWrapper = this.tableWrapper.nativeElement;
|
|
10802
|
-
const scrollbarContainer = this.horizontalScrollbarContainer.nativeElement;
|
|
10803
10748
|
const scrollbarContent = this.horizontalScrollbarContent.nativeElement;
|
|
10804
10749
|
const hasHorizontalScroll = tableWrapper.scrollWidth > tableWrapper.clientWidth;
|
|
10805
10750
|
if (!hasHorizontalScroll) {
|
|
10806
|
-
this.renderer.
|
|
10751
|
+
this.renderer.removeStyle(scrollbarContent, 'width');
|
|
10807
10752
|
return;
|
|
10808
10753
|
}
|
|
10809
10754
|
this.renderer.setStyle(scrollbarContent, 'width', `${tableWrapper.scrollWidth}px`);
|
|
10810
|
-
this.renderer.addClass(scrollbarContainer, 'visible');
|
|
10811
10755
|
}
|
|
10812
10756
|
// 更新横向滚动条固定状态
|
|
10813
10757
|
updateScrollbarFixedState() {
|
|
10814
10758
|
if (this.editor.options.disabledTableStickyScrollbar || !this.horizontalScrollbarContainer) {
|
|
10815
10759
|
return;
|
|
10816
10760
|
}
|
|
10817
|
-
if (!this.isMouseOverTable) {
|
|
10818
|
-
this.setScrollbarFixed(false, 0);
|
|
10819
|
-
return;
|
|
10820
|
-
}
|
|
10821
10761
|
const tableRect = this.nativeElement.getBoundingClientRect();
|
|
10822
10762
|
const viewportHeight = this.getViewportHeight();
|
|
10823
10763
|
const scrollbarBottomPosition = tableRect.bottom;
|
|
@@ -10857,15 +10797,11 @@ class TheTable extends TheBaseElement {
|
|
|
10857
10797
|
this.renderer.addClass(scrollbar, 'fixed');
|
|
10858
10798
|
this.renderer.setStyle(scrollbar, 'left', `${Math.max(0, tableRect.left)}px`);
|
|
10859
10799
|
this.renderer.setStyle(scrollbar, 'width', `${tableRect.width}px`);
|
|
10860
|
-
this.renderer.setStyle(scrollbar, 'top', `${viewportHeight - TABLE_HORIZONTAL_SCROLL_HEIGHT}px`);
|
|
10861
|
-
this.renderer.removeStyle(scrollbar, 'bottom');
|
|
10862
10800
|
}
|
|
10863
10801
|
else {
|
|
10864
10802
|
this.renderer.removeClass(scrollbar, 'fixed');
|
|
10865
10803
|
this.renderer.removeStyle(scrollbar, 'left');
|
|
10866
10804
|
this.renderer.removeStyle(scrollbar, 'width');
|
|
10867
|
-
this.renderer.removeStyle(scrollbar, 'top');
|
|
10868
|
-
this.renderer.setStyle(scrollbar, 'bottom', `-${TABLE_HORIZONTAL_SCROLL_HEIGHT}px`);
|
|
10869
10805
|
}
|
|
10870
10806
|
requestAnimationFrame(() => {
|
|
10871
10807
|
if (scrollbar.scrollLeft !== currentScrollLeft) {
|
|
@@ -14388,7 +14324,21 @@ class TheImage extends TheBaseElement {
|
|
|
14388
14324
|
const blockCard = getBlockCardByNativeElement(this.nativeElement);
|
|
14389
14325
|
if (blockCard) {
|
|
14390
14326
|
const style = getComputedStyle(blockCard);
|
|
14391
|
-
|
|
14327
|
+
const minHeight = realHeight - parseFloat(style.marginTop) - parseFloat(style.marginBottom);
|
|
14328
|
+
blockCard.style.minHeight = minHeight + 'px';
|
|
14329
|
+
if (isDebug) {
|
|
14330
|
+
debugLog('warn', 'setImageMinHeight in blockCard, realHeight(cache): ', realHeight, this.element.key, 'minHeight: ', minHeight);
|
|
14331
|
+
}
|
|
14332
|
+
}
|
|
14333
|
+
else {
|
|
14334
|
+
if (isDebug) {
|
|
14335
|
+
debugLog('warn', 'image render and can not find blockCard', this.element.key, this.editor.children.indexOf(this.element));
|
|
14336
|
+
}
|
|
14337
|
+
}
|
|
14338
|
+
}
|
|
14339
|
+
else {
|
|
14340
|
+
if (isDebug) {
|
|
14341
|
+
debugLog('warn', 'image render and can not find cache height', this.element.key, this.editor.children.indexOf(this.element));
|
|
14392
14342
|
}
|
|
14393
14343
|
}
|
|
14394
14344
|
}
|
|
@@ -14646,7 +14596,15 @@ class TheImage extends TheBaseElement {
|
|
|
14646
14596
|
this.naturalWidth = img.naturalWidth;
|
|
14647
14597
|
this.naturalHeight = img.naturalHeight;
|
|
14648
14598
|
if (AngularEditor.isEnabledVirtualScroll(this.editor)) {
|
|
14599
|
+
if (isDebug) {
|
|
14600
|
+
const realHeight = this.getRealHeight();
|
|
14601
|
+
debugLog('warn', 'imageLoaded, realHeight: ', realHeight, this.element.key, this.editor.children.indexOf(this.element));
|
|
14602
|
+
}
|
|
14649
14603
|
this.imageLoadedCacheHeightTimer = setTimeout(() => {
|
|
14604
|
+
if (isDebug) {
|
|
14605
|
+
const realHeight = this.getRealHeight();
|
|
14606
|
+
debugLog('warn', 'imageLoaded, realHeight setTimeout period: ', realHeight, this.element.key, 'index: ', this.editor.children.indexOf(this.element));
|
|
14607
|
+
}
|
|
14650
14608
|
const result = this.clearMinHeight();
|
|
14651
14609
|
if (!result) {
|
|
14652
14610
|
this.cacheImageHeight(this.getRealHeight());
|