@atlaskit/editor-plugin-table 22.4.14 → 22.4.16

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 (213) hide show
  1. package/CHANGELOG.md +17 -0
  2. package/dist/cjs/nodeviews/TableComponent.js +2 -2
  3. package/dist/cjs/nodeviews/table.js +2 -2
  4. package/dist/cjs/nodeviews/toDOM.js +2 -2
  5. package/dist/cjs/pm-plugins/commands/active-table-menu.js +51 -0
  6. package/dist/cjs/pm-plugins/commands/commands-with-analytics.js +42 -10
  7. package/dist/cjs/pm-plugins/commands/index.js +13 -0
  8. package/dist/cjs/pm-plugins/drag-and-drop/commands-with-analytics.js +2 -0
  9. package/dist/cjs/pm-plugins/drag-and-drop/plugin.js +4 -0
  10. package/dist/cjs/pm-plugins/handlers.js +8 -1
  11. package/dist/cjs/pm-plugins/main.js +4 -3
  12. package/dist/cjs/pm-plugins/reducer.js +2 -0
  13. package/dist/cjs/pm-plugins/table-width.js +2 -2
  14. package/dist/cjs/pm-plugins/transforms/content-mode.js +3 -2
  15. package/dist/cjs/pm-plugins/utils/tableMode/apply-measured-width-to-all-tables.js +70 -0
  16. package/dist/cjs/pm-plugins/utils/tableMode/apply-measured-width-to-selected-table.js +41 -0
  17. package/dist/cjs/pm-plugins/utils/tableMode/is-content-mode-supported.js +12 -0
  18. package/dist/cjs/pm-plugins/utils/tableMode/measure-table-with-auto-layout.js +113 -0
  19. package/dist/cjs/pm-plugins/utils/tableMode/smart-adjust/constants.js +10 -0
  20. package/dist/cjs/pm-plugins/utils/tableMode/smart-adjust/distribute-column-widths.js +83 -0
  21. package/dist/cjs/pm-plugins/utils/tableMode/smart-adjust/run-smart-adjust.js +56 -0
  22. package/dist/cjs/tablePlugin.js +1 -0
  23. package/dist/cjs/ui/ContentComponent.js +1 -1
  24. package/dist/cjs/ui/FloatingContextualButton/index.js +28 -9
  25. package/dist/cjs/ui/FloatingContextualMenu/CellMenuPopup.js +58 -73
  26. package/dist/cjs/ui/FloatingContextualMenu/index.js +26 -12
  27. package/dist/cjs/ui/FloatingDragMenu/index.js +21 -8
  28. package/dist/cjs/ui/TableFloatingColumnControls/ColumnControls/index.js +13 -5
  29. package/dist/cjs/ui/TableFloatingControls/RowControls/DragControls.js +14 -5
  30. package/dist/cjs/ui/TableMenu/cell/getCellMenuComponents.js +8 -3
  31. package/dist/cjs/ui/TableMenu/cell/items/MergeCellsItem.js +16 -1
  32. package/dist/cjs/ui/TableMenu/cell/items/SplitCellItem.js +16 -1
  33. package/dist/cjs/ui/TableMenu/column/items/AddColumnLeftItem.js +4 -4
  34. package/dist/cjs/ui/TableMenu/column/items/AddColumnRightItem.js +4 -4
  35. package/dist/cjs/ui/TableMenu/column/items/DeleteColumnItem.js +2 -3
  36. package/dist/cjs/ui/TableMenu/column/items/DistributeColumnsItem.js +2 -3
  37. package/dist/cjs/ui/TableMenu/column/items/HeaderColumnToggleItem.js +2 -3
  38. package/dist/cjs/ui/TableMenu/column/items/MoveColumnLeftItem.js +2 -3
  39. package/dist/cjs/ui/TableMenu/column/items/MoveColumnRightItem.js +2 -3
  40. package/dist/cjs/ui/TableMenu/column/items/SortDecreasingItem.js +2 -3
  41. package/dist/cjs/ui/TableMenu/column/items/SortIncreasingItem.js +2 -3
  42. package/dist/cjs/ui/TableMenu/row/items/AddRowAboveItem.js +4 -4
  43. package/dist/cjs/ui/TableMenu/row/items/AddRowBelowItem.js +4 -4
  44. package/dist/cjs/ui/TableMenu/row/items/DeleteRowItem.js +2 -3
  45. package/dist/cjs/ui/TableMenu/row/items/HeaderRowToggleItem.js +2 -3
  46. package/dist/cjs/ui/TableMenu/row/items/MoveRowDownItem.js +2 -3
  47. package/dist/cjs/ui/TableMenu/row/items/MoveRowUpItem.js +2 -3
  48. package/dist/cjs/ui/TableMenu/row/items/NumberedRowsToggleItem.js +4 -3
  49. package/dist/cjs/ui/TableMenu/shared/TableMenu.compiled.css +0 -2
  50. package/dist/cjs/ui/TableMenu/shared/TableMenu.js +8 -9
  51. package/dist/cjs/ui/TableMenu/shared/getSharedItems.js +3 -1
  52. package/dist/cjs/ui/TableMenu/shared/getTableMenuComponents.js +1 -1
  53. package/dist/cjs/ui/TableMenu/shared/items/BackgroundColorItem.js +30 -4
  54. package/dist/cjs/ui/TableMenu/shared/items/ClearCellsItem.js +4 -3
  55. package/dist/cjs/ui/toolbar.js +4 -3
  56. package/dist/es2019/nodeviews/TableComponent.js +1 -1
  57. package/dist/es2019/nodeviews/table.js +1 -1
  58. package/dist/es2019/nodeviews/toDOM.js +1 -1
  59. package/dist/es2019/pm-plugins/commands/active-table-menu.js +39 -0
  60. package/dist/es2019/pm-plugins/commands/commands-with-analytics.js +31 -2
  61. package/dist/es2019/pm-plugins/commands/index.js +1 -0
  62. package/dist/es2019/pm-plugins/drag-and-drop/commands-with-analytics.js +2 -0
  63. package/dist/es2019/pm-plugins/drag-and-drop/plugin.js +4 -0
  64. package/dist/es2019/pm-plugins/handlers.js +8 -1
  65. package/dist/es2019/pm-plugins/main.js +2 -1
  66. package/dist/es2019/pm-plugins/reducer.js +5 -0
  67. package/dist/es2019/pm-plugins/table-width.js +1 -1
  68. package/dist/es2019/pm-plugins/transforms/content-mode.js +2 -1
  69. package/dist/es2019/pm-plugins/utils/tableMode/apply-measured-width-to-all-tables.js +70 -0
  70. package/dist/es2019/pm-plugins/utils/tableMode/apply-measured-width-to-selected-table.js +38 -0
  71. package/dist/es2019/pm-plugins/utils/tableMode/is-content-mode-supported.js +7 -0
  72. package/dist/es2019/pm-plugins/utils/tableMode/measure-table-with-auto-layout.js +97 -0
  73. package/dist/es2019/pm-plugins/utils/tableMode/smart-adjust/constants.js +4 -0
  74. package/dist/es2019/pm-plugins/utils/tableMode/smart-adjust/distribute-column-widths.js +63 -0
  75. package/dist/es2019/pm-plugins/utils/tableMode/smart-adjust/run-smart-adjust.js +47 -0
  76. package/dist/es2019/tablePlugin.js +1 -0
  77. package/dist/es2019/ui/ContentComponent.js +1 -1
  78. package/dist/es2019/ui/FloatingContextualButton/index.js +29 -9
  79. package/dist/es2019/ui/FloatingContextualMenu/CellMenuPopup.js +60 -77
  80. package/dist/es2019/ui/FloatingContextualMenu/index.js +27 -12
  81. package/dist/es2019/ui/FloatingDragMenu/index.js +22 -8
  82. package/dist/es2019/ui/TableFloatingColumnControls/ColumnControls/index.js +12 -4
  83. package/dist/es2019/ui/TableFloatingControls/RowControls/DragControls.js +13 -4
  84. package/dist/es2019/ui/TableMenu/cell/getCellMenuComponents.js +9 -3
  85. package/dist/es2019/ui/TableMenu/cell/items/MergeCellsItem.js +18 -2
  86. package/dist/es2019/ui/TableMenu/cell/items/SplitCellItem.js +18 -2
  87. package/dist/es2019/ui/TableMenu/column/items/AddColumnLeftItem.js +3 -3
  88. package/dist/es2019/ui/TableMenu/column/items/AddColumnRightItem.js +3 -3
  89. package/dist/es2019/ui/TableMenu/column/items/DeleteColumnItem.js +2 -3
  90. package/dist/es2019/ui/TableMenu/column/items/DistributeColumnsItem.js +2 -3
  91. package/dist/es2019/ui/TableMenu/column/items/HeaderColumnToggleItem.js +2 -3
  92. package/dist/es2019/ui/TableMenu/column/items/MoveColumnLeftItem.js +2 -3
  93. package/dist/es2019/ui/TableMenu/column/items/MoveColumnRightItem.js +2 -3
  94. package/dist/es2019/ui/TableMenu/column/items/SortDecreasingItem.js +2 -3
  95. package/dist/es2019/ui/TableMenu/column/items/SortIncreasingItem.js +2 -3
  96. package/dist/es2019/ui/TableMenu/row/items/AddRowAboveItem.js +3 -3
  97. package/dist/es2019/ui/TableMenu/row/items/AddRowBelowItem.js +3 -3
  98. package/dist/es2019/ui/TableMenu/row/items/DeleteRowItem.js +2 -3
  99. package/dist/es2019/ui/TableMenu/row/items/HeaderRowToggleItem.js +2 -3
  100. package/dist/es2019/ui/TableMenu/row/items/MoveRowDownItem.js +2 -3
  101. package/dist/es2019/ui/TableMenu/row/items/MoveRowUpItem.js +2 -3
  102. package/dist/es2019/ui/TableMenu/row/items/NumberedRowsToggleItem.js +3 -2
  103. package/dist/es2019/ui/TableMenu/shared/TableMenu.compiled.css +0 -2
  104. package/dist/es2019/ui/TableMenu/shared/TableMenu.js +8 -9
  105. package/dist/es2019/ui/TableMenu/shared/getSharedItems.js +3 -1
  106. package/dist/es2019/ui/TableMenu/shared/getTableMenuComponents.js +1 -1
  107. package/dist/es2019/ui/TableMenu/shared/items/BackgroundColorItem.js +33 -4
  108. package/dist/es2019/ui/TableMenu/shared/items/ClearCellsItem.js +4 -3
  109. package/dist/es2019/ui/toolbar.js +2 -1
  110. package/dist/esm/nodeviews/TableComponent.js +1 -1
  111. package/dist/esm/nodeviews/table.js +1 -1
  112. package/dist/esm/nodeviews/toDOM.js +1 -1
  113. package/dist/esm/pm-plugins/commands/active-table-menu.js +45 -0
  114. package/dist/esm/pm-plugins/commands/commands-with-analytics.js +41 -10
  115. package/dist/esm/pm-plugins/commands/index.js +1 -0
  116. package/dist/esm/pm-plugins/drag-and-drop/commands-with-analytics.js +2 -0
  117. package/dist/esm/pm-plugins/drag-and-drop/plugin.js +4 -0
  118. package/dist/esm/pm-plugins/handlers.js +8 -1
  119. package/dist/esm/pm-plugins/main.js +2 -1
  120. package/dist/esm/pm-plugins/reducer.js +2 -0
  121. package/dist/esm/pm-plugins/table-width.js +1 -1
  122. package/dist/esm/pm-plugins/transforms/content-mode.js +2 -1
  123. package/dist/esm/pm-plugins/utils/tableMode/apply-measured-width-to-all-tables.js +65 -0
  124. package/dist/esm/pm-plugins/utils/tableMode/apply-measured-width-to-selected-table.js +36 -0
  125. package/dist/esm/pm-plugins/utils/tableMode/is-content-mode-supported.js +6 -0
  126. package/dist/esm/pm-plugins/utils/tableMode/measure-table-with-auto-layout.js +107 -0
  127. package/dist/esm/pm-plugins/utils/tableMode/smart-adjust/constants.js +4 -0
  128. package/dist/esm/pm-plugins/utils/tableMode/smart-adjust/distribute-column-widths.js +77 -0
  129. package/dist/esm/pm-plugins/utils/tableMode/smart-adjust/run-smart-adjust.js +49 -0
  130. package/dist/esm/tablePlugin.js +1 -0
  131. package/dist/esm/ui/ContentComponent.js +1 -1
  132. package/dist/esm/ui/FloatingContextualButton/index.js +29 -10
  133. package/dist/esm/ui/FloatingContextualMenu/CellMenuPopup.js +60 -75
  134. package/dist/esm/ui/FloatingContextualMenu/index.js +26 -12
  135. package/dist/esm/ui/FloatingDragMenu/index.js +21 -8
  136. package/dist/esm/ui/TableFloatingColumnControls/ColumnControls/index.js +12 -4
  137. package/dist/esm/ui/TableFloatingControls/RowControls/DragControls.js +13 -4
  138. package/dist/esm/ui/TableMenu/cell/getCellMenuComponents.js +8 -3
  139. package/dist/esm/ui/TableMenu/cell/items/MergeCellsItem.js +16 -2
  140. package/dist/esm/ui/TableMenu/cell/items/SplitCellItem.js +16 -2
  141. package/dist/esm/ui/TableMenu/column/items/AddColumnLeftItem.js +4 -4
  142. package/dist/esm/ui/TableMenu/column/items/AddColumnRightItem.js +4 -4
  143. package/dist/esm/ui/TableMenu/column/items/DeleteColumnItem.js +2 -3
  144. package/dist/esm/ui/TableMenu/column/items/DistributeColumnsItem.js +2 -3
  145. package/dist/esm/ui/TableMenu/column/items/HeaderColumnToggleItem.js +2 -3
  146. package/dist/esm/ui/TableMenu/column/items/MoveColumnLeftItem.js +2 -3
  147. package/dist/esm/ui/TableMenu/column/items/MoveColumnRightItem.js +2 -3
  148. package/dist/esm/ui/TableMenu/column/items/SortDecreasingItem.js +2 -3
  149. package/dist/esm/ui/TableMenu/column/items/SortIncreasingItem.js +2 -3
  150. package/dist/esm/ui/TableMenu/row/items/AddRowAboveItem.js +4 -4
  151. package/dist/esm/ui/TableMenu/row/items/AddRowBelowItem.js +4 -4
  152. package/dist/esm/ui/TableMenu/row/items/DeleteRowItem.js +2 -3
  153. package/dist/esm/ui/TableMenu/row/items/HeaderRowToggleItem.js +2 -3
  154. package/dist/esm/ui/TableMenu/row/items/MoveRowDownItem.js +2 -3
  155. package/dist/esm/ui/TableMenu/row/items/MoveRowUpItem.js +2 -3
  156. package/dist/esm/ui/TableMenu/row/items/NumberedRowsToggleItem.js +4 -3
  157. package/dist/esm/ui/TableMenu/shared/TableMenu.compiled.css +0 -2
  158. package/dist/esm/ui/TableMenu/shared/TableMenu.js +8 -9
  159. package/dist/esm/ui/TableMenu/shared/getSharedItems.js +3 -1
  160. package/dist/esm/ui/TableMenu/shared/getTableMenuComponents.js +1 -1
  161. package/dist/esm/ui/TableMenu/shared/items/BackgroundColorItem.js +30 -4
  162. package/dist/esm/ui/TableMenu/shared/items/ClearCellsItem.js +4 -3
  163. package/dist/esm/ui/toolbar.js +2 -1
  164. package/dist/types/entry-points/types.d.ts +1 -1
  165. package/dist/types/pm-plugins/commands/active-table-menu.d.ts +6 -0
  166. package/dist/types/pm-plugins/commands/commands-with-analytics.d.ts +3 -1
  167. package/dist/types/pm-plugins/commands/index.d.ts +1 -0
  168. package/dist/types/pm-plugins/transforms/content-mode.d.ts +1 -0
  169. package/dist/types/pm-plugins/utils/tableMode/apply-measured-width-to-all-tables.d.ts +8 -0
  170. package/dist/types/pm-plugins/utils/tableMode/apply-measured-width-to-selected-table.d.ts +6 -0
  171. package/dist/types/pm-plugins/utils/tableMode/is-content-mode-supported.d.ts +7 -0
  172. package/dist/types/pm-plugins/utils/tableMode/measure-table-with-auto-layout.d.ts +2 -0
  173. package/dist/types/pm-plugins/utils/tableMode/smart-adjust/constants.d.ts +4 -0
  174. package/dist/types/pm-plugins/utils/tableMode/smart-adjust/distribute-column-widths.d.ts +8 -0
  175. package/dist/types/pm-plugins/utils/tableMode/smart-adjust/run-smart-adjust.d.ts +7 -0
  176. package/dist/types/types/index.d.ts +21 -1
  177. package/dist/types/ui/FloatingContextualButton/index.d.ts +2 -0
  178. package/dist/types/ui/FloatingContextualMenu/CellMenuPopup.d.ts +7 -5
  179. package/dist/types/ui/FloatingContextualMenu/index.d.ts +0 -1
  180. package/dist/types/ui/TableMenu/cell/getCellMenuComponents.d.ts +2 -1
  181. package/dist/types/ui/TableMenu/cell/items/MergeCellsItem.d.ts +2 -1
  182. package/dist/types/ui/TableMenu/cell/items/SplitCellItem.d.ts +2 -1
  183. package/dist/types/ui/TableMenu/column/getColumnMenuComponents.d.ts +1 -1
  184. package/dist/types/ui/TableMenu/shared/TableMenuContext.d.ts +2 -0
  185. package/dist/types/ui/TableMenu/shared/items/BackgroundColorItem.d.ts +2 -1
  186. package/dist/types-ts4.5/entry-points/types.d.ts +1 -1
  187. package/dist/types-ts4.5/pm-plugins/commands/active-table-menu.d.ts +6 -0
  188. package/dist/types-ts4.5/pm-plugins/commands/commands-with-analytics.d.ts +3 -1
  189. package/dist/types-ts4.5/pm-plugins/commands/index.d.ts +1 -0
  190. package/dist/types-ts4.5/pm-plugins/transforms/content-mode.d.ts +1 -0
  191. package/dist/types-ts4.5/pm-plugins/utils/tableMode/apply-measured-width-to-all-tables.d.ts +8 -0
  192. package/dist/types-ts4.5/pm-plugins/utils/tableMode/apply-measured-width-to-selected-table.d.ts +6 -0
  193. package/dist/types-ts4.5/pm-plugins/utils/tableMode/is-content-mode-supported.d.ts +7 -0
  194. package/dist/types-ts4.5/pm-plugins/utils/tableMode/measure-table-with-auto-layout.d.ts +2 -0
  195. package/dist/types-ts4.5/pm-plugins/utils/tableMode/smart-adjust/constants.d.ts +4 -0
  196. package/dist/types-ts4.5/pm-plugins/utils/tableMode/smart-adjust/distribute-column-widths.d.ts +8 -0
  197. package/dist/types-ts4.5/pm-plugins/utils/tableMode/smart-adjust/run-smart-adjust.d.ts +7 -0
  198. package/dist/types-ts4.5/types/index.d.ts +21 -1
  199. package/dist/types-ts4.5/ui/FloatingContextualButton/index.d.ts +2 -0
  200. package/dist/types-ts4.5/ui/FloatingContextualMenu/CellMenuPopup.d.ts +7 -5
  201. package/dist/types-ts4.5/ui/FloatingContextualMenu/index.d.ts +0 -1
  202. package/dist/types-ts4.5/ui/TableMenu/cell/getCellMenuComponents.d.ts +2 -1
  203. package/dist/types-ts4.5/ui/TableMenu/cell/items/MergeCellsItem.d.ts +2 -1
  204. package/dist/types-ts4.5/ui/TableMenu/cell/items/SplitCellItem.d.ts +2 -1
  205. package/dist/types-ts4.5/ui/TableMenu/column/getColumnMenuComponents.d.ts +1 -1
  206. package/dist/types-ts4.5/ui/TableMenu/shared/TableMenuContext.d.ts +2 -0
  207. package/dist/types-ts4.5/ui/TableMenu/shared/items/BackgroundColorItem.d.ts +2 -1
  208. package/package.json +10 -7
  209. package/dist/cjs/pm-plugins/utils/tableMode.js +0 -162
  210. package/dist/es2019/pm-plugins/utils/tableMode.js +0 -158
  211. package/dist/esm/pm-plugins/utils/tableMode.js +0 -156
  212. package/dist/types/pm-plugins/utils/tableMode.d.ts +0 -26
  213. package/dist/types-ts4.5/pm-plugins/utils/tableMode.d.ts +0 -26
