@atlaskit/editor-plugin-table 0.0.10 → 0.1.1

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 (368) hide show
  1. package/.eslintrc.js +35 -0
  2. package/CHANGELOG.md +31 -0
  3. package/commands/package.json +14 -0
  4. package/dist/cjs/plugins/table/commands/hover.js +4 -4
  5. package/dist/cjs/plugins/table/commands-with-analytics.js +59 -58
  6. package/dist/cjs/plugins/table/event-handlers.js +0 -1
  7. package/dist/cjs/plugins/table/index.js +54 -37
  8. package/dist/cjs/plugins/table/pm-plugins/table-resizing/index.js +9 -1
  9. package/dist/cjs/plugins/table/toolbar.js +150 -22
  10. package/dist/cjs/plugins/table/transforms/fix-tables.js +7 -7
  11. package/dist/cjs/plugins/table/ui/FloatingContextualButton/index.js +1 -2
  12. package/dist/cjs/plugins/table/ui/FloatingContextualMenu/ContextualMenu.js +4 -6
  13. package/dist/cjs/plugins/table/ui/FloatingDeleteButton/index.js +2 -1
  14. package/dist/cjs/plugins/table/ui/LayoutButton/index.js +3 -5
  15. package/dist/cjs/plugins/table/ui/TableFloatingControls/CornerControls/index.js +2 -1
  16. package/dist/cjs/plugins/table/utils/column-controls.js +0 -1
  17. package/dist/cjs/plugins/table/utils/decoration.js +53 -4
  18. package/dist/cjs/plugins/table/utils/dom.js +0 -2
  19. package/dist/cjs/plugins/table/utils/paste.js +0 -1
  20. package/dist/cjs/version.json +1 -1
  21. package/dist/es2019/plugins/table/commands/hover.js +4 -4
  22. package/dist/es2019/plugins/table/commands-with-analytics.js +6 -9
  23. package/dist/es2019/plugins/table/event-handlers.js +1 -2
  24. package/dist/es2019/plugins/table/handlers.js +1 -2
  25. package/dist/es2019/plugins/table/index.js +23 -5
  26. package/dist/es2019/plugins/table/pm-plugins/keymap.js +1 -1
  27. package/dist/es2019/plugins/table/pm-plugins/table-local-id.js +1 -3
  28. package/dist/es2019/plugins/table/pm-plugins/table-resizing/index.js +2 -1
  29. package/dist/es2019/plugins/table/toolbar.js +133 -16
  30. package/dist/es2019/plugins/table/transforms/fix-tables.js +2 -4
  31. package/dist/es2019/plugins/table/ui/FloatingContextualButton/index.js +1 -2
  32. package/dist/es2019/plugins/table/ui/FloatingContextualMenu/ContextualMenu.js +4 -6
  33. package/dist/es2019/plugins/table/ui/FloatingDeleteButton/index.js +3 -3
  34. package/dist/es2019/plugins/table/ui/FloatingInsertButton/index.js +1 -2
  35. package/dist/es2019/plugins/table/ui/LayoutButton/index.js +3 -5
  36. package/dist/es2019/plugins/table/ui/TableFloatingControls/CornerControls/index.js +2 -1
  37. package/dist/es2019/plugins/table/utils/column-controls.js +0 -1
  38. package/dist/es2019/plugins/table/utils/decoration.js +60 -25
  39. package/dist/es2019/plugins/table/utils/dom.js +0 -2
  40. package/dist/es2019/plugins/table/utils/paste.js +1 -2
  41. package/dist/es2019/plugins/table/utils/row-controls.js +1 -2
  42. package/dist/es2019/version.json +1 -1
  43. package/dist/esm/plugins/table/commands/hover.js +4 -4
  44. package/dist/esm/plugins/table/commands-with-analytics.js +56 -55
  45. package/dist/esm/plugins/table/event-handlers.js +1 -2
  46. package/dist/esm/plugins/table/handlers.js +1 -2
  47. package/dist/esm/plugins/table/index.js +55 -38
  48. package/dist/esm/plugins/table/pm-plugins/keymap.js +1 -1
  49. package/dist/esm/plugins/table/pm-plugins/table-local-id.js +1 -3
  50. package/dist/esm/plugins/table/pm-plugins/table-resizing/index.js +2 -1
  51. package/dist/esm/plugins/table/toolbar.js +139 -17
  52. package/dist/esm/plugins/table/transforms/fix-tables.js +2 -4
  53. package/dist/esm/plugins/table/ui/FloatingContextualButton/index.js +1 -2
  54. package/dist/esm/plugins/table/ui/FloatingContextualMenu/ContextualMenu.js +4 -6
  55. package/dist/esm/plugins/table/ui/FloatingDeleteButton/index.js +3 -3
  56. package/dist/esm/plugins/table/ui/FloatingInsertButton/index.js +1 -2
  57. package/dist/esm/plugins/table/ui/LayoutButton/index.js +3 -5
  58. package/dist/esm/plugins/table/ui/TableFloatingControls/CornerControls/index.js +2 -1
  59. package/dist/esm/plugins/table/utils/column-controls.js +0 -1
  60. package/dist/esm/plugins/table/utils/decoration.js +50 -4
  61. package/dist/esm/plugins/table/utils/dom.js +0 -2
  62. package/dist/esm/plugins/table/utils/paste.js +1 -2
  63. package/dist/esm/plugins/table/utils/row-controls.js +1 -2
  64. package/dist/esm/version.json +1 -1
  65. package/dist/types/plugins/table/commands-with-analytics.d.ts +5 -5
  66. package/dist/types/plugins/table/pm-plugins/table-resizing/index.d.ts +1 -0
  67. package/dist/types/plugins/table/toolbar.d.ts +2 -2
  68. package/dist/types/plugins/table/transforms/fix-tables.d.ts +1 -1
  69. package/dist/types/plugins/table/utils/decoration.d.ts +1 -1
  70. package/examples/99-testing.tsx +35 -30
  71. package/examples/config.jsonc +14 -0
  72. package/package.json +14 -19
  73. package/plugin-key/package.json +14 -0
  74. package/report.api.md +1 -1
  75. package/src/{plugins/table/__tests__ → __tests__}/integration/__fixtures__/auto-size-documents.ts +5 -10
  76. package/src/{plugins/table/__tests__ → __tests__}/integration/__fixtures__/basic-table.ts +0 -0
  77. package/src/{plugins/table/__tests__ → __tests__}/integration/__fixtures__/empty-paragraph-underneath-table.ts +0 -0
  78. package/src/{plugins/table/__tests__ → __tests__}/integration/__fixtures__/even-columns.ts +0 -0
  79. package/src/{plugins/table/__tests__ → __tests__}/integration/__fixtures__/layout-documents.ts +1 -2
  80. package/src/{plugins/table/__tests__ → __tests__}/integration/__fixtures__/merged-rows-and-cols-document.ts +0 -0
  81. package/src/{plugins/table/__tests__ → __tests__}/integration/__fixtures__/nested-in-extension.ts +0 -0
  82. package/src/{plugins/table/__tests__ → __tests__}/integration/__fixtures__/paragraph-and-table-adf.json +0 -0
  83. package/src/{plugins/table/__tests__ → __tests__}/integration/__fixtures__/resize-documents.ts +5 -10
  84. package/src/{plugins/table/__tests__ → __tests__}/integration/__fixtures__/scale.ts +0 -0
  85. package/src/{plugins/table/__tests__ → __tests__}/integration/__fixtures__/table-inside-layout.ts +0 -0
  86. package/src/{plugins/table/__tests__ → __tests__}/integration/__fixtures__/table-with-min-width-columns-document.ts +0 -0
  87. package/src/{plugins/table/__tests__ → __tests__}/integration/__fixtures__/table-with-multiline-date.adf.json +0 -0
  88. package/src/{plugins/table/__tests__ → __tests__}/integration/__fixtures__/table-with-text-and-empty-row.ts +0 -0
  89. package/src/{plugins/table/__tests__ → __tests__}/integration/__snapshots__/auto-size.ts.snap +0 -0
  90. package/src/{plugins/table/__tests__ → __tests__}/integration/__snapshots__/change-date-inside-table.ts.snap +0 -0
  91. package/src/{plugins/table/__tests__ → __tests__}/integration/__snapshots__/copy-button.ts.snap +0 -0
  92. package/src/{plugins/table/__tests__ → __tests__}/integration/__snapshots__/delete-columns.ts.snap +0 -0
  93. package/src/{plugins/table/__tests__ → __tests__}/integration/__snapshots__/delete-last-column-in-full-width.ts.snap +0 -0
  94. package/src/{plugins/table/__tests__ → __tests__}/integration/__snapshots__/delete-last-column-with-empty-action.ts.snap +0 -0
  95. package/src/{plugins/table/__tests__ → __tests__}/integration/__snapshots__/delete-last-row-with-empty-action.ts.snap +0 -0
  96. package/src/{plugins/table/__tests__ → __tests__}/integration/__snapshots__/delete-rows.ts.snap +0 -0
  97. package/src/{plugins/table/__tests__ → __tests__}/integration/__snapshots__/delete-table-when-selected.ts.snap +0 -0
  98. package/src/{plugins/table/__tests__ → __tests__}/integration/__snapshots__/deleting-empty-paragraph-under-table.ts.snap +0 -0
  99. package/src/{plugins/table/__tests__ → __tests__}/integration/__snapshots__/even-columns.ts.snap +0 -0
  100. package/src/{plugins/table/__tests__ → __tests__}/integration/__snapshots__/insert-cell-header-with-strong-mark.ts.snap +0 -0
  101. package/src/{plugins/table/__tests__ → __tests__}/integration/__snapshots__/insert-row-inside-layout.ts.snap +0 -0
  102. package/src/{plugins/table/__tests__ → __tests__}/integration/__snapshots__/layout.ts.snap +0 -0
  103. package/src/{plugins/table/__tests__ → __tests__}/integration/__snapshots__/resize.ts.snap +0 -0
  104. package/src/{plugins/table/__tests__ → __tests__}/integration/__snapshots__/scale.ts.snap +0 -0
  105. package/src/{plugins/table/__tests__ → __tests__}/integration/arrow-down-into-table.ts +0 -0
  106. package/src/{plugins/table/__tests__ → __tests__}/integration/auto-size.ts +0 -0
  107. package/src/{plugins/table/__tests__ → __tests__}/integration/block-node-selection.ts +1 -0
  108. package/src/{plugins/table/__tests__ → __tests__}/integration/cell-selection.ts +0 -0
  109. package/src/{plugins/table/__tests__ → __tests__}/integration/change-date-inside-table.ts +0 -0
  110. package/src/{plugins/table/__tests__ → __tests__}/integration/copy-button.ts +1 -1
  111. package/src/{plugins/table/__tests__ → __tests__}/integration/delete-columns.ts +2 -2
  112. package/src/{plugins/table/__tests__ → __tests__}/integration/delete-last-column-in-full-width.ts +1 -1
  113. package/src/{plugins/table/__tests__ → __tests__}/integration/delete-last-column-with-empty-action.ts +1 -1
  114. package/src/{plugins/table/__tests__ → __tests__}/integration/delete-last-row-with-empty-action.ts +1 -1
  115. package/src/{plugins/table/__tests__ → __tests__}/integration/delete-rows.ts +2 -2
  116. package/src/{plugins/table/__tests__ → __tests__}/integration/delete-table-when-selected.ts +0 -0
  117. package/src/{plugins/table/__tests__ → __tests__}/integration/deleting-empty-paragraph-under-table.ts +0 -0
  118. package/src/{plugins/table/__tests__ → __tests__}/integration/even-columns.ts +0 -0
  119. package/src/{plugins/table/__tests__ → __tests__}/integration/insert-cell-header-with-strong-mark.ts +0 -0
  120. package/src/{plugins/table/__tests__ → __tests__}/integration/insert-long-smart-link.ts +1 -0
  121. package/src/{plugins/table/__tests__ → __tests__}/integration/insert-row-inside-layout.ts +0 -0
  122. package/src/{plugins/table/__tests__ → __tests__}/integration/layout.ts +0 -0
  123. package/src/{plugins/table/__tests__ → __tests__}/integration/resize-handler.ts +0 -0
  124. package/src/{plugins/table/__tests__ → __tests__}/integration/resize.ts +2 -3
  125. package/src/{plugins/table/__tests__ → __tests__}/integration/scale.ts +0 -0
  126. package/src/__tests__/integration/table-controls-selection.ts +71 -0
  127. package/src/__tests__/unit/analytics.ts +41 -41
  128. package/src/__tests__/unit/collab.ts +12 -9
  129. package/src/{plugins/table/__tests__ → __tests__}/unit/commands/go-to-next-cell.ts +4 -4
  130. package/src/{plugins/table/__tests__ → __tests__}/unit/commands/insert.ts +4 -4
  131. package/src/{plugins/table/__tests__ → __tests__}/unit/commands/misc.ts +12 -6
  132. package/src/__tests__/unit/commands/sort.ts +28 -28
  133. package/src/{plugins/table/__tests__ → __tests__}/unit/commands.ts +7 -7
  134. package/src/__tests__/unit/copy-button.ts +22 -0
  135. package/src/__tests__/unit/copy-paste.ts +6 -8
  136. package/src/__tests__/unit/event-handlers.ts +127 -11
  137. package/src/__tests__/unit/fix-tables.ts +17 -23
  138. package/src/{plugins/table/__tests__ → __tests__}/unit/get-toolbar-config.ts +8 -8
  139. package/src/__tests__/unit/hover-selection.ts +1 -66
  140. package/src/__tests__/unit/index-with-fake-timers.ts +1 -1
  141. package/src/__tests__/unit/index.ts +5 -5
  142. package/src/{plugins/table/__tests__ → __tests__}/unit/nodeviews/OverflowShadowsObserver.ts +2 -2
  143. package/src/__tests__/unit/nodeviews/TableComponent.tsx +181 -0
  144. package/src/__tests__/unit/nodeviews/cell.ts +12 -10
  145. package/src/{plugins/table/__tests__ → __tests__}/unit/nodeviews/table.ts +29 -30
  146. package/src/{plugins/table/__tests__ → __tests__}/unit/pm-plugins/decorations/column-controls.ts +2 -2
  147. package/src/{plugins/table/__tests__ → __tests__}/unit/pm-plugins/decorations/column-resizing.ts +9 -6
  148. package/src/{plugins/table/__tests__ → __tests__}/unit/pm-plugins/decorations/plugin.ts +5 -5
  149. package/src/{plugins/table/__tests__ → __tests__}/unit/pm-plugins/main-with-allow-collapse.ts +4 -4
  150. package/src/{plugins/table/__tests__ → __tests__}/unit/pm-plugins/main.ts +6 -6
  151. package/src/{plugins/table/__tests__ → __tests__}/unit/pm-plugins/safari-delete-composition-text-issue-workaround.ts +12 -9
  152. package/src/{plugins/table/__tests__ → __tests__}/unit/pm-plugins/sticky-headers/tableRow.tsx +27 -25
  153. package/src/{plugins/table/__tests__ → __tests__}/unit/pm-plugins/table-local-id.ts +3 -6
  154. package/src/{plugins/table/__tests__ → __tests__}/unit/pm-plugins/table-resizing/colgroup.ts +1 -1
  155. package/src/{plugins/table/__tests__ → __tests__}/unit/pm-plugins/table-resizing/event-handlers.ts +3 -3
  156. package/src/{plugins/table/__tests__ → __tests__}/unit/pm-plugins/table-selection-keymap.ts +3 -3
  157. package/src/{plugins/table/__tests__ → __tests__}/unit/toolbar.ts +23 -14
  158. package/src/__tests__/unit/ui/ContextualMenu.tsx +55 -0
  159. package/src/__tests__/unit/ui/CornerControls.tsx +7 -7
  160. package/src/__tests__/unit/ui/FloatingContextualButton.tsx +45 -49
  161. package/src/__tests__/unit/ui/FloatingContextualMenu.tsx +49 -0
  162. package/src/__tests__/unit/ui/FloatingDeleteButton.tsx +30 -2
  163. package/src/__tests__/unit/ui/FloatingInsertButton.tsx +143 -111
  164. package/src/__tests__/unit/ui/RowControls.tsx +112 -141
  165. package/src/__tests__/unit/ui/TableFloatingControls.tsx +18 -15
  166. package/src/__tests__/unit/undo-redo.ts +10 -9
  167. package/src/{plugins/table/__tests__ → __tests__}/unit/utils/collapse.ts +2 -2
  168. package/src/{plugins/table/__tests__ → __tests__}/unit/utils/column-controls.ts +1 -1
  169. package/src/__tests__/unit/utils/nodes.ts +8 -4
  170. package/src/__tests__/unit/utils/row-controls.ts +8 -4
  171. package/src/{plugins/table/__tests__ → __tests__}/visual-regression/__fixtures__/table-with-100-numbered-list-items.json +0 -0
  172. package/src/{plugins/table/__tests__ → __tests__}/visual-regression/__image_snapshots__/cell-options-menu-ts-table-cell-options-menu-delete-column-menu-item-should-remove-the-table-column-on-click-1-snap.png +0 -0
  173. package/src/{plugins/table/__tests__ → __tests__}/visual-regression/__image_snapshots__/cell-options-menu-ts-table-cell-options-menu-delete-column-menu-item-visual-hints-should-be-added-to-the-table-column-on-hover-1-snap.png +0 -0
  174. package/src/{plugins/table/__tests__ → __tests__}/visual-regression/__image_snapshots__/cell-options-menu-ts-table-cell-options-menu-delete-row-menu-item-should-remove-the-table-row-on-click-1-snap.png +0 -0
  175. package/src/{plugins/table/__tests__ → __tests__}/visual-regression/__image_snapshots__/cell-options-menu-ts-table-cell-options-menu-delete-row-menu-item-visual-hints-should-be-added-to-the-table-row-on-hover-1-snap.png +0 -0
  176. package/src/{plugins/table/__tests__ → __tests__}/visual-regression/__image_snapshots__/copy-button-ts-floating-toolbar-copy-button-table-target-node-displays-blue-border-when-copy-button-is-hovered-1-snap.png +0 -0
  177. package/src/{plugins/table/__tests__ → __tests__}/visual-regression/__image_snapshots__/index-ts-snapshot-test-table-numbered-list-should-not-overflow-table-cell-when-there-are-more-than-100-ordered-list-items-1-snap.png +0 -0
  178. package/src/{plugins/table/__tests__ → __tests__}/visual-regression/__image_snapshots__/index-ts-snapshot-test-table-numbered-list-should-not-overflow-table-cell-when-there-are-more-than-100-ordered-list-items-2-snap.png +0 -0
  179. package/src/{plugins/table/__tests__ → __tests__}/visual-regression/__image_snapshots__/index-ts-snapshot-test-table-numbered-list-should-not-overflow-table-cell-when-there-are-more-than-100-ordered-list-items-3-snap.png +0 -0
  180. package/src/{plugins/table/__tests__ → __tests__}/visual-regression/cell-options-menu.ts +2 -0
  181. package/src/__tests__/visual-regression/copy-button.ts +181 -0
  182. package/src/{plugins/table/__tests__ → __tests__}/visual-regression/index.ts +3 -1
  183. package/src/plugins/table/commands/clear.ts +30 -29
  184. package/src/plugins/table/commands/go-to-next-cell.ts +41 -38
  185. package/src/plugins/table/commands/hover.ts +4 -1
  186. package/src/plugins/table/commands/insert.ts +91 -91
  187. package/src/plugins/table/commands/misc.ts +123 -125
  188. package/src/plugins/table/commands/selection.ts +329 -319
  189. package/src/plugins/table/commands-with-analytics.ts +299 -290
  190. package/src/plugins/table/event-handlers.ts +111 -112
  191. package/src/plugins/table/handlers.ts +95 -95
  192. package/src/plugins/table/index.tsx +28 -2
  193. package/src/plugins/table/nodeviews/OverflowShadowsObserver.ts +4 -3
  194. package/src/plugins/table/nodeviews/TableComponent.tsx +6 -9
  195. package/src/plugins/table/nodeviews/update-overflow-shadows.ts +39 -39
  196. package/src/plugins/table/pm-plugins/decorations/utils/column-controls.ts +7 -9
  197. package/src/plugins/table/pm-plugins/decorations/utils/column-resizing.ts +30 -30
  198. package/src/plugins/table/pm-plugins/decorations/utils/compose-decorations.ts +7 -7
  199. package/src/plugins/table/pm-plugins/keymap.ts +1 -1
  200. package/src/plugins/table/pm-plugins/plugin-factory.ts +33 -33
  201. package/src/plugins/table/pm-plugins/safari-delete-composition-text-issue-workaround.ts +6 -9
  202. package/src/plugins/table/pm-plugins/sticky-headers/nodeviews/tableRow.ts +3 -2
  203. package/src/plugins/table/pm-plugins/table-local-id.ts +0 -2
  204. package/src/plugins/table/pm-plugins/table-resizing/commands.ts +98 -90
  205. package/src/plugins/table/pm-plugins/table-resizing/index.ts +1 -0
  206. package/src/plugins/table/pm-plugins/table-resizing/utils/dom.ts +46 -47
  207. package/src/plugins/table/{toolbar.ts → toolbar.tsx} +276 -101
  208. package/src/plugins/table/transforms/column-width.ts +143 -146
  209. package/src/plugins/table/transforms/delete-columns.ts +144 -142
  210. package/src/plugins/table/transforms/delete-rows.ts +110 -111
  211. package/src/plugins/table/transforms/fix-tables.ts +2 -3
  212. package/src/plugins/table/transforms/metadata.ts +9 -9
  213. package/src/plugins/table/ui/FloatingContextualButton/index.tsx +0 -1
  214. package/src/plugins/table/ui/FloatingContextualMenu/ContextualMenu.tsx +20 -16
  215. package/src/plugins/table/ui/FloatingDeleteButton/index.tsx +3 -3
  216. package/src/plugins/table/ui/FloatingInsertButton/index.tsx +2 -6
  217. package/src/plugins/table/ui/LayoutButton/index.tsx +4 -10
  218. package/src/plugins/table/ui/TableFloatingControls/CornerControls/index.tsx +1 -0
  219. package/src/plugins/table/ui/common-styles.ts +1 -3
  220. package/src/plugins/table/utils/analytics.ts +24 -25
  221. package/src/plugins/table/utils/column-controls.ts +0 -1
  222. package/src/plugins/table/utils/decoration.ts +44 -5
  223. package/src/plugins/table/utils/dom.ts +3 -5
  224. package/src/plugins/table/utils/paste.ts +0 -1
  225. package/src/plugins/table/utils/row-controls.ts +92 -94
  226. package/types/package.json +5 -5
  227. package/ui/common-styles/package.json +14 -0
  228. package/ui/consts/package.json +14 -0
  229. package/dist/cjs/plugins/plugin-key.js +0 -17
  230. package/dist/cjs/plugins/table/todo-stubs.js +0 -10
  231. package/dist/cjs/types.js +0 -5
  232. package/dist/es2019/plugins/plugin-key.js +0 -3
  233. package/dist/es2019/plugins/table/todo-stubs.js +0 -1
  234. package/dist/es2019/types.js +0 -1
  235. package/dist/esm/plugins/plugin-key.js +0 -5
  236. package/dist/esm/plugins/table/todo-stubs.js +0 -1
  237. package/dist/esm/types.js +0 -1
  238. package/dist/types/plugins/plugin-key.d.ts +0 -4
  239. package/dist/types/plugins/table/todo-stubs.d.ts +0 -1
  240. package/dist/types/types.d.ts +0 -3
  241. package/dist/types-ts4.0/index.d.ts +0 -1
  242. package/dist/types-ts4.0/plugins/plugin-key.d.ts +0 -4
  243. package/dist/types-ts4.0/plugins/table/commands/clear.d.ts +0 -3
  244. package/dist/types-ts4.0/plugins/table/commands/collapse.d.ts +0 -2
  245. package/dist/types-ts4.0/plugins/table/commands/go-to-next-cell.d.ts +0 -4
  246. package/dist/types-ts4.0/plugins/table/commands/hover.d.ts +0 -8
  247. package/dist/types-ts4.0/plugins/table/commands/index.d.ts +0 -7
  248. package/dist/types-ts4.0/plugins/table/commands/insert.d.ts +0 -10
  249. package/dist/types-ts4.0/plugins/table/commands/misc.d.ts +0 -27
  250. package/dist/types-ts4.0/plugins/table/commands/selection.d.ts +0 -8
  251. package/dist/types-ts4.0/plugins/table/commands/sort.d.ts +0 -3
  252. package/dist/types-ts4.0/plugins/table/commands/split-cell.d.ts +0 -6
  253. package/dist/types-ts4.0/plugins/table/commands/toggle.d.ts +0 -12
  254. package/dist/types-ts4.0/plugins/table/commands-with-analytics.d.ts +0 -26
  255. package/dist/types-ts4.0/plugins/table/create-plugin-config.d.ts +0 -2
  256. package/dist/types-ts4.0/plugins/table/event-handlers.d.ts +0 -16
  257. package/dist/types-ts4.0/plugins/table/handlers.d.ts +0 -3
  258. package/dist/types-ts4.0/plugins/table/index.d.ts +0 -17
  259. package/dist/types-ts4.0/plugins/table/nodeviews/OverflowShadowsObserver.d.ts +0 -26
  260. package/dist/types-ts4.0/plugins/table/nodeviews/TableComponent.d.ts +0 -72
  261. package/dist/types-ts4.0/plugins/table/nodeviews/__mocks__/OverflowShadowsObserver.d.ts +0 -9
  262. package/dist/types-ts4.0/plugins/table/nodeviews/__mocks__/OverridableMock.d.ts +0 -9
  263. package/dist/types-ts4.0/plugins/table/nodeviews/table.d.ts +0 -31
  264. package/dist/types-ts4.0/plugins/table/nodeviews/tableCell.d.ts +0 -19
  265. package/dist/types-ts4.0/plugins/table/nodeviews/types.d.ts +0 -24
  266. package/dist/types-ts4.0/plugins/table/nodeviews/update-overflow-shadows.d.ts +0 -8
  267. package/dist/types-ts4.0/plugins/table/pm-plugins/decorations/plugin.d.ts +0 -7
  268. package/dist/types-ts4.0/plugins/table/pm-plugins/decorations/utils/column-controls.d.ts +0 -3
  269. package/dist/types-ts4.0/plugins/table/pm-plugins/decorations/utils/column-resizing.d.ts +0 -2
  270. package/dist/types-ts4.0/plugins/table/pm-plugins/decorations/utils/compose-decorations.d.ts +0 -2
  271. package/dist/types-ts4.0/plugins/table/pm-plugins/decorations/utils/index.d.ts +0 -3
  272. package/dist/types-ts4.0/plugins/table/pm-plugins/decorations/utils/types.d.ts +0 -6
  273. package/dist/types-ts4.0/plugins/table/pm-plugins/default-table-selection.d.ts +0 -5
  274. package/dist/types-ts4.0/plugins/table/pm-plugins/keymap.d.ts +0 -5
  275. package/dist/types-ts4.0/plugins/table/pm-plugins/main.d.ts +0 -8
  276. package/dist/types-ts4.0/plugins/table/pm-plugins/plugin-factory.d.ts +0 -1
  277. package/dist/types-ts4.0/plugins/table/pm-plugins/plugin-key.d.ts +0 -3
  278. package/dist/types-ts4.0/plugins/table/pm-plugins/safari-delayed-dom-selection-syncing-workaround.d.ts +0 -4
  279. package/dist/types-ts4.0/plugins/table/pm-plugins/safari-delete-composition-text-issue-workaround.d.ts +0 -15
  280. package/dist/types-ts4.0/plugins/table/pm-plugins/sticky-headers/commands.d.ts +0 -3
  281. package/dist/types-ts4.0/plugins/table/pm-plugins/sticky-headers/index.d.ts +0 -6
  282. package/dist/types-ts4.0/plugins/table/pm-plugins/sticky-headers/nodeviews/dom.d.ts +0 -6
  283. package/dist/types-ts4.0/plugins/table/pm-plugins/sticky-headers/nodeviews/tableRow.d.ts +0 -65
  284. package/dist/types-ts4.0/plugins/table/pm-plugins/sticky-headers/plugin-key.d.ts +0 -3
  285. package/dist/types-ts4.0/plugins/table/pm-plugins/sticky-headers/plugin-state.d.ts +0 -3
  286. package/dist/types-ts4.0/plugins/table/pm-plugins/sticky-headers/plugin.d.ts +0 -4
  287. package/dist/types-ts4.0/plugins/table/pm-plugins/sticky-headers/types.d.ts +0 -16
  288. package/dist/types-ts4.0/plugins/table/pm-plugins/sticky-headers/util.d.ts +0 -2
  289. package/dist/types-ts4.0/plugins/table/pm-plugins/table-local-id.d.ts +0 -22
  290. package/dist/types-ts4.0/plugins/table/pm-plugins/table-resizing/commands.d.ts +0 -25
  291. package/dist/types-ts4.0/plugins/table/pm-plugins/table-resizing/event-handlers.d.ts +0 -4
  292. package/dist/types-ts4.0/plugins/table/pm-plugins/table-resizing/index.d.ts +0 -3
  293. package/dist/types-ts4.0/plugins/table/pm-plugins/table-resizing/plugin-factory.d.ts +0 -4
  294. package/dist/types-ts4.0/plugins/table/pm-plugins/table-resizing/plugin-key.d.ts +0 -3
  295. package/dist/types-ts4.0/plugins/table/pm-plugins/table-resizing/plugin.d.ts +0 -6
  296. package/dist/types-ts4.0/plugins/table/pm-plugins/table-resizing/reducer.d.ts +0 -3
  297. package/dist/types-ts4.0/plugins/table/pm-plugins/table-resizing/utils/colgroup.d.ts +0 -8
  298. package/dist/types-ts4.0/plugins/table/pm-plugins/table-resizing/utils/column-state.d.ts +0 -14
  299. package/dist/types-ts4.0/plugins/table/pm-plugins/table-resizing/utils/content-width.d.ts +0 -4
  300. package/dist/types-ts4.0/plugins/table/pm-plugins/table-resizing/utils/dom.d.ts +0 -13
  301. package/dist/types-ts4.0/plugins/table/pm-plugins/table-resizing/utils/index.d.ts +0 -12
  302. package/dist/types-ts4.0/plugins/table/pm-plugins/table-resizing/utils/misc.d.ts +0 -22
  303. package/dist/types-ts4.0/plugins/table/pm-plugins/table-resizing/utils/resize-column.d.ts +0 -2
  304. package/dist/types-ts4.0/plugins/table/pm-plugins/table-resizing/utils/resize-logic.d.ts +0 -4
  305. package/dist/types-ts4.0/plugins/table/pm-plugins/table-resizing/utils/resize-state.d.ts +0 -29
  306. package/dist/types-ts4.0/plugins/table/pm-plugins/table-resizing/utils/scale-table.d.ts +0 -17
  307. package/dist/types-ts4.0/plugins/table/pm-plugins/table-resizing/utils/types.d.ts +0 -22
  308. package/dist/types-ts4.0/plugins/table/pm-plugins/table-resizing/utils/unit-to-number.d.ts +0 -1
  309. package/dist/types-ts4.0/plugins/table/pm-plugins/table-selection-keymap.d.ts +0 -4
  310. package/dist/types-ts4.0/plugins/table/reducer.d.ts +0 -3
  311. package/dist/types-ts4.0/plugins/table/todo-stubs.d.ts +0 -1
  312. package/dist/types-ts4.0/plugins/table/toolbar.d.ts +0 -36
  313. package/dist/types-ts4.0/plugins/table/transforms/column-width.d.ts +0 -18
  314. package/dist/types-ts4.0/plugins/table/transforms/delete-columns.d.ts +0 -3
  315. package/dist/types-ts4.0/plugins/table/transforms/delete-rows.d.ts +0 -3
  316. package/dist/types-ts4.0/plugins/table/transforms/fix-tables.d.ts +0 -10
  317. package/dist/types-ts4.0/plugins/table/transforms/index.d.ts +0 -7
  318. package/dist/types-ts4.0/plugins/table/transforms/merge.d.ts +0 -5
  319. package/dist/types-ts4.0/plugins/table/transforms/metadata.d.ts +0 -21
  320. package/dist/types-ts4.0/plugins/table/transforms/replace-table.d.ts +0 -5
  321. package/dist/types-ts4.0/plugins/table/transforms/split.d.ts +0 -9
  322. package/dist/types-ts4.0/plugins/table/types.d.ts +0 -328
  323. package/dist/types-ts4.0/plugins/table/ui/FloatingContextualButton/index.d.ts +0 -29
  324. package/dist/types-ts4.0/plugins/table/ui/FloatingContextualButton/styles.d.ts +0 -1
  325. package/dist/types-ts4.0/plugins/table/ui/FloatingContextualMenu/ContextualMenu.d.ts +0 -87
  326. package/dist/types-ts4.0/plugins/table/ui/FloatingContextualMenu/index.d.ts +0 -22
  327. package/dist/types-ts4.0/plugins/table/ui/FloatingContextualMenu/styles.d.ts +0 -2
  328. package/dist/types-ts4.0/plugins/table/ui/FloatingDeleteButton/DeleteButton.d.ts +0 -14
  329. package/dist/types-ts4.0/plugins/table/ui/FloatingDeleteButton/getPopUpOptions.d.ts +0 -10
  330. package/dist/types-ts4.0/plugins/table/ui/FloatingDeleteButton/index.d.ts +0 -54
  331. package/dist/types-ts4.0/plugins/table/ui/FloatingDeleteButton/types.d.ts +0 -1
  332. package/dist/types-ts4.0/plugins/table/ui/FloatingInsertButton/InsertButton.d.ts +0 -12
  333. package/dist/types-ts4.0/plugins/table/ui/FloatingInsertButton/getPopupOptions.d.ts +0 -3
  334. package/dist/types-ts4.0/plugins/table/ui/FloatingInsertButton/index.d.ts +0 -35
  335. package/dist/types-ts4.0/plugins/table/ui/LayoutButton/index.d.ts +0 -21
  336. package/dist/types-ts4.0/plugins/table/ui/TableFloatingControls/CornerControls/index.d.ts +0 -16
  337. package/dist/types-ts4.0/plugins/table/ui/TableFloatingControls/NumberColumn/index.d.ts +0 -21
  338. package/dist/types-ts4.0/plugins/table/ui/TableFloatingControls/RowControls/index.d.ts +0 -17
  339. package/dist/types-ts4.0/plugins/table/ui/TableFloatingControls/index.d.ts +0 -40
  340. package/dist/types-ts4.0/plugins/table/ui/common-styles.d.ts +0 -4
  341. package/dist/types-ts4.0/plugins/table/ui/consts.d.ts +0 -39
  342. package/dist/types-ts4.0/plugins/table/ui/messages.d.ts +0 -38
  343. package/dist/types-ts4.0/plugins/table/ui/ui-styles.d.ts +0 -15
  344. package/dist/types-ts4.0/plugins/table/utils/analytics.d.ts +0 -18
  345. package/dist/types-ts4.0/plugins/table/utils/collapse.d.ts +0 -29
  346. package/dist/types-ts4.0/plugins/table/utils/column-controls.d.ts +0 -10
  347. package/dist/types-ts4.0/plugins/table/utils/decoration.d.ts +0 -16
  348. package/dist/types-ts4.0/plugins/table/utils/dom.d.ts +0 -20
  349. package/dist/types-ts4.0/plugins/table/utils/get-allow-add-column-custom-step.d.ts +0 -2
  350. package/dist/types-ts4.0/plugins/table/utils/index.d.ts +0 -11
  351. package/dist/types-ts4.0/plugins/table/utils/nodes.d.ts +0 -12
  352. package/dist/types-ts4.0/plugins/table/utils/paste.d.ts +0 -14
  353. package/dist/types-ts4.0/plugins/table/utils/referentiality.d.ts +0 -2
  354. package/dist/types-ts4.0/plugins/table/utils/row-controls.d.ts +0 -16
  355. package/dist/types-ts4.0/plugins/table/utils/selection.d.ts +0 -6
  356. package/dist/types-ts4.0/plugins/table/utils/table.d.ts +0 -4
  357. package/dist/types-ts4.0/plugins/table/utils/update-plugin-state-decorations.d.ts +0 -4
  358. package/dist/types-ts4.0/plugins/table-plugin.d.ts +0 -2
  359. package/dist/types-ts4.0/types.d.ts +0 -3
  360. package/src/plugins/plugin-key.ts +0 -7
  361. package/src/plugins/table/__tests__/integration/table-controls-selection.ts +0 -70
  362. package/src/plugins/table/__tests__/unit/event-handlers.ts +0 -130
  363. package/src/plugins/table/__tests__/unit/nodeviews/TableComponent.tsx +0 -388
  364. package/src/plugins/table/todo-stubs.ts +0 -1
  365. package/src/plugins/table/ui/FloatingContextualMenu/__tests__/ContextualMenu.tsx +0 -55
  366. package/src/plugins/table/ui/FloatingContextualMenu/__tests__/FloatingContextualMenu.tsx +0 -49
  367. package/src/types.ts +0 -3
  368. package/tmp/api-report-tmp.d.ts +0 -91
