@atlaskit/editor-plugin-table 7.25.3 → 7.25.4

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 (100) hide show
  1. package/CHANGELOG.md +11 -0
  2. package/dist/cjs/commands/column-resize.js +4 -1
  3. package/dist/cjs/commands-with-analytics.js +2 -1
  4. package/dist/cjs/event-handlers.js +3 -2
  5. package/dist/cjs/nodeviews/TableComponent.js +14 -10
  6. package/dist/cjs/nodeviews/TableResizer.js +1 -1
  7. package/dist/cjs/nodeviews/lazy-node-views.js +1 -5
  8. package/dist/cjs/nodeviews/table.js +18 -8
  9. package/dist/cjs/plugin.js +6 -4
  10. package/dist/cjs/pm-plugins/drag-and-drop/plugin.js +10 -5
  11. package/dist/cjs/pm-plugins/keymap.js +2 -2
  12. package/dist/cjs/pm-plugins/table-resizing/event-handlers.js +6 -4
  13. package/dist/cjs/pm-plugins/table-resizing/plugin.js +2 -2
  14. package/dist/cjs/pm-plugins/table-resizing/utils/resize-state.js +2 -1
  15. package/dist/cjs/pm-plugins/table-resizing/utils/scale-table.js +4 -1
  16. package/dist/cjs/toolbar.js +10 -6
  17. package/dist/cjs/ui/DragHandle/index.js +2 -1
  18. package/dist/cjs/ui/FloatingContextualMenu/ContextualMenu.js +5 -2
  19. package/dist/cjs/ui/FloatingContextualMenu/index.js +4 -2
  20. package/dist/es2019/commands/column-resize.js +4 -1
  21. package/dist/es2019/commands-with-analytics.js +2 -1
  22. package/dist/es2019/event-handlers.js +2 -2
  23. package/dist/es2019/nodeviews/TableComponent.js +13 -10
  24. package/dist/es2019/nodeviews/TableResizer.js +1 -1
  25. package/dist/es2019/nodeviews/lazy-node-views.js +1 -5
  26. package/dist/es2019/nodeviews/table.js +21 -8
  27. package/dist/es2019/plugin.js +6 -4
  28. package/dist/es2019/pm-plugins/drag-and-drop/plugin.js +8 -6
  29. package/dist/es2019/pm-plugins/keymap.js +2 -2
  30. package/dist/es2019/pm-plugins/table-resizing/event-handlers.js +6 -4
  31. package/dist/es2019/pm-plugins/table-resizing/plugin.js +2 -2
  32. package/dist/es2019/pm-plugins/table-resizing/utils/resize-state.js +3 -3
  33. package/dist/es2019/pm-plugins/table-resizing/utils/scale-table.js +5 -3
  34. package/dist/es2019/toolbar.js +10 -10
  35. package/dist/es2019/ui/DragHandle/index.js +1 -1
  36. package/dist/es2019/ui/FloatingContextualMenu/ContextualMenu.js +5 -2
  37. package/dist/es2019/ui/FloatingContextualMenu/index.js +4 -2
  38. package/dist/esm/commands/column-resize.js +4 -1
  39. package/dist/esm/commands-with-analytics.js +2 -1
  40. package/dist/esm/event-handlers.js +3 -2
  41. package/dist/esm/nodeviews/TableComponent.js +14 -10
  42. package/dist/esm/nodeviews/TableResizer.js +1 -1
  43. package/dist/esm/nodeviews/lazy-node-views.js +1 -5
  44. package/dist/esm/nodeviews/table.js +18 -8
  45. package/dist/esm/plugin.js +6 -4
  46. package/dist/esm/pm-plugins/drag-and-drop/plugin.js +10 -5
  47. package/dist/esm/pm-plugins/keymap.js +2 -2
  48. package/dist/esm/pm-plugins/table-resizing/event-handlers.js +6 -4
  49. package/dist/esm/pm-plugins/table-resizing/plugin.js +2 -2
  50. package/dist/esm/pm-plugins/table-resizing/utils/resize-state.js +3 -2
  51. package/dist/esm/pm-plugins/table-resizing/utils/scale-table.js +5 -2
  52. package/dist/esm/toolbar.js +10 -6
  53. package/dist/esm/ui/DragHandle/index.js +2 -1
  54. package/dist/esm/ui/FloatingContextualMenu/ContextualMenu.js +5 -2
  55. package/dist/esm/ui/FloatingContextualMenu/index.js +4 -2
  56. package/dist/types/commands/column-resize.d.ts +2 -1
  57. package/dist/types/commands-with-analytics.d.ts +1 -1
  58. package/dist/types/pm-plugins/drag-and-drop/plugin.d.ts +1 -1
  59. package/dist/types/pm-plugins/table-resizing/event-handlers.d.ts +1 -1
  60. package/dist/types/pm-plugins/table-resizing/plugin.d.ts +1 -1
  61. package/dist/types/pm-plugins/table-resizing/utils/resize-state.d.ts +1 -1
  62. package/dist/types/pm-plugins/table-resizing/utils/scale-table.d.ts +1 -1
  63. package/dist/types/toolbar.d.ts +2 -2
  64. package/dist/types/ui/FloatingContextualMenu/ContextualMenu.d.ts +1 -0
  65. package/dist/types/ui/FloatingContextualMenu/index.d.ts +2 -1
  66. package/dist/types-ts4.5/commands/column-resize.d.ts +2 -1
  67. package/dist/types-ts4.5/commands-with-analytics.d.ts +1 -1
  68. package/dist/types-ts4.5/pm-plugins/drag-and-drop/plugin.d.ts +1 -1
  69. package/dist/types-ts4.5/pm-plugins/table-resizing/event-handlers.d.ts +1 -1
  70. package/dist/types-ts4.5/pm-plugins/table-resizing/plugin.d.ts +1 -1
  71. package/dist/types-ts4.5/pm-plugins/table-resizing/utils/resize-state.d.ts +1 -1
  72. package/dist/types-ts4.5/pm-plugins/table-resizing/utils/scale-table.d.ts +1 -1
  73. package/dist/types-ts4.5/toolbar.d.ts +2 -2
  74. package/dist/types-ts4.5/ui/FloatingContextualMenu/ContextualMenu.d.ts +1 -0
  75. package/dist/types-ts4.5/ui/FloatingContextualMenu/index.d.ts +2 -1
  76. package/package.json +3 -3
  77. package/src/commands/column-resize.ts +7 -2
  78. package/src/commands-with-analytics.ts +2 -0
  79. package/src/event-handlers.ts +2 -1
  80. package/src/nodeviews/TableComponent.tsx +11 -8
  81. package/src/nodeviews/TableResizer.tsx +1 -0
  82. package/src/nodeviews/lazy-node-views.ts +0 -4
  83. package/src/nodeviews/table.tsx +30 -8
  84. package/src/plugin.tsx +8 -2
  85. package/src/pm-plugins/drag-and-drop/plugin.ts +9 -4
  86. package/src/pm-plugins/keymap.ts +2 -0
  87. package/src/pm-plugins/table-resizing/event-handlers.ts +11 -6
  88. package/src/pm-plugins/table-resizing/plugin.ts +2 -0
  89. package/src/pm-plugins/table-resizing/utils/resize-state.ts +5 -3
  90. package/src/pm-plugins/table-resizing/utils/scale-table.ts +6 -3
  91. package/src/toolbar.tsx +10 -1
  92. package/src/ui/DragHandle/index.tsx +1 -1
  93. package/src/ui/FloatingContextualMenu/ContextualMenu.tsx +6 -2
  94. package/src/ui/FloatingContextualMenu/index.tsx +3 -0
  95. package/dist/cjs/nodeviews/ignore-mutation-delegate.js +0 -23
  96. package/dist/es2019/nodeviews/ignore-mutation-delegate.js +0 -20
  97. package/dist/esm/nodeviews/ignore-mutation-delegate.js +0 -17
  98. package/dist/types/nodeviews/ignore-mutation-delegate.d.ts +0 -5
  99. package/dist/types-ts4.5/nodeviews/ignore-mutation-delegate.d.ts +0 -5
  100. package/src/nodeviews/ignore-mutation-delegate.ts +0 -28
