@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
@@ -1,117 +1,87 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
5
4
  Object.defineProperty(exports, "__esModule", {
6
5
  value: true
7
6
  });
8
7
  exports.deleteColumns = void 0;
9
-
10
8
  var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
11
-
12
9
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
13
-
14
10
  var _prosemirrorState = require("prosemirror-state");
15
-
16
11
  var _tableMap = require("@atlaskit/editor-tables/table-map");
17
-
18
12
  var _utils = require("@atlaskit/editor-tables/utils");
19
-
20
13
  var _steps = require("@atlaskit/adf-schema/steps");
21
-
22
14
  var _metadata = require("./metadata");
23
-
24
15
  var _split = require("./split");
25
-
26
16
  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; }
27
-
28
17
  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) { (0, _defineProperty2.default)(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; }
29
-
30
18
  var deleteColumnsCustomStep = function deleteColumnsCustomStep(rect) {
31
19
  return function (tr) {
32
20
  var table = (0, _utils.findTable)(tr.selection);
33
-
34
21
  if (!table) {
35
22
  return tr;
36
- } // Need to split all the merge in the ranges (this is the current behaviour)
23
+ }
24
+
25
+ // Need to split all the merge in the ranges (this is the current behaviour)
37
26
  // Maybe is better to split only the last column?
38
27
  // TODO: After talking with Roto about this behaviour, he likes when we dont split the columns, I am keeping this for consistency of the current implementation.
28
+ (0, _split.splitCellsInColumns)(tr, table.pos, rect.left, rect.right);
39
29
 
40
-
41
- (0, _split.splitCellsInColumns)(tr, table.pos, rect.left, rect.right); // Delete the columns
42
-
30
+ // Delete the columns
43
31
  var mapStart = tr.mapping.maps.length;
44
32
  var originalDoc = tr.doc;
45
33
  var deletedColumns = [];
46
-
47
34
  for (var i = rect.left; i < rect.right; i++) {
48
35
  var step = _steps.AddColumnStep.create(originalDoc, table.pos, i, true);
49
-
50
36
  deletedColumns.push(i);
51
37
  tr.step(step.map(tr.mapping.slice(mapStart)));
52
38
  }
53
-
54
39
  var tablePosResult = tr.mapping.mapResult(table.pos);
55
-
56
40
  if (tablePosResult.deleted) {
57
41
  var pos = Math.min(tablePosResult.pos, tr.doc.nodeSize - 1);
58
42
  tr.setSelection(_prosemirrorState.Selection.near(tr.doc.resolve(pos)));
59
43
  } else {
60
44
  var newTable = tr.doc.nodeAt(tablePosResult.pos);
61
-
62
45
  if (newTable) {
63
46
  var cursorPos = getNextCursorPos(newTable, deletedColumns);
64
47
  tr.setSelection(_prosemirrorState.Selection.near(tr.doc.resolve(table.pos + cursorPos)));
65
48
  }
66
49
  }
67
-
68
50
  return tr;
69
51
  };
70
52
  };