@@ -0,0 +1,181 @@
1
+ import React from 'react';
2
+ import { replaceRaf } from 'raf-stub';
3
+ import { render } from '@testing-library/react';
4
+ import { createEditorFactory } from '@atlaskit/editor-test-helpers/create-editor';
5
+ import tablePlugin from '../../../plugins/table-plugin';
6
+ import {
7
+ doc,
8
+ p,
9
+ table,
10
+ tr,
11
+ td,
12
+ tdEmpty,
13
+ tdCursor,
14
+ DocBuilder,
15
+ } from '@atlaskit/editor-test-helpers/doc-builder';
16
+ import { findTable, selectTable } from '@atlaskit/editor-tables/utils';
17
+ import {
18
+ TableCssClassName as ClassName,
19
+ TablePluginState,
20
+ } from '../../../plugins/table/types';
21
+ import TableComponent from '../../../plugins/table/nodeviews/TableComponent';
22
+
23
+ import { pluginKey } from '../../../plugins/table/pm-plugins/plugin-key';
24
+ import type { EventDispatcher } from '@atlaskit/editor-common/event-dispatcher';
25
+ import { toggleNumberColumn } from '../../../plugins/table/commands';
26
+
27
+ jest.mock('../../../plugins/table/utils/nodes', () =>
28
+ Object.assign({}, jest.requireActual('../../../plugins/table/utils/nodes'), {
29
+ tablesHaveDifferentColumnWidths: jest.fn(),
30
+ }),
31
+ );
32
+
33
+ replaceRaf();
34
+ const requestAnimationFrame = window.requestAnimationFrame as any;
35
+
36
+ describe('table -> nodeviews -> TableComponent.tsx', () => {
37
+ const createEditor = createEditorFactory<TablePluginState>();
38
+ const getEditorFeatureFlags = jest.fn();
39
+ const editor = (
40
+ doc: DocBuilder,
41
+ featureFlags?: { [featureFlag: string]: string | boolean },
42
+ ) => {
43
+ getEditorFeatureFlags.mockReturnValue(featureFlags || {});
44
+ return createEditor({
45
+ doc,
46
+ editorProps: {
47
+ allowTables: false,
48
+ dangerouslyAppendPlugins: {
49
+ __plugins: [tablePlugin()],
50
+ },
51
+ featureFlags,
52
+ },
53
+ pluginKey,
54
+ });
55
+ };
56
+ afterEach(() => {
57
+ jest.clearAllMocks();
58
+ });
59
+
60
+ describe('when the table is selected', () => {
61
+ it('should add table selected css class', () => {
62
+ const { editorView } = editor(
63
+ doc(p('text'), table()(tr(tdEmpty, tdEmpty, tdCursor))),
64
+ {
65
+ tableCellOptimization: true,
66
+ tableRenderOptimization: true,
67
+ stickyHeadersOptimization: true,
68
+ initialRenderOptimization: true,
69
+ },
70
+ );
71
+ const { state, dispatch } = editorView;
72
+ dispatch(selectTable(state.tr));
73
+ requestAnimationFrame.step();
74
+ const tableContainer = document.querySelector(
75
+ `.${ClassName.TABLE_CONTAINER}`,
76
+ );
77
+ expect(
78
+ tableContainer!.classList.contains(ClassName.TABLE_SELECTED),
79
+ ).toBeTruthy();
80
+ });
81
+ });
82
+
83
+ describe('when the numbered column attribute is changed', () => {
84
+ it('should not resize the columns', () => {
85
+ const { editorView } = editor(
86
+ doc(
87
+ table({ isNumberColumnEnabled: false, layout: 'default' })(
88
+ tr(
89
+ td({ colwidth: [1400] })(p('{<>}')),
90
+ td({ colwidth: [48] })(p()),
91
+ td({ colwidth: [48] })(p()),
92
+ ),
93
+ ),
94
+ ),
95
+ );
96
+ const { state, dispatch } = editorView;
97
+ const tableCell = state.schema.nodes.tableCell;
98
+ const columnWidths: number[][] = [];
99
+
100
+ toggleNumberColumn(state, dispatch);
101
+ requestAnimationFrame.step();
102
+
103
+ editorView.state.doc.nodesBetween(3, 14, (node) => {
104
+ if (node.type === tableCell) {
105
+ columnWidths.push(node.attrs.colwidth);
106
+ }
107
+
108
+ return node.type !== tableCell;
109
+ });
110
+
111
+ expect(columnWidths).toEqual([[1400], [48], [48]]);
112
+ });
113
+ });
114
+
115
+ describe('WITH_CONTROLS css class', () => {
116
+ it.each<[string, object, boolean]>([
117
+ [
118
+ 'is added when allowControls is set',
119
+ {
120
+ allowControls: true,
121
+ tableActive: true,
122
+ },
123
+ true,
124
+ ],
125
+ [
126
+ 'is added by default when allowControls is not provided',
127
+ {
128
+ tableActive: true,
129
+ },
130
+ true,
131
+ ],
132
+ [
133
+ 'is not added when allowControls is false',
134
+ {
135
+ allowControls: false,
136
+ tableActive: true,
137
+ },
138
+ false,
139
+ ],
140
+ [
141
+ 'is not added when table is not active',
142
+ {
143
+ allowControls: true,
144
+ tableActive: false,
145
+ },
146
+ false,
147
+ ],
148
+ ])('%s', (_, props, expected) => {
149
+ const { editorView: view } = editor(
150
+ doc(p('text'), table()(tr(td()(p('{<>}text')), tdEmpty, tdEmpty))),
151
+ );
152
+
153
+ const tableF = findTable(view.state.selection);
154
+ const getNode = () => tableF!.node;
155
+ const { container } = render(
156
+ <TableComponent
157
+ view={view}
158
+ eventDispatcher={
159
+ { on: jest.fn(), off: jest.fn() } as unknown as EventDispatcher
160
+ }
161
+ // @ts-ignore
162
+ containerWidth={{}}
163
+ getNode={getNode}
164
+ contentDOM={(contentElement: HTMLElement | null) => {
165
+ const node = view.dom.getElementsByTagName('table')[0];
166
+
167
+ if (!contentElement?.firstChild) {
168
+ contentElement?.appendChild(node);
169
+ }
170
+ }}
171
+ getEditorFeatureFlags={getEditorFeatureFlags}
172
+ {...props}
173
+ />,
174
+ );
175
+ const controlsContainer = container.querySelector(
176
+ `.${ClassName.WITH_CONTROLS}`,
177
+ );
178
+ expect(!!controlsContainer).toBe(expected);
179
+ });
180
+ });
181
+ });
@@ -2,7 +2,11 @@ import {
2
2
  setCellAttrs,
3
3
  findCellClosestToPos,
4
4
  } from '@atlaskit/editor-tables/utils';
