@atlaskit/editor-plugin-table 7.16.13 → 7.16.15
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 +17 -0
- package/dist/cjs/commands/column-resize.js +6 -3
- package/dist/cjs/commands/delete.js +2 -1
- package/dist/cjs/commands/insert.js +8 -5
- package/dist/cjs/commands/misc.js +17 -1
- package/dist/cjs/commands-with-analytics.js +6 -4
- package/dist/cjs/event-handlers.js +2 -1
- package/dist/cjs/nodeviews/TableComponent.js +21 -10
- package/dist/cjs/nodeviews/TableContainer.js +7 -3
- package/dist/cjs/nodeviews/TableResizer.js +3 -2
- package/dist/cjs/plugin.js +4 -3
- package/dist/cjs/pm-plugins/drag-and-drop/plugin.js +4 -2
- package/dist/cjs/pm-plugins/keymap.js +5 -4
- package/dist/cjs/pm-plugins/main.js +2 -2
- package/dist/cjs/pm-plugins/table-resizing/event-handlers.js +12 -7
- package/dist/cjs/pm-plugins/table-resizing/utils/colgroup.js +6 -5
- package/dist/cjs/pm-plugins/table-resizing/utils/consts.js +2 -1
- package/dist/cjs/pm-plugins/table-resizing/utils/index.js +6 -0
- package/dist/cjs/pm-plugins/table-resizing/utils/misc.js +6 -4
- package/dist/cjs/pm-plugins/table-resizing/utils/resize-column.js +5 -3
- package/dist/cjs/pm-plugins/table-resizing/utils/resize-state.js +13 -8
- package/dist/cjs/pm-plugins/table-resizing/utils/scale-table.js +17 -9
- package/dist/cjs/toolbar.js +10 -5
- package/dist/cjs/transforms/column-width.js +3 -1
- package/dist/cjs/transforms/delete-columns.js +2 -1
- package/dist/cjs/ui/FloatingContextualMenu/ContextualMenu.js +4 -2
- package/dist/cjs/ui/FloatingDragMenu/DragMenu.js +3 -2
- package/dist/cjs/ui/FloatingDragMenu/index.js +4 -1
- package/dist/cjs/ui/FloatingInsertButton/index.js +3 -1
- package/dist/cjs/utils/drag-menu.js +2 -1
- package/dist/es2019/commands/column-resize.js +6 -3
- package/dist/es2019/commands/delete.js +2 -2
- package/dist/es2019/commands/insert.js +8 -8
- package/dist/es2019/commands/misc.js +17 -1
- package/dist/es2019/commands-with-analytics.js +6 -6
- package/dist/es2019/event-handlers.js +2 -2
- package/dist/es2019/nodeviews/TableComponent.js +21 -10
- package/dist/es2019/nodeviews/TableContainer.js +7 -3
- package/dist/es2019/nodeviews/TableResizer.js +3 -2
- package/dist/es2019/plugin.js +4 -3
- package/dist/es2019/pm-plugins/drag-and-drop/plugin.js +4 -2
- package/dist/es2019/pm-plugins/keymap.js +5 -5
- package/dist/es2019/pm-plugins/main.js +2 -2
- package/dist/es2019/pm-plugins/table-resizing/event-handlers.js +12 -7
- package/dist/es2019/pm-plugins/table-resizing/utils/colgroup.js +6 -6
- package/dist/es2019/pm-plugins/table-resizing/utils/consts.js +1 -0
- package/dist/es2019/pm-plugins/table-resizing/utils/index.js +1 -1
- package/dist/es2019/pm-plugins/table-resizing/utils/misc.js +7 -5
- package/dist/es2019/pm-plugins/table-resizing/utils/resize-column.js +5 -5
- package/dist/es2019/pm-plugins/table-resizing/utils/resize-state.js +12 -8
- package/dist/es2019/pm-plugins/table-resizing/utils/scale-table.js +17 -12
- package/dist/es2019/toolbar.js +10 -8
- package/dist/es2019/transforms/column-width.js +3 -2
- package/dist/es2019/transforms/delete-columns.js +2 -2
- package/dist/es2019/ui/FloatingContextualMenu/ContextualMenu.js +4 -2
- package/dist/es2019/ui/FloatingDragMenu/DragMenu.js +3 -2
- package/dist/es2019/ui/FloatingDragMenu/index.js +4 -1
- package/dist/es2019/ui/FloatingInsertButton/index.js +3 -1
- package/dist/es2019/utils/drag-menu.js +2 -2
- package/dist/esm/commands/column-resize.js +6 -3
- package/dist/esm/commands/delete.js +2 -1
- package/dist/esm/commands/insert.js +8 -5
- package/dist/esm/commands/misc.js +17 -1
- package/dist/esm/commands-with-analytics.js +6 -4
- package/dist/esm/event-handlers.js +2 -1
- package/dist/esm/nodeviews/TableComponent.js +21 -10
- package/dist/esm/nodeviews/TableContainer.js +7 -3
- package/dist/esm/nodeviews/TableResizer.js +3 -2
- package/dist/esm/plugin.js +4 -3
- package/dist/esm/pm-plugins/drag-and-drop/plugin.js +4 -2
- package/dist/esm/pm-plugins/keymap.js +5 -4
- package/dist/esm/pm-plugins/main.js +2 -2
- package/dist/esm/pm-plugins/table-resizing/event-handlers.js +12 -7
- package/dist/esm/pm-plugins/table-resizing/utils/colgroup.js +6 -5
- package/dist/esm/pm-plugins/table-resizing/utils/consts.js +1 -0
- package/dist/esm/pm-plugins/table-resizing/utils/index.js +1 -1
- package/dist/esm/pm-plugins/table-resizing/utils/misc.js +7 -5
- package/dist/esm/pm-plugins/table-resizing/utils/resize-column.js +5 -3
- package/dist/esm/pm-plugins/table-resizing/utils/resize-state.js +13 -8
- package/dist/esm/pm-plugins/table-resizing/utils/scale-table.js +17 -9
- package/dist/esm/toolbar.js +10 -5
- package/dist/esm/transforms/column-width.js +3 -1
- package/dist/esm/transforms/delete-columns.js +2 -1
- package/dist/esm/ui/FloatingContextualMenu/ContextualMenu.js +4 -2
- package/dist/esm/ui/FloatingDragMenu/DragMenu.js +3 -2
- package/dist/esm/ui/FloatingDragMenu/index.js +4 -1
- package/dist/esm/ui/FloatingInsertButton/index.js +3 -1
- package/dist/esm/utils/drag-menu.js +2 -1
- package/dist/types/commands/delete.d.ts +1 -1
- package/dist/types/commands/insert.d.ts +4 -4
- package/dist/types/commands-with-analytics.d.ts +3 -3
- package/dist/types/event-handlers.d.ts +1 -1
- package/dist/types/nodeviews/TableContainer.d.ts +4 -2
- package/dist/types/nodeviews/TableResizer.d.ts +2 -1
- package/dist/types/pm-plugins/keymap.d.ts +1 -1
- package/dist/types/pm-plugins/main.d.ts +1 -1
- package/dist/types/pm-plugins/table-resizing/utils/colgroup.d.ts +2 -2
- 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 +2 -2
- package/dist/types/pm-plugins/table-resizing/utils/resize-column.d.ts +2 -2
- package/dist/types/pm-plugins/table-resizing/utils/resize-state.d.ts +3 -2
- package/dist/types/pm-plugins/table-resizing/utils/scale-table.d.ts +3 -3
- 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/FloatingDragMenu/DragMenu.d.ts +2 -1
- package/dist/types/utils/drag-menu.d.ts +1 -1
- package/dist/types-ts4.5/commands/delete.d.ts +1 -1
- package/dist/types-ts4.5/commands/insert.d.ts +4 -4
- 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/TableContainer.d.ts +4 -2
- package/dist/types-ts4.5/nodeviews/TableResizer.d.ts +2 -1
- package/dist/types-ts4.5/pm-plugins/keymap.d.ts +1 -1
- package/dist/types-ts4.5/pm-plugins/main.d.ts +1 -1
- 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 +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 +2 -2
- package/dist/types-ts4.5/pm-plugins/table-resizing/utils/resize-column.d.ts +2 -2
- package/dist/types-ts4.5/pm-plugins/table-resizing/utils/resize-state.d.ts +3 -2
- package/dist/types-ts4.5/pm-plugins/table-resizing/utils/scale-table.d.ts +3 -3
- 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/FloatingDragMenu/DragMenu.d.ts +2 -1
- package/dist/types-ts4.5/utils/drag-menu.d.ts +1 -1
- package/package.json +4 -1
- package/src/commands/column-resize.ts +9 -3
- package/src/commands/delete.ts +2 -1
- package/src/commands/insert.ts +31 -12
- package/src/commands/misc.ts +20 -4
- package/src/commands-with-analytics.ts +24 -8
- package/src/event-handlers.ts +2 -0
- package/src/nodeviews/TableComponent.tsx +41 -12
- package/src/nodeviews/TableContainer.tsx +6 -0
- package/src/nodeviews/TableResizer.tsx +4 -0
- package/src/plugin.tsx +9 -0
- package/src/pm-plugins/drag-and-drop/plugin.ts +13 -4
- package/src/pm-plugins/keymap.ts +17 -4
- package/src/pm-plugins/main.ts +2 -0
- package/src/pm-plugins/table-resizing/event-handlers.ts +21 -10
- package/src/pm-plugins/table-resizing/utils/colgroup.ts +14 -4
- package/src/pm-plugins/table-resizing/utils/consts.ts +1 -0
- package/src/pm-plugins/table-resizing/utils/index.ts +1 -0
- package/src/pm-plugins/table-resizing/utils/misc.ts +24 -5
- package/src/pm-plugins/table-resizing/utils/resize-column.ts +11 -4
- package/src/pm-plugins/table-resizing/utils/resize-state.ts +17 -6
- package/src/pm-plugins/table-resizing/utils/scale-table.ts +32 -9
- package/src/toolbar.tsx +18 -10
- package/src/transforms/column-width.ts +2 -1
- package/src/transforms/delete-columns.ts +11 -2
- package/src/ui/FloatingContextualMenu/ContextualMenu.tsx +12 -5
- package/src/ui/FloatingDragMenu/DragMenu.tsx +3 -0
- package/src/ui/FloatingDragMenu/index.tsx +7 -0
- package/src/ui/FloatingInsertButton/index.tsx +7 -0
- package/src/utils/drag-menu.ts +2 -0
|
@@ -9,8 +9,8 @@ type Col = Array<string | {
|
|
|
9
9
|
* overflow.
|
|
10
10
|
*/
|
|
11
11
|
export declare const getColWidthFix: (colwidth: number, tableColumnCount: number) => number;
|
|
12
|
-
export declare const generateColgroup: (table: PmNode, tableRef?: HTMLElement) => Col[];
|
|
13
|
-
export declare const insertColgroupFromNode: (tableRef: HTMLTableElement | null, table: PmNode, isTableScalingEnabled?: boolean, shouldRemove?: boolean) => HTMLCollection;
|
|
12
|
+
export declare const generateColgroup: (table: PmNode, tableRef?: HTMLElement, shouldUseIncreasedScalingPercent?: boolean) => Col[];
|
|
13
|
+
export declare const insertColgroupFromNode: (tableRef: HTMLTableElement | null, table: PmNode, isTableScalingEnabled?: boolean, shouldRemove?: boolean, shouldUseIncreasedScalingPercent?: 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
|
|
@@ -2,4 +2,5 @@ export declare const COLUMN_MIN_WIDTH = 48;
|
|
|
2
2
|
export declare const TABLE_DEFAULT_WIDTH = 760;
|
|
3
3
|
export declare const TABLE_MAX_WIDTH = 1800;
|
|
4
4
|
export declare const MAX_SCALING_PERCENT = 0.3;
|
|
5
|
+
export declare const MAX_SCALING_PERCENT_TABLES_WITH_FIXED_COLUMN_WIDTHS_OPTION = 0.4;
|
|
5
6
|
export declare const TABLE_EDITOR_MARGIN = 76;
|
|
@@ -10,4 +10,4 @@ export { scale, scaleWithParent, scaleTable, previewScaleTable } from './scale-t
|
|
|
10
10
|
export type { ScaleOptions } from './scale-table';
|
|
11
11
|
export type { ResizeState, ResizeStateWithAnalytics } from './types';
|
|
12
12
|
export { resizeColumn, resizeColumnAndTable } from './resize-column';
|
|
13
|
-
export { COLUMN_MIN_WIDTH, TABLE_MAX_WIDTH, TABLE_DEFAULT_WIDTH, MAX_SCALING_PERCENT, } from './consts';
|
|
13
|
+
export { COLUMN_MIN_WIDTH, TABLE_MAX_WIDTH, TABLE_DEFAULT_WIDTH, MAX_SCALING_PERCENT, MAX_SCALING_PERCENT_TABLES_WITH_FIXED_COLUMN_WIDTHS_OPTION, } from './consts';
|
|
@@ -24,6 +24,6 @@ export declare const getTableMaxWidth: ({ table, tableStart, state, layout, getE
|
|
|
24
24
|
*/
|
|
25
25
|
export declare const getTableElementWidth: (table: PMNode) => number;
|
|
26
26
|
export declare const getTableContainerElementWidth: (table: PMNode) => number;
|
|
27
|
-
export declare const getTableScalingPercent: (table: PMNode, tableRef: HTMLElement | null) => number;
|
|
28
|
-
export declare const getStaticTableScalingPercent: (table: PMNode, tableRenderWidth: number) => number;
|
|
27
|
+
export declare const getTableScalingPercent: (table: PMNode, tableRef: HTMLElement | null, shouldUseIncreasedScalingPercent?: boolean) => number;
|
|
28
|
+
export declare const getStaticTableScalingPercent: (table: PMNode, tableRenderWidth: number, shouldUseIncreasedScalingPercent?: boolean) => number;
|
|
29
29
|
export {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { Node as PmNode } from '@atlaskit/editor-prosemirror/model';
|
|
2
2
|
import type { ResizeState } from './types';
|
|
3
|
-
export declare const resizeColumn: (resizeState: ResizeState, colIndex: number, amount: number, tableRef: HTMLElement | null, tableNode: PmNode, selectedColumns?: number[], isTableScalingEnabled?: boolean) => ResizeState;
|
|
4
|
-
export declare const resizeColumnAndTable: (resizeState: ResizeState, colIndex: number, amount: number, tableRef: HTMLElement, tableNode: PmNode, selectedColumns?: number[], isTableScalingEnabled?: boolean, originalTableWidth?: number) => ResizeState;
|
|
3
|
+
export declare const resizeColumn: (resizeState: ResizeState, colIndex: number, amount: number, tableRef: HTMLElement | null, tableNode: PmNode, selectedColumns?: number[], isTableScalingEnabled?: boolean, shouldUseIncreasedScalingPercent?: boolean) => ResizeState;
|
|
4
|
+
export declare const resizeColumnAndTable: (resizeState: ResizeState, colIndex: number, amount: number, tableRef: HTMLElement, tableNode: PmNode, selectedColumns?: number[], isTableScalingEnabled?: boolean, originalTableWidth?: number, shouldUseIncreasedScalingPercent?: boolean) => ResizeState;
|
|
@@ -3,7 +3,7 @@ import type { Node as PMNode } from '@atlaskit/editor-prosemirror/model';
|
|
|
3
3
|
import type { EditorState } from '@atlaskit/editor-prosemirror/state';
|
|
4
4
|
import type { Rect } from '@atlaskit/editor-tables/table-map';
|
|
5
5
|
import type { ResizeState, ResizeStateWithAnalytics } from './types';
|
|
6
|
-
export declare const getResizeState: ({ minWidth, maxSize, table, tableRef, start, domAtPos, isTableScalingEnabled, }: {
|
|
6
|
+
export declare const getResizeState: ({ minWidth, maxSize, table, tableRef, start, domAtPos, isTableScalingEnabled, shouldUseIncreasedScalingPercent, }: {
|
|
7
7
|
minWidth: number;
|
|
8
8
|
maxSize: number;
|
|
9
9
|
table: PMNode;
|
|
@@ -14,8 +14,9 @@ export declare const getResizeState: ({ minWidth, maxSize, table, tableRef, star
|
|
|
14
14
|
offset: number;
|
|
15
15
|
};
|
|
16
16
|
isTableScalingEnabled: boolean;
|
|
17
|
+
shouldUseIncreasedScalingPercent: boolean;
|
|
17
18
|
}) => ResizeState;
|
|
18
|
-
export declare const updateColgroup: (state: ResizeState, tableRef: HTMLElement | null, tableNode?: PMNode, isTableScalingEnabled?: boolean) => void;
|
|
19
|
+
export declare const updateColgroup: (state: ResizeState, tableRef: HTMLElement | null, tableNode?: PMNode, isTableScalingEnabled?: boolean, shouldUseIncreasedScalingPercent?: boolean) => void;
|
|
19
20
|
export declare const getTotalWidth: ({ cols }: ResizeState) => number;
|
|
20
21
|
export declare const adjustColumnsWidths: (resizeState: ResizeState, maxSize: number) => ResizeState;
|
|
21
22
|
export declare const evenAllColumnsWidths: (resizeState: ResizeState) => ResizeState;
|
|
@@ -13,8 +13,8 @@ export interface ScaleOptions {
|
|
|
13
13
|
isFullWidthModeEnabled?: boolean;
|
|
14
14
|
isTableResizingEnabled?: boolean;
|
|
15
15
|
}
|
|
16
|
-
export declare const scale: (tableRef: HTMLTableElement, options: ScaleOptions, domAtPos: DomAtPos, isTableScalingEnabledOnCurrentTable?: boolean) => ResizeState | undefined;
|
|
17
|
-
export declare const scaleWithParent: (tableRef: HTMLTableElement, parentWidth: number, table: PMNode, start: number, domAtPos: DomAtPos, isTableScalingEnabledOnCurrentTable?: boolean) => ResizeState;
|
|
16
|
+
export declare const scale: (tableRef: HTMLTableElement, options: ScaleOptions, domAtPos: DomAtPos, isTableScalingEnabledOnCurrentTable?: boolean, shouldUseIncreasedScalingPercent?: boolean) => ResizeState | undefined;
|
|
17
|
+
export declare const scaleWithParent: (tableRef: HTMLTableElement, parentWidth: number, table: PMNode, start: number, domAtPos: DomAtPos, isTableScalingEnabledOnCurrentTable?: boolean, shouldUseIncreasedScalingPercent?: boolean) => ResizeState;
|
|
18
18
|
export declare function scaleTableTo(state: ResizeState, maxSize: number): ResizeState;
|
|
19
19
|
export declare const previewScaleTable: (tableRef: HTMLTableElement | null | undefined, options: ScaleOptions, domAtPos: DomAtPos, isTableScalingEnabled?: boolean) => void;
|
|
20
|
-
export declare const scaleTable: (tableRef: HTMLTableElement | null | undefined, options: ScaleOptions, domAtPos: DomAtPos, isTableScalingEnabledOnCurrentTable?: boolean) => (tr: Transaction) => Transaction;
|
|
20
|
+
export declare const scaleTable: (tableRef: HTMLTableElement | null | undefined, options: ScaleOptions, domAtPos: DomAtPos, isTableScalingEnabledOnCurrentTable?: boolean, shouldUseIncreasedScalingPercent?: boolean) => (tr: Transaction) => Transaction;
|
|
@@ -8,10 +8,10 @@ import { Rect } from '@atlaskit/editor-tables/table-map';
|
|
|
8
8
|
import type { TablePluginOptions } from './plugin';
|
|
9
9
|
import type { AlignmentOptions, PluginConfig, ToolbarMenuConfig, ToolbarMenuContext, ToolbarMenuState } from './types';
|
|
10
10
|
export declare const getToolbarMenuConfig: (config: ToolbarMenuConfig, state: ToolbarMenuState, { formatMessage }: ToolbarMenuContext, editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null) => FloatingToolbarItem<Command>;
|
|
11
|
-
export declare const getToolbarCellOptionsConfig: (editorState: EditorState, editorView: EditorView | undefined | null, initialSelectionRect: Rect, { formatMessage }: ToolbarMenuContext, getEditorContainerWidth: GetEditorContainerWidth, editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null, isTableScalingEnabled?: boolean) => FloatingToolbarDropdown<Command>;
|
|
11
|
+
export declare const getToolbarCellOptionsConfig: (editorState: EditorState, editorView: EditorView | undefined | null, initialSelectionRect: Rect, { formatMessage }: ToolbarMenuContext, getEditorContainerWidth: GetEditorContainerWidth, editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null, isTableScalingEnabled?: boolean, shouldUseIncreasedScalingPercent?: boolean) => FloatingToolbarDropdown<Command>;
|
|
12
12
|
export declare const getClosestSelectionRect: (state: EditorState) => Rect | undefined;
|
|
13
13
|
export declare const getClosestSelectionOrTableRect: (state: EditorState) => Rect | undefined;
|
|
14
|
-
export declare const getToolbarConfig: (getEditorContainerWidth: GetEditorContainerWidth, editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null, getEditorFeatureFlags: GetEditorFeatureFlags, getEditorView: () => EditorView | null, options?: TablePluginOptions) => (config: PluginConfig) => FloatingToolbarHandler;
|
|
14
|
+
export declare const getToolbarConfig: (getEditorContainerWidth: GetEditorContainerWidth, editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null, getEditorFeatureFlags: GetEditorFeatureFlags, getEditorView: () => EditorView | null, options?: TablePluginOptions, shouldUseIncreasedScalingPercent?: boolean) => (config: PluginConfig) => FloatingToolbarHandler;
|
|
15
15
|
export declare const getLockBtnConfig: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null) => Command;
|
|
16
16
|
export declare const getDistributeConfig: (getEditorContainerWidth: GetEditorContainerWidth, editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null, isTableScalingEnabled?: boolean) => Command;
|
|
17
17
|
type AlignmentIcon = {
|
|
@@ -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: (isTableScalingEnabled?: boolean) => (table: ContentNodeWithPos, view: EditorView | undefined) => (tr: Transaction) => Transaction;
|
|
24
|
+
export declare const rescaleColumns: (isTableScalingEnabled?: boolean, shouldUseIncreasedScalingPercent?: 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, isTableScalingEnabled?: boolean) => (tr: Transaction) => Transaction;
|
|
4
|
+
export declare const deleteColumns: (rect: Rect, allowCustomStep: boolean, view?: EditorView, isTableScalingEnabled?: boolean, shouldUseIncreasedScalingPercent?: boolean) => (tr: Transaction) => Transaction;
|
|
@@ -26,8 +26,9 @@ type DragMenuProps = {
|
|
|
26
26
|
scrollableElement?: HTMLElement;
|
|
27
27
|
isTableScalingEnabled?: boolean;
|
|
28
28
|
tableDuplicateCellColouring?: boolean;
|
|
29
|
+
shouldUseIncreasedScalingPercent?: boolean;
|
|
29
30
|
};
|
|
30
|
-
export declare const DragMenu: React.MemoExoticComponent<({ direction, index, target, isOpen, editorView, tableNode, targetCellPosition, getEditorContainerWidth, editorAnalyticsAPI, pluginConfig, intl: { formatMessage }, fitHeight, fitWidth, mountPoint, scrollableElement, boundariesElement, isTableScalingEnabled, tableDuplicateCellColouring, }: DragMenuProps & WrappedComponentProps) => jsx.JSX.Element | null>;
|
|
31
|
+
export declare const DragMenu: React.MemoExoticComponent<({ direction, index, target, isOpen, editorView, tableNode, targetCellPosition, getEditorContainerWidth, editorAnalyticsAPI, pluginConfig, intl: { formatMessage }, fitHeight, fitWidth, mountPoint, scrollableElement, boundariesElement, isTableScalingEnabled, tableDuplicateCellColouring, shouldUseIncreasedScalingPercent, }: DragMenuProps & WrappedComponentProps) => jsx.JSX.Element | null>;
|
|
31
32
|
declare const _default: React.FC<import("react-intl-next").WithIntlProps<DragMenuProps & WrappedComponentProps>> & {
|
|
32
33
|
WrappedComponent: React.ComponentType<DragMenuProps & WrappedComponentProps>;
|
|
33
34
|
};
|
|
@@ -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, isTableScalingEnabled?: boolean, tableDuplicateCellColouring?: 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, isTableScalingEnabled?: boolean, tableDuplicateCellColouring?: boolean, shouldUseIncreasedScalingPercent?: boolean) => DragMenuConfig[];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-table",
|
|
3
|
-
"version": "7.16.
|
|
3
|
+
"version": "7.16.15",
|
|
4
4
|
"description": "Table plugin for the @atlaskit/editor",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -132,6 +132,9 @@
|
|
|
132
132
|
"platform.editor.table.colum-resizing-improvements": {
|
|
133
133
|
"type": "boolean"
|
|
134
134
|
},
|
|
135
|
+
"platform.editor.table.use-increased-scaling-percent": {
|
|
136
|
+
"type": "boolean"
|
|
137
|
+
},
|
|
135
138
|
"platform.editor.explicit-html-element-check": {
|
|
136
139
|
"type": "boolean"
|
|
137
140
|
},
|
|
@@ -326,13 +326,17 @@ export const changeColumnWidthByStep =
|
|
|
326
326
|
});
|
|
327
327
|
|
|
328
328
|
let isTableScalingEnabledOnCurrentTable = isTableScalingEnabled;
|
|
329
|
-
|
|
329
|
+
const isTableScalingEnabledWithLockButton =
|
|
330
330
|
isTableScalingEnabled &&
|
|
331
|
-
getBooleanFF('platform.editor.table.preserve-widths-with-lock-button')
|
|
332
|
-
) {
|
|
331
|
+
getBooleanFF('platform.editor.table.preserve-widths-with-lock-button');
|
|
332
|
+
if (isTableScalingEnabledWithLockButton) {
|
|
333
333
|
isTableScalingEnabledOnCurrentTable = originalTable.attrs.displayMode !== 'fixed';
|
|
334
334
|
}
|
|
335
335
|
|
|
336
|
+
const shouldUseIncreasedScalingPercent =
|
|
337
|
+
isTableScalingEnabledWithLockButton &&
|
|
338
|
+
getBooleanFF('platform.editor.table.use-increased-scaling-percent');
|
|
339
|
+
|
|
336
340
|
const initialResizeState = getResizeState({
|
|
337
341
|
minWidth: tableCellMinWidth,
|
|
338
342
|
maxSize,
|
|
@@ -341,6 +345,7 @@ export const changeColumnWidthByStep =
|
|
|
341
345
|
start: tableStartPosition,
|
|
342
346
|
domAtPos,
|
|
343
347
|
isTableScalingEnabled: isTableScalingEnabledOnCurrentTable,
|
|
348
|
+
shouldUseIncreasedScalingPercent,
|
|
344
349
|
});
|
|
345
350
|
|
|
346
351
|
updateControls()(state);
|
|
@@ -358,6 +363,7 @@ export const changeColumnWidthByStep =
|
|
|
358
363
|
originalTable,
|
|
359
364
|
resizingSelectedColumns ? selectedColumns : undefined,
|
|
360
365
|
isTableScalingEnabled,
|
|
366
|
+
shouldUseIncreasedScalingPercent,
|
|
361
367
|
);
|
|
362
368
|
|
|
363
369
|
customTr = updateColumnWidths(newResizeState, originalTable, tableStartPosition)(customTr);
|
package/src/commands/delete.ts
CHANGED
|
@@ -5,13 +5,14 @@ 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, isTableScalingEnabled = false): Command =>
|
|
8
|
+
(rect: Rect, isTableScalingEnabled = false, shouldUseIncreasedScalingPercent = 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
|
+
shouldUseIncreasedScalingPercent,
|
|
15
16
|
)(state.tr);
|
|
16
17
|
if (dispatch) {
|
|
17
18
|
dispatch(tr);
|
package/src/commands/insert.ts
CHANGED
|
@@ -38,7 +38,11 @@ function addColumnAtCustomStep(column: number) {
|
|
|
38
38
|
};
|
|
39
39
|
}
|
|
40
40
|
|
|
41
|
-
export function addColumnAt(
|
|
41
|
+
export function addColumnAt(
|
|
42
|
+
isTableScalingEnabled = false,
|
|
43
|
+
isCellBackgroundDuplicated?: boolean,
|
|
44
|
+
shouldUseIncreasedScalingPercent?: boolean,
|
|
45
|
+
) {
|
|
42
46
|
return (
|
|
43
47
|
column: number,
|
|
44
48
|
allowAddColumnCustomStep: boolean = false,
|
|
@@ -54,7 +58,10 @@ export function addColumnAt(isTableScalingEnabled = false, isCellBackgroundDupli
|
|
|
54
58
|
const table = findTable(updatedTr.selection);
|
|
55
59
|
if (table) {
|
|
56
60
|
// [ED-8288] Update colwidths manually to avoid multiple dispatch in TableComponent
|
|
57
|
-
updatedTr = rescaleColumns(isTableScalingEnabled
|
|
61
|
+
updatedTr = rescaleColumns(isTableScalingEnabled, shouldUseIncreasedScalingPercent)(
|
|
62
|
+
table,
|
|
63
|
+
view,
|
|
64
|
+
)(updatedTr);
|
|
58
65
|
}
|
|
59
66
|
|
|
60
67
|
if (view) {
|
|
@@ -76,7 +83,7 @@ export function addColumnAt(isTableScalingEnabled = false, isCellBackgroundDupli
|
|
|
76
83
|
// :: (EditorState, dispatch: ?(tr: Transaction)) → bool
|
|
77
84
|
// Command to add a column before the column with the selection.
|
|
78
85
|
export const addColumnBefore =
|
|
79
|
-
(isTableScalingEnabled = false): Command =>
|
|
86
|
+
(isTableScalingEnabled = false, shouldUseIncreasedScalingPercent = false): Command =>
|
|
80
87
|
(state, dispatch, view) => {
|
|
81
88
|
const table = findTable(state.selection);
|
|
82
89
|
if (!table) {
|
|
@@ -85,9 +92,11 @@ export const addColumnBefore =
|
|
|
85
92
|
if (dispatch) {
|
|
86
93
|
let rect = selectedRect(state);
|
|
87
94
|
dispatch(
|
|
88
|
-
addColumnAt(isTableScalingEnabled
|
|
89
|
-
|
|
90
|
-
|
|
95
|
+
addColumnAt(isTableScalingEnabled, shouldUseIncreasedScalingPercent)(
|
|
96
|
+
rect.left,
|
|
97
|
+
getAllowAddColumnCustomStep(state),
|
|
98
|
+
view,
|
|
99
|
+
)(state.tr),
|
|
91
100
|
);
|
|
92
101
|
}
|
|
93
102
|
return true;
|
|
@@ -96,7 +105,7 @@ export const addColumnBefore =
|
|
|
96
105
|
// :: (EditorState, dispatch: ?(tr: Transaction)) → bool
|
|
97
106
|
// Command to add a column after the column with the selection.
|
|
98
107
|
export const addColumnAfter =
|
|
99
|
-
(isTableScalingEnabled?: boolean): Command =>
|
|
108
|
+
(isTableScalingEnabled?: boolean, shouldUseIncreasedScalingPercent?: boolean): Command =>
|
|
100
109
|
(state, dispatch, view) => {
|
|
101
110
|
const table = findTable(state.selection);
|
|
102
111
|
if (!table) {
|
|
@@ -105,19 +114,29 @@ export const addColumnAfter =
|
|
|
105
114
|
if (dispatch) {
|
|
106
115
|
let rect = selectedRect(state);
|
|
107
116
|
dispatch(
|
|
108
|
-
addColumnAt(isTableScalingEnabled
|
|
109
|
-
|
|
110
|
-
|
|
117
|
+
addColumnAt(isTableScalingEnabled, shouldUseIncreasedScalingPercent)(
|
|
118
|
+
rect.right,
|
|
119
|
+
getAllowAddColumnCustomStep(state),
|
|
120
|
+
view,
|
|
121
|
+
)(state.tr),
|
|
111
122
|
);
|
|
112
123
|
}
|
|
113
124
|
return true;
|
|
114
125
|
};
|
|
115
126
|
|
|
116
127
|
export const insertColumn =
|
|
117
|
-
(
|
|
128
|
+
(
|
|
129
|
+
isTableScalingEnabled = false,
|
|
130
|
+
isCellBackgroundDuplicated?: boolean,
|
|
131
|
+
shouldUseIncreasedScalingPercent?: boolean,
|
|
132
|
+
) =>
|
|
118
133
|
(column: number): Command =>
|
|
119
134
|
(state, dispatch, view) => {
|
|
120
|
-
let tr = addColumnAt(
|
|
135
|
+
let tr = addColumnAt(
|
|
136
|
+
isTableScalingEnabled,
|
|
137
|
+
isCellBackgroundDuplicated,
|
|
138
|
+
shouldUseIncreasedScalingPercent,
|
|
139
|
+
)(
|
|
121
140
|
column,
|
|
122
141
|
getAllowAddColumnCustomStep(state),
|
|
123
142
|
view,
|
package/src/commands/misc.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import isEqual from 'lodash/isEqual';
|
|
2
2
|
|
|
3
|
-
import type { CellAttributes, TableLayout } from '@atlaskit/adf-schema';
|
|
3
|
+
import type { CellAttributes, TableAttributes, TableLayout } from '@atlaskit/adf-schema';
|
|
4
|
+
import { getTableContainerWidth } from '@atlaskit/editor-common/node-width';
|
|
4
5
|
import type { Command, EditorCommand } from '@atlaskit/editor-common/types';
|
|
5
6
|
import {
|
|
6
7
|
closestElement,
|
|
@@ -735,7 +736,14 @@ export const setTableAlignment =
|
|
|
735
736
|
const nextTableAttrs = {
|
|
736
737
|
...tableObject.node.attrs,
|
|
737
738
|
layout: newAlignment,
|
|
738
|
-
};
|
|
739
|
+
} as TableAttributes;
|
|
740
|
+
|
|
741
|
+
// table uses old breakout values in layout attribute to determine width
|
|
742
|
+
// but that information is lost when alignment changes, so we need to ensure we retain that info
|
|
743
|
+
if (!tableObject.node.attrs.width) {
|
|
744
|
+
const tableWidth = getTableContainerWidth(tableObject.node);
|
|
745
|
+
nextTableAttrs.width = tableWidth;
|
|
746
|
+
}
|
|
739
747
|
|
|
740
748
|
tr.setNodeMarkup(tableObject.pos, undefined, nextTableAttrs).setMeta('scrollIntoView', false);
|
|
741
749
|
|
|
@@ -745,10 +753,18 @@ export const setTableAlignment =
|
|
|
745
753
|
export const setTableAlignmentWithTableContentWithPos =
|
|
746
754
|
(newAlignment: TableLayout, tableNodeWithPos: NodeWithPos): EditorCommand =>
|
|
747
755
|
({ tr }) => {
|
|
756
|
+
const table = tableNodeWithPos.node;
|
|
748
757
|
const nextTableAttrs = {
|
|
749
|
-
...
|
|
758
|
+
...table.attrs,
|
|
750
759
|
layout: newAlignment,
|
|
751
|
-
};
|
|
760
|
+
} as TableAttributes;
|
|
761
|
+
|
|
762
|
+
// table uses old breakout values in layout attribute to determine width
|
|
763
|
+
// but that information is lost when alignment changes, so we need to ensure we retain that info
|
|
764
|
+
if (!table.attrs.width) {
|
|
765
|
+
const tableWidth = getTableContainerWidth(table);
|
|
766
|
+
nextTableAttrs.width = tableWidth;
|
|
767
|
+
}
|
|
752
768
|
|
|
753
769
|
tr.setNodeMarkup(tableNodeWithPos.pos, undefined, nextTableAttrs).setMeta(
|
|
754
770
|
'scrollIntoView',
|
|
@@ -276,6 +276,7 @@ export const insertColumnWithAnalytics =
|
|
|
276
276
|
editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null,
|
|
277
277
|
isTableScalingEnabled = false,
|
|
278
278
|
isCellbackgroundDuplicated = false,
|
|
279
|
+
shouldUseIncreasedScalingPercent = false,
|
|
279
280
|
) =>
|
|
280
281
|
(
|
|
281
282
|
inputMethod:
|
|
@@ -301,7 +302,11 @@ export const insertColumnWithAnalytics =
|
|
|
301
302
|
eventType: EVENT_TYPE.TRACK,
|
|
302
303
|
};
|
|
303
304
|
})(editorAnalyticsAPI)(
|
|
304
|
-
insertColumn(
|
|
305
|
+
insertColumn(
|
|
306
|
+
isTableScalingEnabled,
|
|
307
|
+
isCellbackgroundDuplicated,
|
|
308
|
+
shouldUseIncreasedScalingPercent,
|
|
309
|
+
)(position),
|
|
305
310
|
);
|
|
306
311
|
|
|
307
312
|
export const deleteRowsWithAnalytics =
|
|
@@ -340,7 +345,11 @@ export const deleteRowsWithAnalytics =
|
|
|
340
345
|
});
|
|
341
346
|
|
|
342
347
|
export const deleteColumnsWithAnalytics =
|
|
343
|
-
(
|
|
348
|
+
(
|
|
349
|
+
editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null,
|
|
350
|
+
isTableScalingEnabled = false,
|
|
351
|
+
shouldUseIncreasedScalingPercent = false,
|
|
352
|
+
) =>
|
|
344
353
|
(
|
|
345
354
|
inputMethod:
|
|
346
355
|
| INPUT_METHOD.CONTEXT_MENU
|
|
@@ -366,10 +375,16 @@ export const deleteColumnsWithAnalytics =
|
|
|
366
375
|
},
|
|
367
376
|
eventType: EVENT_TYPE.TRACK,
|
|
368
377
|
};
|
|
369
|
-
})(editorAnalyticsAPI)(
|
|
378
|
+
})(editorAnalyticsAPI)(
|
|
379
|
+
deleteColumnsCommand(rect, isTableScalingEnabled, shouldUseIncreasedScalingPercent),
|
|
380
|
+
);
|
|
370
381
|
|
|
371
382
|
export const deleteSelectedRowsOrColumnsWithAnalyticsViaShortcut =
|
|
372
|
-
(
|
|
383
|
+
(
|
|
384
|
+
editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null,
|
|
385
|
+
isTableScalingEnabled?: boolean,
|
|
386
|
+
shouldUseIncreasedScalingPercent?: boolean,
|
|
387
|
+
): Command =>
|
|
373
388
|
(state, dispatch) => {
|
|
374
389
|
const { selection } = state;
|
|
375
390
|
const isCellSelection = selection instanceof CellSelection;
|
|
@@ -393,10 +408,11 @@ export const deleteSelectedRowsOrColumnsWithAnalyticsViaShortcut =
|
|
|
393
408
|
isHeaderRowRequired,
|
|
394
409
|
)(state, dispatch);
|
|
395
410
|
} else if (selectionType === 'column') {
|
|
396
|
-
return deleteColumnsWithAnalytics(
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
411
|
+
return deleteColumnsWithAnalytics(
|
|
412
|
+
editorAnalyticsAPI,
|
|
413
|
+
isTableScalingEnabled,
|
|
414
|
+
shouldUseIncreasedScalingPercent,
|
|
415
|
+
)(INPUT_METHOD.SHORTCUT, rect)(state, dispatch);
|
|
400
416
|
} else {
|
|
401
417
|
return false;
|
|
402
418
|
}
|
package/src/event-handlers.ts
CHANGED
|
@@ -477,6 +477,7 @@ export const handleCut = (
|
|
|
477
477
|
editorAnalyticsAPI?: EditorAnalyticsAPI,
|
|
478
478
|
editorView?: EditorView,
|
|
479
479
|
isTableScalingEnabled = false,
|
|
480
|
+
shouldUseIncreasedScalingPercent = false,
|
|
480
481
|
): Transaction => {
|
|
481
482
|
const oldSelection = oldState.tr.selection;
|
|
482
483
|
let { tr } = newState;
|
|
@@ -524,6 +525,7 @@ export const handleCut = (
|
|
|
524
525
|
getAllowAddColumnCustomStep(oldState),
|
|
525
526
|
editorView,
|
|
526
527
|
isTableScalingEnabled,
|
|
528
|
+
shouldUseIncreasedScalingPercent,
|
|
527
529
|
)(tr);
|
|
528
530
|
}
|
|
529
531
|
}
|
|
@@ -383,6 +383,15 @@ class TableComponent extends React.Component<ComponentProps, TableState> {
|
|
|
383
383
|
isNumberColumnChanged ||
|
|
384
384
|
isNumberOfColumnsChanged;
|
|
385
385
|
|
|
386
|
+
const isTableScalingEnabledWithLockButton =
|
|
387
|
+
this.props.options?.isTableScalingEnabled &&
|
|
388
|
+
getBooleanFF('platform.editor.table.preserve-widths-with-lock-button');
|
|
389
|
+
|
|
390
|
+
const shouldUseIncreasedScalingPercent =
|
|
391
|
+
(isTableScalingEnabledWithLockButton &&
|
|
392
|
+
getBooleanFF('platform.editor.table.use-increased-scaling-percent')) ||
|
|
393
|
+
false;
|
|
394
|
+
|
|
386
395
|
if (force || (!isResizing && shouldUpdateColgroup)) {
|
|
387
396
|
const resizeState = getResizeState({
|
|
388
397
|
minWidth: COLUMN_MIN_WIDTH,
|
|
@@ -392,6 +401,7 @@ class TableComponent extends React.Component<ComponentProps, TableState> {
|
|
|
392
401
|
start,
|
|
393
402
|
domAtPos: view.domAtPos.bind(view),
|
|
394
403
|
isTableScalingEnabled: true,
|
|
404
|
+
shouldUseIncreasedScalingPercent,
|
|
395
405
|
});
|
|
396
406
|
|
|
397
407
|
let shouldScaleOnColgroupUpdate = false;
|
|
@@ -402,17 +412,19 @@ class TableComponent extends React.Component<ComponentProps, TableState> {
|
|
|
402
412
|
shouldScaleOnColgroupUpdate = true;
|
|
403
413
|
}
|
|
404
414
|
|
|
405
|
-
if (
|
|
406
|
-
this.props.options?.isTableScalingEnabled &&
|
|
407
|
-
getBooleanFF('platform.editor.table.preserve-widths-with-lock-button') &&
|
|
408
|
-
tableNode.attrs.displayMode !== 'fixed'
|
|
409
|
-
) {
|
|
415
|
+
if (isTableScalingEnabledWithLockButton && tableNode.attrs.displayMode !== 'fixed') {
|
|
410
416
|
shouldScaleOnColgroupUpdate = true;
|
|
411
417
|
}
|
|
412
418
|
|
|
413
419
|
// Request animation frame required for Firefox
|
|
414
420
|
requestAnimationFrame(() => {
|
|
415
|
-
updateColgroup(
|
|
421
|
+
updateColgroup(
|
|
422
|
+
resizeState,
|
|
423
|
+
this.table!,
|
|
424
|
+
tableNode,
|
|
425
|
+
shouldScaleOnColgroupUpdate,
|
|
426
|
+
shouldUseIncreasedScalingPercent,
|
|
427
|
+
);
|
|
416
428
|
});
|
|
417
429
|
}
|
|
418
430
|
}
|
|
@@ -452,11 +464,14 @@ class TableComponent extends React.Component<ComponentProps, TableState> {
|
|
|
452
464
|
shouldHandleColgroupUpdates = true;
|
|
453
465
|
}
|
|
454
466
|
|
|
455
|
-
|
|
467
|
+
const isTableScalingEnabledWithLockButton =
|
|
456
468
|
isTableScalingEnabled &&
|
|
457
|
-
getBooleanFF('platform.editor.table.preserve-widths-with-lock-button')
|
|
458
|
-
|
|
459
|
-
|
|
469
|
+
getBooleanFF('platform.editor.table.preserve-widths-with-lock-button');
|
|
470
|
+
const shouldUseIncreasedScalingPercent =
|
|
471
|
+
isTableScalingEnabledWithLockButton &&
|
|
472
|
+
getBooleanFF('platform.editor.table.use-increased-scaling-percent');
|
|
473
|
+
|
|
474
|
+
if (isTableScalingEnabledWithLockButton && getNode().attrs.displayMode !== 'fixed') {
|
|
460
475
|
shouldScale = true;
|
|
461
476
|
shouldHandleColgroupUpdates = true;
|
|
462
477
|
}
|
|
@@ -523,7 +538,13 @@ class TableComponent extends React.Component<ComponentProps, TableState> {
|
|
|
523
538
|
const depth = view.state.doc.resolve(start).depth;
|
|
524
539
|
shouldScale = depth === 0 && shouldScale;
|
|
525
540
|
|
|
526
|
-
insertColgroupFromNode(
|
|
541
|
+
insertColgroupFromNode(
|
|
542
|
+
this.table,
|
|
543
|
+
currentTable,
|
|
544
|
+
shouldScale,
|
|
545
|
+
undefined,
|
|
546
|
+
shouldUseIncreasedScalingPercent,
|
|
547
|
+
);
|
|
527
548
|
}
|
|
528
549
|
|
|
529
550
|
updateControls()(view.state);
|
|
@@ -724,6 +745,11 @@ class TableComponent extends React.Component<ComponentProps, TableState> {
|
|
|
724
745
|
|
|
725
746
|
const { stickyScrollbar } = getEditorFeatureFlags();
|
|
726
747
|
|
|
748
|
+
const shouldUseIncreasedScalingPercent =
|
|
749
|
+
isTableScalingEnabled &&
|
|
750
|
+
getBooleanFF('platform.editor.table.preserve-widths-with-lock-button') &&
|
|
751
|
+
getBooleanFF('platform.editor.table.use-increased-scaling-percent');
|
|
752
|
+
|
|
727
753
|
return (
|
|
728
754
|
<TableContainer
|
|
729
755
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
@@ -746,6 +772,7 @@ class TableComponent extends React.Component<ComponentProps, TableState> {
|
|
|
746
772
|
isTableScalingEnabled={isTableScalingEnabled}
|
|
747
773
|
isWholeTableInDanger={isWholeTableInDanger}
|
|
748
774
|
isTableAlignmentEnabled={isTableAlignmentEnabled}
|
|
775
|
+
shouldUseIncreasedScalingPercent={shouldUseIncreasedScalingPercent}
|
|
749
776
|
>
|
|
750
777
|
<div
|
|
751
778
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
@@ -961,6 +988,7 @@ class TableComponent extends React.Component<ComponentProps, TableState> {
|
|
|
961
988
|
this.layoutSize = layoutSize;
|
|
962
989
|
};
|
|
963
990
|
|
|
991
|
+
// Function gets called when table is nested.
|
|
964
992
|
private scaleTable = (scaleOptions: { parentWidth?: number }) => {
|
|
965
993
|
const { view, getNode, getPos, containerWidth, options } = this.props;
|
|
966
994
|
const node = getNode();
|
|
@@ -987,7 +1015,8 @@ class TableComponent extends React.Component<ComponentProps, TableState> {
|
|
|
987
1015
|
...options,
|
|
988
1016
|
},
|
|
989
1017
|
domAtPos,
|
|
990
|
-
false,
|
|
1018
|
+
false, // isTableScalingEnabled doesn't change the behavior of nested tables
|
|
1019
|
+
false, // shouldUseIncreasedScalingPercent set to false for nested tables
|
|
991
1020
|
)(state.tr);
|
|
992
1021
|
|
|
993
1022
|
dispatch(tr);
|
|
@@ -162,6 +162,7 @@ type ResizableTableContainerProps = {
|
|
|
162
162
|
|
|
163
163
|
isTableScalingEnabled?: boolean;
|
|
164
164
|
isTableAlignmentEnabled?: boolean;
|
|
165
|
+
shouldUseIncreasedScalingPercent?: boolean;
|
|
165
166
|
};
|
|
166
167
|
|
|
167
168
|
export const ResizableTableContainer = React.memo(
|
|
@@ -180,6 +181,7 @@ export const ResizableTableContainer = React.memo(
|
|
|
180
181
|
isWholeTableInDanger,
|
|
181
182
|
isTableScalingEnabled,
|
|
182
183
|
isTableAlignmentEnabled,
|
|
184
|
+
shouldUseIncreasedScalingPercent,
|
|
183
185
|
}: PropsWithChildren<ResizableTableContainerProps>) => {
|
|
184
186
|
const containerRef = useRef<HTMLDivElement | null>(null);
|
|
185
187
|
const tableWidthRef = useRef<number>(akEditorDefaultLayoutWidth);
|
|
@@ -308,6 +310,7 @@ export const ResizableTableContainer = React.memo(
|
|
|
308
310
|
isFullWidthModeEnabled,
|
|
309
311
|
isTableScalingEnabled,
|
|
310
312
|
isWholeTableInDanger,
|
|
313
|
+
shouldUseIncreasedScalingPercent,
|
|
311
314
|
pluginInjectionApi,
|
|
312
315
|
onResizeStart,
|
|
313
316
|
onResizeStop,
|
|
@@ -373,6 +376,7 @@ type TableContainerProps = {
|
|
|
373
376
|
isTableResizingEnabled: boolean | undefined;
|
|
374
377
|
isTableScalingEnabled?: boolean;
|
|
375
378
|
isTableAlignmentEnabled?: boolean;
|
|
379
|
+
shouldUseIncreasedScalingPercent?: boolean;
|
|
376
380
|
};
|
|
377
381
|
|
|
378
382
|
export const TableContainer = ({
|
|
@@ -391,6 +395,7 @@ export const TableContainer = ({
|
|
|
391
395
|
isTableResizingEnabled,
|
|
392
396
|
isTableScalingEnabled,
|
|
393
397
|
isTableAlignmentEnabled,
|
|
398
|
+
shouldUseIncreasedScalingPercent,
|
|
394
399
|
}: PropsWithChildren<TableContainerProps>) => {
|
|
395
400
|
if (isTableResizingEnabled && !isNested) {
|
|
396
401
|
return (
|
|
@@ -409,6 +414,7 @@ export const TableContainer = ({
|
|
|
409
414
|
isTableScalingEnabled={isTableScalingEnabled}
|
|
410
415
|
isWholeTableInDanger={isWholeTableInDanger}
|
|
411
416
|
isTableAlignmentEnabled={isTableAlignmentEnabled}
|
|
417
|
+
shouldUseIncreasedScalingPercent={shouldUseIncreasedScalingPercent}
|
|
412
418
|
>
|
|
413
419
|
{children}
|
|
414
420
|
</ResizableTableContainer>
|
|
@@ -76,6 +76,7 @@ interface TableResizerProps {
|
|
|
76
76
|
isTableAlignmentEnabled?: boolean;
|
|
77
77
|
isWholeTableInDanger?: boolean;
|
|
78
78
|
isFullWidthModeEnabled?: boolean;
|
|
79
|
+
shouldUseIncreasedScalingPercent?: boolean;
|
|
79
80
|
}
|
|
80
81
|
|
|
81
82
|
export interface TableResizerImprovementProps extends TableResizerProps {
|
|
@@ -189,6 +190,7 @@ export const TableResizer = ({
|
|
|
189
190
|
isTableScalingEnabled,
|
|
190
191
|
isTableAlignmentEnabled,
|
|
191
192
|
isWholeTableInDanger,
|
|
193
|
+
shouldUseIncreasedScalingPercent,
|
|
192
194
|
pluginInjectionApi,
|
|
193
195
|
isFullWidthModeEnabled,
|
|
194
196
|
}: PropsWithChildren<TableResizerImprovementProps>) => {
|
|
@@ -517,6 +519,7 @@ export const TableResizer = ({
|
|
|
517
519
|
},
|
|
518
520
|
editorView.domAtPos.bind(editorView),
|
|
519
521
|
isTableScalingEnabled,
|
|
522
|
+
shouldUseIncreasedScalingPercent || false,
|
|
520
523
|
)(tr);
|
|
521
524
|
|
|
522
525
|
const scaledNode = tr.doc.nodeAt(pos)!;
|
|
@@ -571,6 +574,7 @@ export const TableResizer = ({
|
|
|
571
574
|
endMeasure,
|
|
572
575
|
onResizeStop,
|
|
573
576
|
isTableScalingEnabled,
|
|
577
|
+
shouldUseIncreasedScalingPercent,
|
|
574
578
|
widthToWidest,
|
|
575
579
|
formatMessage,
|
|
576
580
|
pluginInjectionApi,
|