71
-
72
53
  var deleteColumnsLegacy = function deleteColumnsLegacy(rect) {
73
54
  return function (tr) {
74
55
  var table = (0, _utils.findTable)(tr.selection);
75
-
76
56
  if (!table) {
77
57
  return tr;
78
58
  }
79
-
80
59
  var columnsToDelete = [];
81
-
82
60
  for (var i = rect.left; i < rect.right; i++) {
83
61
  columnsToDelete.push(i);
84
62
  }
85
-
86
63
  if (!columnsToDelete.length) {
87
64
  return tr;
88
65
  }
89
-
90
66
  var map = _tableMap.TableMap.get(table.node);
91
-
92
67
  var rows = [];
93
68
  var seen = {};
94
69
  var deletedCells = {};
95
-
96
70
  for (var rowIndex = 0; rowIndex < map.height; rowIndex++) {
97
71
  var rowCells = [];
98
72
  var row = table.node.child(rowIndex);
99
-
100
73
  var _loop = function _loop(colIndex) {
101
74
  var cellPos = map.map[rowIndex * map.width + colIndex];
102
75
  var cell = table.node.nodeAt(cellPos);
103
-
104
76
  if (!cell) {
105
77
  return "continue";
106
78
  }
107
-
108
79
  var cellsInColumn = map.cellsInRect({
109
80
  left: colIndex,
110
81
  top: 0,
111
82
  right: colIndex + 1,
112
83
  bottom: map.height
113
84
  });
114
-
115
85
  if (columnsToDelete.indexOf(colIndex) === -1) {
116
86
  // decrement colspans for col-spanning cells that overlap deleted columns
117
87
  if (cellsInColumn.indexOf(cellPos) > -1 && !seen[cellPos]) {
@@ -121,12 +91,10 @@ var deleteColumnsLegacy = function deleteColumnsLegacy(rect) {
121
91
  overlappingCols += 1;
122
92
  }
123
93
  });
124
-
125
94
  if (overlappingCols > 0) {
126
95
  var attrs = _objectSpread(_objectSpread({}, cell.attrs), {}, {
127
96
  colspan: cell.attrs.colspan - overlappingCols
128
97
  });
129
-
130
98
  if (cell.attrs.colwidth) {
131
99
  var minColIndex = Math.min.apply(Math, columnsToDelete);
132
100
  var pos = minColIndex > 0 ? minColIndex - map.colCount(cellPos) : 0;
@@ -134,7 +102,6 @@ var deleteColumnsLegacy = function deleteColumnsLegacy(rect) {
134
102
  colwidth.splice(pos, overlappingCols);
135
103
  attrs.colwidth = colwidth;
136
104
  }
137
-
138
105
  var newCell = cell.type.createChecked(attrs, cell.content, cell.marks);
139
106
  rowCells.push(newCell);
140
107
  seen[cellPos] = true;
@@ -146,20 +113,16 @@ var deleteColumnsLegacy = function deleteColumnsLegacy(rect) {
146
113
  colspan: 1,
147
114
  rowspan: 1
148
115
  });
149
-
150
116
  if (cell.attrs.colwidth) {
151
117
  var _pos = colIndex > 0 ? colIndex - map.colCount(cellPos) : 0;
152
-
153
118
  _attrs.colwidth = cell.attrs.colwidth.slice().splice(_pos, 1);
154
119
  }
155
-
156
120
  var _newCell = cell.type.createChecked(_attrs, cell.type.schema.nodes.paragraph.createChecked(), cell.marks);
157
-
158
121
  rowCells.push(_newCell);
159
122
  return "continue";
160
- } // normal cells that we want to keep
161
-
123
+ }
162
124
 
125
+ // normal cells that we want to keep
163
126
  if (!seen[cellPos]) {
164
127
  seen[cellPos] = true;
165
128
  rowCells.push(cell);
@@ -168,126 +131,98 @@ var deleteColumnsLegacy = function deleteColumnsLegacy(rect) {
168
131
  deletedCells[cellPos] = true;
169
132
  }
170
133
  };
171
-
172
134
  for (var colIndex = 0; colIndex < map.width; colIndex++) {
173
135
  var _ret = _loop(colIndex);
174
-
175
136
  if (_ret === "continue") continue;
176
137
  }
177
-
178
138
  if (rowCells.length) {
179
139
  rows.push(row.type.createChecked(row.attrs, rowCells, row.marks));
180
140
  }
181
141
  }
182
-
183
142
  if (!rows.length) {
184
143
  return (0, _metadata.setMeta)({
185
144
  type: 'DELETE_COLUMNS',
186
145
  problem: 'EMPTY_TABLE'
187
146
  })(tr);
188
147
  }
189
-
190
148
  var newTable = table.node.type.createChecked(table.node.attrs, rows, table.node.marks);
191
149
  var fixedTable = fixRowSpans(newTable);
192
-
193
150
  if (fixedTable === null) {
194
151
  return (0, _metadata.setMeta)({
195
152
  type: 'DELETE_COLUMNS',
196
153
  problem: 'FIX_ROWSPANS'
197
154
  })(tr);
198
155
  }
199
-
200
156
  var cursorPos = getNextCursorPos(newTable, columnsToDelete);
201
157
  return (0, _metadata.setMeta)({
202
158
  type: 'DELETE_COLUMNS'
203
- })(tr.replaceWith(table.pos, table.pos + table.node.nodeSize, fixedTable) // move cursor to the left of the deleted columns if possible, otherwise - to the first column
159
+ })(tr.replaceWith(table.pos, table.pos + table.node.nodeSize, fixedTable)
160
+ // move cursor to the left of the deleted columns if possible, otherwise - to the first column
204
161
  .setSelection(_prosemirrorState.Selection.near(tr.doc.resolve(table.pos + cursorPos))));
205
162
  };
206
163
  };
207
-
208
164
  function getNextCursorPos(table, deletedColumns) {
209
165
  var minColumn = Math.min.apply(Math, (0, _toConsumableArray2.default)(deletedColumns));
210
166
  var nextColumnWithCursor = minColumn > 0 ? minColumn - 1 : 0;
211
-
212
167
  var map = _tableMap.TableMap.get(table);
213
-
214
168
  return map.map[nextColumnWithCursor];
215
- } // returns an array of numbers, each number indicates the minimum rowSpan in each row
216
-
169
+ }
217
170
 
