@atlaskit/editor-plugin-table 5.0.0 → 5.2.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 (271) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/dist/cjs/plugins/table/index.js +47 -37
  3. package/dist/cjs/plugins/table/nodeviews/TableCell.js +111 -0
  4. package/dist/cjs/plugins/table/nodeviews/TableNodeViewBase.js +30 -0
  5. package/dist/cjs/plugins/table/{pm-plugins/sticky-headers/nodeviews/tableRow.js → nodeviews/TableRow.js} +313 -307
  6. package/dist/cjs/plugins/table/pm-plugins/drag-and-drop/actions.js +12 -0
  7. package/dist/cjs/plugins/table/pm-plugins/drag-and-drop/commands.js +27 -0
  8. package/dist/cjs/plugins/table/pm-plugins/drag-and-drop/consts.js +11 -0
  9. package/dist/cjs/plugins/table/pm-plugins/drag-and-drop/index.js +32 -0
  10. package/dist/cjs/plugins/table/pm-plugins/drag-and-drop/plugin-factory.js +13 -0
  11. package/dist/cjs/plugins/table/pm-plugins/drag-and-drop/plugin-key.js +8 -0
  12. package/dist/cjs/plugins/table/pm-plugins/drag-and-drop/plugin.js +28 -0
  13. package/dist/cjs/plugins/table/pm-plugins/drag-and-drop/reducer.js +28 -0
  14. package/dist/cjs/plugins/table/pm-plugins/drag-and-drop/types.js +5 -0
  15. package/dist/cjs/plugins/table/pm-plugins/main.js +16 -13
  16. package/dist/cjs/plugins/table/pm-plugins/sticky-headers/index.js +1 -8
  17. package/dist/cjs/plugins/table/pm-plugins/sticky-headers/plugin.js +1 -9
  18. package/dist/cjs/plugins/table/utils/dom.js +31 -1
  19. package/dist/cjs/plugins/table/utils/index.js +12 -0
  20. package/dist/cjs/plugins/table/utils/nodes.js +31 -7
  21. package/dist/es2019/plugins/table/index.js +12 -3
  22. package/dist/es2019/plugins/table/nodeviews/{tableCell.js → TableCell.js} +28 -24
  23. package/dist/es2019/plugins/table/nodeviews/TableNodeViewBase.js +22 -0
  24. package/dist/es2019/plugins/table/{pm-plugins/sticky-headers/nodeviews/tableRow.js → nodeviews/TableRow.js} +273 -284
  25. package/dist/es2019/plugins/table/pm-plugins/drag-and-drop/actions.js +6 -0
  26. package/dist/es2019/plugins/table/pm-plugins/drag-and-drop/commands.js +14 -0
  27. package/dist/es2019/plugins/table/pm-plugins/drag-and-drop/consts.js +5 -0
  28. package/dist/es2019/plugins/table/pm-plugins/drag-and-drop/index.js +3 -0
  29. package/dist/es2019/plugins/table/pm-plugins/drag-and-drop/plugin-factory.js +8 -0
  30. package/dist/es2019/plugins/table/pm-plugins/drag-and-drop/plugin-key.js +2 -0
  31. package/dist/es2019/plugins/table/pm-plugins/drag-and-drop/plugin.js +22 -0
  32. package/dist/es2019/plugins/table/pm-plugins/drag-and-drop/reducer.js +20 -0
  33. package/dist/es2019/plugins/table/pm-plugins/drag-and-drop/types.js +1 -0
  34. package/dist/es2019/plugins/table/pm-plugins/main.js +8 -8
  35. package/dist/es2019/plugins/table/pm-plugins/sticky-headers/index.js +1 -2
  36. package/dist/es2019/plugins/table/pm-plugins/sticky-headers/plugin.js +1 -9
  37. package/dist/es2019/plugins/table/utils/dom.js +30 -0
  38. package/dist/es2019/plugins/table/utils/index.js +1 -1
  39. package/dist/es2019/plugins/table/utils/nodes.js +16 -0
  40. package/dist/esm/plugins/table/index.js +47 -37
  41. package/dist/esm/plugins/table/nodeviews/TableCell.js +105 -0
  42. package/dist/esm/plugins/table/nodeviews/TableNodeViewBase.js +24 -0
  43. package/dist/esm/plugins/table/{pm-plugins/sticky-headers/nodeviews/tableRow.js → nodeviews/TableRow.js} +314 -307
  44. package/dist/esm/plugins/table/pm-plugins/drag-and-drop/actions.js +6 -0
  45. package/dist/esm/plugins/table/pm-plugins/drag-and-drop/commands.js +22 -0
  46. package/dist/esm/plugins/table/pm-plugins/drag-and-drop/consts.js +5 -0
  47. package/dist/esm/plugins/table/pm-plugins/drag-and-drop/index.js +3 -0
  48. package/dist/esm/plugins/table/pm-plugins/drag-and-drop/plugin-factory.js +7 -0
  49. package/dist/esm/plugins/table/pm-plugins/drag-and-drop/plugin-key.js +2 -0
  50. package/dist/esm/plugins/table/pm-plugins/drag-and-drop/plugin.js +22 -0
  51. package/dist/esm/plugins/table/pm-plugins/drag-and-drop/reducer.js +21 -0
  52. package/dist/esm/plugins/table/pm-plugins/drag-and-drop/types.js +1 -0
  53. package/dist/esm/plugins/table/pm-plugins/main.js +16 -13
  54. package/dist/esm/plugins/table/pm-plugins/sticky-headers/index.js +1 -2
  55. package/dist/esm/plugins/table/pm-plugins/sticky-headers/plugin.js +1 -9
  56. package/dist/esm/plugins/table/utils/dom.js +30 -0
  57. package/dist/esm/plugins/table/utils/index.js +1 -1
  58. package/dist/esm/plugins/table/utils/nodes.js +24 -0
  59. package/dist/types/plugins/table/nodeviews/TableCell.d.ts +13 -0
  60. package/dist/types/plugins/table/nodeviews/TableNodeViewBase.d.ts +18 -0
  61. package/dist/types/plugins/table/nodeviews/TableRow.d.ts +60 -0
  62. package/dist/types/plugins/table/pm-plugins/drag-and-drop/actions.d.ts +15 -0
  63. package/dist/types/plugins/table/pm-plugins/drag-and-drop/commands.d.ts +4 -0
  64. package/dist/types/plugins/table/pm-plugins/drag-and-drop/consts.d.ts +6 -0
  65. package/dist/types/plugins/table/pm-plugins/drag-and-drop/index.d.ts +4 -0
  66. package/dist/types/plugins/table/pm-plugins/drag-and-drop/plugin-factory.d.ts +2 -0
  67. package/dist/types/plugins/table/pm-plugins/drag-and-drop/plugin-key.d.ts +3 -0
  68. package/dist/types/plugins/table/pm-plugins/drag-and-drop/plugin.d.ts +3 -0
  69. package/dist/types/plugins/table/pm-plugins/drag-and-drop/reducer.d.ts +4 -0
  70. package/dist/types/plugins/table/pm-plugins/drag-and-drop/types.d.ts +5 -0
  71. package/dist/types/plugins/table/pm-plugins/main.d.ts +1 -1
  72. package/dist/types/plugins/table/pm-plugins/sticky-headers/index.d.ts +0 -1
  73. package/dist/types/plugins/table/pm-plugins/sticky-headers/plugin.d.ts +1 -1
  74. package/dist/types/plugins/table/types.d.ts +1 -0
  75. package/dist/types/plugins/table/utils/dom.d.ts +6 -0
  76. package/dist/types/plugins/table/utils/index.d.ts +1 -1
  77. package/dist/types/plugins/table/utils/nodes.d.ts +12 -2
  78. package/dist/types-ts4.5/i18n/cs.d.ts +37 -0
  79. package/dist/types-ts4.5/i18n/da.d.ts +35 -0
  80. package/dist/types-ts4.5/i18n/de.d.ts +35 -0
  81. package/dist/types-ts4.5/i18n/en.d.ts +37 -0
  82. package/dist/types-ts4.5/i18n/en_GB.d.ts +37 -0
  83. package/dist/types-ts4.5/i18n/en_ZZ.d.ts +37 -0
  84. package/dist/types-ts4.5/i18n/es.d.ts +35 -0
  85. package/dist/types-ts4.5/i18n/fi.d.ts +35 -0
  86. package/dist/types-ts4.5/i18n/fr.d.ts +37 -0
  87. package/dist/types-ts4.5/i18n/hu.d.ts +37 -0
  88. package/dist/types-ts4.5/i18n/it.d.ts +37 -0
  89. package/dist/types-ts4.5/i18n/ja.d.ts +37 -0
  90. package/dist/types-ts4.5/i18n/ko.d.ts +35 -0
  91. package/dist/types-ts4.5/i18n/nb.d.ts +35 -0
  92. package/dist/types-ts4.5/i18n/nl.d.ts +37 -0
  93. package/dist/types-ts4.5/i18n/pl.d.ts +37 -0
  94. package/dist/types-ts4.5/i18n/pt_BR.d.ts +37 -0
  95. package/dist/types-ts4.5/i18n/ru.d.ts +37 -0
  96. package/dist/types-ts4.5/i18n/sv.d.ts +35 -0
  97. package/dist/types-ts4.5/i18n/th.d.ts +35 -0
  98. package/dist/types-ts4.5/i18n/tr.d.ts +37 -0
  99. package/dist/types-ts4.5/i18n/uk.d.ts +37 -0
  100. package/dist/types-ts4.5/i18n/vi.d.ts +35 -0
  101. package/dist/types-ts4.5/i18n/zh.d.ts +37 -0
  102. package/dist/types-ts4.5/i18n/zh_TW.d.ts +37 -0
  103. package/dist/types-ts4.5/index.d.ts +2 -0
  104. package/dist/types-ts4.5/plugins/table/commands/clear.d.ts +3 -0
  105. package/dist/types-ts4.5/plugins/table/commands/collapse.d.ts +2 -0
  106. package/dist/types-ts4.5/plugins/table/commands/delete.d.ts +3 -0
  107. package/dist/types-ts4.5/plugins/table/commands/go-to-next-cell.d.ts +4 -0
  108. package/dist/types-ts4.5/plugins/table/commands/hover.d.ts +8 -0
  109. package/dist/types-ts4.5/plugins/table/commands/index.d.ts +8 -0
  110. package/dist/types-ts4.5/plugins/table/commands/insert.d.ts +9 -0
  111. package/dist/types-ts4.5/plugins/table/commands/misc.d.ts +29 -0
  112. package/dist/types-ts4.5/plugins/table/commands/referentiality.d.ts +2 -0
  113. package/dist/types-ts4.5/plugins/table/commands/selection.d.ts +8 -0
  114. package/dist/types-ts4.5/plugins/table/commands/sort.d.ts +3 -0
  115. package/dist/types-ts4.5/plugins/table/commands/split-cell.d.ts +6 -0
  116. package/dist/types-ts4.5/plugins/table/commands/toggle.d.ts +12 -0
  117. package/dist/types-ts4.5/plugins/table/commands-with-analytics.d.ts +25 -0
  118. package/dist/types-ts4.5/plugins/table/create-plugin-config.d.ts +2 -0
  119. package/dist/types-ts4.5/plugins/table/event-handlers.d.ts +15 -0
  120. package/dist/types-ts4.5/plugins/table/handlers.d.ts +3 -0
  121. package/dist/types-ts4.5/plugins/table/index.d.ts +38 -0
  122. package/dist/types-ts4.5/plugins/table/nodeviews/OverflowShadowsObserver.d.ts +24 -0
  123. package/dist/types-ts4.5/plugins/table/nodeviews/TableCell.d.ts +13 -0
  124. package/dist/types-ts4.5/plugins/table/nodeviews/TableComponent.d.ts +73 -0
  125. package/dist/types-ts4.5/plugins/table/nodeviews/TableContainer.d.ts +44 -0
  126. package/dist/types-ts4.5/plugins/table/nodeviews/TableNodeViewBase.d.ts +18 -0
  127. package/dist/types-ts4.5/plugins/table/nodeviews/TableResizer.d.ts +25 -0
  128. package/dist/types-ts4.5/plugins/table/nodeviews/TableRow.d.ts +60 -0
  129. package/dist/types-ts4.5/plugins/table/nodeviews/TableStickyScrollbar.d.ts +24 -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 +33 -0
  133. package/dist/types-ts4.5/plugins/table/nodeviews/types.d.ts +26 -0
  134. package/dist/types-ts4.5/plugins/table/nodeviews/update-overflow-shadows.d.ts +1 -0
  135. package/dist/types-ts4.5/plugins/table/pm-plugins/decorations/plugin.d.ts +7 -0
  136. package/dist/types-ts4.5/plugins/table/pm-plugins/decorations/utils/column-controls.d.ts +3 -0
  137. package/dist/types-ts4.5/plugins/table/pm-plugins/decorations/utils/column-resizing.d.ts +4 -0
  138. package/dist/types-ts4.5/plugins/table/pm-plugins/decorations/utils/compose-decorations.d.ts +2 -0
  139. package/dist/types-ts4.5/plugins/table/pm-plugins/decorations/utils/index.d.ts +3 -0
  140. package/dist/types-ts4.5/plugins/table/pm-plugins/decorations/utils/types.d.ts +6 -0
  141. package/dist/types-ts4.5/plugins/table/pm-plugins/default-table-selection.d.ts +4 -0
  142. package/dist/types-ts4.5/plugins/table/pm-plugins/drag-and-drop/actions.d.ts +15 -0
  143. package/dist/types-ts4.5/plugins/table/pm-plugins/drag-and-drop/commands.d.ts +4 -0
  144. package/dist/types-ts4.5/plugins/table/pm-plugins/drag-and-drop/consts.d.ts +6 -0
  145. package/dist/types-ts4.5/plugins/table/pm-plugins/drag-and-drop/index.d.ts +4 -0
  146. package/dist/types-ts4.5/plugins/table/pm-plugins/drag-and-drop/plugin-factory.d.ts +2 -0
  147. package/dist/types-ts4.5/plugins/table/pm-plugins/drag-and-drop/plugin-key.d.ts +3 -0
  148. package/dist/types-ts4.5/plugins/table/pm-plugins/drag-and-drop/plugin.d.ts +3 -0
  149. package/dist/types-ts4.5/plugins/table/pm-plugins/drag-and-drop/reducer.d.ts +4 -0
  150. package/dist/types-ts4.5/plugins/table/pm-plugins/drag-and-drop/types.d.ts +5 -0
  151. package/dist/types-ts4.5/plugins/table/pm-plugins/keymap.d.ts +5 -0
  152. package/dist/types-ts4.5/plugins/table/pm-plugins/main.d.ts +8 -0
  153. package/dist/types-ts4.5/plugins/table/pm-plugins/plugin-factory.d.ts +1 -0
  154. package/dist/types-ts4.5/plugins/table/pm-plugins/plugin-key.d.ts +3 -0
  155. package/dist/types-ts4.5/plugins/table/pm-plugins/safari-delete-composition-text-issue-workaround.d.ts +15 -0
  156. package/dist/types-ts4.5/plugins/table/pm-plugins/sticky-headers/commands.d.ts +3 -0
  157. package/dist/types-ts4.5/plugins/table/pm-plugins/sticky-headers/index.d.ts +5 -0
  158. package/dist/types-ts4.5/plugins/table/pm-plugins/sticky-headers/plugin-key.d.ts +3 -0
  159. package/dist/types-ts4.5/plugins/table/pm-plugins/sticky-headers/plugin-state.d.ts +3 -0
  160. package/dist/types-ts4.5/plugins/table/pm-plugins/sticky-headers/plugin.d.ts +4 -0
  161. package/dist/types-ts4.5/plugins/table/pm-plugins/sticky-headers/types.d.ts +16 -0
  162. package/dist/types-ts4.5/plugins/table/pm-plugins/sticky-headers/util.d.ts +2 -0
  163. package/dist/types-ts4.5/plugins/table/pm-plugins/table-analytics.d.ts +23 -0
  164. package/dist/types-ts4.5/plugins/table/pm-plugins/table-local-id.d.ts +10 -0
  165. package/dist/types-ts4.5/plugins/table/pm-plugins/table-resizing/commands.d.ts +23 -0
  166. package/dist/types-ts4.5/plugins/table/pm-plugins/table-resizing/event-handlers.d.ts +4 -0
  167. package/dist/types-ts4.5/plugins/table/pm-plugins/table-resizing/index.d.ts +3 -0
  168. package/dist/types-ts4.5/plugins/table/pm-plugins/table-resizing/plugin-factory.d.ts +4 -0
  169. package/dist/types-ts4.5/plugins/table/pm-plugins/table-resizing/plugin-key.d.ts +3 -0
  170. package/dist/types-ts4.5/plugins/table/pm-plugins/table-resizing/plugin.d.ts +6 -0
  171. package/dist/types-ts4.5/plugins/table/pm-plugins/table-resizing/reducer.d.ts +3 -0
  172. package/dist/types-ts4.5/plugins/table/pm-plugins/table-resizing/utils/colgroup.d.ts +23 -0
  173. package/dist/types-ts4.5/plugins/table/pm-plugins/table-resizing/utils/column-state.d.ts +14 -0
  174. package/dist/types-ts4.5/plugins/table/pm-plugins/table-resizing/utils/consts.d.ts +2 -0
  175. package/dist/types-ts4.5/plugins/table/pm-plugins/table-resizing/utils/content-width.d.ts +4 -0
  176. package/dist/types-ts4.5/plugins/table/pm-plugins/table-resizing/utils/dom.d.ts +12 -0
  177. package/dist/types-ts4.5/plugins/table/pm-plugins/table-resizing/utils/index.d.ts +13 -0
  178. package/dist/types-ts4.5/plugins/table/pm-plugins/table-resizing/utils/misc.d.ts +20 -0
  179. package/dist/types-ts4.5/plugins/table/pm-plugins/table-resizing/utils/resize-column.d.ts +2 -0
  180. package/dist/types-ts4.5/plugins/table/pm-plugins/table-resizing/utils/resize-logic.d.ts +4 -0
  181. package/dist/types-ts4.5/plugins/table/pm-plugins/table-resizing/utils/resize-state.d.ts +29 -0
  182. package/dist/types-ts4.5/plugins/table/pm-plugins/table-resizing/utils/scale-table.d.ts +21 -0
  183. package/dist/types-ts4.5/plugins/table/pm-plugins/table-resizing/utils/types.d.ts +22 -0
  184. package/dist/types-ts4.5/plugins/table/pm-plugins/table-resizing/utils/unit-to-number.d.ts +1 -0
  185. package/dist/types-ts4.5/plugins/table/pm-plugins/table-selection-keymap.d.ts +5 -0
  186. package/dist/types-ts4.5/plugins/table/pm-plugins/table-width.d.ts +17 -0
  187. package/dist/types-ts4.5/plugins/table/reducer.d.ts +3 -0
  188. package/dist/types-ts4.5/plugins/table/toolbar.d.ts +36 -0
  189. package/dist/types-ts4.5/plugins/table/transforms/column-width.d.ts +37 -0
  190. package/dist/types-ts4.5/plugins/table/transforms/delete-columns.d.ts +4 -0
  191. package/dist/types-ts4.5/plugins/table/transforms/delete-rows.d.ts +3 -0
  192. package/dist/types-ts4.5/plugins/table/transforms/fix-tables.d.ts +9 -0
  193. package/dist/types-ts4.5/plugins/table/transforms/index.d.ts +6 -0
  194. package/dist/types-ts4.5/plugins/table/transforms/merge.d.ts +5 -0
  195. package/dist/types-ts4.5/plugins/table/transforms/replace-table.d.ts +5 -0
  196. package/dist/types-ts4.5/plugins/table/transforms/split.d.ts +9 -0
  197. package/dist/types-ts4.5/plugins/table/types.d.ts +343 -0
  198. package/dist/types-ts4.5/plugins/table/ui/ColumnResizeWidget/index.d.ts +9 -0
  199. package/dist/types-ts4.5/plugins/table/ui/FloatingContextualButton/FixedButton.d.ts +23 -0
  200. package/dist/types-ts4.5/plugins/table/ui/FloatingContextualButton/index.d.ts +21 -0
  201. package/dist/types-ts4.5/plugins/table/ui/FloatingContextualButton/styles.d.ts +3 -0
  202. package/dist/types-ts4.5/plugins/table/ui/FloatingContextualMenu/ContextualMenu.d.ts +87 -0
  203. package/dist/types-ts4.5/plugins/table/ui/FloatingContextualMenu/index.d.ts +23 -0
  204. package/dist/types-ts4.5/plugins/table/ui/FloatingContextualMenu/styles.d.ts +2 -0
  205. package/dist/types-ts4.5/plugins/table/ui/FloatingDeleteButton/DeleteButton.d.ts +13 -0
  206. package/dist/types-ts4.5/plugins/table/ui/FloatingDeleteButton/getPopUpOptions.d.ts +10 -0
  207. package/dist/types-ts4.5/plugins/table/ui/FloatingDeleteButton/index.d.ts +54 -0
  208. package/dist/types-ts4.5/plugins/table/ui/FloatingDeleteButton/types.d.ts +1 -0
  209. package/dist/types-ts4.5/plugins/table/ui/FloatingInsertButton/InsertButton.d.ts +13 -0
  210. package/dist/types-ts4.5/plugins/table/ui/FloatingInsertButton/getPopupOptions.d.ts +3 -0
  211. package/dist/types-ts4.5/plugins/table/ui/FloatingInsertButton/index.d.ts +35 -0
  212. package/dist/types-ts4.5/plugins/table/ui/LayoutButton/index.d.ts +21 -0
  213. package/dist/types-ts4.5/plugins/table/ui/TableFloatingControls/CornerControls/index.d.ts +16 -0
  214. package/dist/types-ts4.5/plugins/table/ui/TableFloatingControls/NumberColumn/index.d.ts +21 -0
  215. package/dist/types-ts4.5/plugins/table/ui/TableFloatingControls/RowControls/index.d.ts +17 -0
  216. package/dist/types-ts4.5/plugins/table/ui/TableFloatingControls/index.d.ts +39 -0
  217. package/dist/types-ts4.5/plugins/table/ui/common-styles.d.ts +9 -0
  218. package/dist/types-ts4.5/plugins/table/ui/consts.d.ts +50 -0
  219. package/dist/types-ts4.5/plugins/table/ui/messages.d.ts +63 -0
  220. package/dist/types-ts4.5/plugins/table/ui/ui-styles.d.ts +15 -0
  221. package/dist/types-ts4.5/plugins/table/utils/analytics.d.ts +45 -0
  222. package/dist/types-ts4.5/plugins/table/utils/collapse.d.ts +29 -0
  223. package/dist/types-ts4.5/plugins/table/utils/column-controls.d.ts +10 -0
  224. package/dist/types-ts4.5/plugins/table/utils/decoration.d.ts +19 -0
  225. package/dist/types-ts4.5/plugins/table/utils/dom.d.ts +26 -0
  226. package/dist/types-ts4.5/plugins/table/utils/get-allow-add-column-custom-step.d.ts +2 -0
  227. package/dist/types-ts4.5/plugins/table/utils/guidelines.d.ts +2 -0
  228. package/dist/types-ts4.5/plugins/table/utils/index.d.ts +11 -0
  229. package/dist/types-ts4.5/plugins/table/utils/nodes.d.ts +23 -0
  230. package/dist/types-ts4.5/plugins/table/utils/paste.d.ts +14 -0
  231. package/dist/types-ts4.5/plugins/table/utils/row-controls.d.ts +16 -0
  232. package/dist/types-ts4.5/plugins/table/utils/selection.d.ts +6 -0
  233. package/dist/types-ts4.5/plugins/table/utils/snapping.d.ts +10 -0
  234. package/dist/types-ts4.5/plugins/table/utils/table.d.ts +4 -0
  235. package/dist/types-ts4.5/plugins/table/utils/update-plugin-state-decorations.d.ts +4 -0
  236. package/dist/types-ts4.5/plugins/table-plugin.d.ts +2 -0
  237. package/dist/types-ts4.5/types/i18n.d.ts +5 -0
  238. package/package.json +3 -3
  239. package/report.api.md +2 -17
  240. package/src/__tests__/unit/nodeviews/cell.ts +2 -2
  241. package/src/__tests__/unit/pm-plugins/sticky-headers/tableRow.tsx +25 -148
  242. package/src/plugins/table/index.tsx +14 -0
  243. package/src/plugins/table/nodeviews/{tableCell.tsx → TableCell.ts} +41 -46
  244. package/src/plugins/table/nodeviews/TableNodeViewBase.ts +32 -0
  245. package/src/plugins/table/{pm-plugins/sticky-headers/nodeviews/tableRow.ts → nodeviews/TableRow.ts} +193 -246
  246. package/src/plugins/table/pm-plugins/drag-and-drop/actions.ts +29 -0
  247. package/src/plugins/table/pm-plugins/drag-and-drop/commands.ts +32 -0
  248. package/src/plugins/table/pm-plugins/drag-and-drop/consts.ts +8 -0
  249. package/src/plugins/table/pm-plugins/drag-and-drop/index.ts +5 -0
  250. package/src/plugins/table/pm-plugins/drag-and-drop/plugin-factory.ts +8 -0
  251. package/src/plugins/table/pm-plugins/drag-and-drop/plugin-key.ts +7 -0
  252. package/src/plugins/table/pm-plugins/drag-and-drop/plugin.ts +32 -0
  253. package/src/plugins/table/pm-plugins/drag-and-drop/reducer.ts +26 -0
  254. package/src/plugins/table/pm-plugins/drag-and-drop/types.ts +6 -0
  255. package/src/plugins/table/pm-plugins/main.ts +10 -19
  256. package/src/plugins/table/pm-plugins/sticky-headers/index.ts +0 -1
  257. package/src/plugins/table/pm-plugins/sticky-headers/plugin.ts +1 -9
  258. package/src/plugins/table/types.ts +2 -0
  259. package/src/plugins/table/utils/dom.ts +38 -0
  260. package/src/plugins/table/utils/index.ts +2 -0
  261. package/src/plugins/table/utils/nodes.ts +30 -2
  262. package/tmp/api-report-tmp.d.ts +100 -0
  263. package/dist/cjs/plugins/table/nodeviews/tableCell.js +0 -99
  264. package/dist/cjs/plugins/table/pm-plugins/sticky-headers/nodeviews/dom.js +0 -35
  265. package/dist/es2019/plugins/table/pm-plugins/sticky-headers/nodeviews/dom.js +0 -29
  266. package/dist/esm/plugins/table/nodeviews/tableCell.js +0 -93
  267. package/dist/esm/plugins/table/pm-plugins/sticky-headers/nodeviews/dom.js +0 -29
  268. package/dist/types/plugins/table/nodeviews/tableCell.d.ts +0 -17
  269. package/dist/types/plugins/table/pm-plugins/sticky-headers/nodeviews/dom.d.ts +0 -6
  270. package/dist/types/plugins/table/pm-plugins/sticky-headers/nodeviews/tableRow.d.ts +0 -73
  271. package/src/plugins/table/pm-plugins/sticky-headers/nodeviews/dom.ts +0 -37
