@atlaskit/editor-plugin-table 4.2.1 → 5.1.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 (264) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/dist/cjs/plugins/table/commands/selection.js +19 -22
  3. package/dist/cjs/plugins/table/index.js +45 -38
  4. package/dist/cjs/plugins/table/pm-plugins/drag-and-drop/actions.js +12 -0
  5. package/dist/cjs/plugins/table/pm-plugins/drag-and-drop/commands.js +27 -0
  6. package/dist/cjs/plugins/table/pm-plugins/drag-and-drop/consts.js +11 -0
  7. package/dist/cjs/plugins/table/pm-plugins/drag-and-drop/index.js +32 -0
  8. package/dist/cjs/plugins/table/pm-plugins/drag-and-drop/plugin-factory.js +13 -0
  9. package/dist/cjs/plugins/table/pm-plugins/drag-and-drop/plugin-key.js +8 -0
  10. package/dist/cjs/plugins/table/pm-plugins/drag-and-drop/plugin.js +28 -0
  11. package/dist/cjs/plugins/table/pm-plugins/drag-and-drop/reducer.js +28 -0
  12. package/dist/cjs/plugins/table/pm-plugins/drag-and-drop/types.js +5 -0
  13. package/dist/es2019/plugins/table/commands/selection.js +14 -20
  14. package/dist/es2019/plugins/table/index.js +10 -5
  15. package/dist/es2019/plugins/table/pm-plugins/drag-and-drop/actions.js +6 -0
  16. package/dist/es2019/plugins/table/pm-plugins/drag-and-drop/commands.js +14 -0
  17. package/dist/es2019/plugins/table/pm-plugins/drag-and-drop/consts.js +5 -0
  18. package/dist/es2019/plugins/table/pm-plugins/drag-and-drop/index.js +3 -0
  19. package/dist/es2019/plugins/table/pm-plugins/drag-and-drop/plugin-factory.js +8 -0
  20. package/dist/es2019/plugins/table/pm-plugins/drag-and-drop/plugin-key.js +2 -0
  21. package/dist/es2019/plugins/table/pm-plugins/drag-and-drop/plugin.js +22 -0
  22. package/dist/es2019/plugins/table/pm-plugins/drag-and-drop/reducer.js +20 -0
  23. package/dist/es2019/plugins/table/pm-plugins/drag-and-drop/types.js +1 -0
  24. package/dist/esm/plugins/table/commands/selection.js +19 -22
  25. package/dist/esm/plugins/table/index.js +45 -39
  26. package/dist/esm/plugins/table/pm-plugins/drag-and-drop/actions.js +6 -0
  27. package/dist/esm/plugins/table/pm-plugins/drag-and-drop/commands.js +22 -0
  28. package/dist/esm/plugins/table/pm-plugins/drag-and-drop/consts.js +5 -0
  29. package/dist/esm/plugins/table/pm-plugins/drag-and-drop/index.js +3 -0
  30. package/dist/esm/plugins/table/pm-plugins/drag-and-drop/plugin-factory.js +7 -0
  31. package/dist/esm/plugins/table/pm-plugins/drag-and-drop/plugin-key.js +2 -0
  32. package/dist/esm/plugins/table/pm-plugins/drag-and-drop/plugin.js +22 -0
  33. package/dist/esm/plugins/table/pm-plugins/drag-and-drop/reducer.js +21 -0
  34. package/dist/esm/plugins/table/pm-plugins/drag-and-drop/types.js +1 -0
  35. package/dist/types/plugins/table/commands/selection.d.ts +4 -4
  36. package/dist/types/plugins/table/index.d.ts +3 -10
  37. package/dist/types/plugins/table/pm-plugins/drag-and-drop/actions.d.ts +15 -0
  38. package/dist/types/plugins/table/pm-plugins/drag-and-drop/commands.d.ts +4 -0
  39. package/dist/types/plugins/table/pm-plugins/drag-and-drop/consts.d.ts +6 -0
  40. package/dist/types/plugins/table/pm-plugins/drag-and-drop/index.d.ts +4 -0
  41. package/dist/types/plugins/table/pm-plugins/drag-and-drop/plugin-factory.d.ts +2 -0
  42. package/dist/types/plugins/table/pm-plugins/drag-and-drop/plugin-key.d.ts +3 -0
  43. package/dist/types/plugins/table/pm-plugins/drag-and-drop/plugin.d.ts +3 -0
  44. package/dist/types/plugins/table/pm-plugins/drag-and-drop/reducer.d.ts +4 -0
  45. package/dist/types/plugins/table/pm-plugins/drag-and-drop/types.d.ts +5 -0
  46. package/dist/types/plugins/table/pm-plugins/table-selection-keymap.d.ts +4 -3
  47. package/dist/types-ts4.5/i18n/cs.d.ts +37 -0
  48. package/dist/types-ts4.5/i18n/da.d.ts +35 -0
  49. package/dist/types-ts4.5/i18n/de.d.ts +35 -0
  50. package/dist/types-ts4.5/i18n/en.d.ts +37 -0
  51. package/dist/types-ts4.5/i18n/en_GB.d.ts +37 -0
  52. package/dist/types-ts4.5/i18n/en_ZZ.d.ts +37 -0
  53. package/dist/types-ts4.5/i18n/es.d.ts +35 -0
  54. package/dist/types-ts4.5/i18n/fi.d.ts +35 -0
  55. package/dist/types-ts4.5/i18n/fr.d.ts +37 -0
  56. package/dist/types-ts4.5/i18n/hu.d.ts +37 -0
  57. package/dist/types-ts4.5/i18n/it.d.ts +37 -0
  58. package/dist/types-ts4.5/i18n/ja.d.ts +37 -0
  59. package/dist/types-ts4.5/i18n/ko.d.ts +35 -0
  60. package/dist/types-ts4.5/i18n/nb.d.ts +35 -0
  61. package/dist/types-ts4.5/i18n/nl.d.ts +37 -0
  62. package/dist/types-ts4.5/i18n/pl.d.ts +37 -0
  63. package/dist/types-ts4.5/i18n/pt_BR.d.ts +37 -0
  64. package/dist/types-ts4.5/i18n/ru.d.ts +37 -0
  65. package/dist/types-ts4.5/i18n/sv.d.ts +35 -0
  66. package/dist/types-ts4.5/i18n/th.d.ts +35 -0
  67. package/dist/types-ts4.5/i18n/tr.d.ts +37 -0
  68. package/dist/types-ts4.5/i18n/uk.d.ts +37 -0
  69. package/dist/types-ts4.5/i18n/vi.d.ts +35 -0
  70. package/dist/types-ts4.5/i18n/zh.d.ts +37 -0
  71. package/dist/types-ts4.5/i18n/zh_TW.d.ts +37 -0
  72. package/dist/types-ts4.5/index.d.ts +2 -0
  73. package/dist/types-ts4.5/plugins/table/commands/clear.d.ts +3 -0
  74. package/dist/types-ts4.5/plugins/table/commands/collapse.d.ts +2 -0
  75. package/dist/types-ts4.5/plugins/table/commands/delete.d.ts +3 -0
  76. package/dist/types-ts4.5/plugins/table/commands/go-to-next-cell.d.ts +4 -0
  77. package/dist/types-ts4.5/plugins/table/commands/hover.d.ts +8 -0
  78. package/dist/types-ts4.5/plugins/table/commands/index.d.ts +8 -0
  79. package/dist/types-ts4.5/plugins/table/commands/insert.d.ts +9 -0
  80. package/dist/types-ts4.5/plugins/table/commands/misc.d.ts +29 -0
  81. package/dist/types-ts4.5/plugins/table/commands/referentiality.d.ts +2 -0
  82. package/dist/types-ts4.5/plugins/table/commands/selection.d.ts +8 -0
  83. package/dist/types-ts4.5/plugins/table/commands/sort.d.ts +3 -0
  84. package/dist/types-ts4.5/plugins/table/commands/split-cell.d.ts +6 -0
  85. package/dist/types-ts4.5/plugins/table/commands/toggle.d.ts +12 -0
  86. package/dist/types-ts4.5/plugins/table/commands-with-analytics.d.ts +25 -0
  87. package/dist/types-ts4.5/plugins/table/create-plugin-config.d.ts +2 -0
  88. package/dist/types-ts4.5/plugins/table/event-handlers.d.ts +15 -0
  89. package/dist/types-ts4.5/plugins/table/handlers.d.ts +3 -0
  90. package/dist/types-ts4.5/plugins/table/index.d.ts +38 -0
  91. package/dist/types-ts4.5/plugins/table/nodeviews/OverflowShadowsObserver.d.ts +24 -0
  92. package/dist/types-ts4.5/plugins/table/nodeviews/TableComponent.d.ts +73 -0
  93. package/dist/types-ts4.5/plugins/table/nodeviews/TableContainer.d.ts +44 -0
  94. package/dist/types-ts4.5/plugins/table/nodeviews/TableResizer.d.ts +25 -0
  95. package/dist/types-ts4.5/plugins/table/nodeviews/TableStickyScrollbar.d.ts +24 -0
  96. package/dist/types-ts4.5/plugins/table/nodeviews/__mocks__/OverflowShadowsObserver.d.ts +9 -0
  97. package/dist/types-ts4.5/plugins/table/nodeviews/__mocks__/OverridableMock.d.ts +9 -0
  98. package/dist/types-ts4.5/plugins/table/nodeviews/table.d.ts +33 -0
  99. package/dist/types-ts4.5/plugins/table/nodeviews/tableCell.d.ts +17 -0
  100. package/dist/types-ts4.5/plugins/table/nodeviews/types.d.ts +26 -0
  101. package/dist/types-ts4.5/plugins/table/nodeviews/update-overflow-shadows.d.ts +1 -0
  102. package/dist/types-ts4.5/plugins/table/pm-plugins/decorations/plugin.d.ts +7 -0
  103. package/dist/types-ts4.5/plugins/table/pm-plugins/decorations/utils/column-controls.d.ts +3 -0
  104. package/dist/types-ts4.5/plugins/table/pm-plugins/decorations/utils/column-resizing.d.ts +4 -0
  105. package/dist/types-ts4.5/plugins/table/pm-plugins/decorations/utils/compose-decorations.d.ts +2 -0
  106. package/dist/types-ts4.5/plugins/table/pm-plugins/decorations/utils/index.d.ts +3 -0
  107. package/dist/types-ts4.5/plugins/table/pm-plugins/decorations/utils/types.d.ts +6 -0
  108. package/dist/types-ts4.5/plugins/table/pm-plugins/default-table-selection.d.ts +4 -0
  109. package/dist/types-ts4.5/plugins/table/pm-plugins/drag-and-drop/actions.d.ts +15 -0
  110. package/dist/types-ts4.5/plugins/table/pm-plugins/drag-and-drop/commands.d.ts +4 -0
  111. package/dist/types-ts4.5/plugins/table/pm-plugins/drag-and-drop/consts.d.ts +6 -0
  112. package/dist/types-ts4.5/plugins/table/pm-plugins/drag-and-drop/index.d.ts +4 -0
  113. package/dist/types-ts4.5/plugins/table/pm-plugins/drag-and-drop/plugin-factory.d.ts +2 -0
  114. package/dist/types-ts4.5/plugins/table/pm-plugins/drag-and-drop/plugin-key.d.ts +3 -0
  115. package/dist/types-ts4.5/plugins/table/pm-plugins/drag-and-drop/plugin.d.ts +3 -0
  116. package/dist/types-ts4.5/plugins/table/pm-plugins/drag-and-drop/reducer.d.ts +4 -0
  117. package/dist/types-ts4.5/plugins/table/pm-plugins/drag-and-drop/types.d.ts +5 -0
  118. package/dist/types-ts4.5/plugins/table/pm-plugins/keymap.d.ts +5 -0
  119. package/dist/types-ts4.5/plugins/table/pm-plugins/main.d.ts +8 -0
  120. package/dist/types-ts4.5/plugins/table/pm-plugins/plugin-factory.d.ts +1 -0
  121. package/dist/types-ts4.5/plugins/table/pm-plugins/plugin-key.d.ts +3 -0
  122. package/dist/types-ts4.5/plugins/table/pm-plugins/safari-delete-composition-text-issue-workaround.d.ts +15 -0
  123. package/dist/types-ts4.5/plugins/table/pm-plugins/sticky-headers/commands.d.ts +3 -0
  124. package/dist/types-ts4.5/plugins/table/pm-plugins/sticky-headers/index.d.ts +6 -0
  125. package/dist/types-ts4.5/plugins/table/pm-plugins/sticky-headers/nodeviews/dom.d.ts +6 -0
  126. package/dist/types-ts4.5/plugins/table/pm-plugins/sticky-headers/nodeviews/tableRow.d.ts +73 -0
  127. package/dist/types-ts4.5/plugins/table/pm-plugins/sticky-headers/plugin-key.d.ts +3 -0
  128. package/dist/types-ts4.5/plugins/table/pm-plugins/sticky-headers/plugin-state.d.ts +3 -0
  129. package/dist/types-ts4.5/plugins/table/pm-plugins/sticky-headers/plugin.d.ts +4 -0
  130. package/dist/types-ts4.5/plugins/table/pm-plugins/sticky-headers/types.d.ts +16 -0
  131. package/dist/types-ts4.5/plugins/table/pm-plugins/sticky-headers/util.d.ts +2 -0
  132. package/dist/types-ts4.5/plugins/table/pm-plugins/table-analytics.d.ts +23 -0
  133. package/dist/types-ts4.5/plugins/table/pm-plugins/table-local-id.d.ts +10 -0
  134. package/dist/types-ts4.5/plugins/table/pm-plugins/table-resizing/commands.d.ts +23 -0
  135. package/dist/types-ts4.5/plugins/table/pm-plugins/table-resizing/event-handlers.d.ts +4 -0
  136. package/dist/types-ts4.5/plugins/table/pm-plugins/table-resizing/index.d.ts +3 -0
  137. package/dist/types-ts4.5/plugins/table/pm-plugins/table-resizing/plugin-factory.d.ts +4 -0
  138. package/dist/types-ts4.5/plugins/table/pm-plugins/table-resizing/plugin-key.d.ts +3 -0
  139. package/dist/types-ts4.5/plugins/table/pm-plugins/table-resizing/plugin.d.ts +6 -0
  140. package/dist/types-ts4.5/plugins/table/pm-plugins/table-resizing/reducer.d.ts +3 -0
  141. package/dist/types-ts4.5/plugins/table/pm-plugins/table-resizing/utils/colgroup.d.ts +23 -0
  142. package/dist/types-ts4.5/plugins/table/pm-plugins/table-resizing/utils/column-state.d.ts +14 -0
  143. package/dist/types-ts4.5/plugins/table/pm-plugins/table-resizing/utils/consts.d.ts +2 -0
  144. package/dist/types-ts4.5/plugins/table/pm-plugins/table-resizing/utils/content-width.d.ts +4 -0
  145. package/dist/types-ts4.5/plugins/table/pm-plugins/table-resizing/utils/dom.d.ts +12 -0
  146. package/dist/types-ts4.5/plugins/table/pm-plugins/table-resizing/utils/index.d.ts +13 -0
  147. package/dist/types-ts4.5/plugins/table/pm-plugins/table-resizing/utils/misc.d.ts +20 -0
  148. package/dist/types-ts4.5/plugins/table/pm-plugins/table-resizing/utils/resize-column.d.ts +2 -0
  149. package/dist/types-ts4.5/plugins/table/pm-plugins/table-resizing/utils/resize-logic.d.ts +4 -0
  150. package/dist/types-ts4.5/plugins/table/pm-plugins/table-resizing/utils/resize-state.d.ts +29 -0
  151. package/dist/types-ts4.5/plugins/table/pm-plugins/table-resizing/utils/scale-table.d.ts +21 -0
  152. package/dist/types-ts4.5/plugins/table/pm-plugins/table-resizing/utils/types.d.ts +22 -0
  153. package/dist/types-ts4.5/plugins/table/pm-plugins/table-resizing/utils/unit-to-number.d.ts +1 -0
  154. package/dist/types-ts4.5/plugins/table/pm-plugins/table-selection-keymap.d.ts +5 -0
  155. package/dist/types-ts4.5/plugins/table/pm-plugins/table-width.d.ts +17 -0
  156. package/dist/types-ts4.5/plugins/table/reducer.d.ts +3 -0
  157. package/dist/types-ts4.5/plugins/table/toolbar.d.ts +36 -0
  158. package/dist/types-ts4.5/plugins/table/transforms/column-width.d.ts +37 -0
  159. package/dist/types-ts4.5/plugins/table/transforms/delete-columns.d.ts +4 -0
  160. package/dist/types-ts4.5/plugins/table/transforms/delete-rows.d.ts +3 -0
  161. package/dist/types-ts4.5/plugins/table/transforms/fix-tables.d.ts +9 -0
  162. package/dist/types-ts4.5/plugins/table/transforms/index.d.ts +6 -0
  163. package/dist/types-ts4.5/plugins/table/transforms/merge.d.ts +5 -0
  164. package/dist/types-ts4.5/plugins/table/transforms/replace-table.d.ts +5 -0
  165. package/dist/types-ts4.5/plugins/table/transforms/split.d.ts +9 -0
  166. package/dist/types-ts4.5/plugins/table/types.d.ts +342 -0
  167. package/dist/types-ts4.5/plugins/table/ui/ColumnResizeWidget/index.d.ts +9 -0
  168. package/dist/types-ts4.5/plugins/table/ui/FloatingContextualButton/FixedButton.d.ts +23 -0
  169. package/dist/types-ts4.5/plugins/table/ui/FloatingContextualButton/index.d.ts +21 -0
  170. package/dist/types-ts4.5/plugins/table/ui/FloatingContextualButton/styles.d.ts +3 -0
  171. package/dist/types-ts4.5/plugins/table/ui/FloatingContextualMenu/ContextualMenu.d.ts +87 -0
  172. package/dist/types-ts4.5/plugins/table/ui/FloatingContextualMenu/index.d.ts +23 -0
  173. package/dist/types-ts4.5/plugins/table/ui/FloatingContextualMenu/styles.d.ts +2 -0
  174. package/dist/types-ts4.5/plugins/table/ui/FloatingDeleteButton/DeleteButton.d.ts +13 -0
  175. package/dist/types-ts4.5/plugins/table/ui/FloatingDeleteButton/getPopUpOptions.d.ts +10 -0
  176. package/dist/types-ts4.5/plugins/table/ui/FloatingDeleteButton/index.d.ts +54 -0
  177. package/dist/types-ts4.5/plugins/table/ui/FloatingDeleteButton/types.d.ts +1 -0
  178. package/dist/types-ts4.5/plugins/table/ui/FloatingInsertButton/InsertButton.d.ts +13 -0
  179. package/dist/types-ts4.5/plugins/table/ui/FloatingInsertButton/getPopupOptions.d.ts +3 -0
  180. package/dist/types-ts4.5/plugins/table/ui/FloatingInsertButton/index.d.ts +35 -0
  181. package/dist/types-ts4.5/plugins/table/ui/LayoutButton/index.d.ts +21 -0
  182. package/dist/types-ts4.5/plugins/table/ui/TableFloatingControls/CornerControls/index.d.ts +16 -0
  183. package/dist/types-ts4.5/plugins/table/ui/TableFloatingControls/NumberColumn/index.d.ts +21 -0
  184. package/dist/types-ts4.5/plugins/table/ui/TableFloatingControls/RowControls/index.d.ts +17 -0
  185. package/dist/types-ts4.5/plugins/table/ui/TableFloatingControls/index.d.ts +39 -0
  186. package/dist/types-ts4.5/plugins/table/ui/common-styles.d.ts +9 -0
  187. package/dist/types-ts4.5/plugins/table/ui/consts.d.ts +50 -0
  188. package/dist/types-ts4.5/plugins/table/ui/messages.d.ts +63 -0
  189. package/dist/types-ts4.5/plugins/table/ui/ui-styles.d.ts +15 -0
  190. package/dist/types-ts4.5/plugins/table/utils/analytics.d.ts +45 -0
  191. package/dist/types-ts4.5/plugins/table/utils/collapse.d.ts +29 -0
  192. package/dist/types-ts4.5/plugins/table/utils/column-controls.d.ts +10 -0
  193. package/dist/types-ts4.5/plugins/table/utils/decoration.d.ts +19 -0
  194. package/dist/types-ts4.5/plugins/table/utils/dom.d.ts +20 -0
  195. package/dist/types-ts4.5/plugins/table/utils/get-allow-add-column-custom-step.d.ts +2 -0
  196. package/dist/types-ts4.5/plugins/table/utils/guidelines.d.ts +2 -0
  197. package/dist/types-ts4.5/plugins/table/utils/index.d.ts +11 -0
  198. package/dist/types-ts4.5/plugins/table/utils/nodes.d.ts +13 -0
  199. package/dist/types-ts4.5/plugins/table/utils/paste.d.ts +14 -0
  200. package/dist/types-ts4.5/plugins/table/utils/row-controls.d.ts +16 -0
  201. package/dist/types-ts4.5/plugins/table/utils/selection.d.ts +6 -0
  202. package/dist/types-ts4.5/plugins/table/utils/snapping.d.ts +10 -0
  203. package/dist/types-ts4.5/plugins/table/utils/table.d.ts +4 -0
  204. package/dist/types-ts4.5/plugins/table/utils/update-plugin-state-decorations.d.ts +4 -0
  205. package/dist/types-ts4.5/plugins/table-plugin.d.ts +2 -0
  206. package/dist/types-ts4.5/types/i18n.d.ts +5 -0
  207. package/package.json +4 -3
  208. package/report.api.md +2 -17
  209. package/src/__tests__/unit/analytics.ts +1 -1
  210. package/src/__tests__/unit/collab.ts +1 -1
  211. package/src/__tests__/unit/commands/go-to-next-cell.ts +1 -1
  212. package/src/__tests__/unit/commands/insert.ts +1 -1
  213. package/src/__tests__/unit/commands/misc.ts +1 -1
  214. package/src/__tests__/unit/commands/sort.ts +1 -1
  215. package/src/__tests__/unit/commands.ts +1 -1
  216. package/src/__tests__/unit/copy-paste.ts +1 -1
  217. package/src/__tests__/unit/event-handlers/index.ts +1 -1
  218. package/src/__tests__/unit/event-handlers.ts +1 -1
  219. package/src/__tests__/unit/fix-tables.ts +1 -1
  220. package/src/__tests__/unit/get-toolbar-config.ts +1 -1
  221. package/src/__tests__/unit/handlers.ts +1 -2
  222. package/src/__tests__/unit/hover-selection.ts +1 -2
  223. package/src/__tests__/unit/index.ts +1 -2
  224. package/src/__tests__/unit/layout.ts +1 -2
  225. package/src/__tests__/unit/nodeviews/cell.ts +1 -1
  226. package/src/__tests__/unit/nodeviews/table.ts +1 -1
  227. package/src/__tests__/unit/pm-plugins/decorations/column-resizing.ts +1 -1
  228. package/src/__tests__/unit/pm-plugins/decorations/plugin.ts +1 -1
  229. package/src/__tests__/unit/pm-plugins/main.ts +1 -1
  230. package/src/__tests__/unit/pm-plugins/safari-delete-composition-text-issue-workaround.ts +1 -1
  231. package/src/__tests__/unit/pm-plugins/sticky-headers/tableRow.tsx +1 -1
  232. package/src/__tests__/unit/pm-plugins/table-resizing/event-handlers.ts +1 -1
  233. package/src/__tests__/unit/pm-plugins/table-width.ts +1 -1
  234. package/src/__tests__/unit/sort-column.ts +1 -1
  235. package/src/__tests__/unit/toolbar.ts +1 -1
  236. package/src/__tests__/unit/transforms/delete-columns.ts +1 -1
  237. package/src/__tests__/unit/transforms/delete-rows.ts +1 -1
  238. package/src/__tests__/unit/transforms/merging.ts +1 -1
  239. package/src/__tests__/unit/ui/ContextualMenu.tsx +1 -1
  240. package/src/__tests__/unit/ui/CornerControls.tsx +1 -1
  241. package/src/__tests__/unit/ui/FloatingContextualButton.tsx +1 -1
  242. package/src/__tests__/unit/ui/FloatingContextualMenu.tsx +1 -1
  243. package/src/__tests__/unit/ui/RowControls.tsx +1 -1
  244. package/src/__tests__/unit/ui/TableFloatingControls.tsx +1 -1
  245. package/src/__tests__/unit/undo-redo.ts +1 -1
  246. package/src/__tests__/unit/utils/collapse.ts +1 -1
  247. package/src/__tests__/unit/utils/nodes.ts +1 -1
  248. package/src/__tests__/unit/utils/row-controls.ts +1 -1
  249. package/src/__tests__/unit/utils.ts +1 -1
  250. package/src/plugins/table/commands/selection.ts +101 -33
  251. package/src/plugins/table/index.tsx +15 -17
  252. package/src/plugins/table/pm-plugins/drag-and-drop/actions.ts +29 -0
  253. package/src/plugins/table/pm-plugins/drag-and-drop/commands.ts +32 -0
  254. package/src/plugins/table/pm-plugins/drag-and-drop/consts.ts +8 -0
  255. package/src/plugins/table/pm-plugins/drag-and-drop/index.ts +5 -0
  256. package/src/plugins/table/pm-plugins/drag-and-drop/plugin-factory.ts +8 -0
  257. package/src/plugins/table/pm-plugins/drag-and-drop/plugin-key.ts +7 -0
  258. package/src/plugins/table/pm-plugins/drag-and-drop/plugin.ts +32 -0
  259. package/src/plugins/table/pm-plugins/drag-and-drop/reducer.ts +26 -0
  260. package/src/plugins/table/pm-plugins/drag-and-drop/types.ts +6 -0
  261. package/src/plugins/table/pm-plugins/table-selection-keymap.ts +6 -3
  262. package/tmp/api-report-tmp.d.ts +100 -0
  263. package/tsconfig.app.json +3 -0
  264. package/tsconfig.dev.json +3 -0