@@ -19,9 +19,10 @@ export interface Props {
19
19
  pluginConfig?: PluginConfig;
20
20
  editorAnalyticsAPI?: EditorAnalyticsAPI;
21
21
  isCellMenuOpenByKeyboard?: boolean;
22
+ isCommentEditor?: boolean;
22
23
  }
23
24
  declare const FloatingContextualMenu: {
24
- ({ mountPoint, boundariesElement, scrollableElement, editorView, isOpen, pluginConfig, editorAnalyticsAPI, getEditorContainerWidth, getEditorFeatureFlags, isCellMenuOpenByKeyboard, }: Props): jsx.JSX.Element | null;
25
+ ({ mountPoint, boundariesElement, scrollableElement, editorView, isOpen, pluginConfig, editorAnalyticsAPI, getEditorContainerWidth, getEditorFeatureFlags, isCellMenuOpenByKeyboard, isCommentEditor, }: Props): jsx.JSX.Element | null;
25
26
  displayName: string;
26
27
  };
27
28
  export default FloatingContextualMenu;
@@ -12,11 +12,12 @@ export declare const activateNextResizeArea: ({ direction, ariaNotify, getIntl,
12
12
  ariaNotify?: ((message: string, ariaLiveElementAttributes?: AriaLiveElementAttributes) => void) | undefined;
13
13
  getIntl?: (() => IntlShape) | undefined;
14
14
  }) => Command;