@@ -0,0 +1,6 @@
1
+ export const 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,14 @@
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 const setDropTarget = (type, index, tr) => createCommand({
6
+ type: DragAndDropActionType.SET_DROP_TARGET,
7
+ data: {
8
+ type,
9
+ index
10
+ }
11
+ }, originalTr => (tr || originalTr).setMeta('addToHistory', false));
12
+ export const clearDropTarget = tr => createCommand({
13
+ type: DragAndDropActionType.CLEAR_DROP_TARGET
14
+ }, originalTr => (tr || originalTr).setMeta('addToHistory', false));
@@ -0,0 +1,5 @@
1
+ export const 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,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
+ });
@@ -10,7 +10,8 @@ import { addBoldInEmptyHeaderCells, clearHoverSelection, setTableRef } from '../
10
10
  import { removeResizeHandleDecorations, transformSliceRemoveCellBackgroundColor, transformSliceToAddTableHeaders, transformSliceToRemoveColumnsWidths } from '../commands/misc';
11
11
  import { handleBlur, handleClick, handleCut, handleFocus, handleMouseDown, handleMouseLeave, handleMouseMove, handleMouseOut, handleMouseOver, handleTripleClick, whenTableInFocus } from '../event-handlers';
12
12
  import { createTableView } from '../nodeviews/table';
