@atlaskit/editor-plugin-table 7.16.11 → 7.16.13

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 (254) hide show
  1. package/.eslintrc.js +3 -3
  2. package/CHANGELOG.md +16 -0
  3. package/dist/cjs/commands/misc.js +3 -3
  4. package/dist/cjs/nodeviews/TableCell.js +10 -10
  5. package/dist/cjs/nodeviews/TableContainer.js +83 -27
  6. package/dist/cjs/nodeviews/TableResizer.js +40 -19
  7. package/dist/cjs/nodeviews/TableRow.js +23 -23
  8. package/dist/cjs/pm-plugins/table-resizing/plugin.js +3 -3
  9. package/dist/cjs/pm-plugins/table-resizing/utils/resize-state.js +4 -4
  10. package/dist/cjs/pm-plugins/table-resizing/utils/scale-table.js +3 -3
  11. package/dist/cjs/ui/FloatingContextualMenu/styles.js +1 -1
  12. package/dist/cjs/ui/FloatingDragMenu/styles.js +1 -1
  13. package/dist/cjs/ui/common-styles.js +13 -13
  14. package/dist/cjs/ui/ui-styles.js +25 -25
  15. package/dist/cjs/utils/guidelines.js +7 -4
  16. package/dist/cjs/utils/merged-cells.js +3 -3
  17. package/dist/cjs/utils/snapping.js +7 -8
  18. package/dist/es2019/commands/misc.js +3 -3
  19. package/dist/es2019/nodeviews/TableContainer.js +70 -9
  20. package/dist/es2019/nodeviews/TableResizer.js +42 -21
  21. package/dist/es2019/nodeviews/TableRow.js +21 -21
  22. package/dist/es2019/pm-plugins/table-resizing/plugin.js +3 -3
  23. package/dist/es2019/pm-plugins/table-resizing/utils/resize-state.js +4 -4
  24. package/dist/es2019/pm-plugins/table-resizing/utils/scale-table.js +3 -3
  25. package/dist/es2019/ui/FloatingContextualMenu/styles.js +47 -47
  26. package/dist/es2019/ui/FloatingDragMenu/styles.js +30 -30
  27. package/dist/es2019/ui/common-styles.js +802 -816
  28. package/dist/es2019/ui/ui-styles.js +665 -678
  29. package/dist/es2019/utils/guidelines.js +5 -2
  30. package/dist/es2019/utils/merged-cells.js +3 -3
  31. package/dist/es2019/utils/snapping.js +5 -6
  32. package/dist/esm/commands/misc.js +3 -3
  33. package/dist/esm/nodeviews/TableCell.js +10 -10
  34. package/dist/esm/nodeviews/TableContainer.js +85 -29
  35. package/dist/esm/nodeviews/TableResizer.js +42 -21
  36. package/dist/esm/nodeviews/TableRow.js +23 -23
  37. package/dist/esm/pm-plugins/table-resizing/plugin.js +3 -3
  38. package/dist/esm/pm-plugins/table-resizing/utils/resize-state.js +4 -4
  39. package/dist/esm/pm-plugins/table-resizing/utils/scale-table.js +3 -3
  40. package/dist/esm/ui/FloatingContextualMenu/styles.js +1 -1
  41. package/dist/esm/ui/FloatingDragMenu/styles.js +1 -1
  42. package/dist/esm/ui/common-styles.js +13 -13
  43. package/dist/esm/ui/ui-styles.js +25 -25
  44. package/dist/esm/utils/guidelines.js +6 -3
  45. package/dist/esm/utils/merged-cells.js +3 -3
  46. package/dist/esm/utils/snapping.js +6 -7
  47. package/dist/types/nodeviews/TableResizer.d.ts +2 -1
  48. package/dist/types/pm-plugins/decorations/utils/index.d.ts +1 -1
  49. package/dist/types/pm-plugins/drag-and-drop/utils/autoscrollers.d.ts +1 -1
  50. package/dist/types/pm-plugins/drag-and-drop/utils/getDragBehaviour.d.ts +1 -1
  51. package/dist/types/pm-plugins/table-resizing/utils/index.d.ts +1 -1
  52. package/dist/types/ui/ColumnResizeWidget/index.d.ts +1 -1
  53. package/dist/types/ui/FloatingAlignmentButtons/FloatingAlignmentButtons.d.ts +1 -1
  54. package/dist/types/ui/FloatingToolbarLabel/FloatingToolbarLabel.d.ts +1 -1
  55. package/dist/types/ui/TableFloatingColumnControls/ColumnDropTargets/ColumnDropTarget.d.ts +1 -1
  56. package/dist/types/ui/TableFloatingControls/CornerControls/index.d.ts +1 -1
  57. package/dist/types/ui/icons/DragHandleDisabledIcon.d.ts +1 -1
  58. package/dist/types/utils/guidelines.d.ts +2 -1
  59. package/dist/types/utils/snapping.d.ts +3 -2
  60. package/dist/types-ts4.5/nodeviews/TableResizer.d.ts +2 -1
  61. package/dist/types-ts4.5/pm-plugins/decorations/utils/index.d.ts +1 -1
  62. package/dist/types-ts4.5/pm-plugins/drag-and-drop/utils/autoscrollers.d.ts +1 -1
  63. package/dist/types-ts4.5/pm-plugins/drag-and-drop/utils/getDragBehaviour.d.ts +1 -1
  64. package/dist/types-ts4.5/pm-plugins/table-resizing/utils/index.d.ts +1 -1
  65. package/dist/types-ts4.5/ui/ColumnResizeWidget/index.d.ts +1 -1
  66. package/dist/types-ts4.5/ui/FloatingAlignmentButtons/FloatingAlignmentButtons.d.ts +1 -1
  67. package/dist/types-ts4.5/ui/FloatingToolbarLabel/FloatingToolbarLabel.d.ts +1 -1
  68. package/dist/types-ts4.5/ui/TableFloatingColumnControls/ColumnDropTargets/ColumnDropTarget.d.ts +1 -1
  69. package/dist/types-ts4.5/ui/TableFloatingControls/CornerControls/index.d.ts +1 -1
  70. package/dist/types-ts4.5/ui/icons/DragHandleDisabledIcon.d.ts +1 -1
  71. package/dist/types-ts4.5/utils/guidelines.d.ts +2 -1
  72. package/dist/types-ts4.5/utils/snapping.d.ts +3 -2
  73. package/docs/0-intro.tsx +9 -7
  74. package/package.json +3 -3
  75. package/report.api.md +67 -66
  76. package/src/commands/clear.ts +36 -44
  77. package/src/commands/collapse.ts +8 -8
  78. package/src/commands/column-resize.ts +412 -452
  79. package/src/commands/delete.ts +14 -14
  80. package/src/commands/display-mode.ts +10 -11
  81. package/src/commands/go-to-next-cell.ts +48 -54
  82. package/src/commands/hover.ts +210 -227
  83. package/src/commands/index.ts +35 -35
  84. package/src/commands/insert.ts +208 -235
  85. package/src/commands/misc.ts +655 -748
  86. package/src/commands/referentiality.ts +9 -9
  87. package/src/commands/selection.ts +433 -563
  88. package/src/commands/sort.ts +68 -86
  89. package/src/commands/split-cell.ts +14 -14
  90. package/src/commands/toggle.ts +69 -67
  91. package/src/commands-with-analytics.ts +570 -639
  92. package/src/create-plugin-config.ts +13 -13
  93. package/src/event-handlers.ts +513 -612
  94. package/src/handlers.ts +120 -133
  95. package/src/nodeviews/ExternalDropTargets.tsx +68 -73
  96. package/src/nodeviews/OverflowShadowsObserver.ts +148 -157
  97. package/src/nodeviews/TableCell.ts +47 -54
  98. package/src/nodeviews/TableComponent.tsx +1018 -1112
  99. package/src/nodeviews/TableComponentWithSharedState.tsx +91 -94
  100. package/src/nodeviews/TableContainer.tsx +384 -340
  101. package/src/nodeviews/TableNodeViewBase.ts +19 -24
  102. package/src/nodeviews/TableResizer.tsx +642 -653
  103. package/src/nodeviews/TableRow.ts +580 -629
  104. package/src/nodeviews/TableStickyScrollbar.ts +173 -190
  105. package/src/nodeviews/__mocks__/OverflowShadowsObserver.ts +8 -8
  106. package/src/nodeviews/__mocks__/OverridableMock.ts +14 -15
  107. package/src/nodeviews/table.tsx +345 -375
  108. package/src/nodeviews/types.ts +21 -24
  109. package/src/nodeviews/update-overflow-shadows.ts +8 -14
  110. package/src/plugin.tsx +578 -603
  111. package/src/pm-plugins/analytics/actions.ts +10 -12
  112. package/src/pm-plugins/analytics/commands.ts +31 -37
  113. package/src/pm-plugins/analytics/plugin-factory.ts +4 -2
  114. package/src/pm-plugins/analytics/plugin-key.ts +1 -3
  115. package/src/pm-plugins/analytics/plugin.ts +60 -70
  116. package/src/pm-plugins/analytics/reducer.ts +19 -19
  117. package/src/pm-plugins/analytics/types.ts +10 -10
  118. package/src/pm-plugins/analytics/utils/moved-event.ts +38 -38
  119. package/src/pm-plugins/decorations/plugin.ts +58 -77
  120. package/src/pm-plugins/decorations/utils/column-controls.ts +59 -71
  121. package/src/pm-plugins/decorations/utils/column-resizing.ts +50 -57
  122. package/src/pm-plugins/decorations/utils/compose-decorations.ts +6 -6
  123. package/src/pm-plugins/decorations/utils/index.ts +3 -6
  124. package/src/pm-plugins/decorations/utils/types.ts +7 -12
  125. package/src/pm-plugins/default-table-selection.ts +3 -3
  126. package/src/pm-plugins/drag-and-drop/actions.ts +25 -25
  127. package/src/pm-plugins/drag-and-drop/commands-with-analytics.ts +158 -190
  128. package/src/pm-plugins/drag-and-drop/commands.ts +154 -170
  129. package/src/pm-plugins/drag-and-drop/consts.ts +4 -5
  130. package/src/pm-plugins/drag-and-drop/plugin-factory.ts +23 -20
  131. package/src/pm-plugins/drag-and-drop/plugin-key.ts +1 -3
  132. package/src/pm-plugins/drag-and-drop/plugin.ts +329 -383
  133. package/src/pm-plugins/drag-and-drop/reducer.ts +30 -30
  134. package/src/pm-plugins/drag-and-drop/types.ts +8 -8
  135. package/src/pm-plugins/drag-and-drop/utils/autoscrollers.ts +38 -41
  136. package/src/pm-plugins/drag-and-drop/utils/getDragBehaviour.ts +3 -6
  137. package/src/pm-plugins/drag-and-drop/utils/monitor.ts +57 -70
  138. package/src/pm-plugins/keymap.ts +208 -220
  139. package/src/pm-plugins/main.ts +348 -400
  140. package/src/pm-plugins/plugin-factory.ts +32 -34
  141. package/src/pm-plugins/safari-delete-composition-text-issue-workaround.ts +83 -97
  142. package/src/pm-plugins/sticky-headers/commands.ts +2 -6
  143. package/src/pm-plugins/sticky-headers/plugin-key.ts +1 -3
  144. package/src/pm-plugins/sticky-headers/plugin-state.ts +41 -44
  145. package/src/pm-plugins/sticky-headers/plugin.ts +4 -4
  146. package/src/pm-plugins/sticky-headers/types.ts +8 -8
  147. package/src/pm-plugins/sticky-headers/util.ts +10 -10
  148. package/src/pm-plugins/table-analytics.ts +70 -72
  149. package/src/pm-plugins/table-local-id.ts +180 -184
  150. package/src/pm-plugins/table-resizing/commands.ts +72 -85
  151. package/src/pm-plugins/table-resizing/event-handlers.ts +298 -317
  152. package/src/pm-plugins/table-resizing/plugin-factory.ts +10 -10
  153. package/src/pm-plugins/table-resizing/plugin-key.ts +1 -3
  154. package/src/pm-plugins/table-resizing/plugin.ts +61 -68
  155. package/src/pm-plugins/table-resizing/reducer.ts +30 -33
  156. package/src/pm-plugins/table-resizing/utils/colgroup.ts +84 -84
  157. package/src/pm-plugins/table-resizing/utils/column-state.ts +78 -81
  158. package/src/pm-plugins/table-resizing/utils/content-width.ts +94 -114
  159. package/src/pm-plugins/table-resizing/utils/dom.ts +93 -110
  160. package/src/pm-plugins/table-resizing/utils/index.ts +29 -34
  161. package/src/pm-plugins/table-resizing/utils/misc.ts +94 -119
  162. package/src/pm-plugins/table-resizing/utils/resize-column.ts +93 -106
  163. package/src/pm-plugins/table-resizing/utils/resize-logic.ts +240 -257
  164. package/src/pm-plugins/table-resizing/utils/resize-state.ts +343 -372
  165. package/src/pm-plugins/table-resizing/utils/scale-table.ts +202 -207
  166. package/src/pm-plugins/table-resizing/utils/types.ts +17 -17
  167. package/src/pm-plugins/table-resizing/utils/unit-to-number.ts +1 -2
  168. package/src/pm-plugins/table-selection-keymap.ts +25 -51
  169. package/src/pm-plugins/table-width.ts +191 -204
  170. package/src/pm-plugins/view-mode-sort/index.ts +223 -227
  171. package/src/pm-plugins/view-mode-sort/plugin-key.ts +3 -2
  172. package/src/pm-plugins/view-mode-sort/types.ts +12 -12
  173. package/src/pm-plugins/view-mode-sort/utils.ts +108 -117
  174. package/src/reducer.ts +139 -155
  175. package/src/toolbar.tsx +815 -905
  176. package/src/transforms/column-width.ts +186 -213
  177. package/src/transforms/delete-columns.ts +208 -222
  178. package/src/transforms/delete-rows.ts +117 -121
  179. package/src/transforms/fix-tables.ts +190 -215
  180. package/src/transforms/merge.ts +263 -269
  181. package/src/transforms/replace-table.ts +27 -43
  182. package/src/transforms/split.ts +65 -75
  183. package/src/types.ts +421 -427
  184. package/src/ui/ColumnResizeWidget/index.tsx +40 -47
  185. package/src/ui/DragHandle/HandleIconComponent.tsx +9 -13
  186. package/src/ui/DragHandle/index.tsx +221 -250
  187. package/src/ui/DragPreview/index.tsx +35 -35
  188. package/src/ui/FloatingAlignmentButtons/FloatingAlignmentButtons.tsx +33 -41
  189. package/src/ui/FloatingContextualButton/FixedButton.tsx +154 -157
  190. package/src/ui/FloatingContextualButton/index.tsx +109 -115
  191. package/src/ui/FloatingContextualButton/styles.ts +43 -46
  192. package/src/ui/FloatingContextualMenu/ContextualMenu.tsx +634 -694
  193. package/src/ui/FloatingContextualMenu/index.tsx +83 -101
  194. package/src/ui/FloatingContextualMenu/styles.ts +57 -65
  195. package/src/ui/FloatingDeleteButton/DeleteButton.tsx +37 -37
  196. package/src/ui/FloatingDeleteButton/getPopUpOptions.ts +47 -57
  197. package/src/ui/FloatingDeleteButton/index.tsx +319 -350
  198. package/src/ui/FloatingDragMenu/DragMenu.tsx +555 -596
  199. package/src/ui/FloatingDragMenu/DropdownMenu.tsx +152 -162
  200. package/src/ui/FloatingDragMenu/index.tsx +88 -102
  201. package/src/ui/FloatingDragMenu/styles.ts +51 -54
  202. package/src/ui/FloatingInsertButton/InsertButton.tsx +204 -217
  203. package/src/ui/FloatingInsertButton/getPopupOptions.ts +100 -115
  204. package/src/ui/FloatingInsertButton/index.tsx +248 -292
  205. package/src/ui/FloatingToolbarLabel/FloatingToolbarLabel.tsx +24 -29
  206. package/src/ui/TableFloatingColumnControls/ColumnControls/index.tsx +308 -329
  207. package/src/ui/TableFloatingColumnControls/ColumnDropTargets/ColumnDropTarget.tsx +85 -94
  208. package/src/ui/TableFloatingColumnControls/ColumnDropTargets/index.tsx +46 -46
  209. package/src/ui/TableFloatingColumnControls/index.tsx +116 -136
  210. package/src/ui/TableFloatingControls/CornerControls/ClassicCornerControls.tsx +79 -91
  211. package/src/ui/TableFloatingControls/CornerControls/DragCornerControls.tsx +95 -102
  212. package/src/ui/TableFloatingControls/CornerControls/index.tsx +1 -4
  213. package/src/ui/TableFloatingControls/CornerControls/types.ts +8 -8
  214. package/src/ui/TableFloatingControls/FloatingControlsWithSelection.tsx +50 -50
  215. package/src/ui/TableFloatingControls/NumberColumn/index.tsx +111 -124
  216. package/src/ui/TableFloatingControls/RowControls/ClassicControls.tsx +86 -105
  217. package/src/ui/TableFloatingControls/RowControls/DragControls.tsx +305 -341
  218. package/src/ui/TableFloatingControls/RowDropTarget/index.tsx +72 -75
  219. package/src/ui/TableFloatingControls/index.tsx +191 -193
  220. package/src/ui/TableFullWidthLabel/index.tsx +20 -20
  221. package/src/ui/common-styles.ts +880 -912
  222. package/src/ui/consts.ts +29 -74
  223. package/src/ui/icons/AddColLeftIcon.tsx +33 -39
  224. package/src/ui/icons/AddColRightIcon.tsx +33 -39
  225. package/src/ui/icons/AddRowAboveIcon.tsx +16 -22
  226. package/src/ui/icons/AddRowBelowIcon.tsx +33 -39
  227. package/src/ui/icons/DisplayModeIcon.tsx +31 -31
  228. package/src/ui/icons/DragHandleDisabledIcon.tsx +19 -21
  229. package/src/ui/icons/DragHandleIcon.tsx +12 -12
  230. package/src/ui/icons/DragInMotionIcon.tsx +45 -52
  231. package/src/ui/icons/MergeCellsIcon.tsx +22 -28
  232. package/src/ui/icons/MinimisedHandle.tsx +9 -9
  233. package/src/ui/icons/SplitCellIcon.tsx +30 -36
  234. package/src/ui/ui-styles.ts +769 -798
  235. package/src/utils/alignment.ts +1 -1
  236. package/src/utils/analytics.ts +192 -208
  237. package/src/utils/collapse.ts +55 -64
  238. package/src/utils/column-controls.ts +237 -254
  239. package/src/utils/create.ts +30 -30
  240. package/src/utils/decoration.ts +482 -502
  241. package/src/utils/dom.ts +127 -134
  242. package/src/utils/drag-menu.ts +322 -373
  243. package/src/utils/get-allow-add-column-custom-step.ts +4 -5
  244. package/src/utils/guidelines.ts +16 -21
  245. package/src/utils/index.ts +68 -68
  246. package/src/utils/merged-cells.ts +245 -254
  247. package/src/utils/nodes.ts +91 -106
  248. package/src/utils/paste.ts +119 -135
  249. package/src/utils/row-controls.ts +199 -213
  250. package/src/utils/selection.ts +77 -87
  251. package/src/utils/snapping.ts +87 -100
  252. package/src/utils/table.ts +44 -44
  253. package/src/utils/transforms.ts +5 -5
  254. package/src/utils/update-plugin-state-decorations.ts +5 -9
