@atlaskit/editor-plugin-table 1.1.0 → 1.1.2

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 (284) hide show
  1. package/CHANGELOG.md +12 -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 +82 -188
  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 +12 -42
  46. package/dist/cjs/plugins/table/pm-plugins/table-resizing/event-handlers.js +16 -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 +0 -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 +15 -36
  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 +15 -71
  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 +12 -45
  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 +6 -19
  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 +27 -100
  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 +7 -15
  144. package/dist/es2019/plugins/table/pm-plugins/table-resizing/event-handlers.js +9 -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 +0 -4
  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 +10 -18
  153. package/dist/es2019/plugins/table/pm-plugins/table-resizing/utils/resize-logic.js +29 -59
  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 +16 -28
  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 +6 -5
  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 +82 -181
  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 +12 -24
  230. package/dist/esm/plugins/table/pm-plugins/table-resizing/event-handlers.js +16 -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 +0 -4
  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 +15 -23
  239. package/dist/esm/plugins/table/pm-plugins/table-resizing/utils/resize-logic.js +15 -60
  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 +12 -32
  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 +6 -7
  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/package.json +2 -2
  284. package/src/__tests__/visual-regression/cell-options-menu.ts +1 -12
@@ -7,19 +7,17 @@ export var isIsolating = function isIsolating(node) {
7
7
  return !!node.type.spec.isolating;
8
8
  };