13
- import TableCellNodeView from '../nodeviews/tableCell';
13
+ import TableCell from '../nodeviews/TableCell';
14
+ import TableRow from '../nodeviews/TableRow';
14
15
  import { pluginKey as decorationsPluginKey } from '../pm-plugins/decorations/plugin';
15
16
  import { fixTables, replaceSelectedTable } from '../transforms';
16
17
  import { TableCssClassName as ClassName } from '../types';
@@ -19,7 +20,7 @@ import { isHeaderRowRequired } from '../utils/paste';
19
20
  import { defaultTableSelection } from './default-table-selection';
20
21
  import { createPluginState, getPluginState } from './plugin-factory';
21
22
  import { pluginKey } from './plugin-key';
22
- export const createPlugin = (dispatchAnalyticsEvent, dispatch, portalProviderAPI, eventDispatcher, pluginConfig, getEditorContainerWidth, getEditorFeatureFlags, getIntl, breakoutEnabled, fullWidthModeEnabled, tableResizingEnabled, previousFullWidthModeEnabled, editorAnalyticsAPI, pluginInjectionApi) => {
23
+ export const createPlugin = (dispatchAnalyticsEvent, dispatch, portalProviderAPI, eventDispatcher, pluginConfig, getEditorContainerWidth, getEditorFeatureFlags, getIntl, breakoutEnabled, fullWidthModeEnabled, tableResizingEnabled, previousFullWidthModeEnabled, dragAndDropEnabled, editorAnalyticsAPI, pluginInjectionApi) => {
23
24
  var _window;
24
25
  const state = createPluginState(dispatch, {
25
26
  pluginConfig,
@@ -31,6 +32,7 @@ export const createPlugin = (dispatchAnalyticsEvent, dispatch, portalProviderAPI
31
32
  isTableResizingEnabled: tableResizingEnabled,
32
33
  isHeaderRowEnabled: !!pluginConfig.allowHeaderRow,
33
34
  isHeaderColumnEnabled: false,
35
+ isDragAndDropEnabled: dragAndDropEnabled,
34
36
  ...defaultTableSelection,
35
37
  getIntl
36
38
  });
@@ -43,10 +45,6 @@ export const createPlugin = (dispatchAnalyticsEvent, dispatch, portalProviderAPI
43
45
  elementContentRects[entry.target.id] = entry.contentRect;
44
46
  });
45
47
  }) : undefined;
