@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,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 { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
8
5
  import { findParentDomRefOfType, findParentNodeOfType } from 'prosemirror-utils';
9
6
  import { findTable } from '@atlaskit/editor-tables/utils';
@@ -32,7 +29,6 @@ var isFullWidthModeEnabled;
32
29
  var wasFullWidthModeEnabled;
33
30
  export var createPlugin = function createPlugin(dispatchAnalyticsEvent, dispatch, portalProviderAPI, eventDispatcher, pluginConfig, getEditorContainerWidth, getEditorFeatureFlags, breakoutEnabled, fullWidthModeEnabled, previousFullWidthModeEnabled, editorAnalyticsAPI) {
34
31
  var _window;
35
-
36
32
  isBreakoutEnabled = breakoutEnabled;
37
33
  isFullWidthModeEnabled = fullWidthModeEnabled;
38
34
  wasFullWidthModeEnabled = previousFullWidthModeEnabled;
@@ -50,7 +46,6 @@ export var createPlugin = function createPlugin(dispatchAnalyticsEvent, dispatch
50
46
  if (!entry.target.id) {
51
47
  return;
52
48
  }
53
-
54
49
  elementContentRects[entry.target.id] = entry.contentRect;
55
50
  });
56
51
  }) : undefined;
@@ -61,21 +56,18 @@ export var createPlugin = function createPlugin(dispatchAnalyticsEvent, dispatch
61
56
  tableHeader: function tableHeader(node, view, getPos) {
62
57
  return new TableCellNodeView(node, view, getPos, getEditorFeatureFlags, observer);
63
58
  }
64
- }; // Used to prevent invalid table cell spans being reported more than once per editor/document
59
+ };
65
60
 
61
+ // Used to prevent invalid table cell spans being reported more than once per editor/document
66
62
  var invalidTableIds = [];
67
63
  var editorViewRef = null;
68
-
69
64
  var getCurrentEditorState = function getCurrentEditorState() {
70
65
  var editorView = editorViewRef;
71
-
72
66
  if (!editorView) {
73
67
  return null;
74
68
  }
75
-
76
69
  return editorView.state;
77
70
  };
