@atlaskit/editor-plugin-table 7.25.9 → 7.25.11

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 (365) hide show
  1. package/CHANGELOG.md +24 -0
  2. package/dist/cjs/commands/clear.js +2 -14
  3. package/dist/cjs/commands/column-resize.js +11 -5
  4. package/dist/cjs/commands/delete.js +2 -1
  5. package/dist/cjs/commands/insert.js +8 -5
  6. package/dist/cjs/commands/selection.js +3 -3
  7. package/dist/cjs/commands-with-analytics.js +23 -52
  8. package/dist/cjs/nodeviews/TableComponent.js +29 -14
  9. package/dist/cjs/nodeviews/TableContainer.js +2 -2
  10. package/dist/cjs/nodeviews/TableResizer.js +1 -1
  11. package/dist/cjs/plugin.js +4 -2
  12. package/dist/cjs/pm-plugins/decorations/utils/index.js +1 -8
  13. package/dist/cjs/pm-plugins/drag-and-drop/commands.js +3 -3
  14. package/dist/cjs/pm-plugins/drag-and-drop/index.js +1 -14
  15. package/dist/cjs/pm-plugins/drag-and-drop/plugin.js +4 -1
  16. package/dist/cjs/pm-plugins/drag-and-drop/utils/index.js +0 -7
  17. package/dist/cjs/pm-plugins/safari-delete-composition-text-issue-workaround.js +2 -2
  18. package/dist/cjs/pm-plugins/sticky-headers/index.js +1 -14
  19. package/dist/cjs/pm-plugins/table-analytics.js +2 -2
  20. package/dist/cjs/pm-plugins/table-resizing/commands.js +2 -2
  21. package/dist/cjs/pm-plugins/table-resizing/event-handlers.js +33 -15
  22. package/dist/cjs/pm-plugins/table-resizing/utils/colgroup.js +15 -6
  23. package/dist/cjs/pm-plugins/table-resizing/utils/consts.js +1 -2
  24. package/dist/cjs/pm-plugins/table-resizing/utils/dom.js +3 -3
  25. package/dist/cjs/pm-plugins/table-resizing/utils/index.js +0 -103
  26. package/dist/cjs/pm-plugins/table-resizing/utils/misc.js +23 -15
  27. package/dist/cjs/pm-plugins/table-resizing/utils/resize-column.js +6 -7
  28. package/dist/cjs/pm-plugins/table-resizing/utils/resize-state.js +23 -18
  29. package/dist/cjs/pm-plugins/table-resizing/utils/scale-table.js +13 -8
  30. package/dist/cjs/pm-plugins/table-selection-keymap.js +1 -3
  31. package/dist/cjs/pm-plugins/view-mode-sort/utils.js +2 -2
  32. package/dist/cjs/toolbar.js +9 -9
  33. package/dist/cjs/transforms/column-width.js +3 -1
  34. package/dist/cjs/transforms/delete-columns.js +2 -1
  35. package/dist/cjs/transforms/index.js +0 -6
  36. package/dist/cjs/ui/DragHandle/index.js +3 -1
  37. package/dist/cjs/ui/FloatingContextualButton/FixedButton.js +2 -2
  38. package/dist/cjs/ui/FloatingContextualMenu/ContextualMenu.js +3 -3
  39. package/dist/cjs/ui/FloatingDeleteButton/index.js +0 -1
  40. package/dist/cjs/ui/FloatingDragMenu/DragMenu.js +5 -4
  41. package/dist/cjs/ui/FloatingDragMenu/index.js +4 -2
  42. package/dist/cjs/ui/FloatingInsertButton/InsertButton.js +2 -2
  43. package/dist/cjs/ui/FloatingInsertButton/index.js +3 -2
  44. package/dist/cjs/ui/TableFloatingColumnControls/ColumnControls/index.js +2 -3
  45. package/dist/cjs/ui/TableFloatingColumnControls/index.js +2 -2
  46. package/dist/cjs/ui/TableFloatingControls/RowControls/DragControls.js +3 -1
  47. package/dist/cjs/ui/icons/index.js +0 -7
  48. package/dist/cjs/utils/column-controls.js +1 -22
  49. package/dist/cjs/utils/dom.js +1 -4
  50. package/dist/cjs/utils/drag-menu.js +3 -2
  51. package/dist/cjs/utils/index.js +0 -108
  52. package/dist/cjs/utils/merged-cells.js +1 -60
  53. package/dist/cjs/utils/nodes.js +2 -2
  54. package/dist/cjs/utils/row-controls.js +1 -8
  55. package/dist/cjs/utils/selection.js +1 -60
  56. package/dist/cjs/utils/table.js +1 -11
  57. package/dist/es2019/commands/clear.js +1 -14
  58. package/dist/es2019/commands/column-resize.js +11 -5
  59. package/dist/es2019/commands/delete.js +2 -2
  60. package/dist/es2019/commands/insert.js +8 -8
  61. package/dist/es2019/commands/selection.js +2 -2
  62. package/dist/es2019/commands-with-analytics.js +6 -36
  63. package/dist/es2019/nodeviews/TableComponent.js +30 -15
  64. package/dist/es2019/nodeviews/TableContainer.js +1 -1
  65. package/dist/es2019/nodeviews/TableResizer.js +1 -1
  66. package/dist/es2019/plugin.js +4 -2
  67. package/dist/es2019/pm-plugins/decorations/utils/index.js +1 -2
  68. package/dist/es2019/pm-plugins/drag-and-drop/commands.js +2 -2
  69. package/dist/es2019/pm-plugins/drag-and-drop/index.js +1 -2
  70. package/dist/es2019/pm-plugins/drag-and-drop/plugin.js +4 -1
  71. package/dist/es2019/pm-plugins/drag-and-drop/utils/index.js +0 -1
  72. package/dist/es2019/pm-plugins/safari-delete-composition-text-issue-workaround.js +1 -1
  73. package/dist/es2019/pm-plugins/sticky-headers/index.js +1 -2
  74. package/dist/es2019/pm-plugins/table-analytics.js +1 -1
  75. package/dist/es2019/pm-plugins/table-resizing/commands.js +1 -1
  76. package/dist/es2019/pm-plugins/table-resizing/event-handlers.js +32 -14
  77. package/dist/es2019/pm-plugins/table-resizing/utils/colgroup.js +15 -7
  78. package/dist/es2019/pm-plugins/table-resizing/utils/consts.js +0 -1
  79. package/dist/es2019/pm-plugins/table-resizing/utils/dom.js +2 -2
  80. package/dist/es2019/pm-plugins/table-resizing/utils/index.js +5 -6
  81. package/dist/es2019/pm-plugins/table-resizing/utils/misc.js +22 -14
  82. package/dist/es2019/pm-plugins/table-resizing/utils/resize-column.js +6 -7
  83. package/dist/es2019/pm-plugins/table-resizing/utils/resize-state.js +21 -15
  84. package/dist/es2019/pm-plugins/table-resizing/utils/scale-table.js +10 -7
  85. package/dist/es2019/pm-plugins/table-selection-keymap.js +1 -2
  86. package/dist/es2019/pm-plugins/view-mode-sort/utils.js +1 -1
  87. package/dist/es2019/toolbar.js +8 -8
  88. package/dist/es2019/transforms/column-width.js +3 -2
  89. package/dist/es2019/transforms/delete-columns.js +2 -2
  90. package/dist/es2019/transforms/index.js +1 -1
  91. package/dist/es2019/ui/DragHandle/index.js +3 -1
  92. package/dist/es2019/ui/FloatingContextualButton/FixedButton.js +1 -1
  93. package/dist/es2019/ui/FloatingContextualMenu/ContextualMenu.js +3 -3
  94. package/dist/es2019/ui/FloatingDeleteButton/index.js +1 -1
  95. package/dist/es2019/ui/FloatingDragMenu/DragMenu.js +4 -3
  96. package/dist/es2019/ui/FloatingDragMenu/index.js +4 -2
  97. package/dist/es2019/ui/FloatingInsertButton/InsertButton.js +1 -1
  98. package/dist/es2019/ui/FloatingInsertButton/index.js +3 -2
  99. package/dist/es2019/ui/TableFloatingColumnControls/ColumnControls/index.js +1 -2
  100. package/dist/es2019/ui/TableFloatingColumnControls/index.js +1 -1
  101. package/dist/es2019/ui/TableFloatingControls/RowControls/DragControls.js +3 -1
  102. package/dist/es2019/ui/icons/index.js +0 -1
  103. package/dist/es2019/utils/column-controls.js +1 -19
  104. package/dist/es2019/utils/dom.js +0 -1
  105. package/dist/es2019/utils/drag-menu.js +3 -3
  106. package/dist/es2019/utils/index.js +8 -8
  107. package/dist/es2019/utils/merged-cells.js +0 -47
  108. package/dist/es2019/utils/nodes.js +1 -1
  109. package/dist/es2019/utils/row-controls.js +1 -8
  110. package/dist/es2019/utils/selection.js +0 -60
  111. package/dist/es2019/utils/table.js +0 -6
  112. package/dist/esm/commands/clear.js +1 -14
  113. package/dist/esm/commands/column-resize.js +11 -5
  114. package/dist/esm/commands/delete.js +2 -1
  115. package/dist/esm/commands/insert.js +8 -5
  116. package/dist/esm/commands/selection.js +2 -2
  117. package/dist/esm/commands-with-analytics.js +24 -52
  118. package/dist/esm/nodeviews/TableComponent.js +30 -15
  119. package/dist/esm/nodeviews/TableContainer.js +1 -1
  120. package/dist/esm/nodeviews/TableResizer.js +1 -1
  121. package/dist/esm/plugin.js +4 -2
  122. package/dist/esm/pm-plugins/decorations/utils/index.js +1 -2
  123. package/dist/esm/pm-plugins/drag-and-drop/commands.js +2 -2
  124. package/dist/esm/pm-plugins/drag-and-drop/index.js +1 -2
  125. package/dist/esm/pm-plugins/drag-and-drop/plugin.js +4 -1
  126. package/dist/esm/pm-plugins/drag-and-drop/utils/index.js +0 -1
  127. package/dist/esm/pm-plugins/safari-delete-composition-text-issue-workaround.js +1 -1
  128. package/dist/esm/pm-plugins/sticky-headers/index.js +1 -2
  129. package/dist/esm/pm-plugins/table-analytics.js +1 -1
  130. package/dist/esm/pm-plugins/table-resizing/commands.js +1 -1
  131. package/dist/esm/pm-plugins/table-resizing/event-handlers.js +33 -15
  132. package/dist/esm/pm-plugins/table-resizing/utils/colgroup.js +15 -6
  133. package/dist/esm/pm-plugins/table-resizing/utils/consts.js +0 -1
  134. package/dist/esm/pm-plugins/table-resizing/utils/dom.js +2 -2
  135. package/dist/esm/pm-plugins/table-resizing/utils/index.js +5 -6
  136. package/dist/esm/pm-plugins/table-resizing/utils/misc.js +24 -14
  137. package/dist/esm/pm-plugins/table-resizing/utils/resize-column.js +6 -7
  138. package/dist/esm/pm-plugins/table-resizing/utils/resize-state.js +22 -17
  139. package/dist/esm/pm-plugins/table-resizing/utils/scale-table.js +12 -6
  140. package/dist/esm/pm-plugins/table-selection-keymap.js +1 -2
  141. package/dist/esm/pm-plugins/view-mode-sort/utils.js +1 -1
  142. package/dist/esm/toolbar.js +8 -8
  143. package/dist/esm/transforms/column-width.js +3 -1
  144. package/dist/esm/transforms/delete-columns.js +2 -1
  145. package/dist/esm/transforms/index.js +1 -1
  146. package/dist/esm/ui/DragHandle/index.js +3 -1
  147. package/dist/esm/ui/FloatingContextualButton/FixedButton.js +1 -1
  148. package/dist/esm/ui/FloatingContextualMenu/ContextualMenu.js +3 -3
  149. package/dist/esm/ui/FloatingDeleteButton/index.js +1 -1
  150. package/dist/esm/ui/FloatingDragMenu/DragMenu.js +4 -3
  151. package/dist/esm/ui/FloatingDragMenu/index.js +4 -2
  152. package/dist/esm/ui/FloatingInsertButton/InsertButton.js +1 -1
  153. package/dist/esm/ui/FloatingInsertButton/index.js +3 -2
  154. package/dist/esm/ui/TableFloatingColumnControls/ColumnControls/index.js +1 -2
  155. package/dist/esm/ui/TableFloatingColumnControls/index.js +1 -1
  156. package/dist/esm/ui/TableFloatingControls/RowControls/DragControls.js +3 -1
  157. package/dist/esm/ui/icons/index.js +0 -1
  158. package/dist/esm/utils/column-controls.js +1 -22
  159. package/dist/esm/utils/dom.js +0 -3
  160. package/dist/esm/utils/drag-menu.js +3 -2
  161. package/dist/esm/utils/index.js +8 -8
  162. package/dist/esm/utils/merged-cells.js +0 -59
  163. package/dist/esm/utils/nodes.js +1 -1
  164. package/dist/esm/utils/row-controls.js +1 -8
  165. package/dist/esm/utils/selection.js +0 -59
  166. package/dist/esm/utils/table.js +0 -9
  167. package/dist/types/commands/clear.d.ts +0 -1
  168. package/dist/types/commands/delete.d.ts +1 -1
  169. package/dist/types/commands/insert.d.ts +4 -4
  170. package/dist/types/commands/selection.d.ts +0 -4
  171. package/dist/types/commands-with-analytics.d.ts +2 -3
  172. package/dist/types/nodeviews/TableComponent.d.ts +1 -1
  173. package/dist/types/nodeviews/TableContainer.d.ts +0 -11
  174. package/dist/types/nodeviews/TableResizer.d.ts +1 -3
  175. package/dist/types/pm-plugins/analytics/actions.d.ts +3 -2
  176. package/dist/types/pm-plugins/decorations/utils/index.d.ts +0 -1
  177. package/dist/types/pm-plugins/decorations/utils/types.d.ts +2 -1
  178. package/dist/types/pm-plugins/drag-and-drop/actions.d.ts +5 -4
  179. package/dist/types/pm-plugins/drag-and-drop/commands.d.ts +1 -6
  180. package/dist/types/pm-plugins/drag-and-drop/index.d.ts +0 -2
  181. package/dist/types/pm-plugins/drag-and-drop/utils/index.d.ts +0 -1
  182. package/dist/types/pm-plugins/safari-delete-composition-text-issue-workaround.d.ts +0 -2
  183. package/dist/types/pm-plugins/sticky-headers/index.d.ts +0 -1
  184. package/dist/types/pm-plugins/sticky-headers/types.d.ts +3 -2
  185. package/dist/types/pm-plugins/table-analytics.d.ts +0 -12
  186. package/dist/types/pm-plugins/table-resizing/commands.d.ts +0 -5
  187. package/dist/types/pm-plugins/table-resizing/utils/colgroup.d.ts +3 -2
  188. package/dist/types/pm-plugins/table-resizing/utils/consts.d.ts +0 -1
  189. package/dist/types/pm-plugins/table-resizing/utils/dom.d.ts +0 -2
  190. package/dist/types/pm-plugins/table-resizing/utils/index.d.ts +5 -8
  191. package/dist/types/pm-plugins/table-resizing/utils/misc.d.ts +1 -2
  192. package/dist/types/pm-plugins/table-resizing/utils/resize-column.d.ts +3 -2
  193. package/dist/types/pm-plugins/table-resizing/utils/resize-state.d.ts +3 -5
  194. package/dist/types/pm-plugins/table-resizing/utils/scale-table.d.ts +3 -4
  195. package/dist/types/pm-plugins/table-selection-keymap.d.ts +0 -1
  196. package/dist/types/pm-plugins/view-mode-sort/types.d.ts +2 -1
  197. package/dist/types/pm-plugins/view-mode-sort/utils.d.ts +0 -6
  198. package/dist/types/toolbar.d.ts +1 -14
  199. package/dist/types/transforms/column-width.d.ts +1 -1
  200. package/dist/types/transforms/delete-columns.d.ts +1 -1
  201. package/dist/types/transforms/index.d.ts +1 -1
  202. package/dist/types/ui/FloatingContextualButton/FixedButton.d.ts +1 -2
  203. package/dist/types/ui/FloatingContextualMenu/ContextualMenu.d.ts +2 -2
  204. package/dist/types/ui/FloatingContextualMenu/index.d.ts +1 -1
  205. package/dist/types/ui/FloatingDeleteButton/DeleteButton.d.ts +1 -1
  206. package/dist/types/ui/FloatingDeleteButton/index.d.ts +2 -3
  207. package/dist/types/ui/FloatingDragMenu/DragMenu.d.ts +1 -2
  208. package/dist/types/ui/FloatingDragMenu/index.d.ts +3 -2
  209. package/dist/types/ui/FloatingInsertButton/InsertButton.d.ts +1 -2
  210. package/dist/types/ui/FloatingInsertButton/index.d.ts +1 -0
  211. package/dist/types/ui/FloatingToolbarLabel/FloatingToolbarLabel.d.ts +2 -1
  212. package/dist/types/ui/TableFloatingColumnControls/ColumnControls/index.d.ts +2 -2
  213. package/dist/types/ui/TableFloatingColumnControls/ColumnDropTargets/ColumnDropTarget.d.ts +2 -1
  214. package/dist/types/ui/TableFloatingColumnControls/ColumnDropTargets/index.d.ts +2 -1
  215. package/dist/types/ui/TableFloatingColumnControls/index.d.ts +2 -2
  216. package/dist/types/ui/TableFloatingControls/NumberColumn/index.d.ts +2 -1
  217. package/dist/types/ui/TableFloatingControls/RowDropTarget/index.d.ts +1 -1
  218. package/dist/types/ui/TableFloatingControls/index.d.ts +1 -1
  219. package/dist/types/ui/icons/index.d.ts +0 -1
  220. package/dist/types/utils/column-controls.d.ts +0 -2
  221. package/dist/types/utils/dom.d.ts +0 -1
  222. package/dist/types/utils/drag-menu.d.ts +1 -1
  223. package/dist/types/utils/index.d.ts +8 -8
  224. package/dist/types/utils/merged-cells.d.ts +0 -2
  225. package/dist/types/utils/nodes.d.ts +0 -1
  226. package/dist/types/utils/row-controls.d.ts +0 -1
  227. package/dist/types/utils/selection.d.ts +0 -3
  228. package/dist/types/utils/table.d.ts +0 -2
  229. package/dist/types-ts4.5/commands/clear.d.ts +0 -1
  230. package/dist/types-ts4.5/commands/delete.d.ts +1 -1
  231. package/dist/types-ts4.5/commands/insert.d.ts +4 -4
  232. package/dist/types-ts4.5/commands/selection.d.ts +0 -4
  233. package/dist/types-ts4.5/commands-with-analytics.d.ts +2 -3
  234. package/dist/types-ts4.5/nodeviews/TableComponent.d.ts +1 -1
  235. package/dist/types-ts4.5/nodeviews/TableContainer.d.ts +0 -11
  236. package/dist/types-ts4.5/nodeviews/TableResizer.d.ts +1 -3
  237. package/dist/types-ts4.5/pm-plugins/analytics/actions.d.ts +3 -2
  238. package/dist/types-ts4.5/pm-plugins/decorations/utils/index.d.ts +0 -1
  239. package/dist/types-ts4.5/pm-plugins/decorations/utils/types.d.ts +2 -1
  240. package/dist/types-ts4.5/pm-plugins/drag-and-drop/actions.d.ts +5 -4
  241. package/dist/types-ts4.5/pm-plugins/drag-and-drop/commands.d.ts +1 -6
  242. package/dist/types-ts4.5/pm-plugins/drag-and-drop/index.d.ts +0 -2
  243. package/dist/types-ts4.5/pm-plugins/drag-and-drop/utils/index.d.ts +0 -1
  244. package/dist/types-ts4.5/pm-plugins/safari-delete-composition-text-issue-workaround.d.ts +0 -2
  245. package/dist/types-ts4.5/pm-plugins/sticky-headers/index.d.ts +0 -1
  246. package/dist/types-ts4.5/pm-plugins/sticky-headers/types.d.ts +3 -2
  247. package/dist/types-ts4.5/pm-plugins/table-analytics.d.ts +0 -12
  248. package/dist/types-ts4.5/pm-plugins/table-resizing/commands.d.ts +0 -5
  249. package/dist/types-ts4.5/pm-plugins/table-resizing/utils/colgroup.d.ts +3 -2
  250. package/dist/types-ts4.5/pm-plugins/table-resizing/utils/consts.d.ts +0 -1
  251. package/dist/types-ts4.5/pm-plugins/table-resizing/utils/dom.d.ts +0 -2
  252. package/dist/types-ts4.5/pm-plugins/table-resizing/utils/index.d.ts +5 -8
  253. package/dist/types-ts4.5/pm-plugins/table-resizing/utils/misc.d.ts +1 -2
  254. package/dist/types-ts4.5/pm-plugins/table-resizing/utils/resize-column.d.ts +3 -2
  255. package/dist/types-ts4.5/pm-plugins/table-resizing/utils/resize-state.d.ts +3 -5
  256. package/dist/types-ts4.5/pm-plugins/table-resizing/utils/scale-table.d.ts +3 -4
  257. package/dist/types-ts4.5/pm-plugins/table-selection-keymap.d.ts +0 -1
  258. package/dist/types-ts4.5/pm-plugins/view-mode-sort/types.d.ts +2 -1
  259. package/dist/types-ts4.5/pm-plugins/view-mode-sort/utils.d.ts +0 -6
  260. package/dist/types-ts4.5/toolbar.d.ts +1 -14
  261. package/dist/types-ts4.5/transforms/column-width.d.ts +1 -1
  262. package/dist/types-ts4.5/transforms/delete-columns.d.ts +1 -1
  263. package/dist/types-ts4.5/transforms/index.d.ts +1 -1
  264. package/dist/types-ts4.5/ui/FloatingContextualButton/FixedButton.d.ts +1 -2
  265. package/dist/types-ts4.5/ui/FloatingContextualMenu/ContextualMenu.d.ts +2 -2
  266. package/dist/types-ts4.5/ui/FloatingContextualMenu/index.d.ts +1 -1
  267. package/dist/types-ts4.5/ui/FloatingDeleteButton/DeleteButton.d.ts +1 -1
  268. package/dist/types-ts4.5/ui/FloatingDeleteButton/index.d.ts +2 -3
  269. package/dist/types-ts4.5/ui/FloatingDragMenu/DragMenu.d.ts +1 -2
  270. package/dist/types-ts4.5/ui/FloatingDragMenu/index.d.ts +3 -2
  271. package/dist/types-ts4.5/ui/FloatingInsertButton/InsertButton.d.ts +1 -2
  272. package/dist/types-ts4.5/ui/FloatingInsertButton/index.d.ts +1 -0
  273. package/dist/types-ts4.5/ui/FloatingToolbarLabel/FloatingToolbarLabel.d.ts +2 -1
  274. package/dist/types-ts4.5/ui/TableFloatingColumnControls/ColumnControls/index.d.ts +2 -2
  275. package/dist/types-ts4.5/ui/TableFloatingColumnControls/ColumnDropTargets/ColumnDropTarget.d.ts +2 -1
  276. package/dist/types-ts4.5/ui/TableFloatingColumnControls/ColumnDropTargets/index.d.ts +2 -1
  277. package/dist/types-ts4.5/ui/TableFloatingColumnControls/index.d.ts +2 -2
  278. package/dist/types-ts4.5/ui/TableFloatingControls/NumberColumn/index.d.ts +2 -1
  279. package/dist/types-ts4.5/ui/TableFloatingControls/RowDropTarget/index.d.ts +1 -1
  280. package/dist/types-ts4.5/ui/TableFloatingControls/index.d.ts +1 -1
  281. package/dist/types-ts4.5/ui/icons/index.d.ts +0 -1
  282. package/dist/types-ts4.5/utils/column-controls.d.ts +0 -2
  283. package/dist/types-ts4.5/utils/dom.d.ts +0 -1
  284. package/dist/types-ts4.5/utils/drag-menu.d.ts +1 -1
  285. package/dist/types-ts4.5/utils/index.d.ts +8 -8
  286. package/dist/types-ts4.5/utils/merged-cells.d.ts +0 -2
  287. package/dist/types-ts4.5/utils/nodes.d.ts +0 -1
  288. package/dist/types-ts4.5/utils/row-controls.d.ts +0 -1
  289. package/dist/types-ts4.5/utils/selection.d.ts +0 -3
  290. package/dist/types-ts4.5/utils/table.d.ts +0 -2
  291. package/package.json +3 -3
  292. package/src/commands/clear.ts +0 -14
  293. package/src/commands/column-resize.ts +19 -6
  294. package/src/commands/delete.ts +2 -0
  295. package/src/commands/insert.ts +8 -0
  296. package/src/commands/selection.ts +1 -1
  297. package/src/commands-with-analytics.ts +5 -40
  298. package/src/nodeviews/TableComponent.tsx +43 -9
  299. package/src/nodeviews/TableContainer.tsx +1 -1
  300. package/src/nodeviews/TableResizer.tsx +2 -4
  301. package/src/plugin.tsx +2 -0
  302. package/src/pm-plugins/analytics/actions.ts +2 -2
  303. package/src/pm-plugins/decorations/utils/index.ts +0 -1
  304. package/src/pm-plugins/decorations/utils/types.ts +1 -1
  305. package/src/pm-plugins/drag-and-drop/actions.ts +4 -4
  306. package/src/pm-plugins/drag-and-drop/commands.ts +2 -2
  307. package/src/pm-plugins/drag-and-drop/index.ts +0 -3
  308. package/src/pm-plugins/drag-and-drop/plugin.ts +4 -0
  309. package/src/pm-plugins/drag-and-drop/utils/index.ts +0 -2
  310. package/src/pm-plugins/safari-delete-composition-text-issue-workaround.ts +1 -1
  311. package/src/pm-plugins/sticky-headers/index.ts +0 -1
  312. package/src/pm-plugins/sticky-headers/types.ts +2 -2
  313. package/src/pm-plugins/table-analytics.ts +1 -1
  314. package/src/pm-plugins/table-resizing/commands.ts +1 -1
  315. package/src/pm-plugins/table-resizing/event-handlers.ts +39 -15
  316. package/src/pm-plugins/table-resizing/utils/colgroup.ts +18 -7
  317. package/src/pm-plugins/table-resizing/utils/consts.ts +0 -1
  318. package/src/pm-plugins/table-resizing/utils/dom.ts +2 -5
  319. package/src/pm-plugins/table-resizing/utils/index.ts +4 -30
  320. package/src/pm-plugins/table-resizing/utils/misc.ts +25 -17
  321. package/src/pm-plugins/table-resizing/utils/resize-column.ts +14 -13
  322. package/src/pm-plugins/table-resizing/utils/resize-state.ts +28 -21
  323. package/src/pm-plugins/table-resizing/utils/scale-table.ts +18 -6
  324. package/src/pm-plugins/table-selection-keymap.ts +0 -2
  325. package/src/pm-plugins/view-mode-sort/types.ts +1 -1
  326. package/src/pm-plugins/view-mode-sort/utils.ts +1 -5
  327. package/src/toolbar.tsx +8 -5
  328. package/src/transforms/column-width.ts +2 -0
  329. package/src/transforms/delete-columns.ts +2 -0
  330. package/src/transforms/index.ts +1 -1
  331. package/src/ui/DragHandle/index.tsx +2 -0
  332. package/src/ui/FloatingContextualButton/FixedButton.tsx +2 -2
  333. package/src/ui/FloatingContextualMenu/ContextualMenu.tsx +5 -2
  334. package/src/ui/FloatingContextualMenu/index.tsx +1 -1
  335. package/src/ui/FloatingDeleteButton/DeleteButton.tsx +1 -1
  336. package/src/ui/FloatingDeleteButton/index.tsx +2 -2
  337. package/src/ui/FloatingDragMenu/DragMenu.tsx +4 -1
  338. package/src/ui/FloatingDragMenu/index.tsx +4 -1
  339. package/src/ui/FloatingInsertButton/InsertButton.tsx +2 -2
  340. package/src/ui/FloatingInsertButton/index.tsx +3 -0
  341. package/src/ui/FloatingToolbarLabel/FloatingToolbarLabel.tsx +1 -1
  342. package/src/ui/TableFloatingColumnControls/ColumnControls/index.tsx +1 -3
  343. package/src/ui/TableFloatingColumnControls/ColumnDropTargets/ColumnDropTarget.tsx +1 -1
  344. package/src/ui/TableFloatingColumnControls/ColumnDropTargets/index.tsx +1 -1
  345. package/src/ui/TableFloatingColumnControls/index.tsx +2 -2
  346. package/src/ui/TableFloatingControls/NumberColumn/index.tsx +1 -1
  347. package/src/ui/TableFloatingControls/RowControls/DragControls.tsx +2 -0
  348. package/src/ui/TableFloatingControls/RowDropTarget/index.tsx +1 -1
  349. package/src/ui/TableFloatingControls/index.tsx +1 -1
  350. package/src/ui/icons/index.ts +0 -1
  351. package/src/utils/column-controls.ts +2 -38
  352. package/src/utils/dom.ts +0 -4
  353. package/src/utils/drag-menu.ts +3 -0
  354. package/src/utils/index.ts +1 -22
  355. package/src/utils/merged-cells.ts +0 -62
  356. package/src/utils/nodes.ts +1 -1
  357. package/src/utils/row-controls.ts +1 -19
  358. package/src/utils/selection.ts +0 -84
  359. package/src/utils/table.ts +0 -8
  360. package/dist/cjs/utils/transforms.js +0 -11
  361. package/dist/es2019/utils/transforms.js +0 -5
  362. package/dist/esm/utils/transforms.js +0 -5
  363. package/dist/types/utils/transforms.d.ts +0 -2
  364. package/dist/types-ts4.5/utils/transforms.d.ts +0 -2
  365. package/src/utils/transforms.ts +0 -10