@@ -4,30 +4,24 @@ import type { TableLayout } from '@atlaskit/adf-schema';
4
4
  import { tableBackgroundColorPalette } from '@atlaskit/adf-schema';
5
5
  import type { TableSortOrder as SortOrder } from '@atlaskit/custom-steps';
6
6
  import {
7
- ACTION_SUBJECT,
8
- EVENT_TYPE,
9
- INPUT_METHOD,
10
- TABLE_ACTION,
11
- TABLE_BREAKOUT,
12
- TABLE_DISPLAY_MODE,
13
- } from '@atlaskit/editor-common/analytics';
14
- import type {
15
- AnalyticsEventPayload,
16
- EditorAnalyticsAPI,
7
+ ACTION_SUBJECT,
8
+ EVENT_TYPE,
9
+ INPUT_METHOD,
10
+ TABLE_ACTION,
11
+ TABLE_BREAKOUT,
12
+ TABLE_DISPLAY_MODE,
17
13
  } from '@atlaskit/editor-common/analytics';
14
+ import type { AnalyticsEventPayload, EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
18
15
  import { editorCommandToPMCommand } from '@atlaskit/editor-common/preset';
19
- import type {
20
- Command,
21
- GetEditorContainerWidth,
22
- } from '@atlaskit/editor-common/types';
16
+ import type { Command, GetEditorContainerWidth } from '@atlaskit/editor-common/types';
23
17
  import type { EditorView } from '@atlaskit/editor-prosemirror/dist/types/view';
24
18
  import type { Selection } from '@atlaskit/editor-prosemirror/state';
25
19
  import { CellSelection } from '@atlaskit/editor-tables/cell-selection';
26
20
  import type { Rect } from '@atlaskit/editor-tables/table-map';
27
21
  import {
28
- findCellClosestToPos,
29
- findCellRectClosestToPos,
30
- getSelectionRect,
22
+ findCellClosestToPos,
23
+ findCellRectClosestToPos,
24
+ getSelectionRect,
31
25
  } from '@atlaskit/editor-tables/utils';
32
26
 
33
27
  import { clearMultipleCells } from './commands/clear';
@@ -37,695 +31,632 @@ import { deleteColumnsCommand } from './commands/delete';
37
31
  import { setTableDisplayMode } from './commands/display-mode';
38
32
  import { insertColumn, insertRow } from './commands/insert';
39
33
  import {
40
- deleteTable,
41
- deleteTableIfSelected,
42
- getTableSelectionType,
43
- setMultipleCellAttrs,
44
- setTableAlignment,
34
+ deleteTable,
35
+ deleteTableIfSelected,
36
+ getTableSelectionType,
37
+ setMultipleCellAttrs,
38
+ setTableAlignment,
45
39
  } from './commands/misc';
46
40
  import { sortByColumn } from './commands/sort';
47
41
  import { splitCell } from './commands/split-cell';
48
42
  import {
49
- getNextLayout,
50
- toggleHeaderColumn,
51
- toggleHeaderRow,
52
- toggleNumberColumn,
53
- toggleTableLayout,
43
+ getNextLayout,
44
+ toggleHeaderColumn,
45
+ toggleHeaderRow,
46
+ toggleNumberColumn,
47
+ toggleTableLayout,
54
48
  } from './commands/toggle';
55
49
  import { getPluginState } from './pm-plugins/plugin-factory';
56
50
  import { distributeColumnsWidths } from './pm-plugins/table-resizing/commands';
57
51
  import type { ResizeStateWithAnalytics } from './pm-plugins/table-resizing/utils';
58
52
  import { deleteRows, mergeCells } from './transforms';
59
53
  import type {
60
- AlignmentOptions,
61
- InsertRowMethods,
62
- InsertRowOptions,
63
- RowInsertPosition,
54
+ AlignmentOptions,
55
+ InsertRowMethods,
56
+ InsertRowOptions,
57
+ RowInsertPosition,
64
58
  } from './types';
65
- import {
66
- checkIfNumberColumnEnabled,
67
- getSelectedCellInfo,
68
- getSelectedTableInfo,
69
- } from './utils';
59
+ import { checkIfNumberColumnEnabled, getSelectedCellInfo, getSelectedTableInfo } from './utils';
70
60
  import { withEditorAnalyticsAPI } from './utils/analytics';
71
61
 
72
62
  const TABLE_BREAKOUT_NAME_MAPPING = {
73
- default: TABLE_BREAKOUT.NORMAL,
74
- wide: TABLE_BREAKOUT.WIDE,
75
- 'full-width': TABLE_BREAKOUT.FULL_WIDTH,
63
+ default: TABLE_BREAKOUT.NORMAL,
64
+ wide: TABLE_BREAKOUT.WIDE,
65
+ 'full-width': TABLE_BREAKOUT.FULL_WIDTH,
76
66
  };
77
67
 
78
68
  // #region Analytics wrappers
79
69
  export const emptyMultipleCellsWithAnalytics =
80
- (editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null) =>
81
- (
82
- inputMethod:
83
- | INPUT_METHOD.CONTEXT_MENU
84
- | INPUT_METHOD.KEYBOARD
85
- | INPUT_METHOD.FLOATING_TB
86
- | INPUT_METHOD.TABLE_CONTEXT_MENU,
87
- targetCellPosition?: number,
88
- ) =>
89
- withEditorAnalyticsAPI(({ selection }) => {
90
- const {
91
- horizontalCells,
92
- verticalCells,
93
- totalRowCount,
94
- totalColumnCount,
95
- } = getSelectedCellInfo(selection);
96
-
97
- return {
98
- action: TABLE_ACTION.CLEARED,
99
- actionSubject: ACTION_SUBJECT.TABLE,
100
- actionSubjectId: null,
101
- attributes: {
102
- inputMethod,
103
- horizontalCells,
104
- verticalCells,
105
- totalRowCount,
106
- totalColumnCount,
107
- },
108
- eventType: EVENT_TYPE.TRACK,
109
- };
110
- })(editorAnalyticsAPI)(clearMultipleCells(targetCellPosition));
70
+ (editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null) =>
71
+ (
72
+ inputMethod:
73
+ | INPUT_METHOD.CONTEXT_MENU
74
+ | INPUT_METHOD.KEYBOARD
75
+ | INPUT_METHOD.FLOATING_TB
76
+ | INPUT_METHOD.TABLE_CONTEXT_MENU,
77
+ targetCellPosition?: number,
78
+ ) =>
79
+ withEditorAnalyticsAPI(({ selection }) => {
80
+ const { horizontalCells, verticalCells, totalRowCount, totalColumnCount } =
81
+ getSelectedCellInfo(selection);
82
+
83
+ return {
84
+ action: TABLE_ACTION.CLEARED,
85
+ actionSubject: ACTION_SUBJECT.TABLE,
86
+ actionSubjectId: null,
87
+ attributes: {
88
+ inputMethod,
89
+ horizontalCells,
90
+ verticalCells,
91
+ totalRowCount,
92
+ totalColumnCount,
93
+ },
94
+ eventType: EVENT_TYPE.TRACK,
95
+ };
96
+ })(editorAnalyticsAPI)(clearMultipleCells(targetCellPosition));
111
97
 
112
98
  export const mergeCellsWithAnalytics =
113
- (editorAnalyticsAPI: EditorAnalyticsAPI | null | undefined) =>
114
- (inputMethod: INPUT_METHOD.CONTEXT_MENU | INPUT_METHOD.FLOATING_TB) =>
115
- withEditorAnalyticsAPI(({ selection }) => {
116
- const {
117
- horizontalCells,
118
- verticalCells,
119
- totalCells,
120
- totalRowCount,
121
- totalColumnCount,
122
- } = getSelectedCellInfo(selection);
123
-
124
- return {
125
- action: TABLE_ACTION.MERGED,
126
- actionSubject: ACTION_SUBJECT.TABLE,
127
- actionSubjectId: null,
128
- attributes: {
129
- inputMethod,
130
- horizontalCells,
131
- verticalCells,
132
- totalCells,
133
- totalRowCount,
134
- totalColumnCount,
135
- },
136
- eventType: EVENT_TYPE.TRACK,
137
- };
138
- })(editorAnalyticsAPI)((state, dispatch) => {
139
- if (dispatch) {
140
- dispatch(mergeCells(state.tr));
141
- }
142
- return true;
143
- });
99
+ (editorAnalyticsAPI: EditorAnalyticsAPI | null | undefined) =>
100
+ (inputMethod: INPUT_METHOD.CONTEXT_MENU | INPUT_METHOD.FLOATING_TB) =>
101
+ withEditorAnalyticsAPI(({ selection }) => {
102
+ const { horizontalCells, verticalCells, totalCells, totalRowCount, totalColumnCount } =
103
+ getSelectedCellInfo(selection);
104
+
105
+ return {
106
+ action: TABLE_ACTION.MERGED,
107
+ actionSubject: ACTION_SUBJECT.TABLE,
108
+ actionSubjectId: null,
109
+ attributes: {
110
+ inputMethod,
111
+ horizontalCells,
112
+ verticalCells,
113
+ totalCells,
114
+ totalRowCount,
115
+ totalColumnCount,
116
+ },
117
+ eventType: EVENT_TYPE.TRACK,
118
+ };
119
+ })(editorAnalyticsAPI)((state, dispatch) => {
120
+ if (dispatch) {
121
+ dispatch(mergeCells(state.tr));
122
+ }
123
+ return true;
124
+ });
144
125
 
145
126
  export const splitCellWithAnalytics =
146
- (editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null) =>
147
- (inputMethod: INPUT_METHOD.CONTEXT_MENU | INPUT_METHOD.FLOATING_TB) =>
148
- withEditorAnalyticsAPI(({ selection }) => {
149
- const { totalRowCount, totalColumnCount } =
150
- getSelectedCellInfo(selection);
151
- const cell = findCellClosestToPos(selection.$anchor);
152
- if (cell) {
153
- const { rowspan: verticalCells, colspan: horizontalCells } =
154
- cell.node.attrs;
155
-
156
- return {
157
- action: TABLE_ACTION.SPLIT,
158
- actionSubject: ACTION_SUBJECT.TABLE,
159
- actionSubjectId: null,
160
- attributes: {
161
- inputMethod,
162
- horizontalCells,
163
- verticalCells,
164
- totalCells: horizontalCells * verticalCells,
165
- totalRowCount,
166
- totalColumnCount,
167
- },
168
- eventType: EVENT_TYPE.TRACK,
169
- };
170
- }
171
- return;
172
- })(editorAnalyticsAPI)(splitCell);
127
+ (editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null) =>
128
+ (inputMethod: INPUT_METHOD.CONTEXT_MENU | INPUT_METHOD.FLOATING_TB) =>
129
+ withEditorAnalyticsAPI(({ selection }) => {
130
+ const { totalRowCount, totalColumnCount } = getSelectedCellInfo(selection);
131
+ const cell = findCellClosestToPos(selection.$anchor);
132
+ if (cell) {
133
+ const { rowspan: verticalCells, colspan: horizontalCells } = cell.node.attrs;
134
+
135
+ return {
136
+ action: TABLE_ACTION.SPLIT,
137
+ actionSubject: ACTION_SUBJECT.TABLE,
138
+ actionSubjectId: null,
139
+ attributes: {
140
+ inputMethod,
141
+ horizontalCells,
142
+ verticalCells,
143
+ totalCells: horizontalCells * verticalCells,
144
+ totalRowCount,
145
+ totalColumnCount,
146
+ },
147
+ eventType: EVENT_TYPE.TRACK,
148
+ };
149
+ }
150
+ return;
151
+ })(editorAnalyticsAPI)(splitCell);
173
152
 
174
153
  export const setColorWithAnalytics =
175
- (editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null) =>
176
- (
177
- inputMethod:
178
- | INPUT_METHOD.CONTEXT_MENU
179
- | INPUT_METHOD.FLOATING_TB
180
- | INPUT_METHOD.TABLE_CONTEXT_MENU,
181
- cellColor: string,
182
- targetCellPosition?: number,
183
- editorView?: EditorView | null,
184
- ) =>
185
- withEditorAnalyticsAPI(({ selection }) => {
186
- const {
187
- horizontalCells,
188
- verticalCells,
189
- totalCells,
190
- totalRowCount,
191
- totalColumnCount,
192
- } = getSelectedCellInfo(selection);
193
-
194
- return {
195
- action: TABLE_ACTION.COLORED,
196
- actionSubject: ACTION_SUBJECT.TABLE,
197
- actionSubjectId: null,
198
- attributes: {
199
- inputMethod,
200
- cellColor: (
201
- tableBackgroundColorPalette.get(cellColor.toLowerCase()) ||
202
- cellColor
203
- ).toLowerCase(),
204
- horizontalCells,
205
- verticalCells,
206
- totalCells,
207
- totalRowCount,
208
- totalColumnCount,
209
- },
210
- eventType: EVENT_TYPE.TRACK,
211
- };
212
- })(editorAnalyticsAPI)(
213
- setMultipleCellAttrs(
214
- { background: cellColor },
215
- targetCellPosition,
216
- editorView,
217
- ),
218
- );
154
+ (editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null) =>
155
+ (
156
+ inputMethod:
157
+ | INPUT_METHOD.CONTEXT_MENU
158
+ | INPUT_METHOD.FLOATING_TB
159
+ | INPUT_METHOD.TABLE_CONTEXT_MENU,
160
+ cellColor: string,
161
+ targetCellPosition?: number,
162
+ editorView?: EditorView | null,
163
+ ) =>
164
+ withEditorAnalyticsAPI(({ selection }) => {
165
+ const { horizontalCells, verticalCells, totalCells, totalRowCount, totalColumnCount } =
166
+ getSelectedCellInfo(selection);
167
+
168
+ return {
169
+ action: TABLE_ACTION.COLORED,
170
+ actionSubject: ACTION_SUBJECT.TABLE,
171
+ actionSubjectId: null,
172
+ attributes: {
173
+ inputMethod,
174
+ cellColor: (
175
+ tableBackgroundColorPalette.get(cellColor.toLowerCase()) || cellColor
176
+ ).toLowerCase(),
177
+ horizontalCells,
178
+ verticalCells,
179
+ totalCells,
180
+ totalRowCount,
181
+ totalColumnCount,
182
+ },
183
+ eventType: EVENT_TYPE.TRACK,
184
+ };
185
+ })(editorAnalyticsAPI)(
186
+ setMultipleCellAttrs({ background: cellColor }, targetCellPosition, editorView),
187
+ );
219
188
 
220
189
  export const addRowAroundSelection =
221
- (editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null) =>
222
- (side: RowInsertPosition): Command =>
223
- (state, dispatch) => {
224
- const { selection } = state;
225
- const isCellSelection = selection instanceof CellSelection;
226
- const rect = isCellSelection
227
- ? getSelectionRect(selection)
228
- : findCellRectClosestToPos(selection.$from);
229
-
230
- if (!rect) {
231
- return false;
232
- }
233
-
234
- const position =
235
- isCellSelection && side === 'TOP' ? rect.top : rect.bottom - 1;
236
-
237
- const offset = side === 'BOTTOM' ? 1 : 0;
238
-
239
- return insertRowWithAnalytics(editorAnalyticsAPI)(INPUT_METHOD.SHORTCUT, {
240
- index: position + offset,
241
- moveCursorToInsertedRow: false,
242
- })(state, dispatch);
243
- };
190
+ (editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null) =>
191
+ (side: RowInsertPosition): Command =>
192
+ (state, dispatch) => {
193
+ const { selection } = state;
194
+ const isCellSelection = selection instanceof CellSelection;
195
+ const rect = isCellSelection
196
+ ? getSelectionRect(selection)
197
+ : findCellRectClosestToPos(selection.$from);
198
+
199
+ if (!rect) {
200
+ return false;
201
+ }
202
+
203
+ const position = isCellSelection && side === 'TOP' ? rect.top : rect.bottom - 1;
204
+
205
+ const offset = side === 'BOTTOM' ? 1 : 0;
206
+
207
+ return insertRowWithAnalytics(editorAnalyticsAPI)(INPUT_METHOD.SHORTCUT, {
208
+ index: position + offset,
209
+ moveCursorToInsertedRow: false,
210
+ })(state, dispatch);
211
+ };
244
212
 
245
213
  export const insertRowWithAnalytics =
246
- (
247
- editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null,
248
- isCellbackgroundDuplicated = false,
249
- ) =>
250
- (inputMethod: InsertRowMethods, options: InsertRowOptions) =>
251
- withEditorAnalyticsAPI((state) => {
252
- const { totalRowCount, totalColumnCount } = getSelectedTableInfo(
253
- state.selection,
254
- );
255
- return {
256
- action: TABLE_ACTION.ADDED_ROW,
257
- actionSubject: ACTION_SUBJECT.TABLE,
258
- actionSubjectId: null,
259
- attributes: {
260
- inputMethod,
261
- position: options.index,
262
- totalRowCount,
263
- totalColumnCount,
264
- },
265
- eventType: EVENT_TYPE.TRACK,
266
- };
267
- })(editorAnalyticsAPI)(
268
- insertRow(
269
- options.index,
270
- options.moveCursorToInsertedRow,
271
- isCellbackgroundDuplicated,
272
- ),
273
- );
214
+ (editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null, isCellbackgroundDuplicated = false) =>
215
+ (inputMethod: InsertRowMethods, options: InsertRowOptions) =>
216
+ withEditorAnalyticsAPI((state) => {
217
+ const { totalRowCount, totalColumnCount } = getSelectedTableInfo(state.selection);
218
+ return {
219
+ action: TABLE_ACTION.ADDED_ROW,
220
+ actionSubject: ACTION_SUBJECT.TABLE,
221
+ actionSubjectId: null,
222
+ attributes: {
223
+ inputMethod,
224
+ position: options.index,
225
+ totalRowCount,
226
+ totalColumnCount,
227
+ },
228
+ eventType: EVENT_TYPE.TRACK,
229
+ };
230
+ })(editorAnalyticsAPI)(
231
+ insertRow(options.index, options.moveCursorToInsertedRow, isCellbackgroundDuplicated),
232
+ );
274
233
 
275
234
  export const changeColumnWidthByStepWithAnalytics =
276
- (editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null) =>
277
- (
278
- stepSize: number,
279
- getEditorContainerWidth: GetEditorContainerWidth,
280
- isTableScalingEnabled: boolean,
281
- inputMethod: INPUT_METHOD.SHORTCUT,
282
- ariaNotify?: (message: string) => void,
283
- getIntl?: () => IntlShape,
284
- ) =>
285
- withEditorAnalyticsAPI((state) => {
286
- const { table, totalRowCount, totalColumnCount } = getSelectedTableInfo(
287
- state.selection,
288
- );
289
- const {
290
- hoveredCell: { colIndex },
291
- } = getPluginState(state);
292
-
293
- return {
294
- action: TABLE_ACTION.COLUMN_RESIZED,
295
- actionSubject: ACTION_SUBJECT.TABLE,
296
- eventType: EVENT_TYPE.TRACK,
297
- attributes: {
298
- colIndex,
299
- resizedDelta: stepSize,
300
- isLastColumn: colIndex === totalColumnCount - 1,
301
- tableWidth: table?.node.attrs.width,
302
- inputMethod,
303
- totalRowCount,
304
- totalColumnCount,
305
- },
306
- };
307
- })(editorAnalyticsAPI)(
308
- changeColumnWidthByStep({
309
- stepSize: stepSize,
310
- getEditorContainerWidth: getEditorContainerWidth,
311
- isTableScalingEnabled: isTableScalingEnabled,
312
- ariaNotify: ariaNotify,
313
- getIntl: getIntl,
314
- }),
315
- );
235
+ (editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null) =>
236
+ (
237
+ stepSize: number,
238
+ getEditorContainerWidth: GetEditorContainerWidth,
239
+ isTableScalingEnabled: boolean,
240
+ inputMethod: INPUT_METHOD.SHORTCUT,
241
+ ariaNotify?: (message: string) => void,
242
+ getIntl?: () => IntlShape,
243
+ ) =>
244
+ withEditorAnalyticsAPI((state) => {
245
+ const { table, totalRowCount, totalColumnCount } = getSelectedTableInfo(state.selection);
246
+ const {
247
+ hoveredCell: { colIndex },
248
+ } = getPluginState(state);
249
+
250
+ return {
251
+ action: TABLE_ACTION.COLUMN_RESIZED,
252
+ actionSubject: ACTION_SUBJECT.TABLE,
253
+ eventType: EVENT_TYPE.TRACK,
254
+ attributes: {
255
+ colIndex,
256
+ resizedDelta: stepSize,
257
+ isLastColumn: colIndex === totalColumnCount - 1,
258
+ tableWidth: table?.node.attrs.width,
259
+ inputMethod,
260
+ totalRowCount,
261
+ totalColumnCount,
262
+ },
263
+ };
264
+ })(editorAnalyticsAPI)(
265
+ changeColumnWidthByStep({
266
+ stepSize: stepSize,
267
+ getEditorContainerWidth: getEditorContainerWidth,
268
+ isTableScalingEnabled: isTableScalingEnabled,
269
+ ariaNotify: ariaNotify,
270
+ getIntl: getIntl,
271
+ }),
272
+ );
316
273
 
317
274
  export const insertColumnWithAnalytics =
318
- (
319
- editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null,
320
- isTableScalingEnabled = false,
321
- isCellbackgroundDuplicated = false,
322
- ) =>
323
- (
324
- inputMethod:
325
- | INPUT_METHOD.CONTEXT_MENU
326
- | INPUT_METHOD.BUTTON
327
- | INPUT_METHOD.SHORTCUT
328
- | INPUT_METHOD.FLOATING_TB
329
- | INPUT_METHOD.TABLE_CONTEXT_MENU,
330
- position: number,
331
- ) =>
332
- withEditorAnalyticsAPI((state) => {
333
- const { totalRowCount, totalColumnCount } = getSelectedTableInfo(
334
- state.selection,
335
- );
336
- return {
337
- action: TABLE_ACTION.ADDED_COLUMN,
338
- actionSubject: ACTION_SUBJECT.TABLE,
339
- actionSubjectId: null,
340
- attributes: {
341
- inputMethod,
342
- position,
343
- totalRowCount,
344
- totalColumnCount,
345
- },
346
- eventType: EVENT_TYPE.TRACK,
347
- };
348
- })(editorAnalyticsAPI)(
349
- insertColumn(isTableScalingEnabled, isCellbackgroundDuplicated)(position),
350
- );
275
+ (
276
+ editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null,
277
+ isTableScalingEnabled = false,
278
+ isCellbackgroundDuplicated = false,
279
+ ) =>
280
+ (
281
+ inputMethod:
282
+ | INPUT_METHOD.CONTEXT_MENU
283
+ | INPUT_METHOD.BUTTON
284
+ | INPUT_METHOD.SHORTCUT
285
+ | INPUT_METHOD.FLOATING_TB
286
+ | INPUT_METHOD.TABLE_CONTEXT_MENU,
287
+ position: number,
288
+ ) =>
289
+ withEditorAnalyticsAPI((state) => {
290
+ const { totalRowCount, totalColumnCount } = getSelectedTableInfo(state.selection);
291
+ return {
292
+ action: TABLE_ACTION.ADDED_COLUMN,
293
+ actionSubject: ACTION_SUBJECT.TABLE,
294
+ actionSubjectId: null,
295
+ attributes: {
296
+ inputMethod,
297
+ position,
298
+ totalRowCount,
299
+ totalColumnCount,
300
+ },
301
+ eventType: EVENT_TYPE.TRACK,
302
+ };
303
+ })(editorAnalyticsAPI)(
304
+ insertColumn(isTableScalingEnabled, isCellbackgroundDuplicated)(position),
305
+ );
351
306
 
352
307
  export const deleteRowsWithAnalytics =
353
- (editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null) =>
354
- (
355
- inputMethod:
356
- | INPUT_METHOD.CONTEXT_MENU
357
- | INPUT_METHOD.BUTTON
358
- | INPUT_METHOD.FLOATING_TB
359
- | INPUT_METHOD.SHORTCUT
360
- | INPUT_METHOD.TABLE_CONTEXT_MENU,
361
- rect: Rect,
362
- isHeaderRowRequired: boolean,
363
- ) =>
364
- withEditorAnalyticsAPI(({ selection }) => {
365
- const { totalRowCount, totalColumnCount } =
366
- getSelectedTableInfo(selection);
367
-
368
- return {
369
- action: TABLE_ACTION.DELETED_ROW,
370
- actionSubject: ACTION_SUBJECT.TABLE,
371
- actionSubjectId: null,
372
- attributes: {
373
- inputMethod,
374
- position: rect.top,
375
- count: rect.bottom - rect.top,
376
- totalRowCount,
377
- totalColumnCount,
378
- },
379
- eventType: EVENT_TYPE.TRACK,
380
- };
381
- })(editorAnalyticsAPI)((state, dispatch) => {
382
- if (dispatch) {
383
- dispatch(deleteRows(rect, isHeaderRowRequired)(state.tr));
384
- }
385
- return true;
386
- });
308
+ (editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null) =>
309
+ (
310
+ inputMethod:
311
+ | INPUT_METHOD.CONTEXT_MENU
312
+ | INPUT_METHOD.BUTTON
313
+ | INPUT_METHOD.FLOATING_TB
314
+ | INPUT_METHOD.SHORTCUT
315
+ | INPUT_METHOD.TABLE_CONTEXT_MENU,
316
+ rect: Rect,
317
+ isHeaderRowRequired: boolean,
318
+ ) =>
319
+ withEditorAnalyticsAPI(({ selection }) => {
320
+ const { totalRowCount, totalColumnCount } = getSelectedTableInfo(selection);
321
+
322
+ return {
323
+ action: TABLE_ACTION.DELETED_ROW,
324
+ actionSubject: ACTION_SUBJECT.TABLE,
325
+ actionSubjectId: null,
326
+ attributes: {
327
+ inputMethod,
328
+ position: rect.top,
329
+ count: rect.bottom - rect.top,
330
+ totalRowCount,
331
+ totalColumnCount,
332
+ },
333
+ eventType: EVENT_TYPE.TRACK,
334
+ };
335
+ })(editorAnalyticsAPI)((state, dispatch) => {
336
+ if (dispatch) {
337
+ dispatch(deleteRows(rect, isHeaderRowRequired)(state.tr));
338
+ }
339
+ return true;
340
+ });
387
341
 
388
342
  export const deleteColumnsWithAnalytics =
389
- (
390
- editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null,
391
- isTableScalingEnabled = false,
392
- ) =>
393
- (
394
- inputMethod:
395
- | INPUT_METHOD.CONTEXT_MENU
396
- | INPUT_METHOD.BUTTON
397
- | INPUT_METHOD.FLOATING_TB
398
- | INPUT_METHOD.SHORTCUT
399
- | INPUT_METHOD.TABLE_CONTEXT_MENU,
400
- rect: Rect,
401
- ) =>
402
- withEditorAnalyticsAPI(({ selection }) => {
403
- const { totalRowCount, totalColumnCount } =
404
- getSelectedTableInfo(selection);
405
-
406
- return {
407
- action: TABLE_ACTION.DELETED_COLUMN,
408
- actionSubject: ACTION_SUBJECT.TABLE,
409
- actionSubjectId: null,
410
- attributes: {
411
- inputMethod,
412
- position: rect.left,
413
- count: rect.right - rect.left,
414
- totalRowCount,
415
- totalColumnCount,
416
- },
417
- eventType: EVENT_TYPE.TRACK,
418
- };
419
- })(editorAnalyticsAPI)(deleteColumnsCommand(rect, isTableScalingEnabled));
343
+ (editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null, isTableScalingEnabled = false) =>
344
+ (
345
+ inputMethod:
346
+ | INPUT_METHOD.CONTEXT_MENU
347
+ | INPUT_METHOD.BUTTON
348
+ | INPUT_METHOD.FLOATING_TB
349
+ | INPUT_METHOD.SHORTCUT
350
+ | INPUT_METHOD.TABLE_CONTEXT_MENU,
351
+ rect: Rect,
352
+ ) =>
353
+ withEditorAnalyticsAPI(({ selection }) => {
354
+ const { totalRowCount, totalColumnCount } = getSelectedTableInfo(selection);
355
+
356
+ return {
357
+ action: TABLE_ACTION.DELETED_COLUMN,
358
+ actionSubject: ACTION_SUBJECT.TABLE,
359
+ actionSubjectId: null,
360
+ attributes: {
361
+ inputMethod,
362
+ position: rect.left,
363
+ count: rect.right - rect.left,
364
+ totalRowCount,
365
+ totalColumnCount,
366
+ },
367
+ eventType: EVENT_TYPE.TRACK,
368
+ };
369
+ })(editorAnalyticsAPI)(deleteColumnsCommand(rect, isTableScalingEnabled));
420
370
 
421
371
  export const deleteSelectedRowsOrColumnsWithAnalyticsViaShortcut =
422
- (editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null): Command =>
423
- (state, dispatch) => {
424
- const { selection } = state;
425
- const isCellSelection = selection instanceof CellSelection;
426
- if (!isCellSelection) {
427
- return false;
428
- }
429
-
430
- const rect = getSelectionRect(selection);
431
- if (!rect) {
432
- return false;
433
- }
434
-
435
- const selectionType = getTableSelectionType(selection);
436
- if (selectionType === 'row') {
437
- const { pluginConfig } = getPluginState(state);
438
- const isHeaderRowRequired = pluginConfig.isHeaderRowRequired || false;
439
-
440
- return deleteRowsWithAnalytics(editorAnalyticsAPI)(
441
- INPUT_METHOD.SHORTCUT,
442
- rect,
443
- isHeaderRowRequired,
444
- )(state, dispatch);
445
- } else if (selectionType === 'column') {
446
- return deleteColumnsWithAnalytics(editorAnalyticsAPI)(
447
- INPUT_METHOD.SHORTCUT,
448
- rect,
449
- )(state, dispatch);
450
- } else {
451
- return false;
452
- }
453
- };
372
+ (editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null): Command =>
373
+ (state, dispatch) => {
374
+ const { selection } = state;
375
+ const isCellSelection = selection instanceof CellSelection;
376
+ if (!isCellSelection) {
377
+ return false;
378
+ }
379
+
380
+ const rect = getSelectionRect(selection);
381
+ if (!rect) {
382
+ return false;
383
+ }
384
+
385
+ const selectionType = getTableSelectionType(selection);
386
+ if (selectionType === 'row') {
387
+ const { pluginConfig } = getPluginState(state);
388
+ const isHeaderRowRequired = pluginConfig.isHeaderRowRequired || false;
389
+
390
+ return deleteRowsWithAnalytics(editorAnalyticsAPI)(
391
+ INPUT_METHOD.SHORTCUT,
392
+ rect,
393
+ isHeaderRowRequired,
394
+ )(state, dispatch);
395
+ } else if (selectionType === 'column') {
396
+ return deleteColumnsWithAnalytics(editorAnalyticsAPI)(INPUT_METHOD.SHORTCUT, rect)(
397
+ state,
398
+ dispatch,
399
+ );
400
+ } else {
401
+ return false;
402
+ }
403
+ };
454
404
 
455
405
  const getTableDeletedAnalytics = (
456
- selection: Selection,
457
- inputMethod: INPUT_METHOD.FLOATING_TB | INPUT_METHOD.KEYBOARD,
406
+ selection: Selection,
407
+ inputMethod: INPUT_METHOD.FLOATING_TB | INPUT_METHOD.KEYBOARD,
458
408
  ): AnalyticsEventPayload => {
459
- const { totalRowCount, totalColumnCount } = getSelectedTableInfo(selection);
460
- return {
461
- action: TABLE_ACTION.DELETED,
462
- actionSubject: ACTION_SUBJECT.TABLE,
463
- attributes: {
464
- inputMethod,
465
- totalRowCount,
466
- totalColumnCount,
467
- },
468
- eventType: EVENT_TYPE.TRACK,
469
- };
409
+ const { totalRowCount, totalColumnCount } = getSelectedTableInfo(selection);
410
+ return {
411
+ action: TABLE_ACTION.DELETED,
412
+ actionSubject: ACTION_SUBJECT.TABLE,
413
+ attributes: {
414
+ inputMethod,
415
+ totalRowCount,
416
+ totalColumnCount,
417
+ },
418
+ eventType: EVENT_TYPE.TRACK,
419
+ };
470
420
  };
471
421
 
472
422
  export const deleteTableWithAnalytics = (
473
- editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null,
423
+ editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null,
474
424
  ) =>
475
- withEditorAnalyticsAPI(({ selection }) =>
476
- getTableDeletedAnalytics(selection, INPUT_METHOD.FLOATING_TB),
477
- )(editorAnalyticsAPI)(deleteTable);
425
+ withEditorAnalyticsAPI(({ selection }) =>
426
+ getTableDeletedAnalytics(selection, INPUT_METHOD.FLOATING_TB),
427
+ )(editorAnalyticsAPI)(deleteTable);
478
428
 
479
429
  export const deleteTableIfSelectedWithAnalytics =
480
- (editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null) =>
481
- (inputMethod: INPUT_METHOD.FLOATING_TB | INPUT_METHOD.KEYBOARD) =>
482
- withEditorAnalyticsAPI(({ selection }) =>
483
- getTableDeletedAnalytics(selection, inputMethod),
484
- )(editorAnalyticsAPI)(deleteTableIfSelected);
430
+ (editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null) =>
431
+ (inputMethod: INPUT_METHOD.FLOATING_TB | INPUT_METHOD.KEYBOARD) =>
432
+ withEditorAnalyticsAPI(({ selection }) => getTableDeletedAnalytics(selection, inputMethod))(
433
+ editorAnalyticsAPI,
434
+ )(deleteTableIfSelected);
485
435
 
486
436
  export const toggleHeaderRowWithAnalytics = (
487
- editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null,
437
+ editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null,
488
438
  ) =>
489
- withEditorAnalyticsAPI((state) => {
490
- const { totalRowCount, totalColumnCount } = getSelectedTableInfo(
491
- state.selection,
492
- );
493
- const { isHeaderRowEnabled } = getPluginState(state);
494
-
495
- return {
496
- action: TABLE_ACTION.TOGGLED_HEADER_ROW,
497
- actionSubject: ACTION_SUBJECT.TABLE,
498
- actionSubjectId: null,
499
- attributes: {
500
- newState: !isHeaderRowEnabled,
501
- totalRowCount,
502
- totalColumnCount,
503
- },
504
- eventType: EVENT_TYPE.TRACK,
505
- };
506
- })(editorAnalyticsAPI)(toggleHeaderRow);
439
+ withEditorAnalyticsAPI((state) => {
440
+ const { totalRowCount, totalColumnCount } = getSelectedTableInfo(state.selection);
441
+ const { isHeaderRowEnabled } = getPluginState(state);
442
+
443
+ return {
444
+ action: TABLE_ACTION.TOGGLED_HEADER_ROW,
445
+ actionSubject: ACTION_SUBJECT.TABLE,
446
+ actionSubjectId: null,
447
+ attributes: {
448
+ newState: !isHeaderRowEnabled,
449
+ totalRowCount,
450
+ totalColumnCount,
451
+ },
452
+ eventType: EVENT_TYPE.TRACK,
453
+ };
454
+ })(editorAnalyticsAPI)(toggleHeaderRow);
507
455
 
508
456
  export const toggleHeaderColumnWithAnalytics = (
509
- editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null,
457
+ editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null,
510
458
  ) =>
511
- withEditorAnalyticsAPI((state) => {
512
- const { totalRowCount, totalColumnCount } = getSelectedTableInfo(
513
- state.selection,
514
- );
515
- const { isHeaderColumnEnabled } = getPluginState(state);
516
-
517
- return {
518
- action: TABLE_ACTION.TOGGLED_HEADER_COLUMN,
519
- actionSubject: ACTION_SUBJECT.TABLE,
520
- actionSubjectId: null,
521
- attributes: {
522
- newState: !isHeaderColumnEnabled,
523
- totalRowCount,
524
- totalColumnCount,
525
- },
526
- eventType: EVENT_TYPE.TRACK,
527
- };
528
- })(editorAnalyticsAPI)(toggleHeaderColumn);
459
+ withEditorAnalyticsAPI((state) => {
460
+ const { totalRowCount, totalColumnCount } = getSelectedTableInfo(state.selection);
461
+ const { isHeaderColumnEnabled } = getPluginState(state);
462
+
463
+ return {
464
+ action: TABLE_ACTION.TOGGLED_HEADER_COLUMN,
465
+ actionSubject: ACTION_SUBJECT.TABLE,
466
+ actionSubjectId: null,
467
+ attributes: {
468
+ newState: !isHeaderColumnEnabled,
469
+ totalRowCount,
470
+ totalColumnCount,
471
+ },
472
+ eventType: EVENT_TYPE.TRACK,
473
+ };
474
+ })(editorAnalyticsAPI)(toggleHeaderColumn);
529
475
 
530
476
  export const toggleNumberColumnWithAnalytics = (
531
- editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null,
477
+ editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null,
532
478
  ) =>
533
- withEditorAnalyticsAPI((state) => {
534
- const { totalRowCount, totalColumnCount } = getSelectedTableInfo(
535
- state.selection,
536
- );
537
- return {
538
- action: TABLE_ACTION.TOGGLED_NUMBER_COLUMN,
539
- actionSubject: ACTION_SUBJECT.TABLE,
540
- actionSubjectId: null,
541
- attributes: {
542
- newState: !checkIfNumberColumnEnabled(state.selection),
543
- totalRowCount,
544
- totalColumnCount,
545
- },
546
- eventType: EVENT_TYPE.TRACK,
547
- };
548
- })(editorAnalyticsAPI)(toggleNumberColumn);
479
+ withEditorAnalyticsAPI((state) => {
480
+ const { totalRowCount, totalColumnCount } = getSelectedTableInfo(state.selection);
481
+ return {
482
+ action: TABLE_ACTION.TOGGLED_NUMBER_COLUMN,
483
+ actionSubject: ACTION_SUBJECT.TABLE,
484
+ actionSubjectId: null,
485
+ attributes: {
486
+ newState: !checkIfNumberColumnEnabled(state.selection),
487
+ totalRowCount,
488
+ totalColumnCount,
489
+ },
490
+ eventType: EVENT_TYPE.TRACK,
491
+ };
492
+ })(editorAnalyticsAPI)(toggleNumberColumn);
549
493
 
550
494
  export const toggleTableLayoutWithAnalytics = (
551
- editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null,
495
+ editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null,
552
496
  ) =>
553
- withEditorAnalyticsAPI((state) => {
554
- const { table, totalRowCount, totalColumnCount } = getSelectedTableInfo(
555
- state.selection,
556
- );
557
-
558
- if (table) {
559
- const { layout } = table.node.attrs as {
560
- layout: 'default' | 'wide' | 'full-width';
561
- };
562
- return {
563
- action: TABLE_ACTION.CHANGED_BREAKOUT_MODE,
564
- actionSubject: ACTION_SUBJECT.TABLE,
565
- actionSubjectId: null,
566
- attributes: {
567
- newBreakoutMode: TABLE_BREAKOUT_NAME_MAPPING[getNextLayout(layout)],
568
- previousBreakoutMode: TABLE_BREAKOUT_NAME_MAPPING[layout],
569
- totalRowCount,
570
- totalColumnCount,
571
- },
572
- eventType: EVENT_TYPE.TRACK,
573
- };
574
- }
575
- return;
576
- })(editorAnalyticsAPI)(toggleTableLayout);
497
+ withEditorAnalyticsAPI((state) => {
498
+ const { table, totalRowCount, totalColumnCount } = getSelectedTableInfo(state.selection);
499
+
500
+ if (table) {
501
+ const { layout } = table.node.attrs as {
502
+ layout: 'default' | 'wide' | 'full-width';
503
+ };
504
+ return {
505
+ action: TABLE_ACTION.CHANGED_BREAKOUT_MODE,
506
+ actionSubject: ACTION_SUBJECT.TABLE,
507
+ actionSubjectId: null,
508
+ attributes: {
509
+ newBreakoutMode: TABLE_BREAKOUT_NAME_MAPPING[getNextLayout(layout)],
510
+ previousBreakoutMode: TABLE_BREAKOUT_NAME_MAPPING[layout],
511
+ totalRowCount,
512
+ totalColumnCount,
513
+ },
514
+ eventType: EVENT_TYPE.TRACK,
515
+ };
516
+ }
517
+ return;
518
+ })(editorAnalyticsAPI)(toggleTableLayout);
577
519
 
578
520
  export const sortColumnWithAnalytics =
579
- (editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null) =>
580
- (
581
- inputMethod:
582
- | INPUT_METHOD.CONTEXT_MENU
583
- | INPUT_METHOD.FLOATING_TB
584
- | INPUT_METHOD.TABLE_CONTEXT_MENU,
585
- columnIndex: number,
586
- sortOrder: SortOrder,
587
- ) =>
588
- withEditorAnalyticsAPI((state) => {
589
- const { totalRowCount, totalColumnCount } = getSelectedTableInfo(
590
- state.selection,
591
- );
592
- return {
593
- action: TABLE_ACTION.SORTED_COLUMN,
594
- actionSubject: ACTION_SUBJECT.TABLE,
595
- attributes: {
596
- inputMethod,
597
- totalRowCount,
598
- totalColumnCount,
599
- position: columnIndex,
600
- sortOrder,
601
- mode: 'editor',
602
- },
603
- eventType: EVENT_TYPE.TRACK,
604
- };
605
- })(editorAnalyticsAPI)(sortByColumn(columnIndex, sortOrder));
521
+ (editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null) =>
522
+ (
523
+ inputMethod:
524
+ | INPUT_METHOD.CONTEXT_MENU
525
+ | INPUT_METHOD.FLOATING_TB
526
+ | INPUT_METHOD.TABLE_CONTEXT_MENU,
527
+ columnIndex: number,
528
+ sortOrder: SortOrder,
529
+ ) =>
530
+ withEditorAnalyticsAPI((state) => {
531
+ const { totalRowCount, totalColumnCount } = getSelectedTableInfo(state.selection);
532
+ return {
533
+ action: TABLE_ACTION.SORTED_COLUMN,
534
+ actionSubject: ACTION_SUBJECT.TABLE,
535
+ attributes: {
536
+ inputMethod,
537
+ totalRowCount,
538
+ totalColumnCount,
539
+ position: columnIndex,
540
+ sortOrder,
541
+ mode: 'editor',
542
+ },
543
+ eventType: EVENT_TYPE.TRACK,
544
+ };
545
+ })(editorAnalyticsAPI)(sortByColumn(columnIndex, sortOrder));
606
546
 
607
547
  export const distributeColumnsWidthsWithAnalytics =
608
- (editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null) =>
609
- (
610
- inputMethod:
611
- | INPUT_METHOD.CONTEXT_MENU
612
- | INPUT_METHOD.FLOATING_TB
613
- | INPUT_METHOD.TABLE_CONTEXT_MENU,
614
- { resizeState, table, attributes }: ResizeStateWithAnalytics,
615
- ) => {
616
- return withEditorAnalyticsAPI(() => {
617
- return {
618
- action: TABLE_ACTION.DISTRIBUTED_COLUMNS_WIDTHS,
619
- actionSubject: ACTION_SUBJECT.TABLE,
620
- actionSubjectId: null,
621
- attributes: {
622
- inputMethod,
623
- ...attributes,
624
- },
625
- eventType: EVENT_TYPE.TRACK,
626
- };
627
- })(editorAnalyticsAPI)((state, dispatch) => {
628
- if (dispatch) {
629
- distributeColumnsWidths(resizeState, table)(state, dispatch);
630
- }
631
- return true;
632
- });
633
- };
548
+ (editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null) =>
549
+ (
550
+ inputMethod:
551
+ | INPUT_METHOD.CONTEXT_MENU
552
+ | INPUT_METHOD.FLOATING_TB
553
+ | INPUT_METHOD.TABLE_CONTEXT_MENU,
554
+ { resizeState, table, attributes }: ResizeStateWithAnalytics,
555
+ ) => {
556
+ return withEditorAnalyticsAPI(() => {
557
+ return {
558
+ action: TABLE_ACTION.DISTRIBUTED_COLUMNS_WIDTHS,
559
+ actionSubject: ACTION_SUBJECT.TABLE,
560
+ actionSubjectId: null,
561
+ attributes: {
562
+ inputMethod,
563
+ ...attributes,
564
+ },
565
+ eventType: EVENT_TYPE.TRACK,
566
+ };
567
+ })(editorAnalyticsAPI)((state, dispatch) => {
568
+ if (dispatch) {
569
+ distributeColumnsWidths(resizeState, table)(state, dispatch);
570
+ }
571
+ return true;
572
+ });
573
+ };
634
574
 
635
575
  export const wrapTableInExpandWithAnalytics = (
636
- editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null,
576
+ editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null,
637
577
  ) =>
638
- withEditorAnalyticsAPI((state) => {
639
- const { totalRowCount, totalColumnCount } = getSelectedTableInfo(
640
- state.selection,
641
- );
642
- return {
643
- action: TABLE_ACTION.COLLAPSED,
644
- actionSubject: ACTION_SUBJECT.TABLE,
645
- actionSubjectId: null,
646
- attributes: {
647
- totalRowCount,
648
- totalColumnCount,
649
- },
650
- eventType: EVENT_TYPE.TRACK,
651
- };
652
- })(editorAnalyticsAPI)(wrapTableInExpand);
578
+ withEditorAnalyticsAPI((state) => {
579
+ const { totalRowCount, totalColumnCount } = getSelectedTableInfo(state.selection);
580
+ return {
581
+ action: TABLE_ACTION.COLLAPSED,
582
+ actionSubject: ACTION_SUBJECT.TABLE,
583
+ actionSubjectId: null,
584
+ attributes: {
585
+ totalRowCount,
586
+ totalColumnCount,
587
+ },
588
+ eventType: EVENT_TYPE.TRACK,
589
+ };
590
+ })(editorAnalyticsAPI)(wrapTableInExpand);
653
591
 
654
592
  export const toggleTableLockWithAnalytics =
655
- (editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null) =>
656
- (
657
- displayMode: TABLE_DISPLAY_MODE | null,
658
- inputMethod: INPUT_METHOD.CONTEXT_MENU | INPUT_METHOD.FLOATING_TB,
659
- ) =>
660
- withEditorAnalyticsAPI((state) => {
661
- const { table, totalRowCount, totalColumnCount } = getSelectedTableInfo(
662
- state.selection,
663
- );
664
-
665
- let previousDisplayMode: TABLE_DISPLAY_MODE;
666
- let newDisplayMode: TABLE_DISPLAY_MODE;
667
-
668
- switch (displayMode) {
669
- case 'fixed':
670
- previousDisplayMode = TABLE_DISPLAY_MODE.FIXED;
671
- newDisplayMode = TABLE_DISPLAY_MODE.DEFAULT;
672
- break;
673
- case 'default':
674
- previousDisplayMode = TABLE_DISPLAY_MODE.DEFAULT;
675
- newDisplayMode = TABLE_DISPLAY_MODE.FIXED;
676
- break;
677
- case null:
678
- default:
679
- previousDisplayMode = TABLE_DISPLAY_MODE.INITIAL;
680
- newDisplayMode = TABLE_DISPLAY_MODE.FIXED;
681
- }
682
-
683
- return {
684
- action: TABLE_ACTION.CHANGED_DISPLAY_MODE,
685
- actionSubject: ACTION_SUBJECT.TABLE,
686
- attributes: {
687
- inputMethod,
688
- previousDisplayMode,
689
- newDisplayMode,
690
- tableWidth: table?.node.attrs.width,
691
- totalRowCount,
692
- totalColumnCount,
693
- },
694
- eventType: EVENT_TYPE.TRACK,
695
- };
696
- })(editorAnalyticsAPI)(editorCommandToPMCommand(setTableDisplayMode));
593
+ (editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null) =>
594
+ (
595
+ displayMode: TABLE_DISPLAY_MODE | null,
596
+ inputMethod: INPUT_METHOD.CONTEXT_MENU | INPUT_METHOD.FLOATING_TB,
597
+ ) =>
598
+ withEditorAnalyticsAPI((state) => {
599
+ const { table, totalRowCount, totalColumnCount } = getSelectedTableInfo(state.selection);
600
+
601
+ let previousDisplayMode: TABLE_DISPLAY_MODE;
602
+ let newDisplayMode: TABLE_DISPLAY_MODE;
603
+
604
+ switch (displayMode) {
605
+ case 'fixed':
606
+ previousDisplayMode = TABLE_DISPLAY_MODE.FIXED;
607
+ newDisplayMode = TABLE_DISPLAY_MODE.DEFAULT;
608
+ break;
609
+ case 'default':
610
+ previousDisplayMode = TABLE_DISPLAY_MODE.DEFAULT;
611
+ newDisplayMode = TABLE_DISPLAY_MODE.FIXED;
612
+ break;
613
+ case null:
614
+ default:
615
+ previousDisplayMode = TABLE_DISPLAY_MODE.INITIAL;
616
+ newDisplayMode = TABLE_DISPLAY_MODE.FIXED;
617
+ }
618
+
619
+ return {
620
+ action: TABLE_ACTION.CHANGED_DISPLAY_MODE,
621
+ actionSubject: ACTION_SUBJECT.TABLE,
622
+ attributes: {
623
+ inputMethod,
624
+ previousDisplayMode,
625
+ newDisplayMode,
626
+ tableWidth: table?.node.attrs.width,
627
+ totalRowCount,
628
+ totalColumnCount,
629
+ },
630
+ eventType: EVENT_TYPE.TRACK,
631
+ };
632
+ })(editorAnalyticsAPI)(editorCommandToPMCommand(setTableDisplayMode));
697
633
 
698
634
  export const setTableAlignmentWithAnalytics =
699
- (editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null) =>
700
- (
701
- newAlignment: AlignmentOptions,
702
- // previous alignment could be a breakout value, if so use 'null' to indicate alignment was not previously set
703
- previousAlignment: TableLayout,
704
- inputMethod: INPUT_METHOD.FLOATING_TB,
705
- ) =>
706
- withEditorAnalyticsAPI((state) => {
707
- const { table, totalRowCount, totalColumnCount } = getSelectedTableInfo(
708
- state.selection,
709
- );
710
-
711
- return {
712
- action: TABLE_ACTION.CHANGED_ALIGNMENT,
713
- actionSubject: ACTION_SUBJECT.TABLE,
714
- actionSubjectId: null,
715
- eventType: EVENT_TYPE.TRACK,
716
- attributes: {
717
- tableWidth: table?.node.attrs.width,
718
- newAlignment,
719
- previousAlignment:
720
- previousAlignment === 'center' ||
721
- previousAlignment === 'align-start'
722
- ? previousAlignment
723
- : null,
724
- totalRowCount,
725
- totalColumnCount,
726
- inputMethod,
727
- },
728
- };
729
- })(editorAnalyticsAPI)(
730
- editorCommandToPMCommand(setTableAlignment(newAlignment)),
731
- );
635
+ (editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null) =>
636
+ (
637
+ newAlignment: AlignmentOptions,
638
+ // previous alignment could be a breakout value, if so use 'null' to indicate alignment was not previously set
639
+ previousAlignment: TableLayout,
640
+ inputMethod: INPUT_METHOD.FLOATING_TB,
641
+ ) =>
642
+ withEditorAnalyticsAPI((state) => {
643
+ const { table, totalRowCount, totalColumnCount } = getSelectedTableInfo(state.selection);
644
+
645
+ return {
646
+ action: TABLE_ACTION.CHANGED_ALIGNMENT,
647
+ actionSubject: ACTION_SUBJECT.TABLE,
648
+ actionSubjectId: null,
649
+ eventType: EVENT_TYPE.TRACK,
650
+ attributes: {
651
+ tableWidth: table?.node.attrs.width,
652
+ newAlignment,
653
+ previousAlignment:
654
+ previousAlignment === 'center' || previousAlignment === 'align-start'
655
+ ? previousAlignment
656
+ : null,
657
+ totalRowCount,
658
+ totalColumnCount,
659
+ inputMethod,
660
+ },
661
+ };
662
+ })(editorAnalyticsAPI)(editorCommandToPMCommand(setTableAlignment(newAlignment)));