@atlaskit/editor-plugin-table 1.3.0 → 1.4.0

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 (293) hide show
  1. package/CHANGELOG.md +22 -0
  2. package/commands/package.json +2 -2
  3. package/dist/cjs/plugins/table/commands/misc.js +1 -2
  4. package/dist/cjs/plugins/table/index.js +25 -34
  5. package/dist/cjs/plugins/table/transforms/column-width.js +0 -17
  6. package/dist/cjs/plugins/table/transforms/delete-columns.js +4 -13
  7. package/dist/cjs/plugins/table/transforms/delete-rows.js +4 -13
  8. package/dist/cjs/plugins/table/transforms/fix-tables.js +6 -24
  9. package/dist/cjs/plugins/table/transforms/index.js +0 -13
  10. package/dist/cjs/plugins/table/transforms/merge.js +5 -20
  11. package/dist/cjs/version.json +1 -1
  12. package/dist/es2019/plugins/table/commands/misc.js +2 -3
  13. package/dist/es2019/plugins/table/index.js +21 -33
  14. package/dist/es2019/plugins/table/transforms/column-width.js +0 -17
  15. package/dist/es2019/plugins/table/transforms/delete-columns.js +4 -13
  16. package/dist/es2019/plugins/table/transforms/delete-rows.js +4 -13
  17. package/dist/es2019/plugins/table/transforms/fix-tables.js +0 -14
  18. package/dist/es2019/plugins/table/transforms/index.js +1 -2
  19. package/dist/es2019/plugins/table/transforms/merge.js +5 -21
  20. package/dist/es2019/version.json +1 -1
  21. package/dist/esm/plugins/table/commands/misc.js +2 -3
  22. package/dist/esm/plugins/table/index.js +25 -34
  23. package/dist/esm/plugins/table/transforms/column-width.js +0 -17
  24. package/dist/esm/plugins/table/transforms/delete-columns.js +4 -13
  25. package/dist/esm/plugins/table/transforms/delete-rows.js +4 -13
  26. package/dist/esm/plugins/table/transforms/fix-tables.js +0 -17
  27. package/dist/esm/plugins/table/transforms/index.js +1 -2
  28. package/dist/esm/plugins/table/transforms/merge.js +5 -21
  29. package/dist/esm/version.json +1 -1
  30. package/dist/types/i18n/cs.d.ts +6 -6
  31. package/dist/types/i18n/da.d.ts +6 -6
  32. package/dist/types/i18n/de.d.ts +6 -6
  33. package/dist/types/i18n/en.d.ts +6 -6
  34. package/dist/types/i18n/en_GB.d.ts +6 -6
  35. package/dist/types/i18n/es.d.ts +6 -6
  36. package/dist/types/i18n/fi.d.ts +6 -6
  37. package/dist/types/i18n/fr.d.ts +6 -6
  38. package/dist/types/i18n/hu.d.ts +6 -6
  39. package/dist/types/i18n/it.d.ts +6 -6
  40. package/dist/types/i18n/ja.d.ts +6 -6
  41. package/dist/types/i18n/ko.d.ts +6 -6
  42. package/dist/types/i18n/nb.d.ts +6 -6
  43. package/dist/types/i18n/nl.d.ts +6 -6
  44. package/dist/types/i18n/pl.d.ts +6 -6
  45. package/dist/types/i18n/pt_BR.d.ts +6 -6
  46. package/dist/types/i18n/ru.d.ts +6 -6
  47. package/dist/types/i18n/sv.d.ts +6 -6
  48. package/dist/types/i18n/th.d.ts +6 -6
  49. package/dist/types/i18n/tr.d.ts +6 -6
  50. package/dist/types/i18n/uk.d.ts +6 -6
  51. package/dist/types/i18n/vi.d.ts +6 -6
  52. package/dist/types/i18n/zh.d.ts +6 -6
  53. package/dist/types/i18n/zh_TW.d.ts +6 -6
  54. package/dist/types/plugins/table/commands/clear.d.ts +1 -1
  55. package/dist/types/plugins/table/commands/hover.d.ts +3 -3
  56. package/dist/types/plugins/table/commands/misc.d.ts +4 -4
  57. package/dist/types/plugins/table/commands-with-analytics.d.ts +2 -2
  58. package/dist/types/plugins/table/event-handlers.d.ts +3 -3
  59. package/dist/types/plugins/table/index.d.ts +9 -0
  60. package/dist/types/plugins/table/nodeviews/OverflowShadowsObserver.d.ts +2 -2
  61. package/dist/types/plugins/table/nodeviews/table.d.ts +1 -1
  62. package/dist/types/plugins/table/nodeviews/types.d.ts +1 -1
  63. package/dist/types/plugins/table/nodeviews/update-overflow-shadows.d.ts +1 -1
  64. package/dist/types/plugins/table/pm-plugins/decorations/utils/types.d.ts +1 -1
  65. package/dist/types/plugins/table/pm-plugins/main.d.ts +1 -1
  66. package/dist/types/plugins/table/pm-plugins/sticky-headers/nodeviews/dom.d.ts +1 -1
  67. package/dist/types/plugins/table/pm-plugins/sticky-headers/nodeviews/tableRow.d.ts +1 -1
  68. package/dist/types/plugins/table/pm-plugins/sticky-headers/types.d.ts +5 -5
  69. package/dist/types/plugins/table/pm-plugins/table-resizing/commands.d.ts +2 -2
  70. package/dist/types/plugins/table/pm-plugins/table-resizing/event-handlers.d.ts +1 -1
  71. package/dist/types/plugins/table/pm-plugins/table-resizing/utils/colgroup.d.ts +1 -1
  72. package/dist/types/plugins/table/pm-plugins/table-resizing/utils/dom.d.ts +1 -1
  73. package/dist/types/plugins/table/pm-plugins/table-resizing/utils/resize-column.d.ts +1 -1
  74. package/dist/types/plugins/table/pm-plugins/table-resizing/utils/resize-logic.d.ts +2 -2
  75. package/dist/types/plugins/table/transforms/fix-tables.d.ts +2 -3
  76. package/dist/types/plugins/table/transforms/index.d.ts +1 -2
  77. package/dist/types/plugins/table/transforms/replace-table.d.ts +1 -1
  78. package/dist/types/plugins/table/types.d.ts +11 -11
  79. package/dist/types/plugins/table/ui/FloatingDeleteButton/types.d.ts +1 -1
  80. package/dist/types/plugins/table/ui/ui-styles.d.ts +2 -2
  81. package/dist/types/plugins/table/utils/column-controls.d.ts +1 -1
  82. package/dist/types/plugins/table/utils/decoration.d.ts +1 -1
  83. package/dist/types/plugins/table/utils/dom.d.ts +2 -2
  84. package/dist/types/plugins/table/utils/row-controls.d.ts +1 -1
  85. package/dist/types/plugins/table/utils/selection.d.ts +1 -1
  86. package/dist/types-ts4.5/i18n/cs.d.ts +35 -0
  87. package/dist/types-ts4.5/i18n/da.d.ts +33 -0
  88. package/dist/types-ts4.5/i18n/de.d.ts +33 -0
  89. package/dist/types-ts4.5/i18n/en.d.ts +35 -0
  90. package/dist/types-ts4.5/i18n/en_GB.d.ts +35 -0
  91. package/dist/types-ts4.5/i18n/es.d.ts +33 -0
  92. package/dist/types-ts4.5/i18n/fi.d.ts +33 -0
  93. package/dist/types-ts4.5/i18n/fr.d.ts +35 -0
  94. package/dist/types-ts4.5/i18n/hu.d.ts +35 -0
  95. package/dist/types-ts4.5/i18n/it.d.ts +35 -0
  96. package/dist/types-ts4.5/i18n/ja.d.ts +35 -0
  97. package/dist/types-ts4.5/i18n/ko.d.ts +33 -0
  98. package/dist/types-ts4.5/i18n/nb.d.ts +33 -0
  99. package/dist/types-ts4.5/i18n/nl.d.ts +35 -0
  100. package/dist/types-ts4.5/i18n/pl.d.ts +35 -0
  101. package/dist/types-ts4.5/i18n/pt_BR.d.ts +35 -0
  102. package/dist/types-ts4.5/i18n/ru.d.ts +35 -0
  103. package/dist/types-ts4.5/i18n/sv.d.ts +33 -0
  104. package/dist/types-ts4.5/i18n/th.d.ts +33 -0
  105. package/dist/types-ts4.5/i18n/tr.d.ts +35 -0
  106. package/dist/types-ts4.5/i18n/uk.d.ts +35 -0
  107. package/dist/types-ts4.5/i18n/vi.d.ts +33 -0
  108. package/dist/types-ts4.5/i18n/zh.d.ts +35 -0
  109. package/dist/types-ts4.5/i18n/zh_TW.d.ts +35 -0
  110. package/dist/types-ts4.5/index.d.ts +1 -0
  111. package/dist/types-ts4.5/plugins/table/commands/clear.d.ts +3 -0
  112. package/dist/types-ts4.5/plugins/table/commands/collapse.d.ts +2 -0
  113. package/dist/types-ts4.5/plugins/table/commands/go-to-next-cell.d.ts +4 -0
  114. package/dist/types-ts4.5/plugins/table/commands/hover.d.ts +8 -0
  115. package/dist/types-ts4.5/plugins/table/commands/index.d.ts +8 -0
  116. package/dist/types-ts4.5/plugins/table/commands/insert.d.ts +10 -0
  117. package/dist/types-ts4.5/plugins/table/commands/misc.d.ts +27 -0
  118. package/dist/types-ts4.5/plugins/table/commands/referentiality.d.ts +2 -0
  119. package/dist/types-ts4.5/plugins/table/commands/selection.d.ts +8 -0
  120. package/dist/types-ts4.5/plugins/table/commands/sort.d.ts +3 -0
  121. package/dist/types-ts4.5/plugins/table/commands/split-cell.d.ts +6 -0
  122. package/dist/types-ts4.5/plugins/table/commands/toggle.d.ts +12 -0
  123. package/dist/types-ts4.5/plugins/table/commands-with-analytics.d.ts +26 -0
  124. package/dist/types-ts4.5/plugins/table/create-plugin-config.d.ts +2 -0
  125. package/dist/types-ts4.5/plugins/table/event-handlers.d.ts +16 -0
  126. package/dist/types-ts4.5/plugins/table/handlers.d.ts +3 -0
  127. package/dist/types-ts4.5/plugins/table/index.d.ts +30 -0
  128. package/dist/types-ts4.5/plugins/table/nodeviews/OverflowShadowsObserver.d.ts +25 -0
  129. package/dist/types-ts4.5/plugins/table/nodeviews/TableComponent.d.ts +73 -0
  130. package/dist/types-ts4.5/plugins/table/nodeviews/__mocks__/OverflowShadowsObserver.d.ts +9 -0
  131. package/dist/types-ts4.5/plugins/table/nodeviews/__mocks__/OverridableMock.d.ts +9 -0
  132. package/dist/types-ts4.5/plugins/table/nodeviews/table.d.ts +34 -0
  133. package/dist/types-ts4.5/plugins/table/nodeviews/tableCell.d.ts +19 -0
  134. package/dist/types-ts4.5/plugins/table/nodeviews/types.d.ts +24 -0
  135. package/dist/types-ts4.5/plugins/table/nodeviews/update-overflow-shadows.d.ts +8 -0
  136. package/dist/types-ts4.5/plugins/table/pm-plugins/decorations/plugin.d.ts +7 -0
  137. package/dist/types-ts4.5/plugins/table/pm-plugins/decorations/utils/column-controls.d.ts +3 -0
  138. package/dist/types-ts4.5/plugins/table/pm-plugins/decorations/utils/column-resizing.d.ts +2 -0
  139. package/dist/types-ts4.5/plugins/table/pm-plugins/decorations/utils/compose-decorations.d.ts +2 -0
  140. package/dist/types-ts4.5/plugins/table/pm-plugins/decorations/utils/index.d.ts +3 -0
  141. package/dist/types-ts4.5/plugins/table/pm-plugins/decorations/utils/types.d.ts +6 -0
  142. package/dist/types-ts4.5/plugins/table/pm-plugins/default-table-selection.d.ts +4 -0
  143. package/dist/types-ts4.5/plugins/table/pm-plugins/keymap.d.ts +5 -0
  144. package/dist/types-ts4.5/plugins/table/pm-plugins/main.d.ts +8 -0
  145. package/dist/types-ts4.5/plugins/table/pm-plugins/plugin-factory.d.ts +1 -0
  146. package/dist/types-ts4.5/plugins/table/pm-plugins/plugin-key.d.ts +3 -0
  147. package/dist/types-ts4.5/plugins/table/pm-plugins/safari-delete-composition-text-issue-workaround.d.ts +15 -0
  148. package/dist/types-ts4.5/plugins/table/pm-plugins/sticky-headers/commands.d.ts +3 -0
  149. package/dist/types-ts4.5/plugins/table/pm-plugins/sticky-headers/index.d.ts +6 -0
  150. package/dist/types-ts4.5/plugins/table/pm-plugins/sticky-headers/nodeviews/dom.d.ts +6 -0
  151. package/dist/types-ts4.5/plugins/table/pm-plugins/sticky-headers/nodeviews/tableRow.d.ts +72 -0
  152. package/dist/types-ts4.5/plugins/table/pm-plugins/sticky-headers/plugin-key.d.ts +3 -0
  153. package/dist/types-ts4.5/plugins/table/pm-plugins/sticky-headers/plugin-state.d.ts +3 -0
  154. package/dist/types-ts4.5/plugins/table/pm-plugins/sticky-headers/plugin.d.ts +4 -0
  155. package/dist/types-ts4.5/plugins/table/pm-plugins/sticky-headers/types.d.ts +16 -0
  156. package/dist/types-ts4.5/plugins/table/pm-plugins/sticky-headers/util.d.ts +2 -0
  157. package/dist/types-ts4.5/plugins/table/pm-plugins/table-local-id.d.ts +22 -0
  158. package/dist/types-ts4.5/plugins/table/pm-plugins/table-resizing/commands.d.ts +25 -0
  159. package/dist/types-ts4.5/plugins/table/pm-plugins/table-resizing/event-handlers.d.ts +4 -0
  160. package/dist/types-ts4.5/plugins/table/pm-plugins/table-resizing/index.d.ts +4 -0
  161. package/dist/types-ts4.5/plugins/table/pm-plugins/table-resizing/plugin-factory.d.ts +4 -0
  162. package/dist/types-ts4.5/plugins/table/pm-plugins/table-resizing/plugin-key.d.ts +3 -0
  163. package/dist/types-ts4.5/plugins/table/pm-plugins/table-resizing/plugin.d.ts +6 -0
  164. package/dist/types-ts4.5/plugins/table/pm-plugins/table-resizing/reducer.d.ts +3 -0
  165. package/dist/types-ts4.5/plugins/table/pm-plugins/table-resizing/utils/colgroup.d.ts +15 -0
  166. package/dist/types-ts4.5/plugins/table/pm-plugins/table-resizing/utils/column-state.d.ts +14 -0
  167. package/dist/types-ts4.5/plugins/table/pm-plugins/table-resizing/utils/content-width.d.ts +4 -0
  168. package/dist/types-ts4.5/plugins/table/pm-plugins/table-resizing/utils/dom.d.ts +13 -0
  169. package/dist/types-ts4.5/plugins/table/pm-plugins/table-resizing/utils/index.d.ts +12 -0
  170. package/dist/types-ts4.5/plugins/table/pm-plugins/table-resizing/utils/misc.d.ts +22 -0
  171. package/dist/types-ts4.5/plugins/table/pm-plugins/table-resizing/utils/resize-column.d.ts +2 -0
  172. package/dist/types-ts4.5/plugins/table/pm-plugins/table-resizing/utils/resize-logic.d.ts +4 -0
  173. package/dist/types-ts4.5/plugins/table/pm-plugins/table-resizing/utils/resize-state.d.ts +29 -0
  174. package/dist/types-ts4.5/plugins/table/pm-plugins/table-resizing/utils/scale-table.d.ts +17 -0
  175. package/dist/types-ts4.5/plugins/table/pm-plugins/table-resizing/utils/types.d.ts +22 -0
  176. package/dist/types-ts4.5/plugins/table/pm-plugins/table-resizing/utils/unit-to-number.d.ts +1 -0
  177. package/dist/types-ts4.5/plugins/table/pm-plugins/table-selection-keymap.d.ts +4 -0
  178. package/dist/types-ts4.5/plugins/table/reducer.d.ts +3 -0
  179. package/dist/types-ts4.5/plugins/table/toolbar.d.ts +37 -0
  180. package/dist/types-ts4.5/plugins/table/transforms/column-width.d.ts +18 -0
  181. package/dist/types-ts4.5/plugins/table/transforms/delete-columns.d.ts +3 -0
  182. package/dist/types-ts4.5/plugins/table/transforms/delete-rows.d.ts +3 -0
  183. package/dist/types-ts4.5/plugins/table/transforms/fix-tables.d.ts +9 -0
  184. package/dist/types-ts4.5/plugins/table/transforms/index.d.ts +6 -0
  185. package/dist/types-ts4.5/plugins/table/transforms/merge.d.ts +5 -0
  186. package/dist/types-ts4.5/plugins/table/transforms/replace-table.d.ts +5 -0
  187. package/dist/types-ts4.5/plugins/table/transforms/split.d.ts +9 -0
  188. package/dist/types-ts4.5/plugins/table/types.d.ts +332 -0
  189. package/dist/types-ts4.5/plugins/table/ui/FloatingContextualButton/index.d.ts +29 -0
  190. package/dist/types-ts4.5/plugins/table/ui/FloatingContextualButton/styles.d.ts +3 -0
  191. package/dist/types-ts4.5/plugins/table/ui/FloatingContextualMenu/ContextualMenu.d.ts +88 -0
  192. package/dist/types-ts4.5/plugins/table/ui/FloatingContextualMenu/index.d.ts +23 -0
  193. package/dist/types-ts4.5/plugins/table/ui/FloatingContextualMenu/styles.d.ts +2 -0
  194. package/dist/types-ts4.5/plugins/table/ui/FloatingDeleteButton/DeleteButton.d.ts +14 -0
  195. package/dist/types-ts4.5/plugins/table/ui/FloatingDeleteButton/getPopUpOptions.d.ts +10 -0
  196. package/dist/types-ts4.5/plugins/table/ui/FloatingDeleteButton/index.d.ts +54 -0
  197. package/dist/types-ts4.5/plugins/table/ui/FloatingDeleteButton/types.d.ts +1 -0
  198. package/dist/types-ts4.5/plugins/table/ui/FloatingInsertButton/InsertButton.d.ts +12 -0
  199. package/dist/types-ts4.5/plugins/table/ui/FloatingInsertButton/getPopupOptions.d.ts +3 -0
  200. package/dist/types-ts4.5/plugins/table/ui/FloatingInsertButton/index.d.ts +35 -0
  201. package/dist/types-ts4.5/plugins/table/ui/LayoutButton/index.d.ts +21 -0
  202. package/dist/types-ts4.5/plugins/table/ui/TableFloatingControls/CornerControls/index.d.ts +16 -0
  203. package/dist/types-ts4.5/plugins/table/ui/TableFloatingControls/NumberColumn/index.d.ts +21 -0
  204. package/dist/types-ts4.5/plugins/table/ui/TableFloatingControls/RowControls/index.d.ts +17 -0
  205. package/dist/types-ts4.5/plugins/table/ui/TableFloatingControls/index.d.ts +40 -0
  206. package/dist/types-ts4.5/plugins/table/ui/common-styles.d.ts +8 -0
  207. package/dist/types-ts4.5/plugins/table/ui/consts.d.ts +39 -0
  208. package/dist/types-ts4.5/plugins/table/ui/messages.d.ts +58 -0
  209. package/dist/types-ts4.5/plugins/table/ui/ui-styles.d.ts +15 -0
  210. package/dist/types-ts4.5/plugins/table/utils/analytics.d.ts +18 -0
  211. package/dist/types-ts4.5/plugins/table/utils/collapse.d.ts +29 -0
  212. package/dist/types-ts4.5/plugins/table/utils/column-controls.d.ts +10 -0
  213. package/dist/types-ts4.5/plugins/table/utils/decoration.d.ts +16 -0
  214. package/dist/types-ts4.5/plugins/table/utils/dom.d.ts +20 -0
  215. package/dist/types-ts4.5/plugins/table/utils/get-allow-add-column-custom-step.d.ts +2 -0
  216. package/dist/types-ts4.5/plugins/table/utils/index.d.ts +11 -0
  217. package/dist/types-ts4.5/plugins/table/utils/nodes.d.ts +12 -0
  218. package/dist/types-ts4.5/plugins/table/utils/paste.d.ts +14 -0
  219. package/dist/types-ts4.5/plugins/table/utils/row-controls.d.ts +16 -0
  220. package/dist/types-ts4.5/plugins/table/utils/selection.d.ts +6 -0
  221. package/dist/types-ts4.5/plugins/table/utils/table.d.ts +4 -0
  222. package/dist/types-ts4.5/plugins/table/utils/update-plugin-state-decorations.d.ts +4 -0
  223. package/dist/types-ts4.5/plugins/table-plugin.d.ts +2 -0
  224. package/dist/types-ts4.5/types/i18n.d.ts +5 -0
  225. package/examples/99-testing.tsx +4 -94
  226. package/package.json +19 -9
  227. package/plugin-key/package.json +2 -2
  228. package/report.api.md +11 -0
  229. package/src/__tests__/unit/analytics.ts +6 -0
  230. package/src/__tests__/unit/collab.ts +6 -0
  231. package/src/__tests__/unit/color-picker.ts +4 -0
  232. package/src/__tests__/unit/commands/go-to-next-cell.ts +8 -1
  233. package/src/__tests__/unit/commands/insert.ts +6 -0
  234. package/src/__tests__/unit/commands/misc.ts +14 -6
  235. package/src/__tests__/unit/commands/sort.ts +19 -12
  236. package/src/__tests__/unit/commands.ts +10 -2
  237. package/src/__tests__/unit/copy-paste.ts +6 -0
  238. package/src/__tests__/unit/event-handlers/index.ts +13 -8
  239. package/src/__tests__/unit/event-handlers.ts +13 -1
  240. package/src/__tests__/unit/fix-tables.ts +8 -4
  241. package/src/__tests__/unit/get-toolbar-config.ts +4 -0
  242. package/src/__tests__/unit/handlers.ts +8 -1
  243. package/src/__tests__/unit/hover-selection.ts +8 -1
  244. package/src/__tests__/unit/index.ts +10 -2
  245. package/src/__tests__/unit/keymap.ts +10 -4
  246. package/src/__tests__/unit/layout.ts +4 -0
  247. package/src/__tests__/unit/nodeviews/cell.ts +6 -0
  248. package/src/__tests__/unit/nodeviews/table.ts +16 -9
  249. package/src/__tests__/unit/pm-plugins/decorations/column-resizing.ts +14 -4
  250. package/src/__tests__/unit/pm-plugins/decorations/plugin.ts +8 -1
  251. package/src/__tests__/unit/pm-plugins/main-with-allow-collapse.ts +4 -0
  252. package/src/__tests__/unit/pm-plugins/main.ts +6 -0
  253. package/src/__tests__/unit/pm-plugins/safari-delete-composition-text-issue-workaround.ts +8 -4
  254. package/src/__tests__/unit/pm-plugins/sticky-headers/tableRow.tsx +13 -4
  255. package/src/__tests__/unit/pm-plugins/table-resizing/event-handlers.ts +6 -0
  256. package/src/__tests__/unit/pm-plugins/table-selection-keymap.ts +6 -0
  257. package/src/__tests__/unit/sort-column.ts +6 -0
  258. package/src/__tests__/unit/toolbar.ts +16 -9
  259. package/src/__tests__/unit/transforms/delete-columns.ts +8 -1
  260. package/src/__tests__/unit/transforms/delete-rows.ts +8 -1
  261. package/src/__tests__/unit/transforms/merging.ts +8 -1
  262. package/src/__tests__/unit/ui/ContextualMenu.tsx +8 -4
  263. package/src/__tests__/unit/ui/CornerControls.tsx +8 -1
  264. package/src/__tests__/unit/ui/FloatingContextualButton.tsx +8 -1
  265. package/src/__tests__/unit/ui/FloatingContextualMenu.tsx +8 -1
  266. package/src/__tests__/unit/ui/RowControls.tsx +8 -1
  267. package/src/__tests__/unit/ui/TableFloatingControls.tsx +8 -1
  268. package/src/__tests__/unit/undo-redo.ts +6 -0
  269. package/src/__tests__/unit/utils/collapse.ts +4 -0
  270. package/src/__tests__/unit/utils/nodes.ts +8 -1
  271. package/src/__tests__/unit/utils/row-controls.ts +8 -1
  272. package/src/__tests__/unit/utils.ts +8 -1
  273. package/src/plugins/table/commands/misc.ts +2 -4
  274. package/src/plugins/table/index.tsx +39 -40
  275. package/src/plugins/table/transforms/column-width.ts +0 -11
  276. package/src/plugins/table/transforms/delete-columns.ts +4 -5
  277. package/src/plugins/table/transforms/delete-rows.ts +4 -7
  278. package/src/plugins/table/transforms/fix-tables.ts +0 -17
  279. package/src/plugins/table/transforms/index.ts +1 -2
  280. package/src/plugins/table/transforms/merge.ts +9 -20
  281. package/types/package.json +2 -2
  282. package/ui/common-styles/package.json +2 -2
  283. package/ui/consts/package.json +2 -2
  284. package/dist/cjs/plugins/table/pm-plugins/safari-delayed-dom-selection-syncing-workaround.js +0 -79
  285. package/dist/cjs/plugins/table/transforms/metadata.js +0 -20
  286. package/dist/es2019/plugins/table/pm-plugins/safari-delayed-dom-selection-syncing-workaround.js +0 -71
  287. package/dist/es2019/plugins/table/transforms/metadata.js +0 -12
  288. package/dist/esm/plugins/table/pm-plugins/safari-delayed-dom-selection-syncing-workaround.js +0 -71
  289. package/dist/esm/plugins/table/transforms/metadata.js +0 -14
  290. package/dist/types/plugins/table/pm-plugins/safari-delayed-dom-selection-syncing-workaround.d.ts +0 -4
  291. package/dist/types/plugins/table/transforms/metadata.d.ts +0 -21
  292. package/src/plugins/table/pm-plugins/safari-delayed-dom-selection-syncing-workaround.ts +0 -78
  293. package/src/plugins/table/transforms/metadata.ts +0 -35