9
9
  export var containsHeaderColumn = function containsHeaderColumn(table) {
10
- var map = TableMap.get(table); // Get cell positions for first column.
11
-
10
+ var map = TableMap.get(table);
11
+ // Get cell positions for first column.
12
12
  var cellPositions = map.cellsInRect({
13
13
  left: 0,
14
14
  top: 0,
15
15
  right: 1,
16
16
  bottom: map.height
17
17
  });
18
-
19
18
  for (var i = 0; i < cellPositions.length; i++) {
20
19
  try {
21
20
  var cell = table.nodeAt(cellPositions[i]);
22
-
23
21
  if (cell && cell.type !== table.type.schema.nodes.tableHeader) {
24
22
  return false;
25
23
  }
@@ -27,20 +25,16 @@ export var containsHeaderColumn = function containsHeaderColumn(table) {
27
25
  return false;
28
26
  }
29
27
  }
30
-
31
28
  return true;
32
29
  };
33
30
  export var containsHeaderRow = function containsHeaderRow(table) {
34
31
  var map = TableMap.get(table);
35
-
36
32
  for (var i = 0; i < map.width; i++) {
37
33
  var cell = table.nodeAt(map.map[i]);
38
-
39
34
  if (cell && cell.type !== table.type.schema.nodes.tableHeader) {
40
35
  return false;
41
36
  }
42
37
  }
43
-
44
38
  return true;
45
39
  };
46
40
  export var checkIfHeaderColumnEnabled = function checkIfHeaderColumnEnabled(selection) {
@@ -57,9 +51,9 @@ export var checkIfNumberColumnEnabled = function checkIfNumberColumnEnabled(sele
57
51
  export var isLayoutSupported = function isLayoutSupported(state) {
58
52
  var permittedLayouts = pluginKey.getState(state).pluginConfig.permittedLayouts;
59
53
  var _state$schema$nodes = state.schema.nodes,
60
- bodiedExtension = _state$schema$nodes.bodiedExtension,
61
- layoutSection = _state$schema$nodes.layoutSection,
62
- expand = _state$schema$nodes.expand;
54
+ bodiedExtension = _state$schema$nodes.bodiedExtension,
55
+ layoutSection = _state$schema$nodes.layoutSection,
56
+ expand = _state$schema$nodes.expand;
63
57
  return !hasParentNodeOfType([expand, layoutSection, bodiedExtension])(state.selection) && permittedLayouts && (permittedLayouts === 'all' || permittedLayouts.indexOf('default') > -1 && permittedLayouts.indexOf('wide') > -1 && permittedLayouts.indexOf('full-page') > -1);
64
58
  };
65
59
  export var getTableWidth = function getTableWidth(node) {
@@ -70,11 +64,9 @@ export var getTableWidth = function getTableWidth(node) {
70
64
  export var tablesHaveDifferentColumnWidths = function tablesHaveDifferentColumnWidths(currentTable, previousTable) {
71
65
  var currentTableWidths = getTableWidths(currentTable);
72
66
  var previousTableWidths = getTableWidths(previousTable);
73
-
74
67
  if (currentTableWidths.length !== previousTableWidths.length) {
75
68
  return true;
76
69
  }
77
-
78
70
  var sameWidths = currentTableWidths.every(function (value, index) {
79
71
  return value === previousTableWidths[index];
80
72
  });
@@ -85,22 +77,17 @@ export var tablesHaveDifferentNoOfColumns = function tablesHaveDifferentNoOfColu
85
77
  var currentMap = TableMap.get(currentTable);
86
78
  return prevMap.width !== currentMap.width;
87
79
  };
88
-
89
80
  function filterNearSelection(selection, findNode, predicate, defaultValue) {
90
81
  var found = findNode(selection);
91
-
92
82
  if (!found) {
93
83
  return defaultValue;
94
84
  }
95
-
96
85
  return predicate(found.node, found.pos);
97
86
  }
98
-
99
87
  function getTableWidths(node) {
100
88
  if (!node.content.firstChild) {
101
89
  return [];
102
90
  }
103
-
104
91
  var tableWidths = [];
105
92
  node.content.firstChild.content.forEach(function (cell) {
106
93
  if (Array.isArray(cell.attrs.colwidth)) {
@@ -2,28 +2,26 @@ import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
2
2
  import { Fragment, Slice } from 'prosemirror-model';
3
3
  import { flatten } from 'prosemirror-utils';
4
4
  import { flatmap, mapSlice } from '@atlaskit/editor-common/utils';
5
- import { getPluginState } from '../pm-plugins/plugin-factory'; // lifts up the content of each cell, returning an array of nodes
5
+ import { getPluginState } from '../pm-plugins/plugin-factory';
6
6
 
7
+ // lifts up the content of each cell, returning an array of nodes
7
8
  export var unwrapContentFromTable = function unwrapContentFromTable(maybeTable) {
8
9
  var schema = maybeTable.type.schema;
9
-
10
10
  if (maybeTable.type === schema.nodes.table) {
11
11
  var content = [];
12
12
  var _schema$nodes = schema.nodes,
13
- tableCell = _schema$nodes.tableCell,
14
- tableHeader = _schema$nodes.tableHeader;
13
+ tableCell = _schema$nodes.tableCell,
14
+ tableHeader = _schema$nodes.tableHeader;
15
15
  maybeTable.descendants(function (maybeCell) {
16
16
  if (maybeCell.type === tableCell || maybeCell.type === tableHeader) {
17
17
  content.push.apply(content, _toConsumableArray(flatten(maybeCell, false).map(function (child) {
18
18
  return child.node;
19
19
  })));
20
20
  }
21
-
22
21
  return true;
23
22
  });
24
23
  return content;
25
24
  }
26
-
27
25
  return maybeTable;
28
26
  };
29
27
  export var removeTableFromFirstChild = function removeTableFromFirstChild(node, i) {
@@ -32,79 +30,76 @@ export var removeTableFromFirstChild = function removeTableFromFirstChild(node,
32
30
  export var removeTableFromLastChild = function removeTableFromLastChild(node, i, fragment) {
33
31
  return i === fragment.childCount - 1 ? unwrapContentFromTable(node) : node;
34
32
  };
33
+
35
34
  /**
36
35
  * When we copy from a table cell with a hardBreak at the end,
37
36
  * the slice generated will come with a hardBreak outside of the table.
38
37
  * This code will look for that pattern and fix it.
39
38
  */
40
-
41
39
  export var transformSliceToFixHardBreakProblemOnCopyFromCell = function transformSliceToFixHardBreakProblemOnCopyFromCell(slice, schema) {
42
40
  var _schema$nodes2 = schema.nodes,
43
- paragraph = _schema$nodes2.paragraph,
44
- table = _schema$nodes2.table,
45
- hardBreak = _schema$nodes2.hardBreak;
41
+ paragraph = _schema$nodes2.paragraph,
42
+ table = _schema$nodes2.table,
43
+ hardBreak = _schema$nodes2.hardBreak;
46
44
  var emptyParagraphNode = paragraph.createAndFill();
47
45
  var hardBreakNode = hardBreak === null || hardBreak === void 0 ? void 0 : hardBreak.createAndFill();
48
46
  var paragraphNodeSize = emptyParagraphNode ? emptyParagraphNode.nodeSize : 0;
49
47
  var hardBreakNodeSize = hardBreakNode ? hardBreakNode.nodeSize : 0;
50
48
  var paragraphWithHardBreakSize = paragraphNodeSize + hardBreakNodeSize;
51
-
52
49
  if (slice.content.childCount === 2 && slice.content.firstChild && slice.content.lastChild && slice.content.firstChild.type === table && slice.content.lastChild.type === paragraph && slice.content.lastChild.nodeSize === paragraphWithHardBreakSize) {
53
50
  var nodes = unwrapContentFromTable(slice.content.firstChild);
54
-
55
51
  if (nodes instanceof Array) {
56
- return new Slice(Fragment.from( // keep only the content and discard the hardBreak
52
+ return new Slice(Fragment.from(
53
+ // keep only the content and discard the hardBreak
57
54
  nodes[0]), slice.openStart, slice.openEnd);
58
55
  }
59
56
  }
60
-
61
57
  return slice;
62
58
  };
63
59
  export var transformSliceToRemoveOpenTable = function transformSliceToRemoveOpenTable(slice, schema) {
64
60
  var _slice$content$firstC6;
65
-
66
61
  // we're removing the table, tableRow and tableCell reducing the open depth by 3
67
- var depthDecrement = 3; // Case 1: A slice entirely within a single CELL
62
+ var depthDecrement = 3;
68
63
 
69
- if ( // starts and ends inside of a cell
70
- slice.openStart >= 4 && slice.openEnd >= 4 && // slice is a table node
64
+ // Case 1: A slice entirely within a single CELL
65
+ if (
66
+ // starts and ends inside of a cell
67
+ slice.openStart >= 4 && slice.openEnd >= 4 &&
68
+ // slice is a table node
71
69
  slice.content.childCount === 1 && slice.content.firstChild.type === schema.nodes.table) {
72
70
  var _slice$content$firstC, _slice$content$firstC2, _slice$content$firstC3, _slice$content$firstC4, _slice$content$firstC5;
73
-
74
71
  // prosemirror-view has a bug that it duplicates table entry when selecting multiple paragraphs in a table cell.
75
72
  // https://github.com/ProseMirror/prosemirror/issues/1270
76
73
  // The structure becomes
77
74
  // table(genuine) > tableRow(genuine) > table(duplicated) > tableRow(duplicated) > tableCell/tableHeader(genuine) > contents(genuine)
78
75
  // As we are removing wrapping table anyway, we keep duplicated table and tableRow for simplicity
79
76
  var cleaned = slice;
80
-
81
77
  if (((_slice$content$firstC = slice.content.firstChild) === null || _slice$content$firstC === void 0 ? void 0 : (_slice$content$firstC2 = _slice$content$firstC.content) === null || _slice$content$firstC2 === void 0 ? void 0 : (_slice$content$firstC3 = _slice$content$firstC2.firstChild) === null || _slice$content$firstC3 === void 0 ? void 0 : (_slice$content$firstC4 = _slice$content$firstC3.content) === null || _slice$content$firstC4 === void 0 ? void 0 : (_slice$content$firstC5 = _slice$content$firstC4.firstChild) === null || _slice$content$firstC5 === void 0 ? void 0 : _slice$content$firstC5.type) === schema.nodes.table) {
82
78
  cleaned = new Slice(slice.content.firstChild.content.firstChild.content, slice.openStart - 2, slice.openEnd - 2);
83
79
  }
84
-
85
80
  return new Slice(flatmap(cleaned.content, unwrapContentFromTable), cleaned.openStart - depthDecrement, cleaned.openEnd - depthDecrement);
86
- } // Case 2: A slice starting within a CELL and ending outside the table
87
-
81
+ }
88
82
 
89
- if ( // starts inside of a cell but ends outside of the starting table
90
- slice.openStart >= 4 && // slice starts from a table node (and spans across more than one node)
83
+ // Case 2: A slice starting within a CELL and ending outside the table
84
+ if (
85
+ // starts inside of a cell but ends outside of the starting table
86
+ slice.openStart >= 4 &&
87
+ // slice starts from a table node (and spans across more than one node)
91
88
  slice.content.childCount > 1 && ((_slice$content$firstC6 = slice.content.firstChild) === null || _slice$content$firstC6 === void 0 ? void 0 : _slice$content$firstC6.type) === schema.nodes.table) {
92
89
  // repoint the slice's cutting depth so that cell content where the slice starts
93
90
  // does not get lifted out of the cell on paste
94
91
  return new Slice(slice.content, 1, slice.openEnd);
95
92
  }
96
-
97
93
  return slice;
98
94
  };
99
95
  export var transformSliceToCorrectEmptyTableCells = function transformSliceToCorrectEmptyTableCells(slice, schema) {
100
96
  var _schema$nodes3 = schema.nodes,
101
- tableCell = _schema$nodes3.tableCell,
102
- tableHeader = _schema$nodes3.tableHeader;
97
+ tableCell = _schema$nodes3.tableCell,
98
+ tableHeader = _schema$nodes3.tableHeader;
103
99
  return mapSlice(slice, function (node) {
104
100
  if (node && (node.type === tableCell || node.type === tableHeader) && !node.content.childCount) {
105
101
  return node.type.createAndFill(node.attrs) || node;
106
102
  }
107
-
108
103
  return node;
109
104
  });
110
105
  };
@@ -1,9 +1,6 @@
1
1
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
-
3
2
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
4
-
5
3
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
6
-
7
4
  import { TableMap } from '@atlaskit/editor-tables/table-map';
8
5
  import { CellSelection } from '@atlaskit/editor-tables/cell-selection';
9
6
  import { safeInsert } from 'prosemirror-utils';
@@ -13,14 +10,13 @@ import { TableCssClassName as ClassName } from '../types';
13
10
  import { tableDeleteButtonSize } from '../ui/consts';
14
11
  export var getRowHeights = function getRowHeights(tableRef) {
15
12
  var heights = [];
16
-
17
13
  if (tableRef.lastChild) {
18
14
  var rows = tableRef.lastChild.childNodes;
19
-
20
15
  for (var i = 0, count = rows.length; i < count; i++) {
21
16
  var row = rows[i];
22
- heights[i] = row.getBoundingClientRect().height + 1; // padding only gets applied when the container has sticky
17
+ heights[i] = row.getBoundingClientRect().height + 1;
23
18
 
19
+ // padding only gets applied when the container has sticky
24
20
  if (row.classList.contains('sticky') && i === 0) {
25
21
  var styles = window.getComputedStyle(row);
26
22
  var paddingTop = parsePx(styles.paddingTop || '');
@@ -28,47 +24,38 @@ export var getRowHeights = function getRowHeights(tableRef) {
28
24
  }
29
25
  }
30
26
  }
31
-
32
27
  return heights;
33
28
  };
34
29
  export var isRowDeleteButtonVisible = function isRowDeleteButtonVisible(selection) {
35
30
  if (!isTableSelected(selection) && selection instanceof CellSelection && selection.isRowSelection()) {
36
31
  return true;
37
32
  }
38
-
39
33
  return false;
40
34
  };
41
35
  export var getRowDeleteButtonParams = function getRowDeleteButtonParams(rowsHeights, selection) {
42
36
  var offsetTop = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
43
37
  var rect = getSelectionRect(selection);
44
-
45
38
  if (!rect) {
46
39
  return null;
47
40
  }
48
-
49
41
  var height = 0;
50
- var offset = offsetTop; // find the rows before the selection
51
-
42
+ var offset = offsetTop;
43
+ // find the rows before the selection
52
44
  for (var i = 0; i < rect.top; i++) {
53
45
  var rowHeight = rowsHeights[i];
54
-
55
46
  if (rowHeight) {
56
47
  offset += rowHeight - 1;
57
48
  }
58
- } // these are the selected rows widths
59
-
60
-
49
+ }
50
+ // these are the selected rows widths
61
51
  var indexes = [];
62
-
63
52
  for (var _i = rect.top; _i < rect.bottom; _i++) {
64
53
  var _rowHeight = rowsHeights[_i];
65
-
66
54
  if (_rowHeight) {
67
55
  height += _rowHeight - 1;
68
56
  indexes.push(_i);
69
57
  }
70
58
  }
71
-
72
59
  var top = offset + height / 2 - tableDeleteButtonSize / 2;
73
60
  return {
74
61
  top: top,
@@ -77,30 +64,24 @@ export var getRowDeleteButtonParams = function getRowDeleteButtonParams(rowsHeig
77
64
  };
78
65
  export var getRowsParams = function getRowsParams(rowsHeights) {
79
66
  var rows = [];
80
-
81
67
  for (var i = 0, count = rowsHeights.length; i < count; i++) {
82
68
  var height = rowsHeights[i];
83
-
84
69
  if (!height) {
85
70
  continue;
86
71
  }
87
-
88
72
  var endIndex = rowsHeights.length;
89
-
90
73
  for (var k = i + 1, _count = rowsHeights.length; k < _count; k++) {
91
74
  if (rowsHeights[k]) {
92
75
  endIndex = k;
93
76
  break;
94
77
  }
95
78
  }
96
-
97
79
  rows.push({
98
80
  startIndex: i,
99
81
  endIndex: endIndex,
100
82
  height: height
101
83
  });
102
84
  }
103
-
104
85
  return rows;
105
86
  };
106
87
  export var getRowClassNames = function getRowClassNames(index, selection) {
@@ -108,37 +89,29 @@ export var getRowClassNames = function getRowClassNames(index, selection) {
108
89
  var isInDanger = arguments.length > 3 ? arguments[3] : undefined;
109
90
  var isResizing = arguments.length > 4 ? arguments[4] : undefined;
110
91
  var classNames = [];
111
-
112
92
  if (isRowSelected(index)(selection) || hoveredRows.indexOf(index) > -1 && !isResizing) {
113
93
  classNames.push(ClassName.HOVERED_CELL_ACTIVE);
114
-
115
94
  if (isInDanger) {
116
95
  classNames.push(ClassName.HOVERED_CELL_IN_DANGER);
117
96
  }
118
97
  }
119
-
120
98
  return classNames.join(' ');
121
99
  };
122
100
  export var copyPreviousRow = function copyPreviousRow(schema) {
123
101
  return function (insertNewRowIndex) {
124
102
  return function (tr) {
125
103
  var table = findTable(tr.selection);
126
-
127
104
  if (!table) {
128
105
  return tr;
129
106
  }
130
-
131
107
  var map = TableMap.get(table.node);
132
108
  var copyPreviousRowIndex = insertNewRowIndex - 1;
133
-
134
109
  if (insertNewRowIndex <= 0) {
135
110
  throw Error("Row Index less or equal 0 isn't not allowed since there is not a previous to copy");
136
111
  }
137
-
138
112
  if (insertNewRowIndex > map.height) {
139
113
  return tr;
140
114
  }
141
-
142
115
  var tableNode = table.node;
143
116
  var tableRow = schema.nodes.tableRow;
144
117
  var cellsInRow = map.cellsInRect({
@@ -153,27 +126,21 @@ export var copyPreviousRow = function copyPreviousRow(schema) {
153
126
  var cellsPositionsInNextRow = map.map.slice(offsetNextLineIndexPosition, offsetNextLineIndexPosition + map.width);
154
127
  var cells = [];
155
128
  var fixRowspans = [];
156
-
157
129
  for (var i = 0; i < cellsPositionsInOriginalRow.length;) {
158
130
  var pos = cellsPositionsInOriginalRow[i];
159
131
  var documentCellPos = pos + table.start;
160
132
  var node = tr.doc.nodeAt(documentCellPos);
161
-
162
133
  if (!node) {
163
134
  continue;
164
135
  }
165
-
166
136
  var attributes = _objectSpread(_objectSpread({}, node.attrs), {}, {
167
137
  colspan: 1,
168
138
  rowspan: 1
169
139
  });
170
-
171
140
  var newCell = node.type.createAndFill(attributes);
172
-
173
141
  if (!newCell) {
174
142
  return tr;
175
143
  }
176
-
177
144
  if (cellsPositionsInNextRow.indexOf(pos) > -1) {
178
145
  fixRowspans.push({
179
146
  pos: documentCellPos,
@@ -184,24 +151,19 @@ export var copyPreviousRow = function copyPreviousRow(schema) {
184
151
  var newCellWithColspanFixed = node.type.createAndFill(_objectSpread(_objectSpread({}, attributes), {}, {
185
152
  colspan: node.attrs.colspan
186
153
  }));
187
-
188
154
  if (!newCellWithColspanFixed) {
189
155
  return tr;
190
156
  }
191
-
192
157
  cells.push(newCellWithColspanFixed);
193
158
  i = i + node.attrs.colspan;
194
159
  continue;
195
160
  }
196
-
197
161
  cells.push(newCell);
198
162
  } else {
199
163
  cells.push(newCell);
200
164
  }
201
-
202
165
  i++;
203
166
  }
204
-
205
167
  fixRowspans.forEach(function (cell) {
206
168
  tr.setNodeMarkup(cell.pos, undefined, _objectSpread(_objectSpread({}, cell.node.attrs), {}, {
207
169
  rowspan: cell.node.attrs.rowspan + 1
@@ -209,11 +171,9 @@ export var copyPreviousRow = function copyPreviousRow(schema) {
209
171
  });
210
172
  var cloneRow = tableNode.child(copyPreviousRowIndex);
211
173
  var rowPos = table.start;
212
-
213
174
  for (var _i2 = 0; _i2 < insertNewRowIndex; _i2++) {
214
175
  rowPos += tableNode.child(_i2).nodeSize;
215
176
  }
216
-
217
177
  return safeInsert(tableRow.createChecked(cloneRow.attrs, cells, cloneRow.marks), rowPos)(tr);
218
178
  };
219
179
  };
@@ -4,93 +4,70 @@ import { findTable, getSelectionRangeInColumn, getSelectionRangeInRow, getSelect
4
4
  export var isSelectionUpdated = function isSelectionUpdated(oldSelection, newSelection) {
5
5
  return !!(!newSelection && oldSelection) || isSelectionType(oldSelection, 'cell') !== isSelectionType(newSelection, 'cell') || isSelectionType(oldSelection, 'cell') && isSelectionType(newSelection, 'cell') && oldSelection.ranges !== newSelection.ranges;
6
6
  };
7
-
8
7
  var isRectangularCellSelection = function isRectangularCellSelection(selection, rect) {
9
8
  var table = findTable(selection);
10
-
11
9
  if (!table) {
12
10
  return true;
13
11
  }
14
-
15
12
  var _TableMap$get = TableMap.get(table.node),
16
- width = _TableMap$get.width,
17
- height = _TableMap$get.height,
18
- map = _TableMap$get.map;
19
-
13
+ width = _TableMap$get.width,
14
+ height = _TableMap$get.height,
15
+ map = _TableMap$get.map;
20
16
  var indexTop = rect.top * width + rect.left;
21
17
  var indexLeft = indexTop;
22
18
  var indexBottom = (rect.bottom - 1) * width + rect.left;
23
19
  var indexRight = indexTop + (rect.right - rect.left - 1);
24
-
25
20
  for (var i = rect.top; i < rect.bottom; i++) {
26
21
  if (rect.left > 0 && map[indexLeft] === map[indexLeft - 1] || rect.right < width && map[indexRight] === map[indexRight + 1]) {
27
22
  return false;
28
23
  }
29
-
30
24
  indexLeft += width;
31
25
  indexRight += width;
32
26
  }
33
-
34
27
  for (var _i = rect.left; _i < rect.right; _i++) {
35
28
  if (rect.top > 0 && map[indexTop] === map[indexTop - width] || rect.bottom < height && map[indexBottom] === map[indexBottom + width]) {
36
29
  return false;
37
30
  }
38
-
39
31
  indexTop++;
40
32
  indexBottom++;
41
33
  }
42
-
43
34
  return true;
44
35
  };
45
-
46
36
  export var normalizeSelection = function normalizeSelection(tr) {
47
37
  var selection = tr.selection;
48
38
  var rect = getSelectionRect(selection);
49
-
50
39
  if (!rect || !(selection instanceof CellSelection) || isRectangularCellSelection(selection, rect)) {
51
40
  return tr;
52
41
  }
53
-
54
42
  if (selection.isColSelection()) {
55
43
  var _getSelectionRangeInC, _getSelectionRangeInC2;
56
-
57
44
  var $anchor = (_getSelectionRangeInC = getSelectionRangeInColumn(rect.left)(tr)) === null || _getSelectionRangeInC === void 0 ? void 0 : _getSelectionRangeInC.$anchor;
58
45
  var $head = (_getSelectionRangeInC2 = getSelectionRangeInColumn(rect.right - 1)(tr)) === null || _getSelectionRangeInC2 === void 0 ? void 0 : _getSelectionRangeInC2.$head;
59
-
60
46
  if ($anchor && $head) {
61
47
  return tr.setSelection(new CellSelection($anchor, $head));
62
48
  }
63
49
  }
64
-
65
50
  if (selection.isRowSelection()) {
66
51
  var _getSelectionRangeInR, _getSelectionRangeInR2;
67
-
68
52
  var _$anchor = (_getSelectionRangeInR = getSelectionRangeInRow(rect.top)(tr)) === null || _getSelectionRangeInR === void 0 ? void 0 : _getSelectionRangeInR.$anchor;
69
-
70
53
  var _$head = (_getSelectionRangeInR2 = getSelectionRangeInRow(rect.bottom - 1)(tr)) === null || _getSelectionRangeInR2 === void 0 ? void 0 : _getSelectionRangeInR2.$head;
71
-
72
54
  if (_$anchor && _$head) {
73
55
  return tr.setSelection(new CellSelection(_$anchor, _$head));
74
56
  }
75
57
  }
76
-
77
58
  return tr;
78
59
  };
79
60
  export var getSelectedColumnIndexes = function getSelectedColumnIndexes(selectionRect) {
80
61
  var columnIndexes = [];
81
-
82
62
  for (var i = selectionRect.left; i < selectionRect.right; i++) {
83
63
  columnIndexes.push(i);
84
64
  }
85
-
86
65
  return columnIndexes;
87
66
  };
88
67
  export var getSelectedRowIndexes = function getSelectedRowIndexes(selectionRect) {
89
68
  var rowIndexes = [];
90
-
91
69
  for (var i = selectionRect.top; i < selectionRect.bottom; i++) {
92
70
  rowIndexes.push(i);
93
71
  }
94
-
95
72
  return rowIndexes;
96
73
  };
@@ -3,11 +3,9 @@ import { TableMap } from '@atlaskit/editor-tables/table-map';
3
3
  import { findTable } from '@atlaskit/editor-tables/utils';
4
4
  export var getMergedCellsPositions = function getMergedCellsPositions(tr) {
5
5
  var table = findTable(tr.selection);
6
-
7
6
  if (!table) {
8
7
  return [];
9
8
  }
10
-
11
9
  var map = TableMap.get(table.node);
12
10
  var cellPositions = new Set();
13
11
  var mergedCells = [];
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-table",
3
- "version": "1.1.0",
3
+ "version": "1.1.2",
4
4
  "sideEffects": false
5
5
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-table",
3
- "version": "1.1.0",
3
+ "version": "1.1.2",
4
4
  "description": "Table plugin for the @atlaskit/editor",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -24,7 +24,7 @@
24
24
  "@atlaskit/editor-tables": "^2.2.0",
25
25
  "@atlaskit/icon": "^21.11.0",
26
26
  "@atlaskit/theme": "^12.1.0",
27
- "@atlaskit/tokens": "^0.13.0",
27
+ "@atlaskit/tokens": "^1.0.0",
28
28
  "@atlaskit/tooltip": "^17.6.0",
29
29
  "@babel/runtime": "^7.0.0",
30
30
  "@emotion/react": "^11.7.1",
@@ -1,7 +1,4 @@
1
- import {
2
- PuppeteerPage,
3
- waitForNoTooltip,
4
- } from '@atlaskit/visual-regression/helper';
1
+ import { PuppeteerPage } from '@atlaskit/visual-regression/helper';
5
2
  import { insertTable } from '@atlaskit/editor-test-helpers/page-objects/table';
6
3
  import {
7
4
  snapshot,
@@ -58,8 +55,6 @@ describe('Table cell options menu', () => {
58
55
  await page.waitForSelector(deleteColumnCellOptionSelector);
59
56
  await page.hover(deleteColumnCellOptionSelector);
60
57
 
61
- await waitForNoTooltip(page);
62
-
63
58
  await snapshot(page);
64
59
  });
65
60
 
@@ -72,8 +67,6 @@ describe('Table cell options menu', () => {
72
67
  await page.waitForSelector(deleteColumnCellOptionSelector);
73
68
  await page.click(deleteColumnCellOptionSelector);
74
69
 
75
- await waitForNoTooltip(page);
76
-
77
70
  await snapshot(page);
78
71
  });
79
72
  });
@@ -88,8 +81,6 @@ describe('Table cell options menu', () => {
88
81
  await page.waitForSelector(deleteRowCellOptionSelector);
89
82
  await page.hover(deleteRowCellOptionSelector);
90
83
 
91
- await waitForNoTooltip(page);
92
-
93
84
  await snapshot(page);
94
85
  });
95
86
 
@@ -102,8 +93,6 @@ describe('Table cell options menu', () => {
102
93
  await page.waitForSelector(deleteColumnCellOptionSelector);
103
94
  await page.click(deleteRowCellOptionSelector);
104
95
 
105
- await waitForNoTooltip(page);
106
-
107
96
  await snapshot(page);
108
97
  });
109
98
  });