@@ -49,7 +49,8 @@ import { normaliseAlignment } from '../pm-plugins/utils/alignment';
49
49
  import { isTableNested } from '../pm-plugins/utils/nodes';
50
50
  import { getSelectedColumnIndexes, getSelectedRowIndexes } from '../pm-plugins/utils/selection';
51
51
  import { getMergedCellsPositions } from '../pm-plugins/utils/table';
52
- import { applyMeasuredWidthToSelectedTable, isContentModeSupported } from '../pm-plugins/utils/tableMode';
52
+ import { applyMeasuredWidthToSelectedTable } from '../pm-plugins/utils/tableMode/apply-measured-width-to-selected-table';
53
+ import { isContentModeSupported } from '../pm-plugins/utils/tableMode/is-content-mode-supported';
53
54
  import { TableCssClassName } from '../types';
54
55
  import { FloatingAlignmentButtons } from './FloatingAlignmentButtons/FloatingAlignmentButtons';
55
56
  export var getToolbarMenuConfig = function getToolbarMenuConfig(config, state, _ref, editorAnalyticsAPI) {
@@ -1,2 +1,2 @@
1
1
  export { RESIZE_HANDLE_AREA_DECORATION_GAP, ShadowEvent, TableCssClassName, TableDecorations, } from '../types/index';
2
- export type { AlignmentOptions, Cell, CellColumnPositioning, CellHoverMeta, CellTransform, ColumnResizingPluginAction, ColumnResizingPluginState, DraggableBehaviour, DraggableData, DraggableSourceData, DraggableTargetData, DraggableType, HandleTypes, InsertRowMethods, InsertRowOptions, InvalidNodeAttr, MessageDescriptor, PermittedLayoutsDescriptor, PluginConfig, PluginInjectionAPI, PluginInjectionAPIWithA11y, ReportInvalidNodeAttrs, RowInsertPosition, TableDirection, TablePluginAction, TablePluginState, TableSharedState, TableSharedStateInternal, ToolbarMenuConfig, ToolbarMenuContext, ToolbarMenuState, WidthToWidest, } from '../types/index';
2
+ export type { ActiveTableMenu, AlignmentOptions, Cell, CellColumnPositioning, CellHoverMeta, CellTransform, ColumnResizingPluginAction, ColumnResizingPluginState, DraggableBehaviour, DraggableData, DraggableSourceData, DraggableTargetData, DraggableType, HandleTypes, InsertRowMethods, InsertRowOptions, InvalidNodeAttr, MessageDescriptor, PermittedLayoutsDescriptor, PluginConfig, PluginInjectionAPI, PluginInjectionAPIWithA11y, ReportInvalidNodeAttrs, RowInsertPosition, TableDirection, TablePluginAction, TablePluginState, TableSharedState, TableSharedStateInternal, ToolbarMenuConfig, ToolbarMenuContext, ToolbarMenuState, WidthToWidest, } from '../types/index';
@@ -0,0 +1,6 @@
1
+ import type { Command } from '@atlaskit/editor-common/types';
2
+ import type { ActiveTableMenu } from '../../types';
3
+ export declare const closeActiveTableMenu: () => Command;
4
+ export declare const toggleActiveTableMenu: (activeTableMenu: Exclude<ActiveTableMenu, {
5
+ type: "none";
6
+ }>) => Command;
@@ -7,8 +7,10 @@ import type { Command, GetEditorContainerWidth } from '@atlaskit/editor-common/t
7
7
  import type { NodeWithPos } from '@atlaskit/editor-prosemirror/utils';
8
8
  import type { EditorView } from '@atlaskit/editor-prosemirror/view';
9
9
  import type { Rect } from '@atlaskit/editor-tables/table-map';
10
- import type { AlignmentOptions, InsertRowMethods, InsertRowOptions, PluginInjectionAPI, RowInsertPosition } from '../../types';
10
+ import type { AlignmentOptions, InsertRowMethods, InsertRowOptions, PluginInjectionAPI, RowInsertPosition, TableDirection } from '../../types';
11
+ import type { TriggerType } from '../drag-and-drop/types';
11
12
  import type { ResizeStateWithAnalytics } from '../table-resizing/utils/types';
13
+ export declare const toggleActiveTableMenuWithAnalytics: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null) => (direction: TableDirection, index: number, trigger?: TriggerType) => Command;
12
14
  export declare const emptyMultipleCellsWithAnalytics: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null) => (inputMethod: INPUT_METHOD.CONTEXT_MENU | INPUT_METHOD.KEYBOARD | INPUT_METHOD.FLOATING_TB | INPUT_METHOD.TABLE_CONTEXT_MENU, targetCellPosition?: number) => Command;