78
-
79
71
  return new SafePlugin({
80
72
  state: state,
81
73
  key: pluginKey,
@@ -83,14 +75,12 @@ export var createPlugin = function createPlugin(dispatchAnalyticsEvent, dispatch
83
75
  var tr = transactions.find(function (tr) {
84
76
  return tr.getMeta('uiEvent') === 'cut';
85
77
  });
86
-
87
78
  function reportInvalidTableCellSpanAttrs(invalidNodeAttr) {
88
79
  if (invalidTableIds.find(function (id) {
89
80
  return id === invalidNodeAttr.tableLocalId;
90
81
  })) {
91
82
  return;
92
83
  }
93
-
94
84
  invalidTableIds.push(invalidNodeAttr.tableLocalId);
95
85
  dispatchAnalyticsEvent({
96
86
  action: ACTION.INVALID_DOCUMENT_ENCOUNTERED,
@@ -104,13 +94,11 @@ export var createPlugin = function createPlugin(dispatchAnalyticsEvent, dispatch
104
94
  }
105
95
  });
106
96
  }
107
-
108
97
  if (tr) {
109
98
  // "fixTables" removes empty rows as we don't allow that in schema
110
99
  var updatedTr = handleCut(tr, oldState, newState, editorAnalyticsAPI);
111
100
  return fixTables(updatedTr) || updatedTr;
112
101
  }
113
-
114
102
  if (transactions.find(function (tr) {
115
103
  return tr.docChanged;
116
104
  })) {
@@ -123,38 +111,30 @@ export var createPlugin = function createPlugin(dispatchAnalyticsEvent, dispatch
123
111
  return {
124
112
  update: function update(view) {
125
113
  var state = view.state,
126
- dispatch = view.dispatch;
114
+ dispatch = view.dispatch;
127
115
  var selection = state.selection;
128
116
  var pluginState = getPluginState(state);
129
117
  var tableRef;
130
118
  var tableNode;
131
-
132
119
  if (pluginState.editorHasFocus) {
133
120
  var parent = findParentDomRefOfType(state.schema.nodes.table, domAtPos)(selection);
134
-
135
121
  if (parent) {
136
122
  tableRef = parent.querySelector('table') || undefined;
137
123
  }
138
-
139
124
  tableNode = findTable(state.selection);
140
125
  }
141
-
142
126
  if (pluginState.tableRef !== tableRef) {
143
127
  setTableRef(tableRef)(state, dispatch);
144
128
  }
145
-
146
129
  if (pluginState.tableNode !== tableNode) {
147
130
  updateResizeHandles(tableRef);
148
131
  }
149
-
150
132
  if (pluginState.editorHasFocus && pluginState.tableRef) {
151
133
  var _ref = state.selection,
152
- $cursor = _ref.$cursor;
153
-
134
+ $cursor = _ref.$cursor;
154
135
  if ($cursor) {
155
136
  // Only update bold when it's a cursor
156
137
  var tableCellHeader = findParentNodeOfType(state.schema.nodes.tableHeader)(state.selection);
157
-
158
138
  if (tableCellHeader) {
159
139
  addBoldInEmptyHeaderCells(tableCellHeader)(state, dispatch);
160
140
  }
@@ -171,66 +151,61 @@ export var createPlugin = function createPlugin(dispatchAnalyticsEvent, dispatch
171
151
  props: {
172
152
  transformPasted: function transformPasted(slice) {
173
153
  var editorState = getCurrentEditorState();
174
-
175
154
  if (!editorState) {
176
155
  return slice;
177
156
  }
157
+ var schema = editorState.schema;
178
158
 
179
- var schema = editorState.schema; // if we're pasting to outside a table or outside a table
159
+ // if we're pasting to outside a table or outside a table
180
160
  // header, ensure that we apply any table headers to the first
181
161
  // row of content we see, if required
182
-
183
162
  if (!insideTable(editorState) && isHeaderRowRequired(editorState)) {
184
163
  slice = transformSliceToAddTableHeaders(slice, schema);
185
164
  }
165
+ slice = transformSliceToFixHardBreakProblemOnCopyFromCell(slice, schema);
186
166
 
187
- slice = transformSliceToFixHardBreakProblemOnCopyFromCell(slice, schema); // We do this separately, so it also applies to drag/drop events
167
+ // We do this separately, so it also applies to drag/drop events
188
168
  // This needs to go before `transformSliceToRemoveOpenExpand`
169
+ slice = transformSliceToRemoveOpenLayoutNodes(slice, schema);
189
170
 
190
- slice = transformSliceToRemoveOpenLayoutNodes(slice, schema); // If a partial paste of expand, paste only the content
171
+ // If a partial paste of expand, paste only the content
191
172
  // This needs to go before `transformSliceToRemoveOpenTable`
192
-
193
173
  slice = transformSliceToRemoveOpenExpand(slice, schema);
194
- /** If a partial paste of table, paste only table's content */
195
174
 
175
+ /** If a partial paste of table, paste only table's content */
196
176
  slice = transformSliceToRemoveOpenTable(slice, schema);
197
- /** If a partial paste of bodied extension, paste only text */
198
177
 
178
+ /** If a partial paste of bodied extension, paste only text */
199
179
  slice = transformSliceToRemoveOpenBodiedExtension(slice, schema);
200
180
  slice = transformSliceToCorrectEmptyTableCells(slice, schema);
201
-
202
181
  if (!pluginConfig.allowColumnResizing) {
203
182
  slice = transformSliceToRemoveColumnsWidths(slice, schema);
204
- } // If we don't allow background on cells, we need to remove it
205
- // from the paste slice
206
-
183
+ }
207
184
 
185
+ // If we don't allow background on cells, we need to remove it
186
+ // from the paste slice
208
187
  if (!pluginConfig.allowBackgroundColor) {
209
188
  slice = transformSliceRemoveCellBackgroundColor(slice, schema);
210
189
  }
211
-
212
190
  return slice;
213
191
  },
214
192
  handleClick: function handleClick(_ref2, _pos, event) {
215
193
  var state = _ref2.state,
216
- dispatch = _ref2.dispatch;
194
+ dispatch = _ref2.dispatch;
217
195
  var decorationSet = decorationsPluginKey.getState(state);
218
-
219
196
  if (findControlsHoverDecoration(decorationSet).length) {
220
197
  clearHoverSelection()(state, dispatch);
221
- } // ED-6069: workaround for Chrome given a regression introduced in prosemirror-view@1.6.8
198
+ }
199
+
200
+ // ED-6069: workaround for Chrome given a regression introduced in prosemirror-view@1.6.8
222
201
  // Returning true prevents that updateSelection() is getting called in the commit below:
223
202
  // @see https://github.com/ProseMirror/prosemirror-view/commit/33fe4a8b01584f6b4103c279033dcd33e8047b95
224
-
225
-
226
203
  if (browser.chrome && event.target) {
227
204
  var targetClassList = event.target.classList;
228
-
229
205
  if (targetClassList.contains(ClassName.CONTROLS_BUTTON) || targetClassList.contains(ClassName.CONTEXTUAL_MENU_BUTTON)) {
230
206
  return true;
231
207
  }
232
208
  }
233
-
234
209
  return false;
235
210
  },
236
211
  handleScrollToSelection: function handleScrollToSelection(view) {
@@ -243,14 +218,12 @@ export var createPlugin = function createPlugin(dispatchAnalyticsEvent, dispatch
243
218
  },
244
219
  handleTextInput: function handleTextInput(_ref3, from, to, text) {
245
220
  var state = _ref3.state,
246
- dispatch = _ref3.dispatch;
221
+ dispatch = _ref3.dispatch;
247
222
  var tr = replaceSelectedTable(state, text, INPUT_METHOD.KEYBOARD, editorAnalyticsAPI);
248
-
249
223
  if (tr.selectionSet) {
250
224
  dispatch(tr);
251
225
  return true;
252
226
  }
253
-
254
227
  return false;
255
228
  },
256
229
  nodeViews: _objectSpread(_objectSpread({}, tableCellNodeview), {}, {
@@ -1,51 +1,39 @@
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 { pluginFactory } from '@atlaskit/editor-common/utils';
8
5
  import { handleDocOrSelectionChanged } from '../handlers';
9
6
  import reducer from '../reducer';
10
7
  import { pluginKey } from './plugin-key';
11
-
12
8
  var _pluginFactory = pluginFactory(pluginKey, reducer, {
13
- mapping: function mapping(tr, pluginState) {
14
- if (tr.docChanged) {
15
- var updatedTargetCell = {};
16
-
17
- if (pluginState.targetCellPosition) {
18
- var _tr$mapping$mapResult = tr.mapping.mapResult(pluginState.targetCellPosition),
9
+ mapping: function mapping(tr, pluginState) {
10
+ if (tr.docChanged) {
11
+ var updatedTargetCell = {};
12
+ if (pluginState.targetCellPosition) {
13
+ var _tr$mapping$mapResult = tr.mapping.mapResult(pluginState.targetCellPosition),
19
14
  pos = _tr$mapping$mapResult.pos,
20
15
  deleted = _tr$mapping$mapResult.deleted;
21
-
22
- updatedTargetCell = {
23
- targetCellPosition: deleted ? undefined : pos
24
- };
25
- }
26
-
27
- var updatedTablePos = {};
28
-
29
- if (pluginState.tablePos) {
30
- var _tr$mapping$mapResult2 = tr.mapping.mapResult(pluginState.tablePos, -1),
16
+ updatedTargetCell = {
17
+ targetCellPosition: deleted ? undefined : pos
18
+ };
19
+ }
20
+ var updatedTablePos = {};
21
+ if (pluginState.tablePos) {
22
+ var _tr$mapping$mapResult2 = tr.mapping.mapResult(pluginState.tablePos, -1),
31
23
  _pos = _tr$mapping$mapResult2.pos,
32
24
  _deleted = _tr$mapping$mapResult2.deleted;
33
-
34
- updatedTablePos = {
35
- tablePos: _deleted ? undefined : _pos
36
- };
25
+ updatedTablePos = {
26
+ tablePos: _deleted ? undefined : _pos
27
+ };
28
+ }
29
+ return _objectSpread(_objectSpread(_objectSpread({}, pluginState), updatedTargetCell), updatedTablePos);
37
30
  }
38
-
39
- return _objectSpread(_objectSpread(_objectSpread({}, pluginState), updatedTargetCell), updatedTablePos);
40
- }
41
-
42
- return pluginState;
43
- },
44
- onDocChanged: handleDocOrSelectionChanged,
45
- onSelectionChanged: handleDocOrSelectionChanged
46
- }),
47
- createPluginState = _pluginFactory.createPluginState,
48
- createCommand = _pluginFactory.createCommand,
49
- getPluginState = _pluginFactory.getPluginState;
50
-
31
+ return pluginState;
32
+ },
33
+ onDocChanged: handleDocOrSelectionChanged,
34
+ onSelectionChanged: handleDocOrSelectionChanged
35
+ }),
36
+ createPluginState = _pluginFactory.createPluginState,
37
+ createCommand = _pluginFactory.createCommand,
38
+ getPluginState = _pluginFactory.getPluginState;
51
39
  export { createPluginState, createCommand, getPluginState };
@@ -9,6 +9,7 @@ export var createPlugin = function createPlugin() {
9
9
  // to delay drag selections
10
10
  // - to ensure it is cleaned up when the mouseup
11
11
  // event is not fired in a previous mousedown event
12
+
12
13
  // Because we are manually wiping the view.mouseDown,
13
14
  // we manage this custom cleanup ourselves
14
15
  var prevMouseDownDone = null;
@@ -22,13 +23,16 @@ export var createPlugin = function createPlugin() {
22
23
  // DOM selection syncing during pointer drag.
23
24
  //
24
25
  // https://github.com/ProseMirror/prosemirror-view/commit/885258b80551ac87b81601d3ed25f552aeb22293
26
+
25
27
  // NOTE: this workaround can be removed when next upgrading prosemirror as the issue will be fixed
26
28
  // https://github.com/ProseMirror/prosemirror-view/pull/116
29
+
27
30
  // This fix removes the selectionToDOM from the view
28
31
  // prior to selectionToDOM being called.
29
32
  // selectionToDOM checks if there is an "active"
30
33
  // mouseDown, and if so, it delays running logic
31
34
  // which causes the table selections issue.
35
+
32
36
  // The handleDOMEvents are called before ProseMirror
33
37
  // events fired on the editable DOM element.
34
38
  // This means the view.mouseView will not yet be
@@ -40,21 +44,22 @@ export var createPlugin = function createPlugin() {
40
44
  // prepend a task which will clear the mouseDown from
41
45
  // the view. We do this using a setTimout with no
42
46
  // interval.
47
+
43
48
  if (prevMouseDownDone) {
44
49
  // avoid memory leaks when the mouseup event is not fired
45
50
  // in a previous mousedown event
46
51
  prevMouseDownDone();
47
52
  }
48
-
49
53
  setTimeout(function () {
50
54
  // the ts-ignores here are required due to the
51
55
  // view.mouseDown being an internal which is
52
56
  // not part of the views type signature
57
+
53
58
  // @ts-ignore
54
59
  if (view.mouseDown) {
55
60
  // @ts-ignore
56
- prevMouseDownDone = view.mouseDown.done.bind(view.mouseDown); // @ts-ignore
57
-
61
+ prevMouseDownDone = view.mouseDown.done.bind(view.mouseDown);
62
+ // @ts-ignore
58
63
  view.mouseDown = null;
59
64
  }
60
65
  });
@@ -19,13 +19,10 @@ export var createPlugin = function createPlugin() {
19
19
  },
20
20
  apply: function apply(tr, value) {
21
21
  var renderSpan = tr.getMeta(tableSafariDeleteCompositionTextIssueWorkaroundKey);
22
-
23
22
  if (typeof renderSpan === 'undefined') {
24
23
  return value;
25
24
  }
26
-
27
25
  var decorations;
28
-
29
26
  if (renderSpan) {
30
27
  // Find position of the first text node in case it has multiple text nodes created by Japanese IME
31
28
  var $from = tr.selection.$from;
@@ -38,7 +35,6 @@ export var createPlugin = function createPlugin() {
38
35
  } else {
39
36
  decorations = DecorationSet.empty;
40
37
  }
41
-
42
38
  return {
43
39
  renderSpan: renderSpan,
44
40
  decorations: decorations
@@ -54,43 +50,35 @@ export var createPlugin = function createPlugin() {
54
50
  if ((event === null || event === void 0 ? void 0 : event.inputType) !== 'deleteCompositionText') {
55
51
  return false;
56
52
  }
57
-
58
53
  var selection = window.getSelection();
59
-
60
54
  if (!selection || selection.rangeCount <= 0 || selection.type !== 'Range') {
61
55
  return false;
62
56
  }
63
-
64
57
  var range = selection.getRangeAt(0);
65
58
  var startContainer = range.startContainer,
66
- endContainer = range.endContainer,
67
- endOffset = range.endOffset,
68
- startOffset = range.startOffset;
59
+ endContainer = range.endContainer,
60
+ endOffset = range.endOffset,
61
+ startOffset = range.startOffset;
69
62
  /**
70
63
  * On Safari when composition text is deleted, it deletes any empty elements it finds up the dom tree. Prosemirror can sometimes be confused by this
71
64
  * and will think that we meant to delete those elements. This fix forces the resulting node to not be empty.
72
65
  * The condition here checks to see if the entire text node is about to be swapped inside of an element
73
66
  */
74
-
75
67
  if (startContainer.nodeType === Node.TEXT_NODE && startContainer === endContainer && startOffset === 0 && endOffset === startContainer.length) {
76
68
  var tr = view.state.tr;
77
69
  tr.setMeta(tableSafariDeleteCompositionTextIssueWorkaroundKey, true);
78
70
  view.dispatch(tr);
79
71
  }
80
-
81
72
  return false;
82
73
  },
83
74
  input: function input(view, event) {
84
75
  if ((event === null || event === void 0 ? void 0 : event.inputType) !== 'deleteCompositionText') {
85
76
  return false;
86
77
  }
87
-
88
78
  var selection = window.getSelection();
89
-
90
79
  if (!selection) {
91
80
  return false;
92
81
  }
93
-
94
82
  var tr = view.state.tr;
95
83
  tr.setMeta(tableSafariDeleteCompositionTextIssueWorkaroundKey, false);
96
84
  view.dispatch(tr);
@@ -1,25 +1,21 @@
1
1
  export var getTree = function getTree(tr) {
2
2
  // pm renders into tbody, owned by react
3
3
  var tbody = tr.parentElement;
4
-
5
4
  if (!tbody) {
6
5
  return null;
7
- } // rendered by react
8
-
6
+ }
9
7
 
8
+ // rendered by react
10
9
  var table = tbody.parentElement;
11
-
12
10
  if (!table) {
13
11
  return null;
14
- } // rendered by react
15
-
12
+ }
16
13
 
14
+ // rendered by react
17
15
  var wrapper = table.parentElement;
18
-
19
16
  if (!wrapper) {
20
17
  return null;
21
18
  }
22
-
23
19
  return {
24
20
  wrapper: wrapper,
25
21
  table: table
@@ -29,6 +25,5 @@ export var getTop = function getTop(element) {
29
25
  if (!element || element instanceof Window) {
30
26
  return 0;
31
27
  }
32
-
33
28
  return element.getBoundingClientRect().top;
34
29
  };