@worktile/theia 15.0.15 → 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/table.editor.mjs +3 -21
- package/esm2020/services/context.service.mjs +11 -8
- package/fesm2015/worktile-theia.mjs +12 -31
- package/fesm2015/worktile-theia.mjs.map +1 -1
- package/fesm2020/worktile-theia.mjs +11 -30
- 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 +1 -1
|
@@ -3171,21 +3171,23 @@ class TheContextService {
|
|
|
3171
3171
|
}
|
|
3172
3172
|
initialize(options) {
|
|
3173
3173
|
this.options = options;
|
|
3174
|
-
this.containerElement =
|
|
3175
|
-
this.options.nativeElement.closest(this.options.theOptions?.scrollContainer) ||
|
|
3176
|
-
this.options.nativeElement.querySelector(this.options.theOptions?.scrollContainer);
|
|
3177
3174
|
this.rebindContainerScroll();
|
|
3178
3175
|
this.bindContainerResize();
|
|
3179
3176
|
this.bindTheEditorResize();
|
|
3180
3177
|
this.bindWindowResize();
|
|
3181
3178
|
}
|
|
3179
|
+
getScrollContainer() {
|
|
3180
|
+
return (this.options.nativeElement.closest(this.options.theOptions?.scrollContainer) ||
|
|
3181
|
+
this.options.nativeElement.querySelector(this.options.theOptions?.scrollContainer));
|
|
3182
|
+
}
|
|
3182
3183
|
rebindContainerScroll() {
|
|
3183
3184
|
this.scrollSubscription?.unsubscribe();
|
|
3184
3185
|
if (this.options.theOptions?.scrollContainer) {
|
|
3185
|
-
|
|
3186
|
+
const containerElement = this.getScrollContainer();
|
|
3187
|
+
if (containerElement) {
|
|
3186
3188
|
this.ngZone.runOutsideAngular(() => {
|
|
3187
3189
|
let previousContainerScroll = { x: 0, y: 0 };
|
|
3188
|
-
this.scrollSubscription = fromEvent(
|
|
3190
|
+
this.scrollSubscription = fromEvent(containerElement, 'scroll').subscribe(event => {
|
|
3189
3191
|
const entires = { event, direction: ScrollDirection.Y };
|
|
3190
3192
|
const target = event.target;
|
|
3191
3193
|
const [x, y] = [target.scrollLeft, target.scrollTop];
|
|
@@ -3203,8 +3205,9 @@ class TheContextService {
|
|
|
3203
3205
|
}
|
|
3204
3206
|
}
|
|
3205
3207
|
bindContainerResize() {
|
|
3206
|
-
|
|
3207
|
-
|
|
3208
|
+
const containerElement = this.getScrollContainer();
|
|
3209
|
+
if (containerElement) {
|
|
3210
|
+
this.containerResizeObserver = this.elementResize(containerElement, this.containerResized$);
|
|
3208
3211
|
}
|
|
3209
3212
|
}
|
|
3210
3213
|
bindTheEditorResize() {
|
|
@@ -6214,27 +6217,9 @@ const TableEditor = {
|
|
|
6214
6217
|
}
|
|
6215
6218
|
return null;
|
|
6216
6219
|
},
|
|
6217
|
-
isAlignActive(editor, alignment) {
|
|
6218
|
-
const cells = TableEditor.getSelectedCells(editor);
|
|
6219
|
-
if (cells) {
|
|
6220
|
-
const lastCell = cells[cells.length - 1];
|
|
6221
|
-
const tableNode = getAboveByType(editor, ElementKinds.table);
|
|
6222
|
-
const cellPath = [...tableNode[1], lastCell.row, lastCell.col];
|
|
6223
|
-
const cell = Node.get(editor, cellPath);
|
|
6224
|
-
const { align } = cell;
|
|
6225
|
-
if (!align && alignment === Alignment.left) {
|
|
6226
|
-
return true;
|
|
6227
|
-
}
|
|
6228
|
-
return align === alignment;
|
|
6229
|
-
}
|
|
6230
|
-
return null;
|
|
6231
|
-
},
|
|
6232
6220
|
setAlign(editor, alignment) {
|
|
6233
|
-
return TableEditor.handleSelectedCells(editor, (
|
|
6221
|
+
return TableEditor.handleSelectedCells(editor, (_, cellRange) => {
|
|
6234
6222
|
Transforms.setNodes(editor, { align: alignment }, {
|
|
6235
|
-
at: cellPath
|
|
6236
|
-
});
|
|
6237
|
-
Transforms.setNodes(editor, { align: undefined }, {
|
|
6238
6223
|
at: cellRange,
|
|
6239
6224
|
match: (n) => ALIGN_BLOCK_TYPES.includes(n.type)
|
|
6240
6225
|
});
|
|
@@ -6392,10 +6377,6 @@ const AlignEditor = {
|
|
|
6392
6377
|
if (!editor?.selection) {
|
|
6393
6378
|
return;
|
|
6394
6379
|
}
|
|
6395
|
-
const tableCellAlign = TableEditor.isAlignActive(editor, alignment);
|
|
6396
|
-
if (tableCellAlign !== null) {
|
|
6397
|
-
return tableCellAlign;
|
|
6398
|
-
}
|
|
6399
6380
|
const blockElement = anchorBlock(editor);
|
|
6400
6381
|
if (blockElement) {
|
|
6401
6382
|
const { align } = blockElement;
|