@atlaskit/editor-plugin-table 1.1.1 → 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 (283) hide show
  1. package/CHANGELOG.md +6 -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
@@ -28,32 +28,27 @@ import FloatingInsertButton from './ui/FloatingInsertButton';
28
28
  import LayoutButton from './ui/LayoutButton';
29
29
  import { isLayoutSupported } from './utils';
30
30
  import { ErrorBoundary } from '@atlaskit/editor-common/error-boundary';
31
-
32
31
  var defaultGetEditorFeatureFlags = function defaultGetEditorFeatureFlags() {
33
32
  return {};
34
33
  };
35
-
36
34
  var tablesPlugin = function tablesPlugin(options) {
37
35
  var editorViewRef = {
38
36
  current: null
39
37
  };
40
-
41
38
  var defaultGetEditorContainerWidth = function defaultGetEditorContainerWidth() {
42
39
  if (!editorViewRef.current) {
43
40
  var _document, _document$body;
44
-
45
41
  return {
46
42
  width: ((_document = document) === null || _document === void 0 ? void 0 : (_document$body = _document.body) === null || _document$body === void 0 ? void 0 : _document$body.offsetWidth) || 500
47
43
  };
48
44
  }
45
+ var state = editorViewRef.current.state;
49
46
 
50
- var state = editorViewRef.current.state; // TODO: ED-15663
47
+ // TODO: ED-15663
51
48
  // Please, do not copy or use this kind of code below
52
49
  // @ts-ignore
53
-
54
50
  return state['widthPlugin$'];
55
51
  };
56
-
57
52
  return {
58
53
  name: 'table',
59
54
  nodes: function nodes() {
@@ -76,34 +71,29 @@ var tablesPlugin = function tablesPlugin(options) {
76
71
  name: 'table',
77
72
  plugin: function plugin(_ref) {
78
73
  var dispatchAnalyticsEvent = _ref.dispatchAnalyticsEvent,
79
- dispatch = _ref.dispatch,
80
- portalProviderAPI = _ref.portalProviderAPI,
81
- eventDispatcher = _ref.eventDispatcher;
82
-
74
+ dispatch = _ref.dispatch,
75
+ portalProviderAPI = _ref.portalProviderAPI,
76
+ eventDispatcher = _ref.eventDispatcher;
83
77
  var _ref2 = options || {},
84
- fullWidthEnabled = _ref2.fullWidthEnabled,
85
- wasFullWidthEnabled = _ref2.wasFullWidthEnabled,
86
- breakoutEnabled = _ref2.breakoutEnabled,
87
- tableOptions = _ref2.tableOptions,
88
- editorAnalyticsAPI = _ref2.editorAnalyticsAPI,
89
- getEditorFeatureFlags = _ref2.getEditorFeatureFlags;
90
-
78
+ fullWidthEnabled = _ref2.fullWidthEnabled,
79
+ wasFullWidthEnabled = _ref2.wasFullWidthEnabled,
80
+ breakoutEnabled = _ref2.breakoutEnabled,
81
+ tableOptions = _ref2.tableOptions,
82
+ editorAnalyticsAPI = _ref2.editorAnalyticsAPI,
83
+ getEditorFeatureFlags = _ref2.getEditorFeatureFlags;
91
84
  return createPlugin(dispatchAnalyticsEvent, dispatch, portalProviderAPI, eventDispatcher, pluginConfig(tableOptions), defaultGetEditorContainerWidth, getEditorFeatureFlags || defaultGetEditorFeatureFlags, breakoutEnabled, fullWidthEnabled, wasFullWidthEnabled, editorAnalyticsAPI);
92
85
  }
93
86
  }, {
94
87
  name: 'tablePMColResizing',
95
88
  plugin: function plugin(_ref3) {
96
89
  var dispatch = _ref3.dispatch;
97
-
98
90
  var _ref4 = options || {},
99
- fullWidthEnabled = _ref4.fullWidthEnabled,
100
- tableOptions = _ref4.tableOptions,
101
- editorAnalyticsAPI = _ref4.editorAnalyticsAPI,
102
- getEditorFeatureFlags = _ref4.getEditorFeatureFlags;
103
-
91
+ fullWidthEnabled = _ref4.fullWidthEnabled,
92
+ tableOptions = _ref4.tableOptions,
93
+ editorAnalyticsAPI = _ref4.editorAnalyticsAPI,
94
+ getEditorFeatureFlags = _ref4.getEditorFeatureFlags;
104
95
  var _pluginConfig = pluginConfig(tableOptions),
105
- allowColumnResizing = _pluginConfig.allowColumnResizing;
106
-
96
+ allowColumnResizing = _pluginConfig.allowColumnResizing;
107
97
  return allowColumnResizing ? createFlexiResizingPlugin(dispatch, {
108
98
  lastColumnResizable: !fullWidthEnabled
109
99
  }, defaultGetEditorContainerWidth, getEditorFeatureFlags || defaultGetEditorFeatureFlags, editorAnalyticsAPI) : undefined;
@@ -113,7 +103,8 @@ var tablesPlugin = function tablesPlugin(options) {
113
103
  plugin: function plugin() {
114
104
  return createDecorationsPlugin();
115
105
  }
116
- }, // Needs to be lower priority than editor-tables.tableEditing
106
+ },
107
+ // Needs to be lower priority than editor-tables.tableEditing
117
108
  // plugin as it is currently swallowing backspace events inside tables
118
109
  {
119
110
  name: 'tableKeymap',
@@ -131,10 +122,9 @@ var tablesPlugin = function tablesPlugin(options) {
131
122
  return tableEditing({
132
123
  reportFixedTable: function reportFixedTable(_ref5) {
133
124
  var _options$editorAnalyt;
134
-
135
125
  var state = _ref5.state,
136
- tr = _ref5.tr,
137
- reason = _ref5.reason;
126
+ tr = _ref5.tr,
127
+ reason = _ref5.reason;
138
128
  options === null || options === void 0 ? void 0 : (_options$editorAnalyt = options.editorAnalyticsAPI) === null || _options$editorAnalyt === void 0 ? void 0 : _options$editorAnalyt.attachAnalyticsEvent({
139
129
  action: TABLE_ACTION.FIXED,
140
130
  actionSubject: ACTION_SUBJECT.TABLE,
@@ -151,7 +141,7 @@ var tablesPlugin = function tablesPlugin(options) {
151
141
  name: 'tableStickyHeaders',
152
142
  plugin: function plugin(_ref6) {
153
143
  var dispatch = _ref6.dispatch,
154
- eventDispatcher = _ref6.eventDispatcher;
144
+ eventDispatcher = _ref6.eventDispatcher;
155
145
  return options && options.tableOptions.stickyHeaders ? createStickyHeadersPlugin(dispatch, eventDispatcher, function () {
156
146
  return [];
157
147
  }, (options === null || options === void 0 ? void 0 : options.getEditorFeatureFlags) || defaultGetEditorFeatureFlags) : undefined;
@@ -176,12 +166,14 @@ var tablesPlugin = function tablesPlugin(options) {
176
166
  }
177
167
  });
178
168
  }
179
- }]; // workaround for prosemirrors delayed dom selection syncing during pointer drag
169
+ }];
170
+
171
+ // workaround for prosemirrors delayed dom selection syncing during pointer drag
180
172
  // causing issues with table selections in Safari
181
173
  // https://github.com/ProseMirror/prosemirror-view/commit/885258b80551ac87b81601d3ed25f552aeb22293
174
+
182
175
  // NOTE: this workaround can be removed when next upgrading prosemirror as the issue will be fixed
183
176
  // https://github.com/ProseMirror/prosemirror-view/pull/116
184
-
185
177
  if (browser.safari) {
186
178
  plugins.push({
187
179
  name: 'tableSafariDelayedDomSelectionSyncingWorkaround',
@@ -189,10 +181,10 @@ var tablesPlugin = function tablesPlugin(options) {
189
181
  return createTableSafariDelayedDomSelectionSyncingWorkaroundPlugin();
190
182
  }
191
183
  });
192
- } // Workaround for table element breaking issue caused by composition event with an inputType of deleteCompositionText.
193
- // https://github.com/ProseMirror/prosemirror/issues/934
194
-
184
+ }
195
185
 
186
+ // Workaround for table element breaking issue caused by composition event with an inputType of deleteCompositionText.
187
+ // https://github.com/ProseMirror/prosemirror/issues/934
196
188
  if (browser.safari) {
197
189
  plugins.push({
198
190
  name: 'tableSafariDeleteCompositionTextIssueWorkaround',
@@ -201,15 +193,14 @@ var tablesPlugin = function tablesPlugin(options) {
201
193
  }
202
194
  });
203
195
  }
204
-
205
196
  return plugins;
206
197
  },
207
198
  contentComponent: function contentComponent(_ref8) {
208
199
  var editorView = _ref8.editorView,
209
- popupsMountPoint = _ref8.popupsMountPoint,
210
- popupsBoundariesElement = _ref8.popupsBoundariesElement,
211
- popupsScrollableElement = _ref8.popupsScrollableElement,
212
- dispatchAnalyticsEvent = _ref8.dispatchAnalyticsEvent;
200
+ popupsMountPoint = _ref8.popupsMountPoint,
201
+ popupsBoundariesElement = _ref8.popupsBoundariesElement,
202
+ popupsScrollableElement = _ref8.popupsScrollableElement,
203
+ dispatchAnalyticsEvent = _ref8.dispatchAnalyticsEvent;
213
204
  return /*#__PURE__*/React.createElement(ErrorBoundary, {
214
205
  component: ACTION_SUBJECT.TABLES_PLUGIN,
215
206
  dispatchAnalyticsEvent: dispatchAnalyticsEvent,
@@ -222,23 +213,23 @@ var tablesPlugin = function tablesPlugin(options) {
222
213
  },
223
214
  render: function render(_ref9) {
224
215
  var resizingPluginState = _ref9.tableResizingPluginState,
225
- stickyHeadersState = _ref9.stickyHeadersState,
226
- tablePluginState = _ref9.tablePluginState;
216
+ stickyHeadersState = _ref9.stickyHeadersState,
217
+ tablePluginState = _ref9.tablePluginState;
227
218
  var state = editorView.state;
228
219
  var isDragging = resizingPluginState === null || resizingPluginState === void 0 ? void 0 : resizingPluginState.dragging;
229
220
  var _ref10 = tablePluginState,
230
- tableNode = _ref10.tableNode,
231
- tablePos = _ref10.tablePos,
232
- targetCellPosition = _ref10.targetCellPosition,
233
- isContextualMenuOpen = _ref10.isContextualMenuOpen,
234
- layout = _ref10.layout,
235
- tableRef = _ref10.tableRef,
236
- pluginConfig = _ref10.pluginConfig,
237
- insertColumnButtonIndex = _ref10.insertColumnButtonIndex,
238
- insertRowButtonIndex = _ref10.insertRowButtonIndex,
239
- isHeaderColumnEnabled = _ref10.isHeaderColumnEnabled,
240
- isHeaderRowEnabled = _ref10.isHeaderRowEnabled,
241
- tableWrapperTarget = _ref10.tableWrapperTarget;
221
+ tableNode = _ref10.tableNode,
222
+ tablePos = _ref10.tablePos,
223
+ targetCellPosition = _ref10.targetCellPosition,
224
+ isContextualMenuOpen = _ref10.isContextualMenuOpen,
225
+ layout = _ref10.layout,
226
+ tableRef = _ref10.tableRef,
227
+ pluginConfig = _ref10.pluginConfig,
228
+ insertColumnButtonIndex = _ref10.insertColumnButtonIndex,
229
+ insertRowButtonIndex = _ref10.insertRowButtonIndex,
230
+ isHeaderColumnEnabled = _ref10.isHeaderColumnEnabled,
231
+ isHeaderRowEnabled = _ref10.isHeaderRowEnabled,
232
+ tableWrapperTarget = _ref10.tableWrapperTarget;
242
233
  var allowControls = pluginConfig.allowControls;
243
234
  var stickyHeader = stickyHeadersState ? findStickyHeaderForTable(stickyHeadersState, tablePos) : undefined;
244
235
  return /*#__PURE__*/React.createElement(React.Fragment, null, targetCellPosition && tableRef && !isDragging && options && options.allowContextualMenu && /*#__PURE__*/React.createElement(FloatingContextualButton, {
@@ -305,13 +296,11 @@ var tablesPlugin = function tablesPlugin(options) {
305
296
  // For now, we are using this on (insert-api/api.ts) but we may create a proper place for it
306
297
  createNodeHandler: function createNodeHandler(_ref11) {
307
298
  var nodeName = _ref11.nodeName,
308
- schema = _ref11.schema;
309
-
299
+ schema = _ref11.schema;
310
300
  // An EditorPlugin may manage more than one node.
311
301
  if (nodeName !== 'table') {
312
302
  return null;
313
303
  }
314
-
315
304
  var table = createTable({
316
305
  schema: schema
317
306
  });
@@ -331,7 +320,6 @@ var tablesPlugin = function tablesPlugin(options) {
331
320
  },
332
321
  action: function action(insert, state) {
333
322
  var _options$editorAnalyt2;
334
-
335
323
  var tr = insert(createTable({
336
324
  schema: state.schema
337
325
  }));
@@ -354,5 +342,4 @@ var tablesPlugin = function tablesPlugin(options) {
354
342
  }
355
343
  };
356
344
  };
357
-
358
345
  export default tablesPlugin;
@@ -8,53 +8,36 @@ export var OverflowShadowsObserver = /*#__PURE__*/function () {
8
8
  // updateShadowState is a method to update shadow key
9
9
  function OverflowShadowsObserver(updateShadowState, _table, wrapper) {
10
10
  var _this = this;
11
-
12
11
  _classCallCheck(this, OverflowShadowsObserver);
13
-
14
12
  _defineProperty(this, "firstCell", null);
15
-
16
13
  _defineProperty(this, "lastCell", null);
17
-
18
14
  _defineProperty(this, "getFirstCell", function (isSticky, hasHeaderRow) {
19
15
  var _this$table;
20
-
21
16
  return (_this$table = _this.table) === null || _this$table === void 0 ? void 0 : _this$table.querySelector(isSticky || !hasHeaderRow ? 'table tbody tr td' : 'table tbody tr th');
22
17
  });
23
-
24
18
  _defineProperty(this, "getLastCell", function (isSticky, hasHeaderRow) {
25
19
  var _this$table2;
26
-
27
20
  return (_this$table2 = _this.table) === null || _this$table2 === void 0 ? void 0 : _this$table2.querySelector(isSticky || !hasHeaderRow ? 'table tbody tr td:last-child' : 'table tbody tr th:last-child');
28
21
  });
29
-
30
22
  _defineProperty(this, "isSticky", false);
31
-
32
23
  _defineProperty(this, "stickyRowHeight", 0);
33
-
34
24
  _defineProperty(this, "init", function () {
35
25
  var table = _this.table;
36
-
37
26
  if (!_this.wrapper || !table) {
38
27
  return;
39
28
  }
40
-
41
29
  if (!_this.tableIntersectionObserver) {
42
30
  var intersectonOnbserverCallback = function intersectonOnbserverCallback(entry) {
43
31
  var _entry$rootBounds, _entry$rootBounds2;
44
-
45
32
  if (!((_entry$rootBounds = entry.rootBounds) !== null && _entry$rootBounds !== void 0 && _entry$rootBounds.height) && !((_entry$rootBounds2 = entry.rootBounds) !== null && _entry$rootBounds2 !== void 0 && _entry$rootBounds2.width)) {
46
33
  return;
47
34
  }
48
-
49
35
  if (entry.target !== _this.firstCell && entry.target !== _this.lastCell) {
50
36
  return;
51
37
  }
52
-
53
38
  _this.updateStickyShadowsHeightIfChanged();
54
-
55
39
  _this.checkIntersectionEvent(entry, _this.firstCell === entry.target ? ShadowEvent.SHOW_BEFORE_SHADOW : ShadowEvent.SHOW_AFTER_SHADOW);
56
40
  };
57
-
58
41
  _this.tableIntersectionObserver = new IntersectionObserver(function (entries, _) {
59
42
  entries.forEach(function (entry) {
60
43
  return intersectonOnbserverCallback(entry);
@@ -67,88 +50,71 @@ export var OverflowShadowsObserver = /*#__PURE__*/function () {
67
50
  return;
68
51
  }
69
52
  });
70
-
71
53
  _defineProperty(this, "checkIntersectionEvent", function (entry, shadowKey) {
72
- if ( // If it's in full view, don't show shadow.
54
+ if (
55
+ // If it's in full view, don't show shadow.
73
56
  entry.isIntersecting && entry.intersectionRatio === 1) {
74
57
  _this.updateShadowState(shadowKey, false);
75
- } else if ( // If it's in partial view, show a shadow
58
+ } else if (
59
+ // If it's in partial view, show a shadow
76
60
  entry.intersectionRatio < 1) {
77
61
  _this.updateShadowState(shadowKey, true);
78
62
  }
79
63
  });
80
-
81
64
  _defineProperty(this, "observeCells", function (isSticky, hasHeaderRow) {
82
65
  var stickyChanged = !!isSticky !== _this.isSticky;
83
- _this.isSticky = !!isSticky; // update sticky shadows
66
+ _this.isSticky = !!isSticky;
84
67
 
68
+ // update sticky shadows
85
69
  _this.updateStickyShadowsHeightIfChanged();
86
-
87
70
  if (!stickyChanged) {
88
71
  var firstCell = _this.getFirstCell(isSticky, hasHeaderRow);
89
-
90
72
  var lastCell = _this.getLastCell(isSticky, hasHeaderRow);
91
-
92
73
  if (!firstCell || !lastCell || firstCell === _this.firstCell && lastCell === _this.lastCell) {
93
74
  return;
94
75
  }
95
76
  }
96
-
97
77
  _this.firstCell = _this.getFirstCell(isSticky, hasHeaderRow);
98
78
  _this.lastCell = _this.getLastCell(isSticky, hasHeaderRow);
99
-
100
79
  if (_this.tableIntersectionObserver && _this.firstCell && _this.lastCell) {
101
80
  _this.tableIntersectionObserver.disconnect();
102
-
103
81
  _this.tableIntersectionObserver.observe(_this.firstCell);
104
-
105
82
  _this.tableIntersectionObserver.observe(_this.lastCell);
106
83
  }
107
84
  });
108
-
109
85
  _defineProperty(this, "updateStickyShadows", function (stickyRowHeight) {
110
86
  var _this$wrapper, _this$wrapper2, _this$wrapper2$parent, _this$wrapper3, _this$wrapper3$parent;
111
-
112
87
  if (!_this.isSticky) {
113
88
  return;
114
89
  }
115
-
116
90
  var stickyCell = _this.getStickyCell();
117
-
118
91
  if (!stickyCell || !((_this$wrapper = _this.wrapper) !== null && _this$wrapper !== void 0 && _this$wrapper.parentElement)) {
119
92
  return;
120
93
  }
121
-
122
- var heightStyleOrCompute = "".concat(stickyRowHeight || stickyCell.clientHeight + 1, "px"); // Use getElementsByClassName here for a live node list to capture
94
+ var heightStyleOrCompute = "".concat(stickyRowHeight || stickyCell.clientHeight + 1, "px");
95
+ // Use getElementsByClassName here for a live node list to capture
123
96
  // sticky shadows
124
-
125
97
  var liveRightShadows = (_this$wrapper2 = _this.wrapper) === null || _this$wrapper2 === void 0 ? void 0 : (_this$wrapper2$parent = _this$wrapper2.parentElement) === null || _this$wrapper2$parent === void 0 ? void 0 : _this$wrapper2$parent.getElementsByClassName("".concat(ClassName.TABLE_RIGHT_SHADOW));
126
98
  var liveLeftShadows = (_this$wrapper3 = _this.wrapper) === null || _this$wrapper3 === void 0 ? void 0 : (_this$wrapper3$parent = _this$wrapper3.parentElement) === null || _this$wrapper3$parent === void 0 ? void 0 : _this$wrapper3$parent.getElementsByClassName("".concat(ClassName.TABLE_LEFT_SHADOW));
127
99
  updateShadowListForStickyStyles(heightStyleOrCompute, liveLeftShadows);
128
100
  updateShadowListForStickyStyles(heightStyleOrCompute, liveRightShadows);
129
101
  });
130
-
131
102
  this.updateShadowState = updateShadowState;
132
103
  this.table = _table;
133
104
  this.wrapper = wrapper;
134
105
  this.init();
135
106
  }
136
-
137
107
  _createClass(OverflowShadowsObserver, [{
138
108
  key: "updateStickyShadowsHeightIfChanged",
139
109
  value: function updateStickyShadowsHeightIfChanged() {
140
110
  if (!this.isSticky) {
141
111
  return;
142
112
  }
143
-
144
113
  var stickyCell = this.getStickyCell();
145
-
146
114
  if (!stickyCell) {
147
115
  return;
148
116
  }
149
-
150
117
  var newStickyRowHeight = stickyCell.clientHeight + 1;
151
-
152
118
  if (newStickyRowHeight === this.stickyRowHeight) {
153
119
  this.stickyRowHeight = newStickyRowHeight;
154
120
  this.updateStickyShadows(this.stickyRowHeight);
@@ -158,7 +124,6 @@ export var OverflowShadowsObserver = /*#__PURE__*/function () {
158
124
  key: "getStickyCell",
159
125
  value: function getStickyCell() {
160
126
  var _this$wrapper4;
161
-
162
127
  var stickyRow = (_this$wrapper4 = this.wrapper) === null || _this$wrapper4 === void 0 ? void 0 : _this$wrapper4.querySelector('tr.sticky');
163
128
  var stickyCell = stickyRow && stickyRow.firstElementChild;
164
129
  return stickyCell;
@@ -172,6 +137,5 @@ export var OverflowShadowsObserver = /*#__PURE__*/function () {
172
137
  }
173
138
  }
174
139
  }]);
175
-
176
140
  return OverflowShadowsObserver;
177
141
  }();