@atlaskit/editor-plugin-table 8.4.14 → 9.0.1
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/CHANGELOG.md +23 -0
- package/dist/cjs/nodeviews/TableRow.js +24 -14
- package/dist/cjs/pm-plugins/table-resizing/event-handlers.js +9 -84
- package/dist/cjs/pm-plugins/table-resizing/plugin.js +2 -2
- package/dist/cjs/pm-plugins/table-resizing/utils/resize-column.js +3 -144
- package/dist/cjs/pm-plugins/table-resizing/utils/resize-state.js +1 -2
- package/dist/cjs/pm-plugins/view-mode-sort/utils.js +3 -0
- package/dist/cjs/tablePlugin.js +3 -5
- package/dist/cjs/ui/DragPreview/index.js +1 -0
- package/dist/cjs/ui/FloatingContextualButton/index.js +1 -2
- package/dist/cjs/ui/FloatingContextualMenu/ContextualMenu.js +2 -4
- package/dist/cjs/ui/TableFullWidthLabel/index.js +1 -0
- package/dist/cjs/ui/event-handlers.js +18 -7
- package/dist/cjs/ui/toolbar.js +1 -4
- package/dist/es2019/nodeviews/TableContainer.js +1 -1
- package/dist/es2019/nodeviews/TableRow.js +24 -14
- package/dist/es2019/pm-plugins/commands/column-resize.js +1 -1
- package/dist/es2019/pm-plugins/commands/insert.js +3 -3
- package/dist/es2019/pm-plugins/commands/misc.js +1 -1
- package/dist/es2019/pm-plugins/drag-and-drop/commands.js +1 -1
- package/dist/es2019/pm-plugins/table-analytics.js +1 -1
- package/dist/es2019/pm-plugins/table-resizing/event-handlers.js +12 -84
- package/dist/es2019/pm-plugins/table-resizing/plugin.js +2 -2
- package/dist/es2019/pm-plugins/table-resizing/utils/misc.js +2 -2
- package/dist/es2019/pm-plugins/table-resizing/utils/resize-column.js +2 -139
- package/dist/es2019/pm-plugins/table-resizing/utils/resize-logic.js +1 -1
- package/dist/es2019/pm-plugins/table-resizing/utils/resize-state.js +1 -2
- package/dist/es2019/pm-plugins/table-resizing/utils/scale-table.js +1 -1
- package/dist/es2019/pm-plugins/transforms/delete-columns.js +1 -1
- package/dist/es2019/pm-plugins/transforms/fix-tables.js +1 -1
- package/dist/es2019/pm-plugins/transforms/replace-table.js +1 -1
- package/dist/es2019/pm-plugins/transforms/split.js +2 -2
- package/dist/es2019/pm-plugins/utils/analytics.js +4 -4
- package/dist/es2019/pm-plugins/utils/column-controls.js +1 -1
- package/dist/es2019/pm-plugins/utils/drag-menu.js +1 -1
- package/dist/es2019/pm-plugins/utils/merged-cells.js +4 -4
- package/dist/es2019/pm-plugins/utils/nodes.js +3 -3
- package/dist/es2019/pm-plugins/utils/row-controls.js +2 -2
- package/dist/es2019/pm-plugins/view-mode-sort/index.js +2 -2
- package/dist/es2019/pm-plugins/view-mode-sort/utils.js +4 -1
- package/dist/es2019/tablePlugin.js +3 -5
- package/dist/es2019/ui/DragPreview/index.js +4 -3
- package/dist/es2019/ui/FloatingContextualButton/index.js +1 -2
- package/dist/es2019/ui/FloatingContextualMenu/ContextualMenu.js +4 -6
- package/dist/es2019/ui/FloatingDragMenu/DragMenu.js +4 -4
- package/dist/es2019/ui/FloatingDragMenu/DropdownMenu.js +2 -2
- package/dist/es2019/ui/TableFullWidthLabel/index.js +1 -0
- package/dist/es2019/ui/event-handlers.js +12 -1
- package/dist/es2019/ui/toolbar.js +1 -4
- package/dist/esm/nodeviews/TableRow.js +24 -14
- package/dist/esm/pm-plugins/table-resizing/event-handlers.js +11 -85
- package/dist/esm/pm-plugins/table-resizing/plugin.js +2 -2
- package/dist/esm/pm-plugins/table-resizing/utils/resize-column.js +2 -143
- package/dist/esm/pm-plugins/table-resizing/utils/resize-state.js +1 -2
- package/dist/esm/pm-plugins/view-mode-sort/utils.js +3 -0
- package/dist/esm/tablePlugin.js +3 -5
- package/dist/esm/ui/DragPreview/index.js +1 -0
- package/dist/esm/ui/FloatingContextualButton/index.js +1 -2
- package/dist/esm/ui/FloatingContextualMenu/ContextualMenu.js +2 -4
- package/dist/esm/ui/TableFullWidthLabel/index.js +1 -0
- package/dist/esm/ui/event-handlers.js +12 -1
- package/dist/esm/ui/toolbar.js +1 -4
- package/dist/types/pm-plugins/table-resizing/event-handlers.d.ts +1 -1
- package/dist/types/pm-plugins/table-resizing/plugin.d.ts +1 -1
- package/dist/types/pm-plugins/table-resizing/utils/resize-column.d.ts +0 -24
- package/dist/types/tablePluginType.d.ts +0 -1
- package/dist/types-ts4.5/pm-plugins/table-resizing/event-handlers.d.ts +1 -1
- package/dist/types-ts4.5/pm-plugins/table-resizing/plugin.d.ts +1 -1
- package/dist/types-ts4.5/pm-plugins/table-resizing/utils/resize-column.d.ts +0 -24
- package/dist/types-ts4.5/tablePluginType.d.ts +0 -1
- package/package.json +5 -5
- package/src/nodeviews/TableComponent.tsx +1 -1
- package/src/nodeviews/TableContainer.tsx +1 -1
- package/src/nodeviews/TableRow.ts +34 -14
- package/src/pm-plugins/commands/column-resize.ts +1 -1
- package/src/pm-plugins/commands/hover.ts +2 -2
- package/src/pm-plugins/commands/insert.ts +3 -3
- package/src/pm-plugins/commands/misc.ts +1 -1
- package/src/pm-plugins/drag-and-drop/commands-with-analytics.ts +1 -1
- package/src/pm-plugins/drag-and-drop/commands.ts +6 -2
- package/src/pm-plugins/table-analytics.ts +1 -1
- package/src/pm-plugins/table-resizing/event-handlers.ts +35 -121
- package/src/pm-plugins/table-resizing/plugin.ts +0 -4
- package/src/pm-plugins/table-resizing/utils/colgroup.ts +1 -1
- package/src/pm-plugins/table-resizing/utils/misc.ts +2 -2
- package/src/pm-plugins/table-resizing/utils/resize-column.ts +1 -219
- package/src/pm-plugins/table-resizing/utils/resize-logic.ts +1 -1
- package/src/pm-plugins/table-resizing/utils/resize-state.ts +1 -3
- package/src/pm-plugins/table-resizing/utils/scale-table.ts +1 -1
- package/src/pm-plugins/transforms/column-width.ts +1 -1
- package/src/pm-plugins/transforms/delete-columns.ts +1 -1
- package/src/pm-plugins/transforms/fix-tables.ts +1 -1
- package/src/pm-plugins/transforms/replace-table.ts +1 -1
- package/src/pm-plugins/transforms/split.ts +2 -2
- package/src/pm-plugins/utils/analytics.ts +4 -4
- package/src/pm-plugins/utils/column-controls.ts +1 -1
- package/src/pm-plugins/utils/drag-menu.ts +1 -1
- package/src/pm-plugins/utils/merged-cells.ts +4 -4
- package/src/pm-plugins/utils/nodes.ts +3 -3
- package/src/pm-plugins/utils/row-controls.ts +2 -2
- package/src/pm-plugins/view-mode-sort/index.ts +2 -2
- package/src/pm-plugins/view-mode-sort/utils.ts +3 -1
- package/src/tablePlugin.tsx +3 -10
- package/src/tablePluginType.ts +0 -1
- package/src/ui/DragPreview/index.tsx +4 -3
- package/src/ui/FloatingContextualButton/index.tsx +1 -2
- package/src/ui/FloatingContextualMenu/ContextualMenu.tsx +4 -6
- package/src/ui/FloatingDragMenu/DragMenu.tsx +4 -4
- package/src/ui/FloatingDragMenu/DropdownMenu.tsx +2 -2
- package/src/ui/TableFloatingColumnControls/ColumnControls/index.tsx +1 -1
- package/src/ui/TableFloatingColumnControls/index.tsx +1 -1
- package/src/ui/TableFullWidthLabel/index.tsx +1 -0
- package/src/ui/event-handlers.ts +19 -1
- package/src/ui/toolbar.tsx +1 -11
- package/tsconfig.app.json +0 -1
- package/tsconfig.dev.json +0 -1
|
@@ -60,8 +60,8 @@ export const tablesHaveDifferentColumnWidths = (
|
|
|
60
60
|
currentTable: PmNode,
|
|
61
61
|
previousTable: PmNode,
|
|
62
62
|
): boolean => {
|
|
63
|
-
|
|
64
|
-
|
|
63
|
+
const currentTableWidths = getTableWidths(currentTable);
|
|
64
|
+
const previousTableWidths = getTableWidths(previousTable);
|
|
65
65
|
|
|
66
66
|
if (currentTableWidths.length !== previousTableWidths.length) {
|
|
67
67
|
return true;
|
|
@@ -115,7 +115,7 @@ function getTableWidths(node: PmNode): number[] {
|
|
|
115
115
|
return [];
|
|
116
116
|
}
|
|
117
117
|
|
|
118
|
-
|
|
118
|
+
const tableWidths: Array<number> = [];
|
|
119
119
|
node.content.firstChild.content.forEach((cell) => {
|
|
120
120
|
if (Array.isArray(cell.attrs.colwidth)) {
|
|
121
121
|
const colspan = cell.attrs.colspan || 1;
|
|
@@ -148,8 +148,8 @@ export const copyPreviousRow =
|
|
|
148
148
|
offsetNextLineIndexPosition + map.width,
|
|
149
149
|
);
|
|
150
150
|
|
|
151
|
-
|
|
152
|
-
|
|
151
|
+
const cells = [] as PMNode[];
|
|
152
|
+
const fixRowspans: { pos: number; node: PMNode }[] = [];
|
|
153
153
|
for (let i = 0; i < cellsPositionsInOriginalRow.length; ) {
|
|
154
154
|
const pos = cellsPositionsInOriginalRow[i];
|
|
155
155
|
const documentCellPos = pos + table.start;
|
|
@@ -53,8 +53,8 @@ export const createPlugin = (
|
|
|
53
53
|
|
|
54
54
|
const sortMeta = tr.getMeta('tableSortMeta');
|
|
55
55
|
|
|
56
|
-
|
|
57
|
-
|
|
56
|
+
const hoverTableMeta = tr.getMeta('mouseEnterTable');
|
|
57
|
+
const removeTableMeta = tr.getMeta('removeTable');
|
|
58
58
|
let tableId = '';
|
|
59
59
|
|
|
60
60
|
// Remove the table from the state
|
|
@@ -66,7 +66,7 @@ export const toggleSort = (view: EditorView, event: Event, pluginState: TableSor
|
|
|
66
66
|
if (widget?.classList.contains(IS_DISABLED_CLASS_NAME) || !widget) {
|
|
67
67
|
return;
|
|
68
68
|
}
|
|
69
|
-
|
|
69
|
+
const dataSortIndex = target
|
|
70
70
|
?.closest('.ProseMirror-widget')
|
|
71
71
|
?.getAttribute(SORT_INDEX_DATA_ATTRIBUTE);
|
|
72
72
|
const tr = view.state.tr;
|
|
@@ -82,6 +82,8 @@ export const toggleSort = (view: EditorView, event: Event, pluginState: TableSor
|
|
|
82
82
|
return;
|
|
83
83
|
}
|
|
84
84
|
|
|
85
|
+
// Ignored via go/ees005
|
|
86
|
+
// eslint-disable-next-line prefer-const
|
|
85
87
|
let { index, direction, order: oldOrder } = pluginState?.[tableId] || {};
|
|
86
88
|
|
|
87
89
|
// Unsort if there was already a sort
|
package/src/tablePlugin.tsx
CHANGED
|
@@ -315,14 +315,9 @@ const tablesPlugin: TablePlugin = ({ config: options, api }) => {
|
|
|
315
315
|
{
|
|
316
316
|
name: 'tablePMColResizing',
|
|
317
317
|
plugin: ({ dispatch, nodeViewPortalProviderAPI }) => {
|
|
318
|
-
const {
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
getEditorFeatureFlags,
|
|
322
|
-
isTableScalingEnabled,
|
|
323
|
-
isNewColumnResizingEnabled,
|
|
324
|
-
} = options || ({} as TablePluginOptions);
|
|
325
|
-
const { allowColumnResizing, allowTableAlignment } = pluginConfig(tableOptions);
|
|
318
|
+
const { fullWidthEnabled, tableOptions, getEditorFeatureFlags, isTableScalingEnabled } =
|
|
319
|
+
options || ({} as TablePluginOptions);
|
|
320
|
+
const { allowColumnResizing } = pluginConfig(tableOptions);
|
|
326
321
|
return allowColumnResizing
|
|
327
322
|
? createFlexiResizingPlugin(
|
|
328
323
|
dispatch,
|
|
@@ -335,8 +330,6 @@ const tablesPlugin: TablePlugin = ({ config: options, api }) => {
|
|
|
335
330
|
nodeViewPortalProviderAPI,
|
|
336
331
|
editorAnalyticsAPI,
|
|
337
332
|
isTableScalingEnabled || false,
|
|
338
|
-
isNewColumnResizingEnabled,
|
|
339
|
-
allowTableAlignment,
|
|
340
333
|
!!options?.isCommentEditor,
|
|
341
334
|
)
|
|
342
335
|
: undefined;
|
package/src/tablePluginType.ts
CHANGED
|
@@ -22,9 +22,9 @@ export const DragPreview = ({
|
|
|
22
22
|
width: number;
|
|
23
23
|
height: number;
|
|
24
24
|
}) => {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
25
|
+
const marginLeft = direction === 'row' ? -14 : width / 2 - 14;
|
|
26
|
+
const marginTop = direction === 'row' ? height / 2 - 14 : -10;
|
|
27
|
+
const transform = direction === 'row' ? 'rotate(90deg)' : 'none';
|
|
28
28
|
return (
|
|
29
29
|
<Box
|
|
30
30
|
xcss={boxStyles}
|
|
@@ -41,6 +41,7 @@ export const DragPreview = ({
|
|
|
41
41
|
marginLeft: `${marginLeft}px`,
|
|
42
42
|
// eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage/preview
|
|
43
43
|
marginTop: `${marginTop}px`,
|
|
44
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop
|
|
44
45
|
transform: transform,
|
|
45
46
|
}}
|
|
46
47
|
/>
|
|
@@ -74,8 +74,7 @@ const FloatingContextualButtonInner = React.memo((props: Props & WrappedComponen
|
|
|
74
74
|
};
|
|
75
75
|
|
|
76
76
|
const domAtPos = editorView.domAtPos.bind(editorView);
|
|
77
|
-
|
|
78
|
-
targetCellRef = findDomRefAtPos(targetCellPosition, domAtPos);
|
|
77
|
+
const targetCellRef: Node | undefined = findDomRefAtPos(targetCellPosition, domAtPos);
|
|
79
78
|
|
|
80
79
|
useEffect(() => {
|
|
81
80
|
if (isCellMenuOpenByKeyboard && !isContextualMenuOpen) {
|
|
@@ -230,8 +230,6 @@ export class ContextualMenu extends Component<Props & WrappedComponentProps, Sta
|
|
|
230
230
|
if (allowBackgroundColor) {
|
|
231
231
|
const node = isOpen && targetCellPosition ? state.doc.nodeAt(targetCellPosition) : null;
|
|
232
232
|
const background = hexToEditorBackgroundPaletteColor(node?.attrs?.background || '#ffffff');
|
|
233
|
-
let selectedRowIndex;
|
|
234
|
-
let selectedColumnIndex;
|
|
235
233
|
|
|
236
234
|
const selectedRowAndColumnFromPalette = getSelectedRowAndColumnFromPalette(
|
|
237
235
|
cellBackgroundColorPalette,
|
|
@@ -240,8 +238,8 @@ export class ContextualMenu extends Component<Props & WrappedComponentProps, Sta
|
|
|
240
238
|
background!,
|
|
241
239
|
colorPalletteColumns,
|
|
242
240
|
);
|
|
243
|
-
selectedRowIndex = selectedRowAndColumnFromPalette.selectedRowIndex;
|
|
244
|
-
selectedColumnIndex = selectedRowAndColumnFromPalette.selectedColumnIndex;
|
|
241
|
+
const selectedRowIndex = selectedRowAndColumnFromPalette.selectedRowIndex;
|
|
242
|
+
const selectedColumnIndex = selectedRowAndColumnFromPalette.selectedColumnIndex;
|
|
245
243
|
return {
|
|
246
244
|
content: isDragAndDropEnabled
|
|
247
245
|
? formatMessage(messages.backgroundColor)
|
|
@@ -590,7 +588,7 @@ export class ContextualMenu extends Component<Props & WrappedComponentProps, Sta
|
|
|
590
588
|
};
|
|
591
589
|
|
|
592
590
|
private createOriginalContextMenuItems = () => {
|
|
593
|
-
|
|
591
|
+
const items: MenuItem[] = [];
|
|
594
592
|
const sortColumnItems = this.createSortColumnItems();
|
|
595
593
|
const backgroundColorItem = this.createBackgroundColorItem();
|
|
596
594
|
const distributeColumnsItem = this.createDistributeColumnsItem();
|
|
@@ -626,7 +624,7 @@ export class ContextualMenu extends Component<Props & WrappedComponentProps, Sta
|
|
|
626
624
|
const deleteRowItem = this.createDeleteRowItem();
|
|
627
625
|
|
|
628
626
|
// Group items so when table.menu.group-items FF is enabled, a divider shows under split cell, above add column
|
|
629
|
-
|
|
627
|
+
const items: { items: MenuItem[] }[] = [
|
|
630
628
|
{
|
|
631
629
|
items: [],
|
|
632
630
|
},
|
|
@@ -165,7 +165,7 @@ const MapDragMenuOptionIdToMessage: Record<DragMenuOptionIdType, MessageType> =
|
|
|
165
165
|
};
|
|
166
166
|
|
|
167
167
|
const getGroupedDragMenuConfig = () => {
|
|
168
|
-
|
|
168
|
+
const groupedDragMenuConfig: DragMenuOptionIdType[][] = [
|
|
169
169
|
[
|
|
170
170
|
'add_row_above',
|
|
171
171
|
'add_row_below',
|
|
@@ -195,8 +195,8 @@ const convertToDropdownItems = (
|
|
|
195
195
|
selectionRect?: Rect,
|
|
196
196
|
) => {
|
|
197
197
|
const groupedDragMenuConfig = getGroupedDragMenuConfig();
|
|
198
|
-
|
|
199
|
-
|
|
198
|
+
const menuItemsArr: MenuItem[][] = [...Array(groupedDragMenuConfig.length)].map(() => []);
|
|
199
|
+
const menuCallback: { [key: string]: Command } = {};
|
|
200
200
|
dragMenuConfig.forEach((item) => {
|
|
201
201
|
const menuGroupIndex = groupedDragMenuConfig.findIndex((group) => group.includes(item.id));
|
|
202
202
|
|
|
@@ -497,7 +497,7 @@ const DragMenu = React.memo(
|
|
|
497
497
|
* @returns true when the menu should be closed, false otherwise
|
|
498
498
|
*/
|
|
499
499
|
const shouldCloseMenu = (state: EditorState) => {
|
|
500
|
-
|
|
500
|
+
const {
|
|
501
501
|
isDragMenuOpen: previousOpenState,
|
|
502
502
|
dragMenuDirection: previousDragMenuDirection,
|
|
503
503
|
dragMenuIndex: previousDragMenuIndex,
|
|
@@ -72,8 +72,8 @@ export const DropdownMenu = ({
|
|
|
72
72
|
};
|
|
73
73
|
|
|
74
74
|
// more offsets calculation as offsets depend on the direction and updated placement here
|
|
75
|
-
|
|
76
|
-
|
|
75
|
+
const offsetY = direction === 'row' ? (popupPlacement[0] === 'bottom' ? -8 : -34) : 0;
|
|
76
|
+
const offsetX = direction === 'column' ? (popupPlacement[1] === 'left' ? 0 : -7) : 0;
|
|
77
77
|
|
|
78
78
|
const innerMenu = () => {
|
|
79
79
|
return (
|
|
@@ -98,7 +98,7 @@ export const ColumnControls = ({
|
|
|
98
98
|
const hasHeaderRow = firstRow ? firstRow.getAttribute('data-header-row') : false;
|
|
99
99
|
|
|
100
100
|
const rowControlStickyTop = fg('platform_editor_breakout_use_css') ? 45 : rowHeights?.[0];
|
|
101
|
-
const marginTop = hasHeaderRow && stickyTop !== undefined ?
|
|
101
|
+
const marginTop = hasHeaderRow && stickyTop !== undefined ? rowControlStickyTop ?? 0 : 0;
|
|
102
102
|
|
|
103
103
|
const handleClick = useCallback(
|
|
104
104
|
(event: MouseEvent) => {
|
|
@@ -102,7 +102,7 @@ const TableFloatingColumnControls = ({
|
|
|
102
102
|
|
|
103
103
|
if (stickyTop) {
|
|
104
104
|
const columnControlTopOffsetFromParent = '-12px';
|
|
105
|
-
const headerRowHeight = hasHeaderRow && stickyTop !== undefined ?
|
|
105
|
+
const headerRowHeight = hasHeaderRow && stickyTop !== undefined ? rowHeights?.[0] ?? 0 : 0;
|
|
106
106
|
containerRef?.current?.style.setProperty(
|
|
107
107
|
'top',
|
|
108
108
|
fg('platform_editor_breakout_use_css')
|
|
@@ -12,6 +12,7 @@ const tableFullWidthLabelWrapperStyles = xcss({
|
|
|
12
12
|
backgroundColor: 'elevation.surface.overlay',
|
|
13
13
|
borderRadius: 'border.radius',
|
|
14
14
|
boxShadow: 'elevation.shadow.overlay',
|
|
15
|
+
// eslint-disable-next-line @atlaskit/design-system/use-tokens-typography
|
|
15
16
|
lineHeight: 1,
|
|
16
17
|
boxSizing: 'border-box',
|
|
17
18
|
alignItems: 'center',
|
package/src/ui/event-handlers.ts
CHANGED
|
@@ -2,6 +2,7 @@ import rafSchedule from 'raf-schd';
|
|
|
2
2
|
|
|
3
3
|
import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
|
|
4
4
|
import { ACTION_SUBJECT, EVENT_TYPE, TABLE_ACTION } from '@atlaskit/editor-common/analytics';
|
|
5
|
+
import { getParentOfTypeCount } from '@atlaskit/editor-common/nesting';
|
|
5
6
|
import { type PortalProviderAPI } from '@atlaskit/editor-common/portal';
|
|
6
7
|
import {
|
|
7
8
|
browser,
|
|
@@ -13,6 +14,7 @@ import {
|
|
|
13
14
|
import type { Node as PmNode } from '@atlaskit/editor-prosemirror/model';
|
|
14
15
|
import type { EditorState, Transaction } from '@atlaskit/editor-prosemirror/state';
|
|
15
16
|
import { Selection, TextSelection } from '@atlaskit/editor-prosemirror/state';
|
|
17
|
+
import { findParentNodeOfTypeClosestToPos } from '@atlaskit/editor-prosemirror/utils';
|
|
16
18
|
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
17
19
|
import { CellSelection } from '@atlaskit/editor-tables/cell-selection';
|
|
18
20
|
import { TableMap } from '@atlaskit/editor-tables/table-map';
|
|
@@ -224,7 +226,23 @@ export const handleMouseOver = (view: EditorView, mouseEvent: Event): boolean =>
|
|
|
224
226
|
return hoverColumns([startIndex], false)(state, dispatch);
|
|
225
227
|
}
|
|
226
228
|
|
|
227
|
-
|
|
229
|
+
const isNestedTable = getParentOfTypeCount(state.schema.nodes.table)(state.selection.$from) > 1;
|
|
230
|
+
|
|
231
|
+
if (isNestedTable) {
|
|
232
|
+
// if the table is nested inside a table, we only call hideInsertColumnOrRowButton if the table nearest to the mouse target is NOT the parent table
|
|
233
|
+
const nearestTable = closestElement(target, 'table');
|
|
234
|
+
const nestedTable = findParentNodeOfTypeClosestToPos(state.doc.resolve(state.selection.from), [
|
|
235
|
+
state.schema.nodes.table,
|
|
236
|
+
]);
|
|
237
|
+
|
|
238
|
+
const parentTable = findParentNodeOfTypeClosestToPos(state.doc.resolve(nestedTable?.pos || 0), [
|
|
239
|
+
state.schema.nodes.table,
|
|
240
|
+
]);
|
|
241
|
+
|
|
242
|
+
if (nearestTable?.dataset.tableLocalId !== parentTable?.node.attrs.localId) {
|
|
243
|
+
return hideInsertColumnOrRowButton()(state, dispatch);
|
|
244
|
+
}
|
|
245
|
+
} else if (
|
|
228
246
|
(isCell(target) || isCornerButton(target)) &&
|
|
229
247
|
(typeof insertColumnButtonIndex === 'number' || typeof insertRowButtonIndex === 'number')
|
|
230
248
|
) {
|
package/src/ui/toolbar.tsx
CHANGED
|
@@ -501,17 +501,7 @@ export const getToolbarConfig =
|
|
|
501
501
|
// We don't want to show floating toolbar while resizing the table
|
|
502
502
|
const isWidthResizing = tableWidthState?.resizing;
|
|
503
503
|
|
|
504
|
-
|
|
505
|
-
const shouldHideToolbarForInternalColumnWidth = Boolean(
|
|
506
|
-
options?.isNewColumnResizingEnabled && resizeState && resizeState.dragging,
|
|
507
|
-
);
|
|
508
|
-
|
|
509
|
-
if (
|
|
510
|
-
tableObject &&
|
|
511
|
-
pluginState.editorHasFocus &&
|
|
512
|
-
!isWidthResizing &&
|
|
513
|
-
!shouldHideToolbarForInternalColumnWidth
|
|
514
|
-
) {
|
|
504
|
+
if (tableObject && pluginState.editorHasFocus && !isWidthResizing) {
|
|
515
505
|
const nodeType = state.schema.nodes.table;
|
|
516
506
|
const isNested = pluginState.tablePos && isTableNested(state, pluginState.tablePos);
|
|
517
507
|
const isTableScalingWithFixedColumnWidthsOptionShown =
|
package/tsconfig.app.json
CHANGED