@atlaskit/editor-plugin-table 1.1.1 → 1.1.3

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 (305) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/dist/cjs/index.js +0 -2
  3. package/dist/cjs/plugins/table/commands/clear.js +4 -16
  4. package/dist/cjs/plugins/table/commands/collapse.js +0 -6
  5. package/dist/cjs/plugins/table/commands/go-to-next-cell.js +7 -18
  6. package/dist/cjs/plugins/table/commands/hover.js +7 -37
  7. package/dist/cjs/plugins/table/commands/index.js +0 -8
  8. package/dist/cjs/plugins/table/commands/insert.js +17 -56
  9. package/dist/cjs/plugins/table/commands/misc.js +36 -132
  10. package/dist/cjs/plugins/table/commands/referentiality.js +0 -4
  11. package/dist/cjs/plugins/table/commands/selection.js +21 -87
  12. package/dist/cjs/plugins/table/commands/sort.js +2 -23
  13. package/dist/cjs/plugins/table/commands/split-cell.js +3 -11
  14. package/dist/cjs/plugins/table/commands/toggle.js +8 -34
  15. package/dist/cjs/plugins/table/commands-with-analytics.js +50 -139
  16. package/dist/cjs/plugins/table/create-plugin-config.js +0 -6
  17. package/dist/cjs/plugins/table/event-handlers.js +58 -160
  18. package/dist/cjs/plugins/table/handlers.js +10 -39
  19. package/dist/cjs/plugins/table/index.js +47 -91
  20. package/dist/cjs/plugins/table/nodeviews/OverflowShadowsObserver.js +8 -41
  21. package/dist/cjs/plugins/table/nodeviews/TableComponent.js +95 -191
  22. package/dist/cjs/plugins/table/nodeviews/table.js +12 -70
  23. package/dist/cjs/plugins/table/nodeviews/tableCell.js +15 -39
  24. package/dist/cjs/plugins/table/nodeviews/update-overflow-shadows.js +3 -15
  25. package/dist/cjs/plugins/table/pm-plugins/decorations/plugin.js +0 -18
  26. package/dist/cjs/plugins/table/pm-plugins/decorations/utils/column-controls.js +8 -27
  27. package/dist/cjs/plugins/table/pm-plugins/decorations/utils/column-resizing.js +8 -20
  28. package/dist/cjs/plugins/table/pm-plugins/decorations/utils/compose-decorations.js +1 -3
  29. package/dist/cjs/plugins/table/pm-plugins/decorations/utils/index.js +0 -3
  30. package/dist/cjs/plugins/table/pm-plugins/keymap.js +2 -15
  31. package/dist/cjs/plugins/table/pm-plugins/main.js +20 -72
  32. package/dist/cjs/plugins/table/pm-plugins/plugin-factory.js +25 -42
  33. package/dist/cjs/plugins/table/pm-plugins/plugin-key.js +0 -2
  34. package/dist/cjs/plugins/table/pm-plugins/safari-delayed-dom-selection-syncing-workaround.js +8 -8
  35. package/dist/cjs/plugins/table/pm-plugins/safari-delete-composition-text-issue-workaround.js +4 -23
  36. package/dist/cjs/plugins/table/pm-plugins/sticky-headers/commands.js +0 -5
  37. package/dist/cjs/plugins/table/pm-plugins/sticky-headers/index.js +0 -5
  38. package/dist/cjs/plugins/table/pm-plugins/sticky-headers/nodeviews/dom.js +4 -13
  39. package/dist/cjs/plugins/table/pm-plugins/sticky-headers/nodeviews/tableRow.js +56 -138
  40. package/dist/cjs/plugins/table/pm-plugins/sticky-headers/plugin-key.js +0 -2
  41. package/dist/cjs/plugins/table/pm-plugins/sticky-headers/plugin-state.js +15 -30
  42. package/dist/cjs/plugins/table/pm-plugins/sticky-headers/plugin.js +0 -6
  43. package/dist/cjs/plugins/table/pm-plugins/sticky-headers/util.js +0 -5
  44. package/dist/cjs/plugins/table/pm-plugins/table-local-id.js +13 -44
  45. package/dist/cjs/plugins/table/pm-plugins/table-resizing/commands.js +18 -43
  46. package/dist/cjs/plugins/table/pm-plugins/table-resizing/event-handlers.js +20 -52
  47. package/dist/cjs/plugins/table/pm-plugins/table-resizing/index.js +0 -4
  48. package/dist/cjs/plugins/table/pm-plugins/table-resizing/plugin-factory.js +0 -10
  49. package/dist/cjs/plugins/table/pm-plugins/table-resizing/plugin-key.js +0 -2
  50. package/dist/cjs/plugins/table/pm-plugins/table-resizing/plugin.js +5 -19
  51. package/dist/cjs/plugins/table/pm-plugins/table-resizing/reducer.js +0 -10
  52. package/dist/cjs/plugins/table/pm-plugins/table-resizing/utils/colgroup.js +16 -15
  53. package/dist/cjs/plugins/table/pm-plugins/table-resizing/utils/column-state.js +8 -28
  54. package/dist/cjs/plugins/table/pm-plugins/table-resizing/utils/content-width.js +3 -23
  55. package/dist/cjs/plugins/table/pm-plugins/table-resizing/utils/dom.js +4 -46
  56. package/dist/cjs/plugins/table/pm-plugins/table-resizing/utils/index.js +0 -9
  57. package/dist/cjs/plugins/table/pm-plugins/table-resizing/utils/misc.js +51 -40
  58. package/dist/cjs/plugins/table/pm-plugins/table-resizing/utils/resize-column.js +1 -4
  59. package/dist/cjs/plugins/table/pm-plugins/table-resizing/utils/resize-logic.js +17 -73
  60. package/dist/cjs/plugins/table/pm-plugins/table-resizing/utils/resize-state.js +34 -82
  61. package/dist/cjs/plugins/table/pm-plugins/table-resizing/utils/scale-table.js +12 -36
  62. package/dist/cjs/plugins/table/pm-plugins/table-resizing/utils/unit-to-number.js +0 -2
  63. package/dist/cjs/plugins/table/pm-plugins/table-selection-keymap.js +0 -5
  64. package/dist/cjs/plugins/table/reducer.js +0 -24
  65. package/dist/cjs/plugins/table/toolbar.js +14 -94
  66. package/dist/cjs/plugins/table/transforms/column-width.js +58 -49
  67. package/dist/cjs/plugins/table/transforms/delete-columns.js +11 -76
  68. package/dist/cjs/plugins/table/transforms/delete-rows.js +4 -42
  69. package/dist/cjs/plugins/table/transforms/fix-tables.js +24 -61
  70. package/dist/cjs/plugins/table/transforms/index.js +0 -7
  71. package/dist/cjs/plugins/table/transforms/merge.js +14 -90
  72. package/dist/cjs/plugins/table/transforms/metadata.js +0 -5
  73. package/dist/cjs/plugins/table/transforms/replace-table.js +2 -13
  74. package/dist/cjs/plugins/table/transforms/split.js +18 -32
  75. package/dist/cjs/plugins/table/types.js +0 -11
  76. package/dist/cjs/plugins/table/ui/FloatingContextualButton/index.js +10 -51
  77. package/dist/cjs/plugins/table/ui/FloatingContextualButton/styles.js +0 -12
  78. package/dist/cjs/plugins/table/ui/FloatingContextualMenu/ContextualMenu.js +46 -145
  79. package/dist/cjs/plugins/table/ui/FloatingContextualMenu/index.js +12 -35
  80. package/dist/cjs/plugins/table/ui/FloatingContextualMenu/styles.js +0 -11
  81. package/dist/cjs/plugins/table/ui/FloatingDeleteButton/DeleteButton.js +5 -12
  82. package/dist/cjs/plugins/table/ui/FloatingDeleteButton/getPopUpOptions.js +3 -16
  83. package/dist/cjs/plugins/table/ui/FloatingDeleteButton/index.js +19 -89
  84. package/dist/cjs/plugins/table/ui/FloatingInsertButton/InsertButton.js +6 -31
  85. package/dist/cjs/plugins/table/ui/FloatingInsertButton/getPopupOptions.js +5 -22
  86. package/dist/cjs/plugins/table/ui/FloatingInsertButton/index.js +25 -80
  87. package/dist/cjs/plugins/table/ui/LayoutButton/index.js +16 -64
  88. package/dist/cjs/plugins/table/ui/TableFloatingControls/CornerControls/index.js +14 -47
  89. package/dist/cjs/plugins/table/ui/TableFloatingControls/NumberColumn/index.js +20 -48
  90. package/dist/cjs/plugins/table/ui/TableFloatingControls/RowControls/index.js +10 -43
  91. package/dist/cjs/plugins/table/ui/TableFloatingControls/index.js +33 -74
  92. package/dist/cjs/plugins/table/ui/common-styles.js +10 -22
  93. package/dist/cjs/plugins/table/ui/consts.js +3 -8
  94. package/dist/cjs/plugins/table/ui/messages.js +0 -3
  95. package/dist/cjs/plugins/table/ui/ui-styles.js +0 -32
  96. package/dist/cjs/plugins/table/utils/analytics.js +4 -19
  97. package/dist/cjs/plugins/table/utils/collapse.js +4 -21
  98. package/dist/cjs/plugins/table/utils/column-controls.js +25 -61
  99. package/dist/cjs/plugins/table/utils/decoration.js +46 -114
  100. package/dist/cjs/plugins/table/utils/dom.js +4 -51
  101. package/dist/cjs/plugins/table/utils/get-allow-add-column-custom-step.js +0 -2
  102. package/dist/cjs/plugins/table/utils/index.js +0 -10
  103. package/dist/cjs/plugins/table/utils/nodes.js +5 -48
  104. package/dist/cjs/plugins/table/utils/paste.js +22 -47
  105. package/dist/cjs/plugins/table/utils/row-controls.js +6 -67
  106. package/dist/cjs/plugins/table/utils/selection.js +3 -36
  107. package/dist/cjs/plugins/table/utils/table.js +0 -11
  108. package/dist/cjs/plugins/table/utils/update-plugin-state-decorations.js +0 -4
  109. package/dist/cjs/plugins/table-plugin.js +0 -3
  110. package/dist/cjs/version.json +1 -1
  111. package/dist/es2019/plugins/table/commands/clear.js +3 -8
  112. package/dist/es2019/plugins/table/commands/collapse.js +0 -3
  113. package/dist/es2019/plugins/table/commands/go-to-next-cell.js +4 -7
  114. package/dist/es2019/plugins/table/commands/hover.js +7 -17
  115. package/dist/es2019/plugins/table/commands/insert.js +16 -36
  116. package/dist/es2019/plugins/table/commands/misc.js +37 -67
  117. package/dist/es2019/plugins/table/commands/selection.js +7 -62
  118. package/dist/es2019/plugins/table/commands/sort.js +0 -12
  119. package/dist/es2019/plugins/table/commands/split-cell.js +0 -4
  120. package/dist/es2019/plugins/table/commands/toggle.js +13 -15
  121. package/dist/es2019/plugins/table/commands-with-analytics.js +4 -14
  122. package/dist/es2019/plugins/table/event-handlers.js +14 -62
  123. package/dist/es2019/plugins/table/handlers.js +16 -26
  124. package/dist/es2019/plugins/table/index.js +12 -25
  125. package/dist/es2019/plugins/table/nodeviews/OverflowShadowsObserver.js +8 -40
  126. package/dist/es2019/plugins/table/nodeviews/TableComponent.js +40 -103
  127. package/dist/es2019/plugins/table/nodeviews/table.js +3 -33
  128. package/dist/es2019/plugins/table/nodeviews/tableCell.js +7 -16
  129. package/dist/es2019/plugins/table/nodeviews/update-overflow-shadows.js +3 -10
  130. package/dist/es2019/plugins/table/pm-plugins/decorations/plugin.js +0 -5
  131. package/dist/es2019/plugins/table/pm-plugins/decorations/utils/column-controls.js +4 -13
  132. package/dist/es2019/plugins/table/pm-plugins/decorations/utils/column-resizing.js +0 -3
  133. package/dist/es2019/plugins/table/pm-plugins/keymap.js +2 -3
  134. package/dist/es2019/plugins/table/pm-plugins/main.js +19 -43
  135. package/dist/es2019/plugins/table/pm-plugins/plugin-factory.js +2 -6
  136. package/dist/es2019/plugins/table/pm-plugins/safari-delayed-dom-selection-syncing-workaround.js +8 -3
  137. package/dist/es2019/plugins/table/pm-plugins/safari-delete-composition-text-issue-workaround.js +0 -12
  138. package/dist/es2019/plugins/table/pm-plugins/sticky-headers/nodeviews/dom.js +4 -9
  139. package/dist/es2019/plugins/table/pm-plugins/sticky-headers/nodeviews/tableRow.js +55 -130
  140. package/dist/es2019/plugins/table/pm-plugins/sticky-headers/plugin-state.js +2 -9
  141. package/dist/es2019/plugins/table/pm-plugins/sticky-headers/util.js +0 -3
  142. package/dist/es2019/plugins/table/pm-plugins/table-local-id.js +20 -39
  143. package/dist/es2019/plugins/table/pm-plugins/table-resizing/commands.js +14 -17
  144. package/dist/es2019/plugins/table/pm-plugins/table-resizing/event-handlers.js +13 -27
  145. package/dist/es2019/plugins/table/pm-plugins/table-resizing/plugin-factory.js +2 -4
  146. package/dist/es2019/plugins/table/pm-plugins/table-resizing/plugin.js +2 -5
  147. package/dist/es2019/plugins/table/pm-plugins/table-resizing/reducer.js +8 -8
  148. package/dist/es2019/plugins/table/pm-plugins/table-resizing/utils/colgroup.js +14 -3
  149. package/dist/es2019/plugins/table/pm-plugins/table-resizing/utils/column-state.js +8 -11
  150. package/dist/es2019/plugins/table/pm-plugins/table-resizing/utils/content-width.js +4 -21
  151. package/dist/es2019/plugins/table/pm-plugins/table-resizing/utils/dom.js +3 -22
  152. package/dist/es2019/plugins/table/pm-plugins/table-resizing/utils/misc.js +46 -21
  153. package/dist/es2019/plugins/table/pm-plugins/table-resizing/utils/resize-logic.js +31 -61
  154. package/dist/es2019/plugins/table/pm-plugins/table-resizing/utils/resize-state.js +54 -51
  155. package/dist/es2019/plugins/table/pm-plugins/table-resizing/utils/scale-table.js +9 -14
  156. package/dist/es2019/plugins/table/reducer.js +26 -30
  157. package/dist/es2019/plugins/table/toolbar.js +5 -48
  158. package/dist/es2019/plugins/table/transforms/column-width.js +60 -32
  159. package/dist/es2019/plugins/table/transforms/delete-columns.js +17 -58
  160. package/dist/es2019/plugins/table/transforms/delete-rows.js +8 -25
  161. package/dist/es2019/plugins/table/transforms/fix-tables.js +25 -42
  162. package/dist/es2019/plugins/table/transforms/merge.js +22 -70
  163. package/dist/es2019/plugins/table/transforms/metadata.js +3 -2
  164. package/dist/es2019/plugins/table/transforms/replace-table.js +0 -2
  165. package/dist/es2019/plugins/table/transforms/split.js +16 -19
  166. package/dist/es2019/plugins/table/types.js +2 -4
  167. package/dist/es2019/plugins/table/ui/FloatingContextualButton/index.js +2 -16
  168. package/dist/es2019/plugins/table/ui/FloatingContextualMenu/ContextualMenu.js +8 -54
  169. package/dist/es2019/plugins/table/ui/FloatingContextualMenu/index.js +4 -13
  170. package/dist/es2019/plugins/table/ui/FloatingDeleteButton/DeleteButton.js +0 -2
  171. package/dist/es2019/plugins/table/ui/FloatingDeleteButton/getPopUpOptions.js +2 -11
  172. package/dist/es2019/plugins/table/ui/FloatingDeleteButton/index.js +13 -49
  173. package/dist/es2019/plugins/table/ui/FloatingInsertButton/InsertButton.js +0 -8
  174. package/dist/es2019/plugins/table/ui/FloatingInsertButton/getPopupOptions.js +16 -24
  175. package/dist/es2019/plugins/table/ui/FloatingInsertButton/index.js +3 -31
  176. package/dist/es2019/plugins/table/ui/LayoutButton/index.js +2 -29
  177. package/dist/es2019/plugins/table/ui/TableFloatingControls/CornerControls/index.js +0 -12
  178. package/dist/es2019/plugins/table/ui/TableFloatingControls/NumberColumn/index.js +6 -12
  179. package/dist/es2019/plugins/table/ui/TableFloatingControls/RowControls/index.js +0 -9
  180. package/dist/es2019/plugins/table/ui/TableFloatingControls/index.js +4 -19
  181. package/dist/es2019/plugins/table/ui/common-styles.js +11 -7
  182. package/dist/es2019/plugins/table/ui/consts.js +4 -3
  183. package/dist/es2019/plugins/table/ui/ui-styles.js +0 -10
  184. package/dist/es2019/plugins/table/utils/analytics.js +0 -8
  185. package/dist/es2019/plugins/table/utils/collapse.js +3 -14
  186. package/dist/es2019/plugins/table/utils/column-controls.js +22 -37
  187. package/dist/es2019/plugins/table/utils/decoration.js +13 -51
  188. package/dist/es2019/plugins/table/utils/dom.js +3 -19
  189. package/dist/es2019/plugins/table/utils/nodes.js +2 -15
  190. package/dist/es2019/plugins/table/utils/paste.js +17 -22
  191. package/dist/es2019/plugins/table/utils/row-controls.js +12 -45
  192. package/dist/es2019/plugins/table/utils/selection.js +0 -21
  193. package/dist/es2019/plugins/table/utils/table.js +0 -2
  194. package/dist/es2019/version.json +1 -1
  195. package/dist/esm/plugins/table/commands/clear.js +3 -8
  196. package/dist/esm/plugins/table/commands/collapse.js +0 -3
  197. package/dist/esm/plugins/table/commands/go-to-next-cell.js +6 -9
  198. package/dist/esm/plugins/table/commands/hover.js +8 -18
  199. package/dist/esm/plugins/table/commands/insert.js +16 -36
  200. package/dist/esm/plugins/table/commands/misc.js +39 -78
  201. package/dist/esm/plugins/table/commands/selection.js +21 -78
  202. package/dist/esm/plugins/table/commands/sort.js +2 -14
  203. package/dist/esm/plugins/table/commands/split-cell.js +3 -8
  204. package/dist/esm/plugins/table/commands/toggle.js +11 -20
  205. package/dist/esm/plugins/table/commands-with-analytics.js +50 -85
  206. package/dist/esm/plugins/table/create-plugin-config.js +0 -3
  207. package/dist/esm/plugins/table/event-handlers.js +58 -123
  208. package/dist/esm/plugins/table/handlers.js +11 -29
  209. package/dist/esm/plugins/table/index.js +47 -60
  210. package/dist/esm/plugins/table/nodeviews/OverflowShadowsObserver.js +8 -44
  211. package/dist/esm/plugins/table/nodeviews/TableComponent.js +95 -184
  212. package/dist/esm/plugins/table/nodeviews/table.js +12 -52
  213. package/dist/esm/plugins/table/nodeviews/tableCell.js +15 -33
  214. package/dist/esm/plugins/table/nodeviews/update-overflow-shadows.js +3 -10
  215. package/dist/esm/plugins/table/pm-plugins/decorations/plugin.js +0 -5
  216. package/dist/esm/plugins/table/pm-plugins/decorations/utils/column-controls.js +8 -19
  217. package/dist/esm/plugins/table/pm-plugins/decorations/utils/column-resizing.js +8 -13
  218. package/dist/esm/plugins/table/pm-plugins/decorations/utils/compose-decorations.js +1 -1
  219. package/dist/esm/plugins/table/pm-plugins/keymap.js +2 -3
  220. package/dist/esm/plugins/table/pm-plugins/main.js +20 -47
  221. package/dist/esm/plugins/table/pm-plugins/plugin-factory.js +25 -37
  222. package/dist/esm/plugins/table/pm-plugins/safari-delayed-dom-selection-syncing-workaround.js +8 -3
  223. package/dist/esm/plugins/table/pm-plugins/safari-delete-composition-text-issue-workaround.js +3 -15
  224. package/dist/esm/plugins/table/pm-plugins/sticky-headers/nodeviews/dom.js +4 -9
  225. package/dist/esm/plugins/table/pm-plugins/sticky-headers/nodeviews/tableRow.js +58 -147
  226. package/dist/esm/plugins/table/pm-plugins/sticky-headers/plugin-state.js +15 -27
  227. package/dist/esm/plugins/table/pm-plugins/sticky-headers/util.js +0 -3
  228. package/dist/esm/plugins/table/pm-plugins/table-local-id.js +14 -37
  229. package/dist/esm/plugins/table/pm-plugins/table-resizing/commands.js +18 -25
  230. package/dist/esm/plugins/table/pm-plugins/table-resizing/event-handlers.js +20 -36
  231. package/dist/esm/plugins/table/pm-plugins/table-resizing/plugin-factory.js +0 -6
  232. package/dist/esm/plugins/table/pm-plugins/table-resizing/plugin.js +5 -8
  233. package/dist/esm/plugins/table/pm-plugins/table-resizing/reducer.js +0 -7
  234. package/dist/esm/plugins/table/pm-plugins/table-resizing/utils/colgroup.js +14 -3
  235. package/dist/esm/plugins/table/pm-plugins/table-resizing/utils/column-state.js +8 -12
  236. package/dist/esm/plugins/table/pm-plugins/table-resizing/utils/content-width.js +5 -22
  237. package/dist/esm/plugins/table/pm-plugins/table-resizing/utils/dom.js +4 -23
  238. package/dist/esm/plugins/table/pm-plugins/table-resizing/utils/misc.js +49 -26
  239. package/dist/esm/plugins/table/pm-plugins/table-resizing/utils/resize-logic.js +17 -62
  240. package/dist/esm/plugins/table/pm-plugins/table-resizing/utils/resize-state.js +34 -55
  241. package/dist/esm/plugins/table/pm-plugins/table-resizing/utils/scale-table.js +12 -24
  242. package/dist/esm/plugins/table/reducer.js +0 -20
  243. package/dist/esm/plugins/table/toolbar.js +13 -63
  244. package/dist/esm/plugins/table/transforms/column-width.js +58 -36
  245. package/dist/esm/plugins/table/transforms/delete-columns.js +11 -62
  246. package/dist/esm/plugins/table/transforms/delete-rows.js +4 -30
  247. package/dist/esm/plugins/table/transforms/fix-tables.js +24 -49
  248. package/dist/esm/plugins/table/transforms/merge.js +16 -75
  249. package/dist/esm/plugins/table/transforms/metadata.js +3 -2
  250. package/dist/esm/plugins/table/transforms/replace-table.js +2 -6
  251. package/dist/esm/plugins/table/transforms/split.js +18 -29
  252. package/dist/esm/plugins/table/types.js +0 -6
  253. package/dist/esm/plugins/table/ui/FloatingContextualButton/index.js +10 -31
  254. package/dist/esm/plugins/table/ui/FloatingContextualButton/styles.js +0 -2
  255. package/dist/esm/plugins/table/ui/FloatingContextualMenu/ContextualMenu.js +46 -126
  256. package/dist/esm/plugins/table/ui/FloatingContextualMenu/index.js +13 -24
  257. package/dist/esm/plugins/table/ui/FloatingContextualMenu/styles.js +0 -2
  258. package/dist/esm/plugins/table/ui/FloatingDeleteButton/DeleteButton.js +5 -7
  259. package/dist/esm/plugins/table/ui/FloatingDeleteButton/getPopUpOptions.js +3 -13
  260. package/dist/esm/plugins/table/ui/FloatingDeleteButton/index.js +19 -68
  261. package/dist/esm/plugins/table/ui/FloatingInsertButton/InsertButton.js +6 -14
  262. package/dist/esm/plugins/table/ui/FloatingInsertButton/getPopupOptions.js +5 -18
  263. package/dist/esm/plugins/table/ui/FloatingInsertButton/index.js +25 -57
  264. package/dist/esm/plugins/table/ui/LayoutButton/index.js +16 -47
  265. package/dist/esm/plugins/table/ui/TableFloatingControls/CornerControls/index.js +14 -35
  266. package/dist/esm/plugins/table/ui/TableFloatingControls/NumberColumn/index.js +20 -38
  267. package/dist/esm/plugins/table/ui/TableFloatingControls/RowControls/index.js +10 -29
  268. package/dist/esm/plugins/table/ui/TableFloatingControls/index.js +33 -62
  269. package/dist/esm/plugins/table/ui/common-styles.js +9 -10
  270. package/dist/esm/plugins/table/ui/consts.js +4 -3
  271. package/dist/esm/plugins/table/ui/ui-styles.js +0 -12
  272. package/dist/esm/plugins/table/utils/analytics.js +4 -13
  273. package/dist/esm/plugins/table/utils/collapse.js +4 -15
  274. package/dist/esm/plugins/table/utils/column-controls.js +25 -41
  275. package/dist/esm/plugins/table/utils/decoration.js +46 -88
  276. package/dist/esm/plugins/table/utils/dom.js +4 -20
  277. package/dist/esm/plugins/table/utils/nodes.js +5 -18
  278. package/dist/esm/plugins/table/utils/paste.js +24 -29
  279. package/dist/esm/plugins/table/utils/row-controls.js +6 -46
  280. package/dist/esm/plugins/table/utils/selection.js +3 -26
  281. package/dist/esm/plugins/table/utils/table.js +0 -2
  282. package/dist/esm/version.json +1 -1
  283. package/dist/types/plugins/table/pm-plugins/table-resizing/utils/colgroup.d.ts +7 -0
  284. package/dist/types/plugins/table/pm-plugins/table-resizing/utils/misc.d.ts +2 -1
  285. package/dist/types/plugins/table/ui/common-styles.d.ts +1 -0
  286. package/package.json +8 -6
  287. package/src/__tests__/integration/__fixtures__/empty-layout.ts +35 -0
  288. package/src/__tests__/integration/__fixtures__/nested-in-expand.ts +129 -0
  289. package/src/__tests__/integration/horizontal-scroll.ts +489 -0
  290. package/src/__tests__/unit/commands/insert.ts +3 -3
  291. package/src/__tests__/unit/keymap.ts +3 -1
  292. package/src/__tests__/unit/pm-plugins/table-resizing/colgroup.ts +38 -0
  293. package/src/__tests__/unit/pm-plugins/table-resizing/event-handlers.ts +5 -2
  294. package/src/__tests__/visual-regression/__image_snapshots__/cell-options-menu-ts-table-cell-options-menu-delete-column-menu-item-visual-hints-should-be-added-to-the-table-column-on-hover-1-snap.png +2 -2
  295. package/src/__tests__/visual-regression/__image_snapshots__/cell-options-menu-ts-table-cell-options-menu-delete-row-menu-item-visual-hints-should-be-added-to-the-table-row-on-hover-1-snap.png +2 -2
  296. package/src/__tests__/visual-regression/__image_snapshots__/sticky-header-ts-snapshot-test-table-sticky-header-should-align-with-table-cell-when-active-2-snap.png +2 -2
  297. package/src/__tests__/visual-regression/sticky-header.ts +2 -1
  298. package/src/plugins/table/nodeviews/TableComponent.tsx +16 -3
  299. package/src/plugins/table/pm-plugins/table-resizing/commands.ts +6 -2
  300. package/src/plugins/table/pm-plugins/table-resizing/event-handlers.ts +9 -1
  301. package/src/plugins/table/pm-plugins/table-resizing/utils/colgroup.ts +19 -1
  302. package/src/plugins/table/pm-plugins/table-resizing/utils/misc.ts +57 -5
  303. package/src/plugins/table/pm-plugins/table-resizing/utils/resize-logic.ts +2 -2
  304. package/src/plugins/table/transforms/column-width.ts +60 -6
  305. package/src/plugins/table/ui/common-styles.ts +5 -2