46
- const tableCellNodeview = {
47
- tableCell: (node, view, getPos) => new TableCellNodeView(node, view, getPos, observer),
48
- tableHeader: (node, view, getPos) => new TableCellNodeView(node, view, getPos, observer)
49
- };
50
48
 
51
49
  // Used to prevent invalid table cell spans being reported more than once per editor/document
52
50
  const invalidTableIds = [];
@@ -228,8 +226,10 @@ export const createPlugin = (dispatchAnalyticsEvent, dispatch, portalProviderAPI
228
226
  return false;
229
227
  },
230
228
  nodeViews: {
231
- ...tableCellNodeview,
232
- table: (node, view, getPos) => createTableView(node, view, getPos, portalProviderAPI, eventDispatcher, getEditorContainerWidth, getEditorFeatureFlags, pluginInjectionApi)
229
+ table: (node, view, getPos) => createTableView(node, view, getPos, portalProviderAPI, eventDispatcher, getEditorContainerWidth, getEditorFeatureFlags, pluginInjectionApi),
230
+ tableRow: (node, view, getPos) => new TableRow(node, view, getPos, eventDispatcher),
231
+ tableCell: (node, view, getPos) => new TableCell(node, view, getPos, eventDispatcher, observer),
232
+ tableHeader: (node, view, getPos) => new TableCell(node, view, getPos, eventDispatcher, observer)
233
233
  },