@@ -1,5 +1,5 @@
1
1
  import { tableBackgroundColorPalette } from '@atlaskit/adf-schema';
2
- import { ACTION_SUBJECT, EVENT_TYPE, INPUT_METHOD, TABLE_ACTION, TABLE_BREAKOUT, TABLE_DISPLAY_MODE } from '@atlaskit/editor-common/analytics';
2
+ import { ACTION_SUBJECT, EVENT_TYPE, INPUT_METHOD, TABLE_ACTION, TABLE_DISPLAY_MODE } from '@atlaskit/editor-common/analytics';
3
3
  import { editorCommandToPMCommand } from '@atlaskit/editor-common/preset';
4
4
  import { CellSelection } from '@atlaskit/editor-tables/cell-selection';
5
5
  import { TableMap } from '@atlaskit/editor-tables/table-map';
@@ -13,17 +13,12 @@ import { insertColumn, insertRow } from './commands/insert';
13
13
  import { deleteTable, deleteTableIfSelected, getTableSelectionType, setMultipleCellAttrs, setTableAlignment, setTableAlignmentWithTableContentWithPos } from './commands/misc';
14
14
  import { sortByColumn } from './commands/sort';
15
15
  import { splitCell } from './commands/split-cell';
16
- import { getNextLayout, toggleHeaderColumn, toggleHeaderRow, toggleNumberColumn, toggleTableLayout } from './commands/toggle';
16
+ import { toggleHeaderColumn, toggleHeaderRow, toggleNumberColumn } from './commands/toggle';
17
17
  import { getPluginState } from './pm-plugins/plugin-factory';