5
- import { createEditorFactory } from '@atlaskit/editor-test-helpers/create-editor';
5
+ import {
6
+ createProsemirrorEditorFactory,
7
+ LightEditorPlugin,
8
+ Preset,
9
+ } from '@atlaskit/editor-test-helpers/create-prosemirror-editor';
6
10
  import {
7
11
  doc,
8
12
  p,
@@ -19,13 +23,14 @@ import {
19
23
  rgbToHex,
20
24
  uuid,
21
25
  } from '@atlaskit/adf-schema';
22
- import { TablePluginState, PluginConfig } from '../../../plugins/table/types';
26
+ import { PluginConfig } from '../../../plugins/table/types';
23
27
  import { mergeCells } from '../../../plugins/table/transforms';
24
28
  import { pluginKey } from '../../../plugins/table/pm-plugins/plugin-key';
25
29
  import TableCellViews from '../../../plugins/table/nodeviews/tableCell';
26
30
  import sendKeyToPm from '@atlaskit/editor-test-helpers/send-key-to-pm';
27
31
  import * as domHelpers from '../../../plugins/table/pm-plugins/sticky-headers/nodeviews/dom';
28
32
  import tablePlugin from '../../../plugins/table-plugin';
33
+ import undoRedoPlugin from '@atlaskit/editor-core/src/plugins/undo-redo';
29
34
 
30
35
  jest.mock('@atlaskit/editor-common/utils', () => ({
31
36
  ...jest.requireActual<Object>('@atlaskit/editor-common/utils'),
@@ -36,18 +41,15 @@ jest.mock('@atlaskit/editor-common/utils', () => ({
36
41
 
37
42
  describe('table -> nodeviews -> tableCell.tsx', () => {
38
43
  const TABLE_LOCAL_ID = 'test-table-local-id';
39
- const createEditor = createEditorFactory<TablePluginState>();
44
+ const createEditor = createProsemirrorEditorFactory();
40
45
 
41
46
  const editor = (doc: DocBuilder, props?: PluginConfig) =>
42
47
  createEditor({
43
48
  doc,
44
- editorProps: {
45
- dangerouslyAppendPlugins: {
46
- __plugins: [
47
- tablePlugin({ tableOptions: { advanced: true, ...props } }),
48
- ],
49
- },
50
- },
49
+ attachTo: document.body,
50
+ preset: new Preset<LightEditorPlugin>()
51
+ .add([tablePlugin, { tableOptions: { advanced: true, ...props } }])
52
+ .add(undoRedoPlugin),
51
53
  pluginKey,
52
54
  });
53
55
 
@@ -1,5 +1,9 @@
1
1
  import { Node as PMNode } from 'prosemirror-model';
2
- import { createEditorFactory } from '@atlaskit/editor-test-helpers/create-editor';
2
+ import {
3
+ createProsemirrorEditorFactory,
4
+ LightEditorPlugin,
5
+ Preset,
6
+ } from '@atlaskit/editor-test-helpers/create-prosemirror-editor';
3
7
  import {
4
8
  doc,
5
9
  p,
@@ -11,39 +15,37 @@ import {
11
15
  DocBuilder,
12
16
  } from '@atlaskit/editor-test-helpers/doc-builder';
13
17
  import { TableAttributes } from '@atlaskit/adf-schema';
14
- import { TablePluginState } from '../../../../../plugins/table/types';
15
- import { pluginKey } from '../../../../../plugins/table/pm-plugins/plugin-key';
16
- import tablePlugin from '../../../../../plugins/table';
17
- import TableView from '../../../../../plugins/table/nodeviews/table';
18
+ import { pluginKey } from '../../../plugins/table/pm-plugins/plugin-key';
19
+ import tablePlugin from '../../../plugins/table';
20
+ import TableView from '../../../plugins/table/nodeviews/table';
18
21
  import defaultSchema from '@atlaskit/editor-test-helpers/schema';
19
- import type { EditorProps } from '@atlaskit/editor-core';
20
22
  import { EditorView } from 'prosemirror-view';
21
- import { hoverRows } from '../../../commands';
23
+ import { hoverRows } from '../../../plugins/table/commands';
22
24
 
23
25
  describe('table -> nodeviews -> table.tsx', () => {
24
- const createEditor = createEditorFactory<TablePluginState>();
25
- const createTableNode = (attrs?: TableAttributes) => (...args: any) =>
26
- table(attrs)(...args)(defaultSchema);
27
-
28
- const editor = (doc: DocBuilder, props?: EditorProps) =>
29
- createEditor({
30
- doc,
31
- editorProps: {
32
- allowTables: false,
33
- dangerouslyAppendPlugins: {
34
- __plugins: [tablePlugin()],
35
- },
36
- ...props,
37
- },
38
- pluginKey,
39
- });
40
-
41
- afterEach(() => {
42
- jest.clearAllMocks();
43
- });
26
+ const createEditor = createProsemirrorEditorFactory();
27
+ const createTableNode =
28
+ (attrs?: TableAttributes) =>
29
+ (...args: any) =>
30
+ table(attrs)(...args)(defaultSchema);
44
31
 
45
32
  describe('TableView', () => {
46
33
  describe('with tableRenderOptimization', () => {
34
+ const editor = (doc: DocBuilder) =>
35
+ createEditor({
36
+ doc,
37
+ preset: new Preset<LightEditorPlugin>().add([
38
+ tablePlugin,
39
+ {
40
+ tableOptions: {},
41
+ getEditorFeatureFlags: () => ({
42
+ tableRenderOptimization: true,
43
+ }),
44
+ },
45
+ ]),
46
+ pluginKey,
47
+ });
48
+
47
49
  describe('on view update', () => {
48
50
  let tableNode: PMNode,
49
51
  tableNodeView: TableView,
@@ -58,9 +60,6 @@ describe('table -> nodeviews -> table.tsx', () => {
58
60
  p('text'),
59
61
  table()(tr(tdCursor, tdEmpty), tr(tdEmpty, tdEmpty)),
60
62
  ),
61
- {
62
- featureFlags: { tableRenderOptimization: true },
63
- },
64
63
  );
65
64
  view = editorView;
66
65
  tableNodeView = new TableView({
@@ -9,8 +9,8 @@ import {
9
9
  } from '@atlaskit/editor-test-helpers/doc-builder';
10
10
  import { createEditorState } from '@atlaskit/editor-test-helpers/create-editor-state';
11
11
 
12
- import { buildColumnControlsDecorations } from '../../../../pm-plugins/decorations/utils';
13
- import { TableDecorations } from '../../../../types';
12
+ import { buildColumnControlsDecorations } from '../../../../plugins/table/pm-plugins/decorations/utils';
13
+ import { TableDecorations } from '../../../../plugins/table/types';
14
14
 
15
15
  describe('tables: column controls decorations', () => {
16
16
  describe('#buildColumnControlsDecorations', () => {
@@ -20,15 +20,18 @@ import {
20
20
  DocBuilder,
21
21
  } from '@atlaskit/editor-test-helpers/doc-builder';
22
22
 
23
- import tablePlugin from '../../../../../table';
23
+ import tablePlugin from '../../../../plugins/table';
24
24
  import {
25
25
  hideResizeHandleLine,
26
26
  showResizeHandleLine,
27
- } from '../../../../commands/hover';
28
- import { getDecorations } from '../../../../pm-plugins/decorations/plugin';
29
- import { buildColumnResizingDecorations } from '../../../../pm-plugins/decorations/utils';
30
- import { pluginKey } from '../../../../pm-plugins/plugin-key';
31
- import { TableDecorations, TablePluginState } from '../../../../types';
27
+ } from '../../../../plugins/table/commands/hover';
28
+ import { getDecorations } from '../../../../plugins/table/pm-plugins/decorations/plugin';
29
+ import { buildColumnResizingDecorations } from '../../../../plugins/table/pm-plugins/decorations/utils';
30
+ import { pluginKey } from '../../../../plugins/table/pm-plugins/plugin-key';
31
+ import {
32
+ TableDecorations,
33
+ TablePluginState,
34
+ } from '../../../../plugins/table/types';
32
35
 
33
36
  describe('tables: column resizing decorations', () => {
34
37
  const createEditor = createProsemirrorEditorFactory();
@@ -16,14 +16,14 @@ import {
16
16
  DocBuilder,
17
17
  } from '@atlaskit/editor-test-helpers/doc-builder';
18
18
 
19
- import { selectColumn } from '../../../../commands';
19
+ import { selectColumn } from '../../../../plugins/table/commands';
20
20
  import {
21
21
  getDecorations,
22
22
  handleDocOrSelectionChanged,
23
- } from '../../../../pm-plugins/decorations/plugin';
24
- import { pluginKey } from '../../../../pm-plugins/plugin-key';
25
- import { TableDecorations } from '../../../../types';
26
- import tablePlugin from '../../../../../table';
23
+ } from '../../../../plugins/table/pm-plugins/decorations/plugin';
24
+ import { pluginKey } from '../../../../plugins/table/pm-plugins/plugin-key';
25
+ import { TableDecorations } from '../../../../plugins/table/types';
26
+ import tablePlugin from '../../../../plugins/table';
27
27
 
28
28
  describe('decorations plugin', () => {
29
29
  const createEditor = createProsemirrorEditorFactory();
@@ -15,10 +15,10 @@ import {
15
15
  DocBuilder,
16
16
  } from '@atlaskit/editor-test-helpers/doc-builder';
17
17
 
18
- import tablePlugin from '../../../../table';
19
- import { pluginKey } from '../../../pm-plugins/plugin-key';
20
- import { TablePluginState } from '../../../types';
21
- import { handleDocOrSelectionChanged } from '../../../handlers';
18
+ import tablePlugin from '../../../plugins/table';
19
+ import { pluginKey } from '../../../plugins/table/pm-plugins/plugin-key';
20
+ import { TablePluginState } from '../../../plugins/table/types';
21
+ import { handleDocOrSelectionChanged } from '../../../plugins/table/handlers';
22
22
  import expandPlugin from '@atlaskit/editor-core/src/plugins/expand';
23
23
  import extensionPlugin from '@atlaskit/editor-core/src/plugins/extension';
24
24
 
@@ -15,19 +15,19 @@ import {
15
15
  import { Selection } from 'prosemirror-state';
16
16
  import * as pmUtils from 'prosemirror-utils';
17
17
 
18
- import tablePlugin from '../../../../table';
18
+ import tablePlugin from '../../../plugins/table';
19
19
  import textFormattingPlugin from '@atlaskit/editor-core/src/plugins/text-formatting';
20
- import { pluginKey } from '../../../pm-plugins/plugin-key';
21
- import { getPluginState } from '../../../pm-plugins/plugin-factory';
22
- import { setEditorFocus } from '../../../../table/commands/misc';
23
- import * as miscCommands from '../../../../table/commands/misc';
20
+ import { pluginKey } from '../../../plugins/table/pm-plugins/plugin-key';
21
+ import { getPluginState } from '../../../plugins/table/pm-plugins/plugin-factory';
22
+ import { setEditorFocus } from '../../../plugins/table/commands/misc';
23
+ import * as miscCommands from '../../../plugins/table/commands/misc';
24
24
  import { NodeType } from 'prosemirror-model';
25
25
  import { undo } from 'prosemirror-history';
26
26
  import {
27
27
  toggleHeaderColumn,
28
28
  toggleHeaderRow,
29
29
  toggleNumberColumn,
30
- } from '../../../../table/commands';
30
+ } from '../../../plugins/table/commands';
31
31
 
32
32
  describe('tables: main plugin', () => {
33
33
  const createEditor = createProsemirrorEditorFactory();
@@ -1,4 +1,8 @@
1
- import { createEditorFactory } from '@atlaskit/editor-test-helpers/create-editor';
1
+ import {
2
+ createProsemirrorEditorFactory,
3
+ LightEditorPlugin,
4
+ Preset,
5
+ } from '@atlaskit/editor-test-helpers/create-prosemirror-editor';
2
6
  import {
3
7
  doc,
4
8
  DocBuilder,
@@ -7,21 +11,20 @@ import {
7
11
  td,
8
12
  tr,
9
13
  } from '@atlaskit/editor-test-helpers/doc-builder';
10
- import { pluginKey } from '../../../pm-plugins/plugin-key';
11
- import { TablePluginState } from '../../../types';
14
+ import { pluginKey } from '../../../plugins/table/pm-plugins/plugin-key';
15
+ import tablePlugin from '../../../plugins/table-plugin';
12
16
 
13
17
  describe('table/safari-delete-composition-text-issue-workaround', () => {
14
18
  let editor: any;
15
19
  beforeEach(() => {
16
- const createEditor = createEditorFactory<TablePluginState>();
20
+ const createEditor = createProsemirrorEditorFactory();
17
21
  editor = (doc: DocBuilder) =>
18
22
  createEditor({
19
23
  doc,
20
- editorProps: {
21
- allowTables: {
22
- allowColumnResizing: true,
23
- },
24
- },
24
+ preset: new Preset<LightEditorPlugin>().add([
25
+ tablePlugin,
26
+ { tableOptions: { allowColumnResizing: true } },
27
+ ]),
25
28
  pluginKey,
26
29
  });
27
30
  });
@@ -13,33 +13,36 @@ import {
13
13
  tr,
14
14
  DocBuilder,
15
15
  } from '@atlaskit/editor-test-helpers/doc-builder';
16
- import { TableRowNodeView } from '../../../../pm-plugins/sticky-headers';
17
- import tablePlugin from '../../../../../table';
18
- import { pluginKey } from '../../../../pm-plugins/plugin-key';
16
+ import { TableRowNodeView } from '../../../../plugins/table/pm-plugins/sticky-headers';
17
+ import tablePlugin from '../../../../plugins/table';
18
+ import { pluginKey } from '../../../../plugins/table/pm-plugins/plugin-key';
19
19
  import type { EventDispatcher } from '@atlaskit/editor-common/event-dispatcher';
20
20
  import createStub, { Stub } from 'raf-stub';
21
21
  import featureFlagsPlugin from '@atlaskit/editor-core/src/plugins/feature-flags-context';
22
- jest.mock('../../../../pm-plugins/sticky-headers/commands', () => ({
23
- ...jest.requireActual<Object>(
24
- '../../../../pm-plugins/sticky-headers/commands',
25
- ),
26
- updateStickyState: jest.fn(() => jest.fn()),
27
- }));
22
+ jest.mock(
23
+ '../../../../plugins/table/pm-plugins/sticky-headers/commands',
24
+ () => ({
25
+ ...jest.requireActual<Object>(
26
+ '../../../../plugins/table/pm-plugins/sticky-headers/commands',
27
+ ),
28
+ updateStickyState: jest.fn(() => jest.fn()),
29
+ }),
30
+ );
28
31
  jest.mock('@atlaskit/editor-common/ui', () => ({
29
32
  ...jest.requireActual<Object>('@atlaskit/editor-common/ui'),
30
33
  findOverflowScrollParent: jest.fn(() => jest.fn()),
31
34
  }));
32
35
 
33
36
  import { findOverflowScrollParent } from '@atlaskit/editor-common/ui';
34
- import { updateStickyState } from '../../../../pm-plugins/sticky-headers/commands';
35
- import { TableCssClassName } from '../../../../types';
36
- import TableComponent from '../../../../nodeviews/TableComponent';
37
+ import { updateStickyState } from '../../../../plugins/table/pm-plugins/sticky-headers/commands';
38
+ import { TableCssClassName } from '../../../../plugins/table/types';
39
+ import TableComponent from '../../../../plugins/table/nodeviews/TableComponent';
37
40
  import React from 'react';
38
41
  import { render, screen } from '@testing-library/react';
39
42
  import {
40
43
  stickyRowOffsetTop,
41
44
  tableScrollbarOffset,
42
- } from '../../../../ui/consts';
45
+ } from '../../../../plugins/table/ui/consts';
43
46
 
44
47
  describe('TableRowNodeView', () => {
45
48
  let tableRowNodeView: TableRowNodeView;
@@ -358,10 +361,9 @@ describe('TableRowNodeView', () => {
358
361
  }
359
362
 
360
363
  function mockScrollPositions(tableRowDom: HTMLTableRowElement) {
361
- const { tableWrapper, tableParent, scrollContainer } = getTableElements(
362
- tableRowDom,
363
- );
364
- ((findOverflowScrollParent as unknown) as jest.SpyInstance).mockReturnValue(
364
+ const { tableWrapper, tableParent, scrollContainer } =
365
+ getTableElements(tableRowDom);
366
+ (findOverflowScrollParent as unknown as jest.SpyInstance).mockReturnValue(
365
367
  scrollContainer,
366
368
  );
367
369
 
@@ -406,11 +408,11 @@ describe('TableRowNodeView', () => {
406
408
  contentDOM={
407
409
  disableContentDomMock
408
410
  ? jest.fn()
409
- : (wrapper: HTMLElement | null) => {
411
+ : (table: HTMLElement | null) => {
410
412
  const node = editorView.dom.getElementsByTagName('table')[0];
411
413
 
412
- if (!wrapper?.firstChild) {
413
- wrapper?.appendChild(node);
414
+ if (!table?.firstChild) {
415
+ table?.appendChild(node);
414
416
  }
415
417
  }
416
418
  }
@@ -436,8 +438,8 @@ describe('TableRowNodeView', () => {
436
438
  expect(sentinelBottom).toBeTruthy();
437
439
  });
438
440
 
439
- describe('updates sticky header state', () => {
440
- it('top sentinel does nothing if the rootBounds has height 0', () => {
441
+ describe('updates sticky header', () => {
442
+ it('does not update sticky header if trigger is sentinel top in confluence preview mode', () => {
441
443
  renderTableComponent();
442
444
  const sentinelTop = screen.getByTestId('sticky-sentinel-top');
443
445
 
@@ -451,7 +453,7 @@ describe('TableRowNodeView', () => {
451
453
  expect(updateStickyState).not.toHaveBeenCalled();
452
454
  });
453
455
 
454
- it('bottom sentinel does nothing if the rootBounds has height 0', () => {
456
+ it('does not update sticky header if trigger is sentinel bottom in confluence preview mode', () => {
455
457
  renderTableComponent();
456
458
  const sentinelBottom = screen.getByTestId('sticky-sentinel-bottom');
457
459
  triggerElementIntersect({
@@ -464,7 +466,7 @@ describe('TableRowNodeView', () => {
464
466
  expect(updateStickyState).not.toHaveBeenCalled();
465
467
  });
466
468
 
467
- it('updates sticky header when top of sticky header sentinel leaves scroll area', () => {
469
+ it('updates sticky header when sentinel is below scroll area', () => {
468
470
  renderTableComponent();
469
471
  const sentinelTop = screen.getByTestId('sticky-sentinel-top');
470
472
 
@@ -499,7 +501,7 @@ describe('TableRowNodeView', () => {
499
501
  );
500
502
  });
501
503
 
502
- it('updates sticky header when bottom of sticky header sentinel enters or leaves scroll area', () => {
504
+ it('updates sticky header when sentinel is above scroll area', () => {
503
505
  renderTableComponent();
504
506
  const sentinelBottom = screen.getByTestId('sticky-sentinel-bottom');
505
507
 
@@ -7,7 +7,7 @@ import dispatchPasteEvent from '@atlaskit/editor-test-helpers/dispatch-paste-eve
7
7
  import { insertText } from '@atlaskit/editor-test-helpers/transactions';
8
8
  import { replaceRaf } from 'raf-stub';
9
9
 
10
- import { handleCut } from '../../../event-handlers';
10
+ import { handleCut } from '../../../plugins/table/event-handlers';
11
11
 
12
12
  import {
13
13
  doc,
@@ -21,11 +21,8 @@ import {
21
21
  th,
22
22
  DocBuilder,
23
23
  } from '@atlaskit/editor-test-helpers/doc-builder';
24
- import {
25
- TablePluginState,
26
- PluginConfig,
27
- } from '../../../../../plugins/table/types';
28
- import { pluginKey as tablePluginKey } from '../../../../../plugins/table/pm-plugins/plugin-key';
24
+ import { TablePluginState, PluginConfig } from '../../../plugins/table/types';
25
+ import { pluginKey as tablePluginKey } from '../../../plugins/table/pm-plugins/plugin-key';
29
26
  import { CellSelection } from '@atlaskit/editor-tables';
30
27
 
31
28
  import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
@@ -1,6 +1,6 @@
1
1
  import { p, table, tr, td } from '@atlaskit/editor-test-helpers/doc-builder';
2
2
  import defaultSchema from '@atlaskit/editor-test-helpers/schema';
3
- import { generateColgroup } from '../../../../pm-plugins/table-resizing/utils';
3
+ import { generateColgroup } from '../../../../plugins/table/pm-plugins/table-resizing/utils';
4
4
 
5
5
  describe('table-resizing/colgroup', () => {
6
6
  describe('#generateColgroup', () => {
@@ -3,7 +3,7 @@ import {
3
3
  LightEditorPlugin,
4
4
  Preset,
5
5
  } from '@atlaskit/editor-test-helpers/create-prosemirror-editor';
6
- import { setResizeHandlePos } from '../../../../../../plugins/table/pm-plugins/table-resizing/commands';
6
+ import { setResizeHandlePos } from '../../../../plugins/table/pm-plugins/table-resizing/commands';
7
7
  import {
8
8
  doc,
9
9
  table,
@@ -19,8 +19,8 @@ import {
19
19
  TABLE_ACTION,
20
20
  } from '@atlaskit/editor-common/analytics';
21
21
 
22
- import tablePlugin from '../../../../../table';
23
- import { pluginKey } from '../../../../pm-plugins/plugin-key';
22
+ import tablePlugin from '../../../../plugins/table';
23
+ import { pluginKey } from '../../../../plugins/table/pm-plugins/plugin-key';
24
24
  import { TextSelection, NodeSelection } from 'prosemirror-state';
25
25
  import panelPlugin from '@atlaskit/editor-core/src/plugins/panel';
26
26
  import widthPlugin from '@atlaskit/editor-core/src/plugins/width';
@@ -23,9 +23,9 @@ import { uuid } from '@atlaskit/adf-schema';
23
23
  import selectionPlugin from '@atlaskit/editor-core/src/plugins/selection';
24
24
  import panelPlugin from '@atlaskit/editor-core/src/plugins/panel';
25
25
  import codeBlockPlugin from '@atlaskit/editor-core/src/plugins/code-block';
26
- import tablePlugin from '../../../index';
27
- import { TablePluginState } from '../../../types';
28
- import { pluginKey } from '../../../pm-plugins/plugin-key';
26
+ import tablePlugin from '../../../plugins/table';
27
+ import { TablePluginState } from '../../../plugins/table/types';
28
+ import { pluginKey } from '../../../plugins/table/pm-plugins/plugin-key';
29
29
  import { createEditorSelectionAPI } from '@atlaskit/editor-core/src/selection-api/api';
30
30
  import type { EditorSelectionAPI } from '@atlaskit/editor-common/selection';
31
31