234
234
  handleDOMEvents: {
235
235
  focus: handleFocus,
@@ -1,5 +1,4 @@
1
1
  export { createPlugin } from './plugin';
2
2
  export { pluginKey } from './plugin-key';
3
3
  export { findStickyHeaderForTable } from './util';
4
- export { updateStickyState, removeStickyState } from './commands';
5
- export { TableRowNodeView } from './nodeviews/tableRow';
4
+ export { updateStickyState, removeStickyState } from './commands';
@@ -1,17 +1,9 @@
1
1
  import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
2
- import { TableRowNodeView } from './nodeviews/tableRow';
3
2
  import { pluginKey } from './plugin-key';
4
3
  import { createPluginState } from './plugin-state';
5
4
  export const createPlugin = (dispatch, eventDispatcher, initialState = () => [], getEditorFeatureFlags) => {
6
5
  return new SafePlugin({
7
6
  state: createPluginState(dispatch, initialState),
8
- key: pluginKey,
9
- props: {
10
- nodeViews: {
11
- tableRow: (node, view, getPos) => {
12
- return new TableRowNodeView(node, view, getPos, eventDispatcher);
13
- }
14
- }
15
- }
7
+ key: pluginKey
16
8
  });
17
9
  };
@@ -135,4 +135,34 @@ export const hasResizeHandler = ({
135
135
  return false;
136
136
  }
137
137
  return true;
138
+ };
139
+ export const getTree = tr => {
140
+ // pm renders into tbody, owned by react
141
+ const tbody = tr.parentElement;
142
+ if (!tbody) {
143
+ return null;
144
+ }
145
+
146
+ // rendered by react
147
+ const table = tbody.parentElement;
148
+ if (!table) {
149
+ return null;
150
+ }
151
+
152
+ // rendered by react
153
+ const wrapper = table.parentElement;
154
+ if (!wrapper) {
155
+ return null;
156
+ }
157
+ return {
158
+ wrapper: wrapper,
159
+ table: table
160
+ };
161
+ };
162
+ export const getTop = element => {
163
+ var _element$getBoundingC, _element$getBoundingC2, _element$getBoundingC3;
164
+ if (!element || element instanceof Window) {
165
+ return 0;
166
+ }
167
+ return (_element$getBoundingC = element === null || element === void 0 ? void 0 : (_element$getBoundingC2 = element.getBoundingClientRect) === null || _element$getBoundingC2 === void 0 ? void 0 : (_element$getBoundingC3 = _element$getBoundingC2.call(element)) === null || _element$getBoundingC3 === void 0 ? void 0 : _element$getBoundingC3.top) !== null && _element$getBoundingC !== void 0 ? _element$getBoundingC : 0;
138
168
  };
@@ -1,6 +1,6 @@
1
1
  export { getSelectedColumnIndexes, getSelectedRowIndexes, normalizeSelection, isSelectionUpdated } from './selection';
2
2
  export { findControlsHoverDecoration, createControlsHoverDecoration, createColumnControlsDecoration, createColumnSelectedDecoration, createCellHoverDecoration, updateDecorations, createResizeHandleDecoration, createColumnLineResize } from './decoration';
3
- export { isIsolating, containsHeaderColumn, containsHeaderRow, checkIfHeaderColumnEnabled, checkIfHeaderRowEnabled, checkIfNumberColumnEnabled, isLayoutSupported, getTableWidth, tablesHaveDifferentColumnWidths, tablesHaveDifferentNoOfColumns, isTableNested } from './nodes';
3
+ export { isIsolating, containsHeaderColumn, containsHeaderRow, checkIfHeaderColumnEnabled, checkIfHeaderRowEnabled, checkIfNumberColumnEnabled, isLayoutSupported, getTableWidth, tablesHaveDifferentColumnWidths, tablesHaveDifferentNoOfColumns, isTableNested, anyChildCellMergedAcrossRow, supportedHeaderRow } from './nodes';
4
4
  export { unwrapContentFromTable, removeTableFromFirstChild, removeTableFromLastChild, transformSliceToRemoveOpenTable, transformSliceToCorrectEmptyTableCells, transformSliceToFixHardBreakProblemOnCopyFromCell } from './paste';
5
5
  export { isCell, isCornerButton, isInsertRowButton, isColumnControlsDecorations, isTableControlsButton, isTableContainerOrWrapper, isRowControlsButton, getColumnOrRowIndex, getMousePositionHorizontalRelativeByElement, getMousePositionVerticalRelativeByElement, updateResizeHandles, isResizeHandleDecoration, hasResizeHandler } from './dom';
6
6
  export { getColumnsWidths, isColumnDeleteButtonVisible, getColumnDeleteButtonParams, getColumnClassNames } from './column-controls';
@@ -1,3 +1,4 @@
1
+ import { mapChildren } from '@atlaskit/editor-common/utils';
1
2
  import { hasParentNodeOfType } from '@atlaskit/editor-prosemirror/utils';
2
3
  import { TableMap } from '@atlaskit/editor-tables/table-map';
3
4
  import { findTable } from '@atlaskit/editor-tables/utils';
@@ -94,4 +95,19 @@ export const isTableNested = (state, tablePos = 0) => {
94
95
  const parent = state.doc.resolve(tablePos).parent;
95
96
  const nodeTypes = state.schema.nodes;
96
97
  return parent.type === nodeTypes.layoutColumn || parent.type === nodeTypes.expand || parent.type === nodeTypes.bodiedExtension;
98
+ };
99
+ export const anyChildCellMergedAcrossRow = node => mapChildren(node, child => child.attrs.rowspan || 0).some(rowspan => rowspan > 1);
100
+
101
+ /**
102
+ * Check if a given node is a header row with this definition:
103
+ * - all children are tableHeader cells
104
+ * - no table cells have been have merged with other table row cells
105
+ *
106
+ * @param node ProseMirror node
107
+ * @return boolean if it meets definition
108
+ */
109
+ export const supportedHeaderRow = node => {
110
+ const allHeaders = mapChildren(node, child => child.type.name === 'tableHeader').every(Boolean);
111
+ const someMerged = anyChildCellMergedAcrossRow(node);
112
+ return allHeaders && !someMerged;
97
113
  };
@@ -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';
@@ -104,8 +105,9 @@ var tablesPlugin = function tablesPlugin(_ref) {
104
105
  tableResizingEnabled = _ref3.tableResizingEnabled,
105
106
  breakoutEnabled = _ref3.breakoutEnabled,
106
107
  tableOptions = _ref3.tableOptions,
107
- getEditorFeatureFlags = _ref3.getEditorFeatureFlags;
108
- return createPlugin(dispatchAnalyticsEvent, dispatch, portalProviderAPI, eventDispatcher, pluginConfig(tableOptions), defaultGetEditorContainerWidth, getEditorFeatureFlags || defaultGetEditorFeatureFlags, getIntl, breakoutEnabled, fullWidthEnabled, tableResizingEnabled, wasFullWidthEnabled, editorAnalyticsAPI, api);
108
+ getEditorFeatureFlags = _ref3.getEditorFeatureFlags,
109
+ dragAndDropEnabled = _ref3.dragAndDropEnabled;
110
+ return createPlugin(dispatchAnalyticsEvent, dispatch, portalProviderAPI, eventDispatcher, pluginConfig(tableOptions), defaultGetEditorContainerWidth, getEditorFeatureFlags || defaultGetEditorFeatureFlags, getIntl, breakoutEnabled, fullWidthEnabled, tableResizingEnabled, wasFullWidthEnabled, dragAndDropEnabled, editorAnalyticsAPI, api);
109
111
  }
110
112
  }, {
111
113
  name: 'tablePMColResizing',
@@ -168,25 +170,32 @@ var tablesPlugin = function tablesPlugin(_ref) {
168
170
  }, (options === null || options === void 0 ? void 0 : options.getEditorFeatureFlags) || defaultGetEditorFeatureFlags) : undefined;
