@atlaskit/editor-plugin-table 22.4.7 → 22.4.9

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 (124) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/dist/cjs/pm-plugins/commands/split-cell.js +18 -1
  3. package/dist/cjs/pm-plugins/transforms/merge.js +5 -2
  4. package/dist/cjs/ui/FloatingContextualButton/index.js +5 -0
  5. package/dist/cjs/ui/FloatingContextualMenu/CellMenuPopup.js +104 -0
  6. package/dist/cjs/ui/FloatingContextualMenu/index.js +13 -2
  7. package/dist/cjs/ui/FloatingDragMenu/index.js +7 -2
  8. package/dist/cjs/ui/TableMenu/cell/getCellMenuComponents.js +70 -0
  9. package/dist/cjs/ui/TableMenu/cell/items/MergeCellsItem.js +33 -0
  10. package/dist/cjs/ui/TableMenu/cell/items/SplitCellItem.js +33 -0
  11. package/dist/cjs/ui/TableMenu/cell/keys.js +40 -0
  12. package/dist/cjs/ui/TableMenu/column/getColumnMenuComponents.js +4 -11
  13. package/dist/cjs/ui/TableMenu/column/items/ColumnBackgroundSection.js +25 -0
  14. package/dist/cjs/ui/TableMenu/column/items/ColumnToggleSection.js +24 -0
  15. package/dist/cjs/ui/TableMenu/column/items/DistributeColumnsItem.js +10 -0
  16. package/dist/cjs/ui/TableMenu/column/items/HeaderColumnToggleItem.js +17 -1
  17. package/dist/cjs/ui/TableMenu/column/items/MoveColumnRightItem.js +2 -6
  18. package/dist/cjs/ui/TableMenu/column/items/SortDecreasingItem.js +3 -1
  19. package/dist/cjs/ui/TableMenu/column/items/SortIncreasingItem.js +3 -1
  20. package/dist/cjs/ui/TableMenu/row/getRowMenuComponents.js +0 -7
  21. package/dist/cjs/ui/TableMenu/row/items/HeaderRowToggleItem.js +9 -0
  22. package/dist/cjs/ui/TableMenu/row/items/MoveRowDownItem.js +10 -0
  23. package/dist/cjs/ui/TableMenu/row/items/MoveRowUpItem.js +10 -0
  24. package/dist/cjs/ui/TableMenu/shared/TableMenu.js +53 -3
  25. package/dist/cjs/ui/TableMenu/shared/TableMenuContext.js +13 -0
  26. package/dist/cjs/ui/TableMenu/shared/consts.js +3 -2
  27. package/dist/cjs/ui/TableMenu/shared/getSharedItems.js +28 -19
  28. package/dist/cjs/ui/TableMenu/shared/getTableMenuComponents.js +2 -1
  29. package/dist/cjs/ui/event-handlers.js +6 -1
  30. package/dist/es2019/pm-plugins/commands/split-cell.js +17 -1
  31. package/dist/es2019/pm-plugins/transforms/merge.js +4 -4
  32. package/dist/es2019/ui/FloatingContextualButton/index.js +5 -0
  33. package/dist/es2019/ui/FloatingContextualMenu/CellMenuPopup.js +100 -0
  34. package/dist/es2019/ui/FloatingContextualMenu/index.js +13 -3
  35. package/dist/es2019/ui/FloatingDragMenu/index.js +7 -2
  36. package/dist/es2019/ui/TableMenu/cell/getCellMenuComponents.js +53 -0
  37. package/dist/es2019/ui/TableMenu/cell/items/MergeCellsItem.js +26 -0
  38. package/dist/es2019/ui/TableMenu/cell/items/SplitCellItem.js +26 -0
  39. package/dist/es2019/ui/TableMenu/cell/keys.js +42 -0
  40. package/dist/es2019/ui/TableMenu/column/getColumnMenuComponents.js +4 -12
  41. package/dist/es2019/ui/TableMenu/column/items/ColumnBackgroundSection.js +20 -0
  42. package/dist/es2019/ui/TableMenu/column/items/ColumnToggleSection.js +19 -0
  43. package/dist/es2019/ui/TableMenu/column/items/DistributeColumnsItem.js +11 -0
  44. package/dist/es2019/ui/TableMenu/column/items/HeaderColumnToggleItem.js +15 -0
  45. package/dist/es2019/ui/TableMenu/column/items/MoveColumnRightItem.js +3 -5
  46. package/dist/es2019/ui/TableMenu/column/items/SortDecreasingItem.js +3 -1
  47. package/dist/es2019/ui/TableMenu/column/items/SortIncreasingItem.js +3 -1
  48. package/dist/es2019/ui/TableMenu/row/getRowMenuComponents.js +0 -8
  49. package/dist/es2019/ui/TableMenu/row/items/HeaderRowToggleItem.js +8 -0
  50. package/dist/es2019/ui/TableMenu/row/items/MoveRowDownItem.js +8 -0
  51. package/dist/es2019/ui/TableMenu/row/items/MoveRowUpItem.js +8 -0
  52. package/dist/es2019/ui/TableMenu/shared/TableMenu.js +51 -3
  53. package/dist/es2019/ui/TableMenu/shared/TableMenuContext.js +4 -0
  54. package/dist/es2019/ui/TableMenu/shared/consts.js +2 -1
  55. package/dist/es2019/ui/TableMenu/shared/getSharedItems.js +9 -0
  56. package/dist/es2019/ui/TableMenu/shared/getTableMenuComponents.js +2 -1
  57. package/dist/es2019/ui/event-handlers.js +4 -1
  58. package/dist/esm/pm-plugins/commands/split-cell.js +17 -1
  59. package/dist/esm/pm-plugins/transforms/merge.js +4 -2
  60. package/dist/esm/ui/FloatingContextualButton/index.js +5 -0
  61. package/dist/esm/ui/FloatingContextualMenu/CellMenuPopup.js +96 -0
  62. package/dist/esm/ui/FloatingContextualMenu/index.js +13 -3
  63. package/dist/esm/ui/FloatingDragMenu/index.js +7 -2
  64. package/dist/esm/ui/TableMenu/cell/getCellMenuComponents.js +63 -0
  65. package/dist/esm/ui/TableMenu/cell/items/MergeCellsItem.js +27 -0
  66. package/dist/esm/ui/TableMenu/cell/items/SplitCellItem.js +27 -0
  67. package/dist/esm/ui/TableMenu/cell/keys.js +34 -0
  68. package/dist/esm/ui/TableMenu/column/getColumnMenuComponents.js +4 -12
  69. package/dist/esm/ui/TableMenu/column/items/ColumnBackgroundSection.js +19 -0
  70. package/dist/esm/ui/TableMenu/column/items/ColumnToggleSection.js +18 -0
  71. package/dist/esm/ui/TableMenu/column/items/DistributeColumnsItem.js +11 -0
  72. package/dist/esm/ui/TableMenu/column/items/HeaderColumnToggleItem.js +17 -0
  73. package/dist/esm/ui/TableMenu/column/items/MoveColumnRightItem.js +3 -7
  74. package/dist/esm/ui/TableMenu/column/items/SortDecreasingItem.js +3 -1
  75. package/dist/esm/ui/TableMenu/column/items/SortIncreasingItem.js +3 -1
  76. package/dist/esm/ui/TableMenu/row/getRowMenuComponents.js +0 -8
  77. package/dist/esm/ui/TableMenu/row/items/HeaderRowToggleItem.js +10 -0
  78. package/dist/esm/ui/TableMenu/row/items/MoveRowDownItem.js +10 -0
  79. package/dist/esm/ui/TableMenu/row/items/MoveRowUpItem.js +10 -0
  80. package/dist/esm/ui/TableMenu/shared/TableMenu.js +52 -3
  81. package/dist/esm/ui/TableMenu/shared/TableMenuContext.js +6 -0
  82. package/dist/esm/ui/TableMenu/shared/consts.js +2 -1
  83. package/dist/esm/ui/TableMenu/shared/getSharedItems.js +9 -0
  84. package/dist/esm/ui/TableMenu/shared/getTableMenuComponents.js +2 -1
  85. package/dist/esm/ui/event-handlers.js +6 -1
  86. package/dist/types/pm-plugins/commands/split-cell.d.ts +2 -0
  87. package/dist/types/pm-plugins/transforms/merge.d.ts +2 -0
  88. package/dist/types/ui/FloatingContextualMenu/CellMenuPopup.d.ts +12 -0
  89. package/dist/types/ui/TableMenu/cell/getCellMenuComponents.d.ts +2 -0
  90. package/dist/types/ui/TableMenu/cell/items/MergeCellsItem.d.ts +2 -0
  91. package/dist/types/ui/TableMenu/cell/items/SplitCellItem.d.ts +2 -0
  92. package/dist/types/ui/TableMenu/cell/keys.d.ts +9 -0
  93. package/dist/types/ui/TableMenu/column/getColumnMenuComponents.d.ts +0 -7
  94. package/dist/types/ui/TableMenu/column/items/ColumnBackgroundSection.d.ts +10 -0
  95. package/dist/types/ui/TableMenu/column/items/ColumnToggleSection.d.ts +9 -0
  96. package/dist/types/ui/TableMenu/column/items/DistributeColumnsItem.d.ts +1 -1
  97. package/dist/types/ui/TableMenu/column/items/HeaderColumnToggleItem.d.ts +11 -1
  98. package/dist/types/ui/TableMenu/row/getRowMenuComponents.d.ts +0 -7
  99. package/dist/types/ui/TableMenu/row/items/HeaderRowToggleItem.d.ts +1 -1
  100. package/dist/types/ui/TableMenu/row/items/MoveRowDownItem.d.ts +1 -1
  101. package/dist/types/ui/TableMenu/row/items/MoveRowUpItem.d.ts +1 -1
  102. package/dist/types/ui/TableMenu/shared/TableMenu.d.ts +3 -1
  103. package/dist/types/ui/TableMenu/shared/TableMenuContext.d.ts +14 -0
  104. package/dist/types/ui/TableMenu/shared/consts.d.ts +1 -0
  105. package/dist/types-ts4.5/pm-plugins/commands/split-cell.d.ts +2 -0
  106. package/dist/types-ts4.5/pm-plugins/transforms/merge.d.ts +2 -0
  107. package/dist/types-ts4.5/ui/FloatingContextualMenu/CellMenuPopup.d.ts +12 -0
  108. package/dist/types-ts4.5/ui/TableMenu/cell/getCellMenuComponents.d.ts +2 -0
  109. package/dist/types-ts4.5/ui/TableMenu/cell/items/MergeCellsItem.d.ts +2 -0
  110. package/dist/types-ts4.5/ui/TableMenu/cell/items/SplitCellItem.d.ts +2 -0
  111. package/dist/types-ts4.5/ui/TableMenu/cell/keys.d.ts +9 -0
  112. package/dist/types-ts4.5/ui/TableMenu/column/getColumnMenuComponents.d.ts +0 -7
  113. package/dist/types-ts4.5/ui/TableMenu/column/items/ColumnBackgroundSection.d.ts +10 -0
  114. package/dist/types-ts4.5/ui/TableMenu/column/items/ColumnToggleSection.d.ts +9 -0
  115. package/dist/types-ts4.5/ui/TableMenu/column/items/DistributeColumnsItem.d.ts +1 -1
  116. package/dist/types-ts4.5/ui/TableMenu/column/items/HeaderColumnToggleItem.d.ts +11 -1
  117. package/dist/types-ts4.5/ui/TableMenu/row/getRowMenuComponents.d.ts +0 -7
  118. package/dist/types-ts4.5/ui/TableMenu/row/items/HeaderRowToggleItem.d.ts +1 -1
  119. package/dist/types-ts4.5/ui/TableMenu/row/items/MoveRowDownItem.d.ts +1 -1
  120. package/dist/types-ts4.5/ui/TableMenu/row/items/MoveRowUpItem.d.ts +1 -1
  121. package/dist/types-ts4.5/ui/TableMenu/shared/TableMenu.d.ts +3 -1
  122. package/dist/types-ts4.5/ui/TableMenu/shared/TableMenuContext.d.ts +14 -0
  123. package/dist/types-ts4.5/ui/TableMenu/shared/consts.d.ts +1 -0
  124. package/package.json +5 -5