13
15
  export declare const mergeCellsWithAnalytics: (editorAnalyticsAPI: EditorAnalyticsAPI | null | undefined) => (inputMethod: INPUT_METHOD.CONTEXT_MENU | INPUT_METHOD.FLOATING_TB) => Command;
14
16
  export declare const splitCellWithAnalytics: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null) => (inputMethod: INPUT_METHOD.CONTEXT_MENU | INPUT_METHOD.FLOATING_TB) => Command;
@@ -1,6 +1,7 @@
1
1
  export { hoverColumns, hoverRows, hoverTable, hoverCell, hoverMergedCells, clearHoverSelection, showResizeHandleLine, hideResizeHandleLine, setTableHovered, } from './hover';
2
2
  export { insertColumn, insertRow, createTable } from './insert';
3
3
  export { getNextLayout, toggleContextualMenu, toggleHeaderColumn, toggleHeaderRow, toggleNumberColumn, toggleTableLayout, } from './toggle';
4
+ export { closeActiveTableMenu, toggleActiveTableMenu } from './active-table-menu';
4
5
  export { clearMultipleCells } from './clear';
5
6
  export { autoSizeTable, convertFirstRowToHeader, deleteTable, hideInsertColumnOrRowButton, moveCursorBackward, selectColumn, selectColumns, selectRow, selectRows, setCellAttr, setEditorFocus, setMultipleCellAttrs, setTableRef, showInsertColumnButton, showInsertRowButton, transformSliceToAddTableHeaders, triggerUnlessTableHeader, addBoldInEmptyHeaderCells, addResizeHandleDecorations, updateWidthToWidest, setFocusToCellMenu, } from './misc';