169
171
  }
170
172
  }, {
171
- name: 'tableLocalId',
173
+ name: 'tableDragAndDrop',
172
174
  plugin: function plugin(_ref8) {
173
- var dispatch = _ref8.dispatch;
175
+ var dispatch = _ref8.dispatch,
176
+ eventDispatcher = _ref8.eventDispatcher;
177
+ return options !== null && options !== void 0 && options.dragAndDropEnabled ? createDragAndDropPlugin(dispatch, eventDispatcher) : undefined;
178
+ }
179
+ }, {
180
+ name: 'tableLocalId',
181
+ plugin: function plugin(_ref9) {
182
+ var dispatch = _ref9.dispatch;
174
183
  return createTableLocalIdPlugin(dispatch);
175
184
  }
176
185
  }, {
177
186
  name: 'tableWidth',
178
- plugin: function plugin(_ref9) {
187
+ plugin: function plugin(_ref10) {
179
188
  var _options$fullWidthEna;
180
- var dispatchAnalyticsEvent = _ref9.dispatchAnalyticsEvent,
181
- dispatch = _ref9.dispatch;
189
+ var dispatchAnalyticsEvent = _ref10.dispatchAnalyticsEvent,
190
+ dispatch = _ref10.dispatch;
182
191
  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;
183
192
  }
184
193
  }, {
185
194
  name: 'tableAnalyticsPlugin',
186
- plugin: function plugin(_ref10) {
195
+ plugin: function plugin(_ref11) {
187
196
  var _options$tableResizin;
188
- var dispatch = _ref10.dispatch,
189
- dispatchAnalyticsEvent = _ref10.dispatchAnalyticsEvent;
197
+ var dispatch = _ref11.dispatch,
198
+ dispatchAnalyticsEvent = _ref11.dispatchAnalyticsEvent;
190
199
  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;
191
200
  }
192
201
  }, {
@@ -217,12 +226,12 @@ var tablesPlugin = function tablesPlugin(_ref) {
217
226
  }
218
227
  return plugins;
219
228
  },
220
- contentComponent: function contentComponent(_ref11) {
221
- var editorView = _ref11.editorView,
222
- popupsMountPoint = _ref11.popupsMountPoint,
223
- popupsBoundariesElement = _ref11.popupsBoundariesElement,
224
- popupsScrollableElement = _ref11.popupsScrollableElement,
225
- dispatchAnalyticsEvent = _ref11.dispatchAnalyticsEvent;
229
+ contentComponent: function contentComponent(_ref12) {
230
+ var editorView = _ref12.editorView,
231
+ popupsMountPoint = _ref12.popupsMountPoint,
232
+ popupsBoundariesElement = _ref12.popupsBoundariesElement,
233
+ popupsScrollableElement = _ref12.popupsScrollableElement,
234
+ dispatchAnalyticsEvent = _ref12.dispatchAnalyticsEvent;
226
235
  return /*#__PURE__*/React.createElement(ErrorBoundary, {
227
236
  component: ACTION_SUBJECT.TABLES_PLUGIN,
228
237
  dispatchAnalyticsEvent: dispatchAnalyticsEvent,
@@ -233,30 +242,31 @@ var tablesPlugin = function tablesPlugin(_ref) {
233
242
  tablePluginState: pluginKey,
234
243
  tableWidthPluginState: tableWidthPluginKey,
235
244
  tableResizingPluginState: tableResizingPluginKey,
236
- stickyHeadersState: stickyHeadersPluginKey
245
+ stickyHeadersState: stickyHeadersPluginKey,
246
+ dragAndDropState: dragAndDropPluginKey
237
247
  },
238
- render: function render(_ref12) {
239
- var resizingPluginState = _ref12.tableResizingPluginState,
240
- stickyHeadersState = _ref12.stickyHeadersState,
241
- tablePluginState = _ref12.tablePluginState,
242
- tableWidthPluginState = _ref12.tableWidthPluginState;
248
+ render: function render(_ref13) {
249
+ var resizingPluginState = _ref13.tableResizingPluginState,
250
+ stickyHeadersState = _ref13.stickyHeadersState,
251
+ tablePluginState = _ref13.tablePluginState,
252
+ tableWidthPluginState = _ref13.tableWidthPluginState;
243
253
  var state = editorView.state;
244
254
  var isColumnResizing = resizingPluginState === null || resizingPluginState === void 0 ? void 0 : resizingPluginState.dragging;
245
255
  var isTableResizing = tableWidthPluginState === null || tableWidthPluginState === void 0 ? void 0 : tableWidthPluginState.resizing;
246
256
  var isResizing = isColumnResizing || isTableResizing;
247
- var _ref13 = tablePluginState,
248
- tableNode = _ref13.tableNode,
249
- tablePos = _ref13.tablePos,
250
- targetCellPosition = _ref13.targetCellPosition,
251
- isContextualMenuOpen = _ref13.isContextualMenuOpen,
252
- layout = _ref13.layout,
253
- tableRef = _ref13.tableRef,
254
- pluginConfig = _ref13.pluginConfig,
255
- insertColumnButtonIndex = _ref13.insertColumnButtonIndex,
256
- insertRowButtonIndex = _ref13.insertRowButtonIndex,
257
- isHeaderColumnEnabled = _ref13.isHeaderColumnEnabled,
258
- isHeaderRowEnabled = _ref13.isHeaderRowEnabled,
259
- tableWrapperTarget = _ref13.tableWrapperTarget;
257
+ var _ref14 = tablePluginState,
258
+ tableNode = _ref14.tableNode,
259
+ tablePos = _ref14.tablePos,
260
+ targetCellPosition = _ref14.targetCellPosition,
261
+ isContextualMenuOpen = _ref14.isContextualMenuOpen,
262
+ layout = _ref14.layout,
263
+ tableRef = _ref14.tableRef,
264
+ pluginConfig = _ref14.pluginConfig,
265
+ insertColumnButtonIndex = _ref14.insertColumnButtonIndex,
266
+ insertRowButtonIndex = _ref14.insertRowButtonIndex,
267
+ isHeaderColumnEnabled = _ref14.isHeaderColumnEnabled,
268
+ isHeaderRowEnabled = _ref14.isHeaderRowEnabled,
269
+ tableWrapperTarget = _ref14.tableWrapperTarget;
260
270
  var allowControls = pluginConfig.allowControls;
261
271
  var stickyHeader = stickyHeadersState ? findStickyHeaderForTable(stickyHeadersState, tablePos) : undefined;
262
272
  var LayoutContent = options && !options.tableResizingEnabled && isLayoutSupported(state) && options.breakoutEnabled ? /*#__PURE__*/React.createElement(LayoutButton, {
@@ -322,8 +332,8 @@ var tablesPlugin = function tablesPlugin(_ref) {
322
332
  }));
323
333
  },
324
334
  pluginsOptions: {
325
- quickInsert: function quickInsert(_ref14) {
326
- var formatMessage = _ref14.formatMessage;
335
+ quickInsert: function quickInsert(_ref15) {
336
+ var formatMessage = _ref15.formatMessage;
327
337
  return [{
328
338
  id: 'table',
329
339
  title: formatMessage(messages.table),
@@ -0,0 +1,105 @@
1
+ import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
2
+ import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
3
+ import _createClass from "@babel/runtime/helpers/createClass";
4
+ import _inherits from "@babel/runtime/helpers/inherits";
5
+ import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
6
+ import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
7
+ function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
8
+ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
9
+ import uuid from 'uuid';
10
+ import { getCellAttrs, getCellDomAttrs } from '@atlaskit/adf-schema';
11
+ import { getPluginState } from '../pm-plugins/plugin-factory';
12
+ import TableNodeView from './TableNodeViewBase';
13
+ var DEFAULT_COL_SPAN = 1;
14
+ var DEFAULT_ROW_SPAN = 1;
15
+ var TableCell = /*#__PURE__*/function (_ref) {
16
+ _inherits(TableCell, _ref);
17
+ var _super = _createSuper(TableCell);
18
+ function TableCell(node, view, getPos, eventDispatcher, observer) {
19
+ var _this;
20
+ _classCallCheck(this, TableCell);
21
+ _this = _super.call(this, node, view, getPos, eventDispatcher);
22
+ _this.observer = observer;
23
+ var _getPluginState = getPluginState(view.state),
24
+ pluginConfig = _getPluginState.pluginConfig,
25
+ isDragAndDropEnabled = _getPluginState.isDragAndDropEnabled;
26
+ _this.isStickyHeaderEnabled = !!pluginConfig.stickyHeaders;
27
+ _this.isDragAndDropEnabled = !!isDragAndDropEnabled;
28
+ if (observer) {
29
+ _this.contentDOM.id = uuid();
30
+ observer.observe(_this.contentDOM);
31
+ }
32
+ return _this;
33
+ }
34
+
35
+ // @ts-ignore
36
+
37
+ // @ts-ignore
38
+ _createClass(TableCell, [{
39
+ key: "update",
40
+ value: function update(node) {
41
+ var didUpdate = this.updateNodeView(node);
42
+ if (didUpdate) {
43
+ this.node = node;
44
+ }
45
+ return didUpdate;
46
+ }
47
+ }, {
48
+ key: "destroy",
49
+ value: function destroy() {
50
+ if (this.observer) {
51
+ this.observer.unobserve(this.contentDOM);
52
+ }
53
+ }
54
+ }, {
55
+ key: "updateNodeView",
56
+ value: function updateNodeView(node) {
57
+ var _this2 = this;
58
+ if (this.node.type !== node.type) {
59
+ return false;
60
+ }
61
+ var attrs = getCellDomAttrs(this.node);
62
+ var nextAttrs = getCellDomAttrs(node);
63
+ var _getCellAttrs = getCellAttrs(this.dom),
64
+ colspan = _getCellAttrs.colspan,
65
+ rowspan = _getCellAttrs.rowspan;
66
+
67
+ // need to rerender when colspan/rowspan in dom are different from the node attrs
68
+ // this can happen when undoing merge cells
69
+ if (colspan !== (node.attrs.colspan || DEFAULT_COL_SPAN) || rowspan !== (node.attrs.rowspan || DEFAULT_ROW_SPAN)) {
70
+ return false;
71
+ }
72
+
73
+ // added + changed attributes
74
+ var addedAttrs = Object.entries(nextAttrs).filter(function (_ref2) {
75
+ var _ref3 = _slicedToArray(_ref2, 2),
76
+ key = _ref3[0],
77
+ value = _ref3[1];
78
+ return attrs[key] !== value;
79
+ });
80
+ var removedAttrs = Object.keys(attrs).filter(function (key) {
81
+ return !nextAttrs.hasOwnProperty(key);
82
+ });
83
+ if (addedAttrs.length || removedAttrs.length) {
84
+ addedAttrs.forEach(function (_ref4) {
85
+ var _ref5 = _slicedToArray(_ref4, 2),
86
+ key = _ref5[0],
87
+ value = _ref5[1];
88
+ return _this2.dom.setAttribute(key, value || '');
89
+ });
90
+ removedAttrs.forEach(function (key) {
91
+ return _this2.dom.removeAttribute(key);
92
+ });
93
+ return true;
94
+ }
95
+
96
+ // Return true to not re-render this node view
97
+ if (this.node.sameMarkup(node)) {
98
+ return true;
99
+ }
100
+ return false;
101
+ }
102
+ }]);
103
+ return TableCell;
104
+ }(TableNodeView);
105
+ export { TableCell as default };
@@ -0,0 +1,24 @@
1
+ import _createClass from "@babel/runtime/helpers/createClass";
2
+ import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
3
+ import { DOMSerializer } from '@atlaskit/editor-prosemirror/model';
4
+ var TableNodeView = /*#__PURE__*/_createClass(
5
+ /**
6
+ * @constructor
7
+ */
8
+ function TableNodeView(node, view, getPos, eventDispatcher) {
9
+ _classCallCheck(this, TableNodeView);
10
+ this.node = node;
11
+ this.view = view;
12
+ this.getPos = getPos;
13
+ this.eventDispatcher = eventDispatcher;
14
+ var _DOMSerializer$render = DOMSerializer.renderSpec(document, node.type.spec.toDOM(node)),
15
+ dom = _DOMSerializer$render.dom,
16
+ contentDOM = _DOMSerializer$render.contentDOM;
17
+ this.dom = dom;
18
+ this.contentDOM = contentDOM;
19
+ }
20
+
21
+ /**
22
+ * Variables
23
+ */);
24
+ export { TableNodeView as default };