@@ -0,0 +1,129 @@
1
+ export default {
2
+ version: 1,
3
+ type: 'doc',
4
+ content: [
5
+ {
6
+ type: 'expand',
7
+ attrs: {
8
+ title: '',
9
+ },
10
+ content: [
11
+ {
12
+ type: 'table',
13
+ attrs: {
14
+ isNumberColumnEnabled: false,
15
+ layout: 'default',
16
+ localId: '30bc8b3b-d6b5-42c8-830b-71358eb3ab39',
17
+ },
18
+ content: [
19
+ {
20
+ type: 'tableRow',
21
+ content: [
22
+ {
23
+ type: 'tableHeader',
24
+ attrs: {},
25
+ content: [
26
+ {
27
+ type: 'paragraph',
28
+ content: [],
29
+ },
30
+ ],
31
+ },
32
+ {
33
+ type: 'tableHeader',
34
+ attrs: {},
35
+ content: [
36
+ {
37
+ type: 'paragraph',
38
+ content: [],
39
+ },
40
+ ],
41
+ },
42
+ {
43
+ type: 'tableHeader',
44
+ attrs: {},
45
+ content: [
46
+ {
47
+ type: 'paragraph',
48
+ content: [],
49
+ },
50
+ ],
51
+ },
52
+ ],
53
+ },
54
+ {
55
+ type: 'tableRow',
56
+ content: [
57
+ {
58
+ type: 'tableCell',
59
+ attrs: {},
60
+ content: [
61
+ {
62
+ type: 'paragraph',
63
+ content: [],
64
+ },
65
+ ],
66
+ },
67
+ {
68
+ type: 'tableCell',
69
+ attrs: {},
70
+ content: [
71
+ {
72
+ type: 'paragraph',
73
+ content: [],
74
+ },
75
+ ],
76
+ },
77
+ {
78
+ type: 'tableCell',
79
+ attrs: {},
80
+ content: [
81
+ {
82
+ type: 'paragraph',
83
+ content: [],
84
+ },
85
+ ],
86
+ },
87
+ ],
88
+ },
89
+ {
90
+ type: 'tableRow',
91
+ content: [
92
+ {
93
+ type: 'tableCell',
94
+ attrs: {},
95
+ content: [
96
+ {
97
+ type: 'paragraph',
98
+ content: [],
99
+ },
100
+ ],
101
+ },
102
+ {
103
+ type: 'tableCell',
104
+ attrs: {},
105
+ content: [
106
+ {
107
+ type: 'paragraph',
108
+ content: [],
109
+ },
110
+ ],
111
+ },
112
+ {
113
+ type: 'tableCell',
114
+ attrs: {},
115
+ content: [
116
+ {
117
+ type: 'paragraph',
118
+ content: [],
119
+ },
120
+ ],
121
+ },
122
+ ],
123
+ },
124
+ ],
125
+ },
126
+ ],
127
+ },
128
+ ],
129
+ };
@@ -0,0 +1,489 @@
1
+ import WebdriverPage from '@atlaskit/webdriver-runner/wd-wrapper';
2
+ import { BrowserTestCase } from '@atlaskit/webdriver-runner/runner';
3
+ import {
4
+ fullpage,
5
+ resizeColumn,
6
+ } from '@atlaskit/editor-test-helpers/integration/helpers';
7
+ import {
8
+ goToEditorTestingWDExample,
9
+ mountEditor,
10
+ } from '@atlaskit/editor-test-helpers/testing-example-page';
11
+ import {
12
+ insertColumn,
13
+ insertTable,
14
+ } from '@atlaskit/editor-test-helpers/page-objects/table';
15
+ import basicTableAdf from './__fixtures__/basic-table';
16
+ import nestedInExpand from './__fixtures__/nested-in-expand';
17
+ import { nestedInExtension } from './__fixtures__/nested-in-extension';
18
+ import { table as tableInsideLayout } from './__fixtures__/table-inside-layout';
19
+ import { emptyLayout } from './__fixtures__/empty-layout';
20
+
21
+ // TODO - Add wider screen size here once editor-common fix is made ED-16647
22
+ const screenWidths = [1920];
23
+
24
+ const breakout = async (
25
+ page: WebdriverPage,
26
+ breakoutButton: WebdriverIO.Element,
27
+ ) => {
28
+ let tableContainer = await page.$('.pm-table-container');
29
+
30
+ const currentWidth = await tableContainer.getCSSProperty('width');
31
+ breakoutButton.click();
32
+
33
+ await page.waitUntil(async () => {
34
+ tableContainer = await page.$('.pm-table-container');
35
+ const updatedWidth = await tableContainer.getCSSProperty('width');
36
+ return updatedWidth.value !== currentWidth.value;
37
+ });
38
+ };
39
+
40
+ const assertTableDoesNotScroll = async (page: WebdriverPage) => {
41
+ const table = await page.$('.pm-table-wrapper');
42
+
43
+ const tableScrollWidth = await table.getProperty('scrollWidth');
44
+ const tableOffsetWidth = await table.getProperty('offsetWidth');
45
+
46
+ expect(tableScrollWidth).toEqual(tableOffsetWidth);
47
+ };
48
+
49
+ const assertTableDoesScroll = async (page: WebdriverPage) => {
50
+ const table = await page.$('.pm-table-wrapper');
51
+
52
+ const tableScrollWidth = await table.getProperty('scrollWidth');
53
+ const tableOffsetWidth = (await table.getProperty('offsetWidth')) as number;
54
+
55
+ expect(tableScrollWidth).toBeGreaterThan(tableOffsetWidth);
56
+ };
57
+
58
+ // insertColumn helper doesn't work in Safari
59
+ BrowserTestCase(
60
+ 'Table: Does not scroll when column is resized and a new column is inserted',
61
+ { skip: ['safari'] },
62
+ async (client: any, testName: string) => {
63
+ for (const screenWidth of screenWidths) {
64
+ const page = await goToEditorTestingWDExample(
65
+ client,
66
+ 'editor-plugin-table',
67
+ { width: screenWidth, height: 1440 },
68
+ );
69
+
70
+ await mountEditor(page, {
71
+ appearance: fullpage.appearance,
72
+ defaultValue: basicTableAdf,
73
+ allowTables: {
74
+ advanced: true,
75
+ allowDistributeColumns: true,
76
+ },
77
+ allowLayouts: true,
78
+ });
79
+
80
+ await resizeColumn(page, { cellHandlePos: 2, resizeWidth: -100 });
81
+ await insertColumn(page, 0, 'right');
82
+ await assertTableDoesNotScroll(page);
83
+ }
84
+ },
85
+ );
86
+
87
+ // insertColumn helper doesn't work in Safari
88
+ BrowserTestCase(
89
+ 'Table: Does not scroll when column is resized and breakout button is clicked 3x',
90
+ { skip: ['safari'] },
91
+ async (client: any, testName: string) => {
92
+ for (const screenWidth of screenWidths) {
93
+ const page = await goToEditorTestingWDExample(
94
+ client,
95
+ 'editor-plugin-table',
96
+ { width: screenWidth, height: 1440 },
97
+ );
98
+
99
+ await mountEditor(page, {
100
+ appearance: fullpage.appearance,
101
+ defaultValue: basicTableAdf,
102
+ allowTables: {
103
+ advanced: true,
104
+ allowDistributeColumns: true,
105
+ },
106
+ allowLayouts: true,
107
+ allowBreakout: true,
108
+ });
109
+
110
+ await resizeColumn(page, { cellHandlePos: 2, resizeWidth: -100 });
111
+ await insertColumn(page, 0, 'right');
112
+
113
+ const breakoutButton = await page.$('[aria-label="Go wide"]');
114
+
115
+ await breakout(page, breakoutButton);
116
+ await assertTableDoesNotScroll(page);
117
+
118
+ await breakout(page, breakoutButton);
119
+ await assertTableDoesNotScroll(page);
120
+
121
+ await breakout(page, breakoutButton);
122
+ await assertTableDoesNotScroll(page);
123
+ }
124
+ },
125
+ );
126
+
127
+ BrowserTestCase(
128
+ 'Table: Does not scroll when nested in expand, column is resized and breakout button is clicked',
129
+ { skip: [] },
130
+ async (client: any, testName: string) => {
131
+ for (const screenWidth of screenWidths) {
132
+ const page = await goToEditorTestingWDExample(
133
+ client,
134
+ 'editor-plugin-table',
135
+ { width: screenWidth, height: 1440 },
136
+ );
137
+
138
+ await mountEditor(page, {
139
+ appearance: fullpage.appearance,
140
+ defaultValue: nestedInExpand,
141
+ allowTables: {
142
+ advanced: true,
143
+ allowDistributeColumns: true,
144
+ },
145
+ allowExpand: true,
146
+ allowLayouts: true,
147
+ allowBreakout: true,
148
+ });
149
+
150
+ const breakoutButton = await page.$('[aria-label="Go wide"]');
151
+
152
+ await resizeColumn(page, { cellHandlePos: 3, resizeWidth: -100 });
153
+ await breakout(page, breakoutButton);
154
+ await assertTableDoesNotScroll(page);
155
+ }
156
+ },
157
+ );
158
+
159
+ BrowserTestCase(
160
+ 'Table: Last column can be resized to remove scroll',
161
+ { skip: [] },
162
+ async (client: any, testName: string) => {
163
+ for (const screenWidth of screenWidths) {
164
+ const page = await goToEditorTestingWDExample(
165
+ client,
166
+ 'editor-plugin-table',
167
+ { width: screenWidth, height: 1440 },
168
+ );
169
+
170
+ await mountEditor(page, {
171
+ appearance: fullpage.appearance,
172
+ defaultValue: basicTableAdf,
173
+ allowTables: {
174
+ advanced: true,
175
+ allowDistributeColumns: true,
176
+ },
177
+ allowExpand: true,
178
+ allowLayouts: true,
179
+ allowBreakout: true,
180
+ });
181
+
182
+ await resizeColumn(page, { cellHandlePos: 2, resizeWidth: 1000 });
183
+ await assertTableDoesScroll(page);
184
+ await resizeColumn(page, { cellHandlePos: 10, resizeWidth: -1000 });
185
+ await assertTableDoesNotScroll(page);
186
+ }
187
+ },
188
+ );
189
+
190
+ BrowserTestCase(
191
+ 'Table: When nested in expand, last column can be resized to remove scroll',
192
+ { skip: [] },
193
+ async (client: any, testName: string) => {
194
+ for (const screenWidth of screenWidths) {
195
+ const page = await goToEditorTestingWDExample(
196
+ client,
197
+ 'editor-plugin-table',
198
+ { width: screenWidth, height: 1440 },
199
+ );
200
+
201
+ await mountEditor(page, {
202
+ appearance: fullpage.appearance,
203
+ defaultValue: nestedInExpand,
204
+ allowTables: {
205
+ advanced: true,
206
+ allowDistributeColumns: true,
207
+ },
208
+ allowExpand: true,
209
+ allowLayouts: true,
210
+ allowBreakout: true,
211
+ });
212
+
213
+ await resizeColumn(page, { cellHandlePos: 3, resizeWidth: 1000 });
214
+ await assertTableDoesScroll(page);
215
+ await resizeColumn(page, { cellHandlePos: 11, resizeWidth: -1000 });
216
+ await assertTableDoesNotScroll(page);
217
+ }
218
+ },
219
+ );
220
+
221
+ BrowserTestCase(
222
+ 'Table: When nested in layout, last column can be resized to remove scroll',
223
+ { skip: [] },
224
+ async (client: any, testName: string) => {
225
+ for (const screenWidth of screenWidths) {
226
+ const page = await goToEditorTestingWDExample(
227
+ client,
228
+ 'editor-plugin-table',
229
+ { width: screenWidth, height: 1440 },
230
+ );
231
+
232
+ await mountEditor(page, {
233
+ appearance: fullpage.appearance,
234
+ defaultValue: tableInsideLayout,
235
+ allowTables: {
236
+ advanced: true,
237
+ allowDistributeColumns: true,
238
+ },
239
+ allowExpand: true,
240
+ allowLayouts: true,
241
+ allowBreakout: true,
242
+ });
243
+
244
+ await resizeColumn(page, { cellHandlePos: 8, resizeWidth: 1000 });
245
+ await assertTableDoesScroll(page);
246
+ await resizeColumn(page, { cellHandlePos: 16, resizeWidth: -1000 });
247
+ await assertTableDoesNotScroll(page);
248
+ }
249
+ },
250
+ );
251
+
252
+ BrowserTestCase(
253
+ 'Table: When nested in bodied macro, last column can be resized to remove scroll',
254
+ { skip: [] },
255
+ async (client: any, testName: string) => {
256
+ for (const screenWidth of screenWidths) {
257
+ const page = await goToEditorTestingWDExample(
258
+ client,
259
+ 'editor-plugin-table',
260
+ { width: screenWidth, height: 1440 },
261
+ );
262
+
263
+ await mountEditor(page, {
264
+ appearance: fullpage.appearance,
265
+ defaultValue: nestedInExtension,
266
+ allowTables: {
267
+ advanced: true,
268
+ allowDistributeColumns: true,
269
+ },
270
+ allowExpand: true,
271
+ allowLayouts: true,
272
+ allowBreakout: true,
273
+ allowExtension: true,
274
+ });
275
+
276
+ await resizeColumn(page, { cellHandlePos: 3, resizeWidth: 1000 });
277
+ await assertTableDoesScroll(page);
278
+ await resizeColumn(page, { cellHandlePos: 11, resizeWidth: -1000 });
279
+ await assertTableDoesNotScroll(page);
280
+ }
281
+ },
282
+ );
283
+
284
+ // insertColumn helper doesn't work in Safari
285
+ BrowserTestCase(
286
+ 'Table: Scrolls when there are more columns added than can fit the current width',
287
+ { skip: ['safari'] },
288
+ async (client: any, testName: string) => {
289
+ for (const screenWidth of screenWidths) {
290
+ const page = await goToEditorTestingWDExample(
291
+ client,
292
+ 'editor-plugin-table',
293
+ { width: screenWidth, height: 1440 },
294
+ );
295
+
296
+ await mountEditor(page, {
297
+ appearance: fullpage.appearance,
298
+ defaultValue: basicTableAdf,
299
+ allowTables: {
300
+ advanced: true,
301
+ allowDistributeColumns: true,
302
+ },
303
+ allowExpand: true,
304
+ allowLayouts: true,
305
+ allowBreakout: true,
306
+ });
307
+
308
+ const numberOfColumns = 14;
309
+ for (const _column of [...Array(numberOfColumns).keys()]) {
310
+ await insertColumn(page, 0, 'right');
311
+ }
312
+
313
+ await assertTableDoesScroll(page);
314
+ }
315
+ },
316
+ );
317
+
318
+ // insertColumn helper doesn't work in Safari
319
+ BrowserTestCase(
320
+ 'Table: Does not scroll when nested in Bodied Macro, column is resized and breakout button is clicked',
321
+ { skip: ['safari'] },
322
+ async (client: any, testName: string) => {
323
+ for (const screenWidth of screenWidths) {
324
+ const page = await goToEditorTestingWDExample(
325
+ client,
326
+ 'editor-plugin-table',
327
+ { width: screenWidth, height: 1440 },
328
+ );
329
+
330
+ await mountEditor(page, {
331
+ appearance: fullpage.appearance,
332
+ defaultValue: JSON.stringify(nestedInExtension),
333
+ allowTables: {
334
+ advanced: true,
335
+ },
336
+ allowExtension: true,
337
+ });
338
+
339
+ await resizeColumn(page, { cellHandlePos: 3, resizeWidth: -100 });
340
+ await insertColumn(page, 0, 'right');
341
+ await assertTableDoesNotScroll(page);
342
+ }
343
+ },
344
+ );
345
+
346
+ BrowserTestCase(
347
+ 'Table: Does not scroll when nested in layout, column is resized and breakout button is clicked',
348
+ { skip: [] },
349
+ async (client: any, testName: string) => {
350
+ for (const screenWidth of screenWidths) {
351
+ const page = await goToEditorTestingWDExample(
352
+ client,
353
+ 'editor-plugin-table',
354
+ { width: screenWidth, height: 1440 },
355
+ );
356
+
357
+ await mountEditor(page, {
358
+ appearance: fullpage.appearance,
359
+ defaultValue: JSON.stringify(tableInsideLayout),
360
+ allowTables: {
361
+ advanced: true,
362
+ },
363
+ allowLayouts: {
364
+ allowBreakout: true,
365
+ },
366
+ allowBreakout: true,
367
+ });
368
+
369
+ const breakoutButton = await page.$('[aria-label="Go wide"]');
370
+
371
+ await resizeColumn(page, { cellHandlePos: 8, resizeWidth: -100 });
372
+ await breakout(page, breakoutButton);
373
+ await assertTableDoesNotScroll(page);
374
+ }
375
+ },
376
+ );
377
+
378
+ BrowserTestCase(
379
+ 'Table: Does not scroll when nested in single column layout, table column is resized and breakout button is clicked',
380
+ { skip: [] },
381
+ async (client: any, testName: string) => {
382
+ for (const screenWidth of screenWidths) {
383
+ const page = await goToEditorTestingWDExample(
384
+ client,
385
+ 'editor-plugin-table',
386
+ { width: screenWidth, height: 1440 },
387
+ );
388
+
389
+ await mountEditor(page, {
390
+ appearance: fullpage.appearance,
391
+ defaultValue: JSON.stringify(tableInsideLayout),
392
+ allowTables: {
393
+ advanced: true,
394
+ allowDistributeColumns: true,
395
+ },
396
+ allowLayouts: {
397
+ allowBreakout: true,
398
+ UNSAFE_allowSingleColumnLayout: true,
399
+ },
400
+ allowBreakout: true,
401
+ });
402
+
403
+ await resizeColumn(page, { cellHandlePos: 8, resizeWidth: -100 });
404
+
405
+ const singleColumnButton = await page.$('[aria-label="Single column"]');
406
+ singleColumnButton.click();
407
+
408
+ const breakoutButton = await page.$('[aria-label="Go wide"]');
409
+
410
+ await breakout(page, breakoutButton);
411
+ await assertTableDoesNotScroll(page);
412
+ }
413
+ },
414
+ );
415
+
416
+ BrowserTestCase(
417
+ 'Table: Does not scroll when nested in three columns layout, table column is resized and breakout button is clicked',
418
+ { skip: [] },
419
+ async (client: any, testName: string) => {
420
+ for (const screenWidth of screenWidths) {
421
+ const page = await goToEditorTestingWDExample(
422
+ client,
423
+ 'editor-plugin-table',
424
+ { width: screenWidth, height: 1440 },
425
+ );
426
+
427
+ await mountEditor(page, {
428
+ appearance: fullpage.appearance,
429
+ defaultValue: JSON.stringify(tableInsideLayout),
430
+ allowTables: {
431
+ advanced: true,
432
+ allowDistributeColumns: true,
433
+ },
434
+ allowLayouts: {
435
+ allowBreakout: true,
436
+ UNSAFE_allowSingleColumnLayout: true,
437
+ },
438
+ allowBreakout: true,
439
+ });
440
+
441
+ await resizeColumn(page, { cellHandlePos: 8, resizeWidth: -100 });
442
+
443
+ const threeColumnButton = await page.$('[aria-label="Three columns"]');
444
+ threeColumnButton.click();
445
+
446
+ const breakoutButton = await page.$('[aria-label="Go wide"]');
447
+
448
+ await breakout(page, breakoutButton);
449
+ await assertTableDoesNotScroll(page);
450
+ }
451
+ },
452
+ );
453
+
454
+ // insertColumn helper doesn't work in Safari
455
+ BrowserTestCase(
456
+ 'Table: Does not scroll when nested in full-width layout, columns is resized and new column is inserted',
457
+ { skip: ['safari'] },
458
+ async (client: any, testName: string) => {
459
+ for (const screenWidth of screenWidths) {
460
+ const page = await goToEditorTestingWDExample(
461
+ client,
462
+ 'editor-plugin-table',
463
+ { width: screenWidth, height: 1440 },
464
+ );
465
+
466
+ await mountEditor(page, {
467
+ appearance: fullpage.appearance,
468
+ defaultValue: emptyLayout,
469
+ allowTables: {
470
+ advanced: true,
471
+ },
472
+ allowLayouts: {
473
+ allowBreakout: true,
474
+ },
475
+ allowBreakout: true,
476
+ });
477
+
478
+ const goWideButton = await page.$('[aria-label="Go wide"]');
479
+ goWideButton.click();
480
+ goWideButton.click();
481
+
482
+ insertTable(page);
483
+ await assertTableDoesNotScroll(page);
484
+ await resizeColumn(page, { cellHandlePos: 4, resizeWidth: -100 });
485
+ await insertColumn(page, 0, 'right');
486
+ await assertTableDoesNotScroll(page);
487
+ }
488
+ },
489
+ );
@@ -58,9 +58,9 @@ describe('table plugin: insert', () => {
58
58
  doc(
59
59
  table({ localId: TABLE_LOCAL_ID })(
60
60
  tr(
61
- td({ colwidth: [200] })(p('')),
62
- td({ colwidth: [200] })(p('')),
63
- td({ colwidth: [200] })(p('')),
61
+ td({ colwidth: [230] })(p('')),
62
+ td({ colwidth: [230] })(p('')),
63
+ td({ colwidth: [230] })(p('')),
64
64
  ),
65
65
  ),
66
66
  ),
@@ -57,6 +57,7 @@ import tablePlugin from '../../plugins/table';
57
57
  import { TablePluginState } from '../../plugins/table/types';
58
58
  import { pluginKey } from '../../plugins/table/pm-plugins/plugin-key';
59
59
  import featureFlagsPlugin from '@atlaskit/editor-core/src/plugins/feature-flags-context';
60
+ import widthPlugin from '@atlaskit/editor-core/src/plugins/width';
60
61
 
61
62
  const TABLE_LOCAL_ID = 'test-table-local-id';
62
63
 
@@ -101,7 +102,8 @@ describe('table keymap', () => {
101
102
  .add([statusPlugin, { menuDisabled: false }])
102
103
  .add([mediaPlugin, { allowMediaSingle: true }])
103
104
  .add([analyticsPlugin, { createAnalyticsEvent }])
104
- .add([featureFlagsPlugin, {}]);
105
+ .add([featureFlagsPlugin, {}])
106
+ .add(widthPlugin);
105
107
 
106
108
  const editor = (doc: DocBuilder) =>
107
109
  createEditor<TablePluginState, PluginKey>({
@@ -1,5 +1,6 @@
1
1
  import { p, table, tr, td } from '@atlaskit/editor-test-helpers/doc-builder';
2
2
  import defaultSchema from '@atlaskit/editor-test-helpers/schema';
3
+ import { isMinCellWidthTable } from '../../../../plugins/table/pm-plugins/table-resizing/utils/colgroup';
3
4
  import { generateColgroup } from '../../../../plugins/table/pm-plugins/table-resizing/utils';
4
5
 
5
6
  describe('table-resizing/colgroup', () => {
@@ -83,4 +84,41 @@ describe('table-resizing/colgroup', () => {
83
84
  }
84
85
  });
85
86
  });
87
+
88
+ //isMinCellWidthTable function test
89
+ describe('#isMinCellWidthTable', () => {
90
+ describe('check if a table has all the columns with minimum width', () => {
91
+ it('when input table has all columns in minimum width', () => {
92
+ const result = isMinCellWidthTable(getMinCellWidthTable());
93
+
94
+ expect(result).toEqual(true);
95
+ });
96
+
97
+ it('when input table has a column that is not minimum width', () => {
98
+ const result = isMinCellWidthTable(getNonMinCellWidthTable());
99
+
100
+ expect(result).toEqual(false);
101
+ });
102
+
103
+ function getMinCellWidthTable() {
104
+ return table()(
105
+ tr(
106
+ td({ colwidth: [48] })(p('')),
107
+ td({ colwidth: [48] })(p('')),
108
+ td({ colwidth: [48] })(p('')),
109
+ ),
110
+ )(defaultSchema);
111
+ }
112
+
113
+ function getNonMinCellWidthTable() {
114
+ return table()(
115
+ tr(
116
+ td({ colwidth: [200] })(p('')),
117
+ td({ colwidth: [200] })(p('')),
118
+ td({ colwidth: [48] })(p('')),
119
+ ),
120
+ )(defaultSchema);
121
+ }
122
+ });
123
+ });
86
124
  });