@atlaskit/editor-plugin-table 0.0.9 → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (219) hide show
  1. package/.eslintrc.js +35 -0
  2. package/CHANGELOG.md +29 -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/DeleteButton.js +1 -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/DeleteButton.js +2 -3
  34. package/dist/es2019/plugins/table/ui/FloatingDeleteButton/index.js +1 -2
  35. package/dist/es2019/plugins/table/ui/FloatingInsertButton/index.js +1 -2
  36. package/dist/es2019/plugins/table/ui/LayoutButton/index.js +3 -5
  37. package/dist/es2019/plugins/table/ui/TableFloatingControls/CornerControls/index.js +2 -1
  38. package/dist/es2019/plugins/table/utils/column-controls.js +0 -1
  39. package/dist/es2019/plugins/table/utils/decoration.js +60 -25
  40. package/dist/es2019/plugins/table/utils/dom.js +0 -2
  41. package/dist/es2019/plugins/table/utils/paste.js +1 -2
  42. package/dist/es2019/plugins/table/utils/row-controls.js +1 -2
  43. package/dist/es2019/version.json +1 -1
  44. package/dist/esm/plugins/table/commands/hover.js +4 -4
  45. package/dist/esm/plugins/table/commands-with-analytics.js +56 -55
  46. package/dist/esm/plugins/table/event-handlers.js +1 -2
  47. package/dist/esm/plugins/table/handlers.js +1 -2
  48. package/dist/esm/plugins/table/index.js +55 -38
  49. package/dist/esm/plugins/table/pm-plugins/keymap.js +1 -1
  50. package/dist/esm/plugins/table/pm-plugins/table-local-id.js +1 -3
  51. package/dist/esm/plugins/table/pm-plugins/table-resizing/index.js +2 -1
  52. package/dist/esm/plugins/table/toolbar.js +139 -17
  53. package/dist/esm/plugins/table/transforms/fix-tables.js +2 -4
  54. package/dist/esm/plugins/table/ui/FloatingContextualButton/index.js +1 -2
  55. package/dist/esm/plugins/table/ui/FloatingContextualMenu/ContextualMenu.js +4 -6
  56. package/dist/esm/plugins/table/ui/FloatingDeleteButton/DeleteButton.js +2 -3
  57. package/dist/esm/plugins/table/ui/FloatingDeleteButton/index.js +1 -2
  58. package/dist/esm/plugins/table/ui/FloatingInsertButton/index.js +1 -2
  59. package/dist/esm/plugins/table/ui/LayoutButton/index.js +3 -5
  60. package/dist/esm/plugins/table/ui/TableFloatingControls/CornerControls/index.js +2 -1
  61. package/dist/esm/plugins/table/utils/column-controls.js +0 -1
  62. package/dist/esm/plugins/table/utils/decoration.js +50 -4
  63. package/dist/esm/plugins/table/utils/dom.js +0 -2
  64. package/dist/esm/plugins/table/utils/paste.js +1 -2
  65. package/dist/esm/plugins/table/utils/row-controls.js +1 -2
  66. package/dist/esm/version.json +1 -1
  67. package/dist/types/plugins/table/commands-with-analytics.d.ts +5 -5
  68. package/dist/types/plugins/table/pm-plugins/table-resizing/index.d.ts +1 -0
  69. package/dist/types/plugins/table/toolbar.d.ts +2 -2
  70. package/dist/types/plugins/table/transforms/fix-tables.d.ts +1 -1
  71. package/dist/types/plugins/table/utils/decoration.d.ts +1 -1
  72. package/dist/types-ts4.0/plugins/table/commands-with-analytics.d.ts +5 -5
  73. package/dist/types-ts4.0/plugins/table/pm-plugins/table-resizing/index.d.ts +1 -0
  74. package/dist/types-ts4.0/plugins/table/toolbar.d.ts +2 -2
  75. package/dist/types-ts4.0/plugins/table/transforms/fix-tables.d.ts +1 -1
  76. package/dist/types-ts4.0/plugins/table/utils/decoration.d.ts +1 -1
  77. package/examples/config.jsonc +14 -0
  78. package/package.json +15 -11
  79. package/plugin-key/package.json +14 -0
  80. package/report.api.md +1 -1
  81. package/src/{plugins/table/__tests__ → __tests__}/integration/__fixtures__/auto-size-documents.ts +0 -0
  82. package/src/{plugins/table/__tests__ → __tests__}/integration/__fixtures__/basic-table.ts +0 -0
  83. package/src/{plugins/table/__tests__ → __tests__}/integration/__fixtures__/empty-paragraph-underneath-table.ts +0 -0
  84. package/src/{plugins/table/__tests__ → __tests__}/integration/__fixtures__/even-columns.ts +0 -0
  85. package/src/{plugins/table/__tests__ → __tests__}/integration/__fixtures__/layout-documents.ts +0 -0
  86. package/src/{plugins/table/__tests__ → __tests__}/integration/__fixtures__/merged-rows-and-cols-document.ts +0 -0
  87. package/src/{plugins/table/__tests__ → __tests__}/integration/__fixtures__/nested-in-extension.ts +0 -0
  88. package/src/{plugins/table/__tests__ → __tests__}/integration/__fixtures__/paragraph-and-table-adf.json +0 -0
  89. package/src/{plugins/table/__tests__ → __tests__}/integration/__fixtures__/resize-documents.ts +0 -0
  90. package/src/{plugins/table/__tests__ → __tests__}/integration/__fixtures__/scale.ts +0 -0
  91. package/src/{plugins/table/__tests__ → __tests__}/integration/__fixtures__/table-inside-layout.ts +0 -0
  92. package/src/{plugins/table/__tests__ → __tests__}/integration/__fixtures__/table-with-min-width-columns-document.ts +0 -0
  93. package/src/{plugins/table/__tests__ → __tests__}/integration/__fixtures__/table-with-multiline-date.adf.json +0 -0
  94. package/src/{plugins/table/__tests__ → __tests__}/integration/__fixtures__/table-with-text-and-empty-row.ts +0 -0
  95. package/src/{plugins/table/__tests__ → __tests__}/integration/__snapshots__/auto-size.ts.snap +0 -0
  96. package/src/{plugins/table/__tests__ → __tests__}/integration/__snapshots__/change-date-inside-table.ts.snap +0 -0
  97. package/src/{plugins/table/__tests__ → __tests__}/integration/__snapshots__/copy-button.ts.snap +0 -0
  98. package/src/{plugins/table/__tests__ → __tests__}/integration/__snapshots__/delete-columns.ts.snap +0 -0
  99. package/src/{plugins/table/__tests__ → __tests__}/integration/__snapshots__/delete-last-column-in-full-width.ts.snap +0 -0
  100. package/src/{plugins/table/__tests__ → __tests__}/integration/__snapshots__/delete-last-column-with-empty-action.ts.snap +0 -0
  101. package/src/{plugins/table/__tests__ → __tests__}/integration/__snapshots__/delete-last-row-with-empty-action.ts.snap +0 -0
  102. package/src/{plugins/table/__tests__ → __tests__}/integration/__snapshots__/delete-rows.ts.snap +0 -0
  103. package/src/{plugins/table/__tests__ → __tests__}/integration/__snapshots__/delete-table-when-selected.ts.snap +0 -0
  104. package/src/{plugins/table/__tests__ → __tests__}/integration/__snapshots__/deleting-empty-paragraph-under-table.ts.snap +0 -0
  105. package/src/{plugins/table/__tests__ → __tests__}/integration/__snapshots__/even-columns.ts.snap +0 -0
  106. package/src/{plugins/table/__tests__ → __tests__}/integration/__snapshots__/insert-cell-header-with-strong-mark.ts.snap +0 -0
  107. package/src/{plugins/table/__tests__ → __tests__}/integration/__snapshots__/insert-row-inside-layout.ts.snap +0 -0
  108. package/src/{plugins/table/__tests__ → __tests__}/integration/__snapshots__/layout.ts.snap +0 -0
  109. package/src/{plugins/table/__tests__ → __tests__}/integration/__snapshots__/resize.ts.snap +0 -0
  110. package/src/{plugins/table/__tests__ → __tests__}/integration/__snapshots__/scale.ts.snap +0 -0
  111. package/src/{plugins/table/__tests__ → __tests__}/integration/arrow-down-into-table.ts +0 -0
  112. package/src/{plugins/table/__tests__ → __tests__}/integration/auto-size.ts +0 -0
  113. package/src/{plugins/table/__tests__ → __tests__}/integration/block-node-selection.ts +1 -0
  114. package/src/{plugins/table/__tests__ → __tests__}/integration/cell-selection.ts +0 -0
  115. package/src/{plugins/table/__tests__ → __tests__}/integration/change-date-inside-table.ts +0 -0
  116. package/src/{plugins/table/__tests__ → __tests__}/integration/copy-button.ts +1 -1
  117. package/src/{plugins/table/__tests__ → __tests__}/integration/delete-columns.ts +2 -2
  118. package/src/{plugins/table/__tests__ → __tests__}/integration/delete-last-column-in-full-width.ts +1 -1
  119. package/src/{plugins/table/__tests__ → __tests__}/integration/delete-last-column-with-empty-action.ts +1 -1
  120. package/src/{plugins/table/__tests__ → __tests__}/integration/delete-last-row-with-empty-action.ts +1 -1
  121. package/src/{plugins/table/__tests__ → __tests__}/integration/delete-rows.ts +2 -2
  122. package/src/{plugins/table/__tests__ → __tests__}/integration/delete-table-when-selected.ts +0 -0
  123. package/src/{plugins/table/__tests__ → __tests__}/integration/deleting-empty-paragraph-under-table.ts +0 -0
  124. package/src/{plugins/table/__tests__ → __tests__}/integration/even-columns.ts +0 -0
  125. package/src/{plugins/table/__tests__ → __tests__}/integration/insert-cell-header-with-strong-mark.ts +0 -0
  126. package/src/{plugins/table/__tests__ → __tests__}/integration/insert-long-smart-link.ts +1 -0
  127. package/src/{plugins/table/__tests__ → __tests__}/integration/insert-row-inside-layout.ts +0 -0
  128. package/src/{plugins/table/__tests__ → __tests__}/integration/layout.ts +0 -0
  129. package/src/{plugins/table/__tests__ → __tests__}/integration/resize-handler.ts +0 -0
  130. package/src/{plugins/table/__tests__ → __tests__}/integration/resize.ts +1 -1
  131. package/src/{plugins/table/__tests__ → __tests__}/integration/scale.ts +0 -0
  132. package/src/__tests__/integration/table-controls-selection.ts +71 -0
  133. package/src/__tests__/unit/analytics.ts +8 -9
  134. package/src/{plugins/table/__tests__ → __tests__}/unit/commands/go-to-next-cell.ts +4 -4
  135. package/src/{plugins/table/__tests__ → __tests__}/unit/commands/insert.ts +4 -4
  136. package/src/{plugins/table/__tests__ → __tests__}/unit/commands/misc.ts +12 -6
  137. package/src/{plugins/table/__tests__ → __tests__}/unit/commands.ts +7 -7
  138. package/src/__tests__/unit/copy-button.ts +22 -0
  139. package/src/__tests__/unit/event-handlers.ts +120 -1
  140. package/src/{plugins/table/__tests__ → __tests__}/unit/get-toolbar-config.ts +8 -3
  141. package/src/{plugins/table/__tests__ → __tests__}/unit/nodeviews/OverflowShadowsObserver.ts +2 -2
  142. package/src/{plugins/table/__tests__ → __tests__}/unit/nodeviews/TableComponent.tsx +11 -11
  143. package/src/{plugins/table/__tests__ → __tests__}/unit/nodeviews/table.ts +5 -5
  144. package/src/{plugins/table/__tests__ → __tests__}/unit/pm-plugins/decorations/column-controls.ts +2 -2
  145. package/src/{plugins/table/__tests__ → __tests__}/unit/pm-plugins/decorations/column-resizing.ts +9 -6
  146. package/src/{plugins/table/__tests__ → __tests__}/unit/pm-plugins/decorations/plugin.ts +5 -5
  147. package/src/{plugins/table/__tests__ → __tests__}/unit/pm-plugins/main-with-allow-collapse.ts +4 -4
  148. package/src/{plugins/table/__tests__ → __tests__}/unit/pm-plugins/main.ts +6 -6
  149. package/src/{plugins/table/__tests__ → __tests__}/unit/pm-plugins/safari-delete-composition-text-issue-workaround.ts +2 -2
  150. package/src/{plugins/table/__tests__ → __tests__}/unit/pm-plugins/sticky-headers/tableRow.tsx +16 -13
  151. package/src/{plugins/table/__tests__ → __tests__}/unit/pm-plugins/table-local-id.ts +3 -6
  152. package/src/{plugins/table/__tests__ → __tests__}/unit/pm-plugins/table-resizing/colgroup.ts +1 -1
  153. package/src/{plugins/table/__tests__ → __tests__}/unit/pm-plugins/table-resizing/event-handlers.ts +3 -3
  154. package/src/{plugins/table/__tests__ → __tests__}/unit/pm-plugins/table-selection-keymap.ts +3 -3
  155. package/src/{plugins/table/__tests__ → __tests__}/unit/toolbar.ts +5 -9
  156. package/src/__tests__/unit/ui/DeleteButton.tsx +35 -0
  157. package/src/__tests__/unit/ui/FloatingDeleteButton.tsx +26 -64
  158. package/src/{plugins/table/__tests__ → __tests__}/unit/utils/collapse.ts +2 -2
  159. package/src/{plugins/table/__tests__ → __tests__}/unit/utils/column-controls.ts +1 -1
  160. package/src/{plugins/table/__tests__ → __tests__}/visual-regression/__fixtures__/table-with-100-numbered-list-items.json +0 -0
  161. 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
  162. 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
  163. 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
  164. 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
  165. 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
  166. 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
  167. 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
  168. 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
  169. package/src/{plugins/table/__tests__ → __tests__}/visual-regression/cell-options-menu.ts +2 -0
  170. package/src/__tests__/visual-regression/copy-button.ts +181 -0
  171. package/src/{plugins/table/__tests__ → __tests__}/visual-regression/index.ts +3 -1
  172. package/src/plugins/table/commands/hover.ts +4 -1
  173. package/src/plugins/table/commands-with-analytics.ts +12 -8
  174. package/src/plugins/table/event-handlers.ts +0 -1
  175. package/src/plugins/table/handlers.ts +0 -1
  176. package/src/plugins/table/index.tsx +28 -2
  177. package/src/plugins/table/pm-plugins/keymap.ts +1 -1
  178. package/src/plugins/table/pm-plugins/table-local-id.ts +0 -2
  179. package/src/plugins/table/pm-plugins/table-resizing/index.ts +1 -0
  180. package/src/plugins/table/{toolbar.ts → toolbar.tsx} +186 -14
  181. package/src/plugins/table/transforms/fix-tables.ts +2 -3
  182. package/src/plugins/table/ui/FloatingContextualButton/index.tsx +0 -1
  183. package/src/plugins/table/ui/FloatingContextualMenu/ContextualMenu.tsx +13 -10
  184. package/src/plugins/table/ui/FloatingContextualMenu/__tests__/ContextualMenu.tsx +1 -0
  185. package/src/plugins/table/ui/FloatingContextualMenu/__tests__/FloatingContextualMenu.tsx +1 -0
  186. package/src/plugins/table/ui/FloatingDeleteButton/DeleteButton.tsx +1 -2
  187. package/src/plugins/table/ui/FloatingDeleteButton/index.tsx +0 -1
  188. package/src/plugins/table/ui/FloatingInsertButton/index.tsx +0 -1
  189. package/src/plugins/table/ui/LayoutButton/index.tsx +2 -4
  190. package/src/plugins/table/ui/TableFloatingControls/CornerControls/index.tsx +1 -0
  191. package/src/plugins/table/utils/column-controls.ts +0 -1
  192. package/src/plugins/table/utils/decoration.ts +44 -5
  193. package/src/plugins/table/utils/dom.ts +0 -2
  194. package/src/plugins/table/utils/paste.ts +0 -1
  195. package/src/plugins/table/utils/row-controls.ts +0 -1
  196. package/types/package.json +5 -5
  197. package/ui/common-styles/package.json +14 -0
  198. package/ui/consts/package.json +14 -0
  199. package/dist/cjs/plugins/plugin-key.js +0 -17
  200. package/dist/cjs/plugins/table/todo-stubs.js +0 -10
  201. package/dist/cjs/types.js +0 -5
  202. package/dist/es2019/plugins/plugin-key.js +0 -3
  203. package/dist/es2019/plugins/table/todo-stubs.js +0 -1
  204. package/dist/es2019/types.js +0 -1
  205. package/dist/esm/plugins/plugin-key.js +0 -5
  206. package/dist/esm/plugins/table/todo-stubs.js +0 -1
  207. package/dist/esm/types.js +0 -1
  208. package/dist/types/plugins/plugin-key.d.ts +0 -4
  209. package/dist/types/plugins/table/todo-stubs.d.ts +0 -1
  210. package/dist/types/types.d.ts +0 -3
  211. package/dist/types-ts4.0/plugins/plugin-key.d.ts +0 -4
  212. package/dist/types-ts4.0/plugins/table/todo-stubs.d.ts +0 -1
  213. package/dist/types-ts4.0/types.d.ts +0 -3
  214. package/src/plugins/plugin-key.ts +0 -7
  215. package/src/plugins/table/__tests__/integration/table-controls-selection.ts +0 -70
  216. package/src/plugins/table/__tests__/unit/event-handlers.ts +0 -130
  217. package/src/plugins/table/todo-stubs.ts +0 -1
  218. package/src/types.ts +0 -3
  219. package/tmp/api-report-tmp.d.ts +0 -91
