@atlaskit/editor-plugin-table 7.4.9 → 7.5.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 +12 -0
- package/dist/cjs/commands/column-resize.js +4 -2
- package/dist/cjs/commands/delete.js +2 -1
- package/dist/cjs/commands/insert.js +6 -3
- package/dist/cjs/commands-with-analytics.js +4 -2
- package/dist/cjs/event-handlers.js +2 -1
- package/dist/cjs/nodeviews/TableComponent.js +116 -47
- package/dist/cjs/nodeviews/TableContainer.js +8 -4
- package/dist/cjs/nodeviews/TableResizer.js +6 -5
- package/dist/cjs/nodeviews/table.js +12 -4
- package/dist/cjs/plugin.js +50 -47
- package/dist/cjs/pm-plugins/drag-and-drop/plugin.js +9 -6
- package/dist/cjs/pm-plugins/keymap.js +6 -3
- package/dist/cjs/pm-plugins/main.js +4 -1
- package/dist/cjs/pm-plugins/table-resizing/event-handlers.js +7 -3
- package/dist/cjs/pm-plugins/table-resizing/utils/colgroup.js +32 -11
- package/dist/cjs/pm-plugins/table-resizing/utils/consts.js +4 -2
- package/dist/cjs/pm-plugins/table-resizing/utils/index.js +24 -0
- package/dist/cjs/pm-plugins/table-resizing/utils/misc.js +20 -1
- package/dist/cjs/pm-plugins/table-resizing/utils/resize-column.js +2 -1
- package/dist/cjs/pm-plugins/table-resizing/utils/resize-state.js +52 -11
- package/dist/cjs/pm-plugins/table-resizing/utils/scale-table.js +19 -8
- package/dist/cjs/toolbar.js +17 -10
- package/dist/cjs/transforms/column-width.js +22 -7
- package/dist/cjs/transforms/delete-columns.js +2 -1
- package/dist/cjs/ui/FloatingContextualMenu/ContextualMenu.js +45 -38
- package/dist/cjs/ui/FloatingContextualMenu/index.js +4 -2
- package/dist/cjs/ui/FloatingDragMenu/DragMenu.js +3 -2
- package/dist/cjs/ui/FloatingDragMenu/index.js +7 -2
- package/dist/cjs/ui/FloatingInsertButton/index.js +5 -1
- package/dist/cjs/utils/create.js +1 -1
- package/dist/cjs/utils/drag-menu.js +4 -3
- package/dist/es2019/commands/column-resize.js +4 -3
- package/dist/es2019/commands/delete.js +2 -2
- package/dist/es2019/commands/insert.js +6 -6
- package/dist/es2019/commands-with-analytics.js +4 -4
- package/dist/es2019/event-handlers.js +2 -2
- package/dist/es2019/nodeviews/TableComponent.js +77 -8
- package/dist/es2019/nodeviews/TableContainer.js +8 -4
- package/dist/es2019/nodeviews/TableResizer.js +6 -5
- package/dist/es2019/nodeviews/table.js +12 -4
- package/dist/es2019/plugin.js +14 -8
- package/dist/es2019/pm-plugins/drag-and-drop/plugin.js +7 -4
- package/dist/es2019/pm-plugins/keymap.js +6 -3
- package/dist/es2019/pm-plugins/main.js +4 -1
- package/dist/es2019/pm-plugins/table-resizing/event-handlers.js +7 -3
- package/dist/es2019/pm-plugins/table-resizing/utils/colgroup.js +31 -12
- package/dist/es2019/pm-plugins/table-resizing/utils/consts.js +3 -1
- package/dist/es2019/pm-plugins/table-resizing/utils/index.js +2 -2
- package/dist/es2019/pm-plugins/table-resizing/utils/misc.js +20 -2
- package/dist/es2019/pm-plugins/table-resizing/utils/resize-column.js +2 -2
- package/dist/es2019/pm-plugins/table-resizing/utils/resize-state.js +47 -10
- package/dist/es2019/pm-plugins/table-resizing/utils/scale-table.js +19 -12
- package/dist/es2019/toolbar.js +15 -12
- package/dist/es2019/transforms/column-width.js +24 -10
- package/dist/es2019/transforms/delete-columns.js +2 -2
- package/dist/es2019/ui/FloatingContextualMenu/ContextualMenu.js +12 -5
- package/dist/es2019/ui/FloatingContextualMenu/index.js +4 -2
- package/dist/es2019/ui/FloatingDragMenu/DragMenu.js +3 -2
- package/dist/es2019/ui/FloatingDragMenu/index.js +7 -2
- package/dist/es2019/ui/FloatingInsertButton/index.js +5 -1
- package/dist/es2019/utils/create.js +1 -1
- package/dist/es2019/utils/drag-menu.js +4 -4
- package/dist/esm/commands/column-resize.js +4 -2
- package/dist/esm/commands/delete.js +2 -1
- package/dist/esm/commands/insert.js +6 -3
- package/dist/esm/commands-with-analytics.js +4 -2
- package/dist/esm/event-handlers.js +2 -1
- package/dist/esm/nodeviews/TableComponent.js +118 -49
- package/dist/esm/nodeviews/TableContainer.js +8 -4
- package/dist/esm/nodeviews/TableResizer.js +6 -5
- package/dist/esm/nodeviews/table.js +12 -4
- package/dist/esm/plugin.js +50 -47
- package/dist/esm/pm-plugins/drag-and-drop/plugin.js +9 -6
- package/dist/esm/pm-plugins/keymap.js +6 -3
- package/dist/esm/pm-plugins/main.js +4 -1
- package/dist/esm/pm-plugins/table-resizing/event-handlers.js +7 -3
- package/dist/esm/pm-plugins/table-resizing/utils/colgroup.js +32 -11
- package/dist/esm/pm-plugins/table-resizing/utils/consts.js +3 -1
- package/dist/esm/pm-plugins/table-resizing/utils/index.js +2 -2
- package/dist/esm/pm-plugins/table-resizing/utils/misc.js +22 -2
- package/dist/esm/pm-plugins/table-resizing/utils/resize-column.js +2 -1
- package/dist/esm/pm-plugins/table-resizing/utils/resize-state.js +52 -11
- package/dist/esm/pm-plugins/table-resizing/utils/scale-table.js +19 -8
- package/dist/esm/toolbar.js +17 -10
- package/dist/esm/transforms/column-width.js +23 -8
- package/dist/esm/transforms/delete-columns.js +2 -1
- package/dist/esm/ui/FloatingContextualMenu/ContextualMenu.js +45 -38
- package/dist/esm/ui/FloatingContextualMenu/index.js +4 -2
- package/dist/esm/ui/FloatingDragMenu/DragMenu.js +3 -2
- package/dist/esm/ui/FloatingDragMenu/index.js +7 -2
- package/dist/esm/ui/FloatingInsertButton/index.js +5 -1
- package/dist/esm/utils/create.js +1 -1
- package/dist/esm/utils/drag-menu.js +4 -3
- package/dist/types/commands/column-resize.d.ts +1 -1
- package/dist/types/commands/delete.d.ts +1 -1
- package/dist/types/commands/insert.d.ts +3 -3
- package/dist/types/commands-with-analytics.d.ts +2 -2
- package/dist/types/event-handlers.d.ts +1 -1
- package/dist/types/nodeviews/TableComponent.d.ts +3 -0
- package/dist/types/nodeviews/TableContainer.d.ts +4 -2
- package/dist/types/nodeviews/TableResizer.d.ts +2 -1
- package/dist/types/nodeviews/table.d.ts +1 -0
- package/dist/types/pm-plugins/drag-and-drop/plugin.d.ts +3 -2
- package/dist/types/pm-plugins/keymap.d.ts +2 -2
- package/dist/types/pm-plugins/table-resizing/utils/colgroup.d.ts +2 -2
- package/dist/types/pm-plugins/table-resizing/utils/consts.d.ts +2 -0
- package/dist/types/pm-plugins/table-resizing/utils/index.d.ts +2 -2
- package/dist/types/pm-plugins/table-resizing/utils/misc.d.ts +7 -0
- package/dist/types/pm-plugins/table-resizing/utils/resize-column.d.ts +1 -1
- package/dist/types/pm-plugins/table-resizing/utils/resize-state.d.ts +4 -3
- package/dist/types/pm-plugins/table-resizing/utils/scale-table.d.ts +4 -4
- package/dist/types/toolbar.d.ts +2 -2
- package/dist/types/transforms/column-width.d.ts +1 -1
- package/dist/types/transforms/delete-columns.d.ts +1 -1
- package/dist/types/ui/FloatingContextualMenu/ContextualMenu.d.ts +2 -1
- package/dist/types/ui/FloatingContextualMenu/index.d.ts +1 -1
- package/dist/types/ui/FloatingDragMenu/DragMenu.d.ts +2 -1
- package/dist/types/ui/FloatingDragMenu/index.d.ts +3 -2
- package/dist/types/ui/FloatingInsertButton/index.d.ts +2 -1
- package/dist/types/utils/drag-menu.d.ts +1 -1
- package/dist/types-ts4.5/commands/column-resize.d.ts +1 -1
- package/dist/types-ts4.5/commands/delete.d.ts +1 -1
- package/dist/types-ts4.5/commands/insert.d.ts +3 -3
- package/dist/types-ts4.5/commands-with-analytics.d.ts +2 -2
- package/dist/types-ts4.5/event-handlers.d.ts +1 -1
- package/dist/types-ts4.5/nodeviews/TableComponent.d.ts +3 -0
- package/dist/types-ts4.5/nodeviews/TableContainer.d.ts +4 -2
- package/dist/types-ts4.5/nodeviews/TableResizer.d.ts +2 -1
- package/dist/types-ts4.5/nodeviews/table.d.ts +1 -0
- package/dist/types-ts4.5/pm-plugins/drag-and-drop/plugin.d.ts +3 -2
- package/dist/types-ts4.5/pm-plugins/keymap.d.ts +2 -2
- package/dist/types-ts4.5/pm-plugins/table-resizing/utils/colgroup.d.ts +2 -2
- package/dist/types-ts4.5/pm-plugins/table-resizing/utils/consts.d.ts +2 -0
- package/dist/types-ts4.5/pm-plugins/table-resizing/utils/index.d.ts +2 -2
- package/dist/types-ts4.5/pm-plugins/table-resizing/utils/misc.d.ts +7 -0
- package/dist/types-ts4.5/pm-plugins/table-resizing/utils/resize-column.d.ts +1 -1
- package/dist/types-ts4.5/pm-plugins/table-resizing/utils/resize-state.d.ts +4 -3
- package/dist/types-ts4.5/pm-plugins/table-resizing/utils/scale-table.d.ts +4 -4
- package/dist/types-ts4.5/toolbar.d.ts +2 -2
- package/dist/types-ts4.5/transforms/column-width.d.ts +1 -1
- package/dist/types-ts4.5/transforms/delete-columns.d.ts +1 -1
- package/dist/types-ts4.5/ui/FloatingContextualMenu/ContextualMenu.d.ts +2 -1
- package/dist/types-ts4.5/ui/FloatingContextualMenu/index.d.ts +1 -1
- package/dist/types-ts4.5/ui/FloatingDragMenu/DragMenu.d.ts +2 -1
- package/dist/types-ts4.5/ui/FloatingDragMenu/index.d.ts +3 -2
- package/dist/types-ts4.5/ui/FloatingInsertButton/index.d.ts +2 -1
- package/dist/types-ts4.5/utils/drag-menu.d.ts +1 -1
- package/docs/0-intro.tsx +3 -2
- package/package.json +2 -2
- package/src/commands/column-resize.ts +3 -0
- package/src/commands/delete.ts +2 -1
- package/src/commands/insert.ts +15 -6
- package/src/commands-with-analytics.ts +9 -3
- package/src/event-handlers.ts +2 -0
- package/src/nodeviews/TableComponent.tsx +91 -5
- package/src/nodeviews/TableContainer.tsx +7 -1
- package/src/nodeviews/TableResizer.tsx +7 -1
- package/src/nodeviews/table.tsx +15 -10
- package/src/plugin.tsx +17 -5
- package/src/pm-plugins/drag-and-drop/plugin.ts +16 -8
- package/src/pm-plugins/keymap.ts +11 -3
- package/src/pm-plugins/main.ts +3 -0
- package/src/pm-plugins/table-resizing/event-handlers.ts +11 -1
- package/src/pm-plugins/table-resizing/utils/colgroup.ts +49 -17
- package/src/pm-plugins/table-resizing/utils/consts.ts +2 -0
- package/src/pm-plugins/table-resizing/utils/index.ts +8 -1
- package/src/pm-plugins/table-resizing/utils/misc.ts +25 -1
- package/src/pm-plugins/table-resizing/utils/resize-column.ts +2 -1
- package/src/pm-plugins/table-resizing/utils/resize-state.ts +56 -11
- package/src/pm-plugins/table-resizing/utils/scale-table.ts +24 -6
- package/src/toolbar.tsx +18 -5
- package/src/transforms/column-width.ts +33 -11
- package/src/transforms/delete-columns.ts +7 -2
- package/src/ui/FloatingContextualMenu/ContextualMenu.tsx +20 -5
- package/src/ui/FloatingContextualMenu/index.tsx +2 -0
- package/src/ui/FloatingDragMenu/DragMenu.tsx +3 -0
- package/src/ui/FloatingDragMenu/index.tsx +9 -1
- package/src/ui/FloatingInsertButton/index.tsx +17 -5
- package/src/ui/TableFloatingColumnControls/ColumnControls/index.tsx +4 -1
- package/src/ui/TableFloatingControls/RowControls/DragControls.tsx +4 -1
- package/src/utils/create.ts +1 -3
- package/src/utils/drag-menu.ts +4 -1
- package/tsconfig.dev.json +1 -1
|
@@ -24,8 +24,9 @@ type DragMenuProps = {
|
|
|
24
24
|
mountPoint?: HTMLElement;
|
|
25
25
|
boundariesElement?: HTMLElement;
|
|
26
26
|
scrollableElement?: HTMLElement;
|
|
27
|
+
tablePreserveWidth?: boolean;
|
|
27
28
|
};
|
|
28
|
-
export declare const DragMenu: React.MemoExoticComponent<({ direction, index, target, isOpen, editorView, tableNode, targetCellPosition, getEditorContainerWidth, editorAnalyticsAPI, pluginConfig, intl: { formatMessage }, fitHeight, fitWidth, mountPoint, scrollableElement, boundariesElement, }: DragMenuProps & WrappedComponentProps) => jsx.JSX.Element | null>;
|
|
29
|
+
export declare const DragMenu: React.MemoExoticComponent<({ direction, index, target, isOpen, editorView, tableNode, targetCellPosition, getEditorContainerWidth, editorAnalyticsAPI, pluginConfig, intl: { formatMessage }, fitHeight, fitWidth, mountPoint, scrollableElement, boundariesElement, tablePreserveWidth, }: DragMenuProps & WrappedComponentProps) => jsx.JSX.Element | null>;
|
|
29
30
|
declare const _default: React.FC<import("react-intl-next").WithIntlProps<DragMenuProps & WrappedComponentProps<"intl">>> & {
|
|
30
31
|
WrappedComponent: React.ComponentType<DragMenuProps & WrappedComponentProps<"intl">>;
|
|
31
32
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
|
|
3
|
-
import type { GetEditorContainerWidth } from '@atlaskit/editor-common/types';
|
|
3
|
+
import type { GetEditorContainerWidth, GetEditorFeatureFlags } from '@atlaskit/editor-common/types';
|
|
4
4
|
import type { Node as PmNode } from '@atlaskit/editor-prosemirror/model';
|
|
5
5
|
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
6
6
|
import type { RowStickyState } from '../../pm-plugins/sticky-headers';
|
|
@@ -20,9 +20,10 @@ export interface Props {
|
|
|
20
20
|
editorAnalyticsAPI?: EditorAnalyticsAPI;
|
|
21
21
|
stickyHeaders?: RowStickyState;
|
|
22
22
|
pluginConfig?: PluginConfig;
|
|
23
|
+
getEditorFeatureFlags: GetEditorFeatureFlags;
|
|
23
24
|
}
|
|
24
25
|
declare const FloatingDragMenu: {
|
|
25
|
-
({ mountPoint, boundariesElement, scrollableElement, editorView, isOpen, tableNode, direction, index, targetCellPosition, getEditorContainerWidth, editorAnalyticsAPI, stickyHeaders, pluginConfig, }: Props): JSX.Element | null;
|
|
26
|
+
({ mountPoint, boundariesElement, scrollableElement, editorView, isOpen, tableNode, direction, index, targetCellPosition, getEditorContainerWidth, editorAnalyticsAPI, stickyHeaders, pluginConfig, getEditorFeatureFlags, }: Props): JSX.Element | null;
|
|
26
27
|
displayName: string;
|
|
27
28
|
};
|
|
28
29
|
export default FloatingDragMenu;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import type { WrappedComponentProps } from 'react-intl-next';
|
|
3
3
|
import type { DispatchAnalyticsEvent, EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
|
|
4
|
-
import type { GetEditorContainerWidth } from '@atlaskit/editor-common/types';
|
|
4
|
+
import type { GetEditorContainerWidth, GetEditorFeatureFlags } from '@atlaskit/editor-common/types';
|
|
5
5
|
import type { Node as PmNode } from '@atlaskit/editor-prosemirror/model';
|
|
6
6
|
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
7
7
|
export interface Props {
|
|
@@ -20,6 +20,7 @@ export interface Props {
|
|
|
20
20
|
hasStickyHeaders?: boolean;
|
|
21
21
|
dispatchAnalyticsEvent?: DispatchAnalyticsEvent;
|
|
22
22
|
editorAnalyticsAPI?: EditorAnalyticsAPI;
|
|
23
|
+
getEditorFeatureFlags?: GetEditorFeatureFlags;
|
|
23
24
|
}
|
|
24
25
|
export declare class FloatingInsertButton extends React.Component<Props & WrappedComponentProps, any> {
|
|
25
26
|
static displayName: string;
|
|
@@ -13,4 +13,4 @@ export interface DragMenuConfig extends DropdownOptionT<Command> {
|
|
|
13
13
|
icon?: React.ComponentType<IconProps>;
|
|
14
14
|
keymap?: string;
|
|
15
15
|
}
|
|
16
|
-
export declare const getDragMenuConfig: (direction: TableDirection, getEditorContainerWidth: GetEditorContainerWidth, canDrag: boolean, hasMergedCellsInTable: boolean, editorView: EditorView, tableMap?: TableMap, index?: number, targetCellPosition?: number, selectionRect?: Rect, editorAnalyticsAPI?: EditorAnalyticsAPI, isHeaderRowRequired?: boolean) => DragMenuConfig[];
|
|
16
|
+
export declare const getDragMenuConfig: (direction: TableDirection, getEditorContainerWidth: GetEditorContainerWidth, canDrag: boolean, hasMergedCellsInTable: boolean, editorView: EditorView, tableMap?: TableMap, index?: number, targetCellPosition?: number, selectionRect?: Rect, editorAnalyticsAPI?: EditorAnalyticsAPI, isHeaderRowRequired?: boolean, tablePreserveWidth?: boolean) => DragMenuConfig[];
|
package/docs/0-intro.tsx
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
|
|
3
3
|
import { AtlassianInternalWarning, code, md } from '@atlaskit/docs';
|
|
4
|
-
|
|
4
|
+
// eslint-disable-next-line @atlassian/tangerine/import/entry-points
|
|
5
|
+
import { createEditorUseOnlyNotice } from '@atlaskit/editor-common/doc-utils';
|
|
5
6
|
import { token } from '@atlaskit/tokens';
|
|
6
7
|
|
|
7
8
|
export default md`
|
|
@@ -23,7 +24,7 @@ ${createEditorUseOnlyNotice('Editor Plugin Table', [
|
|
|
23
24
|
---
|
|
24
25
|
|
|
25
26
|
The \`dependencies\`, \`configuration\`, \`state\`, \`actions\`, and \`commands\` of the plugin are defined
|
|
26
|
-
below:
|
|
27
|
+
below:
|
|
27
28
|
|
|
28
29
|
${code`
|
|
29
30
|
type TablePlugin = NextEditorPlugin<
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-table",
|
|
3
|
-
"version": "7.
|
|
3
|
+
"version": "7.5.1",
|
|
4
4
|
"description": "Table plugin for the @atlaskit/editor",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -145,4 +145,4 @@
|
|
|
145
145
|
"type": "boolean"
|
|
146
146
|
}
|
|
147
147
|
}
|
|
148
|
-
}
|
|
148
|
+
}
|
|
@@ -228,6 +228,7 @@ export const changeColumnWidthByStep =
|
|
|
228
228
|
(
|
|
229
229
|
stepSize: number,
|
|
230
230
|
getEditorContainerWidth: GetEditorContainerWidth,
|
|
231
|
+
tablePreserveWidth = false,
|
|
231
232
|
): Command =>
|
|
232
233
|
(state, dispatch, view) => {
|
|
233
234
|
let customTr = state.tr;
|
|
@@ -289,6 +290,7 @@ export const changeColumnWidthByStep =
|
|
|
289
290
|
tableRef: dom,
|
|
290
291
|
start: tableStartPosition,
|
|
291
292
|
domAtPos,
|
|
293
|
+
tablePreserveWidth,
|
|
292
294
|
});
|
|
293
295
|
|
|
294
296
|
updateControls()(state);
|
|
@@ -307,6 +309,7 @@ export const changeColumnWidthByStep =
|
|
|
307
309
|
stepSize,
|
|
308
310
|
dom,
|
|
309
311
|
resizingSelectedColumns ? selectedColumns : undefined,
|
|
312
|
+
tablePreserveWidth,
|
|
310
313
|
);
|
|
311
314
|
|
|
312
315
|
customTr = updateColumnWidths(
|
package/src/commands/delete.ts
CHANGED
|
@@ -5,12 +5,13 @@ import { deleteColumns } from '../transforms/delete-columns';
|
|
|
5
5
|
import { getAllowAddColumnCustomStep } from '../utils/get-allow-add-column-custom-step';
|
|
6
6
|
|
|
7
7
|
export const deleteColumnsCommand =
|
|
8
|
-
(rect: Rect): Command =>
|
|
8
|
+
(rect: Rect, tablePreserveWidth = false): Command =>
|
|
9
9
|
(state, dispatch, view) => {
|
|
10
10
|
const tr = deleteColumns(
|
|
11
11
|
rect,
|
|
12
12
|
getAllowAddColumnCustomStep(state),
|
|
13
13
|
view,
|
|
14
|
+
tablePreserveWidth,
|
|
14
15
|
)(state.tr);
|
|
15
16
|
if (dispatch) {
|
|
16
17
|
dispatch(tr);
|
package/src/commands/insert.ts
CHANGED
|
@@ -50,7 +50,10 @@ function addColumnAtCustomStep(column: number) {
|
|
|
50
50
|
};
|
|
51
51
|
}
|
|
52
52
|
|
|
53
|
-
export function addColumnAt(
|
|
53
|
+
export function addColumnAt(
|
|
54
|
+
getEditorContainerWidth: GetEditorContainerWidth,
|
|
55
|
+
tablePreserveWidth = false,
|
|
56
|
+
) {
|
|
54
57
|
return (
|
|
55
58
|
column: number,
|
|
56
59
|
allowAddColumnCustomStep: boolean = false,
|
|
@@ -66,7 +69,7 @@ export function addColumnAt(getEditorContainerWidth: GetEditorContainerWidth) {
|
|
|
66
69
|
const table = findTable(updatedTr.selection);
|
|
67
70
|
if (table) {
|
|
68
71
|
// [ED-8288] Update colwidths manually to avoid multiple dispatch in TableComponent
|
|
69
|
-
updatedTr = rescaleColumns()(table, view)(updatedTr);
|
|
72
|
+
updatedTr = rescaleColumns(tablePreserveWidth)(table, view)(updatedTr);
|
|
70
73
|
}
|
|
71
74
|
|
|
72
75
|
if (
|
|
@@ -91,7 +94,10 @@ export function addColumnAt(getEditorContainerWidth: GetEditorContainerWidth) {
|
|
|
91
94
|
// :: (EditorState, dispatch: ?(tr: Transaction)) → bool
|
|
92
95
|
// Command to add a column before the column with the selection.
|
|
93
96
|
export const addColumnBefore =
|
|
94
|
-
(
|
|
97
|
+
(
|
|
98
|
+
getEditorContainerWidth: GetEditorContainerWidth,
|
|
99
|
+
tablePreserveWidth = false,
|
|
100
|
+
): Command =>
|
|
95
101
|
(state, dispatch, view) => {
|
|
96
102
|
const table = findTable(state.selection);
|
|
97
103
|
if (!table) {
|
|
@@ -100,7 +106,7 @@ export const addColumnBefore =
|
|
|
100
106
|
if (dispatch) {
|
|
101
107
|
let rect = selectedRect(state);
|
|
102
108
|
dispatch(
|
|
103
|
-
addColumnAt(getEditorContainerWidth)(
|
|
109
|
+
addColumnAt(getEditorContainerWidth, tablePreserveWidth)(
|
|
104
110
|
rect.left,
|
|
105
111
|
getAllowAddColumnCustomStep(state),
|
|
106
112
|
view,
|
|
@@ -133,10 +139,13 @@ export const addColumnAfter =
|
|
|
133
139
|
};
|
|
134
140
|
|
|
135
141
|
export const insertColumn =
|
|
136
|
-
(
|
|
142
|
+
(
|
|
143
|
+
getEditorContainerWidth: GetEditorContainerWidth,
|
|
144
|
+
tablePreserveWidth = false,
|
|
145
|
+
) =>
|
|
137
146
|
(column: number): Command =>
|
|
138
147
|
(state, dispatch, view) => {
|
|
139
|
-
let tr = addColumnAt(getEditorContainerWidth)(
|
|
148
|
+
let tr = addColumnAt(getEditorContainerWidth, tablePreserveWidth)(
|
|
140
149
|
column,
|
|
141
150
|
getAllowAddColumnCustomStep(state),
|
|
142
151
|
view,
|
|
@@ -255,6 +255,7 @@ export const insertColumnWithAnalytics =
|
|
|
255
255
|
(
|
|
256
256
|
getEditorContainerWidth: GetEditorContainerWidth,
|
|
257
257
|
editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null,
|
|
258
|
+
tablePreserveWidth = false,
|
|
258
259
|
) =>
|
|
259
260
|
(
|
|
260
261
|
inputMethod:
|
|
@@ -281,7 +282,9 @@ export const insertColumnWithAnalytics =
|
|
|
281
282
|
},
|
|
282
283
|
eventType: EVENT_TYPE.TRACK,
|
|
283
284
|
};
|
|
284
|
-
})(editorAnalyticsAPI)(
|
|
285
|
+
})(editorAnalyticsAPI)(
|
|
286
|
+
insertColumn(getEditorContainerWidth, tablePreserveWidth)(position),
|
|
287
|
+
);
|
|
285
288
|
|
|
286
289
|
export const deleteRowsWithAnalytics =
|
|
287
290
|
(editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null) =>
|
|
@@ -320,7 +323,10 @@ export const deleteRowsWithAnalytics =
|
|
|
320
323
|
});
|
|
321
324
|
|
|
322
325
|
export const deleteColumnsWithAnalytics =
|
|
323
|
-
(
|
|
326
|
+
(
|
|
327
|
+
editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null,
|
|
328
|
+
tablePreserveWidth = false,
|
|
329
|
+
) =>
|
|
324
330
|
(
|
|
325
331
|
inputMethod:
|
|
326
332
|
| INPUT_METHOD.CONTEXT_MENU
|
|
@@ -347,7 +353,7 @@ export const deleteColumnsWithAnalytics =
|
|
|
347
353
|
},
|
|
348
354
|
eventType: EVENT_TYPE.TRACK,
|
|
349
355
|
};
|
|
350
|
-
})(editorAnalyticsAPI)(deleteColumnsCommand(rect));
|
|
356
|
+
})(editorAnalyticsAPI)(deleteColumnsCommand(rect, tablePreserveWidth));
|
|
351
357
|
|
|
352
358
|
export const deleteSelectedRowsOrColumnsWithAnalyticsViaShortcut =
|
|
353
359
|
(editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null): Command =>
|
package/src/event-handlers.ts
CHANGED
|
@@ -538,6 +538,7 @@ export const handleCut = (
|
|
|
538
538
|
newState: EditorState,
|
|
539
539
|
editorAnalyticsAPI?: EditorAnalyticsAPI,
|
|
540
540
|
editorView?: EditorView,
|
|
541
|
+
tablePreserveWidth = false,
|
|
541
542
|
): Transaction => {
|
|
542
543
|
const oldSelection = oldState.tr.selection;
|
|
543
544
|
let { tr } = newState;
|
|
@@ -594,6 +595,7 @@ export const handleCut = (
|
|
|
594
595
|
rect,
|
|
595
596
|
getAllowAddColumnCustomStep(oldState),
|
|
596
597
|
editorView,
|
|
598
|
+
tablePreserveWidth,
|
|
597
599
|
)(tr);
|
|
598
600
|
}
|
|
599
601
|
}
|
|
@@ -22,7 +22,11 @@ import type {
|
|
|
22
22
|
EditorContainerWidth,
|
|
23
23
|
GetEditorFeatureFlags,
|
|
24
24
|
} from '@atlaskit/editor-common/types';
|
|
25
|
-
import {
|
|
25
|
+
import {
|
|
26
|
+
browser,
|
|
27
|
+
calcTableColumnWidths,
|
|
28
|
+
isValidPosition,
|
|
29
|
+
} from '@atlaskit/editor-common/utils';
|
|
26
30
|
import type { Node as PmNode } from '@atlaskit/editor-prosemirror/model';
|
|
27
31
|
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
28
32
|
import {
|
|
@@ -47,9 +51,12 @@ import {
|
|
|
47
51
|
} from '../pm-plugins/sticky-headers';
|
|
48
52
|
import { META_KEYS } from '../pm-plugins/table-analytics';
|
|
49
53
|
import {
|
|
54
|
+
COLUMN_MIN_WIDTH,
|
|
50
55
|
getLayoutSize,
|
|
51
|
-
|
|
56
|
+
getResizeState,
|
|
57
|
+
insertColgroupFromNode,
|
|
52
58
|
scaleTable,
|
|
59
|
+
updateColgroup,
|
|
53
60
|
} from '../pm-plugins/table-resizing/utils';
|
|
54
61
|
import { hasTableBeenResized } from '../pm-plugins/table-resizing/utils/colgroup';
|
|
55
62
|
import { updateControls } from '../pm-plugins/table-resizing/utils/dom';
|
|
@@ -101,6 +108,7 @@ export interface ComponentProps {
|
|
|
101
108
|
getEditorFeatureFlags: GetEditorFeatureFlags;
|
|
102
109
|
dispatchAnalyticsEvent: DispatchAnalyticsEvent;
|
|
103
110
|
pluginInjectionApi?: PluginInjectionAPI;
|
|
111
|
+
tableRef?: HTMLElement | undefined;
|
|
104
112
|
}
|
|
105
113
|
|
|
106
114
|
interface TableState {
|
|
@@ -134,6 +142,8 @@ class TableComponent extends React.Component<ComponentProps, TableState> {
|
|
|
134
142
|
|
|
135
143
|
private dragAndDropCleanupFn?: CleanupFn;
|
|
136
144
|
|
|
145
|
+
private tableColumnWidths?: number[];
|
|
146
|
+
|
|
137
147
|
constructor(props: ComponentProps) {
|
|
138
148
|
super(props);
|
|
139
149
|
const { options, containerWidth, getNode } = props;
|
|
@@ -278,6 +288,65 @@ class TableComponent extends React.Component<ComponentProps, TableState> {
|
|
|
278
288
|
}
|
|
279
289
|
}
|
|
280
290
|
|
|
291
|
+
handleColgroupUpdates() {
|
|
292
|
+
const { getNode, containerWidth, isResizing, view, getPos, tableRef } =
|
|
293
|
+
this.props;
|
|
294
|
+
|
|
295
|
+
if (!tableRef) {
|
|
296
|
+
return;
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
const TABLE_MARGIN = 76;
|
|
300
|
+
|
|
301
|
+
// Remove any widths styles after resizing preview is completed
|
|
302
|
+
tableRef.style.width = '';
|
|
303
|
+
|
|
304
|
+
const tableRenderWidth = containerWidth.width - TABLE_MARGIN;
|
|
305
|
+
const tableNode = getNode();
|
|
306
|
+
const start = getPos() || 0;
|
|
307
|
+
const depth = view.state.doc.resolve(start).depth;
|
|
308
|
+
|
|
309
|
+
// TODO - remove this when support is added for nested tables
|
|
310
|
+
if (depth !== 0) {
|
|
311
|
+
return;
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
const { width: tableNodeWidth } = tableNode.attrs;
|
|
315
|
+
const tableColumnWidths = calcTableColumnWidths(tableNode);
|
|
316
|
+
const shouldTableScale = tableRenderWidth < tableNodeWidth;
|
|
317
|
+
let isTableColumnWidthsSame = false;
|
|
318
|
+
if (this.tableColumnWidths) {
|
|
319
|
+
isTableColumnWidthsSame = tableColumnWidths?.every(
|
|
320
|
+
(width, index) => width === this.tableColumnWidths![index],
|
|
321
|
+
);
|
|
322
|
+
}
|
|
323
|
+
const { width: containerWidthValue } = containerWidth;
|
|
324
|
+
const isWidthChanged = this.containerWidth?.width !== containerWidthValue;
|
|
325
|
+
|
|
326
|
+
if (
|
|
327
|
+
shouldTableScale &&
|
|
328
|
+
!isResizing &&
|
|
329
|
+
(!isTableColumnWidthsSame || isWidthChanged)
|
|
330
|
+
) {
|
|
331
|
+
const resizeState = getResizeState({
|
|
332
|
+
minWidth: COLUMN_MIN_WIDTH,
|
|
333
|
+
maxSize: tableRenderWidth,
|
|
334
|
+
table: tableNode,
|
|
335
|
+
tableRef: this.table as HTMLTableElement,
|
|
336
|
+
start,
|
|
337
|
+
domAtPos: view.domAtPos,
|
|
338
|
+
tablePreserveWidth: true,
|
|
339
|
+
});
|
|
340
|
+
|
|
341
|
+
requestAnimationFrame(() => {
|
|
342
|
+
updateColgroup(resizeState, this.table!, true);
|
|
343
|
+
});
|
|
344
|
+
|
|
345
|
+
this.tableColumnWidths = tableColumnWidths;
|
|
346
|
+
this.containerWidth = containerWidth;
|
|
347
|
+
}
|
|
348
|
+
}
|
|
349
|
+
|
|
281
350
|
componentDidUpdate(_: any, prevState: TableState) {
|
|
282
351
|
const {
|
|
283
352
|
view,
|
|
@@ -286,10 +355,16 @@ class TableComponent extends React.Component<ComponentProps, TableState> {
|
|
|
286
355
|
allowColumnResizing,
|
|
287
356
|
isResizing,
|
|
288
357
|
options,
|
|
358
|
+
getEditorFeatureFlags,
|
|
289
359
|
} = this.props;
|
|
290
360
|
const { isInDanger } = getPluginState(view.state);
|
|
361
|
+
const { tablePreserveWidth = false } = getEditorFeatureFlags();
|
|
291
362
|
const table = findTable(view.state.selection);
|
|
292
363
|
|
|
364
|
+
if (tablePreserveWidth) {
|
|
365
|
+
this.handleColgroupUpdates();
|
|
366
|
+
}
|
|
367
|
+
|
|
293
368
|
if (isInDanger && !table) {
|
|
294
369
|
clearHoverSelection()(view.state, view.dispatch);
|
|
295
370
|
}
|
|
@@ -349,7 +424,7 @@ class TableComponent extends React.Component<ComponentProps, TableState> {
|
|
|
349
424
|
isResizing);
|
|
350
425
|
|
|
351
426
|
if (shouldRecreateResizeCols) {
|
|
352
|
-
|
|
427
|
+
insertColgroupFromNode(this.table, currentTable, tablePreserveWidth);
|
|
353
428
|
}
|
|
354
429
|
|
|
355
430
|
updateControls()(view.state);
|
|
@@ -535,7 +610,7 @@ class TableComponent extends React.Component<ComponentProps, TableState> {
|
|
|
535
610
|
shadowPadding +
|
|
536
611
|
2;
|
|
537
612
|
|
|
538
|
-
const { stickyScrollbar } = getEditorFeatureFlags();
|
|
613
|
+
const { stickyScrollbar, tablePreserveWidth } = getEditorFeatureFlags();
|
|
539
614
|
|
|
540
615
|
return (
|
|
541
616
|
<TableContainer
|
|
@@ -555,6 +630,7 @@ class TableComponent extends React.Component<ComponentProps, TableState> {
|
|
|
555
630
|
pluginInjectionApi={pluginInjectionApi}
|
|
556
631
|
isTableResizingEnabled={options?.isTableResizingEnabled}
|
|
557
632
|
isResizing={isResizing}
|
|
633
|
+
tablePreserveWidth={tablePreserveWidth}
|
|
558
634
|
>
|
|
559
635
|
<div
|
|
560
636
|
className={ClassName.TABLE_STICKY_SENTINEL_TOP}
|
|
@@ -778,7 +854,14 @@ class TableComponent extends React.Component<ComponentProps, TableState> {
|
|
|
778
854
|
layoutChanged: boolean;
|
|
779
855
|
parentWidth?: number;
|
|
780
856
|
}) => {
|
|
781
|
-
const {
|
|
857
|
+
const {
|
|
858
|
+
view,
|
|
859
|
+
getNode,
|
|
860
|
+
getPos,
|
|
861
|
+
containerWidth,
|
|
862
|
+
options,
|
|
863
|
+
getEditorFeatureFlags,
|
|
864
|
+
} = this.props;
|
|
782
865
|
const node = getNode();
|
|
783
866
|
const { state, dispatch } = view;
|
|
784
867
|
const pos = getPos();
|
|
@@ -791,6 +874,8 @@ class TableComponent extends React.Component<ComponentProps, TableState> {
|
|
|
791
874
|
|
|
792
875
|
this.scaleTableDebounced.cancel();
|
|
793
876
|
|
|
877
|
+
const { tablePreserveWidth = false } = getEditorFeatureFlags();
|
|
878
|
+
|
|
794
879
|
const tr = scaleTable(
|
|
795
880
|
this.table,
|
|
796
881
|
{
|
|
@@ -803,6 +888,7 @@ class TableComponent extends React.Component<ComponentProps, TableState> {
|
|
|
803
888
|
...options,
|
|
804
889
|
},
|
|
805
890
|
domAtPos,
|
|
891
|
+
tablePreserveWidth,
|
|
806
892
|
)(state.tr);
|
|
807
893
|
|
|
808
894
|
dispatch(tr);
|
|
@@ -75,6 +75,7 @@ type ResizableTableContainerProps = {
|
|
|
75
75
|
tableRef: HTMLTableElement;
|
|
76
76
|
isResizing?: boolean;
|
|
77
77
|
pluginInjectionApi?: PluginInjectionAPI;
|
|
78
|
+
tablePreserveWidth?: boolean;
|
|
78
79
|
};
|
|
79
80
|
|
|
80
81
|
export const ResizableTableContainer = React.memo(
|
|
@@ -88,6 +89,7 @@ export const ResizableTableContainer = React.memo(
|
|
|
88
89
|
tableRef,
|
|
89
90
|
isResizing,
|
|
90
91
|
pluginInjectionApi,
|
|
92
|
+
tablePreserveWidth,
|
|
91
93
|
}: PropsWithChildren<ResizableTableContainerProps>) => {
|
|
92
94
|
const containerRef = useRef<HTMLDivElement | null>(null);
|
|
93
95
|
const tableWidthRef = useRef<number>(akEditorDefaultLayoutWidth);
|
|
@@ -175,7 +177,7 @@ export const ResizableTableContainer = React.memo(
|
|
|
175
177
|
);
|
|
176
178
|
|
|
177
179
|
const displayGapCursor = useCallback(
|
|
178
|
-
(toggle) => {
|
|
180
|
+
(toggle: boolean) => {
|
|
179
181
|
return (
|
|
180
182
|
pluginInjectionApi?.core?.actions.execute(
|
|
181
183
|
pluginInjectionApi?.selection?.commands.displayGapCursor(toggle),
|
|
@@ -207,6 +209,7 @@ export const ResizableTableContainer = React.memo(
|
|
|
207
209
|
displayGuideline,
|
|
208
210
|
attachAnalyticsEvent,
|
|
209
211
|
displayGapCursor,
|
|
212
|
+
tablePreserveWidth,
|
|
210
213
|
};
|
|
211
214
|
|
|
212
215
|
if (getBooleanFF('platform.editor.resizing-table-height-improvement')) {
|
|
@@ -254,6 +257,7 @@ type TableContainerProps = {
|
|
|
254
257
|
isNested: boolean;
|
|
255
258
|
isResizing?: boolean;
|
|
256
259
|
pluginInjectionApi?: PluginInjectionAPI;
|
|
260
|
+
tablePreserveWidth?: boolean;
|
|
257
261
|
};
|
|
258
262
|
|
|
259
263
|
export const TableContainer = ({
|
|
@@ -269,6 +273,7 @@ export const TableContainer = ({
|
|
|
269
273
|
isNested,
|
|
270
274
|
isResizing,
|
|
271
275
|
pluginInjectionApi,
|
|
276
|
+
tablePreserveWidth,
|
|
272
277
|
}: PropsWithChildren<TableContainerProps>) => {
|
|
273
278
|
if (isTableResizingEnabled && !isNested) {
|
|
274
279
|
return (
|
|
@@ -281,6 +286,7 @@ export const TableContainer = ({
|
|
|
281
286
|
tableRef={tableRef}
|
|
282
287
|
isResizing={isResizing}
|
|
283
288
|
pluginInjectionApi={pluginInjectionApi}
|
|
289
|
+
tablePreserveWidth={tablePreserveWidth}
|
|
284
290
|
>
|
|
285
291
|
{children}
|
|
286
292
|
</ResizableTableContainer>
|
|
@@ -68,6 +68,7 @@ interface TableResizerProps {
|
|
|
68
68
|
payload: TableEventPayload,
|
|
69
69
|
) => ((tr: Transaction) => boolean) | undefined;
|
|
70
70
|
displayGapCursor: (toggle: boolean) => boolean;
|
|
71
|
+
tablePreserveWidth?: boolean;
|
|
71
72
|
}
|
|
72
73
|
|
|
73
74
|
export interface TableResizerImprovementProps extends TableResizerProps {
|
|
@@ -162,6 +163,7 @@ export const TableResizer = ({
|
|
|
162
163
|
displayGuideline,
|
|
163
164
|
attachAnalyticsEvent,
|
|
164
165
|
displayGapCursor,
|
|
166
|
+
tablePreserveWidth,
|
|
165
167
|
}: PropsWithChildren<TableResizerImprovementProps>) => {
|
|
166
168
|
const currentGap = useRef(0);
|
|
167
169
|
// track resizing state - use ref over state to avoid re-render
|
|
@@ -288,7 +290,7 @@ export const TableResizer = ({
|
|
|
288
290
|
]);
|
|
289
291
|
|
|
290
292
|
const handleResize = useCallback(
|
|
291
|
-
(originalState, delta) => {
|
|
293
|
+
(originalState: any, delta: any) => {
|
|
292
294
|
countFrames();
|
|
293
295
|
const newWidth = originalState.width + delta.width;
|
|
294
296
|
let pos: number | undefined;
|
|
@@ -310,6 +312,7 @@ export const TableResizer = ({
|
|
|
310
312
|
parentWidth: newWidth,
|
|
311
313
|
},
|
|
312
314
|
editorView.domAtPos.bind(editorView),
|
|
315
|
+
tablePreserveWidth,
|
|
313
316
|
);
|
|
314
317
|
|
|
315
318
|
updateActiveGuidelines(
|
|
@@ -334,6 +337,7 @@ export const TableResizer = ({
|
|
|
334
337
|
updateWidth,
|
|
335
338
|
updateActiveGuidelines,
|
|
336
339
|
countFrames,
|
|
340
|
+
tablePreserveWidth,
|
|
337
341
|
],
|
|
338
342
|
);
|
|
339
343
|
|
|
@@ -376,6 +380,7 @@ export const TableResizer = ({
|
|
|
376
380
|
parentWidth: newWidth,
|
|
377
381
|
},
|
|
378
382
|
editorView.domAtPos.bind(editorView),
|
|
383
|
+
tablePreserveWidth,
|
|
379
384
|
)(tr);
|
|
380
385
|
|
|
381
386
|
const scaledNode = tr.doc.nodeAt(pos)!;
|
|
@@ -416,6 +421,7 @@ export const TableResizer = ({
|
|
|
416
421
|
attachAnalyticsEvent,
|
|
417
422
|
endMeasure,
|
|
418
423
|
onResizeStop,
|
|
424
|
+
tablePreserveWidth,
|
|
419
425
|
],
|
|
420
426
|
);
|
|
421
427
|
|
package/src/nodeviews/table.tsx
CHANGED
|
@@ -101,8 +101,8 @@ export default class TableView extends ReactNodeView<Props> {
|
|
|
101
101
|
private table: HTMLElement | undefined;
|
|
102
102
|
private resizeObserver?: ResizeObserver;
|
|
103
103
|
eventDispatcher?: EventDispatcher;
|
|
104
|
-
|
|
105
104
|
getPos: getPosHandlerNode;
|
|
105
|
+
getEditorFeatureFlags: GetEditorFeatureFlags;
|
|
106
106
|
|
|
107
107
|
constructor(props: Props) {
|
|
108
108
|
super(
|
|
@@ -119,6 +119,7 @@ export default class TableView extends ReactNodeView<Props> {
|
|
|
119
119
|
);
|
|
120
120
|
this.getPos = props.getPos;
|
|
121
121
|
this.eventDispatcher = props.eventDispatcher;
|
|
122
|
+
this.getEditorFeatureFlags = props.getEditorFeatureFlags;
|
|
122
123
|
}
|
|
123
124
|
|
|
124
125
|
getContentDOM() {
|
|
@@ -130,17 +131,20 @@ export default class TableView extends ReactNodeView<Props> {
|
|
|
130
131
|
contentDOM?: HTMLElement;
|
|
131
132
|
};
|
|
132
133
|
|
|
133
|
-
const tableInlineWidth = getInlineWidth(
|
|
134
|
-
this.node,
|
|
135
|
-
this.reactComponentProps.options,
|
|
136
|
-
this.reactComponentProps.view.state,
|
|
137
|
-
this.reactComponentProps.getPos(),
|
|
138
|
-
);
|
|
139
|
-
|
|
140
134
|
if (rendered.dom) {
|
|
141
135
|
this.table = rendered.dom;
|
|
142
|
-
|
|
143
|
-
|
|
136
|
+
const { tablePreserveWidth = false } = this.getEditorFeatureFlags();
|
|
137
|
+
// Preserve Table Width cannot have inline width set on the table
|
|
138
|
+
if (!tablePreserveWidth) {
|
|
139
|
+
const tableInlineWidth = getInlineWidth(
|
|
140
|
+
this.node,
|
|
141
|
+
this.reactComponentProps.options,
|
|
142
|
+
this.reactComponentProps.view.state,
|
|
143
|
+
this.reactComponentProps.getPos(),
|
|
144
|
+
);
|
|
145
|
+
if (tableInlineWidth) {
|
|
146
|
+
handleInlineTableWidth(this.table, tableInlineWidth);
|
|
147
|
+
}
|
|
144
148
|
}
|
|
145
149
|
}
|
|
146
150
|
|
|
@@ -260,6 +264,7 @@ export default class TableView extends ReactNodeView<Props> {
|
|
|
260
264
|
getEditorFeatureFlags={props.getEditorFeatureFlags}
|
|
261
265
|
dispatchAnalyticsEvent={props.dispatchAnalyticsEvent}
|
|
262
266
|
pluginInjectionApi={props.pluginInjectionApi}
|
|
267
|
+
tableRef={this.table}
|
|
263
268
|
/>
|
|
264
269
|
);
|
|
265
270
|
}}
|
package/src/plugin.tsx
CHANGED
|
@@ -261,12 +261,13 @@ const tablesPlugin: TablePlugin = ({ config: options, api }) => {
|
|
|
261
261
|
{
|
|
262
262
|
name: 'tableKeymap',
|
|
263
263
|
plugin: () => {
|
|
264
|
-
const { dragAndDropEnabled } =
|
|
264
|
+
const { dragAndDropEnabled, getEditorFeatureFlags } =
|
|
265
265
|
options || ({} as TablePluginOptions);
|
|
266
266
|
|
|
267
267
|
return keymapPlugin(
|
|
268
268
|
defaultGetEditorContainerWidth,
|
|
269
269
|
editorAnalyticsAPI,
|
|
270
|
+
getEditorFeatureFlags,
|
|
270
271
|
dragAndDropEnabled,
|
|
271
272
|
);
|
|
272
273
|
},
|
|
@@ -318,14 +319,17 @@ const tablesPlugin: TablePlugin = ({ config: options, api }) => {
|
|
|
318
319
|
},
|
|
319
320
|
{
|
|
320
321
|
name: 'tableDragAndDrop',
|
|
321
|
-
plugin: ({ dispatch
|
|
322
|
-
|
|
322
|
+
plugin: ({ dispatch }) => {
|
|
323
|
+
const { getEditorFeatureFlags } =
|
|
324
|
+
options || ({} as TablePluginOptions);
|
|
325
|
+
return options?.dragAndDropEnabled
|
|
323
326
|
? createDragAndDropPlugin(
|
|
324
327
|
dispatch,
|
|
325
|
-
|
|
328
|
+
getEditorFeatureFlags,
|
|
326
329
|
editorAnalyticsAPI,
|
|
327
330
|
)
|
|
328
|
-
: undefined
|
|
331
|
+
: undefined;
|
|
332
|
+
},
|
|
329
333
|
},
|
|
330
334
|
{
|
|
331
335
|
name: 'tableLocalId',
|
|
@@ -507,6 +511,10 @@ const tablesPlugin: TablePlugin = ({ config: options, api }) => {
|
|
|
507
511
|
dispatchAnalyticsEvent={dispatchAnalyticsEvent}
|
|
508
512
|
editorAnalyticsAPI={editorAnalyticsAPI}
|
|
509
513
|
getEditorContainerWidth={defaultGetEditorContainerWidth}
|
|
514
|
+
getEditorFeatureFlags={
|
|
515
|
+
options?.getEditorFeatureFlags ||
|
|
516
|
+
defaultGetEditorFeatureFlags
|
|
517
|
+
}
|
|
510
518
|
/>
|
|
511
519
|
)}
|
|
512
520
|
{options?.allowContextualMenu && (
|
|
@@ -540,6 +548,10 @@ const tablesPlugin: TablePlugin = ({ config: options, api }) => {
|
|
|
540
548
|
editorAnalyticsAPI={editorAnalyticsAPI}
|
|
541
549
|
stickyHeaders={stickyHeader}
|
|
542
550
|
pluginConfig={pluginConfig}
|
|
551
|
+
getEditorFeatureFlags={
|
|
552
|
+
options?.getEditorFeatureFlags ||
|
|
553
|
+
defaultGetEditorFeatureFlags
|
|
554
|
+
}
|
|
543
555
|
/>
|
|
544
556
|
)}
|
|
545
557
|
{allowControls && !isDragAndDropEnabled && !isResizing && (
|