171
+ // returns an array of numbers, each number indicates the minimum rowSpan in each row
218
172
  function getMinRowSpans(table) {
219
173
  var minRowSpans = [];
220
-
221
174
  for (var rowIndex = 0; rowIndex < table.childCount; rowIndex++) {
222
175
  var rowSpans = [];
223
176
  var row = table.child(rowIndex);
224
-
225
177
  for (var colIndex = 0; colIndex < row.childCount; colIndex++) {
226
178
  var cell = row.child(colIndex);
227
179
  rowSpans.push(cell.attrs.rowspan);
228
180
  }
229
-
230
181
  minRowSpans[rowIndex] = Math.min.apply(Math, rowSpans);
231
182
  }
232
-
233
183
  return minRowSpans;
234
184
  }
235
-
236
185
  function fixRowSpans(table) {
237
186
  var map = _tableMap.TableMap.get(table);
238
-
239
187
  var minRowSpans = getMinRowSpans(table);
240
-
241
188
  if (!minRowSpans.some(function (rowspan) {
242
189
  return rowspan > 1;
243
190
  })) {
244
191
  return table;
245
192
  }
246
-
247
193
  var rows = [];
248
-
249
194
  for (var rowIndex = 0; rowIndex < map.height; rowIndex++) {
250
195
  var row = table.child(rowIndex);
251
-
252
196
  if (minRowSpans[rowIndex] === 1) {
253
197
  rows.push(row);
254
198
  } else {
255
199
  var rowCells = [];
256
-
257
200
  for (var colIndex = 0; colIndex < row.childCount; colIndex++) {
258
201
  var cell = row.child(colIndex);
259
202
  var rowspan = cell.attrs.rowspan - minRowSpans[rowIndex] + 1;
260
-
261
203
  if (rowspan < 1) {
262
204
  return null;
263
205
  }
264
-
265
206
  var newCell = cell.type.createChecked(_objectSpread(_objectSpread({}, cell.attrs), {}, {
266
207
  rowspan: rowspan
267
208
  }), cell.content, cell.marks);
268
209
  rowCells.push(newCell);
269
210
  }
270
-
271
211
  rows.push(row.type.createChecked(row.attrs, rowCells, row.marks));
272
212
  }
273
213
  }
274
-
275
214
  if (!rows.length) {
276
215
  return null;
277
216
  }
278
-
279
217
  return table.type.createChecked(table.attrs, rows, table.marks);
280
218
  }
281
-
282
219
  var deleteColumns = function deleteColumns(rect) {
283
220
  var allowAddColumnCustomStep = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
284
221
  return function (tr) {
285
222
  if (allowAddColumnCustomStep) {
286
223
  return deleteColumnsCustomStep(rect)(tr);
287
224
  }
288
-
289
225
  return deleteColumnsLegacy(rect)(tr);
290
226
  };
291
227
  };
292
-
293
228
  exports.deleteColumns = deleteColumns;
@@ -1,48 +1,32 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
5
4
  Object.defineProperty(exports, "__esModule", {
6
5
  value: true
7
6
  });
8
7
  exports.deleteRows = void 0;
9
-
10
8
  var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
11
-
12
9
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
13
-
14
10
  var _prosemirrorState = require("prosemirror-state");
15
-
16
11
  var _tableMap = require("@atlaskit/editor-tables/table-map");
17
-
18
12
  var _utils = require("@atlaskit/editor-tables/utils");
19
-
20
13
  var _merge = require("./merge");
21
-
22
14
  var _metadata = require("./metadata");
23
-
24
15
  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; }
