@worktile/theia 15.0.14 → 15.0.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.
- package/esm2020/plugins/align/align.editor.mjs +1 -5
- package/esm2020/plugins/table/components/table.component.mjs +9 -3
- package/esm2020/plugins/table/table.editor.mjs +3 -21
- package/esm2020/services/context.service.mjs +17 -4
- package/fesm2015/worktile-theia.mjs +33 -35
- package/fesm2015/worktile-theia.mjs.map +1 -1
- package/fesm2020/worktile-theia.mjs +25 -28
- package/fesm2020/worktile-theia.mjs.map +1 -1
- package/package.json +1 -1
- package/plugins/table/table.editor.d.ts +0 -1
- package/services/context.service.d.ts +8 -0
|
@@ -26,7 +26,7 @@ import { ThyTooltipModule } from 'ngx-tethys/tooltip';
|
|
|
26
26
|
import * as i8$1 from 'ngx-tethys/divider';
|
|
27
27
|
import { ThyDividerComponent, ThyDividerModule } from 'ngx-tethys/divider';
|
|
28
28
|
import { mixinUnsubscribe, MixinBase, ScrollToService } from 'ngx-tethys/core';
|
|
29
|
-
import { isKeyHotkey
|
|
29
|
+
import { isKeyHotkey } from 'is-hotkey';
|
|
30
30
|
import { Subject, fromEvent, timer, combineLatest, Observable, BehaviorSubject, merge, ReplaySubject } from 'rxjs';
|
|
31
31
|
import { takeUntil, debounceTime, take, delay, map as map$1, filter, startWith, distinctUntilChanged, skip, share, mapTo, pairwise } from 'rxjs/operators';
|
|
32
32
|
import * as i5 from 'ngx-tethys/input';
|
|
@@ -3161,6 +3161,7 @@ class TheContextService {
|
|
|
3161
3161
|
this.containerScrolled$ = new Subject();
|
|
3162
3162
|
this.uploadingStatus$ = new Subject();
|
|
3163
3163
|
this.containerResized$ = new Subject();
|
|
3164
|
+
this.theEditorResized$ = new Subject();
|
|
3164
3165
|
this.windowResized$ = new Subject();
|
|
3165
3166
|
this.ngZone.runOutsideAngular(() => {
|
|
3166
3167
|
this.onMouseUp$ = fromEvent(window, `mouseup`).pipe(takeUntil(this.destroy$));
|
|
@@ -3172,13 +3173,17 @@ class TheContextService {
|
|
|
3172
3173
|
this.options = options;
|
|
3173
3174
|
this.rebindContainerScroll();
|
|
3174
3175
|
this.bindContainerResize();
|
|
3176
|
+
this.bindTheEditorResize();
|
|
3175
3177
|
this.bindWindowResize();
|
|
3176
3178
|
}
|
|
3179
|
+
getScrollContainer() {
|
|
3180
|
+
return (this.options.nativeElement.closest(this.options.theOptions?.scrollContainer) ||
|
|
3181
|
+
this.options.nativeElement.querySelector(this.options.theOptions?.scrollContainer));
|
|
3182
|
+
}
|
|
3177
3183
|
rebindContainerScroll() {
|
|
3178
3184
|
this.scrollSubscription?.unsubscribe();
|
|
3179
3185
|
if (this.options.theOptions?.scrollContainer) {
|
|
3180
|
-
const containerElement = this.
|
|
3181
|
-
this.options.nativeElement.querySelector(this.options.theOptions?.scrollContainer);
|
|
3186
|
+
const containerElement = this.getScrollContainer();
|
|
3182
3187
|
if (containerElement) {
|
|
3183
3188
|
this.ngZone.runOutsideAngular(() => {
|
|
3184
3189
|
let previousContainerScroll = { x: 0, y: 0 };
|
|
@@ -3200,7 +3205,13 @@ class TheContextService {
|
|
|
3200
3205
|
}
|
|
3201
3206
|
}
|
|
3202
3207
|
bindContainerResize() {
|
|
3203
|
-
|
|
3208
|
+
const containerElement = this.getScrollContainer();
|
|
3209
|
+
if (containerElement) {
|
|
3210
|
+
this.containerResizeObserver = this.elementResize(containerElement, this.containerResized$);
|
|
3211
|
+
}
|
|
3212
|
+
}
|
|
3213
|
+
bindTheEditorResize() {
|
|
3214
|
+
this.theEditorResizeObserver = this.elementResize(this.options.nativeElement, this.theEditorResized$);
|
|
3204
3215
|
}
|
|
3205
3216
|
bindWindowResize() {
|
|
3206
3217
|
this.windowResizeObserver = this.elementResize(document.documentElement, this.windowResized$);
|
|
@@ -3251,8 +3262,10 @@ class TheContextService {
|
|
|
3251
3262
|
ngOnDestroy() {
|
|
3252
3263
|
this.uploadingStatus$.complete();
|
|
3253
3264
|
this.containerScrolled$?.complete();
|
|
3265
|
+
this.theEditorResized$?.complete();
|
|
3254
3266
|
this.containerResized$?.complete();
|
|
3255
3267
|
this.containerResizeObserver?.disconnect();
|
|
3268
|
+
this.theEditorResizeObserver?.disconnect();
|
|
3256
3269
|
this.windowResized$?.complete();
|
|
3257
3270
|
this.windowResizeObserver?.disconnect();
|
|
3258
3271
|
this.scrollSubscription?.unsubscribe();
|
|
@@ -6204,27 +6217,9 @@ const TableEditor = {
|
|
|
6204
6217
|
}
|
|
6205
6218
|
return null;
|
|
6206
6219
|
},
|
|
6207
|
-
isAlignActive(editor, alignment) {
|
|
6208
|
-
const cells = TableEditor.getSelectedCells(editor);
|
|
6209
|
-
if (cells) {
|
|
6210
|
-
const lastCell = cells[cells.length - 1];
|
|
6211
|
-
const tableNode = getAboveByType(editor, ElementKinds.table);
|
|
6212
|
-
const cellPath = [...tableNode[1], lastCell.row, lastCell.col];
|
|
6213
|
-
const cell = Node.get(editor, cellPath);
|
|
6214
|
-
const { align } = cell;
|
|
6215
|
-
if (!align && alignment === Alignment.left) {
|
|
6216
|
-
return true;
|
|
6217
|
-
}
|
|
6218
|
-
return align === alignment;
|
|
6219
|
-
}
|
|
6220
|
-
return null;
|
|
6221
|
-
},
|
|
6222
6220
|
setAlign(editor, alignment) {
|
|
6223
|
-
return TableEditor.handleSelectedCells(editor, (
|
|
6221
|
+
return TableEditor.handleSelectedCells(editor, (_, cellRange) => {
|
|
6224
6222
|
Transforms.setNodes(editor, { align: alignment }, {
|
|
6225
|
-
at: cellPath
|
|
6226
|
-
});
|
|
6227
|
-
Transforms.setNodes(editor, { align: undefined }, {
|
|
6228
6223
|
at: cellRange,
|
|
6229
6224
|
match: (n) => ALIGN_BLOCK_TYPES.includes(n.type)
|
|
6230
6225
|
});
|
|
@@ -6382,10 +6377,6 @@ const AlignEditor = {
|
|
|
6382
6377
|
if (!editor?.selection) {
|
|
6383
6378
|
return;
|
|
6384
6379
|
}
|
|
6385
|
-
const tableCellAlign = TableEditor.isAlignActive(editor, alignment);
|
|
6386
|
-
if (tableCellAlign !== null) {
|
|
6387
|
-
return tableCellAlign;
|
|
6388
|
-
}
|
|
6389
6380
|
const blockElement = anchorBlock(editor);
|
|
6390
6381
|
if (blockElement) {
|
|
6391
6382
|
const { align } = blockElement;
|
|
@@ -12898,9 +12889,15 @@ class TheTableComponent extends TheBaseElementComponent {
|
|
|
12898
12889
|
this.tableRectLeft = left;
|
|
12899
12890
|
this.subscribeScrollContainerScroll();
|
|
12900
12891
|
this.contextService.containerResized$.pipe(takeUntil(this.destroy$)).subscribe(result => {
|
|
12892
|
+
if (result.widthChanged) {
|
|
12893
|
+
this.setHeaderRowLeftStyle();
|
|
12894
|
+
}
|
|
12895
|
+
});
|
|
12896
|
+
this.contextService.theEditorResized$.pipe(takeUntil(this.destroy$)).subscribe(result => {
|
|
12901
12897
|
if (result.widthChanged) {
|
|
12902
12898
|
this.setGridColumnsStyle();
|
|
12903
12899
|
this.setStickyRowStyle();
|
|
12900
|
+
this.setHeaderRowShadow();
|
|
12904
12901
|
this.bindTableScrollingShadow();
|
|
12905
12902
|
}
|
|
12906
12903
|
});
|
|
@@ -13451,7 +13448,7 @@ class TheTableComponent extends TheBaseElementComponent {
|
|
|
13451
13448
|
fromEvent(document, 'keydown')
|
|
13452
13449
|
.pipe(takeUntil(this.destroy$), filter((e) => !!e))
|
|
13453
13450
|
.subscribe((event) => {
|
|
13454
|
-
if (
|
|
13451
|
+
if (isKeyHotkey('mod', event) && !this.readonly) {
|
|
13455
13452
|
this.tableStore.pointerSelection = true;
|
|
13456
13453
|
const cell = this.tbodyElement.nativeElement.querySelector('.focused-cell');
|
|
13457
13454
|
cell && this.tableStore.selectCellStart(cell, this.editor);
|