@@ -9,6 +9,7 @@ import { findParentNodeOfTypeClosestToPos } from '@atlaskit/editor-prosemirror/u
9
9
  import { CellSelection } from '@atlaskit/editor-tables/cell-selection';
10
10
  import { TableMap } from '@atlaskit/editor-tables/table-map';
11
11
  import { cellAround, findCellRectClosestToPos, findTable, getSelectionRect, removeTable } from '@atlaskit/editor-tables/utils';
12
+ import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
12
13
  import { addResizeHandleDecorations, clearHoverSelection, hideInsertColumnOrRowButton, hideResizeHandleLine, hoverCell, hoverColumns, selectColumn, setEditorFocus, setTableHovered, showInsertColumnButton, showInsertRowButton, showResizeHandleLine } from '../pm-plugins/commands';
13
14
  import { getPluginState as getDragDropPluginState } from '../pm-plugins/drag-and-drop/plugin-factory';
14
15
  import { getPluginState } from '../pm-plugins/plugin-factory';
@@ -20,6 +21,7 @@ import { convertHTMLCellIndexToColumnIndex, getColumnIndexMappedToColumnIndexInF
20
21
  import { getColumnOrRowIndex, getMousePositionHorizontalRelativeByElement, getMousePositionVerticalRelativeByElement, hasResizeHandler, isCell, isColumnControlsDecorations, isCornerButton, isDragColumnFloatingInsertDot, isDragCornerButton, isDragRowFloatingInsertDot, isInsertRowButton, isResizeHandleDecoration, isRowControlsButton, isTableContainerOrWrapper, isTableControlsButton } from '../pm-plugins/utils/dom';
21
22
  import { getAllowAddColumnCustomStep } from '../pm-plugins/utils/get-allow-add-column-custom-step';
22
23
  import { TableCssClassName as ClassName, RESIZE_HANDLE_AREA_DECORATION_GAP } from '../types';
24
+ import { TABLE_MENU_SELECTOR } from './TableMenu/shared/consts';
23
25
  var isFocusingCalendar = function isFocusingCalendar(event) {
24
26
  return event instanceof FocusEvent && event.relatedTarget instanceof HTMLElement && event.relatedTarget.getAttribute('aria-label') === 'calendar';
25
27
  };
@@ -35,12 +37,15 @@ var isFocusingDragHandles = function isFocusingDragHandles(event) {
35
37
  var isFocusingDragHandlesClickableZone = function isFocusingDragHandlesClickableZone(event) {
36
38
  return event instanceof FocusEvent && event.relatedTarget instanceof HTMLElement && event.relatedTarget.closest('button') && event.relatedTarget.classList.contains(ClassName.DRAG_HANDLE_BUTTON_CLICKABLE_ZONE);
37
39
  };
40
+ var isFocusingTableMenu = function isFocusingTableMenu(event) {
41
+ return expValEquals('platform_editor_table_menu_updates', 'isEnabled', true) && event instanceof FocusEvent && event.relatedTarget instanceof HTMLElement && Boolean(event.relatedTarget.closest(TABLE_MENU_SELECTOR));
42
+ };
38
43
  export var handleBlur = function handleBlur(view, event) {
39
44
  var state = view.state,
40
45
  dispatch = view.dispatch;
41
46
  // IE version check for ED-4665
42
47
  // Calendar focus check for ED-10466
43
- if (getBrowserInfo().ie_version !== 11 && !isFocusingCalendar(event) && !isFocusingModal(event) && !isFocusingFloatingToolbar(event) && !isFocusingDragHandles(event) && !isFocusingDragHandlesClickableZone(event)) {
48
+ if (getBrowserInfo().ie_version !== 11 && !isFocusingCalendar(event) && !isFocusingModal(event) && !isFocusingFloatingToolbar(event) && !isFocusingDragHandles(event) && !isFocusingDragHandlesClickableZone(event) && !isFocusingTableMenu(event)) {
44
49
  setEditorFocus(false)(state, dispatch);
45
50
  }
46
51
  event.preventDefault();
@@ -1,4 +1,6 @@
1
1
  import type { Command } from '@atlaskit/editor-common/types';
2
+ import type { Selection } from '@atlaskit/editor-prosemirror/state';
3
+ export declare const canSplitCellSelection: (selection: Selection) => boolean;
2
4
  /**
3
5
  * We need to split cell keeping the right type of cell given current table configuration.
4
6
  * We are using editor-tables splitCellWithType that allows you to choose what cell type should be.
@@ -1,5 +1,7 @@
1
1
  import type { Node as PMNode } from '@atlaskit/editor-prosemirror/model';
2
2
  import type { Transaction } from '@atlaskit/editor-prosemirror/state';
3
+ import { Selection } from '@atlaskit/editor-prosemirror/state';
3
4
  export declare function mergeCells(tr: Transaction): Transaction;
5
+ export declare function canMergeCellSelection(selection: Selection): boolean;
4
6
  export declare function canMergeCells(tr: Transaction): boolean;
5
7
  export declare function mergeEmptyColumns(table: PMNode): PMNode | null;
@@ -0,0 +1,12 @@
1
+ import React from 'react';
2
+ import type { EditorView } from '@atlaskit/editor-prosemirror/view';
3
+ import type { PluginInjectionAPI } from '../../types';
4
+ type CellMenuPopupProps = {
5
+ api: PluginInjectionAPI | undefined | null;
6
+ editorView: EditorView;
7
+ isCellMenuOpenByKeyboard?: boolean;
8
+ isOpen: boolean;
9
+ targetCellRef: Node;
10
+ };
11
+ export declare const CellMenuPopup: ({ api, editorView, isCellMenuOpenByKeyboard, isOpen, targetCellRef, }: CellMenuPopupProps) => React.JSX.Element;
12
+ export {};
@@ -0,0 +1,2 @@
1
+ import type { RegisterComponent } from '@atlaskit/editor-ui-control-model';
2
+ export declare const getCellMenuComponents: () => RegisterComponent[];
@@ -0,0 +1,2 @@
1
+ import React from 'react';
2
+ export declare const MergeCellsItem: () => React.JSX.Element | null;
@@ -0,0 +1,2 @@
1
+ import React from 'react';
2
+ export declare const SplitCellItem: () => React.JSX.Element | null;
@@ -0,0 +1,9 @@
1
+ import type { MenuItemType, MenuSectionType, MenuType } from '@atlaskit/editor-ui-control-model';
2
+ export declare const CELL_MENU: MenuType;
3
+ export declare const CELL_ACTION_SECTION: MenuSectionType;
4
+ export declare const CELL_DANGER_SECTION: MenuSectionType;
5
+ export declare const CELL_MENU_RANK: Record<string, number>;
6
+ export declare const MERGE_CELLS_ITEM: MenuItemType;
7
+ export declare const SPLIT_CELL_ITEM: MenuItemType;
8
+ export declare const CELL_ACTION_SECTION_RANK: Record<string, number>;
9
+ export declare const CELL_DANGER_SECTION_RANK: Record<string, number>;
@@ -1,9 +1,2 @@
1
1
  import type { RegisterComponent } from '@atlaskit/editor-ui-control-model';
2
- /**
3
- * Returns the RegisterComponent[] array defining the column menu surface.
4
- *
5
- * This is a **UI-only stub** — all items are always visible with no conditional
6
- * logic and no wired actions. Functional behaviour (actions, conditional visibility)
7
- * will be connected in follow-up tickets.
8
- */
9
2
  export declare const getColumnMenuComponents: () => RegisterComponent[];
@@ -0,0 +1,10 @@
1
+ import React from 'react';
2
+ /**
3
+ * Background section sits directly below `ColumnToggleSection`. Its separator
4
+ * exists only to divide it from the toggle section; when the toggle section
5
+ * is hidden, the separator must drop too so we don't render a stray rule at
6
+ * the very top of the menu.
7
+ */
8
+ export declare const ColumnBackgroundSection: ({ children, }: {
9
+ children?: React.ReactNode;
10
+ }) => React.JSX.Element;
@@ -0,0 +1,9 @@
1
+ import React from 'react';
2
+ /**
3
+ * The toggle section currently contains only the Header column toggle. When
4
+ * that item is hidden, the whole section disappears so we don't render an
5
+ * empty wrapper (and so the section below can drop its leading separator).
6
+ */
7
+ export declare const ColumnToggleSection: ({ children, }: {
8
+ children?: React.ReactNode;
9
+ }) => React.JSX.Element | null;
@@ -1,2 +1,2 @@
1
1
  import React from 'react';
2
- export declare const DistributeColumnsItem: () => React.JSX.Element;
2
+ export declare const DistributeColumnsItem: () => React.JSX.Element | null;
@@ -1,2 +1,12 @@
1
1
  import React from 'react';
2
- export declare const HeaderColumnToggleItem: () => React.JSX.Element;
2
+ import { type TableMenuContextValue } from '../../shared/TableMenuContext';
3
+ /**
4
+ * Header column toggle is only visible when the first column is the entire
5
+ * selection.
6
+ *
7
+ * Exported so `ColumnToggleSection` (which can become empty) and
8
+ * `ColumnBackgroundSection` (which drops its leading separator alongside)
9
+ * can stay in lockstep with this rule without redefining it.
10
+ */
11
+ export declare const shouldShowHeaderColumnToggle: (tableMenuContext?: TableMenuContextValue) => boolean;
12
+ export declare const HeaderColumnToggleItem: () => React.JSX.Element | null;
@@ -1,9 +1,2 @@
1
1
  import type { RegisterComponent } from '@atlaskit/editor-ui-control-model';
2
- /**
3
- * Returns the RegisterComponent[] array defining the row menu surface.
4
- *
5
- * This is a **UI-only stub** — all items are always visible with no conditional
6
- * logic and no wired actions. Functional behaviour (actions, conditional visibility)
7
- * will be connected in follow-up tickets.
8
- */
9
2
  export declare const getRowMenuComponents: () => RegisterComponent[];
@@ -1,2 +1,2 @@
1
1
  import React from 'react';
2
- export declare const HeaderRowToggleItem: () => React.JSX.Element;
2
+ export declare const HeaderRowToggleItem: () => React.JSX.Element | null;
@@ -1,2 +1,2 @@
1
1
  import React from 'react';
2
- export declare const MoveRowDownItem: () => React.JSX.Element;
2
+ export declare const MoveRowDownItem: () => React.JSX.Element | null;
@@ -1,2 +1,2 @@
1
1
  import React from 'react';
2
- export declare const MoveRowUpItem: () => React.JSX.Element;
2
+ export declare const MoveRowUpItem: () => React.JSX.Element | null;
@@ -1,9 +1,11 @@
1
1
  import React from 'react';
2
+ import type { EditorView } from '@atlaskit/editor-prosemirror/view';
2
3
  import type { MenuType } from '@atlaskit/editor-ui-control-model';
3
4
  import type { PluginInjectionAPI } from '../../../types';
4
5
  type TableMenuProps = {
5
6
  api: PluginInjectionAPI | undefined | null;
7
+ editorView?: EditorView;
6
8
  surface: MenuType;
7
9
  };
8
- export declare const TableMenu: React.MemoExoticComponent<(props: TableMenuProps) => React.JSX.Element | null>;
10
+ export declare const TableMenu: React.NamedExoticComponent<TableMenuProps>;
9
11
  export {};
@@ -0,0 +1,14 @@
1
+ import React from 'react';
2
+ export type TableMenuContextValue = {
3
+ canMergeCells?: boolean;
4
+ canSplitCell?: boolean;
5
+ hasMergedCellsInTable?: boolean;
6
+ isFirstColumn?: boolean;
7
+ isFirstRow?: boolean;
8
+ isLastColumn?: boolean;
9
+ isLastRow?: boolean;
10
+ selectedColumnCount?: number;
11
+ selectedRowCount?: number;
12
+ };
13
+ export declare const TableMenuProvider: React.Provider<TableMenuContextValue | undefined>;
14
+ export declare const useTableMenuContext: () => TableMenuContextValue | undefined;
@@ -1 +1,2 @@
1
1
  export declare const TABLE_MENU_WIDTH = 280;
2
+ export declare const TABLE_MENU_SELECTOR = "[data-testid=\"column-handle-menu\"], [data-testid=\"row-handle-menu\"], [data-toolbar-nested-dropdown-menu]";
@@ -1,4 +1,6 @@
1
1
  import type { Command } from '@atlaskit/editor-common/types';
2
+ import type { Selection } from '@atlaskit/editor-prosemirror/state';
3
+ export declare const canSplitCellSelection: (selection: Selection) => boolean;
2
4
  /**
3
5
  * We need to split cell keeping the right type of cell given current table configuration.
4
6
  * We are using editor-tables splitCellWithType that allows you to choose what cell type should be.
@@ -1,5 +1,7 @@
1
1
  import type { Node as PMNode } from '@atlaskit/editor-prosemirror/model';
2
2
  import type { Transaction } from '@atlaskit/editor-prosemirror/state';
3
+ import { Selection } from '@atlaskit/editor-prosemirror/state';
3
4
  export declare function mergeCells(tr: Transaction): Transaction;
5
+ export declare function canMergeCellSelection(selection: Selection): boolean;
4
6
  export declare function canMergeCells(tr: Transaction): boolean;
5
7
  export declare function mergeEmptyColumns(table: PMNode): PMNode | null;
@@ -0,0 +1,12 @@
1
+ import React from 'react';
2
+ import type { EditorView } from '@atlaskit/editor-prosemirror/view';
3
+ import type { PluginInjectionAPI } from '../../types';
4
+ type CellMenuPopupProps = {
5
+ api: PluginInjectionAPI | undefined | null;
6
+ editorView: EditorView;
7
+ isCellMenuOpenByKeyboard?: boolean;
8
+ isOpen: boolean;
9
+ targetCellRef: Node;
10
+ };
11
+ export declare const CellMenuPopup: ({ api, editorView, isCellMenuOpenByKeyboard, isOpen, targetCellRef, }: CellMenuPopupProps) => React.JSX.Element;
12
+ export {};
@@ -0,0 +1,2 @@
1
+ import type { RegisterComponent } from '@atlaskit/editor-ui-control-model';
2
+ export declare const getCellMenuComponents: () => RegisterComponent[];
@@ -0,0 +1,2 @@
1
+ import React from 'react';
2
+ export declare const MergeCellsItem: () => React.JSX.Element | null;
@@ -0,0 +1,2 @@
1
+ import React from 'react';
2
+ export declare const SplitCellItem: () => React.JSX.Element | null;
@@ -0,0 +1,9 @@
1
+ import type { MenuItemType, MenuSectionType, MenuType } from '@atlaskit/editor-ui-control-model';
2
+ export declare const CELL_MENU: MenuType;
3
+ export declare const CELL_ACTION_SECTION: MenuSectionType;
4
+ export declare const CELL_DANGER_SECTION: MenuSectionType;
5
+ export declare const CELL_MENU_RANK: Record<string, number>;
6
+ export declare const MERGE_CELLS_ITEM: MenuItemType;
7
+ export declare const SPLIT_CELL_ITEM: MenuItemType;
8
+ export declare const CELL_ACTION_SECTION_RANK: Record<string, number>;
9
+ export declare const CELL_DANGER_SECTION_RANK: Record<string, number>;
@@ -1,9 +1,2 @@
1
1
  import type { RegisterComponent } from '@atlaskit/editor-ui-control-model';
2
- /**
3
- * Returns the RegisterComponent[] array defining the column menu surface.
4
- *
5
- * This is a **UI-only stub** — all items are always visible with no conditional
6
- * logic and no wired actions. Functional behaviour (actions, conditional visibility)
7
- * will be connected in follow-up tickets.
8
- */
9
2
  export declare const getColumnMenuComponents: () => RegisterComponent[];
@@ -0,0 +1,10 @@
1
+ import React from 'react';
2
+ /**
3
+ * Background section sits directly below `ColumnToggleSection`. Its separator
4
+ * exists only to divide it from the toggle section; when the toggle section
5
+ * is hidden, the separator must drop too so we don't render a stray rule at
6
+ * the very top of the menu.
7
+ */
8
+ export declare const ColumnBackgroundSection: ({ children, }: {
9
+ children?: React.ReactNode;
10
+ }) => React.JSX.Element;
@@ -0,0 +1,9 @@
1
+ import React from 'react';
2
+ /**
3
+ * The toggle section currently contains only the Header column toggle. When
4
+ * that item is hidden, the whole section disappears so we don't render an
5
+ * empty wrapper (and so the section below can drop its leading separator).
6
+ */
7
+ export declare const ColumnToggleSection: ({ children, }: {
8
+ children?: React.ReactNode;
9
+ }) => React.JSX.Element | null;
@@ -1,2 +1,2 @@
1
1
  import React from 'react';
2
- export declare const DistributeColumnsItem: () => React.JSX.Element;
2
+ export declare const DistributeColumnsItem: () => React.JSX.Element | null;
@@ -1,2 +1,12 @@
1
1
  import React from 'react';
2
- export declare const HeaderColumnToggleItem: () => React.JSX.Element;
2
+ import { type TableMenuContextValue } from '../../shared/TableMenuContext';
3
+ /**
4
+ * Header column toggle is only visible when the first column is the entire
5
+ * selection.
6
+ *
7
+ * Exported so `ColumnToggleSection` (which can become empty) and
8
+ * `ColumnBackgroundSection` (which drops its leading separator alongside)
9
+ * can stay in lockstep with this rule without redefining it.
10
+ */
11
+ export declare const shouldShowHeaderColumnToggle: (tableMenuContext?: TableMenuContextValue) => boolean;
12
+ export declare const HeaderColumnToggleItem: () => React.JSX.Element | null;
@@ -1,9 +1,2 @@
1
1
  import type { RegisterComponent } from '@atlaskit/editor-ui-control-model';
2
- /**
3
- * Returns the RegisterComponent[] array defining the row menu surface.
4
- *
5
- * This is a **UI-only stub** — all items are always visible with no conditional
6
- * logic and no wired actions. Functional behaviour (actions, conditional visibility)
7
- * will be connected in follow-up tickets.
8
- */
9
2
  export declare const getRowMenuComponents: () => RegisterComponent[];
@@ -1,2 +1,2 @@
1
1
  import React from 'react';
2
- export declare const HeaderRowToggleItem: () => React.JSX.Element;
2
+ export declare const HeaderRowToggleItem: () => React.JSX.Element | null;
@@ -1,2 +1,2 @@
1
1
  import React from 'react';
2
- export declare const MoveRowDownItem: () => React.JSX.Element;
2
+ export declare const MoveRowDownItem: () => React.JSX.Element | null;
@@ -1,2 +1,2 @@
1
1
  import React from 'react';
2
- export declare const MoveRowUpItem: () => React.JSX.Element;
2
+ export declare const MoveRowUpItem: () => React.JSX.Element | null;
@@ -1,9 +1,11 @@
1
1
  import React from 'react';
2
+ import type { EditorView } from '@atlaskit/editor-prosemirror/view';
2
3
  import type { MenuType } from '@atlaskit/editor-ui-control-model';
3
4
  import type { PluginInjectionAPI } from '../../../types';
4
5
  type TableMenuProps = {
5
6
  api: PluginInjectionAPI | undefined | null;
7
+ editorView?: EditorView;
6
8
  surface: MenuType;
7
9
  };
8
- export declare const TableMenu: React.MemoExoticComponent<(props: TableMenuProps) => React.JSX.Element | null>;
10
+ export declare const TableMenu: React.NamedExoticComponent<TableMenuProps>;
9
11
  export {};
@@ -0,0 +1,14 @@
1
+ import React from 'react';
2
+ export type TableMenuContextValue = {
3
+ canMergeCells?: boolean;
4
+ canSplitCell?: boolean;
5
+ hasMergedCellsInTable?: boolean;
6
+ isFirstColumn?: boolean;
7
+ isFirstRow?: boolean;
8
+ isLastColumn?: boolean;
9
+ isLastRow?: boolean;
10
+ selectedColumnCount?: number;
11
+ selectedRowCount?: number;
12
+ };
13
+ export declare const TableMenuProvider: React.Provider<TableMenuContextValue | undefined>;
14
+ export declare const useTableMenuContext: () => TableMenuContextValue | undefined;
@@ -1 +1,2 @@
1
1
  export declare const TABLE_MENU_WIDTH = 280;
2
+ export declare const TABLE_MENU_SELECTOR = "[data-testid=\"column-handle-menu\"], [data-testid=\"row-handle-menu\"], [data-toolbar-nested-dropdown-menu]";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-table",
3
- "version": "22.4.7",
3
+ "version": "22.4.9",
4
4
  "description": "Table plugin for the @atlaskit/editor",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -28,7 +28,7 @@
28
28
  "singleton": true
29
29
  },
30
30
  "dependencies": {
31
- "@atlaskit/adf-schema": "^52.11.0",
31
+ "@atlaskit/adf-schema": "^52.12.0",
32
32
  "@atlaskit/button": "^23.11.0",
33
33
  "@atlaskit/custom-steps": "^0.17.0",
34
34
  "@atlaskit/editor-palette": "^2.2.0",
@@ -49,7 +49,7 @@
49
49
  "@atlaskit/editor-prosemirror": "^7.3.0",
50
50
  "@atlaskit/editor-shared-styles": "^3.11.0",
51
51
  "@atlaskit/editor-tables": "^2.10.0",
52
- "@atlaskit/editor-toolbar": "^1.5.0",
52
+ "@atlaskit/editor-toolbar": "^1.6.0",
53
53
  "@atlaskit/editor-ui-control-model": "^1.2.0",
54
54
  "@atlaskit/icon": "^35.0.0",
55
55
  "@atlaskit/insm": "^0.4.0",
@@ -59,7 +59,7 @@
59
59
  "@atlaskit/pragmatic-drag-and-drop-auto-scroll": "^2.1.0",
60
60
  "@atlaskit/pragmatic-drag-and-drop-hitbox": "^1.1.0",
61
61
  "@atlaskit/primitives": "^19.0.0",
62
- "@atlaskit/tmp-editor-statsig": "^81.1.0",
62
+ "@atlaskit/tmp-editor-statsig": "^81.2.0",
63
63
  "@atlaskit/toggle": "^15.6.0",
64
64
  "@atlaskit/tokens": "^13.0.0",
65
65
  "@atlaskit/tooltip": "^22.2.0",
@@ -74,7 +74,7 @@
74
74
  "uuid": "^3.1.0"
75
75
  },
76
76
  "peerDependencies": {
77
- "@atlaskit/editor-common": "^114.35.0",
77
+ "@atlaskit/editor-common": "^114.36.0",
78
78
  "react": "^18.2.0",
79
79
  "react-dom": "^18.2.0",
80
80
  "react-intl": "^5.25.1 || ^6.0.0 || ^7.0.0"