25
-
26
16
  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) { (0, _defineProperty2.default)(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; }
27
-
28
17
  var deleteRows = function deleteRows(rect) {
29
18
  var isHeaderRowRequired = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
30
19
  return function (tr) {
31
20
  var table = (0, _utils.findTable)(tr.selection);
32
-
33
21
  if (!table) {
34
22
  return tr;
35
23
  }
36
-
37
24
  var rowsToDelete = [];
38
-
39
25
  var map = _tableMap.TableMap.get(table.node);
40
-
41
26
  for (var i = rect.top; i < rect.bottom; i++) {
42
27
  // skip header row if its required
43
28
  if (isHeaderRowRequired) {
44
29
  var cell = table.node.nodeAt(map.map[i * map.width]);
45
-
46
30
  if (cell && cell.type !== cell.type.schema.nodes.tableHeader) {
47
31
  rowsToDelete.push(i);
48
32
  }
@@ -50,34 +34,27 @@ var deleteRows = function deleteRows(rect) {
50
34
  rowsToDelete.push(i);
51
35
  }
52
36
  }
53
-
54
37
  if (!rowsToDelete.length) {
55
38
  return tr;
56
39
  }
57
-
58
40
  var rows = [];
59
41
  var seen = {};
60
42
  var deletedCells = {};
61
-
62
43
  var _loop = function _loop(rowIndex) {
63
44
  var rowCells = [];
64
45
  var row = table.node.child(rowIndex);
65
-
66
46
  var _loop2 = function _loop2(colIndex) {
67
47
  var cellPos = map.map[rowIndex * map.width + colIndex];
68
48
  var cell = table.node.nodeAt(cellPos);
69
-
70
49
  if (!cell) {
71
50
  return "continue";
72
51
  }
73
-
74
52
  var cellsInRow = map.cellsInRect({
75
53
  left: 0,
76
54
  top: rowIndex,
77
55
  right: map.width,
78
56
  bottom: rowIndex + 1
79
57
  });
80
-
81
58
  if (rowsToDelete.indexOf(rowIndex) === -1 && !seen[cellPos]) {
82
59
  // decrement rowspans for row-spanning cells that overlap deleted rows
83
60
  if (cellsInRow.indexOf(cellPos) > -1) {
@@ -87,7 +64,6 @@ var deleteRows = function deleteRows(rect) {
87
64
  overlappingRows += 1;
88
65
  }
89
66
  });
90
-
91
67
  if (overlappingRows > 0) {
92
68
  var newCell = cell.type.createChecked(_objectSpread(_objectSpread({}, cell.attrs), {}, {
93
69
  rowspan: cell.attrs.rowspan - overlappingRows
@@ -102,19 +78,16 @@ var deleteRows = function deleteRows(rect) {
102
78
  colspan: 1,
103
79
  rowspan: 1
104
80
  });
105
-
106
81
  if (cell.attrs.colwidth) {
107
82
  var pos = colIndex > 0 ? colIndex - map.colCount(cellPos) : 0;
108
83
  attrs.colwidth = cell.attrs.colwidth.slice().splice(pos, 1);
109
84
  }
110
-
111
85
  var _newCell = cell.type.createChecked(attrs, cell.type.schema.nodes.paragraph.createChecked(), cell.marks);
112
-
113
86
  rowCells.push(_newCell);
114
87
  return "continue";
115
- } // normal cells that we want to keep
116
-
88
+ }
117
89
 
90
+ // normal cells that we want to keep
118
91
  if (!seen[cellPos]) {
119
92
  seen[cellPos] = true;
120
93
  rowCells.push(cell);
@@ -123,54 +96,43 @@ var deleteRows = function deleteRows(rect) {
123
96
  deletedCells[cellPos] = true;
124
97
  }
125
98
  };
126
-
127
99
  for (var colIndex = 0; colIndex < map.width; colIndex++) {
128
100
  var _ret = _loop2(colIndex);
129
-
130
101
  if (_ret === "continue") continue;
131
102
  }
132
-
133
103
  if (rowCells.length) {
134
104
  rows.push(row.type.createChecked(row.attrs, rowCells, row.marks));
135
105
  }
136
106
  };
137
-
138
107
  for (var rowIndex = 0; rowIndex < map.height; rowIndex++) {
139
108
  _loop(rowIndex);
140
109
  }
141
-
142
110
  if (!rows.length) {
143
111
  return (0, _metadata.setMeta)({
144
112
  type: 'DELETE_ROWS',
145
113
  problem: 'EMPTY_TABLE'
146
114
  })(tr);
147
115
  }
148
-
149
116
  var newTable = table.node.type.createChecked(table.node.attrs, rows, table.node.marks);
150
117
  var fixedTable = (0, _merge.removeEmptyColumns)(newTable);
151
-
152
118
  if (fixedTable === null) {
153
119
  return (0, _metadata.setMeta)({
154
120
  type: 'DELETE_ROWS',
155
121
  problem: 'REMOVE_EMPTY_COLUMNS'
156
122
  })(tr);
157
123
  }
158
-
159
124
  var cursorPos = getNextCursorPos(newTable, rowsToDelete);
160
125
  return (0, _metadata.setMeta)({
161
126
  type: 'DELETE_ROWS'
162
- })(tr.replaceWith(table.pos, table.pos + table.node.nodeSize, fixedTable) // move cursor before the deleted rows if possible, otherwise - to the first row
127
+ })(tr.replaceWith(table.pos, table.pos + table.node.nodeSize, fixedTable)
128
+ // move cursor before the deleted rows if possible, otherwise - to the first row
163
129
  .setSelection(_prosemirrorState.Selection.near(tr.doc.resolve(table.pos + cursorPos))));
164
130
  };
165
131
  };
166
-
167
132
  exports.deleteRows = deleteRows;
168
-
169
133
  function getNextCursorPos(table, deletedRows) {
170
134
  var minRow = Math.min.apply(Math, (0, _toConsumableArray2.default)(deletedRows));
171
135
  var nextRowWithCursor = minRow > 0 ? minRow - 1 : 0;
172
-
173
136
  var map = _tableMap.TableMap.get(table);
174
-
175
137
  return map.map[nextRowWithCursor * map.width];
176
138
  }