@atlaskit/editor-plugin-table 7.5.4 → 7.5.5
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 +7 -0
- package/dist/cjs/commands/column-resize.js +3 -3
- package/dist/cjs/commands/delete.js +2 -2
- package/dist/cjs/commands/insert.js +15 -15
- package/dist/cjs/commands-with-analytics.js +7 -7
- package/dist/cjs/event-handlers.js +2 -2
- package/dist/cjs/nodeviews/TableComponent.js +46 -59
- package/dist/cjs/nodeviews/TableContainer.js +5 -5
- package/dist/cjs/nodeviews/TableResizer.js +12 -12
- package/dist/cjs/nodeviews/table.js +9 -9
- package/dist/cjs/plugin.js +58 -56
- package/dist/cjs/pm-plugins/drag-and-drop/plugin.js +13 -13
- package/dist/cjs/pm-plugins/keymap.js +6 -8
- package/dist/cjs/pm-plugins/main.js +4 -6
- package/dist/cjs/pm-plugins/sticky-headers/plugin.js +2 -3
- package/dist/cjs/pm-plugins/table-resizing/event-handlers.js +12 -12
- package/dist/cjs/pm-plugins/table-resizing/utils/colgroup.js +2 -2
- package/dist/cjs/pm-plugins/table-resizing/utils/consts.js +4 -2
- package/dist/cjs/pm-plugins/table-resizing/utils/index.js +2 -2
- package/dist/cjs/pm-plugins/table-resizing/utils/misc.js +3 -3
- package/dist/cjs/pm-plugins/table-resizing/utils/resize-column.js +3 -3
- package/dist/cjs/pm-plugins/table-resizing/utils/resize-state.js +11 -12
- package/dist/cjs/pm-plugins/table-resizing/utils/scale-table.js +13 -13
- package/dist/cjs/pm-plugins/table-width.js +6 -2
- package/dist/cjs/toolbar.js +21 -21
- package/dist/cjs/transforms/column-width.js +4 -4
- package/dist/cjs/transforms/delete-columns.js +2 -2
- package/dist/cjs/ui/FloatingContextualMenu/ContextualMenu.js +53 -55
- package/dist/cjs/ui/FloatingContextualMenu/index.js +2 -4
- package/dist/cjs/ui/FloatingDragMenu/DragMenu.js +2 -2
- package/dist/cjs/ui/FloatingDragMenu/index.js +6 -6
- package/dist/cjs/ui/FloatingInsertButton/index.js +6 -7
- package/dist/cjs/utils/create.js +2 -5
- package/dist/cjs/utils/drag-menu.js +4 -4
- package/dist/es2019/commands/column-resize.js +3 -3
- package/dist/es2019/commands/delete.js +2 -2
- package/dist/es2019/commands/insert.js +12 -12
- package/dist/es2019/commands-with-analytics.js +6 -6
- package/dist/es2019/event-handlers.js +2 -2
- package/dist/es2019/nodeviews/TableComponent.js +25 -36
- package/dist/es2019/nodeviews/TableContainer.js +5 -5
- package/dist/es2019/nodeviews/TableResizer.js +12 -12
- package/dist/es2019/nodeviews/table.js +9 -9
- package/dist/es2019/plugin.js +17 -17
- package/dist/es2019/pm-plugins/drag-and-drop/plugin.js +6 -6
- package/dist/es2019/pm-plugins/keymap.js +5 -8
- package/dist/es2019/pm-plugins/main.js +3 -5
- package/dist/es2019/pm-plugins/sticky-headers/plugin.js +1 -1
- package/dist/es2019/pm-plugins/table-resizing/event-handlers.js +5 -5
- package/dist/es2019/pm-plugins/table-resizing/utils/colgroup.js +2 -2
- package/dist/es2019/pm-plugins/table-resizing/utils/consts.js +3 -1
- package/dist/es2019/pm-plugins/table-resizing/utils/index.js +1 -1
- package/dist/es2019/pm-plugins/table-resizing/utils/misc.js +2 -2
- package/dist/es2019/pm-plugins/table-resizing/utils/resize-column.js +3 -2
- package/dist/es2019/pm-plugins/table-resizing/utils/resize-state.js +12 -13
- package/dist/es2019/pm-plugins/table-resizing/utils/scale-table.js +13 -13
- package/dist/es2019/pm-plugins/table-width.js +6 -2
- package/dist/es2019/toolbar.js +15 -15
- package/dist/es2019/transforms/column-width.js +5 -5
- package/dist/es2019/transforms/delete-columns.js +2 -2
- package/dist/es2019/ui/FloatingContextualMenu/ContextualMenu.js +9 -12
- package/dist/es2019/ui/FloatingContextualMenu/index.js +2 -4
- package/dist/es2019/ui/FloatingDragMenu/DragMenu.js +2 -2
- package/dist/es2019/ui/FloatingDragMenu/index.js +5 -5
- package/dist/es2019/ui/FloatingInsertButton/index.js +5 -6
- package/dist/es2019/utils/create.js +2 -5
- package/dist/es2019/utils/drag-menu.js +4 -4
- package/dist/esm/commands/column-resize.js +3 -3
- package/dist/esm/commands/delete.js +2 -2
- package/dist/esm/commands/insert.js +15 -15
- package/dist/esm/commands-with-analytics.js +7 -7
- package/dist/esm/event-handlers.js +2 -2
- package/dist/esm/nodeviews/TableComponent.js +45 -58
- package/dist/esm/nodeviews/TableContainer.js +5 -5
- package/dist/esm/nodeviews/TableResizer.js +12 -12
- package/dist/esm/nodeviews/table.js +9 -9
- package/dist/esm/plugin.js +58 -56
- package/dist/esm/pm-plugins/drag-and-drop/plugin.js +13 -13
- package/dist/esm/pm-plugins/keymap.js +6 -8
- package/dist/esm/pm-plugins/main.js +4 -6
- package/dist/esm/pm-plugins/sticky-headers/plugin.js +2 -3
- package/dist/esm/pm-plugins/table-resizing/event-handlers.js +12 -12
- package/dist/esm/pm-plugins/table-resizing/utils/colgroup.js +2 -2
- package/dist/esm/pm-plugins/table-resizing/utils/consts.js +3 -1
- package/dist/esm/pm-plugins/table-resizing/utils/index.js +1 -1
- package/dist/esm/pm-plugins/table-resizing/utils/misc.js +2 -2
- package/dist/esm/pm-plugins/table-resizing/utils/resize-column.js +4 -3
- package/dist/esm/pm-plugins/table-resizing/utils/resize-state.js +13 -14
- package/dist/esm/pm-plugins/table-resizing/utils/scale-table.js +13 -13
- package/dist/esm/pm-plugins/table-width.js +6 -2
- package/dist/esm/toolbar.js +21 -21
- package/dist/esm/transforms/column-width.js +5 -5
- package/dist/esm/transforms/delete-columns.js +2 -2
- package/dist/esm/ui/FloatingContextualMenu/ContextualMenu.js +53 -55
- package/dist/esm/ui/FloatingContextualMenu/index.js +2 -4
- package/dist/esm/ui/FloatingDragMenu/DragMenu.js +2 -2
- package/dist/esm/ui/FloatingDragMenu/index.js +6 -6
- package/dist/esm/ui/FloatingInsertButton/index.js +6 -7
- package/dist/esm/utils/create.js +2 -5
- package/dist/esm/utils/drag-menu.js +4 -4
- 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 +7 -7
- package/dist/types/commands-with-analytics.d.ts +3 -3
- package/dist/types/event-handlers.d.ts +1 -1
- package/dist/types/nodeviews/TableComponent.d.ts +2 -3
- package/dist/types/nodeviews/TableContainer.d.ts +4 -4
- package/dist/types/nodeviews/TableResizer.d.ts +2 -2
- package/dist/types/nodeviews/table.d.ts +1 -1
- package/dist/types/nodeviews/types.d.ts +1 -0
- package/dist/types/plugin.d.ts +1 -0
- package/dist/types/pm-plugins/drag-and-drop/plugin.d.ts +1 -2
- package/dist/types/pm-plugins/keymap.d.ts +2 -2
- package/dist/types/pm-plugins/main.d.ts +1 -1
- package/dist/types/pm-plugins/sticky-headers/plugin.d.ts +2 -3
- package/dist/types/pm-plugins/table-resizing/utils/colgroup.d.ts +1 -1
- package/dist/types/pm-plugins/table-resizing/utils/consts.d.ts +1 -0
- package/dist/types/pm-plugins/table-resizing/utils/index.d.ts +1 -1
- package/dist/types/pm-plugins/table-resizing/utils/misc.d.ts +1 -1
- package/dist/types/pm-plugins/table-resizing/utils/resize-column.d.ts +2 -1
- package/dist/types/pm-plugins/table-resizing/utils/resize-state.d.ts +4 -4
- package/dist/types/pm-plugins/table-resizing/utils/scale-table.d.ts +4 -4
- package/dist/types/pm-plugins/table-width.d.ts +1 -2
- 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/types.d.ts +1 -0
- package/dist/types/ui/FloatingContextualMenu/index.d.ts +1 -1
- package/dist/types/ui/FloatingDragMenu/DragMenu.d.ts +2 -2
- package/dist/types/ui/FloatingDragMenu/index.d.ts +2 -3
- package/dist/types/ui/FloatingInsertButton/index.d.ts +1 -2
- package/dist/types/utils/create.d.ts +1 -2
- 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 +7 -7
- package/dist/types-ts4.5/commands-with-analytics.d.ts +3 -3
- package/dist/types-ts4.5/event-handlers.d.ts +1 -1
- package/dist/types-ts4.5/nodeviews/TableComponent.d.ts +2 -3
- package/dist/types-ts4.5/nodeviews/TableContainer.d.ts +4 -4
- package/dist/types-ts4.5/nodeviews/TableResizer.d.ts +2 -2
- package/dist/types-ts4.5/nodeviews/table.d.ts +1 -1
- package/dist/types-ts4.5/nodeviews/types.d.ts +1 -0
- package/dist/types-ts4.5/plugin.d.ts +1 -0
- package/dist/types-ts4.5/pm-plugins/drag-and-drop/plugin.d.ts +1 -2
- package/dist/types-ts4.5/pm-plugins/keymap.d.ts +2 -2
- package/dist/types-ts4.5/pm-plugins/main.d.ts +1 -1
- package/dist/types-ts4.5/pm-plugins/sticky-headers/plugin.d.ts +2 -3
- package/dist/types-ts4.5/pm-plugins/table-resizing/utils/colgroup.d.ts +1 -1
- package/dist/types-ts4.5/pm-plugins/table-resizing/utils/consts.d.ts +1 -0
- package/dist/types-ts4.5/pm-plugins/table-resizing/utils/index.d.ts +1 -1
- package/dist/types-ts4.5/pm-plugins/table-resizing/utils/misc.d.ts +1 -1
- package/dist/types-ts4.5/pm-plugins/table-resizing/utils/resize-column.d.ts +2 -1
- package/dist/types-ts4.5/pm-plugins/table-resizing/utils/resize-state.d.ts +4 -4
- package/dist/types-ts4.5/pm-plugins/table-resizing/utils/scale-table.d.ts +4 -4
- package/dist/types-ts4.5/pm-plugins/table-width.d.ts +1 -2
- 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/types.d.ts +1 -0
- package/dist/types-ts4.5/ui/FloatingContextualMenu/index.d.ts +1 -1
- package/dist/types-ts4.5/ui/FloatingDragMenu/DragMenu.d.ts +2 -2
- package/dist/types-ts4.5/ui/FloatingDragMenu/index.d.ts +2 -3
- package/dist/types-ts4.5/ui/FloatingInsertButton/index.d.ts +1 -2
- package/dist/types-ts4.5/utils/create.d.ts +1 -2
- package/dist/types-ts4.5/utils/drag-menu.d.ts +1 -1
- package/package.json +2 -2
- package/src/commands/column-resize.ts +4 -3
- package/src/commands/delete.ts +2 -2
- package/src/commands/insert.ts +15 -27
- package/src/commands-with-analytics.ts +6 -9
- package/src/event-handlers.ts +2 -2
- package/src/nodeviews/TableComponent.tsx +31 -46
- package/src/nodeviews/TableContainer.tsx +7 -7
- package/src/nodeviews/TableResizer.tsx +14 -14
- package/src/nodeviews/table.tsx +6 -5
- package/src/nodeviews/types.ts +1 -0
- package/src/plugin.tsx +12 -28
- package/src/pm-plugins/drag-and-drop/plugin.ts +10 -15
- package/src/pm-plugins/keymap.ts +6 -13
- package/src/pm-plugins/main.ts +3 -3
- package/src/pm-plugins/sticky-headers/plugin.ts +2 -11
- package/src/pm-plugins/table-resizing/event-handlers.ts +6 -4
- package/src/pm-plugins/table-resizing/utils/colgroup.ts +2 -2
- package/src/pm-plugins/table-resizing/utils/consts.ts +2 -0
- package/src/pm-plugins/table-resizing/utils/index.ts +1 -1
- package/src/pm-plugins/table-resizing/utils/misc.ts +2 -2
- package/src/pm-plugins/table-resizing/utils/resize-column.ts +5 -2
- package/src/pm-plugins/table-resizing/utils/resize-state.ts +18 -13
- package/src/pm-plugins/table-resizing/utils/scale-table.ts +14 -14
- package/src/pm-plugins/table-width.ts +4 -6
- package/src/toolbar.tsx +16 -19
- package/src/transforms/column-width.ts +7 -6
- package/src/transforms/delete-columns.ts +2 -2
- package/src/types.ts +1 -0
- package/src/ui/FloatingContextualMenu/ContextualMenu.tsx +11 -16
- package/src/ui/FloatingContextualMenu/index.tsx +0 -2
- package/src/ui/FloatingDragMenu/DragMenu.tsx +3 -3
- package/src/ui/FloatingDragMenu/index.tsx +4 -8
- package/src/ui/FloatingInsertButton/index.tsx +11 -22
- package/src/utils/create.ts +2 -5
- package/src/utils/drag-menu.ts +7 -12
|
@@ -14,7 +14,7 @@ export default class TableView extends ReactNodeView<Props> {
|
|
|
14
14
|
private resizeObserver?;
|
|
15
15
|
eventDispatcher?: EventDispatcher;
|
|
16
16
|
getPos: getPosHandlerNode;
|
|
17
|
-
|
|
17
|
+
options: import("./types").TableOptions | undefined;
|
|
18
18
|
constructor(props: Props);
|
|
19
19
|
getContentDOM(): {
|
|
20
20
|
dom: HTMLElement;
|
|
@@ -16,6 +16,7 @@ export interface TablePluginOptions {
|
|
|
16
16
|
fullWidthEnabled?: boolean;
|
|
17
17
|
wasFullWidthEnabled?: boolean;
|
|
18
18
|
getEditorFeatureFlags?: GetEditorFeatureFlags;
|
|
19
|
+
isTableScalingEnabled?: boolean;
|
|
19
20
|
}
|
|
20
21
|
type InsertTableAction = (analyticsPayload: AnalyticsEventPayload) => Command;
|
|
21
22
|
export type TablePlugin = NextEditorPlugin<'table', {
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
|
|
2
2
|
import type { Dispatch } from '@atlaskit/editor-common/event-dispatcher';
|
|
3
3
|
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
4
|
-
|
|
5
|
-
export declare const createPlugin: (dispatch: Dispatch, getEditorFeatureFlags?: GetEditorFeatureFlags, editorAnalyticsAPI?: EditorAnalyticsAPI) => SafePlugin<import("./types").DragAndDropPluginState>;
|
|
4
|
+
export declare const createPlugin: (dispatch: Dispatch, editorAnalyticsAPI?: EditorAnalyticsAPI) => SafePlugin<import("./types").DragAndDropPluginState>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
|
|
2
2
|
import type { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
3
|
-
import type { GetEditorContainerWidth
|
|
4
|
-
export declare function keymapPlugin(getEditorContainerWidth: GetEditorContainerWidth, editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null,
|
|
3
|
+
import type { GetEditorContainerWidth } from '@atlaskit/editor-common/types';
|
|
4
|
+
export declare function keymapPlugin(getEditorContainerWidth: GetEditorContainerWidth, editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null, dragAndDropEnabled?: boolean, isTableScalingEnabled?: boolean): SafePlugin;
|
|
5
5
|
export default keymapPlugin;
|
|
@@ -5,4 +5,4 @@ import type { PortalProviderAPI } from '@atlaskit/editor-common/portal-provider'
|
|
|
5
5
|
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
6
6
|
import type { GetEditorContainerWidth, GetEditorFeatureFlags } from '@atlaskit/editor-common/types';
|
|
7
7
|
import type { PluginConfig, PluginInjectionAPI } from '../types';
|
|
8
|
-
export declare const createPlugin: (dispatchAnalyticsEvent: DispatchAnalyticsEvent, dispatch: Dispatch, portalProviderAPI: PortalProviderAPI, eventDispatcher: EventDispatcher, pluginConfig: PluginConfig, getEditorContainerWidth: GetEditorContainerWidth, getEditorFeatureFlags: GetEditorFeatureFlags, getIntl: () => IntlShape, breakoutEnabled?: boolean, tableResizingEnabled?: boolean, fullWidthModeEnabled?: boolean, previousFullWidthModeEnabled?: boolean, dragAndDropEnabled?: boolean, editorAnalyticsAPI?: EditorAnalyticsAPI, pluginInjectionApi?: PluginInjectionAPI) => SafePlugin<import("../types").TablePluginState>;
|
|
8
|
+
export declare const createPlugin: (dispatchAnalyticsEvent: DispatchAnalyticsEvent, dispatch: Dispatch, portalProviderAPI: PortalProviderAPI, eventDispatcher: EventDispatcher, pluginConfig: PluginConfig, getEditorContainerWidth: GetEditorContainerWidth, getEditorFeatureFlags: GetEditorFeatureFlags, getIntl: () => IntlShape, breakoutEnabled?: boolean, tableResizingEnabled?: boolean, fullWidthModeEnabled?: boolean, previousFullWidthModeEnabled?: boolean, dragAndDropEnabled?: boolean, editorAnalyticsAPI?: EditorAnalyticsAPI, pluginInjectionApi?: PluginInjectionAPI, isTableScalingEnabled?: boolean) => SafePlugin<import("../types").TablePluginState>;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import type { Dispatch
|
|
1
|
+
import type { Dispatch } from '@atlaskit/editor-common/event-dispatcher';
|
|
2
2
|
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
3
|
-
|
|
4
|
-
export declare const createPlugin: (dispatch: Dispatch, eventDispatcher: EventDispatcher, initialState: (() => never[]) | undefined, getEditorFeatureFlags: GetEditorFeatureFlags) => SafePlugin<import("./types").StickyPluginState>;
|
|
3
|
+
export declare const createPlugin: (dispatch: Dispatch, initialState?: () => never[]) => SafePlugin<import("./types").StickyPluginState>;
|
|
@@ -10,7 +10,7 @@ type Col = Array<string | {
|
|
|
10
10
|
*/
|
|
11
11
|
export declare const getColWidthFix: (colwidth: number, tableColumnCount: number) => number;
|
|
12
12
|
export declare const generateColgroup: (table: PmNode, tableRef?: HTMLElement) => Col[];
|
|
13
|
-
export declare const insertColgroupFromNode: (tableRef: HTMLTableElement, table: PmNode,
|
|
13
|
+
export declare const insertColgroupFromNode: (tableRef: HTMLTableElement, table: PmNode, isTableScalingEnabled?: boolean, shouldRemove?: boolean) => HTMLCollection;
|
|
14
14
|
export declare const hasTableBeenResized: (table: PmNode) => boolean;
|
|
15
15
|
/**
|
|
16
16
|
* Check if a table has all the column width set to tableCellMinWidth(48px) or null
|
|
@@ -4,7 +4,7 @@ export { getColumnStateFromDOM, getFreeSpace, getCellsRefsInColumn, calculateCol
|
|
|
4
4
|
export type { ColumnState } from './column-state';
|
|
5
5
|
export { growColumn, shrinkColumn, reduceSpace } from './resize-logic';
|
|
6
6
|
export { getResizeState, updateColgroup, getTotalWidth, evenAllColumnsWidths, bulkColumnsResize, areColumnsEven, adjustColumnsWidths, } from './resize-state';
|
|
7
|
-
export { getLayoutSize, getDefaultLayoutMaxWidth, pointsAtCell, currentColWidth, domCellAround, getTableMaxWidth, getTableElementWidth,
|
|
7
|
+
export { getLayoutSize, getDefaultLayoutMaxWidth, pointsAtCell, currentColWidth, domCellAround, getTableMaxWidth, getTableElementWidth, getTableContainerElementWidth, } from './misc';
|
|
8
8
|
export { updateControls, isClickNear, getResizeCellPos } from './dom';
|
|
9
9
|
export { scale, scaleWithParent, scaleTable, previewScaleTable, } from './scale-table';
|
|
10
10
|
export type { ScaleOptions } from './scale-table';
|
|
@@ -23,5 +23,5 @@ export declare const getTableMaxWidth: ({ table, tableStart, state, layout, getE
|
|
|
23
23
|
* @returns calculated width of <table /> element derived from sum of colwidths on tableCell or tableHeader nodes or falls back to container width
|
|
24
24
|
*/
|
|
25
25
|
export declare const getTableElementWidth: (table: PMNode) => number;
|
|
26
|
-
export declare const
|
|
26
|
+
export declare const getTableContainerElementWidth: (table: PMNode) => number;
|
|
27
27
|
export {};
|
|
@@ -1,2 +1,3 @@
|
|
|
1
|
+
import type { Node as PmNode } from '@atlaskit/editor-prosemirror/model';
|
|
1
2
|
import type { ResizeState } from './types';
|
|
2
|
-
export declare const resizeColumn: (resizeState: ResizeState, colIndex: number, amount: number, tableRef: HTMLElement, selectedColumns?: number[],
|
|
3
|
+
export declare const resizeColumn: (resizeState: ResizeState, colIndex: number, amount: number, tableRef: HTMLElement, tableNode: PmNode, selectedColumns?: number[], isTableScalingEnabled?: boolean) => ResizeState;
|
|
@@ -4,7 +4,7 @@ import type { Node as PMNode } from '@atlaskit/editor-prosemirror/model';
|
|
|
4
4
|
import type { EditorState } from '@atlaskit/editor-prosemirror/state';
|
|
5
5
|
import type { Rect } from '@atlaskit/editor-tables/table-map';
|
|
6
6
|
import type { ResizeState, ResizeStateWithAnalytics } from './types';
|
|
7
|
-
export declare const getResizeState: ({ minWidth, maxSize, table, tableRef, start, domAtPos,
|
|
7
|
+
export declare const getResizeState: ({ minWidth, maxSize, table, tableRef, start, domAtPos, isTableScalingEnabled, }: {
|
|
8
8
|
minWidth: number;
|
|
9
9
|
maxSize: number;
|
|
10
10
|
table: PMNode;
|
|
@@ -14,9 +14,9 @@ export declare const getResizeState: ({ minWidth, maxSize, table, tableRef, star
|
|
|
14
14
|
node: Node;
|
|
15
15
|
offset: number;
|
|
16
16
|
};
|
|
17
|
-
|
|
17
|
+
isTableScalingEnabled: boolean;
|
|
18
18
|
}) => ResizeState;
|
|
19
|
-
export declare const updateColgroup: (state: ResizeState, tableRef: HTMLElement,
|
|
19
|
+
export declare const updateColgroup: (state: ResizeState, tableRef: HTMLElement, tableNode?: PMNode, isTableScalingEnabled?: boolean) => void;
|
|
20
20
|
export declare const getTotalWidth: ({ cols }: ResizeState) => number;
|
|
21
21
|
export declare const adjustColumnsWidths: (resizeState: ResizeState, maxSize: number) => ResizeState;
|
|
22
22
|
export declare const evenAllColumnsWidths: (resizeState: ResizeState) => ResizeState;
|
|
@@ -27,4 +27,4 @@ export declare const normaliseTableLayout: (input: string | undefined | null) =>
|
|
|
27
27
|
export declare const getNewResizeStateFromSelectedColumns: (rect: Rect, state: EditorState, domAtPos: (pos: number) => {
|
|
28
28
|
node: Node;
|
|
29
29
|
offset: number;
|
|
30
|
-
}, getEditorContainerWidth: GetEditorContainerWidth,
|
|
30
|
+
}, getEditorContainerWidth: GetEditorContainerWidth, isTableScalingEnabled?: boolean) => ResizeStateWithAnalytics | undefined;
|
|
@@ -14,8 +14,8 @@ export interface ScaleOptions {
|
|
|
14
14
|
isFullWidthModeEnabled?: boolean;
|
|
15
15
|
isTableResizingEnabled?: boolean;
|
|
16
16
|
}
|
|
17
|
-
export declare const scale: (tableRef: HTMLTableElement, options: ScaleOptions, domAtPos: DomAtPos,
|
|
18
|
-
export declare const scaleWithParent: (tableRef: HTMLTableElement, parentWidth: number, table: PMNode, start: number, domAtPos: DomAtPos,
|
|
17
|
+
export declare const scale: (tableRef: HTMLTableElement, options: ScaleOptions, domAtPos: DomAtPos, isTableScalingEnabled?: boolean) => ResizeState | undefined;
|
|
18
|
+
export declare const scaleWithParent: (tableRef: HTMLTableElement, parentWidth: number, table: PMNode, start: number, domAtPos: DomAtPos, isTableScalingEnabled?: boolean) => ResizeState;
|
|
19
19
|
export declare function scaleTableTo(state: ResizeState, maxSize: number): ResizeState;
|
|
20
|
-
export declare const previewScaleTable: (tableRef: HTMLTableElement | null | undefined, options: ScaleOptions, domAtPos: DomAtPos,
|
|
21
|
-
export declare const scaleTable: (tableRef: HTMLTableElement | null | undefined, options: ScaleOptions, domAtPos: DomAtPos,
|
|
20
|
+
export declare const previewScaleTable: (tableRef: HTMLTableElement | null | undefined, options: ScaleOptions, domAtPos: DomAtPos, isTableScalingEnabled?: boolean) => void;
|
|
21
|
+
export declare const scaleTable: (tableRef: HTMLTableElement | null | undefined, options: ScaleOptions, domAtPos: DomAtPos, isTableScalingEnabled?: boolean) => (tr: Transaction) => Transaction;
|
|
@@ -6,13 +6,12 @@
|
|
|
6
6
|
import type { DispatchAnalyticsEvent } from '@atlaskit/editor-common/analytics';
|
|
7
7
|
import type { Dispatch } from '@atlaskit/editor-common/event-dispatcher';
|
|
8
8
|
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
9
|
-
import type { GetEditorFeatureFlags } from '@atlaskit/editor-common/types';
|
|
10
9
|
import { PluginKey } from '@atlaskit/editor-prosemirror/state';
|
|
11
10
|
type TableWidthPluginState = {
|
|
12
11
|
resizing: boolean;
|
|
13
12
|
};
|
|
14
13
|
export declare const pluginKey: PluginKey<TableWidthPluginState>;
|
|
15
|
-
declare const createPlugin: (dispatch: Dispatch, dispatchAnalyticsEvent: DispatchAnalyticsEvent, fullWidthEnabled: boolean
|
|
14
|
+
declare const createPlugin: (dispatch: Dispatch, dispatchAnalyticsEvent: DispatchAnalyticsEvent, fullWidthEnabled: boolean) => SafePlugin<{
|
|
16
15
|
resizing: boolean;
|
|
17
16
|
}>;
|
|
18
17
|
export { createPlugin };
|
|
@@ -5,8 +5,8 @@ import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
|
5
5
|
import { Rect } from '@atlaskit/editor-tables/table-map';
|
|
6
6
|
import type { PluginConfig, ToolbarMenuConfig, ToolbarMenuContext, ToolbarMenuState } from './types';
|
|
7
7
|
export declare const getToolbarMenuConfig: (config: ToolbarMenuConfig, state: ToolbarMenuState, { formatMessage }: ToolbarMenuContext, editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null) => FloatingToolbarItem<Command>;
|
|
8
|
-
export declare const getToolbarCellOptionsConfig: (editorState: EditorState, editorView: EditorView | undefined | null, initialSelectionRect: Rect, { formatMessage }: ToolbarMenuContext, getEditorContainerWidth: GetEditorContainerWidth, editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null,
|
|
8
|
+
export declare const getToolbarCellOptionsConfig: (editorState: EditorState, editorView: EditorView | undefined | null, initialSelectionRect: Rect, { formatMessage }: ToolbarMenuContext, getEditorContainerWidth: GetEditorContainerWidth, editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null, isTableScalingEnabled?: boolean) => FloatingToolbarDropdown<Command>;
|
|
9
9
|
export declare const getClosestSelectionRect: (state: EditorState) => Rect | undefined;
|
|
10
10
|
export declare const getClosestSelectionOrTableRect: (state: EditorState) => Rect | undefined;
|
|
11
11
|
export declare const getToolbarConfig: (getEditorContainerWidth: GetEditorContainerWidth, editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null, getEditorFeatureFlags: GetEditorFeatureFlags, getEditorView: () => EditorView | null) => (config: PluginConfig) => FloatingToolbarHandler;
|
|
12
|
-
export declare const getDistributeConfig: (getEditorContainerWidth: GetEditorContainerWidth, editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null,
|
|
12
|
+
export declare const getDistributeConfig: (getEditorContainerWidth: GetEditorContainerWidth, editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null, isTableScalingEnabled?: boolean) => Command;
|
|
@@ -21,4 +21,4 @@ export declare const updateColumnWidths: (resizeState: ResizeState, table: PMNod
|
|
|
21
21
|
* @param view
|
|
22
22
|
* @returns Updated transaction with rescaled columns for a given table
|
|
23
23
|
*/
|
|
24
|
-
export declare const rescaleColumns: (
|
|
24
|
+
export declare const rescaleColumns: (isTableScalingEnabled?: boolean) => (table: ContentNodeWithPos, view: EditorView | undefined) => (tr: Transaction) => Transaction;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { Transaction } from '@atlaskit/editor-prosemirror/state';
|
|
2
2
|
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
3
3
|
import type { Rect } from '@atlaskit/editor-tables/table-map';
|
|
4
|
-
export declare const deleteColumns: (rect: Rect, allowCustomStep: boolean, view?: EditorView,
|
|
4
|
+
export declare const deleteColumns: (rect: Rect, allowCustomStep: boolean, view?: EditorView, isTableScalingEnabled?: boolean) => (tr: Transaction) => Transaction;
|
|
@@ -17,7 +17,7 @@ export interface Props {
|
|
|
17
17
|
editorAnalyticsAPI?: EditorAnalyticsAPI;
|
|
18
18
|
}
|
|
19
19
|
declare const FloatingContextualMenu: {
|
|
20
|
-
({ mountPoint, boundariesElement, scrollableElement, editorView, isOpen, pluginConfig, editorAnalyticsAPI, getEditorContainerWidth,
|
|
20
|
+
({ mountPoint, boundariesElement, scrollableElement, editorView, isOpen, pluginConfig, editorAnalyticsAPI, getEditorContainerWidth, }: Props): jsx.JSX.Element | null;
|
|
21
21
|
displayName: string;
|
|
22
22
|
};
|
|
23
23
|
export default FloatingContextualMenu;
|
|
@@ -24,9 +24,9 @@ type DragMenuProps = {
|
|
|
24
24
|
mountPoint?: HTMLElement;
|
|
25
25
|
boundariesElement?: HTMLElement;
|
|
26
26
|
scrollableElement?: HTMLElement;
|
|
27
|
-
|
|
27
|
+
isTableScalingEnabled?: boolean;
|
|
28
28
|
};
|
|
29
|
-
export declare const DragMenu: React.MemoExoticComponent<({ direction, index, target, isOpen, editorView, tableNode, targetCellPosition, getEditorContainerWidth, editorAnalyticsAPI, pluginConfig, intl: { formatMessage }, fitHeight, fitWidth, mountPoint, scrollableElement, boundariesElement,
|
|
29
|
+
export declare const DragMenu: React.MemoExoticComponent<({ direction, index, target, isOpen, editorView, tableNode, targetCellPosition, getEditorContainerWidth, editorAnalyticsAPI, pluginConfig, intl: { formatMessage }, fitHeight, fitWidth, mountPoint, scrollableElement, boundariesElement, isTableScalingEnabled, }: DragMenuProps & WrappedComponentProps) => jsx.JSX.Element | null>;
|
|
30
30
|
declare const _default: React.FC<import("react-intl-next").WithIntlProps<DragMenuProps & WrappedComponentProps<"intl">>> & {
|
|
31
31
|
WrappedComponent: React.ComponentType<DragMenuProps & WrappedComponentProps<"intl">>;
|
|
32
32
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
|
|
3
|
-
import type { GetEditorContainerWidth
|
|
3
|
+
import type { GetEditorContainerWidth } 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,10 +20,9 @@ export interface Props {
|
|
|
20
20
|
editorAnalyticsAPI?: EditorAnalyticsAPI;
|
|
21
21
|
stickyHeaders?: RowStickyState;
|
|
22
22
|
pluginConfig?: PluginConfig;
|
|
23
|
-
getEditorFeatureFlags: GetEditorFeatureFlags;
|
|
24
23
|
}
|
|
25
24
|
declare const FloatingDragMenu: {
|
|
26
|
-
({ mountPoint, boundariesElement, scrollableElement, editorView, isOpen, tableNode, direction, index, targetCellPosition, getEditorContainerWidth, editorAnalyticsAPI, stickyHeaders, pluginConfig,
|
|
25
|
+
({ mountPoint, boundariesElement, scrollableElement, editorView, isOpen, tableNode, direction, index, targetCellPosition, getEditorContainerWidth, editorAnalyticsAPI, stickyHeaders, pluginConfig, }: Props): JSX.Element | null;
|
|
27
26
|
displayName: string;
|
|
28
27
|
};
|
|
29
28
|
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
|
|
4
|
+
import type { GetEditorContainerWidth } 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,7 +20,6 @@ export interface Props {
|
|
|
20
20
|
hasStickyHeaders?: boolean;
|
|
21
21
|
dispatchAnalyticsEvent?: DispatchAnalyticsEvent;
|
|
22
22
|
editorAnalyticsAPI?: EditorAnalyticsAPI;
|
|
23
|
-
getEditorFeatureFlags?: GetEditorFeatureFlags;
|
|
24
23
|
}
|
|
25
24
|
export declare class FloatingInsertButton extends React.Component<Props & WrappedComponentProps, any> {
|
|
26
25
|
static displayName: string;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import type { GetEditorFeatureFlags } from '@atlaskit/editor-common/types';
|
|
2
1
|
import type { Schema } from '@atlaskit/editor-prosemirror/model';
|
|
3
|
-
export declare const createTableWithWidth: (
|
|
2
|
+
export declare const createTableWithWidth: (isTableScalingEnabled?: boolean, isFullWidthModeEnabled?: boolean, createTableProps?: {
|
|
4
3
|
rowsCount?: number;
|
|
5
4
|
colsCount?: number;
|
|
6
5
|
}) => (schema: Schema) => import("prosemirror-model").Node;
|
|
@@ -13,4 +13,4 @@ export interface DragMenuConfig extends DropdownOptionT<Command> {
|
|
|
13
13
|
icon?: React.ComponentType<React.PropsWithChildren<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,
|
|
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, isTableScalingEnabled?: boolean) => DragMenuConfig[];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-table",
|
|
3
|
-
"version": "7.5.
|
|
3
|
+
"version": "7.5.5",
|
|
4
4
|
"description": "Table plugin for the @atlaskit/editor",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
"@atlaskit/primitives": "^4.0.0",
|
|
50
50
|
"@atlaskit/theme": "^12.6.0",
|
|
51
51
|
"@atlaskit/toggle": "^13.0.0",
|
|
52
|
-
"@atlaskit/tokens": "^1.
|
|
52
|
+
"@atlaskit/tokens": "^1.40.0",
|
|
53
53
|
"@atlaskit/tooltip": "^18.1.0",
|
|
54
54
|
"@babel/runtime": "^7.0.0",
|
|
55
55
|
"@emotion/react": "^11.7.1",
|
|
@@ -228,7 +228,7 @@ export const changeColumnWidthByStep =
|
|
|
228
228
|
(
|
|
229
229
|
stepSize: number,
|
|
230
230
|
getEditorContainerWidth: GetEditorContainerWidth,
|
|
231
|
-
|
|
231
|
+
isTableScalingEnabled = false,
|
|
232
232
|
): Command =>
|
|
233
233
|
(state, dispatch, view) => {
|
|
234
234
|
let customTr = state.tr;
|
|
@@ -290,7 +290,7 @@ export const changeColumnWidthByStep =
|
|
|
290
290
|
tableRef: dom,
|
|
291
291
|
start: tableStartPosition,
|
|
292
292
|
domAtPos,
|
|
293
|
-
|
|
293
|
+
isTableScalingEnabled,
|
|
294
294
|
});
|
|
295
295
|
|
|
296
296
|
updateControls()(state);
|
|
@@ -308,8 +308,9 @@ export const changeColumnWidthByStep =
|
|
|
308
308
|
colIndex,
|
|
309
309
|
stepSize,
|
|
310
310
|
dom,
|
|
311
|
+
originalTable,
|
|
311
312
|
resizingSelectedColumns ? selectedColumns : undefined,
|
|
312
|
-
|
|
313
|
+
isTableScalingEnabled,
|
|
313
314
|
);
|
|
314
315
|
|
|
315
316
|
customTr = updateColumnWidths(
|
package/src/commands/delete.ts
CHANGED
|
@@ -5,13 +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,
|
|
8
|
+
(rect: Rect, isTableScalingEnabled = false): Command =>
|
|
9
9
|
(state, dispatch, view) => {
|
|
10
10
|
const tr = deleteColumns(
|
|
11
11
|
rect,
|
|
12
12
|
getAllowAddColumnCustomStep(state),
|
|
13
13
|
view,
|
|
14
|
-
|
|
14
|
+
isTableScalingEnabled,
|
|
15
15
|
)(state.tr);
|
|
16
16
|
if (dispatch) {
|
|
17
17
|
dispatch(tr);
|
package/src/commands/insert.ts
CHANGED
|
@@ -11,12 +11,7 @@ import {
|
|
|
11
11
|
EVENT_TYPE,
|
|
12
12
|
TABLE_OVERFLOW_CHANGE_TRIGGER,
|
|
13
13
|
} from '@atlaskit/editor-common/analytics';
|
|
14
|
-
import type {
|
|
15
|
-
Command,
|
|
16
|
-
EditorCommand,
|
|
17
|
-
GetEditorContainerWidth,
|
|
18
|
-
GetEditorFeatureFlags,
|
|
19
|
-
} from '@atlaskit/editor-common/types';
|
|
14
|
+
import type { Command, EditorCommand } from '@atlaskit/editor-common/types';
|
|
20
15
|
import type { Transaction } from '@atlaskit/editor-prosemirror/state';
|
|
21
16
|
import { Selection } from '@atlaskit/editor-prosemirror/state';
|
|
22
17
|
import { safeInsert } from '@atlaskit/editor-prosemirror/utils';
|
|
@@ -50,10 +45,7 @@ function addColumnAtCustomStep(column: number) {
|
|
|
50
45
|
};
|
|
51
46
|
}
|
|
52
47
|
|
|
53
|
-
export function addColumnAt(
|
|
54
|
-
getEditorContainerWidth: GetEditorContainerWidth,
|
|
55
|
-
tablePreserveWidth = false,
|
|
56
|
-
) {
|
|
48
|
+
export function addColumnAt(isTableScalingEnabled = false) {
|
|
57
49
|
return (
|
|
58
50
|
column: number,
|
|
59
51
|
allowAddColumnCustomStep: boolean = false,
|
|
@@ -69,7 +61,9 @@ export function addColumnAt(
|
|
|
69
61
|
const table = findTable(updatedTr.selection);
|
|
70
62
|
if (table) {
|
|
71
63
|
// [ED-8288] Update colwidths manually to avoid multiple dispatch in TableComponent
|
|
72
|
-
updatedTr = rescaleColumns(
|
|
64
|
+
updatedTr = rescaleColumns(isTableScalingEnabled)(table, view)(
|
|
65
|
+
updatedTr,
|
|
66
|
+
);
|
|
73
67
|
}
|
|
74
68
|
|
|
75
69
|
if (
|
|
@@ -94,10 +88,7 @@ export function addColumnAt(
|
|
|
94
88
|
// :: (EditorState, dispatch: ?(tr: Transaction)) → bool
|
|
95
89
|
// Command to add a column before the column with the selection.
|
|
96
90
|
export const addColumnBefore =
|
|
97
|
-
(
|
|
98
|
-
getEditorContainerWidth: GetEditorContainerWidth,
|
|
99
|
-
tablePreserveWidth = false,
|
|
100
|
-
): Command =>
|
|
91
|
+
(isTableScalingEnabled = false): Command =>
|
|
101
92
|
(state, dispatch, view) => {
|
|
102
93
|
const table = findTable(state.selection);
|
|
103
94
|
if (!table) {
|
|
@@ -106,7 +97,7 @@ export const addColumnBefore =
|
|
|
106
97
|
if (dispatch) {
|
|
107
98
|
let rect = selectedRect(state);
|
|
108
99
|
dispatch(
|
|
109
|
-
addColumnAt(
|
|
100
|
+
addColumnAt(isTableScalingEnabled)(
|
|
110
101
|
rect.left,
|
|
111
102
|
getAllowAddColumnCustomStep(state),
|
|
112
103
|
view,
|
|
@@ -119,7 +110,7 @@ export const addColumnBefore =
|
|
|
119
110
|
// :: (EditorState, dispatch: ?(tr: Transaction)) → bool
|
|
120
111
|
// Command to add a column after the column with the selection.
|
|
121
112
|
export const addColumnAfter =
|
|
122
|
-
(
|
|
113
|
+
(isTableScalingEnabled?: boolean): Command =>
|
|
123
114
|
(state, dispatch, view) => {
|
|
124
115
|
const table = findTable(state.selection);
|
|
125
116
|
if (!table) {
|
|
@@ -128,7 +119,7 @@ export const addColumnAfter =
|
|
|
128
119
|
if (dispatch) {
|
|
129
120
|
let rect = selectedRect(state);
|
|
130
121
|
dispatch(
|
|
131
|
-
addColumnAt(
|
|
122
|
+
addColumnAt(isTableScalingEnabled)(
|
|
132
123
|
rect.right,
|
|
133
124
|
getAllowAddColumnCustomStep(state),
|
|
134
125
|
view,
|
|
@@ -139,13 +130,10 @@ export const addColumnAfter =
|
|
|
139
130
|
};
|
|
140
131
|
|
|
141
132
|
export const insertColumn =
|
|
142
|
-
(
|
|
143
|
-
getEditorContainerWidth: GetEditorContainerWidth,
|
|
144
|
-
tablePreserveWidth = false,
|
|
145
|
-
) =>
|
|
133
|
+
(isTableScalingEnabled = false) =>
|
|
146
134
|
(column: number): Command =>
|
|
147
135
|
(state, dispatch, view) => {
|
|
148
|
-
let tr = addColumnAt(
|
|
136
|
+
let tr = addColumnAt(isTableScalingEnabled)(
|
|
149
137
|
column,
|
|
150
138
|
getAllowAddColumnCustomStep(state),
|
|
151
139
|
view,
|
|
@@ -213,13 +201,13 @@ export const insertRow =
|
|
|
213
201
|
|
|
214
202
|
export const createTable =
|
|
215
203
|
(
|
|
204
|
+
isTableScalingEnabled?: boolean,
|
|
216
205
|
isFullWidthModeEnabled?: boolean,
|
|
217
|
-
getEditorFeatureFlags?: GetEditorFeatureFlags,
|
|
218
206
|
): Command =>
|
|
219
207
|
(state, dispatch) => {
|
|
220
208
|
const table = createTableWithWidth(
|
|
209
|
+
isTableScalingEnabled,
|
|
221
210
|
isFullWidthModeEnabled,
|
|
222
|
-
getEditorFeatureFlags,
|
|
223
211
|
)(state.schema);
|
|
224
212
|
|
|
225
213
|
if (dispatch) {
|
|
@@ -231,7 +219,7 @@ export const createTable =
|
|
|
231
219
|
export const insertTableWithSize =
|
|
232
220
|
(
|
|
233
221
|
isFullWidthModeEnabled?: boolean,
|
|
234
|
-
|
|
222
|
+
isTableScalingEnabled?: boolean,
|
|
235
223
|
editorAnalyticsAPI?: EditorAnalyticsAPI,
|
|
236
224
|
) =>
|
|
237
225
|
(
|
|
@@ -241,8 +229,8 @@ export const insertTableWithSize =
|
|
|
241
229
|
): EditorCommand => {
|
|
242
230
|
return ({ tr }) => {
|
|
243
231
|
const tableNode = createTableWithWidth(
|
|
232
|
+
isTableScalingEnabled,
|
|
244
233
|
isFullWidthModeEnabled,
|
|
245
|
-
getEditorFeatureFlags,
|
|
246
234
|
{
|
|
247
235
|
rowsCount: rowsCount,
|
|
248
236
|
colsCount: colsCount,
|
|
@@ -257,7 +257,7 @@ export const changeColumnWidthByStepWithAnalytics =
|
|
|
257
257
|
(
|
|
258
258
|
stepSize: number,
|
|
259
259
|
getEditorContainerWidth: GetEditorContainerWidth,
|
|
260
|
-
|
|
260
|
+
isTableScalingEnabled: boolean,
|
|
261
261
|
inputMethod: INPUT_METHOD.SHORTCUT,
|
|
262
262
|
) =>
|
|
263
263
|
withEditorAnalyticsAPI((state) => {
|
|
@@ -286,15 +286,14 @@ export const changeColumnWidthByStepWithAnalytics =
|
|
|
286
286
|
changeColumnWidthByStep(
|
|
287
287
|
stepSize,
|
|
288
288
|
getEditorContainerWidth,
|
|
289
|
-
|
|
289
|
+
isTableScalingEnabled,
|
|
290
290
|
),
|
|
291
291
|
);
|
|
292
292
|
|
|
293
293
|
export const insertColumnWithAnalytics =
|
|
294
294
|
(
|
|
295
|
-
getEditorContainerWidth: GetEditorContainerWidth,
|
|
296
295
|
editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null,
|
|
297
|
-
|
|
296
|
+
isTableScalingEnabled = false,
|
|
298
297
|
) =>
|
|
299
298
|
(
|
|
300
299
|
inputMethod:
|
|
@@ -321,9 +320,7 @@ export const insertColumnWithAnalytics =
|
|
|
321
320
|
},
|
|
322
321
|
eventType: EVENT_TYPE.TRACK,
|
|
323
322
|
};
|
|
324
|
-
})(editorAnalyticsAPI)(
|
|
325
|
-
insertColumn(getEditorContainerWidth, tablePreserveWidth)(position),
|
|
326
|
-
);
|
|
323
|
+
})(editorAnalyticsAPI)(insertColumn(isTableScalingEnabled)(position));
|
|
327
324
|
|
|
328
325
|
export const deleteRowsWithAnalytics =
|
|
329
326
|
(editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null) =>
|
|
@@ -364,7 +361,7 @@ export const deleteRowsWithAnalytics =
|
|
|
364
361
|
export const deleteColumnsWithAnalytics =
|
|
365
362
|
(
|
|
366
363
|
editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null,
|
|
367
|
-
|
|
364
|
+
isTableScalingEnabled = false,
|
|
368
365
|
) =>
|
|
369
366
|
(
|
|
370
367
|
inputMethod:
|
|
@@ -392,7 +389,7 @@ export const deleteColumnsWithAnalytics =
|
|
|
392
389
|
},
|
|
393
390
|
eventType: EVENT_TYPE.TRACK,
|
|
394
391
|
};
|
|
395
|
-
})(editorAnalyticsAPI)(deleteColumnsCommand(rect,
|
|
392
|
+
})(editorAnalyticsAPI)(deleteColumnsCommand(rect, isTableScalingEnabled));
|
|
396
393
|
|
|
397
394
|
export const deleteSelectedRowsOrColumnsWithAnalyticsViaShortcut =
|
|
398
395
|
(editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null): Command =>
|
package/src/event-handlers.ts
CHANGED
|
@@ -538,7 +538,7 @@ export const handleCut = (
|
|
|
538
538
|
newState: EditorState,
|
|
539
539
|
editorAnalyticsAPI?: EditorAnalyticsAPI,
|
|
540
540
|
editorView?: EditorView,
|
|
541
|
-
|
|
541
|
+
isTableScalingEnabled = false,
|
|
542
542
|
): Transaction => {
|
|
543
543
|
const oldSelection = oldState.tr.selection;
|
|
544
544
|
let { tr } = newState;
|
|
@@ -595,7 +595,7 @@ export const handleCut = (
|
|
|
595
595
|
rect,
|
|
596
596
|
getAllowAddColumnCustomStep(oldState),
|
|
597
597
|
editorView,
|
|
598
|
-
|
|
598
|
+
isTableScalingEnabled,
|
|
599
599
|
)(tr);
|
|
600
600
|
}
|
|
601
601
|
}
|