@@ -0,0 +1,3 @@
1
+ export { createPlugin } from './plugin';
2
+ export { pluginKey } from './plugin-key';
3
+ export { setDropTarget, clearDropTarget } from './commands';
@@ -0,0 +1,8 @@
1
+ import { pluginFactory } from '@atlaskit/editor-common/utils';
2
+ import { pluginKey } from './plugin-key';
3
+ import reducer from './reducer';
4
+ const {
5
+ createPluginState,
6
+ createCommand
7
+ } = pluginFactory(pluginKey, reducer);
8
+ export { createPluginState, createCommand };
@@ -0,0 +1,2 @@
1
+ import { PluginKey } from '@atlaskit/editor-prosemirror/state';
2
+ export const pluginKey = new PluginKey('dragAndDropPlugin');
@@ -0,0 +1,22 @@
1
+ import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
2
+ import { DropTargetType } from './consts';
3
+ import { createPluginState } from './plugin-factory';
4
+ import { pluginKey } from './plugin-key';
5
+ export const createPlugin = (dispatch, eventDispatcher) => {
6
+ return new SafePlugin({
7
+ state: createPluginState(dispatch, {
8
+ // TODO: This is example placeholder state. We could use this to track which row/col is currently set as the drop target
9
+ // This would result in a blue highlight being displayed on the corrisponding row/column to single the drop target location.
10
+ dropTargetType: DropTargetType.NONE,
11
+ dropTargetIndex: 0
12
+ }),
13
+ key: pluginKey,
14
+ view: editorView => {
15
+ // TODO: Add Pragmatic DnD monitor when the view is constructed.
16
+ return {
17
+ // TODO: Cleanup monitor instance
18
+ // destroy: cleanup,
19
+ };
20
+ }
21
+ });
22
+ };
@@ -0,0 +1,20 @@
1
+ import { DragAndDropActionType } from './actions';
2
+ import { DropTargetType } from './consts';
3
+ export default ((pluginState, action) => {
4
+ switch (action.type) {
5
+ case DragAndDropActionType.SET_DROP_TARGET:
6
+ return {
7
+ ...pluginState,
8
+ dropTargetType: action.data.type,
9
+ dropTargetIndex: action.data.index
10
+ };
11
+ case DragAndDropActionType.CLEAR_DROP_TARGET:
12
+ return {
13
+ ...pluginState,
14
+ dropTargetType: DropTargetType.NONE,
15
+ dropTargetIndex: 0
16
+ };
17
+ default:
18
+ return pluginState;
19
+ }
20
+ });
@@ -42,15 +42,14 @@ var arrowLeftFromCellSelection = function arrowLeftFromCellSelection(editorSelec
42
42
  return function (selection) {
43
43
  return function (state, dispatch) {
44
44
  if (isTableSelected(state.selection) && editorSelectionAPI) {
45
- var _editorSelectionAPI$g = editorSelectionAPI.getSelectionPluginState(state),
46
- selectionRelativeToNode = _editorSelectionAPI$g.selectionRelativeToNode;
47
- if (selectionRelativeToNode === RelativeSelectionPos.Start) {
45
+ var selectionState = editorSelectionAPI.sharedState.currentState() || {};
46
+ if ((selectionState === null || selectionState === void 0 ? void 0 : selectionState.selectionRelativeToNode) === RelativeSelectionPos.Start) {
48
47
  // we have full table cell selection and want to set gap cursor selection before table
49
48
  return setGapCursorBeforeTable(editorSelectionAPI)()(state, dispatch);
50
- } else if (selectionRelativeToNode === RelativeSelectionPos.End) {
49
+ } else if ((selectionState === null || selectionState === void 0 ? void 0 : selectionState.selectionRelativeToNode) === RelativeSelectionPos.End) {
51
50
  // we have full table cell selection and want to set selection at end of last cell
52
51
  return setSelectionAtEndOfLastCell(editorSelectionAPI)(selection)(state, dispatch);
53
- } else if (selectionRelativeToNode === undefined) {
52
+ } else if ((selectionState === null || selectionState === void 0 ? void 0 : selectionState.selectionRelativeToNode) === undefined) {
54
53
  // we have full table cell selection and want to set selection at start of first cell
55
54
  return setSelectionAtStartOfFirstCell(editorSelectionAPI)(selection, RelativeSelectionPos.Before)(state, dispatch);
56
55
  }
@@ -63,8 +62,8 @@ var arrowRightFromCellSelection = function arrowRightFromCellSelection(editorSel
63
62
  return function (selection) {
64
63
  return function (state, dispatch) {
65
64
  if (isTableSelected(state.selection) && editorSelectionAPI) {
66
- var _editorSelectionAPI$g2 = editorSelectionAPI.getSelectionPluginState(state),
67
- selectionRelativeToNode = _editorSelectionAPI$g2.selectionRelativeToNode;
65
+ var _ref = editorSelectionAPI.sharedState.currentState() || {},
66
+ selectionRelativeToNode = _ref.selectionRelativeToNode;
68
67
  if (selectionRelativeToNode === RelativeSelectionPos.Start) {
69
68
  // we have full table cell selection and want to set selection at start of first cell
70
69
  return setSelectionAtStartOfFirstCell(editorSelectionAPI)(selection)(state, dispatch);
@@ -96,9 +95,8 @@ var arrowLeftFromGapCursor = function arrowLeftFromGapCursor(editorSelectionAPI)
96
95
  } else if (side === Side.LEFT) {
97
96
  var table = findTable(selection);
98
97
  if (table && isSelectionAtStartOfTable($from, selection) && editorSelectionAPI) {
99
- var _editorSelectionAPI$g3 = editorSelectionAPI.getSelectionPluginState(state),
100
- selectionRelativeToNode = _editorSelectionAPI$g3.selectionRelativeToNode;
101
- if (selectionRelativeToNode === RelativeSelectionPos.Before) {
98
+ var selectionState = editorSelectionAPI.sharedState.currentState() || {};
99
+ if ((selectionState === null || selectionState === void 0 ? void 0 : selectionState.selectionRelativeToNode) === RelativeSelectionPos.Before) {
102
100
  // we have a gap cursor at start of first table cell and want to set a gap cursor selection before table
103
101
  return setGapCursorBeforeTable(editorSelectionAPI)()(state, dispatch);
104
102
  } else {
@@ -155,9 +153,8 @@ var arrowLeftFromText = function arrowLeftFromText(editorSelectionAPI) {
155
153
  if (isSelectionAtStartOfTable($from, selection) && $from.parent.type.name === 'paragraph' && $from.depth === table.depth + 3 &&
156
154
  // + 3 for: row, cell & paragraph nodes
157
155
  editorSelectionAPI) {
158
- var _editorSelectionAPI$g4 = editorSelectionAPI.getSelectionPluginState(state),
159
- selectionRelativeToNode = _editorSelectionAPI$g4.selectionRelativeToNode;
160
- if (selectionRelativeToNode === RelativeSelectionPos.Before) {
156
+ var selectionState = editorSelectionAPI.sharedState.currentState() || {};
157
+ if ((selectionState === null || selectionState === void 0 ? void 0 : selectionState.selectionRelativeToNode) === RelativeSelectionPos.Before) {
161
158
  // we have a text selection at start of first table cell, directly inside a top level paragraph,
162
159
  // and want to set gap cursor selection before table
163
160
  return setGapCursorBeforeTable(editorSelectionAPI)()(state, dispatch);
@@ -205,10 +202,10 @@ var arrowRightFromText = function arrowRightFromText(editorSelectionAPI) {
205
202
  * pos in the selection plugin
206
203
  */
207
204
  var selectFullTable = function selectFullTable(editorSelectionAPI) {
208
- return function (_ref) {
209
- var node = _ref.node,
210
- startPos = _ref.startPos,
211
- dir = _ref.dir;
205
+ return function (_ref2) {
206
+ var node = _ref2.node,
207
+ startPos = _ref2.startPos,
208
+ dir = _ref2.dir;
212
209
  return function (state, dispatch) {
213
210
  var doc = state.doc;
214
211
  var _TableMap$get = TableMap.get(node),
@@ -225,7 +222,7 @@ var selectFullTable = function selectFullTable(editorSelectionAPI) {
225
222
  selectionRelativeToNode = RelativeSelectionPos.Start;
226
223
  }
227
224
  if (editorSelectionAPI) {
228
- var tr = editorSelectionAPI.setSelectionRelativeToNode({
225
+ var tr = editorSelectionAPI.actions.selectNearNode({
229
226
  selectionRelativeToNode: selectionRelativeToNode,
230
227
  selection: fullTableSelection
231
228
  })(state);
@@ -249,7 +246,7 @@ var setSelectionAtStartOfFirstCell = function setSelectionAtStartOfFirstCell(edi
249
246
  // check if first pos should have a gap cursor, otherwise find closest text selection
250
247
  var selectionAtStartOfCell = GapCursorSelection.valid($firstPosInsideCell) ? new GapCursorSelection($firstPosInsideCell, Side.LEFT) : Selection.findFrom($firstPosInsideCell, 1);
251
248
  if (editorSelectionAPI) {
252
- var tr = editorSelectionAPI.setSelectionRelativeToNode({
249
+ var tr = editorSelectionAPI.actions.selectNearNode({
253
250
  selectionRelativeToNode: selectionRelativeToNode,
254
251
  selection: selectionAtStartOfCell
255
252
  })(state);
@@ -274,7 +271,7 @@ var setSelectionAtEndOfLastCell = function setSelectionAtEndOfLastCell(editorSel
274
271
  // check if last pos should have a gap cursor, otherwise find closest text selection
275
272
  var selectionAtEndOfCell = GapCursorSelection.valid($lastPosInsideCell) ? new GapCursorSelection($lastPosInsideCell, Side.RIGHT) : Selection.findFrom($lastPosInsideCell, -1);
276
273
  if (editorSelectionAPI) {
277
- var tr = editorSelectionAPI.setSelectionRelativeToNode({
274
+ var tr = editorSelectionAPI.actions.selectNearNode({
278
275
  selectionRelativeToNode: selectionRelativeToNode,
279
276
  selection: selectionAtEndOfCell
280
277
  })(state);
@@ -296,7 +293,7 @@ var setGapCursorBeforeTable = function setGapCursorBeforeTable(editorSelectionAP
296
293
  if (GapCursorSelection.valid($beforeTablePos)) {
297
294
  var selectionBeforeTable = new GapCursorSelection($beforeTablePos, Side.LEFT);
298
295
  if (editorSelectionAPI) {
299
- var tr = editorSelectionAPI.setSelectionRelativeToNode({
296
+ var tr = editorSelectionAPI.actions.selectNearNode({
300
297
  selectionRelativeToNode: undefined,
301
298
  selection: selectionBeforeTable
302
299
  })(state);
@@ -320,7 +317,7 @@ var setGapCursorAfterTable = function setGapCursorAfterTable(editorSelectionAPI)
320
317
  if (GapCursorSelection.valid($afterTablePos)) {
321
318
  var selectionAfterTable = new GapCursorSelection($afterTablePos, Side.RIGHT);
322
319
  if (editorSelectionAPI) {
323
- var tr = editorSelectionAPI.setSelectionRelativeToNode({
320
+ var tr = editorSelectionAPI.actions.selectNearNode({
324
321
  selectionRelativeToNode: undefined,
325
322
  selection: selectionAfterTable
326
323
  })(state);
@@ -13,6 +13,7 @@ import { createTable } from '@atlaskit/editor-tables/utils';
13
13
  import { getBooleanFF } from '@atlaskit/platform-feature-flags';
14
14
  import { pluginConfig } from './create-plugin-config';
15
15
  import { createPlugin as createDecorationsPlugin } from './pm-plugins/decorations/plugin';
16
+ import { createPlugin as createDragAndDropPlugin, pluginKey as dragAndDropPluginKey } from './pm-plugins/drag-and-drop';
16
17
  import { keymapPlugin } from './pm-plugins/keymap';
17
18
  import { createPlugin } from './pm-plugins/main';
18
19
  import { pluginKey } from './pm-plugins/plugin-key';
@@ -30,9 +31,6 @@ import FloatingDeleteButton from './ui/FloatingDeleteButton';
30
31
  import FloatingInsertButton from './ui/FloatingInsertButton';
31
32
  import LayoutButton from './ui/LayoutButton';
32
33
  import { isLayoutSupported } from './utils';
33
-
34
- // TODO: duplicated SelectionPlugin type as it's still in editor-core, doing this avoid
35
- // circular dependencies
36
34
  var defaultGetEditorFeatureFlags = function defaultGetEditorFeatureFlags() {
37
35
  return {};
38
36
  };
@@ -140,7 +138,7 @@ var tablesPlugin = function tablesPlugin(_ref) {
140
138
  }, {
141
139
  name: 'tableSelectionKeymap',
142
140
  plugin: function plugin() {
143
- return tableSelectionKeymapPlugin(options === null || options === void 0 ? void 0 : options.editorSelectionAPI);
141
+ return tableSelectionKeymapPlugin(api === null || api === void 0 ? void 0 : api.selection);
144
142
  }
145
143
  }, {
146
144
  name: 'tableEditing',
@@ -171,25 +169,32 @@ var tablesPlugin = function tablesPlugin(_ref) {
171
169
  }, (options === null || options === void 0 ? void 0 : options.getEditorFeatureFlags) || defaultGetEditorFeatureFlags) : undefined;
172
170
  }
173
171
  }, {
174
- name: 'tableLocalId',
172
+ name: 'tableDragAndDrop',
175
173
  plugin: function plugin(_ref8) {
176
- var dispatch = _ref8.dispatch;
174
+ var dispatch = _ref8.dispatch,
175
+ eventDispatcher = _ref8.eventDispatcher;
176
+ return options !== null && options !== void 0 && options.dragAndDropEnabled ? createDragAndDropPlugin(dispatch, eventDispatcher) : undefined;
177
+ }
178
+ }, {
179
+ name: 'tableLocalId',
180
+ plugin: function plugin(_ref9) {
181
+ var dispatch = _ref9.dispatch;
177
182
  return createTableLocalIdPlugin(dispatch);
178
183
  }
179
184
  }, {
180
185
  name: 'tableWidth',
181
- plugin: function plugin(_ref9) {
186
+ plugin: function plugin(_ref10) {
182
187
  var _options$fullWidthEna;
183
- var dispatchAnalyticsEvent = _ref9.dispatchAnalyticsEvent,
184
- dispatch = _ref9.dispatch;
188
+ var dispatchAnalyticsEvent = _ref10.dispatchAnalyticsEvent,
189
+ dispatch = _ref10.dispatch;
185
190
  return options !== null && options !== void 0 && options.tableResizingEnabled ? createTableWidthPlugin(dispatch, dispatchAnalyticsEvent, (_options$fullWidthEna = options === null || options === void 0 ? void 0 : options.fullWidthEnabled) !== null && _options$fullWidthEna !== void 0 ? _options$fullWidthEna : false) : undefined;
186
191
  }
187
192
  }, {
188
193
  name: 'tableAnalyticsPlugin',
189
- plugin: function plugin(_ref10) {
194
+ plugin: function plugin(_ref11) {
190
195
  var _options$tableResizin;
191
- var dispatch = _ref10.dispatch,
192
- dispatchAnalyticsEvent = _ref10.dispatchAnalyticsEvent;
196
+ var dispatch = _ref11.dispatch,
197
+ dispatchAnalyticsEvent = _ref11.dispatchAnalyticsEvent;
193
198
  return getBooleanFF('platform.editor.table.overflow-state-analytics') ? createTableAnalyticsPlugin(dispatch, dispatchAnalyticsEvent, (_options$tableResizin = options === null || options === void 0 ? void 0 : options.tableResizingEnabled) !== null && _options$tableResizin !== void 0 ? _options$tableResizin : false) : undefined;
194
199
  }
195
200
  }, {
@@ -220,12 +225,12 @@ var tablesPlugin = function tablesPlugin(_ref) {
220
225
  }
221
226
  return plugins;
222
227
  },
223
- contentComponent: function contentComponent(_ref11) {
224
- var editorView = _ref11.editorView,
225
- popupsMountPoint = _ref11.popupsMountPoint,
226
- popupsBoundariesElement = _ref11.popupsBoundariesElement,
227
- popupsScrollableElement = _ref11.popupsScrollableElement,
228
- dispatchAnalyticsEvent = _ref11.dispatchAnalyticsEvent;
228
+ contentComponent: function contentComponent(_ref12) {
229
+ var editorView = _ref12.editorView,
230
+ popupsMountPoint = _ref12.popupsMountPoint,
231
+ popupsBoundariesElement = _ref12.popupsBoundariesElement,
232
+ popupsScrollableElement = _ref12.popupsScrollableElement,
233
+ dispatchAnalyticsEvent = _ref12.dispatchAnalyticsEvent;
229
234
  return /*#__PURE__*/React.createElement(ErrorBoundary, {
230
235
  component: ACTION_SUBJECT.TABLES_PLUGIN,
231
236
  dispatchAnalyticsEvent: dispatchAnalyticsEvent,
@@ -236,30 +241,31 @@ var tablesPlugin = function tablesPlugin(_ref) {
236
241
  tablePluginState: pluginKey,
237
242
  tableWidthPluginState: tableWidthPluginKey,
238
243
  tableResizingPluginState: tableResizingPluginKey,
239
- stickyHeadersState: stickyHeadersPluginKey
244
+ stickyHeadersState: stickyHeadersPluginKey,
245
+ dragAndDropState: dragAndDropPluginKey
240
246
  },
241
- render: function render(_ref12) {
242
- var resizingPluginState = _ref12.tableResizingPluginState,
243
- stickyHeadersState = _ref12.stickyHeadersState,
244
- tablePluginState = _ref12.tablePluginState,
245
- tableWidthPluginState = _ref12.tableWidthPluginState;
247
+ render: function render(_ref13) {
248
+ var resizingPluginState = _ref13.tableResizingPluginState,
249
+ stickyHeadersState = _ref13.stickyHeadersState,
250
+ tablePluginState = _ref13.tablePluginState,
251
+ tableWidthPluginState = _ref13.tableWidthPluginState;
246
252
  var state = editorView.state;
247
253
  var isColumnResizing = resizingPluginState === null || resizingPluginState === void 0 ? void 0 : resizingPluginState.dragging;
248
254
  var isTableResizing = tableWidthPluginState === null || tableWidthPluginState === void 0 ? void 0 : tableWidthPluginState.resizing;
249
255
  var isResizing = isColumnResizing || isTableResizing;
250
- var _ref13 = tablePluginState,
251
- tableNode = _ref13.tableNode,
252
- tablePos = _ref13.tablePos,
253
- targetCellPosition = _ref13.targetCellPosition,
254
- isContextualMenuOpen = _ref13.isContextualMenuOpen,
255
- layout = _ref13.layout,
256
- tableRef = _ref13.tableRef,
257
- pluginConfig = _ref13.pluginConfig,
258
- insertColumnButtonIndex = _ref13.insertColumnButtonIndex,
259
- insertRowButtonIndex = _ref13.insertRowButtonIndex,
260
- isHeaderColumnEnabled = _ref13.isHeaderColumnEnabled,
261
- isHeaderRowEnabled = _ref13.isHeaderRowEnabled,
262
- tableWrapperTarget = _ref13.tableWrapperTarget;
256
+ var _ref14 = tablePluginState,
257
+ tableNode = _ref14.tableNode,
258
+ tablePos = _ref14.tablePos,
259
+ targetCellPosition = _ref14.targetCellPosition,
260
+ isContextualMenuOpen = _ref14.isContextualMenuOpen,
261
+ layout = _ref14.layout,
262
+ tableRef = _ref14.tableRef,
263
+ pluginConfig = _ref14.pluginConfig,
264
+ insertColumnButtonIndex = _ref14.insertColumnButtonIndex,
265
+ insertRowButtonIndex = _ref14.insertRowButtonIndex,
266
+ isHeaderColumnEnabled = _ref14.isHeaderColumnEnabled,
267
+ isHeaderRowEnabled = _ref14.isHeaderRowEnabled,
268
+ tableWrapperTarget = _ref14.tableWrapperTarget;
263
269
  var allowControls = pluginConfig.allowControls;
264
270
  var stickyHeader = stickyHeadersState ? findStickyHeaderForTable(stickyHeadersState, tablePos) : undefined;
265
271
  var LayoutContent = options && !options.tableResizingEnabled && isLayoutSupported(state) && options.breakoutEnabled ? /*#__PURE__*/React.createElement(LayoutButton, {
@@ -325,8 +331,8 @@ var tablesPlugin = function tablesPlugin(_ref) {
325
331
  }));
326
332
  },
327
333
  pluginsOptions: {
328
- quickInsert: function quickInsert(_ref14) {
329
- var formatMessage = _ref14.formatMessage;
334
+ quickInsert: function quickInsert(_ref15) {
335
+ var formatMessage = _ref15.formatMessage;
330
336
  return [{
331
337
  id: 'table',
332
338
  title: formatMessage(messages.table),
@@ -0,0 +1,6 @@
1
+ export var DragAndDropActionType = {
2
+ SET_DROP_TARGET: 'SET_DROP_TARGET',
3
+ CLEAR_DROP_TARGET: 'CLEAR_DROP_TARGET'
4
+ };
5
+
6
+ // NOTE: This should be a Union of all possible actions
@@ -0,0 +1,22 @@
1
+ import { DragAndDropActionType } from './actions';
2
+ import { createCommand } from './plugin-factory';
3
+
4
+ // TODO: This command is a placeholder example. Please replace this if required.
5
+ export var setDropTarget = function setDropTarget(type, index, tr) {
6
+ return createCommand({
7
+ type: DragAndDropActionType.SET_DROP_TARGET,
8
+ data: {
9
+ type: type,
10
+ index: index
11
+ }
12
+ }, function (originalTr) {
13
+ return (tr || originalTr).setMeta('addToHistory', false);
14
+ });
15
+ };
16
+ export var clearDropTarget = function clearDropTarget(tr) {
17
+ return createCommand({
18
+ type: DragAndDropActionType.CLEAR_DROP_TARGET
19
+ }, function (originalTr) {
20
+ return (tr || originalTr).setMeta('addToHistory', false);
21
+ });
22
+ };
@@ -0,0 +1,5 @@
1
+ export var DropTargetType = {
2
+ NONE: 'none',
3
+ ROW: 'row',
4
+ COLUMN: 'column'
5
+ };
@@ -0,0 +1,3 @@
1
+ export { createPlugin } from './plugin';
2
+ export { pluginKey } from './plugin-key';
3
+ export { setDropTarget, clearDropTarget } from './commands';
@@ -0,0 +1,7 @@
1
+ import { pluginFactory } from '@atlaskit/editor-common/utils';
2
+ import { pluginKey } from './plugin-key';
3
+ import reducer from './reducer';
4
+ var _pluginFactory = pluginFactory(pluginKey, reducer),
5
+ createPluginState = _pluginFactory.createPluginState,
6
+ createCommand = _pluginFactory.createCommand;
7
+ export { createPluginState, createCommand };
@@ -0,0 +1,2 @@
1
+ import { PluginKey } from '@atlaskit/editor-prosemirror/state';
2
+ export var pluginKey = new PluginKey('dragAndDropPlugin');
@@ -0,0 +1,22 @@
1
+ import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
2
+ import { DropTargetType } from './consts';
3
+ import { createPluginState } from './plugin-factory';
4
+ import { pluginKey } from './plugin-key';
5
+ export var createPlugin = function createPlugin(dispatch, eventDispatcher) {
6
+ return new SafePlugin({
7
+ state: createPluginState(dispatch, {
8
+ // TODO: This is example placeholder state. We could use this to track which row/col is currently set as the drop target
9
+ // This would result in a blue highlight being displayed on the corrisponding row/column to single the drop target location.
10
+ dropTargetType: DropTargetType.NONE,
11
+ dropTargetIndex: 0
12
+ }),
13
+ key: pluginKey,
14
+ view: function view(editorView) {
15
+ // TODO: Add Pragmatic DnD monitor when the view is constructed.
16
+ return {
17
+ // TODO: Cleanup monitor instance
18
+ // destroy: cleanup,
19
+ };
20
+ }
21
+ });
22
+ };
@@ -0,0 +1,21 @@
1
+ import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
3
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
4
+ import { DragAndDropActionType } from './actions';
5
+ import { DropTargetType } from './consts';
6
+ export default (function (pluginState, action) {
7
+ switch (action.type) {
8
+ case DragAndDropActionType.SET_DROP_TARGET:
9
+ return _objectSpread(_objectSpread({}, pluginState), {}, {
10
+ dropTargetType: action.data.type,
11
+ dropTargetIndex: action.data.index
12
+ });
13
+ case DragAndDropActionType.CLEAR_DROP_TARGET:
14
+ return _objectSpread(_objectSpread({}, pluginState), {}, {
15
+ dropTargetType: DropTargetType.NONE,
16
+ dropTargetIndex: 0
17
+ });
18
+ default:
19
+ return pluginState;
20
+ }
21
+ });
@@ -1,8 +1,8 @@
1
- import { EditorSelectionAPI } from '@atlaskit/editor-common/selection';
2
- import type { Command } from '@atlaskit/editor-common/types';
1
+ import type { Command, ExtractInjectionAPI } from '@atlaskit/editor-common/types';
2
+ import type tablePlugin from '../index';
3
3
  export declare enum TableSelectionDirection {
4
4
  TopToBottom = "TopToBottom",
5
5
  BottomToTop = "BottomToTop"
6
6
  }
7
- export declare const arrowLeftFromTable: (editorSelectionAPI: EditorSelectionAPI | undefined | null) => () => Command;
8
- export declare const arrowRightFromTable: (editorSelectionAPI: EditorSelectionAPI | undefined | null) => () => Command;
7
+ export declare const arrowLeftFromTable: (editorSelectionAPI: ExtractInjectionAPI<typeof tablePlugin>['selection'] | undefined) => () => Command;
8
+ export declare const arrowRightFromTable: (editorSelectionAPI: ExtractInjectionAPI<typeof tablePlugin>['selection'] | undefined) => () => Command;
@@ -1,9 +1,9 @@
1
1
  import type { AnalyticsEventPayload } from '@atlaskit/editor-common/analytics';
2
- import type { EditorSelectionAPI } from '@atlaskit/editor-common/selection';
3
- import type { Command, EditorCommand, GetEditorFeatureFlags, NextEditorPlugin, OptionalPlugin } from '@atlaskit/editor-common/types';
2
+ import type { Command, GetEditorFeatureFlags, NextEditorPlugin } from '@atlaskit/editor-common/types';
4
3
  import type { AnalyticsPlugin } from '@atlaskit/editor-plugin-analytics';
5
4
  import type { ContentInsertionPlugin } from '@atlaskit/editor-plugin-content-insertion';
6
5
  import type { GuidelinePlugin } from '@atlaskit/editor-plugin-guideline';
6
+ import type { SelectionPlugin } from '@atlaskit/editor-plugin-selection';
7
7
  import type { WidthPlugin } from '@atlaskit/editor-plugin-width';
8
8
  import type { PluginConfig } from './types';
9
9
  interface TablePluginOptions {
@@ -14,16 +14,9 @@ interface TablePluginOptions {
14
14
  allowContextualMenu?: boolean;
15
15
  fullWidthEnabled?: boolean;
16
16
  wasFullWidthEnabled?: boolean;
17
- editorSelectionAPI?: EditorSelectionAPI;
18
17
  getEditorFeatureFlags?: GetEditorFeatureFlags;
19
18
  }
20
19
  type InsertTableAction = (analyticsPayload: AnalyticsEventPayload) => Command;
21
- type SelectionPlugin = NextEditorPlugin<'selection', {
22
- pluginConfiguration: unknown;
23
- commands: {
24
- displayGapCursor: (toggle: boolean) => EditorCommand;
25
- };
26
- }>;
27
20
  export type TablePlugin = NextEditorPlugin<'table', {
28
21
  pluginConfiguration: TablePluginOptions | undefined;
29
22
  actions: {
@@ -34,7 +27,7 @@ export type TablePlugin = NextEditorPlugin<'table', {
34
27
  ContentInsertionPlugin,
35
28
  WidthPlugin,
36
29
  GuidelinePlugin,
37
- OptionalPlugin<SelectionPlugin>
30
+ SelectionPlugin
38
31
  ];
39
32
  }>;
40
33
  /**
@@ -0,0 +1,15 @@
1
+ import type { DropTargetType } from './consts';
2
+ export interface DragAndDropAction<T, D> {
3
+ type: T;
4
+ data: D;
5
+ }
6
+ export declare const DragAndDropActionType: {
7
+ readonly SET_DROP_TARGET: "SET_DROP_TARGET";
8
+ readonly CLEAR_DROP_TARGET: "CLEAR_DROP_TARGET";
9
+ };
10
+ export type DragAndDropSetDropTargetAction = DragAndDropAction<typeof DragAndDropActionType.SET_DROP_TARGET, {
11
+ type: DropTargetType;
12
+ index: number;
13
+ }>;
14
+ export type DragAndDropClearDropTargetAction = DragAndDropAction<typeof DragAndDropActionType.CLEAR_DROP_TARGET, undefined>;
15
+ export type DragAndDropPluginAction = DragAndDropSetDropTargetAction | DragAndDropClearDropTargetAction;
@@ -0,0 +1,4 @@
1
+ import type { Transaction } from '@atlaskit/editor-prosemirror/state';
2
+ import type { DropTargetType } from './consts';
3
+ export declare const setDropTarget: (type: DropTargetType, index: number, tr?: Transaction) => import("@atlaskit/editor-common/types").Command;
4
+ export declare const clearDropTarget: (tr?: Transaction) => import("@atlaskit/editor-common/types").Command;
@@ -0,0 +1,6 @@
1
+ export declare const DropTargetType: {
2
+ readonly NONE: "none";
3
+ readonly ROW: "row";
4
+ readonly COLUMN: "column";
5
+ };
6
+ export type DropTargetType = (typeof DropTargetType)[keyof typeof DropTargetType];
@@ -0,0 +1,4 @@
1
+ export { createPlugin } from './plugin';
2
+ export { pluginKey } from './plugin-key';
3
+ export type { DragAndDropPluginState } from './types';
4
+ export { setDropTarget, clearDropTarget } from './commands';
@@ -0,0 +1,2 @@
1
+ declare const createPluginState: (dispatch: import("@atlaskit/editor-common/event-dispatcher").Dispatch<any>, initialState: import("./types").DragAndDropPluginState | ((state: import("prosemirror-state").EditorState) => import("./types").DragAndDropPluginState)) => import("prosemirror-state").SafeStateField<import("./types").DragAndDropPluginState>, createCommand: <A = import("./actions").DragAndDropPluginAction>(action: A | ((state: Readonly<import("prosemirror-state").EditorState>) => false | A), transform?: ((tr: import("prosemirror-state").Transaction, state: import("prosemirror-state").EditorState) => import("prosemirror-state").Transaction) | undefined) => import("@atlaskit/editor-common/types").Command;
2
+ export { createPluginState, createCommand };
@@ -0,0 +1,3 @@
1
+ import { PluginKey } from '@atlaskit/editor-prosemirror/state';
2
+ import type { DragAndDropPluginState } from './types';
3
+ export declare const pluginKey: PluginKey<DragAndDropPluginState>;
@@ -0,0 +1,3 @@
1
+ import type { Dispatch, EventDispatcher } from '@atlaskit/editor-common/event-dispatcher';
2
+ import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
3
+ export declare const createPlugin: (dispatch: Dispatch, eventDispatcher: EventDispatcher) => SafePlugin<import("./types").DragAndDropPluginState>;
@@ -0,0 +1,4 @@
1
+ import type { DragAndDropPluginAction } from './actions';
2
+ import type { DragAndDropPluginState } from './types';
3
+ declare const _default: (pluginState: DragAndDropPluginState, action: DragAndDropPluginAction) => DragAndDropPluginState;
4
+ export default _default;
@@ -0,0 +1,5 @@
1
+ import type { DropTargetType } from './consts';
2
+ export interface DragAndDropPluginState {
3
+ dropTargetType: DropTargetType;
4
+ dropTargetIndex: number;
5
+ }
@@ -1,4 +1,5 @@
1
- import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
2
- import type { EditorSelectionAPI } from '@atlaskit/editor-common/selection';
3
- export declare function tableSelectionKeymapPlugin(editorSelectionAPI: EditorSelectionAPI | undefined | null): SafePlugin;
1
+ import type { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
2
+ import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
3
+ import type tablePlugin from '../index';
4
+ export declare function tableSelectionKeymapPlugin(editorSelectionAPI: ExtractInjectionAPI<typeof tablePlugin>['selection'] | undefined): SafePlugin;
4
5
  export default tableSelectionKeymapPlugin;
@@ -0,0 +1,37 @@
1
+ /**
2
+ * NOTE:
3
+ *
4
+ * This file is automatically generated by Traduki 2.0.
5
+ * DO NOT CHANGE IT BY HAND or your changes will be lost.
6
+ */
7
+ declare const _default: {
8
+ 'fabric.editor.canNotSortTable': string;
9
+ 'fabric.editor.cellBackground': string;
10
+ 'fabric.editor.cellOptions': string;
11
+ 'fabric.editor.clearCells': string;
12
+ 'fabric.editor.collapseTable': string;
13
+ 'fabric.editor.cornerControl': string;
14
+ 'fabric.editor.distributeColumns': string;
15
+ 'fabric.editor.extension.confirmDeleteLinkedModalMessagePrefix': string;
16
+ 'fabric.editor.extension.deleteElementTitle': string;
17
+ 'fabric.editor.extension.sourceNoTitledName': string;
18
+ 'fabric.editor.floatingToolbar.confirmModalCheckboxLabel': string;
19
+ 'fabric.editor.headerColumn': string;
20
+ 'fabric.editor.headerRow': string;
21
+ 'fabric.editor.insertColumn': string;
22
+ 'fabric.editor.insertRow': string;
23
+ 'fabric.editor.mergeCells': string;
24
+ 'fabric.editor.numberedColumn': string;
25
+ 'fabric.editor.removeColumns': string;
26
+ 'fabric.editor.removeRows': string;
27
+ 'fabric.editor.rowControl': string;
28
+ 'fabric.editor.sortColumnASC': string;
29
+ 'fabric.editor.sortColumnDESC': string;
30
+ 'fabric.editor.splitCell': string;
31
+ 'fabric.editor.tableOptions': string;
32
+ 'fabric.editor.tables.adjustColumn': string;
33
+ 'fabric.editor.tables.confirmDeleteLinkedModalMessage': string;
34
+ 'fabric.editor.tables.confirmDeleteLinkedModalOKButton': string;
35
+ 'fabric.editor.tables.resizeTable': string;
36
+ };
37
+ export default _default;