6
7
  export { sortByColumn } from './sort';
@@ -4,5 +4,6 @@ export type TableMeasurement = {
4
4
  colWidths: Array<number>;
5
5
  tableWidth: number;
6
6
  };
7
+ export declare const clampToEditorMaxWidth: (contentWidth: number) => number;
7
8
  export declare const getTableMeasurement: (tableRef: HTMLTableElement) => TableMeasurement;
8
9
  export declare const applyTableMeasurement: (tr: Transaction, tableNode: PMNode, { colWidths, tableWidth }: TableMeasurement, tablePos: number) => Transaction;
@@ -0,0 +1,8 @@
1
+ import type { EditorView } from '@atlaskit/editor-prosemirror/view';
2
+ import type { PluginInjectionAPI } from '../../../types';
3
+ /**
4
+ * Iterates all top-level tables in the document, and for those in content mode,
5
+ * measures rendered column widths and sets colwidth + table width attributes
6
+ * in a single batched transaction.
7
+ */
8
+ export declare const applyMeasuredWidthToAllTables: (view: EditorView, pluginInjectionApi?: PluginInjectionAPI) => void;
@@ -0,0 +1,6 @@
1
+ import type { EditorView } from '@atlaskit/editor-prosemirror/view';
2
+ import type { PluginInjectionAPI } from '../../../types';
3
+ /**
4
+ * Used to measure a selected table width with it's content being laid out natively by the browser
5
+ */
6
+ export declare const applyMeasuredWidthToSelectedTable: (view: EditorView, api?: PluginInjectionAPI) => void;
@@ -0,0 +1,7 @@
1
+ type ContentModePluginOptions = {
2
+ allowColumnResizing: boolean;
3
+ allowTableResizing: boolean;
4
+ isFullPageEditor: boolean;
5
+ };
6
+ export declare const isContentModeSupported: ({ allowColumnResizing, allowTableResizing, isFullPageEditor, }: ContentModePluginOptions) => boolean;
7
+ export {};
@@ -0,0 +1,2 @@
1
+ import { type TableMeasurement } from '../../transforms/content-mode';
2
+ export declare const measureTableWithAutoLayout: (tableRef: HTMLTableElement, editorContainerWidth?: number) => TableMeasurement;
@@ -0,0 +1,4 @@
1
+ /** Each column's max width is `MAX × (usableWidth / numCols)`. */
2
+ export declare const EVEN_SHARE_RATIO: {
3
+ readonly MAX: 2;
4
+ };
@@ -0,0 +1,8 @@
1
+ export declare const sumWidths: (widths: Array<number>) => number;
2
+ /**
3
+ * Clamps each desired width to `[tableCellMinWidth, MAX × evenShare]`. Greedy
4
+ * columns (paragraphs) hit the ceiling and wrap; small columns stay at their
5
+ * natural width. Leftover canvas budget grows ceiling-hitters up to their
6
+ * desired; overflow reclaims from ceiling-hitters only.
7
+ */
8
+ export declare const distributeByEvenShareRatio: (desiredWidths: Array<number>, editorContainerWidth: number) => Array<number>;
@@ -0,0 +1,7 @@
1
+ import { type TableMeasurement } from '../../../transforms/content-mode';
2
+ export declare const restoreResizerContainer: (resizerContainer: HTMLElement | undefined | null) => void;
3
+ /**
4
+ * Smart-adjust: measure unconstrained max-content per column, then clamp via
5
+ * `distributeByEvenShareRatio`.
6
+ */
7
+ export declare const runSmartAdjust: (tableRef: HTMLTableElement, resizerContainer: HTMLElement | undefined | null, resizerItem: HTMLElement | undefined | null, editorContainerWidthFromApi: number | undefined) => TableMeasurement;
@@ -34,7 +34,7 @@ export type PluginInjectionAPIWithA11y = ExtractInjectionAPI<TablePlugin> & {
34
34
  };
