@atlaskit/editor-plugin-table 7.31.2 → 8.0.0

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.
Files changed (98) hide show
  1. package/CHANGELOG.md +92 -0
  2. package/dist/cjs/commands/insert.js +16 -19
  3. package/dist/cjs/commands-with-analytics.js +5 -7
  4. package/dist/cjs/event-handlers.js +12 -1
  5. package/dist/cjs/nodeviews/TableComponent.js +18 -15
  6. package/dist/cjs/nodeviews/TableComponentWithSharedState.js +5 -2
  7. package/dist/cjs/nodeviews/lazy-node-views.js +2 -3
  8. package/dist/cjs/nodeviews/table.js +16 -12
  9. package/dist/cjs/plugin.js +22 -28
  10. package/dist/cjs/pm-plugins/keymap.js +9 -10
  11. package/dist/cjs/pm-plugins/main.js +3 -5
  12. package/dist/cjs/toolbar.js +10 -13
  13. package/dist/cjs/ui/FloatingContextualMenu/ContextualMenu.js +2 -4
  14. package/dist/cjs/ui/FloatingDragMenu/DragMenu.js +1 -2
  15. package/dist/cjs/ui/FloatingDragMenu/index.js +2 -4
  16. package/dist/cjs/ui/FloatingInsertButton/index.js +3 -7
  17. package/dist/cjs/utils/drag-menu.js +6 -7
  18. package/dist/es2019/commands/insert.js +10 -10
  19. package/dist/es2019/commands-with-analytics.js +4 -4
  20. package/dist/es2019/event-handlers.js +12 -1
  21. package/dist/es2019/nodeviews/TableComponent.js +18 -15
  22. package/dist/es2019/nodeviews/TableComponentWithSharedState.js +5 -2
  23. package/dist/es2019/nodeviews/lazy-node-views.js +2 -3
  24. package/dist/es2019/nodeviews/table.js +16 -12
  25. package/dist/es2019/plugin.js +22 -26
  26. package/dist/es2019/pm-plugins/keymap.js +5 -5
  27. package/dist/es2019/pm-plugins/main.js +3 -5
  28. package/dist/es2019/toolbar.js +6 -7
  29. package/dist/es2019/ui/FloatingContextualMenu/ContextualMenu.js +2 -3
  30. package/dist/es2019/ui/FloatingDragMenu/DragMenu.js +1 -2
  31. package/dist/es2019/ui/FloatingDragMenu/index.js +2 -3
  32. package/dist/es2019/ui/FloatingInsertButton/index.js +3 -6
  33. package/dist/es2019/utils/drag-menu.js +3 -3
  34. package/dist/esm/commands/insert.js +16 -19
  35. package/dist/esm/commands-with-analytics.js +5 -7
  36. package/dist/esm/event-handlers.js +12 -1
  37. package/dist/esm/nodeviews/TableComponent.js +18 -15
  38. package/dist/esm/nodeviews/TableComponentWithSharedState.js +5 -2
  39. package/dist/esm/nodeviews/lazy-node-views.js +2 -3
  40. package/dist/esm/nodeviews/table.js +16 -12
  41. package/dist/esm/plugin.js +22 -28
  42. package/dist/esm/pm-plugins/keymap.js +9 -10
  43. package/dist/esm/pm-plugins/main.js +3 -5
  44. package/dist/esm/toolbar.js +10 -13
  45. package/dist/esm/ui/FloatingContextualMenu/ContextualMenu.js +2 -4
  46. package/dist/esm/ui/FloatingDragMenu/DragMenu.js +1 -2
  47. package/dist/esm/ui/FloatingDragMenu/index.js +2 -4
  48. package/dist/esm/ui/FloatingInsertButton/index.js +3 -7
  49. package/dist/esm/utils/drag-menu.js +6 -7
  50. package/dist/types/commands/insert.d.ts +5 -5
  51. package/dist/types/commands-with-analytics.d.ts +3 -4
  52. package/dist/types/event-handlers.d.ts +1 -1
  53. package/dist/types/nodeviews/TableComponent.d.ts +2 -1
  54. package/dist/types/nodeviews/TableComponentWithSharedState.d.ts +3 -1
  55. package/dist/types/nodeviews/lazy-node-views.d.ts +0 -1
  56. package/dist/types/nodeviews/table.d.ts +1 -1
  57. package/dist/types/nodeviews/types.d.ts +2 -2
  58. package/dist/types/plugin.d.ts +1 -3
  59. package/dist/types/pm-plugins/keymap.d.ts +1 -1
  60. package/dist/types/pm-plugins/main.d.ts +1 -1
  61. package/dist/types/toolbar.d.ts +1 -1
  62. package/dist/types/types.d.ts +2 -1
  63. package/dist/types/ui/FloatingDragMenu/DragMenu.d.ts +0 -1
  64. package/dist/types/utils/drag-menu.d.ts +1 -1
  65. package/dist/types-ts4.5/commands/insert.d.ts +5 -5
  66. package/dist/types-ts4.5/commands-with-analytics.d.ts +3 -4
  67. package/dist/types-ts4.5/event-handlers.d.ts +1 -1
  68. package/dist/types-ts4.5/nodeviews/TableComponent.d.ts +2 -1
  69. package/dist/types-ts4.5/nodeviews/TableComponentWithSharedState.d.ts +3 -1
  70. package/dist/types-ts4.5/nodeviews/lazy-node-views.d.ts +0 -1
  71. package/dist/types-ts4.5/nodeviews/table.d.ts +1 -1
  72. package/dist/types-ts4.5/nodeviews/types.d.ts +2 -2
  73. package/dist/types-ts4.5/plugin.d.ts +1 -3
  74. package/dist/types-ts4.5/pm-plugins/keymap.d.ts +1 -1
  75. package/dist/types-ts4.5/pm-plugins/main.d.ts +1 -1
  76. package/dist/types-ts4.5/toolbar.d.ts +1 -1
  77. package/dist/types-ts4.5/types.d.ts +2 -1
  78. package/dist/types-ts4.5/ui/FloatingDragMenu/DragMenu.d.ts +0 -1
  79. package/dist/types-ts4.5/utils/drag-menu.d.ts +1 -1
  80. package/package.json +3 -3
  81. package/src/commands/insert.ts +3 -10
  82. package/src/commands-with-analytics.ts +7 -8
  83. package/src/event-handlers.ts +17 -1
  84. package/src/nodeviews/TableComponent.tsx +22 -16
  85. package/src/nodeviews/TableComponentWithSharedState.tsx +6 -1
  86. package/src/nodeviews/lazy-node-views.ts +0 -4
  87. package/src/nodeviews/table.tsx +13 -8
  88. package/src/nodeviews/types.ts +2 -2
  89. package/src/plugin.tsx +24 -35
  90. package/src/pm-plugins/keymap.ts +0 -5
  91. package/src/pm-plugins/main.ts +2 -6
  92. package/src/toolbar.tsx +1 -9
  93. package/src/types.ts +2 -1
  94. package/src/ui/FloatingContextualMenu/ContextualMenu.tsx +7 -10
  95. package/src/ui/FloatingDragMenu/DragMenu.tsx +0 -3
  96. package/src/ui/FloatingDragMenu/index.tsx +1 -3
  97. package/src/ui/FloatingInsertButton/index.tsx +5 -10
  98. package/src/utils/drag-menu.ts +4 -9