@@ -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();
@@ -7,8 +7,8 @@ import {
7
7
  td,
8
8
  tr,
9
9
  } from '@atlaskit/editor-test-helpers/doc-builder';
10
- import { pluginKey } from '../../../pm-plugins/plugin-key';
11
- import { TablePluginState } from '../../../types';
10
+ import { pluginKey } from '../../../plugins/table/pm-plugins/plugin-key';
11
+ import { TablePluginState } from '../../../plugins/table/types';
12
12
 
13
13
  describe('table/safari-delete-composition-text-issue-workaround', () => {
14
14
  let editor: any;
@@ -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;
@@ -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
 
@@ -1,8 +1,8 @@
1
1
  import {
2
2
  getToolbarMenuConfig,
3
3
  getToolbarCellOptionsConfig,
4
- } from '../../toolbar';
5
- import { ToolbarMenuConfig, ToolbarMenuState } from '../../types';
4
+ } from '../../plugins/table/toolbar';
5
+ import { ToolbarMenuConfig, ToolbarMenuState } from '../../plugins/table/types';
6
6
  import { createEditorState } from '@atlaskit/editor-test-helpers/create-editor-state';
7
7
  import {
8
8
  doc,
@@ -17,11 +17,11 @@ import type {
17
17
  FloatingToolbarDropdown,
18
18
  } from '@atlaskit/editor-common/types';
19
19
  import { splitCell } from '@atlaskit/editor-tables/utils';
20
- import { canMergeCells } from '../../transforms';
20
+ import { canMergeCells } from '../../plugins/table/transforms';
21
21
  import { Rect } from '@atlaskit/editor-tables/table-map';
22
22
 
23
23
  jest.mock('@atlaskit/editor-tables/utils');
24
- jest.mock('../../transforms');
24
+ jest.mock('../../plugins/table/transforms');
25
25
 
26
26
  const formatMessage: (t: unknown) => string = (id) => 'Lorem ipsum';
27
27
  const ctx = { formatMessage };
@@ -133,7 +133,7 @@ describe('getToolbarMenuConfig', () => {
133
133
  describe('getToolbarCellOptionsConfig', () => {
134
134
  const state = createEditorState(doc(table()(row(td()(p('1{cursor}'))))));
135
135
  const getEditorContainerWidth = () => ({ width: 500 });
136
- //
136
+
137
137
  const formatMessage: (t: { id: string }) => string = (message) =>
138
138
  `${message.id}`;
139
139
  const rect = new Rect(1, 1, 1, 1);
@@ -146,10 +146,6 @@ describe('getToolbarCellOptionsConfig', () => {
146
146
  getEditorContainerWidth,
147
147
  undefined,
148
148
  );
149
- //
150
- it('is hidden by default', () => {
151
- expect(cellOptionsMenu.hidden).toBe(true);
152
- });
153
149
 
154
150
  it('is a dropdown with the following dropdown items with the given order', () => {
155
151
  const items = cellOptionsMenu.options as Array<DropdownOptionT<Command>>;
@@ -0,0 +1,35 @@
1
+ import React from 'react';
2
+ import { render, screen, fireEvent } from '@testing-library/react';
3
+ import { IntlProvider } from 'react-intl-next';
4
+ import DeleteButton from '../../../plugins/table/ui/FloatingDeleteButton/DeleteButton';
5
+ import tableMessages from '../../../plugins/table/ui/messages';
6
+
7
+ describe('<DeleteButton />', () => {
8
+ it('should fire the onMouseEnter callback', () => {
9
+ const onMouseEnter = jest.fn();
10
+ render(
11
+ <IntlProvider locale="en">
12
+ <DeleteButton
13
+ removeLabel={tableMessages.removeColumns}
14
+ onMouseEnter={onMouseEnter}
15
+ />
16
+ </IntlProvider>,
17
+ );
18
+ fireEvent.mouseEnter(screen.getByLabelText('Delete column'));
19
+ expect(onMouseEnter).toHaveBeenCalled();
20
+ });
21
+
22
+ it('should fire the onMouseLeave callback', () => {
23
+ const onMouseLeave = jest.fn();
24
+ render(
25
+ <IntlProvider locale="en">
26
+ <DeleteButton
27
+ removeLabel={tableMessages.removeColumns}
28
+ onMouseLeave={onMouseLeave}
29
+ />
30
+ </IntlProvider>,
31
+ );
32
+ fireEvent.mouseLeave(screen.getByLabelText('Delete column'));
33
+ expect(onMouseLeave).toHaveBeenCalled();
34
+ });
35
+ });
@@ -1,5 +1,4 @@
1
1
  import { createEditorFactory } from '@atlaskit/editor-test-helpers/create-editor';
2
- import { mountWithIntl } from '@atlaskit/editor-test-helpers/enzyme';
3
2
  import {
4
3
  doc,
5
4
  table,
@@ -10,10 +9,11 @@ import {
10
9
  DocBuilder,
11
10
  } from '@atlaskit/editor-test-helpers/doc-builder';
12
11
  import { selectColumns, selectRows } from '@atlaskit/editor-test-helpers/table';
13
- import { ReactWrapper } from 'enzyme';
14
12
  import { selectTable } from '@atlaskit/editor-tables/utils';
15
13
  import { EditorView } from 'prosemirror-view';
16
14
  import React from 'react';
15
+ import { render, screen } from '@testing-library/react';
16
+ import { IntlProvider } from 'react-intl-next';
17
17
  import {
18
18
  TablePluginState,
19
19
  TableCssClassName,
@@ -21,8 +21,6 @@ import {
21
21
  import FloatingDeleteButton, {
22
22
  Props as FloatingDeleteButtonProps,
23
23
  } from '../../../plugins/table/ui/FloatingDeleteButton';
24
- import DeleteButton from '../../../plugins/table/ui/FloatingDeleteButton/DeleteButton';
25
- import tableMessages from '../../../plugins/table/ui/messages';
26
24
  import * as tableColumnControlsUtils from '../../../plugins/table/utils/column-controls';
27
25
  import { pluginKey } from '../../../plugins/table/pm-plugins/plugin-key';
28
26
  import tablePlugin from '../../../plugins/table-plugin';
@@ -40,7 +38,6 @@ describe('Floating Delete Button', () => {
40
38
  pluginKey,
41
39
  });
42
40
 
43
- let wrapper: ReactWrapper<FloatingDeleteButtonProps>;
44
41
  let editorView: EditorView;
45
42
 
46
43
  beforeEach(() => {
@@ -53,34 +50,31 @@ describe('Floating Delete Button', () => {
53
50
  ),
54
51
  ),
55
52
  ));
56
-
57
- wrapper = (mountWithIntl(
58
- <FloatingDeleteButton
59
- tableRef={document.querySelector('table')!}
60
- editorView={editorView}
61
- selection={editorView.state.selection}
62
- />,
63
- ) as unknown) as ReactWrapper<FloatingDeleteButtonProps>;
64
53
  });
65
54
 
66
- afterEach(() => {
67
- if (wrapper) {
68
- wrapper.unmount();
69
- }
70
- });
55
+ const component = (props: FloatingDeleteButtonProps) =>
56
+ render(
57
+ <IntlProvider locale="en">
58
+ <FloatingDeleteButton
59
+ tableRef={editorView.dom.querySelector('table')!}
60
+ {...props}
61
+ />
62
+ </IntlProvider>,
63
+ );
71
64
 
72
65
  it('should not render a delete button with no selection', () => {
73
- expect(wrapper.find(DeleteButton).length).toBe(0);
66
+ component({ selection: editorView.state.selection, editorView });
67
+
68
+ expect(screen.queryByLabelText('Popup')).toBeFalsy();
74
69
  });
75
70
 
76
71
  it('should not render a delete button with whole table selected', () => {
77
- // select the whole table
72
+ // selects the whole table
78
73
  editorView.dispatch(selectTable(editorView.state.tr));
79
74
 
80
- // We need to force renderer
81
- wrapper.setProps({ selection: editorView.state.selection });
82
- // set numberOfColumns prop to trick shouldComponentUpdate and force re-render
83
- expect(wrapper.find(DeleteButton).length).toBe(0);
75
+ component({ selection: editorView.state.selection, editorView });
76
+
77
+ expect(screen.queryByLabelText('Popup')).toBeFalsy();
84
78
  });
85
79
 
86
80
  describe('Columns', () => {
@@ -104,21 +98,18 @@ describe('Floating Delete Button', () => {
104
98
  // Select columns start from 0
105
99
  selectColumns([column - 1])(editorView.state, editorView.dispatch);
106
100
 
107
- // We need to force renderer
108
- wrapper.setProps({ selection: editorView.state.selection });
101
+ component({ selection: editorView.state.selection, editorView });
109
102
 
110
- // we should now have a delete button
111
- expect(wrapper.find(DeleteButton).length).toBe(1);
103
+ expect(screen.getAllByLabelText('Delete column').length).toBe(1);
112
104
  },
113
105
  );
114
106
 
115
107
  it('should render a single delete button over multiple column selections', () => {
116
108
  selectColumns([0, 1])(editorView.state, editorView.dispatch);
117
109
 
118
- // We need to force renderer
119
- wrapper.setProps({ selection: editorView.state.selection });
110
+ component({ selection: editorView.state.selection, editorView });
120
111
 
121
- expect(wrapper.find(DeleteButton).length).toBe(1);
112
+ expect(screen.getAllByLabelText('Delete column').length).toBe(1);
122
113
  });
123
114
  });
124
115
 
@@ -128,9 +119,9 @@ describe('Floating Delete Button', () => {
128
119
  (row) => {
129
120
  selectRows([row - 1])(editorView.state, editorView.dispatch);
130
121
 
131
- wrapper.setProps({ selection: editorView.state.selection });
122
+ component({ selection: editorView.state.selection, editorView });
132
123
 
133
- expect(wrapper.find(DeleteButton).length).toBe(1);
124
+ expect(screen.getAllByLabelText('Delete row').length).toBe(1);
134
125
  },
135
126
  );
136
127
 
@@ -138,38 +129,9 @@ describe('Floating Delete Button', () => {
138
129
  selectRows([0, 1])(editorView.state, editorView.dispatch);
139
130
 
140
131
  // selecting the row mutates the editor state (which is inside editorView)
141
- // we set tableHeight prop to trick shouldComponentUpdate and force re-render
142
- wrapper.setProps({ selection: editorView.state.selection });
143
-
144
- expect(wrapper.find(DeleteButton).length).toBe(1);
145
- });
146
- });
147
-
148
- describe('<DeleteButton />', () => {
149
- it('should fire the onMouseEnter callback', () => {
150
- const onMouseEnter = jest.fn();
151
- const button = mountWithIntl(
152
- <DeleteButton
153
- removeLabel={tableMessages.removeColumns}
154
- onMouseEnter={onMouseEnter}
155
- />,
156
- );
157
- button.simulate('mouseenter');
158
- expect(onMouseEnter).toBeCalled();
159
- button.unmount();
160
- });
132
+ component({ selection: editorView.state.selection, editorView });
161
133
 
162
- it('should fire the onMouseLeave callback', () => {
163
- const onMouseLeave = jest.fn();
164
- const button = mountWithIntl(
165
- <DeleteButton
166
- removeLabel={tableMessages.removeRows}
167
- onMouseLeave={onMouseLeave}
168
- />,
169
- );
170
- button.simulate('mouseleave');
171
- expect(onMouseLeave).toBeCalled();
172
- button.unmount();
134
+ expect(screen.getAllByLabelText('Delete row').length).toBe(1);
173
135
  });
174
136
  });
175
137
  });
@@ -11,13 +11,13 @@ import {
11
11
  DocBuilder,
12
12
  } from '@atlaskit/editor-test-helpers/doc-builder';
13
13
 
14
- import tablePlugin from '../../../../table';
14
+ import tablePlugin from '../../../plugins/table';
15
15
  import expandPlugin from '@atlaskit/editor-core/src/plugins/expand';
16
16
 
17
17
  import {
18
18
  isTableCollapsible,
19
19
  collapseSelectedTable,
20
- } from '../../../utils/collapse';
20
+ } from '../../../plugins/table/utils/collapse';
21
21
 
22
22
  describe('collapse', () => {
23
23
  const createEditor = createProsemirrorEditorFactory();
@@ -1,4 +1,4 @@
1
- import { colWidthsForRow } from '../../../utils/column-controls';
1
+ import { colWidthsForRow } from '../../../plugins/table/utils/column-controls';
2
2
 
3
3
  const createRow = (colCount: number, childType = 'td') => {
4
4
  const tr = document.createElement('tr');
@@ -1,3 +1,5 @@
1
+ export {};
2
+
1
3
  // import {
2
4
  // PuppeteerPage,
3
5
  // waitForNoTooltip,
@@ -0,0 +1,181 @@
1
+ export {};
2
+
3
+ it.skip('TODO: restore vr `packages/editor/editor-plugin-table/src/plugins/table/__tests__/visual-regression/copy-button.ts`', () => {});
4
+
5
+ // import { _getCopyButtonTestSuite } from '../../../copy-button/__tests__/visual-regression/_getCopyButtonTestSuite';
6
+
7
+ // _getCopyButtonTestSuite({
8
+ // nodeName: 'Table',
9
+ // editorOptions: {
10
+ // allowTables: {
11
+ // advanced: true,
12
+ // },
13
+ // defaultValue: {
14
+ // version: 1,
15
+ // type: 'doc',
16
+ // content: [
17
+ // {
18
+ // type: 'table',
19
+ // attrs: {
20
+ // isNumberColumnEnabled: false,
21
+ // layout: 'default',
22
+ // localId: '15804638-b946-4591-b64c-beffe5122733',
23
+ // },
24
+ // content: [
25
+ // {
26
+ // type: 'tableRow',
27
+ // content: [
28
+ // {
29
+ // type: 'tableHeader',
30
+ // attrs: {},
31
+ // content: [
32
+ // {
33
+ // type: 'paragraph',
34
+ // content: [
35
+ // {
36
+ // type: 'text',
37
+ // text: '1',
38
+ // },
39
+ // ],
40
+ // },
41
+ // ],
42
+ // },
43
+ // {
44
+ // type: 'tableHeader',
45
+ // attrs: {},
46
+ // content: [
47
+ // {
48
+ // type: 'paragraph',
49
+ // content: [
50
+ // {
51
+ // type: 'text',
52
+ // text: '2',
53
+ // },
54
+ // ],
55
+ // },
56
+ // ],
57
+ // },
58
+ // {
59
+ // type: 'tableHeader',
60
+ // attrs: {},
61
+ // content: [
62
+ // {
63
+ // type: 'paragraph',
64
+ // content: [
65
+ // {
66
+ // type: 'text',
67
+ // text: '3',
68
+ // },
69
+ // ],
70
+ // },
71
+ // ],
72
+ // },
73
+ // ],
74
+ // },
75
+ // {
76
+ // type: 'tableRow',
77
+ // content: [
78
+ // {
79
+ // type: 'tableCell',
80
+ // attrs: {},
81
+ // content: [
82
+ // {
83
+ // type: 'paragraph',
84
+ // content: [
85
+ // {
86
+ // type: 'text',
87
+ // text: '4',
88
+ // },
89
+ // ],
90
+ // },
91
+ // ],
92
+ // },
93
+ // {
94
+ // type: 'tableCell',
95
+ // attrs: {},
96
+ // content: [
97
+ // {
98
+ // type: 'paragraph',
99
+ // content: [
100
+ // {
101
+ // type: 'text',
102
+ // text: '5',
103
+ // },
104
+ // ],
105
+ // },
106
+ // ],
107
+ // },
108
+ // {
109
+ // type: 'tableCell',
110
+ // attrs: {},
111
+ // content: [
112
+ // {
113
+ // type: 'paragraph',
114
+ // content: [
115
+ // {
116
+ // type: 'text',
117
+ // text: '6',
118
+ // },
119
+ // ],
120
+ // },
121
+ // ],
122
+ // },
123
+ // ],
124
+ // },
125
+ // {
126
+ // type: 'tableRow',
127
+ // content: [
128
+ // {
129
+ // type: 'tableCell',
130
+ // attrs: {},
131
+ // content: [
132
+ // {
133
+ // type: 'paragraph',
134
+ // content: [
135
+ // {
136
+ // type: 'text',
137
+ // text: '7',
138
+ // },
139
+ // ],
140
+ // },
141
+ // ],
142
+ // },
143
+ // {
144
+ // type: 'tableCell',
145
+ // attrs: {},
146
+ // content: [
147
+ // {
148
+ // type: 'paragraph',
149
+ // content: [
150
+ // {
151
+ // type: 'text',
152
+ // text: '8',
153
+ // },
154
+ // ],
155
+ // },
156
+ // ],
157
+ // },
158
+ // {
159
+ // type: 'tableCell',
160
+ // attrs: {},
161
+ // content: [
162
+ // {
163
+ // type: 'paragraph',
164
+ // content: [
165
+ // {
166
+ // type: 'text',
167
+ // text: '9',
168
+ // },
169
+ // ],
170
+ // },
171
+ // ],
172
+ // },
173
+ // ],
174
+ // },
175
+ // ],
176
+ // },
177
+ // ],
178
+ // },
179
+ // },
180
+ // nodeSelector: '.pm-table-cell-content-wrap',
181
+ // });
@@ -1,8 +1,10 @@
1
+ export {};
2
+
1
3
  // import { PuppeteerPage } from '@atlaskit/visual-regression/helper';
4
+ // import { Device } from '@atlaskit/editor-test-helpers/vr-utils/device-viewport';
2
5
  // import {
3
6
  // snapshot,
4
7
  // initFullPageEditorWithAdf,
5
- // Device,
6
8
  // } from '../../../../__tests__/visual-regression/_utils';
7
9
  // import tableWith100ListItemsADF from './__fixtures__/table-with-100-numbered-list-items.json';
8
10
  // import {