35
35
  };
36
36
  };
37
- export type TableSharedStateInternal = Pick<TablePluginState, 'isFullWidthModeEnabled' | 'isMaxWidthModeEnabled' | 'wasFullWidthModeEnabled' | 'wasMaxWidthModeEnabled' | 'isHeaderRowEnabled' | 'isHeaderColumnEnabled' | 'isNumberColumnEnabled' | 'isCommentEditor' | 'isTableScalingEnabled' | 'ordering' | 'isInDanger' | 'hoveredRows' | 'hoveredColumns' | 'hoveredCell' | 'isTableHovered' | 'tableNode' | 'widthToWidest' | 'tableRef' | 'tablePos' | 'targetCellPosition' | 'isContextualMenuOpen' | 'pluginConfig' | 'insertColumnButtonIndex' | 'insertRowButtonIndex' | 'tableWrapperTarget' | 'isCellMenuOpenByKeyboard'> & {
37
+ export type TableSharedStateInternal = Pick<TablePluginState, 'isFullWidthModeEnabled' | 'isMaxWidthModeEnabled' | 'wasFullWidthModeEnabled' | 'wasMaxWidthModeEnabled' | 'isHeaderRowEnabled' | 'isHeaderColumnEnabled' | 'isNumberColumnEnabled' | 'isCommentEditor' | 'isTableScalingEnabled' | 'ordering' | 'isInDanger' | 'hoveredRows' | 'hoveredColumns' | 'hoveredCell' | 'isTableHovered' | 'tableNode' | 'widthToWidest' | 'tableRef' | 'tablePos' | 'targetCellPosition' | 'isContextualMenuOpen' | 'pluginConfig' | 'insertColumnButtonIndex' | 'insertRowButtonIndex' | 'tableWrapperTarget' | 'isCellMenuOpenByKeyboard' | 'activeTableMenu'> & {
38
38
  dragMenuDirection?: TableDirection;
39
39
  dragMenuIndex?: number;
40
40
  editorContentAreaHeight?: number;
@@ -85,7 +85,22 @@ export interface CellHoverMeta {
85
85
  export interface WidthToWidest {
86
86
  [tableLocalId: string]: boolean;
87
87
  }
88
+ export type ActiveTableMenu = {
89
+ type: 'none';
90
+ } | {
91
+ openedBy: 'mouse' | 'keyboard';
92
+ type: 'cell';
93
+ } | {
94
+ index: number;
95
+ openedBy: 'mouse' | 'keyboard';
96
+ type: 'row';
97
+ } | {
98
+ index: number;
99
+ openedBy: 'mouse' | 'keyboard';
100
+ type: 'column';
101
+ };
88
102
  export interface TablePluginState {
103
+ activeTableMenu?: ActiveTableMenu;
89
104
  canCollapseTable?: boolean;
90
105
  editorHasFocus?: boolean;
91
106
  editorViewportHeight?: number;
@@ -266,6 +281,11 @@ export type TablePluginAction = {
266
281
  type: 'HIDE_INSERT_COLUMN_OR_ROW_BUTTON';
267
282
  } | {
268
283
  type: 'TOGGLE_CONTEXTUAL_MENU';
284
+ } | {
285
+ data: {
286
+ activeTableMenu: ActiveTableMenu;
287
+ };
288
+ type: 'SET_ACTIVE_TABLE_MENU';
269
289
  } | {
270
290
  data: {
271
291
  isCellMenuOpenByKeyboard: boolean;
@@ -2,7 +2,9 @@ import type { DispatchAnalyticsEvent } from '@atlaskit/editor-common/analytics';
2
2
  import type { Node as PMNode } from '@atlaskit/editor-prosemirror/model';
3
3
  import type { EditorView } from '@atlaskit/editor-prosemirror/view';
4
4
  import type { RowStickyState } from '../../pm-plugins/sticky-headers/types';
5
+ import { type PluginInjectionAPI } from '../../types';
5
6
  export interface Props {
7
+ api?: PluginInjectionAPI | null;
6
8
  boundariesElement?: HTMLElement;
7
9
  dispatchAnalyticsEvent?: DispatchAnalyticsEvent;
8
10
  editorView: EditorView;
@@ -1,12 +1,14 @@
1
1
  import React from 'react';
2
2
  import type { EditorView } from '@atlaskit/editor-prosemirror/view';
3
- import type { PluginInjectionAPI } from '../../types';
3
+ import { type PluginInjectionAPI } from '../../types';
4
4
  type CellMenuPopupProps = {
5
5
  api: PluginInjectionAPI | undefined | null;
6
+ boundariesElement?: HTMLElement;
6
7
  editorView: EditorView;
7
- isCellMenuOpenByKeyboard?: boolean;
8
- isOpen: boolean;
9
- targetCellRef: Node;
8
+ mountPoint?: HTMLElement;
9
+ scrollableElement?: HTMLElement;
10
+ targetCellRef: HTMLElement;
11
+ zIndex: number;
10
12
  };
11
- export declare const CellMenuPopup: ({ api, editorView, isCellMenuOpenByKeyboard, isOpen, targetCellRef, }: CellMenuPopupProps) => React.JSX.Element;
13
+ export declare const CellMenuPopup: ({ api, boundariesElement, editorView, mountPoint, scrollableElement, targetCellRef, zIndex, }: CellMenuPopupProps) => React.JSX.Element;
12
14
  export {};
@@ -16,7 +16,6 @@ interface Props {
16
16
  mountPoint?: HTMLElement;
17
17
  pluginConfig?: PluginConfig;
18
18
  scrollableElement?: HTMLElement;
19
- targetCellPosition?: number;
20
19
  }
21
20
  declare const FloatingContextualMenu: {
22
21
  ({ mountPoint, boundariesElement, scrollableElement, editorView, isOpen, pluginConfig, editorAnalyticsAPI, getEditorContainerWidth, getEditorFeatureFlags, isCellMenuOpenByKeyboard, isCommentEditor, api, isDragMenuOpen, }: Props): JSX.Element | null;
@@ -1,2 +1,3 @@
1
1
  import type { RegisterComponent } from '@atlaskit/editor-ui-control-model';
2
- export declare const getCellMenuComponents: () => RegisterComponent[];
2
+ import type { TableMenuComponentsParams } from '../shared/types';
3
+ export declare const getCellMenuComponents: ({ api }: TableMenuComponentsParams) => RegisterComponent[];
@@ -1,2 +1,3 @@
1
1
  import React from 'react';
2
- export declare const MergeCellsItem: () => React.JSX.Element | null;
2
+ import type { TableMenuComponentsParams } from '../../shared/types';
3
+ export declare const MergeCellsItem: ({ api }: TableMenuComponentsParams) => React.JSX.Element | null;
@@ -1,2 +1,3 @@
1
1
  import React from 'react';
2
- export declare const SplitCellItem: () => React.JSX.Element | null;
2
+ import type { TableMenuComponentsParams } from '../../shared/types';
3
+ export declare const SplitCellItem: ({ api }: TableMenuComponentsParams) => React.JSX.Element | null;
@@ -1,3 +1,3 @@
1
1
  import type { RegisterComponent } from '@atlaskit/editor-ui-control-model';
2
2
  import type { TableMenuComponentsParams } from '../shared/types';
3
- export declare const getColumnMenuComponents: ({ api }: TableMenuComponentsParams) => RegisterComponent[];
3
+ export declare const getColumnMenuComponents: ({ api, }: TableMenuComponentsParams) => RegisterComponent[];
@@ -1,7 +1,9 @@
1
1
  import React from 'react';
2
+ import type { EditorView } from '@atlaskit/editor-prosemirror/view';
2
3
  export type TableMenuContextValue = {
3
4
  canMergeCells?: boolean;
4
5
  canSplitCell?: boolean;
6
+ editorView?: EditorView;
5
7
  hasMergedCellsInTable?: boolean;
6
8
  isFirstColumn?: boolean;
7
9
  isFirstRow?: boolean;
@@ -3,4 +3,5 @@
3
3
  * @jsx jsx
4
4
  */
5
5
  import React from 'react';
6
- export declare const BackgroundColorItem: () => React.JSX.Element;
6
+ import type { TableMenuComponentsParams } from '../types';
7
+ export declare const BackgroundColorItem: ({ api }: TableMenuComponentsParams) => React.JSX.Element;
@@ -1,2 +1,2 @@
1
1
  export { RESIZE_HANDLE_AREA_DECORATION_GAP, ShadowEvent, TableCssClassName, TableDecorations, } from '../types/index';
2
- export type { AlignmentOptions, Cell, CellColumnPositioning, CellHoverMeta, CellTransform, ColumnResizingPluginAction, ColumnResizingPluginState, DraggableBehaviour, DraggableData, DraggableSourceData, DraggableTargetData, DraggableType, HandleTypes, InsertRowMethods, InsertRowOptions, InvalidNodeAttr, MessageDescriptor, PermittedLayoutsDescriptor, PluginConfig, PluginInjectionAPI, PluginInjectionAPIWithA11y, ReportInvalidNodeAttrs, RowInsertPosition, TableDirection, TablePluginAction, TablePluginState, TableSharedState, TableSharedStateInternal, ToolbarMenuConfig, ToolbarMenuContext, ToolbarMenuState, WidthToWidest, } from '../types/index';
2
+ export type { ActiveTableMenu, AlignmentOptions, Cell, CellColumnPositioning, CellHoverMeta, CellTransform, ColumnResizingPluginAction, ColumnResizingPluginState, DraggableBehaviour, DraggableData, DraggableSourceData, DraggableTargetData, DraggableType, HandleTypes, InsertRowMethods, InsertRowOptions, InvalidNodeAttr, MessageDescriptor, PermittedLayoutsDescriptor, PluginConfig, PluginInjectionAPI, PluginInjectionAPIWithA11y, ReportInvalidNodeAttrs, RowInsertPosition, TableDirection, TablePluginAction, TablePluginState, TableSharedState, TableSharedStateInternal, ToolbarMenuConfig, ToolbarMenuContext, ToolbarMenuState, WidthToWidest, } from '../types/index';
@@ -0,0 +1,6 @@
1
+ import type { Command } from '@atlaskit/editor-common/types';
2
+ import type { ActiveTableMenu } from '../../types';
3
+ export declare const closeActiveTableMenu: () => Command;
4
+ export declare const toggleActiveTableMenu: (activeTableMenu: Exclude<ActiveTableMenu, {
5
+ type: "none";
6
+ }>) => Command;
@@ -7,8 +7,10 @@ import type { Command, GetEditorContainerWidth } from '@atlaskit/editor-common/t
7
7
  import type { NodeWithPos } from '@atlaskit/editor-prosemirror/utils';
8
8
  import type { EditorView } from '@atlaskit/editor-prosemirror/view';
9
9
  import type { Rect } from '@atlaskit/editor-tables/table-map';
10
- import type { AlignmentOptions, InsertRowMethods, InsertRowOptions, PluginInjectionAPI, RowInsertPosition } from '../../types';
10
+ import type { AlignmentOptions, InsertRowMethods, InsertRowOptions, PluginInjectionAPI, RowInsertPosition, TableDirection } from '../../types';
11
+ import type { TriggerType } from '../drag-and-drop/types';
11
12
  import type { ResizeStateWithAnalytics } from '../table-resizing/utils/types';
13
+ export declare const toggleActiveTableMenuWithAnalytics: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null) => (direction: TableDirection, index: number, trigger?: TriggerType) => Command;
12
14
  export declare const emptyMultipleCellsWithAnalytics: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null) => (inputMethod: INPUT_METHOD.CONTEXT_MENU | INPUT_METHOD.KEYBOARD | INPUT_METHOD.FLOATING_TB | INPUT_METHOD.TABLE_CONTEXT_MENU, targetCellPosition?: number) => Command;
13
15
  export declare const mergeCellsWithAnalytics: (editorAnalyticsAPI: EditorAnalyticsAPI | null | undefined) => (inputMethod: INPUT_METHOD.CONTEXT_MENU | INPUT_METHOD.FLOATING_TB) => Command;
14
16
  export declare const splitCellWithAnalytics: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null) => (inputMethod: INPUT_METHOD.CONTEXT_MENU | INPUT_METHOD.FLOATING_TB) => Command;
@@ -1,6 +1,7 @@
1
1
  export { hoverColumns, hoverRows, hoverTable, hoverCell, hoverMergedCells, clearHoverSelection, showResizeHandleLine, hideResizeHandleLine, setTableHovered, } from './hover';
2
2
  export { insertColumn, insertRow, createTable } from './insert';
3
3
  export { getNextLayout, toggleContextualMenu, toggleHeaderColumn, toggleHeaderRow, toggleNumberColumn, toggleTableLayout, } from './toggle';
4
+ export { closeActiveTableMenu, toggleActiveTableMenu } from './active-table-menu';
4
5
  export { clearMultipleCells } from './clear';
5
6
  export { autoSizeTable, convertFirstRowToHeader, deleteTable, hideInsertColumnOrRowButton, moveCursorBackward, selectColumn, selectColumns, selectRow, selectRows, setCellAttr, setEditorFocus, setMultipleCellAttrs, setTableRef, showInsertColumnButton, showInsertRowButton, transformSliceToAddTableHeaders, triggerUnlessTableHeader, addBoldInEmptyHeaderCells, addResizeHandleDecorations, updateWidthToWidest, setFocusToCellMenu, } from './misc';
6
7
  export { sortByColumn } from './sort';
@@ -4,5 +4,6 @@ export type TableMeasurement = {
4
4
  colWidths: Array<number>;
5
5
  tableWidth: number;
6
6
  };
7
+ export declare const clampToEditorMaxWidth: (contentWidth: number) => number;
7
8
  export declare const getTableMeasurement: (tableRef: HTMLTableElement) => TableMeasurement;
8
9
  export declare const applyTableMeasurement: (tr: Transaction, tableNode: PMNode, { colWidths, tableWidth }: TableMeasurement, tablePos: number) => Transaction;
@@ -0,0 +1,8 @@
1
+ import type { EditorView } from '@atlaskit/editor-prosemirror/view';
2
+ import type { PluginInjectionAPI } from '../../../types';
3
+ /**
4
+ * Iterates all top-level tables in the document, and for those in content mode,
5
+ * measures rendered column widths and sets colwidth + table width attributes
6
+ * in a single batched transaction.
7
+ */
8
+ export declare const applyMeasuredWidthToAllTables: (view: EditorView, pluginInjectionApi?: PluginInjectionAPI) => void;
@@ -0,0 +1,6 @@
1
+ import type { EditorView } from '@atlaskit/editor-prosemirror/view';
2
+ import type { PluginInjectionAPI } from '../../../types';
3
+ /**
4
+ * Used to measure a selected table width with it's content being laid out natively by the browser
5
+ */
6
+ export declare const applyMeasuredWidthToSelectedTable: (view: EditorView, api?: PluginInjectionAPI) => void;
@@ -0,0 +1,7 @@
1
+ type ContentModePluginOptions = {
2
+ allowColumnResizing: boolean;
3
+ allowTableResizing: boolean;
4
+ isFullPageEditor: boolean;
5
+ };
6
+ export declare const isContentModeSupported: ({ allowColumnResizing, allowTableResizing, isFullPageEditor, }: ContentModePluginOptions) => boolean;
7
+ export {};
@@ -0,0 +1,2 @@
1
+ import { type TableMeasurement } from '../../transforms/content-mode';
2
+ export declare const measureTableWithAutoLayout: (tableRef: HTMLTableElement, editorContainerWidth?: number) => TableMeasurement;
@@ -0,0 +1,4 @@
1
+ /** Each column's max width is `MAX × (usableWidth / numCols)`. */
2
+ export declare const EVEN_SHARE_RATIO: {
3
+ readonly MAX: 2;
4
+ };
@@ -0,0 +1,8 @@
1
+ export declare const sumWidths: (widths: Array<number>) => number;
2
+ /**
3
+ * Clamps each desired width to `[tableCellMinWidth, MAX × evenShare]`. Greedy
4
+ * columns (paragraphs) hit the ceiling and wrap; small columns stay at their
5
+ * natural width. Leftover canvas budget grows ceiling-hitters up to their
6
+ * desired; overflow reclaims from ceiling-hitters only.
7
+ */
8
+ export declare const distributeByEvenShareRatio: (desiredWidths: Array<number>, editorContainerWidth: number) => Array<number>;
@@ -0,0 +1,7 @@
1
+ import { type TableMeasurement } from '../../../transforms/content-mode';
2
+ export declare const restoreResizerContainer: (resizerContainer: HTMLElement | undefined | null) => void;
3
+ /**
4
+ * Smart-adjust: measure unconstrained max-content per column, then clamp via
5
+ * `distributeByEvenShareRatio`.
6
+ */
7
+ export declare const runSmartAdjust: (tableRef: HTMLTableElement, resizerContainer: HTMLElement | undefined | null, resizerItem: HTMLElement | undefined | null, editorContainerWidthFromApi: number | undefined) => TableMeasurement;
@@ -34,7 +34,7 @@ export type PluginInjectionAPIWithA11y = ExtractInjectionAPI<TablePlugin> & {
34
34
  };
35
35
  };
36
36
  };
37
- export type TableSharedStateInternal = Pick<TablePluginState, 'isFullWidthModeEnabled' | 'isMaxWidthModeEnabled' | 'wasFullWidthModeEnabled' | 'wasMaxWidthModeEnabled' | 'isHeaderRowEnabled' | 'isHeaderColumnEnabled' | 'isNumberColumnEnabled' | 'isCommentEditor' | 'isTableScalingEnabled' | 'ordering' | 'isInDanger' | 'hoveredRows' | 'hoveredColumns' | 'hoveredCell' | 'isTableHovered' | 'tableNode' | 'widthToWidest' | 'tableRef' | 'tablePos' | 'targetCellPosition' | 'isContextualMenuOpen' | 'pluginConfig' | 'insertColumnButtonIndex' | 'insertRowButtonIndex' | 'tableWrapperTarget' | 'isCellMenuOpenByKeyboard'> & {
37
+ export type TableSharedStateInternal = Pick<TablePluginState, 'isFullWidthModeEnabled' | 'isMaxWidthModeEnabled' | 'wasFullWidthModeEnabled' | 'wasMaxWidthModeEnabled' | 'isHeaderRowEnabled' | 'isHeaderColumnEnabled' | 'isNumberColumnEnabled' | 'isCommentEditor' | 'isTableScalingEnabled' | 'ordering' | 'isInDanger' | 'hoveredRows' | 'hoveredColumns' | 'hoveredCell' | 'isTableHovered' | 'tableNode' | 'widthToWidest' | 'tableRef' | 'tablePos' | 'targetCellPosition' | 'isContextualMenuOpen' | 'pluginConfig' | 'insertColumnButtonIndex' | 'insertRowButtonIndex' | 'tableWrapperTarget' | 'isCellMenuOpenByKeyboard' | 'activeTableMenu'> & {
38
38
  dragMenuDirection?: TableDirection;
39
39
  dragMenuIndex?: number;
40
40
  editorContentAreaHeight?: number;
@@ -85,7 +85,22 @@ export interface CellHoverMeta {
85
85
  export interface WidthToWidest {
86
86
  [tableLocalId: string]: boolean;
87
87
  }
88
+ export type ActiveTableMenu = {
89
+ type: 'none';
90
+ } | {
91
+ openedBy: 'mouse' | 'keyboard';
92
+ type: 'cell';
93
+ } | {
94
+ index: number;
95
+ openedBy: 'mouse' | 'keyboard';
96
+ type: 'row';
97
+ } | {
98
+ index: number;
99
+ openedBy: 'mouse' | 'keyboard';
100
+ type: 'column';
101
+ };
88
102
  export interface TablePluginState {
103
+ activeTableMenu?: ActiveTableMenu;
89
104
  canCollapseTable?: boolean;
90
105
  editorHasFocus?: boolean;
91
106
  editorViewportHeight?: number;
@@ -266,6 +281,11 @@ export type TablePluginAction = {
266
281
  type: 'HIDE_INSERT_COLUMN_OR_ROW_BUTTON';
267
282
  } | {
268
283
  type: 'TOGGLE_CONTEXTUAL_MENU';
284
+ } | {
285
+ data: {
286
+ activeTableMenu: ActiveTableMenu;
287
+ };
288
+ type: 'SET_ACTIVE_TABLE_MENU';
269
289
  } | {
270
290
  data: {
271
291
  isCellMenuOpenByKeyboard: boolean;
@@ -2,7 +2,9 @@ import type { DispatchAnalyticsEvent } from '@atlaskit/editor-common/analytics';
2
2
  import type { Node as PMNode } from '@atlaskit/editor-prosemirror/model';
3
3
  import type { EditorView } from '@atlaskit/editor-prosemirror/view';
4
4
  import type { RowStickyState } from '../../pm-plugins/sticky-headers/types';
5
+ import { type PluginInjectionAPI } from '../../types';
5
6
  export interface Props {
7
+ api?: PluginInjectionAPI | null;
6
8
  boundariesElement?: HTMLElement;
7
9
  dispatchAnalyticsEvent?: DispatchAnalyticsEvent;
8
10
  editorView: EditorView;
@@ -1,12 +1,14 @@
1
1
  import React from 'react';
2
2
  import type { EditorView } from '@atlaskit/editor-prosemirror/view';
3
- import type { PluginInjectionAPI } from '../../types';
3
+ import { type PluginInjectionAPI } from '../../types';
4
4
  type CellMenuPopupProps = {
5
5
  api: PluginInjectionAPI | undefined | null;
6
+ boundariesElement?: HTMLElement;
6
7
  editorView: EditorView;
7
- isCellMenuOpenByKeyboard?: boolean;
8
- isOpen: boolean;
9
- targetCellRef: Node;
8
+ mountPoint?: HTMLElement;
9
+ scrollableElement?: HTMLElement;
10
+ targetCellRef: HTMLElement;
11
+ zIndex: number;
10
12
  };
11
- export declare const CellMenuPopup: ({ api, editorView, isCellMenuOpenByKeyboard, isOpen, targetCellRef, }: CellMenuPopupProps) => React.JSX.Element;
13
+ export declare const CellMenuPopup: ({ api, boundariesElement, editorView, mountPoint, scrollableElement, targetCellRef, zIndex, }: CellMenuPopupProps) => React.JSX.Element;
12
14
  export {};
@@ -16,7 +16,6 @@ interface Props {
16
16
  mountPoint?: HTMLElement;
17
17
  pluginConfig?: PluginConfig;
18
18
  scrollableElement?: HTMLElement;
19
- targetCellPosition?: number;
20
19
  }
21
20
  declare const FloatingContextualMenu: {
22
21
  ({ mountPoint, boundariesElement, scrollableElement, editorView, isOpen, pluginConfig, editorAnalyticsAPI, getEditorContainerWidth, getEditorFeatureFlags, isCellMenuOpenByKeyboard, isCommentEditor, api, isDragMenuOpen, }: Props): JSX.Element | null;
@@ -1,2 +1,3 @@
1
1
  import type { RegisterComponent } from '@atlaskit/editor-ui-control-model';
2
- export declare const getCellMenuComponents: () => RegisterComponent[];
2
+ import type { TableMenuComponentsParams } from '../shared/types';
3
+ export declare const getCellMenuComponents: ({ api }: TableMenuComponentsParams) => RegisterComponent[];
@@ -1,2 +1,3 @@
1
1
  import React from 'react';
2
- export declare const MergeCellsItem: () => React.JSX.Element | null;
2
+ import type { TableMenuComponentsParams } from '../../shared/types';
3
+ export declare const MergeCellsItem: ({ api }: TableMenuComponentsParams) => React.JSX.Element | null;
@@ -1,2 +1,3 @@
1
1
  import React from 'react';
2
- export declare const SplitCellItem: () => React.JSX.Element | null;
2
+ import type { TableMenuComponentsParams } from '../../shared/types';
3
+ export declare const SplitCellItem: ({ api }: TableMenuComponentsParams) => React.JSX.Element | null;
@@ -1,3 +1,3 @@
1
1
  import type { RegisterComponent } from '@atlaskit/editor-ui-control-model';
2
2
  import type { TableMenuComponentsParams } from '../shared/types';
3
- export declare const getColumnMenuComponents: ({ api }: TableMenuComponentsParams) => RegisterComponent[];
3
+ export declare const getColumnMenuComponents: ({ api, }: TableMenuComponentsParams) => RegisterComponent[];
@@ -1,7 +1,9 @@
1
1
  import React from 'react';
2
+ import type { EditorView } from '@atlaskit/editor-prosemirror/view';
2
3
  export type TableMenuContextValue = {
3
4
  canMergeCells?: boolean;
4
5
  canSplitCell?: boolean;
6
+ editorView?: EditorView;
5
7
  hasMergedCellsInTable?: boolean;
6
8
  isFirstColumn?: boolean;
7
9
  isFirstRow?: boolean;
@@ -3,4 +3,5 @@
3
3
  * @jsx jsx
4
4
  */
5
5
  import React from 'react';
6
- export declare const BackgroundColorItem: () => React.JSX.Element;
6
+ import type { TableMenuComponentsParams } from '../types';
7
+ export declare const BackgroundColorItem: ({ api }: TableMenuComponentsParams) => React.JSX.Element;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-table",
3
- "version": "22.4.14",
3
+ "version": "22.4.16",
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.13.0",
31
+ "@atlaskit/adf-schema": "^52.14.0",
32
32
  "@atlaskit/button": "^23.11.0",
33
33
  "@atlaskit/custom-steps": "^0.17.0",
34
34
  "@atlaskit/editor-palette": "^2.2.0",
@@ -37,7 +37,7 @@
37
37
  "@atlaskit/editor-plugin-batch-attribute-updates": "^10.1.0",
38
38
  "@atlaskit/editor-plugin-content-insertion": "^10.1.0",
39
39
  "@atlaskit/editor-plugin-editor-viewmode": "^12.1.0",
40
- "@atlaskit/editor-plugin-extension": "13.5.5",
40
+ "@atlaskit/editor-plugin-extension": "13.5.6",
41
41
  "@atlaskit/editor-plugin-guideline": "^10.1.0",
42
42
  "@atlaskit/editor-plugin-interaction": "^19.1.0",
43
43
  "@atlaskit/editor-plugin-limited-mode": "^7.2.0",
@@ -51,7 +51,7 @@
51
51
  "@atlaskit/editor-tables": "^2.10.0",
52
52
  "@atlaskit/editor-toolbar": "^1.7.0",
53
53
  "@atlaskit/editor-ui-control-model": "^1.2.0",
54
- "@atlaskit/icon": "^35.0.0",
54
+ "@atlaskit/icon": "^35.1.0",
55
55
  "@atlaskit/insm": "^0.4.0",
56
56
  "@atlaskit/menu": "^8.5.0",
57
57
  "@atlaskit/platform-feature-flags": "^1.1.0",
@@ -59,10 +59,10 @@
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": "^82.3.0",
62
+ "@atlaskit/tmp-editor-statsig": "^83.0.0",
63
63
  "@atlaskit/toggle": "^15.6.0",
64
64
  "@atlaskit/tokens": "^13.0.0",
65
- "@atlaskit/tooltip": "^22.2.0",
65
+ "@atlaskit/tooltip": "^22.3.0",
66
66
  "@babel/runtime": "^7.0.0",
67
67
  "@compiled/react": "^0.20.0",
68
68
  "@emotion/react": "^11.7.1",
@@ -74,7 +74,7 @@
74
74
  "uuid": "^3.1.0"
75
75
  },
76
76
  "peerDependencies": {
77
- "@atlaskit/editor-common": "^114.41.0",
77
+ "@atlaskit/editor-common": "^114.47.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"
@@ -122,6 +122,9 @@
122
122
  "platform_editor_content_mode_button_mvp": {
123
123
  "type": "boolean"
124
124
  },
125
+ "platform_editor_table_fit_to_content_smart_adjust": {
126
+ "type": "boolean"
127
+ },
125
128
  "platform_editor_table_height_analytics": {
126
129
  "type": "boolean"
127
130
  },