@@ -5,4 +5,4 @@ import { type PortalProviderAPI } from '@atlaskit/editor-common/portal';
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, nodeViewPortalProviderAPI: PortalProviderAPI, eventDispatcher: EventDispatcher, pluginConfig: PluginConfig, getEditorContainerWidth: GetEditorContainerWidth, getEditorFeatureFlags: GetEditorFeatureFlags, getIntl: () => IntlShape, tableResizingEnabled?: boolean, fullWidthModeEnabled?: boolean, previousFullWidthModeEnabled?: boolean, dragAndDropEnabled?: boolean, editorAnalyticsAPI?: EditorAnalyticsAPI, pluginInjectionApi?: PluginInjectionAPI, isTableScalingEnabled?: boolean, isTableAlignmentEnabled?: boolean, shouldUseIncreasedScalingPercent?: boolean, isCommentEditor?: boolean, isChromelessEditor?: boolean) => SafePlugin<import("../types").TablePluginState>;
8
+ export declare const createPlugin: (dispatchAnalyticsEvent: DispatchAnalyticsEvent, dispatch: Dispatch, portalProviderAPI: PortalProviderAPI, nodeViewPortalProviderAPI: PortalProviderAPI, eventDispatcher: EventDispatcher, pluginConfig: PluginConfig, getEditorContainerWidth: GetEditorContainerWidth, getEditorFeatureFlags: GetEditorFeatureFlags, getIntl: () => IntlShape, fullWidthModeEnabled?: boolean, previousFullWidthModeEnabled?: boolean, dragAndDropEnabled?: boolean, editorAnalyticsAPI?: EditorAnalyticsAPI, pluginInjectionApi?: PluginInjectionAPI, isTableScalingEnabled?: boolean, shouldUseIncreasedScalingPercent?: boolean, isCommentEditor?: boolean, isChromelessEditor?: boolean) => SafePlugin<import("../types").TablePluginState>;
@@ -6,6 +6,6 @@ import { Rect } from '@atlaskit/editor-tables/table-map';
6
6
  import type { TablePluginOptions } from './plugin';
7
7
  import type { PluginConfig, PluginInjectionAPI, ToolbarMenuConfig, ToolbarMenuContext, ToolbarMenuState } from './types';
8
8
  export declare const getToolbarMenuConfig: (config: ToolbarMenuConfig, state: ToolbarMenuState, { formatMessage }: ToolbarMenuContext, editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null, isTableScalingWithFixedColumnWidthsOptionShown?: boolean, areTableColumnWidthsFixed?: boolean) => FloatingToolbarItem<Command>;
9
- export declare const getToolbarCellOptionsConfig: (editorState: EditorState, editorView: EditorView | undefined | null, initialSelectionRect: Rect, { formatMessage }: ToolbarMenuContext, getEditorContainerWidth: GetEditorContainerWidth, api: PluginInjectionAPI | undefined | null, editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null, isTableScalingEnabled?: boolean, isCellBackgroundDuplicated?: boolean, isTableFixedColumnWidthsOptionEnabled?: boolean, shouldUseIncreasedScalingPercent?: boolean, isCommentEditor?: boolean) => FloatingToolbarDropdown<Command>;
9
+ export declare const getToolbarCellOptionsConfig: (editorState: EditorState, editorView: EditorView | undefined | null, initialSelectionRect: Rect, { formatMessage }: ToolbarMenuContext, getEditorContainerWidth: GetEditorContainerWidth, api: PluginInjectionAPI | undefined | null, editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null, isTableScalingEnabled?: boolean, isTableFixedColumnWidthsOptionEnabled?: boolean, shouldUseIncreasedScalingPercent?: boolean, isCommentEditor?: boolean) => FloatingToolbarDropdown<Command>;
10
10
  export declare const getClosestSelectionRect: (state: EditorState) => Rect | undefined;
11
11
  export declare const getToolbarConfig: (getEditorContainerWidth: GetEditorContainerWidth, api: PluginInjectionAPI | undefined | null, editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null, getEditorFeatureFlags: GetEditorFeatureFlags, getEditorView: () => EditorView | null, options?: TablePluginOptions, isTableFixedColumnWidthsOptionEnabled?: boolean, shouldUseIncreasedScalingPercent?: boolean) => (config: PluginConfig) => FloatingToolbarHandler;