18
18
  import { distributeColumnsWidths } from './pm-plugins/table-resizing/commands';
19
19
  import { deleteRows, mergeCells } from './transforms';
20
20
  import { checkIfNumberColumnEnabled, getSelectedCellInfo, getSelectedTableInfo } from './utils';
21
21
  import { withEditorAnalyticsAPI } from './utils/analytics';
22
- const TABLE_BREAKOUT_NAME_MAPPING = {
23
- default: TABLE_BREAKOUT.NORMAL,
24
- wide: TABLE_BREAKOUT.WIDE,
25
- 'full-width': TABLE_BREAKOUT.FULL_WIDTH
26
- };
27
22
 
28
23
  // #region Analytics wrappers
29
24
  export const emptyMultipleCellsWithAnalytics = editorAnalyticsAPI => (inputMethod, targetCellPosition) => withEditorAnalyticsAPI(({
@@ -206,7 +201,7 @@ export const changeColumnWidthByStepWithAnalytics = (editorAnalyticsAPI, api) =>
206
201
  getIntl: getIntl,
207
202
  api
208
203
  }));
209
- export const insertColumnWithAnalytics = (api, editorAnalyticsAPI, isTableScalingEnabled = false, isCellbackgroundDuplicated = false, isTableFixedColumnWidthsOptionEnabled = false, shouldUseIncreasedScalingPercent = false) => (inputMethod, position) => withEditorAnalyticsAPI(state => {
204
+ export const insertColumnWithAnalytics = (api, editorAnalyticsAPI, isTableScalingEnabled = false, isCellbackgroundDuplicated = false, isTableFixedColumnWidthsOptionEnabled = false, shouldUseIncreasedScalingPercent = false, isCommentEditor = false) => (inputMethod, position) => withEditorAnalyticsAPI(state => {
210
205
  const {
211
206
  totalRowCount,
212
207
  totalColumnCount
@@ -223,7 +218,7 @@ export const insertColumnWithAnalytics = (api, editorAnalyticsAPI, isTableScalin
223
218
  },
224
219
  eventType: EVENT_TYPE.TRACK
225
220
  };
226
- })(editorAnalyticsAPI)(insertColumn(api, isTableScalingEnabled, isCellbackgroundDuplicated, isTableFixedColumnWidthsOptionEnabled, shouldUseIncreasedScalingPercent)(position));
221
+ })(editorAnalyticsAPI)(insertColumn(api, isTableScalingEnabled, isCellbackgroundDuplicated, isTableFixedColumnWidthsOptionEnabled, shouldUseIncreasedScalingPercent, isCommentEditor)(position));
227
222
  export const deleteRowsWithAnalytics = editorAnalyticsAPI => (inputMethod, rect, isHeaderRowRequired) => withEditorAnalyticsAPI(({
228
223
  selection
229
224
  }) => {
@@ -250,7 +245,7 @@ export const deleteRowsWithAnalytics = editorAnalyticsAPI => (inputMethod, rect,
250
245
  }
251
246
  return true;
252
247
  });