15
- export declare const changeColumnWidthByStep: ({ stepSize, getEditorContainerWidth, isTableScalingEnabled, isTableFixedColumnWidthsOptionEnabled, ariaNotify, getIntl, }: {
15
+ export declare const changeColumnWidthByStep: ({ stepSize, getEditorContainerWidth, isTableScalingEnabled, isTableFixedColumnWidthsOptionEnabled, isCommentEditor, ariaNotify, getIntl, }: {
16
16
  stepSize: number;
17
17
  getEditorContainerWidth: GetEditorContainerWidth;
18
18
  isTableScalingEnabled: boolean;
19
19
  isTableFixedColumnWidthsOptionEnabled: boolean;
20
+ isCommentEditor: boolean;
20
21
  ariaNotify?: ((message: string, ariaLiveElementAttributes?: AriaLiveElementAttributes) => void) | undefined;
21
22
  getIntl?: (() => IntlShape) | undefined;
22
23
  originalTr?: Transaction | undefined;
@@ -16,7 +16,7 @@ export declare const splitCellWithAnalytics: (editorAnalyticsAPI: EditorAnalytic
16
16
  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
17
  export declare const addRowAroundSelection: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null) => (side: RowInsertPosition) => Command;
18
18
  export declare const insertRowWithAnalytics: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null, isCellbackgroundDuplicated?: boolean) => (inputMethod: InsertRowMethods, options: InsertRowOptions) => Command;
19
- export declare const changeColumnWidthByStepWithAnalytics: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null) => (stepSize: number, getEditorContainerWidth: GetEditorContainerWidth, isTableScalingEnabled: boolean, isTableFixedColumnWidthsOptionEnabled: boolean, inputMethod: INPUT_METHOD.SHORTCUT, ariaNotify?: ((message: string) => void) | undefined, getIntl?: () => IntlShape) => Command;
19
+ export declare const changeColumnWidthByStepWithAnalytics: (editorAnalyticsAPI: EditorAnalyticsAPI | 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
20
  export declare const insertColumnWithAnalytics: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null, isTableScalingEnabled?: boolean, isCellbackgroundDuplicated?: boolean, isTableFixedColumnWidthsOptionEnabled?: boolean, shouldUseIncreasedScalingPercent?: 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
21
  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
22
  export declare const deleteColumnsWithAnalytics: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null, isTableScalingEnabled?: boolean, isTableFixedColumnWidthsOptionEnabled?: boolean, shouldUseIncreasedScalingPercent?: boolean) => (inputMethod: INPUT_METHOD.CONTEXT_MENU | INPUT_METHOD.BUTTON | INPUT_METHOD.FLOATING_TB | INPUT_METHOD.SHORTCUT | INPUT_METHOD.TABLE_CONTEXT_MENU, rect: Rect) => Command;
@@ -1,4 +1,4 @@
1
1
  import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
2
2
  import type { Dispatch } from '@atlaskit/editor-common/event-dispatcher';
3
3
  import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
4
- export declare const createPlugin: (dispatch: Dispatch, editorAnalyticsAPI?: EditorAnalyticsAPI, isTableScalingEnabled?: boolean, isTableFixedColumnWidthsOptionEnabled?: boolean) => SafePlugin<import("./types").DragAndDropPluginState>;
4
+ export declare const createPlugin: (dispatch: Dispatch, editorAnalyticsAPI?: EditorAnalyticsAPI, isTableScalingEnabled?: boolean, isTableFixedColumnWidthsOptionEnabled?: boolean, isCommentEditor?: boolean) => SafePlugin<import("./types").DragAndDropPluginState>;
@@ -1,4 +1,4 @@
1
1
  import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
2
2
  import type { GetEditorContainerWidth, GetEditorFeatureFlags } from '@atlaskit/editor-common/types';
3
3
  import type { EditorView } from '@atlaskit/editor-prosemirror/view';
4
- export declare const handleMouseDown: (view: EditorView, event: MouseEvent, localResizeHandlePos: number, getEditorContainerWidth: GetEditorContainerWidth, getEditorFeatureFlags: GetEditorFeatureFlags, isTableScalingEnabled: boolean, editorAnalyticsAPI?: EditorAnalyticsAPI, isNewColumnResizingEnabled?: boolean, isTableAlignmentEnabled?: boolean) => boolean;
4
+ export declare const handleMouseDown: (view: EditorView, event: MouseEvent, localResizeHandlePos: number, getEditorContainerWidth: GetEditorContainerWidth, getEditorFeatureFlags: GetEditorFeatureFlags, isTableScalingEnabled: boolean, editorAnalyticsAPI?: EditorAnalyticsAPI, isNewColumnResizingEnabled?: boolean, isTableAlignmentEnabled?: boolean, isCommentEditor?: boolean) => boolean;
@@ -3,4 +3,4 @@ import type { Dispatch } from '@atlaskit/editor-common/event-dispatcher';
3
3
  import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
4
4
  import type { GetEditorContainerWidth, GetEditorFeatureFlags } from '@atlaskit/editor-common/types';
5
5
  import type { ColumnResizingPluginState } from '../../types';
6
- export declare function createPlugin(dispatch: Dispatch<ColumnResizingPluginState>, { lastColumnResizable }: ColumnResizingPluginState, getEditorContainerWidth: GetEditorContainerWidth, getEditorFeatureFlags: GetEditorFeatureFlags, editorAnalyticsAPI?: EditorAnalyticsAPI, isTableScalingEnabled?: boolean, isNewColumnResizingEnabled?: boolean, isTableAlignmentEnabled?: boolean): SafePlugin<ColumnResizingPluginState>;
6
+ export declare function createPlugin(dispatch: Dispatch<ColumnResizingPluginState>, { lastColumnResizable }: ColumnResizingPluginState, getEditorContainerWidth: GetEditorContainerWidth, getEditorFeatureFlags: GetEditorFeatureFlags, editorAnalyticsAPI?: EditorAnalyticsAPI, isTableScalingEnabled?: boolean, isNewColumnResizingEnabled?: boolean, isTableAlignmentEnabled?: boolean, isCommentEditor?: boolean): SafePlugin<ColumnResizingPluginState>;
@@ -27,4 +27,4 @@ export declare const normaliseTableLayout: (input: string | undefined | null) =>
27
27
  export declare const getNewResizeStateFromSelectedColumns: (rect: Rect, state: EditorState, domAtPos: (pos: number) => {
28
28
  node: Node;
29
29
  offset: number;
30
- }, getEditorContainerWidth: GetEditorContainerWidth, isTableScalingEnabled?: boolean, isTableFixedColumnWidthsOptionEnabled?: boolean) => ResizeStateWithAnalytics | undefined;
30
+ }, getEditorContainerWidth: GetEditorContainerWidth, isTableScalingEnabled?: boolean, isTableFixedColumnWidthsOptionEnabled?: boolean, isCommentEditor?: boolean) => ResizeStateWithAnalytics | undefined;
@@ -16,5 +16,5 @@ export interface ScaleOptions {
16
16
  export declare const scale: (tableRef: HTMLTableElement, options: ScaleOptions, domAtPos: DomAtPos, isTableScalingEnabledOnCurrentTable?: boolean, shouldUseIncreasedScalingPercent?: boolean) => ResizeState | undefined;
17
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
- export declare const previewScaleTable: (tableRef: HTMLTableElement | null | undefined, options: ScaleOptions, domAtPos: DomAtPos, isTableScalingEnabled?: boolean, isTableWithFixedColumnWidthsOptionEnabled?: boolean) => void;
19
+ export declare const previewScaleTable: (tableRef: HTMLTableElement | null | undefined, options: ScaleOptions, domAtPos: DomAtPos, isTableScalingEnabled?: boolean, isTableWithFixedColumnWidthsOptionEnabled?: boolean, isCommentEditor?: boolean) => void;
20
20
  export declare const scaleTable: (tableRef: HTMLTableElement | null | undefined, options: ScaleOptions, domAtPos: DomAtPos, isTableScalingEnabledOnCurrentTable?: boolean, shouldUseIncreasedScalingPercent?: boolean) => (tr: Transaction) => Transaction;
@@ -8,11 +8,11 @@ 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, isTableScalingWithFixedColumnWidthsOptionShown?: boolean, areTableColumnWidthsFixed?: boolean) => 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, isCellBackgroundDuplicated?: boolean, isTableFixedColumnWidthsOptionEnabled?: boolean, shouldUseIncreasedScalingPercent?: 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, isCellBackgroundDuplicated?: boolean, isTableFixedColumnWidthsOptionEnabled?: boolean, shouldUseIncreasedScalingPercent?: boolean, isCommentEditor?: boolean) => FloatingToolbarDropdown<Command>;
12
12
  export declare const getClosestSelectionRect: (state: EditorState) => Rect | undefined;