@@ -45,6 +45,8 @@ export interface PluginConfig {
45
45
  advanced?: boolean;
46
46
  allowBackgroundColor?: boolean;
47
47
  allowColumnResizing?: boolean;
48
+ allowTableResizing?: boolean;
49
+ allowTableAlignment?: boolean;
48
50
  allowHeaderColumn?: boolean;
49
51
  allowHeaderRow?: boolean;
50
52
  allowMergeCells?: boolean;
@@ -102,7 +104,6 @@ export interface TablePluginState {
102
104
  widthToWidest?: WidthToWidest;
103
105
  getIntl: () => IntlShape;
104
106
  wasFullWidthModeEnabled?: boolean;
105
- isTableResizingEnabled?: boolean;
106
107
  isDragAndDropEnabled?: boolean;
107
108
  isTableHovered?: boolean;
108
109
  isTableScalingEnabled?: boolean;
@@ -29,7 +29,6 @@ type DragMenuProps = {
29
29
  boundariesElement?: HTMLElement;
30
30
  scrollableElement?: HTMLElement;
31
31
  isTableScalingEnabled?: boolean;
32
- tableDuplicateCellColouring?: boolean;
33
32
  shouldUseIncreasedScalingPercent?: boolean;
34
33
  isTableFixedColumnWidthsOptionEnabled?: boolean;
35
34
  ariaNotifyPlugin?: (message: string, ariaLiveElementAttributes?: AriaLiveElementAttributes) => void;
@@ -16,4 +16,4 @@ export interface DragMenuConfig extends Omit<DropdownOptionT<Command>, 'icon'> {
16
16
  iconFallback?: React.ComponentType<React.PropsWithChildren<UNSAFE_NewIconProps>>;
17
17
  keymap?: string;
18
18
  }
19
- export declare const getDragMenuConfig: (direction: TableDirection, getEditorContainerWidth: GetEditorContainerWidth, hasMergedCellsInTable: boolean, editorView: EditorView, api: PluginInjectionAPI | undefined | null, tableMap?: TableMap, index?: number, targetCellPosition?: number, selectionRect?: Rect, editorAnalyticsAPI?: EditorAnalyticsAPI, isHeaderRowRequired?: boolean, isTableScalingEnabled?: boolean, tableDuplicateCellColouring?: boolean, isTableFixedColumnWidthsOptionEnabled?: boolean, shouldUseIncreasedScalingPercent?: boolean, ariaNotifyPlugin?: ((message: string, ariaLiveElementAttributes?: AriaLiveElementAttributes) => void) | undefined, isCommentEditor?: boolean) => DragMenuConfig[];
19
+ export declare const getDragMenuConfig: (direction: TableDirection, getEditorContainerWidth: GetEditorContainerWidth, hasMergedCellsInTable: boolean, editorView: EditorView, api: PluginInjectionAPI | undefined | null, tableMap?: TableMap, index?: number, targetCellPosition?: number, selectionRect?: Rect, editorAnalyticsAPI?: EditorAnalyticsAPI, isHeaderRowRequired?: boolean, isTableScalingEnabled?: boolean, isTableFixedColumnWidthsOptionEnabled?: boolean, shouldUseIncreasedScalingPercent?: boolean, ariaNotifyPlugin?: ((message: string, ariaLiveElementAttributes?: AriaLiveElementAttributes) => void) | undefined, isCommentEditor?: boolean) => DragMenuConfig[];
@@ -4,10 +4,10 @@ import type { Command, EditorCommand } from '@atlaskit/editor-common/types';
4
4
  import type { Transaction } from '@atlaskit/editor-prosemirror/state';
5
5
  import type { EditorView } from '@atlaskit/editor-prosemirror/view';
6
6
  import type { PluginInjectionAPI } from '../types';
7
- export declare function addColumnAt(api: PluginInjectionAPI | undefined | null, isTableScalingEnabled?: boolean, isCellBackgroundDuplicated?: boolean, isTableFixedColumnWidthsOptionEnabled?: boolean, shouldUseIncreasedScalingPercent?: boolean, isCommentEditor?: boolean): (column: number, allowAddColumnCustomStep: boolean | undefined, view: EditorView | undefined) => (tr: Transaction) => Transaction;
8
- export declare const addColumnBefore: (api: PluginInjectionAPI | undefined | null, isTableScalingEnabled?: boolean, isCellBackgroundDuplicated?: boolean, isTableFixedColumnWidthsOptionEnabled?: boolean, shouldUseIncreasedScalingPercent?: boolean, isCommentEditor?: boolean) => Command;
9
- export declare const addColumnAfter: (api: PluginInjectionAPI | undefined | null, isTableScalingEnabled?: boolean, isCellBackgroundDuplicated?: boolean, isTableFixedColumnWidthsOptionEnabled?: boolean, shouldUseIncreasedScalingPercent?: boolean, isCommentEditor?: boolean) => Command;
10
- export declare const insertColumn: (api: PluginInjectionAPI | undefined | null, isTableScalingEnabled?: boolean, isCellBackgroundDuplicated?: boolean, isTableFixedColumnWidthsOptionEnabled?: boolean, shouldUseIncreasedScalingPercent?: boolean, isCommentEditor?: boolean) => (column: number) => Command;
11
- export declare const insertRow: (row: number, moveCursorToTheNewRow: boolean, isCellBackgroundDuplicated?: boolean) => Command;
7
+ export declare function addColumnAt(api: PluginInjectionAPI | undefined | null, isTableScalingEnabled?: boolean, isTableFixedColumnWidthsOptionEnabled?: boolean, shouldUseIncreasedScalingPercent?: boolean, isCommentEditor?: boolean): (column: number, allowAddColumnCustomStep: boolean | undefined, view: EditorView | undefined) => (tr: Transaction) => Transaction;
8
+ export declare const addColumnBefore: (api: PluginInjectionAPI | undefined | null, isTableScalingEnabled?: boolean, isTableFixedColumnWidthsOptionEnabled?: boolean, shouldUseIncreasedScalingPercent?: boolean, isCommentEditor?: boolean) => Command;
9
+ export declare const addColumnAfter: (api: PluginInjectionAPI | undefined | null, isTableScalingEnabled?: boolean, isTableFixedColumnWidthsOptionEnabled?: boolean, shouldUseIncreasedScalingPercent?: boolean, isCommentEditor?: boolean) => Command;
10
+ export declare const insertColumn: (api: PluginInjectionAPI | undefined | null, isTableScalingEnabled?: boolean, isTableFixedColumnWidthsOptionEnabled?: boolean, shouldUseIncreasedScalingPercent?: boolean, isCommentEditor?: boolean) => (column: number) => Command;
11
+ export declare const insertRow: (row: number, moveCursorToTheNewRow: boolean) => Command;
12
12
  export declare const createTable: (isTableScalingEnabled?: boolean, isTableAlignmentEnabled?: boolean, isFullWidthModeEnabled?: boolean, editorAnalyticsAPI?: EditorAnalyticsAPI | undefined | null, isCommentEditor?: boolean, isChromelessEditor?: boolean, isTableResizingEnabled?: boolean) => Command;
13
13
  export declare const insertTableWithSize: (isFullWidthModeEnabled?: boolean, isTableScalingEnabled?: boolean, isTableAlignmentEnabled?: boolean, editorAnalyticsAPI?: EditorAnalyticsAPI, isCommentEditor?: boolean, isChromelessEditor?: boolean) => (rowsCount: number, colsCount: number, inputMethod?: INPUT_METHOD.PICKER) => EditorCommand;
@@ -1,9 +1,8 @@
1
1
  import type { IntlShape } from 'react-intl-next/src/types';
2
2
  import type { TableLayout } from '@atlaskit/adf-schema';
3
3
  import type { TableSortOrder as SortOrder } from '@atlaskit/custom-steps';
4
- import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
4
+ import type { CHANGE_ALIGNMENT_REASON, EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
5
5
  import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
6
- import { type CHANGE_ALIGNMENT_REASON } from '@atlaskit/editor-common/analytics';
7
6
  import type { Command, GetEditorContainerWidth } from '@atlaskit/editor-common/types';
8
7
  import type { NodeWithPos } from '@atlaskit/editor-prosemirror/utils';
9
8
  import type { EditorView } from '@atlaskit/editor-prosemirror/view';
@@ -15,9 +14,9 @@ export declare const mergeCellsWithAnalytics: (editorAnalyticsAPI: EditorAnalyti
15
14
  export declare const splitCellWithAnalytics: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null) => (inputMethod: INPUT_METHOD.CONTEXT_MENU | INPUT_METHOD.FLOATING_TB) => Command;
16
15
  export declare const setColorWithAnalytics: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null) => (inputMethod: INPUT_METHOD.CONTEXT_MENU | INPUT_METHOD.FLOATING_TB | INPUT_METHOD.TABLE_CONTEXT_MENU, cellColor: string, editorView?: EditorView | null) => Command;
17
16
  export declare const addRowAroundSelection: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null) => (side: RowInsertPosition) => Command;
18
- export declare const insertRowWithAnalytics: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null, isCellbackgroundDuplicated?: boolean) => (inputMethod: InsertRowMethods, options: InsertRowOptions) => Command;
17
+ export declare const insertRowWithAnalytics: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null) => (inputMethod: InsertRowMethods, options: InsertRowOptions) => Command;
19
18
  export declare const changeColumnWidthByStepWithAnalytics: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null, api: PluginInjectionAPI | undefined | null) => (stepSize: number, getEditorContainerWidth: GetEditorContainerWidth, isTableScalingEnabled: boolean, isTableFixedColumnWidthsOptionEnabled: boolean, isCommentEditor: boolean, inputMethod: INPUT_METHOD.SHORTCUT, ariaNotify?: ((message: string) => void) | undefined, getIntl?: () => IntlShape) => Command;