253
- export const deleteColumnsWithAnalytics = (editorAnalyticsAPI, api, isTableScalingEnabled = false, isTableFixedColumnWidthsOptionEnabled = false, shouldUseIncreasedScalingPercent = false) => (inputMethod, rect) => withEditorAnalyticsAPI(({
248
+ export const deleteColumnsWithAnalytics = (editorAnalyticsAPI, api, isTableScalingEnabled = false, isTableFixedColumnWidthsOptionEnabled = false, shouldUseIncreasedScalingPercent = false, isCommentEditor = false) => (inputMethod, rect) => withEditorAnalyticsAPI(({
254
249
  selection
255
250
  }) => {
256
251
  const {
@@ -270,7 +265,7 @@ export const deleteColumnsWithAnalytics = (editorAnalyticsAPI, api, isTableScali
270
265
  },
271
266
  eventType: EVENT_TYPE.TRACK
272
267
  };
273
- })(editorAnalyticsAPI)(deleteColumnsCommand(rect, api, isTableScalingEnabled, isTableFixedColumnWidthsOptionEnabled, shouldUseIncreasedScalingPercent));
268
+ })(editorAnalyticsAPI)(deleteColumnsCommand(rect, api, isTableScalingEnabled, isTableFixedColumnWidthsOptionEnabled, shouldUseIncreasedScalingPercent, isCommentEditor));
274
269
  export const deleteSelectedRowsOrColumnsWithAnalyticsViaShortcut = (editorAnalyticsAPI, api, isTableScalingEnabled, isTableFixedColumnWidthsOptionEnabled, shouldUseIncreasedScalingPercent) => (state, dispatch) => {
275
270
  const {
276
271
  selection
@@ -375,31 +370,6 @@ export const toggleNumberColumnWithAnalytics = editorAnalyticsAPI => withEditorA
375
370
  eventType: EVENT_TYPE.TRACK
376
371
  };
377
372
  })(editorAnalyticsAPI)(toggleNumberColumn);