13
13
  export declare const getClosestSelectionOrTableRect: (state: EditorState) => Rect | undefined;
14
14
  export declare const getToolbarConfig: (getEditorContainerWidth: GetEditorContainerWidth, editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null, getEditorFeatureFlags: GetEditorFeatureFlags, getEditorView: () => EditorView | null, options?: TablePluginOptions, isTableFixedColumnWidthsOptionEnabled?: boolean, shouldUseIncreasedScalingPercent?: boolean) => (config: PluginConfig) => FloatingToolbarHandler;
15
- export declare const getDistributeConfig: (getEditorContainerWidth: GetEditorContainerWidth, editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null, isTableScalingEnabled?: boolean, isTableFixedColumnWidthsOptionEnabled?: boolean) => Command;
15
+ export declare const getDistributeConfig: (getEditorContainerWidth: GetEditorContainerWidth, editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null, isTableScalingEnabled?: boolean, isTableFixedColumnWidthsOptionEnabled?: boolean, isCommentEditor?: boolean) => Command;
16
16
  type AlignmentIcon = {
17
17
  id?: string;
18
18
  value: AlignmentOptions;
@@ -24,6 +24,7 @@ export interface Props {
24
24
  getEditorContainerWidth: GetEditorContainerWidth;
25
25
  getEditorFeatureFlags?: GetEditorFeatureFlags;
26
26
  isCellMenuOpenByKeyboard?: boolean;
27
+ isCommentEditor?: boolean;
27
28
  }
28
29
  export interface State {
29
30
  isSubmenuOpen: boolean;
@@ -19,9 +19,10 @@ export interface Props {
19
19
  pluginConfig?: PluginConfig;
20
20
  editorAnalyticsAPI?: EditorAnalyticsAPI;
21
21
  isCellMenuOpenByKeyboard?: boolean;
22
+ isCommentEditor?: boolean;
22
23
  }
23
24
  declare const FloatingContextualMenu: {
24
- ({ mountPoint, boundariesElement, scrollableElement, editorView, isOpen, pluginConfig, editorAnalyticsAPI, getEditorContainerWidth, getEditorFeatureFlags, isCellMenuOpenByKeyboard, }: Props): jsx.JSX.Element | null;
25
+ ({ mountPoint, boundariesElement, scrollableElement, editorView, isOpen, pluginConfig, editorAnalyticsAPI, getEditorContainerWidth, getEditorFeatureFlags, isCellMenuOpenByKeyboard, isCommentEditor, }: Props): jsx.JSX.Element | null;
25
26
  displayName: string;
26
27
  };
27
28
  export default FloatingContextualMenu;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-table",
3
- "version": "7.25.3",
3
+ "version": "7.25.4",
4
4
  "description": "Table plugin for the @atlaskit/editor",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -31,7 +31,7 @@
31
31
  "@atlaskit/adf-schema": "^40.8.1",
32
32
  "@atlaskit/button": "^19.2.0",
33
33
  "@atlaskit/custom-steps": "^0.7.0",
34
- "@atlaskit/editor-common": "^87.9.0",
34
+ "@atlaskit/editor-common": "^87.10.0",
35
35
  "@atlaskit/editor-palette": "1.6.0",
36
36
  "@atlaskit/editor-plugin-accessibility-utils": "^1.2.0",
37
37
  "@atlaskit/editor-plugin-analytics": "^1.7.0",
@@ -50,7 +50,7 @@
50
50
  "@atlaskit/pragmatic-drag-and-drop-auto-scroll": "^1.4.0",
51
51
  "@atlaskit/pragmatic-drag-and-drop-hitbox": "^1.0.0",
52
52
  "@atlaskit/primitives": "^12.0.0",
53
- "@atlaskit/theme": "^12.12.0",
53
+ "@atlaskit/theme": "^13.0.0",
54
54
  "@atlaskit/toggle": "^13.3.0",
55
55
  "@atlaskit/tokens": "^1.58.0",
56
56
  "@atlaskit/tooltip": "^18.7.0",
@@ -250,6 +250,7 @@ export const changeColumnWidthByStep =
250
250
  getEditorContainerWidth,
251
251
  isTableScalingEnabled,
252
252
  isTableFixedColumnWidthsOptionEnabled,
253
+ isCommentEditor,
253
254
  ariaNotify,
254
255
  getIntl,
255
256
  }: {
@@ -257,6 +258,7 @@ export const changeColumnWidthByStep =
257
258
  getEditorContainerWidth: GetEditorContainerWidth;
258
259
  isTableScalingEnabled: boolean;
259
260
  isTableFixedColumnWidthsOptionEnabled: boolean;
261
+ isCommentEditor: boolean;
260
262
  ariaNotify?: (message: string, ariaLiveElementAttributes?: AriaLiveElementAttributes) => void;
261
263
  getIntl?: () => IntlShape;
262
264
  originalTr?: Transaction;
@@ -318,9 +320,12 @@ export const changeColumnWidthByStep =
318
320
  if (isTableScalingWithFixedColumnWidthsOptionEnabled) {
319
321
  isTableScalingEnabledOnCurrentTable = originalTable.attrs.displayMode !== 'fixed';
320
322
  }
323
+
321
324
  const shouldUseIncreasedScalingPercent =
322
- isTableScalingWithFixedColumnWidthsOptionEnabled &&
323
- fg('platform.editor.table.use-increased-scaling-percent');
325
+ (isTableScalingWithFixedColumnWidthsOptionEnabled &&
326
+ fg('platform.editor.table.use-increased-scaling-percent')) ||
327
+ // When in comment editor, we need the scaling percent to be 40% while tableWithFixedColumnWidthsOption is not visible
328
+ (isTableScalingEnabled && isCommentEditor);
324
329
 
325
330
  const initialResizeState = getResizeState({
326
331
  minWidth: tableCellMinWidth,
@@ -238,6 +238,7 @@ export const changeColumnWidthByStepWithAnalytics =
238
238
  getEditorContainerWidth: GetEditorContainerWidth,
239
239
  isTableScalingEnabled: boolean,
240
240
  isTableFixedColumnWidthsOptionEnabled: boolean,
241
+ isCommentEditor: boolean,
241
242
  inputMethod: INPUT_METHOD.SHORTCUT,
242
243
  ariaNotify?: (message: string) => void,
243
244
  getIntl?: () => IntlShape,
@@ -268,6 +269,7 @@ export const changeColumnWidthByStepWithAnalytics =
268
269
  getEditorContainerWidth: getEditorContainerWidth,
269
270
  isTableScalingEnabled,
270
271
  isTableFixedColumnWidthsOptionEnabled,
272
+ isCommentEditor,
271
273
  ariaNotify: ariaNotify,
272
274
  getIntl: getIntl,
273
275
  }),
@@ -315,7 +315,7 @@ export const handleMouseLeave = (view: EditorView, event: Event): boolean => {
315
315
 
316
316
  if (isTableHovered) {
317
317
  if (isDragAndDropEnabled) {
318
- const { isDragMenuOpen } = getDragDropPluginState(state);
318
+ const { isDragMenuOpen = false } = getDragDropPluginState(state);
319
319
  !isDragMenuOpen && setTableHovered(false)(state, dispatch);
320
320
  } else {
321
321
  setTableHovered(false)(state, dispatch);
@@ -588,6 +588,7 @@ export const withCellTracking =
588
588
  (view: EditorView, mouseEvent: Event): boolean => {
589
589
  if (
590
590
  getPluginState(view.state).isDragAndDropEnabled &&
591
+ getDragDropPluginState(view.state) &&
591
592
  !getDragDropPluginState(view.state).isDragging
592
593
  ) {
593
594
  trackCellLocation(view, mouseEvent);
@@ -438,12 +438,13 @@ class TableComponent extends React.Component<ComponentProps, TableState> {
438
438
  const { tableWithFixedColumnWidthsOption = false } = getEditorFeatureFlags();
439
439
 
440
440
  const isTableScalingWithFixedColumnWidthsOptionEnabled =
441
- this.props.options?.isTableScalingEnabled && tableWithFixedColumnWidthsOption;
441
+ !!this.props.options?.isTableScalingEnabled && tableWithFixedColumnWidthsOption;
442
442
 
443
443
  const shouldUseIncreasedScalingPercent =
444
444
  (isTableScalingWithFixedColumnWidthsOptionEnabled &&
445
445
  fg('platform.editor.table.use-increased-scaling-percent')) ||
446
- false;
446
+ // When in comment editor, we need the scaling percent to be 40% while tableWithFixedColumnWidthsOption is not visible
447
+ (!!this.props.options?.isTableScalingEnabled && !!this.props.options?.isCommentEditor);
447
448
 
448
449
  if (force || (!isResizing && shouldUpdateColgroup)) {
449
450
  const resizeState = getResizeState({
@@ -517,10 +518,11 @@ class TableComponent extends React.Component<ComponentProps, TableState> {
517
518
  }
518
519
 
519
520
  const isTableScalingWithFixedColumnWidthsOptionEnabled =
520
- isTableScalingEnabled && tableWithFixedColumnWidthsOption;
521
+ !!isTableScalingEnabled && tableWithFixedColumnWidthsOption;
521
522
  const shouldUseIncreasedScalingPercent =
522
- isTableScalingWithFixedColumnWidthsOptionEnabled &&
523
- fg('platform.editor.table.use-increased-scaling-percent');
523
+ (isTableScalingWithFixedColumnWidthsOptionEnabled &&
524
+ fg('platform.editor.table.use-increased-scaling-percent')) ||
525
+ (!!isTableScalingEnabled && !!this.props.options?.isCommentEditor);
524
526
 
525
527
  if (
526
528
  isTableScalingWithFixedColumnWidthsOptionEnabled &&
@@ -808,9 +810,10 @@ class TableComponent extends React.Component<ComponentProps, TableState> {
808
810
  const { stickyScrollbar, tableWithFixedColumnWidthsOption = false } = getEditorFeatureFlags();
809
811
 
810
812
  const shouldUseIncreasedScalingPercent =
811
- isTableScalingEnabled &&
812
- tableWithFixedColumnWidthsOption &&
813
- fg('platform.editor.table.use-increased-scaling-percent');
813
+ !!isTableScalingEnabled &&
814
+ ((tableWithFixedColumnWidthsOption &&
815
+ fg('platform.editor.table.use-increased-scaling-percent')) ||
816
+ !!this.props.options?.isCommentEditor);
814
817
 
815
818
  return (
816
819
  <TableContainer
@@ -450,6 +450,7 @@ export const TableResizer = ({
450
450
  editorView.domAtPos.bind(editorView),
451
451
  isTableScalingEnabled,
452
452
  isTableWithFixedColumnWidthsOptionEnabled,
453
+ isCommentEditor,
453
454
  );
454
455
 
455
456
  const editorContainerWidth = isFullWidthModeEnabled
@@ -9,7 +9,6 @@ import { fg } from '@atlaskit/platform-feature-flags';
9
9
 
10
10
  import type { PluginInjectionAPI } from '../types';
11
11
 
12
- import ignoreMutationDelegate from './ignore-mutation-delegate';
13
12
  // TODO: Clean up ED-23976
14
13
  import { createTableView } from './table';
15
14
  import TableCell from './TableCell';
@@ -94,9 +93,6 @@ export const lazyTableView = (options: TableViewOptions) => {
94
93
  nodeName: 'table',
95
94
  getNodeViewOptions: () => options,
96
95
  loader,
97
- lazyNodeViewOptions: {
98
- ignoreMutationDelegate,
99
- },
100
96
  });
101
97
  };
102
98
 
@@ -31,7 +31,6 @@ import { pluginKey as tableWidthPluginKey } from '../pm-plugins/table-width';
31
31
  import type { PluginInjectionAPI } from '../types';
32
32
  import { isTableNested } from '../utils';
33
33
 
34
- import ignoreMutationDelegate from './ignore-mutation-delegate';
35
34
  import TableComponent from './TableComponent';
36
35
  import { TableComponentWithSharedState } from './TableComponentWithSharedState';
37
36
  import type { Props } from './types';
@@ -316,16 +315,39 @@ export default class TableView extends ReactNodeView<Props> {
316
315
  }
317
316
 
318
317
  ignoreMutation(mutation: MutationRecord | { type: 'selection'; target: Element }) {
319
- const ignoreMutation = ignoreMutationDelegate(mutation);
318
+ const {
319
+ type,
320
+ target: { nodeName, firstChild },
321
+ } = mutation;
322
+
323
+ if (
324
+ type === 'selection' &&
325
+ nodeName?.toUpperCase() === 'DIV' &&
326
+ firstChild?.nodeName.toUpperCase() === 'TABLE'
327
+ ) {
328
+ return false;
329
+ }
330
+
331
+ // ED-16668
332
+ // Do not remove this fixes an issue with windows firefox that relates to
333
+ // the addition of the shadow sentinels
334
+ if (
335
+ type === 'selection' &&
336
+ nodeName?.toUpperCase() === 'TABLE' &&
337
+ (firstChild?.nodeName.toUpperCase() === 'COLGROUP' ||
338
+ firstChild?.nodeName.toUpperCase() === 'SPAN')
339
+ ) {
340
+ return false;
341
+ }
342
+
320
343
  if (fg('platform_editor_react_18_table_insertion_cursor')) {
321
- if (ignoreMutation) {
322
- if (!this.contentDOM) {
323
- return true;
324
- }
325
- return !this.contentDOM.contains(mutation.target) && mutation.type !== 'selection';
344
+ if (!this.contentDOM) {
345
+ return true;
326
346
  }
347
+ return !this.contentDOM.contains(mutation.target) && mutation.type !== 'selection';
327
348
  }
328
- return ignoreMutation;
349
+
350
+ return true;
329
351
  }
330
352
 
331
353
  destroy() {
package/src/plugin.tsx CHANGED
@@ -162,10 +162,13 @@ const tablesPlugin: TablePlugin = ({ config: options, api }) => {
162
162
 
163
163
  const isTableFixedColumnWidthsOptionEnabled =
164
164
  options?.getEditorFeatureFlags?.().tableWithFixedColumnWidthsOption || false;
165
+
165
166
  const shouldUseIncreasedScalingPercent =
166
167
  options?.isTableScalingEnabled &&
167
- isTableFixedColumnWidthsOptionEnabled &&
168
- fg('platform.editor.table.use-increased-scaling-percent');
168
+ ((isTableFixedColumnWidthsOptionEnabled &&
169
+ fg('platform.editor.table.use-increased-scaling-percent')) ||
170
+ // When in comment editor, we need the scaling percent to be 40% while tableWithFixedColumnWidthsOption is not visible
171
+ options?.isCommentEditor);
169
172
 
170
173
  const isCellBackgroundDuplicated =
171
174
  options?.getEditorFeatureFlags?.().tableDuplicateCellColouring || false;
@@ -338,6 +341,7 @@ const tablesPlugin: TablePlugin = ({ config: options, api }) => {
338
341
  isTableScalingEnabled || false,
339
342
  isNewColumnResizingEnabled,
340
343
  isTableAlignmentEnabled,
344
+ !!options?.isCommentEditor,
341
345
  )
342
346
  : undefined;
343
347
  },
@@ -415,6 +419,7 @@ const tablesPlugin: TablePlugin = ({ config: options, api }) => {
415
419
  editorAnalyticsAPI,
416
420
  options?.isTableScalingEnabled,
417
421
  isTableFixedColumnWidthsOptionEnabled,
422
+ options.isCommentEditor,
418
423
  )
419
424
  : undefined;
420
425
  },
@@ -610,6 +615,7 @@ const tablesPlugin: TablePlugin = ({ config: options, api }) => {
610
615
  options?.getEditorFeatureFlags || defaultGetEditorFeatureFlags
611
616
  }
612
617
  isCellMenuOpenByKeyboard={isCellMenuOpenByKeyboard}
618
+ isCommentEditor={options?.isCommentEditor}
613
619
  />
614
620
  )}
615
621
  {isDragAndDropEnabled && (
@@ -34,6 +34,7 @@ const destroyFn = (
34
34
  editorAnalyticsAPI: any,
35
35
  isTableScalingEnabled: boolean,
36
36
  isTableFixedColumnWidthsOptionEnabled: boolean,
37
+ isCommentEditor: boolean,
37
38
  ) => {
38
39
  const editorPageScrollContainer = document.querySelector('.fabric-editor-popup-scroll-parent');
39
40
 
@@ -224,8 +225,10 @@ const destroyFn = (
224
225
  }
225
226
 
226
227
  const shouldUseIncreasedScalingPercent =
227
- isTableScalingWithFixedColumnWidthsOptionEnabled &&
228
- fg('platform.editor.table.use-increased-scaling-percent');
228
+ (isTableScalingWithFixedColumnWidthsOptionEnabled &&
229
+ fg('platform.editor.table.use-increased-scaling-percent')) ||
230
+ // When in comment editor, we need the scaling percent to be 40% while tableWithFixedColumnWidthsOption is not visible
231
+ (isTableScalingEnabled && isCommentEditor);
229
232
 
230
233
  insertColgroupFromNode(
231
234
  tableRef,
@@ -249,6 +252,7 @@ export const createPlugin = (
249
252
  editorAnalyticsAPI?: EditorAnalyticsAPI,
250
253
  isTableScalingEnabled = false,
251
254
  isTableFixedColumnWidthsOptionEnabled = false,
255
+ isCommentEditor = false,
252
256
  ) => {
253
257
  return new SafePlugin({
254
258
  state: createPluginState(dispatch, (state) => ({
@@ -264,7 +268,7 @@ export const createPlugin = (
264
268
  appendTransaction: (transactions, oldState, newState) => {
265
269
  const { targetCellPosition: oldTargetCellPosition } = getTablePluginState(oldState);
266
270
  const { targetCellPosition: newTargetCellPosition } = getTablePluginState(newState);
267
- const { isDragMenuOpen, dragMenuIndex } = getPluginState(newState);
271
+ const { isDragMenuOpen = false, dragMenuIndex } = getPluginState(newState);
268
272
 
269
273
  transactions.forEach((transaction) => {
270
274
  if (transaction.getMeta('selectedRowViaKeyboard')) {
@@ -323,6 +327,7 @@ export const createPlugin = (
323
327
  editorAnalyticsAPI,
324
328
  isTableScalingEnabled,
325
329
  isTableFixedColumnWidthsOptionEnabled,
330
+ isCommentEditor,
326
331
  ),
327
332
  };
328
333
  },
@@ -361,7 +366,7 @@ export const createPlugin = (
361
366
  ].includes(((event.target as HTMLElement) || null)?.id);
362
367
  const keysToTrap = ['Enter', ' '];
363
368
 
364
- const { isDragMenuOpen } = getPluginState(view.state);
369
+ const { isDragMenuOpen = false } = getPluginState(view.state);
365
370
 
366
371
  // drag handle is focused, and user presses any key return them back to editing
367
372
  if (isDragHandleFocused && !isDragMenuOpen && !keysToTrap.includes(event.key)) {
@@ -286,6 +286,7 @@ export function keymapPlugin(
286
286
  getEditorContainerWidth,
287
287
  isTableScalingEnabled,
288
288
  isTableFixedColumnWidthsOptionEnabled,
289
+ !!isCommentEditor,
289
290
  INPUT_METHOD.SHORTCUT,
290
291
  ariaNotifyPlugin,
291
292
  getIntl,
@@ -300,6 +301,7 @@ export function keymapPlugin(
300
301
  getEditorContainerWidth,
301
302
  isTableScalingEnabled,
302
303
  isTableFixedColumnWidthsOptionEnabled,
304
+ !!isCommentEditor,
303
305
  INPUT_METHOD.SHORTCUT,
304
306
  ariaNotifyPlugin,
305
307
  getIntl,
@@ -50,6 +50,7 @@ export const handleMouseDown = (
50
50
  editorAnalyticsAPI?: EditorAnalyticsAPI,
51
51
  isNewColumnResizingEnabled?: boolean,
52
52
  isTableAlignmentEnabled?: boolean,
53
+ isCommentEditor?: boolean,
53
54
  ): boolean => {
54
55
  const { state, dispatch } = view;
55
56
  const editorDisabled = !view.editable;
@@ -112,8 +113,10 @@ export const handleMouseDown = (
112
113
  domAtPos,
113
114
  isTableScalingEnabled: shouldScale,
114
115
  shouldUseIncreasedScalingPercent:
115
- isTableScalingWithFixedColumnWidthsOptionEnabled &&
116
- fg('platform.editor.table.use-increased-scaling-percent'),
116
+ (isTableScalingWithFixedColumnWidthsOptionEnabled &&
117
+ fg('platform.editor.table.use-increased-scaling-percent')) ||
118
+ // When in comment editor, we need the scaling percent to be 40% while tableWithFixedColumnWidthsOption is not visible
119
+ (isTableScalingEnabled && !!isCommentEditor),
117
120
  });
118
121
 
119
122
  if (
@@ -211,8 +214,9 @@ export const handleMouseDown = (
211
214
 
212
215
  const resizedDelta = clientX - startX;
213
216
  const shouldUseIncreasedScalingPercent =
214
- isTableScalingWithFixedColumnWidthsOptionEnabled &&
215
- fg('platform.editor.table.use-increased-scaling-percent');
217
+ (isTableScalingWithFixedColumnWidthsOptionEnabled &&
218
+ fg('platform.editor.table.use-increased-scaling-percent')) ||
219
+ (isTableScalingEnabled && !!isCommentEditor);
216
220
 
217
221
  if (isNewColumnResizingEnabled && !isTableNested(state, tablePos)) {
218
222
  const newResizeState = resizeColumnAndTable({
@@ -345,8 +349,9 @@ export const handleMouseDown = (
345
349
  let shouldScale = tableDepth === 0 && isTableScalingEnabled;
346
350
 
347
351
  const shouldUseIncreasedScalingPercent =
348
- isTableScalingWithFixedColumnWidthsOptionEnabled &&
349
- fg('platform.editor.table.use-increased-scaling-percent');
352
+ (isTableScalingWithFixedColumnWidthsOptionEnabled &&
353
+ fg('platform.editor.table.use-increased-scaling-percent')) ||
354
+ (isTableScalingEnabled && isCommentEditor);
350
355
 
351
356
  if (isTableScalingWithFixedColumnWidthsOptionEnabled) {
352
357
  shouldScale = shouldScale && originalTable.attrs.displayMode !== 'fixed';
@@ -24,6 +24,7 @@ export function createPlugin(
24
24
  isTableScalingEnabled?: boolean,
25
25
  isNewColumnResizingEnabled?: boolean,
26
26
  isTableAlignmentEnabled?: boolean,
27
+ isCommentEditor?: boolean,
27
28
  ) {
28
29
  return new SafePlugin({
29
30
  key: pluginKey,
@@ -76,6 +77,7 @@ export function createPlugin(
76
77
  editorAnalyticsAPI,
77
78
  isNewColumnResizingEnabled,
78
79
  isTableAlignmentEnabled,
80
+ isCommentEditor,
79
81
  )
80
82
  ) {
81
83
  const { state, dispatch } = view;
@@ -5,7 +5,7 @@ import { calcTableColumnWidths } from '@atlaskit/editor-common/utils';
5
5
  import type { Node as PMNode } from '@atlaskit/editor-prosemirror/model';
6
6
  import type { EditorState } from '@atlaskit/editor-prosemirror/state';
7
7
  import type { Rect } from '@atlaskit/editor-tables/table-map';
8
- import { getBooleanFF } from '@atlaskit/platform-feature-flags';
8
+ import { fg } from '@atlaskit/platform-feature-flags';
9
9
 
10
10
  import { getSelectedTableInfo } from '../../../utils';
11
11
 
@@ -326,6 +326,7 @@ export const getNewResizeStateFromSelectedColumns = (
326
326
  getEditorContainerWidth: GetEditorContainerWidth,
327
327
  isTableScalingEnabled = false,
328
328
  isTableFixedColumnWidthsOptionEnabled = false,
329
+ isCommentEditor = false,
329
330
  ): ResizeStateWithAnalytics | undefined => {
330
331
  // Fail early so that we don't do complex calculations for no reason
331
332
  const numColumnsSelected = rect.right - rect.left;
@@ -381,8 +382,9 @@ export const getNewResizeStateFromSelectedColumns = (
381
382
  domAtPos,
382
383
  isTableScalingEnabled: isTableScalingEnabledOnCurrentTable,
383
384
  shouldUseIncreasedScalingPercent:
384
- isTableScalingWithFixedColumnWidthsOptionEnabled &&
385
- getBooleanFF('platform.editor.table.use-increased-scaling-percent'),
385
+ (isTableScalingWithFixedColumnWidthsOptionEnabled &&
386
+ fg('platform.editor.table.use-increased-scaling-percent')) ||
387
+ (isTableScalingEnabled && isCommentEditor),
386
388
  });
387
389
 
388
390
  const newResizeState = evenSelectedColumnsWidths(resizeState, rect);
@@ -4,7 +4,7 @@ import type { Node as PMNode } from '@atlaskit/editor-prosemirror/model';
4
4
  import type { Transaction } from '@atlaskit/editor-prosemirror/state';
5
5
  import type { DomAtPos } from '@atlaskit/editor-prosemirror/utils';
6
6
  import { akEditorTableNumberColumnWidth } from '@atlaskit/editor-shared-styles';
7
- import { getBooleanFF } from '@atlaskit/platform-feature-flags';
7
+ import { fg } from '@atlaskit/platform-feature-flags';
8
8
 
9
9
  import { updateColumnWidths } from '../../../transforms';
10
10
  import { getTableWidth } from '../../../utils';
@@ -154,6 +154,7 @@ export const previewScaleTable = (
154
154
  domAtPos: DomAtPos,
155
155
  isTableScalingEnabled: boolean = false,
156
156
  isTableWithFixedColumnWidthsOptionEnabled: boolean = false,
157
+ isCommentEditor: boolean = false,
157
158
  ) => {
158
159
  const { node, start, parentWidth } = options;
159
160
 
@@ -185,8 +186,10 @@ export const previewScaleTable = (
185
186
  }
186
187
 
187
188
  const shouldUseIncreasedScalingPercent =
188
- isTableScalingWithFixedColumnWidthsOptionEnabled &&
189
- getBooleanFF('platform.editor.table.use-increased-scaling-percent');
189
+ (isTableScalingWithFixedColumnWidthsOptionEnabled &&
190
+ fg('platform.editor.table.use-increased-scaling-percent')) ||
191
+ // When in comment editor, we need the scaling percent to be 40% while tableWithFixedColumnWidthsOption is not visible
192
+ (isTableScalingEnabled && isCommentEditor);
190
193
 
191
194
  const resizeState = parentWidth
192
195
  ? scaleWithParent(