20
- export declare const insertColumnWithAnalytics: (api: PluginInjectionAPI | undefined | null, editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null, isTableScalingEnabled?: boolean, isCellbackgroundDuplicated?: boolean, isTableFixedColumnWidthsOptionEnabled?: boolean, shouldUseIncreasedScalingPercent?: boolean, isCommentEditor?: boolean) => (inputMethod: INPUT_METHOD.CONTEXT_MENU | INPUT_METHOD.BUTTON | INPUT_METHOD.SHORTCUT | INPUT_METHOD.FLOATING_TB | INPUT_METHOD.TABLE_CONTEXT_MENU, position: number) => Command;
19
+ export declare const insertColumnWithAnalytics: (api: PluginInjectionAPI | undefined | null, editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null, isTableScalingEnabled?: boolean, isTableFixedColumnWidthsOptionEnabled?: boolean, shouldUseIncreasedScalingPercent?: boolean, isCommentEditor?: boolean) => (inputMethod: INPUT_METHOD.CONTEXT_MENU | INPUT_METHOD.BUTTON | INPUT_METHOD.SHORTCUT | INPUT_METHOD.FLOATING_TB | INPUT_METHOD.TABLE_CONTEXT_MENU, position: number) => Command;
21
20
  export declare const deleteRowsWithAnalytics: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null) => (inputMethod: INPUT_METHOD.CONTEXT_MENU | INPUT_METHOD.BUTTON | INPUT_METHOD.FLOATING_TB | INPUT_METHOD.SHORTCUT | INPUT_METHOD.TABLE_CONTEXT_MENU, rect: Rect, isHeaderRowRequired: boolean) => Command;
22
21
  export declare const deleteColumnsWithAnalytics: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null, api: PluginInjectionAPI | undefined | null, isTableScalingEnabled?: boolean, isTableFixedColumnWidthsOptionEnabled?: boolean, shouldUseIncreasedScalingPercent?: boolean, isCommentEditor?: boolean) => (inputMethod: INPUT_METHOD.CONTEXT_MENU | INPUT_METHOD.BUTTON | INPUT_METHOD.FLOATING_TB | INPUT_METHOD.SHORTCUT | INPUT_METHOD.TABLE_CONTEXT_MENU, rect: Rect) => Command;
23
22
  export declare const deleteSelectedRowsOrColumnsWithAnalyticsViaShortcut: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null, api: PluginInjectionAPI | undefined | null, isTableScalingEnabled?: boolean, isTableFixedColumnWidthsOptionEnabled?: boolean, shouldUseIncreasedScalingPercent?: boolean) => Command;
@@ -16,5 +16,5 @@ export declare const handleMouseMove: (nodeViewPortalProviderAPI: PortalProvider
16
16
  export declare function handleTripleClick(view: EditorView, pos: number): boolean;
17
17
  export declare const handleCut: (oldTr: Transaction, oldState: EditorState, newState: EditorState, api: PluginInjectionAPI | undefined | null, editorAnalyticsAPI?: EditorAnalyticsAPI, editorView?: EditorView, isTableScalingEnabled?: boolean, isTableFixedColumnWidthsOptionEnabled?: boolean, shouldUseIncreasedScalingPercent?: boolean) => Transaction;
18
18
  export declare const isTableInFocus: (view: EditorView) => boolean;
19
- export declare const whenTableInFocus: (eventHandler: (view: EditorView, mouseEvent: Event) => boolean) => (view: EditorView, mouseEvent: Event) => boolean;
19
+ export declare const whenTableInFocus: (eventHandler: (view: EditorView, mouseEvent: Event) => boolean, pluginInjectionApi?: PluginInjectionAPI) => (view: EditorView, mouseEvent: Event) => boolean;
20
20
  export declare const withCellTracking: (eventHandler: (view: EditorView, mouseEvent: Event) => boolean) => (view: EditorView, mouseEvent: Event) => boolean;
@@ -18,12 +18,13 @@ interface ComponentProps {
18
18
  contentDOM: (node: HTMLElement | null) => void;
19
19
  containerWidth: EditorContainerWidth;
20
20
  allowControls: boolean;
21
+ allowTableResizing?: boolean;
22
+ allowTableAlignment?: boolean;
21
23
  isHeaderRowEnabled: boolean;
22
24
  isHeaderColumnEnabled: boolean;
23
25
  isMediaFullscreen?: boolean;
24
26
  isDragAndDropEnabled?: boolean;
25
27
  isTableScalingEnabled?: boolean;
26
- isTableAlignmentEnabled?: boolean;
27
28
  tableActive: boolean;
28
29
  ordering?: TableColumnOrdering;
29
30
  isResizing?: boolean;
@@ -19,9 +19,11 @@ type TableComponentWithSharedStateProps = {
19
19
  getPos: getPosHandlerNode;
20
20
  allowColumnResizing?: boolean;
21
21
  allowControls?: boolean;
22
+ allowTableAlignment?: boolean;
23
+ allowTableResizing?: boolean;
22
24
  };
23
25
  /**
24
26
  * Use useSharedPluginState to control re-renders from plugin dependencies
25
27
  */
26
- export declare const TableComponentWithSharedState: ({ view, options, getNode, dispatchAnalyticsEvent, api, getEditorFeatureFlags, eventDispatcher, allowColumnResizing, allowControls, getPos, forwardRef, }: TableComponentWithSharedStateProps) => JSX.Element | null;
28
+ export declare const TableComponentWithSharedState: ({ view, options, getNode, dispatchAnalyticsEvent, api, getEditorFeatureFlags, eventDispatcher, allowColumnResizing, allowControls, getPos, forwardRef, allowTableAlignment, allowTableResizing, }: TableComponentWithSharedStateProps) => JSX.Element | null;
27
29
  export {};
@@ -14,7 +14,6 @@ type TableViewOptions = {
14
14
  getEditorFeatureFlags: GetEditorFeatureFlags;
15
15
  dispatchAnalyticsEvent: DispatchAnalyticsEvent;
16
16
  pluginInjectionApi?: PluginInjectionAPI;
17
- isTableAlignmentEnabled?: boolean;
18
17
  isCommentEditor?: boolean;
19
18
  isChromelessEditor?: boolean;
20
19
  };
@@ -32,5 +32,5 @@ export default class TableView extends ReactNodeView<Props> {
32
32
  }): boolean;
33
33
  destroy(): void;
34
34
  }
35
- export declare const createTableView: (node: PmNode, view: EditorView, getPos: getPosHandler, portalProviderAPI: PortalProviderAPI, eventDispatcher: EventDispatcher, getEditorContainerWidth: GetEditorContainerWidth, getEditorFeatureFlags: GetEditorFeatureFlags, dispatchAnalyticsEvent: DispatchAnalyticsEvent, pluginInjectionApi?: PluginInjectionAPI, isTableAlignmentEnabled?: boolean, isCommentEditor?: boolean, isChromelessEditor?: boolean) => NodeView;
35
+ export declare const createTableView: (node: PmNode, view: EditorView, getPos: getPosHandler, portalProviderAPI: PortalProviderAPI, eventDispatcher: EventDispatcher, getEditorContainerWidth: GetEditorContainerWidth, getEditorFeatureFlags: GetEditorFeatureFlags, dispatchAnalyticsEvent: DispatchAnalyticsEvent, pluginInjectionApi?: PluginInjectionAPI, isCommentEditor?: boolean, isChromelessEditor?: boolean) => NodeView;
36
36
  export {};
@@ -8,10 +8,8 @@ import type { PluginInjectionAPI } from '../types';
8
8
  export type TableOptions = {
9
9
  isFullWidthModeEnabled?: boolean;
10
10
  wasFullWidthModeEnabled?: boolean;
11
- isTableResizingEnabled?: boolean;
12
11
  isDragAndDropEnabled?: boolean;
13
12
  isTableScalingEnabled?: boolean;
14
- isTableAlignmentEnabled?: boolean;
15
13
  isCommentEditor?: boolean;
16
14
  isChromelessEditor?: boolean;
17
15
  };