378
- export const toggleTableLayoutWithAnalytics = editorAnalyticsAPI => withEditorAnalyticsAPI(state => {
379
- const {
380
- table,
381
- totalRowCount,
382
- totalColumnCount
383
- } = getSelectedTableInfo(state.selection);
384
- if (table) {
385
- const {
386
- layout
387
- } = table.node.attrs;
388
- return {
389
- action: TABLE_ACTION.CHANGED_BREAKOUT_MODE,
390
- actionSubject: ACTION_SUBJECT.TABLE,
391
- actionSubjectId: null,
392
- attributes: {
393
- newBreakoutMode: TABLE_BREAKOUT_NAME_MAPPING[getNextLayout(layout)],
394
- previousBreakoutMode: TABLE_BREAKOUT_NAME_MAPPING[layout],
395
- totalRowCount,
396
- totalColumnCount
397
- },
398
- eventType: EVENT_TYPE.TRACK
399
- };
400
- }
401
- return;
402
- })(editorAnalyticsAPI)(toggleTableLayout);
403
373
  export const sortColumnWithAnalytics = editorAnalyticsAPI => (inputMethod, columnIndex, sortOrder) => withEditorAnalyticsAPI(state => {
404
374
  const {
405
375
  totalRowCount,
@@ -21,8 +21,9 @@ import { findStickyHeaderForTable, pluginKey as stickyHeadersPluginKey } from '.
21
21
  import { META_KEYS } from '../pm-plugins/table-analytics';
22
22
  import { COLUMN_MIN_WIDTH, getLayoutSize, getResizeState, insertColgroupFromNode, scaleTable, updateColgroup } from '../pm-plugins/table-resizing/utils';
23
23
  import { hasTableBeenResized } from '../pm-plugins/table-resizing/utils/colgroup';
24
- import { TABLE_EDITOR_MARGIN } from '../pm-plugins/table-resizing/utils/consts';
24
+ import { TABLE_EDITOR_MARGIN, TABLE_OFFSET_IN_COMMENT_EDITOR } from '../pm-plugins/table-resizing/utils/consts';
25
25
  import { updateControls } from '../pm-plugins/table-resizing/utils/dom';
26
+ import { getScalingPercentForTableWithoutWidth, getTableScalingPercent } from '../pm-plugins/table-resizing/utils/misc';
26
27
  import { TableCssClassName as ClassName, ShadowEvent } from '../types';
27
28
  import TableFloatingColumnControls from '../ui/TableFloatingColumnControls';
28
29
  import TableFloatingControls from '../ui/TableFloatingControls';
@@ -482,7 +483,8 @@ class TableComponent extends React.Component {
482
483
  isResizing,
483
484
  view,
484
485
  getPos,
485
- getEditorFeatureFlags
486
+ getEditorFeatureFlags,
487
+ options
486
488
  } = this.props;
487
489
  if (!this.table) {
488
490
  return;
@@ -490,21 +492,24 @@ class TableComponent extends React.Component {
490
492
 
491
493
  // Remove any widths styles after resizing preview is completed
492
494
  this.table.style.width = '';
493
- const tableRenderWidth = containerWidth.width - TABLE_EDITOR_MARGIN;
494
495
  const tableNode = getNode();
495
496
  const start = getPos() || 0;
496
497
  const depth = view.state.doc.resolve(start).depth;
497
498
  if (depth !== 0) {
498
499
  return;
499
500
  }
500
- const tableNodeWidth = getTableContainerWidth(tableNode);
501
+ let tableNodeWidth = getTableContainerWidth(tableNode);
501
502
  const isTableResizedFullWidth = tableNodeWidth === 1800 && this.wasResizing && !isResizing;
503
+
502
504
  // Needed for undo / redo
503
505
  const isTableWidthChanged = tableNodeWidth !== this.tableNodeWidth;
506
+ const tableRenderWidth = options !== null && options !== void 0 && options.isCommentEditor ? containerWidth.width - (TABLE_OFFSET_IN_COMMENT_EDITOR + 1) // should be the same as this.table.parentElement?.clientWidth - 1, subtract 1 to avoid overflow
507
+ : containerWidth.width - TABLE_EDITOR_MARGIN;
508
+ tableNodeWidth = options !== null && options !== void 0 && options.isCommentEditor && !tableNode.attrs.width ? tableRenderWidth : tableNodeWidth;
504
509
  const isTableSquashed = tableRenderWidth < tableNodeWidth;
505
510
  const isNumberColumnChanged = tableNode.attrs.isNumberColumnEnabled !== this.node.attrs.isNumberColumnEnabled;
506
511
  const isNumberOfColumnsChanged = tablesHaveDifferentNoOfColumns(tableNode, this.node);
507
- const maybeScale = isTableSquashed || isTableWidthChanged || isTableResizedFullWidth || isNumberColumnChanged || isNumberOfColumnsChanged;
512
+ const maybeScale = isTableSquashed || isTableWidthChanged || isTableResizedFullWidth && !(options !== null && options !== void 0 && options.isCommentEditor) || isNumberColumnChanged || isNumberOfColumnsChanged;
508
513
  if (force || maybeScale) {
509
514
  var _this$containerWidth, _this$props$options, _this$props$options2, _this$props$options3;
510
515
  const {
@@ -524,7 +529,7 @@ class TableComponent extends React.Component {
524
529
  // When in comment editor, we need the scaling percent to be 40% while tableWithFixedColumnWidthsOption is not visible
525
530
  !!((_this$props$options2 = this.props.options) !== null && _this$props$options2 !== void 0 && _this$props$options2.isTableScalingEnabled) && !!((_this$props$options3 = this.props.options) !== null && _this$props$options3 !== void 0 && _this$props$options3.isCommentEditor);
526
531
  if (force || !isResizing && shouldUpdateColgroup) {
527
- var _this$props$options4;
532
+ var _this$props$options4, _this$props$options5, _this$props$options6, _this$props$options7, _this$props$options8, _this$props$options9;
528
533
  const resizeState = getResizeState({
529
534
  minWidth: COLUMN_MIN_WIDTH,
530
535
  maxSize: tableRenderWidth,
@@ -533,19 +538,29 @@ class TableComponent extends React.Component {
533
538
  start,
534
539
  domAtPos: view.domAtPos.bind(view),
535
540
  isTableScalingEnabled: true,
536
- shouldUseIncreasedScalingPercent
541
+ shouldUseIncreasedScalingPercent,
542
+ isCommentEditor: !!((_this$props$options4 = this.props.options) !== null && _this$props$options4 !== void 0 && _this$props$options4.isCommentEditor)
537
543
  });
538
544
  let shouldScaleOnColgroupUpdate = false;
539
- if ((_this$props$options4 = this.props.options) !== null && _this$props$options4 !== void 0 && _this$props$options4.isTableScalingEnabled && !tableWithFixedColumnWidthsOption) {
545
+ if ((_this$props$options5 = this.props.options) !== null && _this$props$options5 !== void 0 && _this$props$options5.isTableScalingEnabled && !tableWithFixedColumnWidthsOption) {
540
546
  shouldScaleOnColgroupUpdate = true;
541
547
  }
542
548
  if (isTableScalingWithFixedColumnWidthsOptionEnabled && tableNode.attrs.displayMode !== 'fixed') {
543
549
  shouldScaleOnColgroupUpdate = true;
544
550
  }
551
+ if ((_this$props$options6 = this.props.options) !== null && _this$props$options6 !== void 0 && _this$props$options6.isTableScalingEnabled && (_this$props$options7 = this.props.options) !== null && _this$props$options7 !== void 0 && _this$props$options7.isCommentEditor) {
552
+ shouldScaleOnColgroupUpdate = true;
553
+ }
554
+ let scalePercent = 1;
555
+ if (!((_this$props$options8 = this.props.options) !== null && _this$props$options8 !== void 0 && _this$props$options8.isCommentEditor) || (_this$props$options9 = this.props.options) !== null && _this$props$options9 !== void 0 && _this$props$options9.isCommentEditor && tableNode.attrs.width) {
556
+ scalePercent = getTableScalingPercent(tableNode, this.table, shouldUseIncreasedScalingPercent);
557
+ } else {
558
+ scalePercent = getScalingPercentForTableWithoutWidth(tableNode, this.table);
559
+ }
545
560
 
546
561
  // Request animation frame required for Firefox
547
562
  requestAnimationFrame(() => {
548
- updateColgroup(resizeState, this.table, tableNode, shouldScaleOnColgroupUpdate, shouldUseIncreasedScalingPercent);
563
+ updateColgroup(resizeState, this.table, tableNode, shouldScaleOnColgroupUpdate, scalePercent);
549
564
  });
550
565
  }
551
566
  }
@@ -554,7 +569,7 @@ class TableComponent extends React.Component {
554
569
  this.containerWidth = containerWidth;
555
570
  }
556
571
  componentDidUpdate(_, prevState) {
557
- var _this$props$options5, _this$props$options6, _this$wrapper;
572
+ var _this$props$options10, _this$props$options11, _this$wrapper;
558
573
  const {
559
574
  view,
560
575
  getNode,
@@ -585,7 +600,7 @@ class TableComponent extends React.Component {
585
600
  shouldHandleColgroupUpdates = true;
586
601
  }
587
602
  const isTableScalingWithFixedColumnWidthsOptionEnabled = !!isTableScalingEnabled && tableWithFixedColumnWidthsOption;
588
- const shouldUseIncreasedScalingPercent = isTableScalingWithFixedColumnWidthsOptionEnabled && fg('platform.editor.table.use-increased-scaling-percent') || !!isTableScalingEnabled && !!((_this$props$options5 = this.props.options) !== null && _this$props$options5 !== void 0 && _this$props$options5.isCommentEditor);
603
+ const shouldUseIncreasedScalingPercent = isTableScalingWithFixedColumnWidthsOptionEnabled && fg('platform.editor.table.use-increased-scaling-percent') || !!isTableScalingEnabled && !!((_this$props$options10 = this.props.options) !== null && _this$props$options10 !== void 0 && _this$props$options10.isCommentEditor);
589
604
  if (isTableScalingWithFixedColumnWidthsOptionEnabled && getNode().attrs.displayMode !== 'fixed') {
590
605
  shouldScale = true;
591
606
  shouldHandleColgroupUpdates = true;
@@ -596,7 +611,7 @@ class TableComponent extends React.Component {
596
611
  if (isInDanger && !table) {
597
612
  clearHoverSelection()(view.state, view.dispatch);
598
613
  }
599
- if ((_this$props$options6 = this.props.options) !== null && _this$props$options6 !== void 0 && _this$props$options6.isCommentEditor && options !== null && options !== void 0 && options.isTableResizingEnabled) {
614
+ if ((_this$props$options11 = this.props.options) !== null && _this$props$options11 !== void 0 && _this$props$options11.isCommentEditor && options !== null && options !== void 0 && options.isTableResizingEnabled) {
600
615
  this.removeInlineTableWidth();
601
616
  }
602
617
  if ((_this$wrapper = this.wrapper) !== null && _this$wrapper !== void 0 && _this$wrapper.parentElement && this.table && !this.overflowShadowsObserver) {
@@ -643,7 +658,7 @@ class TableComponent extends React.Component {
643
658
  const start = getPos() || 0;
644
659
  const depth = view.state.doc.resolve(start).depth;
645
660
  shouldScale = depth === 0 && shouldScale;
646
- insertColgroupFromNode(this.table, currentTable, shouldScale, undefined, shouldUseIncreasedScalingPercent);
661
+ insertColgroupFromNode(this.table, currentTable, shouldScale, undefined, shouldUseIncreasedScalingPercent, options === null || options === void 0 ? void 0 : options.isCommentEditor);
647
662
  }
648
663
  updateControls()(view.state);
649
664
  }
@@ -683,7 +698,7 @@ class TableComponent extends React.Component {
683
698
  }
684
699
  }
685
700
  render() {
686
- var _this$props$options7;
701
+ var _this$props$options12;
687
702
  const {
688
703
  view,
689
704
  getNode,
@@ -802,7 +817,7 @@ class TableComponent extends React.Component {
802
817
  stickyScrollbar,
803
818
  tableWithFixedColumnWidthsOption = false
804
819
  } = getEditorFeatureFlags();
805
- const shouldUseIncreasedScalingPercent = !!isTableScalingEnabled && (tableWithFixedColumnWidthsOption && fg('platform.editor.table.use-increased-scaling-percent') || !!((_this$props$options7 = this.props.options) !== null && _this$props$options7 !== void 0 && _this$props$options7.isCommentEditor));
820
+ const shouldUseIncreasedScalingPercent = !!isTableScalingEnabled && (tableWithFixedColumnWidthsOption && fg('platform.editor.table.use-increased-scaling-percent') || !!((_this$props$options12 = this.props.options) !== null && _this$props$options12 !== void 0 && _this$props$options12.isCommentEditor));
806
821
  return /*#__PURE__*/React.createElement(TableContainer
807
822
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
808
823
  , {
@@ -11,7 +11,7 @@ import { TableCssClassName as ClassName } from '../types';
11
11
  import { ALIGN_CENTER, ALIGN_START } from '../utils/alignment';
12
12
  import { getAlignmentStyle } from './table-container-styles';
13
13
  import { TableResizer } from './TableResizer';
14
- export const InnerContainer = /*#__PURE__*/forwardRef(({
14
+ const InnerContainer = /*#__PURE__*/forwardRef(({
15
15
  className,
16
16
  style,
17
17
  node,
@@ -325,7 +325,7 @@ export const TableResizer = ({
325
325
  prevNode: node,
326
326
  start: pos + 1,
327
327
  parentWidth: newWidth
328
- }, editorView.domAtPos.bind(editorView), pluginInjectionApi, isTableScalingEnabled, shouldUseIncreasedScalingPercent || false)(tr);
328
+ }, editorView.domAtPos.bind(editorView), pluginInjectionApi, isTableScalingEnabled, shouldUseIncreasedScalingPercent || false, isCommentEditor)(tr);
329
329
  const scaledNode = tr.doc.nodeAt(pos);
330
330
  (_attachAnalyticsEvent2 = attachAnalyticsEvent(generateResizedPayload({
331
331
  originalNode: node,
@@ -403,7 +403,8 @@ const tablesPlugin = ({
403
403
  getEditorContainerWidth: defaultGetEditorContainerWidth,
404
404
  getEditorFeatureFlags: (options === null || options === void 0 ? void 0 : options.getEditorFeatureFlags) || defaultGetEditorFeatureFlags,
405
405
  isChromelessEditor: options === null || options === void 0 ? void 0 : options.isChromelessEditor,
406
- api: api
406
+ api: api,
407
+ isCommentEditor: options === null || options === void 0 ? void 0 : options.isCommentEditor
407
408
  }), (options === null || options === void 0 ? void 0 : options.allowContextualMenu) && /*#__PURE__*/React.createElement(FloatingContextualMenu, {
408
409
  editorView: editorView,
409
410
  mountPoint: popupsMountPoint,
@@ -434,7 +435,8 @@ const tablesPlugin = ({
434
435
  isTableScalingEnabled: options === null || options === void 0 ? void 0 : options.isTableScalingEnabled,
435
436
  getEditorFeatureFlags: (options === null || options === void 0 ? void 0 : options.getEditorFeatureFlags) || defaultGetEditorFeatureFlags,
436
437
  ariaNotifyPlugin: ariaNotifyPlugin,
437
- api: api
438
+ api: api,
439
+ isCommentEditor: options === null || options === void 0 ? void 0 : options.isCommentEditor
438
440
  }), allowControls && !isDragAndDropEnabled && !isResizing && /*#__PURE__*/React.createElement(FloatingDeleteButton, {
439
441
  editorView: editorView,
440
442
  selection: editorView.state.selection,
@@ -1,3 +1,2 @@
1
1
  export { buildColumnControlsDecorations, maybeUpdateColumnControlsSelectedDecoration } from './column-controls';
2
- export { buildColumnResizingDecorations, clearColumnResizingDecorations } from './column-resizing';
3
- export { composeDecorations } from './compose-decorations';
2
+ export { buildColumnResizingDecorations, clearColumnResizingDecorations } from './column-resizing';
@@ -7,11 +7,11 @@ import { DropTargetType } from './consts';
7
7
  import { createCommand, getPluginState } from './plugin-factory';
8
8
  import { pluginKey } from './plugin-key';
9
9
  // TODO: This command is a placeholder example. Please replace this if required.
10
- export const getDecorations = state => {
10
+ const getDecorations = state => {
11
11
  var _pluginKey$getState;
12
12
  return ((_pluginKey$getState = pluginKey.getState(state)) === null || _pluginKey$getState === void 0 ? void 0 : _pluginKey$getState.decorationSet) || DecorationSet.empty;
13
13
  };
14
- export const updatePluginStateDecorations = (state, decorations, key) => updateDecorations(state.doc, getDecorations(state), decorations, key);
14
+ const updatePluginStateDecorations = (state, decorations, key) => updateDecorations(state.doc, getDecorations(state), decorations, key);
15
15
  export const setDropTarget = (type, index, hasMergedCells, tr) => createCommand(state => {
16
16
  const {
17
17
  dropTargetType,
@@ -1,3 +1,2 @@
1
1
  export { createPlugin } from './plugin';
2
- export { pluginKey } from './plugin-key';
3
- export { setDropTarget, clearDropTarget } from './commands';
2
+ export { pluginKey } from './plugin-key';
@@ -173,10 +173,13 @@ const destroyFn = (editorView, editorAnalyticsAPI, isTableScalingEnabled, isTabl
173
173
  if (isTableScalingWithFixedColumnWidthsOptionEnabled) {
174
174
  isTableScalingEnabledOnCurrentTable = tableNode.attrs.displayMode !== 'fixed';
175
175
  }
176
+ if (isTableScalingEnabled && isCommentEditor) {
177
+ isTableScalingEnabledOnCurrentTable = true;
178
+ }
176
179
  const shouldUseIncreasedScalingPercent = isTableScalingWithFixedColumnWidthsOptionEnabled && fg('platform.editor.table.use-increased-scaling-percent') ||
177
180
  // When in comment editor, we need the scaling percent to be 40% while tableWithFixedColumnWidthsOption is not visible
178
181
  isTableScalingEnabled && isCommentEditor;
179
- insertColgroupFromNode(tableRef, tableNode, isTableScalingEnabledOnCurrentTable, undefined, shouldUseIncreasedScalingPercent);
182
+ insertColgroupFromNode(tableRef, tableNode, isTableScalingEnabledOnCurrentTable, undefined, shouldUseIncreasedScalingPercent, isCommentEditor);
180
183
  }
181
184
  }
182
185
  editorView.focus();
@@ -1,2 +1 @@
1
- export { getDraggableDataFromEvent } from './monitor';
2
1
  export { autoScrollerFactory } from './autoscrollers';
@@ -6,7 +6,7 @@
6
6
  import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
7
7
  import { PluginKey } from '@atlaskit/editor-prosemirror/state';
8
8
  import { Decoration, DecorationSet } from '@atlaskit/editor-prosemirror/view';
9
- export const tableSafariDeleteCompositionTextIssueWorkaroundKey = new PluginKey('tableSafariDeleteCompositionTextIssueWorkaround');
9
+ const tableSafariDeleteCompositionTextIssueWorkaroundKey = new PluginKey('tableSafariDeleteCompositionTextIssueWorkaround');
10
10
  export const createPlugin = () => {
11
11
  return new SafePlugin({
12
12
  key: tableSafariDeleteCompositionTextIssueWorkaroundKey,
@@ -1,4 +1,3 @@
1
1
  export { createPlugin } from './plugin';
2
2
  export { pluginKey } from './plugin-key';
3
- export { findStickyHeaderForTable } from './util';
4
- export { updateStickyState, removeStickyState } from './commands';
3
+ export { findStickyHeaderForTable } from './util';
@@ -4,7 +4,7 @@
4
4
  import { ACTION_SUBJECT, EVENT_TYPE, TABLE_ACTION, TABLE_OVERFLOW_CHANGE_TRIGGER } from '@atlaskit/editor-common/analytics';
5
5
  import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
6
6
  import { PluginKey } from '@atlaskit/editor-prosemirror/state';
7
- export const pluginKey = new PluginKey('tableOverflowAnalyticsPlugin');
7
+ const pluginKey = new PluginKey('tableOverflowAnalyticsPlugin');
8
8
  export const META_KEYS = {
9
9
  OVERFLOW_TRIGGER: 'tableOverflowTrigger',
10
10
  OVERFLOW_STATE_CHANGED: 'tableOverflowStateChanged'
@@ -58,7 +58,7 @@ export const setDragging = (dragging, tr) => createCommand({
58
58
  dragging
59
59
  }
60
60
  }, originalTr => (tr || originalTr).setMeta('is-resizer-resizing', true));
61
- export const setLastClick = (lastClick, transform) => createCommand({
61
+ const setLastClick = (lastClick, transform) => createCommand({
62
62
  type: 'SET_LAST_CLICK',
63
63
  data: {
64
64
  lastClick
@@ -13,8 +13,11 @@ import { META_KEYS } from '../table-analytics';
13
13
  import { evenColumns, setDragging, stopResizing } from './commands';
14
14
  import { getPluginState } from './plugin-factory';
15
15
  import { currentColWidth, getResizeState, getTableMaxWidth, pointsAtCell, resizeColumn, resizeColumnAndTable, updateControls } from './utils';
16
+ import { TABLE_OFFSET_IN_COMMENT_EDITOR } from './utils/consts';
17
+ import { getScalingPercentForTableWithoutWidth, getTableScalingPercent } from './utils/misc';
16
18
  import { scaleResizeState } from './utils/resize-column';
17
19
  export const handleMouseDown = (view, event, localResizeHandlePos, getEditorContainerWidth, getEditorFeatureFlags, isTableScalingEnabled, api, editorAnalyticsAPI, isNewColumnResizingEnabled, isTableAlignmentEnabled, isCommentEditor) => {
20
+ var _originalTable$attrs;
18
21
  const {
19
22
  state,
20
23
  dispatch
@@ -48,13 +51,18 @@ export const handleMouseDown = (view, event, localResizeHandlePos, getEditorCont
48
51
  if (dom && dom.nodeName !== 'TABLE') {
49
52
  dom = dom.closest('table');
50
53
  }
51
- const maxSize = getTableMaxWidth({
52
- table: originalTable,
53
- tableStart: start,
54
- state,
55
- layout: originalTable.attrs.layout,
56
- getEditorContainerWidth
57
- });
54
+ let maxSize = 0;
55
+ if (isTableScalingEnabled && isCommentEditor && !((_originalTable$attrs = originalTable.attrs) !== null && _originalTable$attrs !== void 0 && _originalTable$attrs.width)) {
56
+ maxSize = editorWidth - TABLE_OFFSET_IN_COMMENT_EDITOR;
57
+ } else {
58
+ maxSize = getTableMaxWidth({
59
+ table: originalTable,
60
+ tableStart: start,
61
+ state,
62
+ layout: originalTable.attrs.layout,
63
+ getEditorContainerWidth
64
+ });
65
+ }
58
66
  let shouldScale = tableDepth === 0 && isTableScalingEnabled;
59
67
  const {
60
68
  tableWithFixedColumnWidthsOption = false
@@ -63,6 +71,11 @@ export const handleMouseDown = (view, event, localResizeHandlePos, getEditorCont
63
71
  if (isTableScalingWithFixedColumnWidthsOptionEnabled) {
64
72
  shouldScale = shouldScale && originalTable.attrs.displayMode !== 'fixed';
65
73
  }
74
+ let shouldUseIncreasedScalingPercent = isTableScalingWithFixedColumnWidthsOptionEnabled && fg('platform.editor.table.use-increased-scaling-percent');
75
+ if (isTableScalingEnabled && isCommentEditor) {
76
+ shouldScale = tableDepth === 0;
77
+ shouldUseIncreasedScalingPercent = true;
78
+ }
66
79
  let resizeState = getResizeState({
67
80
  minWidth: tableCellMinWidth,
68
81
  maxSize,
@@ -71,9 +84,8 @@ export const handleMouseDown = (view, event, localResizeHandlePos, getEditorCont
71
84
  start,
72
85
  domAtPos,
73
86
  isTableScalingEnabled: shouldScale,
74
- shouldUseIncreasedScalingPercent: isTableScalingWithFixedColumnWidthsOptionEnabled && fg('platform.editor.table.use-increased-scaling-percent') ||
75
- // When in comment editor, we need the scaling percent to be 40% while tableWithFixedColumnWidthsOption is not visible
76
- isTableScalingEnabled && !!isCommentEditor
87
+ shouldUseIncreasedScalingPercent,
88
+ isCommentEditor: isCommentEditor || false
77
89
  });
78
90
  if (evenColumns({
79
91
  resizeState,
@@ -102,7 +114,8 @@ export const handleMouseDown = (view, event, localResizeHandlePos, getEditorCont
102
114
  resizeState,
103
115
  tableRef: dom,
104
116
  tableNode: originalTable,
105
- editorWidth
117
+ editorWidth,
118
+ shouldUseIncreasedScalingPercent
106
119
  });
107
120
  }
108
121
  function finish(event) {
@@ -213,7 +226,9 @@ export const handleMouseDown = (view, event, localResizeHandlePos, getEditorCont
213
226
  tr.setNodeAttribute(start - 1, 'width', newResizeState.maxSize);
214
227
  }
215
228
  } else {
216
- const newResizeState = resizeColumn(resizeState, colIndex, resizedDelta, dom, originalTable, resizingSelectedColumns ? selectedColumns : undefined, shouldScale, shouldUseIncreasedScalingPercent);
229
+ var _table$attrs;
230
+ const scalePercent = isTableScalingEnabled && isCommentEditor && !((_table$attrs = table.attrs) !== null && _table$attrs !== void 0 && _table$attrs.width) ? getScalingPercentForTableWithoutWidth(originalTable, dom) : getTableScalingPercent(originalTable, dom, shouldUseIncreasedScalingPercent);
231
+ const newResizeState = resizeColumn(resizeState, colIndex, resizedDelta, dom, originalTable, resizingSelectedColumns ? selectedColumns : undefined, shouldScale, scalePercent);
217
232
  tr = updateColumnWidths(newResizeState, table, start, api)(tr);
218
233
  }
219
234
  if (colIndex === map.width - 1) {
@@ -289,7 +304,7 @@ export const handleMouseDown = (view, event, localResizeHandlePos, getEditorCont
289
304
  shouldScale = shouldScale && originalTable.attrs.displayMode !== 'fixed';
290
305
  }
291
306
  const resizedDelta = clientX - dragging.startX;
292
- if (isNewColumnResizingEnabled && !isTableNested(state, tablePos)) {
307
+ if (isNewColumnResizingEnabled && !isTableNested(state, tablePos) && !isCommentEditor) {
293
308
  resizeColumnAndTable({
294
309
  resizeState,
295
310
  colIndex,
@@ -301,7 +316,10 @@ export const handleMouseDown = (view, event, localResizeHandlePos, getEditorCont
301
316
  isTableAlignmentEnabled
302
317
  });
303
318
  } else {
304
- resizeColumn(resizeState, colIndex, resizedDelta, dom, table, undefined, shouldScale, shouldUseIncreasedScalingPercent);
319
+ var _table$attrs2;
320
+ const scalePercent = isTableScalingEnabled && isCommentEditor && !((_table$attrs2 = table.attrs) !== null && _table$attrs2 !== void 0 && _table$attrs2.width) ? getScalingPercentForTableWithoutWidth(table, dom) : getTableScalingPercent(originalTable, dom, shouldUseIncreasedScalingPercent);
321
+ // This function is called for Full-page/Fixed-page tables and table that have width attr value in Comment editor
322
+ resizeColumn(resizeState, colIndex, resizedDelta, dom, table, undefined, shouldScale, scalePercent);
305
323
  }
306
324
  updateControls()(state);
307
325
  }
@@ -2,7 +2,7 @@ import { tableCellMinWidth } from '@atlaskit/editor-common/styles';
2
2
  import { getFragmentBackingArray } from '@atlaskit/editor-common/utils';
3
3
  import { DOMSerializer } from '@atlaskit/editor-prosemirror/model';
4
4
  import { TableMap } from '@atlaskit/editor-tables/table-map';
5
- import { getTableScalingPercent } from './misc';
5
+ import { getScalingPercentForTableWithoutWidth, getTableScalingPercent } from './misc';
6
6
  /**
7
7
  * This ensures the combined width of the columns (and tbody) of table is always smaller or equal
8
8
  * than the table and table wrapper elements. This is necessary as there is no longer
@@ -10,7 +10,7 @@ import { getTableScalingPercent } from './misc';
10
10
  * overflow.
11
11
  */
12
12
  export const getColWidthFix = (colwidth, tableColumnCount) => colwidth - 1 / tableColumnCount;
13
- export const generateColgroup = (table, tableRef, shouldUseIncreasedScalingPercent) => {
13
+ export const generateColgroup = (table, tableRef, shouldUseIncreasedScalingPercent, isCommentEditor) => {
14
14
  const cols = [];
15
15
  const map = TableMap.get(table);
16
16
  table.content.firstChild.content.forEach(cell => {
@@ -19,7 +19,14 @@ export const generateColgroup = (table, tableRef, shouldUseIncreasedScalingPerce
19
19
  // We slice here to guard against our colwidth array having more entries
20
20
  // Than the we actually span. We'll patch the document at a later point.
21
21
  if (tableRef) {
22
- const scalePercent = getTableScalingPercent(table, tableRef, shouldUseIncreasedScalingPercent);
22
+ var _table$attrs;
23
+ // if we have tableRef here, isTableScalingEnabled is true
24
+ let scalePercent = 1;
25
+ if (isCommentEditor && !((_table$attrs = table.attrs) !== null && _table$attrs !== void 0 && _table$attrs.width)) {
26
+ scalePercent = getScalingPercentForTableWithoutWidth(table, tableRef);
27
+ } else {
28
+ scalePercent = getTableScalingPercent(table, tableRef, shouldUseIncreasedScalingPercent);
29
+ }
23
30
  cell.attrs.colwidth.slice(0, colspan).forEach(width => {
24
31
  const fixedColWidth = getColWidthFix(width, map.width);
25
32
  const scaledWidth = fixedColWidth * scalePercent;
@@ -48,12 +55,12 @@ export const generateColgroup = (table, tableRef, shouldUseIncreasedScalingPerce
48
55
  });
49
56
  return cols;
50
57
  };
51
- export const insertColgroupFromNode = (tableRef, table, isTableScalingEnabled = false, shouldRemove = true, shouldUseIncreasedScalingPercent = false) => {
58
+ export const insertColgroupFromNode = (tableRef, table, isTableScalingEnabled = false, shouldRemove = true, shouldUseIncreasedScalingPercent = false, isCommentEditor = false) => {
52
59
  let colgroup = tableRef === null || tableRef === void 0 ? void 0 : tableRef.querySelector('colgroup');
53
60
  if (colgroup && shouldRemove) {
54
61
  tableRef === null || tableRef === void 0 ? void 0 : tableRef.removeChild(colgroup);
55
62
  }
56
- colgroup = renderColgroupFromNode(table, isTableScalingEnabled ? tableRef !== null && tableRef !== void 0 ? tableRef : undefined : undefined, shouldUseIncreasedScalingPercent);
63
+ colgroup = renderColgroupFromNode(table, isTableScalingEnabled ? tableRef !== null && tableRef !== void 0 ? tableRef : undefined : undefined, shouldUseIncreasedScalingPercent, isCommentEditor);
57
64
  if (shouldRemove) {
58
65
  tableRef === null || tableRef === void 0 ? void 0 : tableRef.insertBefore(colgroup, tableRef === null || tableRef === void 0 ? void 0 : tableRef.firstChild);
59
66
  }
@@ -62,6 +69,7 @@ export const insertColgroupFromNode = (tableRef, table, isTableScalingEnabled =
62
69
  export const hasTableBeenResized = table => {
63
70
  return !!getFragmentBackingArray(table.content.firstChild.content).find(cell => cell.attrs.colwidth);
64
71
  };
72
+ export const hasTableColumnBeenResized = hasTableBeenResized;
65
73
 
66
74
  /**
67
75
  * Check if a table has all the column width set to tableCellMinWidth(48px) or null
@@ -76,8 +84,8 @@ export const isMinCellWidthTable = table => {
76
84
  });
77
85
  return isTableMinCellWidth;
78
86
  };
79
- function renderColgroupFromNode(table, maybeTableRef, shouldUseIncreasedScalingPercent) {
80
- const rendered = DOMSerializer.renderSpec(document, ['colgroup', {}, ...generateColgroup(table, maybeTableRef, shouldUseIncreasedScalingPercent)]);
87
+ function renderColgroupFromNode(table, maybeTableRef, shouldUseIncreasedScalingPercent, isCommentEditor) {
88
+ const rendered = DOMSerializer.renderSpec(document, ['colgroup', {}, ...generateColgroup(table, maybeTableRef, shouldUseIncreasedScalingPercent, isCommentEditor)]);
81
89
  return rendered.dom;
82
90
  }
83
91
  export const getColgroupChildrenLength = table => {
@@ -1,5 +1,4 @@
1
1
  export const COLUMN_MIN_WIDTH = 48;
2
- export const TABLE_DEFAULT_WIDTH = 760;
3
2
  export const TABLE_MAX_WIDTH = 1800;
4
3
  export const FULL_WIDTH_EDITOR_CONTENT_WIDTH = 1800;
5
4
  export const MAX_SCALING_PERCENT = 0.3;
@@ -62,7 +62,7 @@ export const updateStickyMargins = table => {
62
62
  const firstRowHeight = row.getBoundingClientRect().height - paddingTop - tableCellBorderWidth;
63
63
  table.style.marginTop = `${tableMarginTop + firstRowHeight}px`;
64
64
  };
65
- export const applyColWidthsToStickyRow = (colGroup, headerRow) => {
65
+ const applyColWidthsToStickyRow = (colGroup, headerRow) => {
66
66
  // sync column widths for the sticky row
67
67
  const newCols = colWidthsForRow(headerRow);
68
68
  if (newCols) {
@@ -80,7 +80,7 @@ export const syncStickyRowToTable = tableRef => {
80
80
  applyColWidthsToStickyRow(tableRef.querySelector('colgroup'), headerRow);
81
81
  applyTableWidthToStickyRow(tableRef, headerRow);
82
82
  };
83
- export const applyTableWidthToStickyRow = (tableRef, headerRow) => {
83
+ const applyTableWidthToStickyRow = (tableRef, headerRow) => {
84
84
  const tbody = tableRef.querySelector('tbody');
85
85
  const wrapper = tableRef.parentElement;
86
86
  if (tbody && wrapper) {
@@ -1,10 +1,9 @@
1
1
  export { generateColgroup, insertColgroupFromNode, hasTableBeenResized, getColgroupChildrenLength } from './colgroup';
2
2
  export { contentWidth } from './content-width';
3
- export { getColumnStateFromDOM, getFreeSpace, getCellsRefsInColumn, calculateColumnWidth, addContainerLeftRightPadding } from './column-state';
4
- export { growColumn, shrinkColumn, reduceSpace } from './resize-logic';
5
- export { getResizeState, updateColgroup, getTotalWidth, evenAllColumnsWidths, bulkColumnsResize, areColumnsEven, adjustColumnsWidths } from './resize-state';
6
- export { getLayoutSize, getDefaultLayoutMaxWidth, pointsAtCell, currentColWidth, domCellAround, getTableMaxWidth, getTableElementWidth, getTableContainerElementWidth } from './misc';
3
+ export { getCellsRefsInColumn, calculateColumnWidth } from './column-state';
4
+ export { getResizeState, updateColgroup, evenAllColumnsWidths } from './resize-state';
5
+ export { getLayoutSize, pointsAtCell, currentColWidth, getTableMaxWidth, getTableElementWidth, getTableContainerElementWidth } from './misc';
7
6
  export { updateControls, isClickNear, getResizeCellPos } from './dom';
8
- export { scale, scaleWithParent, scaleTable, previewScaleTable } from './scale-table';
7
+ export { scaleTable, previewScaleTable } from './scale-table';
9
8
  export { resizeColumn, resizeColumnAndTable } from './resize-column';
10
- export { COLUMN_MIN_WIDTH, TABLE_MAX_WIDTH, TABLE_DEFAULT_WIDTH, MAX_SCALING_PERCENT, MAX_SCALING_PERCENT_TABLES_WITH_FIXED_COLUMN_WIDTHS_OPTION, TABLE_OFFSET_IN_COMMENT_EDITOR } from './consts';
9
+ export { COLUMN_MIN_WIDTH, TABLE_MAX_WIDTH, TABLE_OFFSET_IN_COMMENT_EDITOR } from './consts';