@@ -24,11 +24,18 @@ import { pluginKey } from '../../../plugins/table/pm-plugins/plugin-key';
24
24
  import { getDecorations } from '../../../plugins/table/pm-plugins/decorations/plugin';
25
25
  import tablePlugin from '../../../plugins/table-plugin';
26
26
  import { PluginKey } from 'prosemirror-state';
27
+ import featureFlagsPlugin from '@atlaskit/editor-plugin-feature-flags';
28
+ import { analyticsPlugin } from '@atlaskit/editor-plugin-analytics';
29
+ import { contentInsertionPlugin } from '@atlaskit/editor-plugin-content-insertion';
27
30
 
28
31
  describe('TableFloatingControls', () => {
29
32
  const createEditor = createProsemirrorEditorFactory();
30
33
  const fakeGetEditorFeatureFlags = () => ({});
31
- const preset = new Preset<LightEditorPlugin>().add(tablePlugin);
34
+ const preset = new Preset<LightEditorPlugin>()
35
+ .add([featureFlagsPlugin, {}])
36
+ .add([analyticsPlugin, {}])
37
+ .add(contentInsertionPlugin)
38
+ .add(tablePlugin);
32
39
 
33
40
  const editor = (doc: DocBuilder) =>
34
41
  createEditor<TablePluginState, PluginKey>({
@@ -25,6 +25,9 @@ import sendKeyToPm from '@atlaskit/editor-test-helpers/send-key-to-pm';
25
25
  import clone from 'lodash/clone';
26
26
  import tablePlugin from '../../plugins/table';
27
27
  import widthPlugin from '@atlaskit/editor-core/src/plugins/width';
28
+ import featureFlagsPlugin from '@atlaskit/editor-plugin-feature-flags';
29
+ import { analyticsPlugin } from '@atlaskit/editor-plugin-analytics';
30
+ import { contentInsertionPlugin } from '@atlaskit/editor-plugin-content-insertion';
28
31
 
29
32
  const TABLE_LOCAL_ID = 'test-table-local-id';
30
33
 
@@ -59,6 +62,9 @@ describe('undo/redo with tables', () => {
59
62
  return createEditor({
60
63
  doc,
61
64
  preset: new Preset<LightEditorPlugin>()
65
+ .add([featureFlagsPlugin, {}])
66
+ .add([analyticsPlugin, {}])
67
+ .add(contentInsertionPlugin)
62
68
  .add([tablePlugin, { tableOptions }])
63
69
  .add(widthPlugin),
64
70
  pluginKey: tablePluginKey,
@@ -19,6 +19,8 @@ import {
19
19
  collapseSelectedTable,
20
20
  } from '../../../plugins/table/utils/collapse';
21
21
  import featureFlagsPlugin from '@atlaskit/editor-plugin-feature-flags';
22
+ import { analyticsPlugin } from '@atlaskit/editor-plugin-analytics';
23
+ import { contentInsertionPlugin } from '@atlaskit/editor-plugin-content-insertion';
22
24
 
23
25
  describe('collapse', () => {
24
26
  const createEditor = createProsemirrorEditorFactory();
@@ -26,6 +28,8 @@ describe('collapse', () => {
26
28
  const editor = (doc: DocBuilder, expandInPlugins?: boolean) => {
27
29
  const preset = new Preset<LightEditorPlugin>()
28
30
  .add([featureFlagsPlugin, {}])
31
+ .add([analyticsPlugin, {}])
32
+ .add(contentInsertionPlugin)
29
33
  .add(tablePlugin);
30
34
 
31
35
  const finalPreset = expandInPlugins ? preset.add(expandPlugin) : preset;
@@ -18,6 +18,9 @@ import {
18
18
  import { containsHeaderColumn } from '../../../plugins/table/utils/nodes';
19
19
  import { pluginKey } from '../../../plugins/table/pm-plugins/plugin-key';
20
20
  import tablePlugin from '../../../plugins/table-plugin';
21
+ import featureFlagsPlugin from '@atlaskit/editor-plugin-feature-flags';
22
+ import { analyticsPlugin } from '@atlaskit/editor-plugin-analytics';
23
+ import { contentInsertionPlugin } from '@atlaskit/editor-plugin-content-insertion';
21
24
 
22
25
  describe('table merging logic', () => {
23
26
  const createEditor = createProsemirrorEditorFactory();
@@ -25,7 +28,11 @@ describe('table merging logic', () => {
25
28
  const editor = (doc: DocBuilder) =>
26
29
  createEditor({
27
30
  doc,
28
- preset: new Preset<LightEditorPlugin>().add(tablePlugin),
31
+ preset: new Preset<LightEditorPlugin>()
32
+ .add([featureFlagsPlugin, {}])
33
+ .add([analyticsPlugin, {}])
34
+ .add(contentInsertionPlugin)
35
+ .add(tablePlugin),
29
36
  pluginKey,
30
37
  });
31
38
 
@@ -19,6 +19,9 @@ import {
19
19
  import { copyPreviousRow } from '../../../plugins/table/utils/row-controls';
20
20
  import { pluginKey } from '../../../plugins/table/pm-plugins/plugin-key';
21
21
  import tablePlugin from '../../../plugins/table-plugin';
22
+ import featureFlagsPlugin from '@atlaskit/editor-plugin-feature-flags';
23
+ import { analyticsPlugin } from '@atlaskit/editor-plugin-analytics';
24
+ import { contentInsertionPlugin } from '@atlaskit/editor-plugin-content-insertion';
22
25
 
23
26
  const TABLE_LOCAL_ID = 'test-table-local-id';
24
27
 
@@ -35,7 +38,11 @@ describe('table plugin: utils/row-controls.js', () => {
35
38
  const editor = (doc: DocBuilder) =>
36
39
  createEditor({
37
40
  doc,
38
- preset: new Preset<LightEditorPlugin>().add(tablePlugin),
41
+ preset: new Preset<LightEditorPlugin>()
42
+ .add([featureFlagsPlugin, {}])
43
+ .add([analyticsPlugin, {}])
44
+ .add(contentInsertionPlugin)
45
+ .add(tablePlugin),
39
46
  pluginKey,
40
47
  });
41
48
 
@@ -28,10 +28,17 @@ import { getColumnsWidths } from '../../plugins/table/utils/column-controls';
28
28
  import { pluginKey } from '../../plugins/table/pm-plugins/plugin-key';
29
29
  import tablePlugin from '../../plugins/table';
30
30
  import { PluginKey } from 'prosemirror-state';
31
+ import { analyticsPlugin } from '@atlaskit/editor-plugin-analytics';
32
+ import featureFlagsPlugin from '@atlaskit/editor-plugin-feature-flags';
33
+ import { contentInsertionPlugin } from '@atlaskit/editor-plugin-content-insertion';
31
34
 
32
35
  describe('table plugin: utils', () => {
33
36
  const createEditor = createProsemirrorEditorFactory();
34
- const preset = new Preset<LightEditorPlugin>().add(tablePlugin);
37
+ const preset = new Preset<LightEditorPlugin>()
38
+ .add([featureFlagsPlugin, {}])
39
+ .add([analyticsPlugin, {}])
40
+ .add(contentInsertionPlugin)
41
+ .add(tablePlugin);
35
42
 
36
43
  const editor = (doc: DocBuilder) =>
37
44
  createEditor<TablePluginState, PluginKey>({
@@ -1,6 +1,6 @@
1
1
  // #region Imports
2
2
  import { Node as PMNode, Schema, Slice } from 'prosemirror-model';
3
- import { Selection, TextSelection, Transaction } from 'prosemirror-state';
3
+ import { TextSelection, Transaction } from 'prosemirror-state';
4
4
  import { TableMap } from '@atlaskit/editor-tables/table-map';
5
5
  import { CellSelection } from '@atlaskit/editor-tables/cell-selection';
6
6
  import {
@@ -352,10 +352,8 @@ export const setMultipleCellAttrs =
352
352
  }
353
353
 
354
354
  if (tr.docChanged && cursorPos !== undefined) {
355
- const $pos = tr.doc.resolve(tr.mapping.map(cursorPos!));
356
-
357
355
  if (dispatch) {
358
- dispatch(tr.setSelection(Selection.near($pos)));
356
+ dispatch(tr);
359
357
  }
360
358
  return true;
361
359
  }
@@ -1,6 +1,5 @@
1
1
  import React from 'react';
2
2
 
3
- import type { Schema } from 'prosemirror-model';
4
3
  import type { EditorView } from 'prosemirror-view';
5
4
 
6
5
  import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
@@ -12,12 +11,13 @@ import { table, tableCell, tableHeader, tableRow } from '@atlaskit/adf-schema';
12
11
 
13
12
  import { toggleTable, tooltip } from '@atlaskit/editor-common/keymaps';
14
13
 
15
- import type { EditorPlugin } from '@atlaskit/editor-common/types';
14
+ import type { EditorPlugin, Command } from '@atlaskit/editor-common/types';
16
15
  import { WithPluginState } from '@atlaskit/editor-common/with-plugin-state';
17
16
  import {
18
17
  ACTION,
19
18
  ACTION_SUBJECT,
20
19
  ACTION_SUBJECT_ID,
20
+ AnalyticsEventPayload,
21
21
  EVENT_TYPE,
22
22
  INPUT_METHOD,
23
23
  TABLE_ACTION,
@@ -31,7 +31,6 @@ import type { EditorSelectionAPI } from '@atlaskit/editor-common/selection';
31
31
 
32
32
  import { pluginConfig } from './create-plugin-config';
33
33
  import { createPlugin as createTableLocalIdPlugin } from './pm-plugins/table-local-id';
34
- import { createPlugin as createTableSafariDelayedDomSelectionSyncingWorkaroundPlugin } from './pm-plugins/safari-delayed-dom-selection-syncing-workaround';
35
34
  import { createPlugin as createTableSafariDeleteCompositionTextIssueWorkaroundPlugin } from './pm-plugins/safari-delete-composition-text-issue-workaround';
36
35
  import { createPlugin as createDecorationsPlugin } from './pm-plugins/decorations/plugin';
37
36
  import { keymapPlugin } from './pm-plugins/keymap';
@@ -62,6 +61,8 @@ import type {
62
61
  NextEditorPlugin,
63
62
  } from '@atlaskit/editor-common/types';
64
63
  import { EditorState, Transaction } from 'prosemirror-state';
64
+ import type { analyticsPlugin } from '@atlaskit/editor-plugin-analytics';
65
+ import type { contentInsertionPlugin } from '@atlaskit/editor-plugin-content-insertion';
65
66
 
66
67
  interface TablePluginOptions {
67
68
  tableOptions: PluginConfig;
@@ -75,14 +76,20 @@ interface TablePluginOptions {
75
76
  getEditorFeatureFlags?: GetEditorFeatureFlags;
76
77
  }
77
78
 
79
+ type InsertTableAction = (analyticsPayload: AnalyticsEventPayload) => Command;
80
+
78
81
  const defaultGetEditorFeatureFlags = () => ({});
79
82
 
80
83
  const tablesPlugin: NextEditorPlugin<
81
84
  'table',
82
85
  {
83
86
  pluginConfiguration: TablePluginOptions | undefined;
87
+ actions: {
88
+ insertTable: InsertTableAction;
89
+ };
90
+ dependencies: [typeof analyticsPlugin, typeof contentInsertionPlugin];
84
91
  }
85
- > = (options?: TablePluginOptions) => {
92
+ > = (options?: TablePluginOptions, api?) => {
86
93
  const editorViewRef: Record<'current', EditorView | null> = { current: null };
87
94
  const defaultGetEditorContainerWidth: GetEditorContainerWidth = () => {
88
95
  if (!editorViewRef.current) {
@@ -104,6 +111,29 @@ const tablesPlugin: NextEditorPlugin<
104
111
  return {
105
112
  name: 'table',
106
113
 
114
+ actions: {
115
+ insertTable:
116
+ (analyticsPayload): Command =>
117
+ (state, dispatch) => {
118
+ const node = createTable({
119
+ schema: state.schema,
120
+ });
121
+
122
+ return (
123
+ api?.dependencies?.contentInsertion?.actions?.insert({
124
+ state,
125
+ dispatch,
126
+ node,
127
+
128
+ options: {
129
+ selectNodeInserted: false,
130
+ analyticsPayload,
131
+ },
132
+ }) ?? false
133
+ );
134
+ },
135
+ },
136
+
107
137
  nodes() {
108
138
  return [
109
139
  { name: 'table', node: table },
@@ -130,7 +160,11 @@ const tablesPlugin: NextEditorPlugin<
130
160
  tableOptions,
131
161
  editorAnalyticsAPI,
132
162
  getEditorFeatureFlags,
133
- } = options || ({} as TablePluginOptions);
163
+ } =
164
+ options ||
165
+ ({
166
+ editorAnalyticsAPI: api?.dependencies.analytics.actions,
167
+ } as TablePluginOptions);
134
168
  return createPlugin(
135
169
  dispatchAnalyticsEvent,
136
170
  dispatch,
@@ -246,21 +280,6 @@ const tablesPlugin: NextEditorPlugin<
246
280
  },
247
281
  ];
248
282
 
249
- // workaround for prosemirrors delayed dom selection syncing during pointer drag
250
- // causing issues with table selections in Safari
251
- // https://github.com/ProseMirror/prosemirror-view/commit/885258b80551ac87b81601d3ed25f552aeb22293
252
-
253
- // NOTE: this workaround can be removed when next upgrading prosemirror as the issue will be fixed
254
- // https://github.com/ProseMirror/prosemirror-view/pull/116
255
- if (browser.safari) {
256
- plugins.push({
257
- name: 'tableSafariDelayedDomSelectionSyncingWorkaround',
258
- plugin: () => {
259
- return createTableSafariDelayedDomSelectionSyncingWorkaroundPlugin();
260
- },
261
- });
262
- }
263
-
264
283
  // Workaround for table element breaking issue caused by composition event with an inputType of deleteCompositionText.
265
284
  // https://github.com/ProseMirror/prosemirror/issues/934
266
285
  if (browser.safari) {
@@ -418,26 +437,6 @@ const tablesPlugin: NextEditorPlugin<
418
437
  },
419
438
 
420
439
  pluginsOptions: {
421
- // TODO: ED-14676 This is not the final API design
422
- // For now, we are using this on (insert-api/api.ts) but we may create a proper place for it
423
- createNodeHandler: ({
424
- nodeName,
425
- schema,
426
- }: {
427
- nodeName: string;
428
- schema: Schema;
429
- }) => {
430
- // An EditorPlugin may manage more than one node.
431
- if (nodeName !== 'table') {
432
- return null;
433
- }
434
-
435
- const table = createTable({
436
- schema,
437
- });
438
-
439
- return table;
440
- },
441
440
  quickInsert: ({ formatMessage }) => [
442
441
  {
443
442
  id: 'table',
@@ -11,7 +11,6 @@ import {
11
11
  ResizeState,
12
12
  } from '../pm-plugins/table-resizing/utils';
13
13
 
14
- import { setMeta } from './metadata';
15
14
  import { ContentNodeWithPos } from 'prosemirror-utils';
16
15
  import { EditorView } from 'prosemirror-view';
17
16
  import {
@@ -43,11 +42,6 @@ export const updateColumnWidths =
43
42
  const colspan = attrs.colspan || 1;
44
43
 
45
44
  if (attrs.colwidth && attrs.colwidth.length > colspan) {
46
- tr = setMeta({
47
- type: 'UPDATE_COLUMN_WIDTHS',
48
- problem: 'COLWIDTHS_BEFORE_UPDATE',
49
- data: { colwidths: attrs.colwidth, colspan },
50
- })(tr);
51
45
  attrs.colwidth = attrs.colwidth.slice(0, colspan);
52
46
  }
53
47
 
@@ -67,11 +61,6 @@ export const updateColumnWidths =
67
61
 
68
62
  colwidths[colspanIndex] = width;
69
63
  if (colwidths.length > colspan) {
70
- tr = setMeta({
71
- type: 'UPDATE_COLUMN_WIDTHS',
72
- problem: 'COLWIDTHS_AFTER_UPDATE',
73
- data: { colwidths, colspan },
74
- })(tr);
75
64
  colwidths = colwidths.slice(0, colspan);
76
65
  }
77
66
  updatedCellsAttrs[cellPos] = {
@@ -6,7 +6,6 @@ import { findTable } from '@atlaskit/editor-tables/utils';
6
6
  import { CellAttributes } from '@atlaskit/adf-schema';
7
7
  import { AddColumnStep } from '@atlaskit/adf-schema/steps';
8
8
 
9
- import { setMeta } from './metadata';
10
9
  import { splitCellsInColumns } from './split';
11
10
 
12
11
  const deleteColumnsCustomStep =
@@ -155,7 +154,7 @@ const deleteColumnsLegacy =
155
154
  }
156
155
 
157
156
  if (!rows.length) {
158
- return setMeta({ type: 'DELETE_COLUMNS', problem: 'EMPTY_TABLE' })(tr);
157
+ return tr;
159
158
  }
160
159
 
161
160
  const newTable = table.node.type.createChecked(
@@ -166,16 +165,16 @@ const deleteColumnsLegacy =
166
165
 
167
166
  const fixedTable = fixRowSpans(newTable);
168
167
  if (fixedTable === null) {
169
- return setMeta({ type: 'DELETE_COLUMNS', problem: 'FIX_ROWSPANS' })(tr);
168
+ return tr;
170
169
  }
171
170
 
172
171
  const cursorPos = getNextCursorPos(newTable, columnsToDelete);
173
172
 
174
- return setMeta({ type: 'DELETE_COLUMNS' })(
173
+ return (
175
174
  tr
176
175
  .replaceWith(table.pos, table.pos + table.node.nodeSize, fixedTable)
177
176
  // move cursor to the left of the deleted columns if possible, otherwise - to the first column
178
- .setSelection(Selection.near(tr.doc.resolve(table.pos + cursorPos))),
177
+ .setSelection(Selection.near(tr.doc.resolve(table.pos + cursorPos)))
179
178
  );
180
179
  };
181
180
 
@@ -6,7 +6,6 @@ import { findTable } from '@atlaskit/editor-tables/utils';
6
6
  import { CellAttributes } from '@atlaskit/adf-schema';
7
7
 
8
8
  import { mergeEmptyColumns } from './merge';
9
- import { setMeta } from './metadata';
10
9
 
11
10
  export const deleteRows =
12
11
  (rect: Rect, isHeaderRowRequired: boolean = false) =>
@@ -117,7 +116,7 @@ export const deleteRows =
117
116
  }
118
117
 
119
118
  if (!rows.length) {
120
- return setMeta({ type: 'DELETE_ROWS', problem: 'EMPTY_TABLE' })(tr);
119
+ return tr;
121
120
  }
122
121
 
123
122
  const newTable = table.node.type.createChecked(
@@ -127,17 +126,15 @@ export const deleteRows =
127
126
  );
128
127
  const fixedTable = mergeEmptyColumns(newTable);
129
128
  if (fixedTable === null) {
130
- return setMeta({ type: 'DELETE_ROWS', problem: 'REMOVE_EMPTY_COLUMNS' })(
131
- tr,
132
- );
129
+ return tr;
133
130
  }
134
131
  const cursorPos = getNextCursorPos(newTable, rowsToDelete);
135
132
 
136
- return setMeta({ type: 'DELETE_ROWS' })(
133
+ return (
137
134
  tr
138
135
  .replaceWith(table.pos, table.pos + table.node.nodeSize, fixedTable)
139
136
  // move cursor before the deleted rows if possible, otherwise - to the first row
140
- .setSelection(Selection.near(tr.doc.resolve(table.pos + cursorPos))),
137
+ .setSelection(Selection.near(tr.doc.resolve(table.pos + cursorPos)))
141
138
  );
142
139
  };
143
140
 
@@ -9,8 +9,6 @@ import {
9
9
  akEditorWideLayoutWidth,
10
10
  } from '@atlaskit/editor-shared-styles';
11
11
 
12
- import { sendLogs } from '@atlaskit/editor-common/utils';
13
-
14
12
  import {
15
13
  calculateColumnWidth,
16
14
  contentWidth,
@@ -19,20 +17,6 @@ import {
19
17
  } from '../pm-plugins/table-resizing/utils';
20
18
  import { ReportInvalidNodeAttrs } from '../types';
21
19
 
22
- export const fireAnalytics = (properties = {}) =>
23
- sendLogs({
24
- events: [
25
- {
26
- name: 'atlaskit.fabric.editor.fixtable',
27
- product: 'atlaskit',
28
- properties,
29
- serverTime: new Date().getTime(),
30
- server: 'local',
31
- user: '-',
32
- },
33
- ],
34
- });
35
-
36
20
  const validateTableCellNodeAttrs = (
37
21
  {
38
22
  colspan,
@@ -104,7 +88,6 @@ export const removeExtraneousColumnWidths = (
104
88
  });
105
89
 
106
90
  if (hasProblems) {
107
- fireAnalytics({ message: 'removeExtraneousColumnWidths' });
108
91
  return true;
109
92
  }
110
93
 
@@ -1,7 +1,6 @@
1
- export { fireAnalytics, fixTables, fixAutoSizedTable } from './fix-tables';
1
+ export { fixTables, fixAutoSizedTable } from './fix-tables';
2
2
  export { mergeCells, canMergeCells, mergeEmptyColumns } from './merge';
3
3
  export { deleteColumns } from './delete-columns';
4
4
  export { deleteRows } from './delete-rows';
5
5
  export { updateColumnWidths } from './column-width';
6
- export { setMeta } from './metadata';
7
6
  export { replaceSelectedTable } from './replace-table';
@@ -6,8 +6,6 @@ import { findTable, getSelectionRect } from '@atlaskit/editor-tables/utils';
6
6
 
7
7
  import { CellAttributes } from '@atlaskit/adf-schema';
8
8
 
9
- import { setMeta } from './metadata';
10
-
11
9
  // re-creates table node with merged cells
12
10
  export function mergeCells(tr: Transaction): Transaction {
13
11
  const { selection } = tr;
@@ -55,9 +53,7 @@ export function mergeCells(tr: Transaction): Transaction {
55
53
  }
56
54
  const rowspan = rect.bottom - rect.top;
57
55
  if (rowspan < 1) {
58
- return setMeta({ type: 'MERGE_CELLS', problem: 'NEGATIVE_ROWSPAN' })(
59
- tr,
60
- );
56
+ return tr;
61
57
  }
62
58
  // update colspan and rowspan of the merged cell to span the selection
63
59
  const attrs = addColSpan(
@@ -95,10 +91,7 @@ export function mergeCells(tr: Transaction): Transaction {
95
91
  if (rowspan && rowspan + i - 1 >= rows.length) {
96
92
  rowChanged = true;
97
93
  if (rowspan < 2) {
98
- return setMeta({
99
- type: 'MERGE_CELLS',
100
- problem: 'NEGATIVE_ROWSPAN',
101
- })(tr);
94
+ return tr;
102
95
  }
103
96
  cells.push(
104
97
  cell.type.createChecked(
@@ -123,7 +116,7 @@ export function mergeCells(tr: Transaction): Transaction {
123
116
 
124
117
  // empty tables? cancel merging like nothing happened
125
118
  if (!rows.length) {
126
- return setMeta({ type: 'MERGE_CELLS', problem: 'EMPTY_TABLE' })(tr);
119
+ return tr;
127
120
  }
128
121
 
129
122
  const newTable = table.node.type.createChecked(
@@ -134,18 +127,14 @@ export function mergeCells(tr: Transaction): Transaction {
134
127
 
135
128
  const fixedTable = mergeEmptyColumns(newTable);
136
129
  if (fixedTable === null) {
137
- return setMeta({ type: 'MERGE_CELLS', problem: 'REMOVE_EMPTY_COLUMNS' })(
138
- tr,
139
- );
130
+ return tr;
140
131
  }
141
132
 
142
- return setMeta({ type: 'MERGE_CELLS' })(
143
- tr
144
- .replaceWith(table.pos, table.pos + table.node.nodeSize, fixedTable)
145
- .setSelection(
146
- Selection.near(tr.doc.resolve((mergedCellPos || 0) + table.start)),
147
- ),
148
- );
133
+ return tr
134
+ .replaceWith(table.pos, table.pos + table.node.nodeSize, fixedTable)
135
+ .setSelection(
136
+ Selection.near(tr.doc.resolve((mergedCellPos || 0) + table.start)),
137
+ );
149
138
  }
150
139
 
151
140
  export function canMergeCells(tr: Transaction): boolean {
@@ -6,9 +6,9 @@
6
6
  "sideEffects": false,
7
7
  "types": "../dist/types/plugins/table/types.d.ts",
8
8
  "typesVersions": {
9
- ">=4.0 <4.5": {
9
+ ">=4.5 <4.9": {
10
10
  "*": [
11
- "../dist/types-ts4.0/plugins/table/types.d.ts"
11
+ "../dist/types-ts4.5/plugins/table/types.d.ts"
12
12
  ]
13
13
  }
14
14
  }
@@ -6,9 +6,9 @@
6
6
  "sideEffects": false,
7
7
  "types": "../../dist/types/plugins/table/ui/common-styles.d.ts",
8
8
  "typesVersions": {
9
- ">=4.0 <4.5": {
9
+ ">=4.5 <4.9": {
10
10
  "*": [
11
- "../../dist/types-ts4.0/plugins/table/ui/common-styles.d.ts"
11
+ "../../dist/types-ts4.5/plugins/table/ui/common-styles.d.ts"
12
12
  ]
13
13
  }
14
14
  }
@@ -6,9 +6,9 @@
6
6
  "sideEffects": false,
7
7
  "types": "../../dist/types/plugins/table/ui/consts.d.ts",
8
8
  "typesVersions": {
9
- ">=4.0 <4.5": {
9
+ ">=4.5 <4.9": {
10
10
  "*": [
11
- "../../dist/types-ts4.0/plugins/table/ui/consts.d.ts"
11
+ "../../dist/types-ts4.5/plugins/table/ui/consts.d.ts"
12
12
  ]
13
13
  }
14
14
  }
@@ -1,79 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.tableSafariDelayedDomSelectionSyncingWorkaroundKey = exports.createPlugin = void 0;
7
- var _prosemirrorState = require("prosemirror-state");
8
- var _safePlugin = require("@atlaskit/editor-common/safe-plugin");
9
- var tableSafariDelayedDomSelectionSyncingWorkaroundKey = new _prosemirrorState.PluginKey('tableSafariDelayedDomSelectionSyncingWorkaround');
10
- exports.tableSafariDelayedDomSelectionSyncingWorkaroundKey = tableSafariDelayedDomSelectionSyncingWorkaroundKey;
11
- var createPlugin = function createPlugin() {
12
- // From a review of the prosemirror-view source code,
13
- // the only places where a view relies on the presence
14
- // of view.mouseDown are;
15
- // - when checking it's presence in selectionToDOM
16
- // to delay drag selections
17
- // - to ensure it is cleaned up when the mouseup
18
- // event is not fired in a previous mousedown event
19
-
20
- // Because we are manually wiping the view.mouseDown,
21
- // we manage this custom cleanup ourselves
22
- var prevMouseDownDone = null;
23
- return new _safePlugin.SafePlugin({
24
- key: tableSafariDelayedDomSelectionSyncingWorkaroundKey,
25
- props: {
26
- handleDOMEvents: {
27
- mousedown: function mousedown(view) {
28
- // Workaround issue in safari where table selections
29
- // do not work correctly since prosemirror delayed
30
- // DOM selection syncing during pointer drag.
31
- //
32
- // https://github.com/ProseMirror/prosemirror-view/commit/885258b80551ac87b81601d3ed25f552aeb22293
33
-
34
- // NOTE: this workaround can be removed when next upgrading prosemirror as the issue will be fixed
35
- // https://github.com/ProseMirror/prosemirror-view/pull/116
36
-
37
- // This fix removes the selectionToDOM from the view
38
- // prior to selectionToDOM being called.
39
- // selectionToDOM checks if there is an "active"
40
- // mouseDown, and if so, it delays running logic
41
- // which causes the table selections issue.
42
-
43
- // The handleDOMEvents are called before ProseMirror
44
- // events fired on the editable DOM element.
45
- // This means the view.mouseView will not yet be
46
- // created when the mousedown event starts.
47
- // https://prosemirror.net/docs/ref/#view.EditorProps.handleDOMEvents
48
- //
49
- // Because selectionToDOM is only added to the script
50
- // tasks queue following the mousedown event, we can
51
- // prepend a task which will clear the mouseDown from
52
- // the view. We do this using a setTimout with no
53
- // interval.
54
-
55
- if (prevMouseDownDone) {
56
- // avoid memory leaks when the mouseup event is not fired
57
- // in a previous mousedown event
58
- prevMouseDownDone();
59
- }
60
- setTimeout(function () {
61
- // the ts-ignores here are required due to the
62
- // view.mouseDown being an internal which is
63
- // not part of the views type signature
64
-
65
- // @ts-ignore
66
- if (view.mouseDown) {
67
- // @ts-ignore
68
- prevMouseDownDone = view.mouseDown.done.bind(view.mouseDown);
69
- // @ts-ignore
70
- view.mouseDown = null;
71
- }
72
- });
73
- return false;
74
- }
75
- }
76
- }
77
- });
78
- };
79
- exports.createPlugin = createPlugin;
@@ -1,20 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.setMeta = void 0;
7
- var _pluginKey = require("../pm-plugins/plugin-key");
8
- var _fixTables = require("./fix-tables");
9
- // Set metadata on a ProseMirror transaction for debugging purposes in Synchrony
10
-
11
- var setMeta = function setMeta(meta) {
12
- return function (tr) {
13
- if ('problem' in meta) {
14
- // Send analytics event whenever we encounter with a problem
15
- (0, _fixTables.fireAnalytics)(meta);
16
- }
17
- return tr.setMeta(_pluginKey.pluginKey, meta);
18
- };
19
- };
20
- exports.setMeta = setMeta;