@@ -19,6 +17,8 @@ export interface Props {
19
17
  node: PmNode;
20
18
  view: EditorView;
21
19
  allowColumnResizing?: boolean;
20
+ allowTableResizing?: boolean;
21
+ allowTableAlignment?: boolean;
22
22
  allowControls?: boolean;
23
23
  cellMinWidth?: number;
24
24
  portalProviderAPI: PortalProviderAPI;
@@ -13,14 +13,12 @@ import type { WidthPlugin } from '@atlaskit/editor-plugin-width';
13
13
  import type { PluginConfig, TableSharedState } from './types';
14
14
  export interface TablePluginOptions {
15
15
  tableOptions: PluginConfig;
16
- tableResizingEnabled?: boolean;
17
16
  dragAndDropEnabled?: boolean;
17
+ isTableScalingEnabled?: boolean;
18
18
  allowContextualMenu?: boolean;
19
19
  fullWidthEnabled?: boolean;
20
20
  wasFullWidthEnabled?: boolean;
21
21
  getEditorFeatureFlags?: GetEditorFeatureFlags;
22
- isTableScalingEnabled?: boolean;
23
- isTableAlignmentEnabled?: boolean;
24
22
  isNewColumnResizingEnabled?: boolean;
25
23
  isCommentEditor?: boolean;
26
24
  isChromelessEditor?: boolean;
@@ -4,5 +4,5 @@ import { type PortalProviderAPI } from '@atlaskit/editor-common/portal';
4
4
  import type { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
5
5
  import type { GetEditorContainerWidth } from '@atlaskit/editor-common/types';
6
6
  import type { PluginInjectionAPI, PluginInjectionAPIWithA11y } from '../types';
7
- export declare function keymapPlugin(getEditorContainerWidth: GetEditorContainerWidth, api: PluginInjectionAPI | undefined | null, nodeViewPortalProviderAPI: PortalProviderAPI, editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null, dragAndDropEnabled?: boolean, isTableScalingEnabled?: boolean, isTableAlignmentEnabled?: boolean, isFullWidthEnabled?: boolean, pluginInjectionApi?: PluginInjectionAPIWithA11y, getIntl?: () => IntlShape, isCellBackgroundDuplicated?: boolean, isTableFixedColumnWidthsOptionEnabled?: boolean, shouldUseIncreasedScalingPercent?: boolean, isCommentEditor?: boolean, isChromelessEditor?: boolean, isTableResizingEnabled?: boolean): SafePlugin;
7
+ export declare function keymapPlugin(getEditorContainerWidth: GetEditorContainerWidth, api: PluginInjectionAPI | undefined | null, nodeViewPortalProviderAPI: PortalProviderAPI, editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null, dragAndDropEnabled?: boolean, isTableScalingEnabled?: boolean, isTableAlignmentEnabled?: boolean, isFullWidthEnabled?: boolean, pluginInjectionApi?: PluginInjectionAPIWithA11y, getIntl?: () => IntlShape, isTableFixedColumnWidthsOptionEnabled?: boolean, shouldUseIncreasedScalingPercent?: boolean, isCommentEditor?: boolean, isChromelessEditor?: boolean, isTableResizingEnabled?: boolean): SafePlugin;
8
8
  export default keymapPlugin;
@@ -5,4 +5,4 @@ import { type PortalProviderAPI } from '@atlaskit/editor-common/portal';
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, nodeViewPortalProviderAPI: PortalProviderAPI, eventDispatcher: EventDispatcher, pluginConfig: PluginConfig, getEditorContainerWidth: GetEditorContainerWidth, getEditorFeatureFlags: GetEditorFeatureFlags, getIntl: () => IntlShape, tableResizingEnabled?: boolean, fullWidthModeEnabled?: boolean, previousFullWidthModeEnabled?: boolean, dragAndDropEnabled?: boolean, editorAnalyticsAPI?: EditorAnalyticsAPI, pluginInjectionApi?: PluginInjectionAPI, isTableScalingEnabled?: boolean, isTableAlignmentEnabled?: boolean, shouldUseIncreasedScalingPercent?: boolean, isCommentEditor?: boolean, isChromelessEditor?: boolean) => SafePlugin<import("../types").TablePluginState>;
8
+ export declare const createPlugin: (dispatchAnalyticsEvent: DispatchAnalyticsEvent, dispatch: Dispatch, portalProviderAPI: PortalProviderAPI, nodeViewPortalProviderAPI: PortalProviderAPI, eventDispatcher: EventDispatcher, pluginConfig: PluginConfig, getEditorContainerWidth: GetEditorContainerWidth, getEditorFeatureFlags: GetEditorFeatureFlags, getIntl: () => IntlShape, fullWidthModeEnabled?: boolean, previousFullWidthModeEnabled?: boolean, dragAndDropEnabled?: boolean, editorAnalyticsAPI?: EditorAnalyticsAPI, pluginInjectionApi?: PluginInjectionAPI, isTableScalingEnabled?: boolean, shouldUseIncreasedScalingPercent?: boolean, isCommentEditor?: boolean, isChromelessEditor?: boolean) => SafePlugin<import("../types").TablePluginState>;
@@ -6,6 +6,6 @@ import { Rect } from '@atlaskit/editor-tables/table-map';
6
6
  import type { TablePluginOptions } from './plugin';
7
7
  import type { PluginConfig, PluginInjectionAPI, ToolbarMenuConfig, ToolbarMenuContext, ToolbarMenuState } from './types';
8
8
  export declare const getToolbarMenuConfig: (config: ToolbarMenuConfig, state: ToolbarMenuState, { formatMessage }: ToolbarMenuContext, editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null, isTableScalingWithFixedColumnWidthsOptionShown?: boolean, areTableColumnWidthsFixed?: boolean) => FloatingToolbarItem<Command>;
9
- export declare const getToolbarCellOptionsConfig: (editorState: EditorState, editorView: EditorView | undefined | null, initialSelectionRect: Rect, { formatMessage }: ToolbarMenuContext, getEditorContainerWidth: GetEditorContainerWidth, api: PluginInjectionAPI | undefined | null, editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null, isTableScalingEnabled?: boolean, isCellBackgroundDuplicated?: boolean, isTableFixedColumnWidthsOptionEnabled?: boolean, shouldUseIncreasedScalingPercent?: boolean, isCommentEditor?: boolean) => FloatingToolbarDropdown<Command>;
9
+ export declare const getToolbarCellOptionsConfig: (editorState: EditorState, editorView: EditorView | undefined | null, initialSelectionRect: Rect, { formatMessage }: ToolbarMenuContext, getEditorContainerWidth: GetEditorContainerWidth, api: PluginInjectionAPI | undefined | null, editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null, isTableScalingEnabled?: boolean, isTableFixedColumnWidthsOptionEnabled?: boolean, shouldUseIncreasedScalingPercent?: boolean, isCommentEditor?: boolean) => FloatingToolbarDropdown<Command>;
10
10
  export declare const getClosestSelectionRect: (state: EditorState) => Rect | undefined;
11
11
  export declare const getToolbarConfig: (getEditorContainerWidth: GetEditorContainerWidth, api: PluginInjectionAPI | undefined | null, editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null, getEditorFeatureFlags: GetEditorFeatureFlags, getEditorView: () => EditorView | null, options?: TablePluginOptions, isTableFixedColumnWidthsOptionEnabled?: boolean, shouldUseIncreasedScalingPercent?: boolean) => (config: PluginConfig) => FloatingToolbarHandler;
@@ -45,6 +45,8 @@ export interface PluginConfig {
45
45
  advanced?: boolean;
46
46
  allowBackgroundColor?: boolean;
47
47
  allowColumnResizing?: boolean;
48
+ allowTableResizing?: boolean;
49
+ allowTableAlignment?: boolean;
48
50
  allowHeaderColumn?: boolean;
49
51
  allowHeaderRow?: boolean;
50
52
  allowMergeCells?: boolean;
@@ -102,7 +104,6 @@ export interface TablePluginState {
102
104
  widthToWidest?: WidthToWidest;
103
105
  getIntl: () => IntlShape;
104
106
  wasFullWidthModeEnabled?: boolean;
105
- isTableResizingEnabled?: boolean;
106
107
  isDragAndDropEnabled?: boolean;
107
108
  isTableHovered?: boolean;
108
109
  isTableScalingEnabled?: boolean;
@@ -29,7 +29,6 @@ type DragMenuProps = {
29
29
  boundariesElement?: HTMLElement;
30
30
  scrollableElement?: HTMLElement;
31
31
  isTableScalingEnabled?: boolean;
32
- tableDuplicateCellColouring?: boolean;
33
32
  shouldUseIncreasedScalingPercent?: boolean;
34
33
  isTableFixedColumnWidthsOptionEnabled?: boolean;
35
34
  ariaNotifyPlugin?: (message: string, ariaLiveElementAttributes?: AriaLiveElementAttributes) => void;
@@ -16,4 +16,4 @@ export interface DragMenuConfig extends Omit<DropdownOptionT<Command>, 'icon'> {
16
16
  iconFallback?: React.ComponentType<React.PropsWithChildren<UNSAFE_NewIconProps>>;
17
17
  keymap?: string;
18
18
  }
19
- export declare const getDragMenuConfig: (direction: TableDirection, getEditorContainerWidth: GetEditorContainerWidth, hasMergedCellsInTable: boolean, editorView: EditorView, api: PluginInjectionAPI | undefined | null, tableMap?: TableMap, index?: number, targetCellPosition?: number, selectionRect?: Rect, editorAnalyticsAPI?: EditorAnalyticsAPI, isHeaderRowRequired?: boolean, isTableScalingEnabled?: boolean, tableDuplicateCellColouring?: boolean, isTableFixedColumnWidthsOptionEnabled?: boolean, shouldUseIncreasedScalingPercent?: boolean, ariaNotifyPlugin?: ((message: string, ariaLiveElementAttributes?: AriaLiveElementAttributes) => void) | undefined, isCommentEditor?: boolean) => DragMenuConfig[];
19
+ export declare const getDragMenuConfig: (direction: TableDirection, getEditorContainerWidth: GetEditorContainerWidth, hasMergedCellsInTable: boolean, editorView: EditorView, api: PluginInjectionAPI | undefined | null, tableMap?: TableMap, index?: number, targetCellPosition?: number, selectionRect?: Rect, editorAnalyticsAPI?: EditorAnalyticsAPI, isHeaderRowRequired?: boolean, isTableScalingEnabled?: boolean, isTableFixedColumnWidthsOptionEnabled?: boolean, shouldUseIncreasedScalingPercent?: boolean, ariaNotifyPlugin?: ((message: string, ariaLiveElementAttributes?: AriaLiveElementAttributes) => void) | undefined, isCommentEditor?: boolean) => DragMenuConfig[];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-table",
3
- "version": "7.31.2",
3
+ "version": "8.0.0",
4
4
  "description": "Table plugin for the @atlaskit/editor",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -30,7 +30,7 @@
30
30
  "@atlaskit/adf-schema": "^44.2.0",
31
31
  "@atlaskit/button": "^20.3.0",
32
32
  "@atlaskit/custom-steps": "^0.8.0",
33
- "@atlaskit/editor-common": "^94.22.0",
33
+ "@atlaskit/editor-common": "^94.24.0",
34
34
  "@atlaskit/editor-palette": "1.6.3",
35
35
  "@atlaskit/editor-plugin-accessibility-utils": "^1.2.0",
36
36
  "@atlaskit/editor-plugin-analytics": "^1.10.0",
@@ -51,7 +51,7 @@
51
51
  "@atlaskit/pragmatic-drag-and-drop-hitbox": "^1.0.0",
52
52
  "@atlaskit/primitives": "^13.2.0",
53
53
  "@atlaskit/theme": "^14.0.0",
54
- "@atlaskit/tmp-editor-statsig": "^2.17.0",
54
+ "@atlaskit/tmp-editor-statsig": "^2.19.0",
55
55
  "@atlaskit/toggle": "^13.4.0",
56
56
  "@atlaskit/tokens": "^2.2.0",
57
57
  "@atlaskit/tooltip": "^18.9.0",
@@ -42,7 +42,6 @@ function addColumnAtCustomStep(column: number) {
42
42
  export function addColumnAt(
43
43
  api: PluginInjectionAPI | undefined | null,
44
44
  isTableScalingEnabled = false,
45
- isCellBackgroundDuplicated?: boolean,
46
45
  isTableFixedColumnWidthsOptionEnabled?: boolean,
47
46
  shouldUseIncreasedScalingPercent?: boolean,
48
47
  isCommentEditor?: boolean,
@@ -57,7 +56,7 @@ export function addColumnAt(
57
56
  if (allowAddColumnCustomStep) {
58
57
  updatedTr = addColumnAtCustomStep(column)(updatedTr);
59
58
  } else {
60
- updatedTr = addColumnAtPMUtils(column, isCellBackgroundDuplicated)(updatedTr);
59
+ updatedTr = addColumnAtPMUtils(column)(updatedTr);
61
60
  }
62
61
  const table = findTable(updatedTr.selection);
63
62
  if (table) {
@@ -96,7 +95,6 @@ export const addColumnBefore =
96
95
  (
97
96
  api: PluginInjectionAPI | undefined | null,
98
97
  isTableScalingEnabled = false,
99
- isCellBackgroundDuplicated = false,
100
98
  isTableFixedColumnWidthsOptionEnabled = false,
101
99
  shouldUseIncreasedScalingPercent = false,
102
100
  isCommentEditor = false,
@@ -112,7 +110,6 @@ export const addColumnBefore =
112
110
  addColumnAt(
113
111
  api,
114
112
  isTableScalingEnabled,
115
- isCellBackgroundDuplicated,
116
113
  isTableFixedColumnWidthsOptionEnabled,
117
114
  shouldUseIncreasedScalingPercent,
118
115
  isCommentEditor,
@@ -132,7 +129,6 @@ export const addColumnAfter =
132
129
  (
133
130
  api: PluginInjectionAPI | undefined | null,
134
131
  isTableScalingEnabled?: boolean,
135
- isCellBackgroundDuplicated?: boolean,
136
132
  isTableFixedColumnWidthsOptionEnabled?: boolean,
137
133
  shouldUseIncreasedScalingPercent?: boolean,
138
134
  isCommentEditor?: boolean,
@@ -149,7 +145,6 @@ export const addColumnAfter =
149
145
  addColumnAt(
150
146
  api,
151
147
  isTableScalingEnabled,
152
- isCellBackgroundDuplicated,
153
148
  isTableFixedColumnWidthsOptionEnabled,
154
149
  shouldUseIncreasedScalingPercent,
155
150
  isCommentEditor,
@@ -167,7 +162,6 @@ export const insertColumn =
167
162
  (
168
163
  api: PluginInjectionAPI | undefined | null,
169
164
  isTableScalingEnabled = false,
170
- isCellBackgroundDuplicated?: boolean,
171
165
  isTableFixedColumnWidthsOptionEnabled?: boolean,
172
166
  shouldUseIncreasedScalingPercent?: boolean,
173
167
  isCommentEditor?: boolean,
@@ -177,7 +171,6 @@ export const insertColumn =
177
171
  let tr = addColumnAt(
178
172
  api,
179
173
  isTableScalingEnabled,
180
- isCellBackgroundDuplicated,
181
174
  isTableFixedColumnWidthsOptionEnabled,
182
175
  shouldUseIncreasedScalingPercent,
183
176
  isCommentEditor,
@@ -200,7 +193,7 @@ export const insertColumn =
200
193
  };
201
194
 
202
195
  export const insertRow =
203
- (row: number, moveCursorToTheNewRow: boolean, isCellBackgroundDuplicated?: boolean): Command =>
196
+ (row: number, moveCursorToTheNewRow: boolean): Command =>
204
197
  (state, dispatch) => {
205
198
  // Don't clone the header row
206
199
  const headerRowEnabled = checkIfHeaderRowEnabled(state.selection);
@@ -214,7 +207,7 @@ export const insertRow =
214
207
 
215
208
  const tr = clonePreviousRow
216
209
  ? copyPreviousRow(state.schema)(row)(state.tr)
217
- : addRowAt(row, undefined, isCellBackgroundDuplicated)(state.tr);
210
+ : addRowAt(row, undefined)(state.tr);
218
211
 
219
212
  const table = findTable(tr.selection);
220
213
  if (!table) {
@@ -3,7 +3,11 @@ import type { IntlShape } from 'react-intl-next/src/types';
3
3
  import type { TableLayout } from '@atlaskit/adf-schema';
4
4
  import { tableBackgroundColorPalette } from '@atlaskit/adf-schema';
5
5
  import type { TableSortOrder as SortOrder } from '@atlaskit/custom-steps';
6
- import type { AnalyticsEventPayload, EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
6
+ import type {
7
+ AnalyticsEventPayload,
8
+ CHANGE_ALIGNMENT_REASON,
9
+ EditorAnalyticsAPI,
10
+ } from '@atlaskit/editor-common/analytics';
7
11
  import {
8
12
  ACTION_SUBJECT,
9
13
  EVENT_TYPE,
@@ -11,7 +15,6 @@ import {
11
15
  TABLE_ACTION,
12
16
  TABLE_DISPLAY_MODE,
13
17
  } from '@atlaskit/editor-common/analytics';
14
- import { type CHANGE_ALIGNMENT_REASON } from '@atlaskit/editor-common/analytics';
15
18
  import { editorCommandToPMCommand } from '@atlaskit/editor-common/preset';
16
19
  import type { Command, GetEditorContainerWidth } from '@atlaskit/editor-common/types';
17
20
  import type { Selection } from '@atlaskit/editor-prosemirror/state';
@@ -199,7 +202,7 @@ export const addRowAroundSelection =
199
202
  };
200
203
 
201
204
  export const insertRowWithAnalytics =
202
- (editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null, isCellbackgroundDuplicated = false) =>
205
+ (editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null) =>
203
206
  (inputMethod: InsertRowMethods, options: InsertRowOptions) =>
204
207
  withEditorAnalyticsAPI((state) => {
205
208
  const { totalRowCount, totalColumnCount } = getSelectedTableInfo(state.selection);
@@ -215,9 +218,7 @@ export const insertRowWithAnalytics =
215
218
  },
216
219
  eventType: EVENT_TYPE.TRACK,
217
220
  };
218
- })(editorAnalyticsAPI)(
219
- insertRow(options.index, options.moveCursorToInsertedRow, isCellbackgroundDuplicated),
220
- );
221
+ })(editorAnalyticsAPI)(insertRow(options.index, options.moveCursorToInsertedRow));
221
222
 
222
223
  export const changeColumnWidthByStepWithAnalytics =
223
224
  (
@@ -272,7 +273,6 @@ export const insertColumnWithAnalytics =
272
273
  api: PluginInjectionAPI | undefined | null,
273
274
  editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null,
274
275
  isTableScalingEnabled = false,
275
- isCellbackgroundDuplicated = false,
276
276
  isTableFixedColumnWidthsOptionEnabled = false,
277
277
  shouldUseIncreasedScalingPercent = false,
278
278
  isCommentEditor = false,
@@ -304,7 +304,6 @@ export const insertColumnWithAnalytics =
304
304
  insertColumn(
305
305
  api,
306
306
  isTableScalingEnabled,
307
- isCellbackgroundDuplicated,
308
307
  isTableFixedColumnWidthsOptionEnabled,
309
308
  shouldUseIncreasedScalingPercent,
310
309
  isCommentEditor,
@@ -537,12 +537,28 @@ export const isTableInFocus = (view: EditorView) => {
537
537
  };
538
538
 
539
539
  export const whenTableInFocus =
540
- (eventHandler: (view: EditorView, mouseEvent: Event) => boolean) =>
540
+ (
541
+ eventHandler: (view: EditorView, mouseEvent: Event) => boolean,
542
+ pluginInjectionApi?: PluginInjectionAPI,
543
+ ) =>
541
544
  (view: EditorView, mouseEvent: Event): boolean => {
545
+
542
546
  if (!isTableInFocus(view)) {
543
547
  return false;
544
548
  }
545
549
 
550
+ const isViewMode =
551
+ pluginInjectionApi?.editorViewMode?.sharedState.currentState()?.mode === 'view';
552
+ /**
553
+ * Table cannot be in focus if we are in view mode.
554
+ * This will prevent an infinite flow of adding and removing
555
+ * resize handle decorations in view mode that causes unpredictable
556
+ * selections.
557
+ */
558
+ if (isViewMode) {
559
+ return false;
560
+ }
561
+
546
562
  return eventHandler(view, mouseEvent);
547
563
  };
548
564
 
@@ -109,12 +109,15 @@ interface ComponentProps {
109
109
  contentDOM: (node: HTMLElement | null) => void;
110
110
  containerWidth: EditorContainerWidth;
111
111
  allowControls: boolean;
112
+
113
+ allowTableResizing?: boolean;
114
+ allowTableAlignment?: boolean;
115
+
112
116
  isHeaderRowEnabled: boolean;
113
117
  isHeaderColumnEnabled: boolean;
114
118
  isMediaFullscreen?: boolean;
115
119
  isDragAndDropEnabled?: boolean;
116
120
  isTableScalingEnabled?: boolean;
117
- isTableAlignmentEnabled?: boolean;
118
121
  tableActive: boolean;
119
122
  ordering?: TableColumnOrdering;
120
123
  isResizing?: boolean;
@@ -228,8 +231,8 @@ class TableComponent extends React.Component<ComponentProps, TableState> {
228
231
  componentDidMount() {
229
232
  const {
230
233
  allowColumnResizing,
234
+ allowTableResizing,
231
235
  eventDispatcher,
232
- options,
233
236
  isDragAndDropEnabled,
234
237
  getNode,
235
238
  getEditorFeatureFlags,
@@ -290,7 +293,7 @@ class TableComponent extends React.Component<ComponentProps, TableState> {
290
293
  * We no longer use `containerWidth` as a variable to determine an update for table resizing (avoids unnecessary updates).
291
294
  * Instead we use the resize event to only trigger updates when necessary.
292
295
  */
293
- if (!options?.isTableResizingEnabled) {
296
+ if (!allowTableResizing) {
294
297
  window.addEventListener('resize', this.handleWindowResizeDebounced);
295
298
  }
296
299
  this.handleTableResizingDebounced();
@@ -313,7 +316,8 @@ class TableComponent extends React.Component<ComponentProps, TableState> {
313
316
  }
314
317
 
315
318
  componentWillUnmount() {
316
- const { allowColumnResizing, eventDispatcher, options, isDragAndDropEnabled } = this.props;
319
+ const { allowColumnResizing, allowTableResizing, eventDispatcher, isDragAndDropEnabled } =
320
+ this.props;
317
321
  if (this.wrapper && !isIE11) {
318
322
  this.wrapper.removeEventListener('scroll', this.handleScrollDebounced);
319
323
  }
@@ -333,11 +337,11 @@ class TableComponent extends React.Component<ComponentProps, TableState> {
333
337
  this.scaleTableDebounced.cancel();
334
338
  this.handleTableResizingDebounced.cancel();
335
339
  this.handleAutoSizeDebounced.cancel();
336
- if (!options?.isTableResizingEnabled) {
340
+ if (!allowTableResizing) {
337
341
  this.handleWindowResizeDebounced.cancel();
338
342
  }
339
343
 
340
- if (!options?.isTableResizingEnabled && allowColumnResizing) {
344
+ if (!allowTableResizing && allowColumnResizing) {
341
345
  window.removeEventListener('resize', this.handleWindowResizeDebounced);
342
346
  }
343
347
 
@@ -530,6 +534,7 @@ class TableComponent extends React.Component<ComponentProps, TableState> {
530
534
  getNode,
531
535
  isMediaFullscreen,
532
536
  allowColumnResizing,
537
+ allowTableResizing,
533
538
  isResizing,
534
539
  options,
535
540
  isTableScalingEnabled, // we could use options.isTableScalingEnabled here
@@ -578,7 +583,7 @@ class TableComponent extends React.Component<ComponentProps, TableState> {
578
583
 
579
584
  if (
580
585
  this.props.options?.isCommentEditor &&
581
- options?.isTableResizingEnabled &&
586
+ allowTableResizing &&
582
587
  !options?.isTableScalingEnabled
583
588
  ) {
584
589
  this.removeInlineTableWidth();
@@ -632,7 +637,7 @@ class TableComponent extends React.Component<ComponentProps, TableState> {
632
637
  if (tablesHaveDifferentColumnWidths(currentTable, previousTable) || isNoOfColumnsChanged) {
633
638
  const { view } = this.props;
634
639
  const shouldRecreateResizeCols =
635
- !options?.isTableResizingEnabled || !isResizing || (isNoOfColumnsChanged && isResizing);
640
+ !allowTableResizing || !isResizing || (isNoOfColumnsChanged && isResizing);
636
641
 
637
642
  if (shouldRecreateResizeCols) {
638
643
  const start = getPos() || 0;
@@ -745,7 +750,8 @@ class TableComponent extends React.Component<ComponentProps, TableState> {
745
750
  isDragAndDropEnabled,
746
751
  getEditorFeatureFlags,
747
752
  isTableScalingEnabled, // here we can use options.isTableScalingEnabled
748
- isTableAlignmentEnabled,
753
+ allowTableResizing,
754
+ allowTableAlignment,
749
755
  } = this.props;
750
756
 
751
757
  let { isInDanger, hoveredRows, hoveredCell, isTableHovered, isWholeTableInDanger } = this.props;
@@ -873,12 +879,12 @@ class TableComponent extends React.Component<ComponentProps, TableState> {
873
879
  isNested={isNested}
874
880
  pluginInjectionApi={pluginInjectionApi}
875
881
  tableWrapperHeight={this.state.tableWrapperHeight}
876
- isTableResizingEnabled={options?.isTableResizingEnabled}
882
+ isTableResizingEnabled={allowTableResizing}
877
883
  isResizing={isResizing}
878
884
  isTableScalingEnabled={isTableScalingEnabled}
879
885
  isTableWithFixedColumnWidthsOptionEnabled={tableWithFixedColumnWidthsOption}
880
886
  isWholeTableInDanger={isWholeTableInDanger}
881
- isTableAlignmentEnabled={isTableAlignmentEnabled}
887
+ isTableAlignmentEnabled={allowTableAlignment}
882
888
  shouldUseIncreasedScalingPercent={shouldUseIncreasedScalingPercent}
883
889
  isCommentEditor={options?.isCommentEditor}
884
890
  isChromelessEditor={options?.isChromelessEditor}
@@ -1037,7 +1043,7 @@ class TableComponent extends React.Component<ComponentProps, TableState> {
1037
1043
  };
1038
1044
 
1039
1045
  private handleTableResizing = () => {
1040
- const { getNode, containerWidth, options } = this.props;
1046
+ const { getNode, containerWidth, options, allowTableResizing } = this.props;
1041
1047
  const prevNode = this.node!;
1042
1048
  const node = getNode();
1043
1049
  const prevAttrs = prevNode.attrs;
@@ -1096,7 +1102,7 @@ class TableComponent extends React.Component<ComponentProps, TableState> {
1096
1102
  noOfColumnsChanged
1097
1103
  ) {
1098
1104
  const shouldScaleTable =
1099
- (!options?.isTableResizingEnabled || (options?.isTableResizingEnabled && isNested)) &&
1105
+ (!allowTableResizing || (allowTableResizing && isNested)) &&
1100
1106
  !hasNumberedColumnChanged &&
1101
1107
  !noOfColumnsChanged;
1102
1108
 
@@ -1111,7 +1117,7 @@ class TableComponent extends React.Component<ComponentProps, TableState> {
1111
1117
  }
1112
1118
 
1113
1119
  // only when table resizing is enabled and toggle numbered column to run scaleTable
1114
- if (options?.isTableResizingEnabled && hasNumberedColumnChanged) {
1120
+ if (allowTableResizing && hasNumberedColumnChanged) {
1115
1121
  if (!hasTableBeenResized(prevNode)) {
1116
1122
  this.scaleTable(
1117
1123
  {
@@ -1170,7 +1176,7 @@ class TableComponent extends React.Component<ComponentProps, TableState> {
1170
1176
  };
1171
1177
 
1172
1178
  private setTimerToSendInitialOverflowCaptured = (isOverflowing: boolean) => {
1173
- const { dispatchAnalyticsEvent, containerWidth, options } = this.props;
1179
+ const { dispatchAnalyticsEvent, containerWidth, allowTableResizing } = this.props;
1174
1180
  const parentWidth = this.state?.parentWidth || 0;
1175
1181
 
1176
1182
  this.initialOverflowCaptureTimerId = setTimeout(() => {
@@ -1182,7 +1188,7 @@ class TableComponent extends React.Component<ComponentProps, TableState> {
1182
1188
  attributes: {
1183
1189
  editorWidth: containerWidth.width || 0,
1184
1190
  isOverflowing,
1185
- tableResizingEnabled: options?.isTableResizingEnabled || false,
1191
+ tableResizingEnabled: allowTableResizing || false,
1186
1192
  width: this.node.attrs.width || 0,
1187
1193
  parentWidth,
1188
1194
  },