@atlaskit/editor-plugin-table 0.0.10 → 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 (213) hide show
  1. package/.eslintrc.js +35 -0
  2. package/CHANGELOG.md +23 -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/LayoutButton/index.js +3 -5
  14. package/dist/cjs/plugins/table/ui/TableFloatingControls/CornerControls/index.js +2 -1
  15. package/dist/cjs/plugins/table/utils/column-controls.js +0 -1
  16. package/dist/cjs/plugins/table/utils/decoration.js +53 -4
  17. package/dist/cjs/plugins/table/utils/dom.js +0 -2
  18. package/dist/cjs/plugins/table/utils/paste.js +0 -1
  19. package/dist/cjs/version.json +1 -1
  20. package/dist/es2019/plugins/table/commands/hover.js +4 -4
  21. package/dist/es2019/plugins/table/commands-with-analytics.js +6 -9
  22. package/dist/es2019/plugins/table/event-handlers.js +1 -2
  23. package/dist/es2019/plugins/table/handlers.js +1 -2
  24. package/dist/es2019/plugins/table/index.js +23 -5
  25. package/dist/es2019/plugins/table/pm-plugins/keymap.js +1 -1
  26. package/dist/es2019/plugins/table/pm-plugins/table-local-id.js +1 -3
  27. package/dist/es2019/plugins/table/pm-plugins/table-resizing/index.js +2 -1
  28. package/dist/es2019/plugins/table/toolbar.js +133 -16
  29. package/dist/es2019/plugins/table/transforms/fix-tables.js +2 -4
  30. package/dist/es2019/plugins/table/ui/FloatingContextualButton/index.js +1 -2
  31. package/dist/es2019/plugins/table/ui/FloatingContextualMenu/ContextualMenu.js +4 -6
  32. package/dist/es2019/plugins/table/ui/FloatingDeleteButton/index.js +1 -2
  33. package/dist/es2019/plugins/table/ui/FloatingInsertButton/index.js +1 -2
  34. package/dist/es2019/plugins/table/ui/LayoutButton/index.js +3 -5
  35. package/dist/es2019/plugins/table/ui/TableFloatingControls/CornerControls/index.js +2 -1
  36. package/dist/es2019/plugins/table/utils/column-controls.js +0 -1
  37. package/dist/es2019/plugins/table/utils/decoration.js +60 -25
  38. package/dist/es2019/plugins/table/utils/dom.js +0 -2
  39. package/dist/es2019/plugins/table/utils/paste.js +1 -2
  40. package/dist/es2019/plugins/table/utils/row-controls.js +1 -2
  41. package/dist/es2019/version.json +1 -1
  42. package/dist/esm/plugins/table/commands/hover.js +4 -4
  43. package/dist/esm/plugins/table/commands-with-analytics.js +56 -55
  44. package/dist/esm/plugins/table/event-handlers.js +1 -2
  45. package/dist/esm/plugins/table/handlers.js +1 -2
  46. package/dist/esm/plugins/table/index.js +55 -38
  47. package/dist/esm/plugins/table/pm-plugins/keymap.js +1 -1
  48. package/dist/esm/plugins/table/pm-plugins/table-local-id.js +1 -3
  49. package/dist/esm/plugins/table/pm-plugins/table-resizing/index.js +2 -1
  50. package/dist/esm/plugins/table/toolbar.js +139 -17
  51. package/dist/esm/plugins/table/transforms/fix-tables.js +2 -4
  52. package/dist/esm/plugins/table/ui/FloatingContextualButton/index.js +1 -2
  53. package/dist/esm/plugins/table/ui/FloatingContextualMenu/ContextualMenu.js +4 -6
  54. package/dist/esm/plugins/table/ui/FloatingDeleteButton/index.js +1 -2
  55. package/dist/esm/plugins/table/ui/FloatingInsertButton/index.js +1 -2
  56. package/dist/esm/plugins/table/ui/LayoutButton/index.js +3 -5
  57. package/dist/esm/plugins/table/ui/TableFloatingControls/CornerControls/index.js +2 -1
  58. package/dist/esm/plugins/table/utils/column-controls.js +0 -1
  59. package/dist/esm/plugins/table/utils/decoration.js +50 -4
  60. package/dist/esm/plugins/table/utils/dom.js +0 -2
  61. package/dist/esm/plugins/table/utils/paste.js +1 -2
  62. package/dist/esm/plugins/table/utils/row-controls.js +1 -2
  63. package/dist/esm/version.json +1 -1
  64. package/dist/types/plugins/table/commands-with-analytics.d.ts +5 -5
  65. package/dist/types/plugins/table/pm-plugins/table-resizing/index.d.ts +1 -0
  66. package/dist/types/plugins/table/toolbar.d.ts +2 -2
  67. package/dist/types/plugins/table/transforms/fix-tables.d.ts +1 -1
  68. package/dist/types/plugins/table/utils/decoration.d.ts +1 -1
  69. package/dist/types-ts4.0/plugins/table/commands-with-analytics.d.ts +5 -5
  70. package/dist/types-ts4.0/plugins/table/pm-plugins/table-resizing/index.d.ts +1 -0
  71. package/dist/types-ts4.0/plugins/table/toolbar.d.ts +2 -2
  72. package/dist/types-ts4.0/plugins/table/transforms/fix-tables.d.ts +1 -1
  73. package/dist/types-ts4.0/plugins/table/utils/decoration.d.ts +1 -1
  74. package/examples/config.jsonc +14 -0
  75. package/package.json +15 -11
  76. package/plugin-key/package.json +14 -0
  77. package/report.api.md +1 -1
  78. package/src/{plugins/table/__tests__ → __tests__}/integration/__fixtures__/auto-size-documents.ts +0 -0
  79. package/src/{plugins/table/__tests__ → __tests__}/integration/__fixtures__/basic-table.ts +0 -0
  80. package/src/{plugins/table/__tests__ → __tests__}/integration/__fixtures__/empty-paragraph-underneath-table.ts +0 -0
  81. package/src/{plugins/table/__tests__ → __tests__}/integration/__fixtures__/even-columns.ts +0 -0
  82. package/src/{plugins/table/__tests__ → __tests__}/integration/__fixtures__/layout-documents.ts +0 -0
  83. package/src/{plugins/table/__tests__ → __tests__}/integration/__fixtures__/merged-rows-and-cols-document.ts +0 -0
  84. package/src/{plugins/table/__tests__ → __tests__}/integration/__fixtures__/nested-in-extension.ts +0 -0
  85. package/src/{plugins/table/__tests__ → __tests__}/integration/__fixtures__/paragraph-and-table-adf.json +0 -0
  86. package/src/{plugins/table/__tests__ → __tests__}/integration/__fixtures__/resize-documents.ts +0 -0
  87. package/src/{plugins/table/__tests__ → __tests__}/integration/__fixtures__/scale.ts +0 -0
  88. package/src/{plugins/table/__tests__ → __tests__}/integration/__fixtures__/table-inside-layout.ts +0 -0
  89. package/src/{plugins/table/__tests__ → __tests__}/integration/__fixtures__/table-with-min-width-columns-document.ts +0 -0
  90. package/src/{plugins/table/__tests__ → __tests__}/integration/__fixtures__/table-with-multiline-date.adf.json +0 -0
  91. package/src/{plugins/table/__tests__ → __tests__}/integration/__fixtures__/table-with-text-and-empty-row.ts +0 -0
  92. package/src/{plugins/table/__tests__ → __tests__}/integration/__snapshots__/auto-size.ts.snap +0 -0
  93. package/src/{plugins/table/__tests__ → __tests__}/integration/__snapshots__/change-date-inside-table.ts.snap +0 -0
  94. package/src/{plugins/table/__tests__ → __tests__}/integration/__snapshots__/copy-button.ts.snap +0 -0
  95. package/src/{plugins/table/__tests__ → __tests__}/integration/__snapshots__/delete-columns.ts.snap +0 -0
  96. package/src/{plugins/table/__tests__ → __tests__}/integration/__snapshots__/delete-last-column-in-full-width.ts.snap +0 -0
  97. package/src/{plugins/table/__tests__ → __tests__}/integration/__snapshots__/delete-last-column-with-empty-action.ts.snap +0 -0
  98. package/src/{plugins/table/__tests__ → __tests__}/integration/__snapshots__/delete-last-row-with-empty-action.ts.snap +0 -0
  99. package/src/{plugins/table/__tests__ → __tests__}/integration/__snapshots__/delete-rows.ts.snap +0 -0
  100. package/src/{plugins/table/__tests__ → __tests__}/integration/__snapshots__/delete-table-when-selected.ts.snap +0 -0
  101. package/src/{plugins/table/__tests__ → __tests__}/integration/__snapshots__/deleting-empty-paragraph-under-table.ts.snap +0 -0
  102. package/src/{plugins/table/__tests__ → __tests__}/integration/__snapshots__/even-columns.ts.snap +0 -0
  103. package/src/{plugins/table/__tests__ → __tests__}/integration/__snapshots__/insert-cell-header-with-strong-mark.ts.snap +0 -0
  104. package/src/{plugins/table/__tests__ → __tests__}/integration/__snapshots__/insert-row-inside-layout.ts.snap +0 -0
  105. package/src/{plugins/table/__tests__ → __tests__}/integration/__snapshots__/layout.ts.snap +0 -0
  106. package/src/{plugins/table/__tests__ → __tests__}/integration/__snapshots__/resize.ts.snap +0 -0
  107. package/src/{plugins/table/__tests__ → __tests__}/integration/__snapshots__/scale.ts.snap +0 -0
  108. package/src/{plugins/table/__tests__ → __tests__}/integration/arrow-down-into-table.ts +0 -0
  109. package/src/{plugins/table/__tests__ → __tests__}/integration/auto-size.ts +0 -0
  110. package/src/{plugins/table/__tests__ → __tests__}/integration/block-node-selection.ts +1 -0
  111. package/src/{plugins/table/__tests__ → __tests__}/integration/cell-selection.ts +0 -0
  112. package/src/{plugins/table/__tests__ → __tests__}/integration/change-date-inside-table.ts +0 -0
  113. package/src/{plugins/table/__tests__ → __tests__}/integration/copy-button.ts +1 -1
  114. package/src/{plugins/table/__tests__ → __tests__}/integration/delete-columns.ts +2 -2
  115. package/src/{plugins/table/__tests__ → __tests__}/integration/delete-last-column-in-full-width.ts +1 -1
  116. package/src/{plugins/table/__tests__ → __tests__}/integration/delete-last-column-with-empty-action.ts +1 -1
  117. package/src/{plugins/table/__tests__ → __tests__}/integration/delete-last-row-with-empty-action.ts +1 -1
  118. package/src/{plugins/table/__tests__ → __tests__}/integration/delete-rows.ts +2 -2
  119. package/src/{plugins/table/__tests__ → __tests__}/integration/delete-table-when-selected.ts +0 -0
  120. package/src/{plugins/table/__tests__ → __tests__}/integration/deleting-empty-paragraph-under-table.ts +0 -0
  121. package/src/{plugins/table/__tests__ → __tests__}/integration/even-columns.ts +0 -0
  122. package/src/{plugins/table/__tests__ → __tests__}/integration/insert-cell-header-with-strong-mark.ts +0 -0
  123. package/src/{plugins/table/__tests__ → __tests__}/integration/insert-long-smart-link.ts +1 -0
  124. package/src/{plugins/table/__tests__ → __tests__}/integration/insert-row-inside-layout.ts +0 -0
  125. package/src/{plugins/table/__tests__ → __tests__}/integration/layout.ts +0 -0
  126. package/src/{plugins/table/__tests__ → __tests__}/integration/resize-handler.ts +0 -0
  127. package/src/{plugins/table/__tests__ → __tests__}/integration/resize.ts +1 -1
  128. package/src/{plugins/table/__tests__ → __tests__}/integration/scale.ts +0 -0
  129. package/src/__tests__/integration/table-controls-selection.ts +71 -0
  130. package/src/__tests__/unit/analytics.ts +8 -9
  131. package/src/{plugins/table/__tests__ → __tests__}/unit/commands/go-to-next-cell.ts +4 -4
  132. package/src/{plugins/table/__tests__ → __tests__}/unit/commands/insert.ts +4 -4
  133. package/src/{plugins/table/__tests__ → __tests__}/unit/commands/misc.ts +12 -6
  134. package/src/{plugins/table/__tests__ → __tests__}/unit/commands.ts +7 -7
  135. package/src/__tests__/unit/copy-button.ts +22 -0
  136. package/src/__tests__/unit/event-handlers.ts +120 -1
  137. package/src/{plugins/table/__tests__ → __tests__}/unit/get-toolbar-config.ts +8 -3
  138. package/src/{plugins/table/__tests__ → __tests__}/unit/nodeviews/OverflowShadowsObserver.ts +2 -2
  139. package/src/{plugins/table/__tests__ → __tests__}/unit/nodeviews/TableComponent.tsx +11 -11
  140. package/src/{plugins/table/__tests__ → __tests__}/unit/nodeviews/table.ts +5 -5
  141. package/src/{plugins/table/__tests__ → __tests__}/unit/pm-plugins/decorations/column-controls.ts +2 -2
  142. package/src/{plugins/table/__tests__ → __tests__}/unit/pm-plugins/decorations/column-resizing.ts +9 -6
  143. package/src/{plugins/table/__tests__ → __tests__}/unit/pm-plugins/decorations/plugin.ts +5 -5
  144. package/src/{plugins/table/__tests__ → __tests__}/unit/pm-plugins/main-with-allow-collapse.ts +4 -4
  145. package/src/{plugins/table/__tests__ → __tests__}/unit/pm-plugins/main.ts +6 -6
  146. package/src/{plugins/table/__tests__ → __tests__}/unit/pm-plugins/safari-delete-composition-text-issue-workaround.ts +2 -2
  147. package/src/{plugins/table/__tests__ → __tests__}/unit/pm-plugins/sticky-headers/tableRow.tsx +16 -13
  148. package/src/{plugins/table/__tests__ → __tests__}/unit/pm-plugins/table-local-id.ts +3 -6
  149. package/src/{plugins/table/__tests__ → __tests__}/unit/pm-plugins/table-resizing/colgroup.ts +1 -1
  150. package/src/{plugins/table/__tests__ → __tests__}/unit/pm-plugins/table-resizing/event-handlers.ts +3 -3
  151. package/src/{plugins/table/__tests__ → __tests__}/unit/pm-plugins/table-selection-keymap.ts +3 -3
  152. package/src/{plugins/table/__tests__ → __tests__}/unit/toolbar.ts +5 -9
  153. package/src/{plugins/table/__tests__ → __tests__}/unit/utils/collapse.ts +2 -2
  154. package/src/{plugins/table/__tests__ → __tests__}/unit/utils/column-controls.ts +1 -1
  155. package/src/{plugins/table/__tests__ → __tests__}/visual-regression/__fixtures__/table-with-100-numbered-list-items.json +0 -0
  156. 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
  157. 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
  158. 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
  159. 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
  160. 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
  161. 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
  162. 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
  163. 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
  164. package/src/{plugins/table/__tests__ → __tests__}/visual-regression/cell-options-menu.ts +2 -0
  165. package/src/__tests__/visual-regression/copy-button.ts +181 -0
  166. package/src/{plugins/table/__tests__ → __tests__}/visual-regression/index.ts +3 -1
  167. package/src/plugins/table/commands/hover.ts +4 -1
  168. package/src/plugins/table/commands-with-analytics.ts +12 -8
  169. package/src/plugins/table/event-handlers.ts +0 -1
  170. package/src/plugins/table/handlers.ts +0 -1
  171. package/src/plugins/table/index.tsx +28 -2
  172. package/src/plugins/table/pm-plugins/keymap.ts +1 -1
  173. package/src/plugins/table/pm-plugins/table-local-id.ts +0 -2
  174. package/src/plugins/table/pm-plugins/table-resizing/index.ts +1 -0
  175. package/src/plugins/table/{toolbar.ts → toolbar.tsx} +186 -14
  176. package/src/plugins/table/transforms/fix-tables.ts +2 -3
  177. package/src/plugins/table/ui/FloatingContextualButton/index.tsx +0 -1
  178. package/src/plugins/table/ui/FloatingContextualMenu/ContextualMenu.tsx +13 -10
  179. package/src/plugins/table/ui/FloatingContextualMenu/__tests__/ContextualMenu.tsx +1 -0
  180. package/src/plugins/table/ui/FloatingContextualMenu/__tests__/FloatingContextualMenu.tsx +1 -0
  181. package/src/plugins/table/ui/FloatingDeleteButton/index.tsx +0 -1
  182. package/src/plugins/table/ui/FloatingInsertButton/index.tsx +0 -1
  183. package/src/plugins/table/ui/LayoutButton/index.tsx +2 -4
  184. package/src/plugins/table/ui/TableFloatingControls/CornerControls/index.tsx +1 -0
  185. package/src/plugins/table/utils/column-controls.ts +0 -1
  186. package/src/plugins/table/utils/decoration.ts +44 -5
  187. package/src/plugins/table/utils/dom.ts +0 -2
  188. package/src/plugins/table/utils/paste.ts +0 -1
  189. package/src/plugins/table/utils/row-controls.ts +0 -1
  190. package/types/package.json +5 -5
  191. package/ui/common-styles/package.json +14 -0
  192. package/ui/consts/package.json +14 -0
  193. package/dist/cjs/plugins/plugin-key.js +0 -17
  194. package/dist/cjs/plugins/table/todo-stubs.js +0 -10
  195. package/dist/cjs/types.js +0 -5
  196. package/dist/es2019/plugins/plugin-key.js +0 -3
  197. package/dist/es2019/plugins/table/todo-stubs.js +0 -1
  198. package/dist/es2019/types.js +0 -1
  199. package/dist/esm/plugins/plugin-key.js +0 -5
  200. package/dist/esm/plugins/table/todo-stubs.js +0 -1
  201. package/dist/esm/types.js +0 -1
  202. package/dist/types/plugins/plugin-key.d.ts +0 -4
  203. package/dist/types/plugins/table/todo-stubs.d.ts +0 -1
  204. package/dist/types/types.d.ts +0 -3
  205. package/dist/types-ts4.0/plugins/plugin-key.d.ts +0 -4
  206. package/dist/types-ts4.0/plugins/table/todo-stubs.d.ts +0 -1
  207. package/dist/types-ts4.0/types.d.ts +0 -3
  208. package/src/plugins/plugin-key.ts +0 -7
  209. package/src/plugins/table/__tests__/integration/table-controls-selection.ts +0 -70
  210. package/src/plugins/table/__tests__/unit/event-handlers.ts +0 -130
  211. package/src/plugins/table/todo-stubs.ts +0 -1
  212. package/src/types.ts +0 -3
  213. package/tmp/api-report-tmp.d.ts +0 -91
@@ -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>>;
@@ -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 {
@@ -59,13 +59,14 @@ export const hoverMergedCells = () =>
59
59
  export const hoverColumns = (hoveredColumns: number[], isInDanger?: boolean) =>
60
60
  createCommand(
61
61
  (state) => {
62
- const cells = getCellsInColumn(hoveredColumns)(state.selection);
62
+ const cells = getCellsInColumn(hoveredColumns)(state.tr.selection);
63
63
  if (!cells) {
64
64
  return false;
65
65
  }
66
66
  const decorations = createControlsHoverDecoration(
67
67
  cells,
68
68
  'column',
69
+ state.tr,
69
70
  isInDanger,
70
71
  );
71
72
 
@@ -95,6 +96,7 @@ export const hoverRows = (hoveredRows: number[], isInDanger?: boolean) =>
95
96
  const decorations = createControlsHoverDecoration(
96
97
  cells,
97
98
  'row',
99
+ state.tr,
98
100
  isInDanger,
99
101
  );
100
102
 
@@ -131,6 +133,7 @@ export const hoverTable = (isInDanger?: boolean, isSelected?: boolean) =>
131
133
  const decorations = createControlsHoverDecoration(
132
134
  cells,
133
135
  'table',
136
+ state.tr,
134
137
  isInDanger,
135
138
  isSelected,
136
139
  );
@@ -96,7 +96,7 @@ export const emptyMultipleCellsWithAnalytics = (
96
96
 
97
97
  export const mergeCellsWithAnalytics = (
98
98
  editorAnalyticsAPI: EditorAnalyticsAPI | null | undefined,
99
- ) =>
99
+ ) => (inputMethod: INPUT_METHOD.CONTEXT_MENU | INPUT_METHOD.FLOATING_TB) =>
100
100
  withEditorAnalyticsAPI(({ selection }) => {
101
101
  const {
102
102
  horizontalCells,
@@ -111,7 +111,7 @@ export const mergeCellsWithAnalytics = (
111
111
  actionSubject: ACTION_SUBJECT.TABLE,
112
112
  actionSubjectId: null,
113
113
  attributes: {
114
- inputMethod: INPUT_METHOD.CONTEXT_MENU, // TODO: merge with floating toolbar once command is updated
114
+ inputMethod,
115
115
  horizontalCells,
116
116
  verticalCells,
117
117
  totalCells,
@@ -129,7 +129,7 @@ export const mergeCellsWithAnalytics = (
129
129
 
130
130
  export const splitCellWithAnalytics = (
131
131
  editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null,
132
- ) =>
132
+ ) => (inputMethod: INPUT_METHOD.CONTEXT_MENU | INPUT_METHOD.FLOATING_TB) =>
133
133
  withEditorAnalyticsAPI(({ selection }) => {
134
134
  const { totalRowCount, totalColumnCount } = getSelectedCellInfo(selection);
135
135
  const cell = findCellClosestToPos(selection.$anchor);
@@ -144,7 +144,7 @@ export const splitCellWithAnalytics = (
144
144
  actionSubject: ACTION_SUBJECT.TABLE,
145
145
  actionSubjectId: null,
146
146
  attributes: {
147
- inputMethod: INPUT_METHOD.CONTEXT_MENU, // TODO: merge with floating toolbar once command is updated
147
+ inputMethod,
148
148
  horizontalCells,
149
149
  verticalCells,
150
150
  totalCells: horizontalCells * verticalCells,
@@ -159,7 +159,11 @@ export const splitCellWithAnalytics = (
159
159
 
160
160
  export const setColorWithAnalytics = (
161
161
  editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null,
162
- ) => (cellColor: string, targetCellPosition?: number) =>
162
+ ) => (
163
+ inputMethod: INPUT_METHOD.CONTEXT_MENU | INPUT_METHOD.FLOATING_TB,
164
+ cellColor: string,
165
+ targetCellPosition?: number,
166
+ ) =>
163
167
  withEditorAnalyticsAPI(({ selection }) => {
164
168
  const {
165
169
  horizontalCells,
@@ -174,7 +178,7 @@ export const setColorWithAnalytics = (
174
178
  actionSubject: ACTION_SUBJECT.TABLE,
175
179
  actionSubjectId: null,
176
180
  attributes: {
177
- inputMethod: INPUT_METHOD.CONTEXT_MENU, // TODO: merge with floating toolbar once command is updated
181
+ inputMethod,
178
182
  cellColor: (
179
183
  tableBackgroundColorPalette.get(cellColor.toLowerCase()) || cellColor
180
184
  ).toLowerCase(),
@@ -457,7 +461,7 @@ export const toggleTableLayoutWithAnalytics = (
457
461
  export const sortColumnWithAnalytics = (
458
462
  editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null,
459
463
  ) => (
460
- inputMethod: INPUT_METHOD.CONTEXT_MENU,
464
+ inputMethod: INPUT_METHOD.CONTEXT_MENU | INPUT_METHOD.FLOATING_TB,
461
465
  columnIndex: number,
462
466
  sortOrder: SortOrder,
463
467
  ) =>
@@ -483,7 +487,7 @@ export const sortColumnWithAnalytics = (
483
487
  export const distributeColumnsWidthsWithAnalytics = (
484
488
  editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null,
485
489
  ) => (
486
- inputMethod: INPUT_METHOD.CONTEXT_MENU,
490
+ inputMethod: INPUT_METHOD.CONTEXT_MENU | INPUT_METHOD.FLOATING_TB,
487
491
  { resizeState, table, attributes }: ResizeStateWithAnalytics,
488
492
  ) => {
489
493
  return withEditorAnalyticsAPI(() => {
@@ -23,7 +23,6 @@ import {
23
23
  isLastItemMediaGroup,
24
24
  setNodeSelection,
25
25
  } from '@atlaskit/editor-common/utils';
26
- // import { closestElement } from '@atlaskit/editor-core/src/utils/dom';
27
26
  import { closestElement } from '@atlaskit/editor-common/utils';
28
27
  import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
29
28
  import {
@@ -3,7 +3,6 @@ import { Transaction, ReadonlyTransaction } from 'prosemirror-state';
3
3
  import { ContentNodeWithPos, findParentNodeOfType } from 'prosemirror-utils';
4
4
  import { findTable } from '@atlaskit/editor-tables/utils';
5
5
 
6
- // import { isTextInput } from '../../utils/is-text-input';
7
6
  import { isTextInput } from '@atlaskit/editor-common/utils';
8
7
  import { isTableCollapsible } from './utils/collapse';
9
8
 
@@ -20,6 +20,7 @@ import {
20
20
  ACTION_SUBJECT_ID,
21
21
  EVENT_TYPE,
22
22
  INPUT_METHOD,
23
+ TABLE_ACTION,
23
24
  } from '@atlaskit/editor-common/analytics';
24
25
  import { toolbarInsertBlockMessages as messages } from '@atlaskit/editor-common/messages';
25
26
 
@@ -59,6 +60,7 @@ import type {
59
60
  GetEditorContainerWidth,
60
61
  GetEditorFeatureFlags,
61
62
  } from '@atlaskit/editor-common/types';
63
+ import { EditorState, Transaction } from 'prosemirror-state';
62
64
 
63
65
  interface TablePluginOptions {
64
66
  tableOptions: PluginConfig;
@@ -177,8 +179,31 @@ const tablesPlugin = (options?: TablePluginOptions): EditorPlugin => {
177
179
  name: 'tableSelectionKeymap',
178
180
  plugin: () => tableSelectionKeymapPlugin(options?.editorSelectionAPI),
179
181
  },
180
- { name: 'tableEditing', plugin: () => tableEditing() as SafePlugin },
181
-
182
+ {
183
+ name: 'tableEditing',
184
+ plugin: () =>
185
+ tableEditing({
186
+ reportFixedTable: ({
187
+ state,
188
+ tr,
189
+ reason,
190
+ }: {
191
+ state: EditorState;
192
+ tr: Transaction;
193
+ reason: string;
194
+ }) => {
195
+ options?.editorAnalyticsAPI?.attachAnalyticsEvent({
196
+ action: TABLE_ACTION.FIXED,
197
+ actionSubject: ACTION_SUBJECT.TABLE,
198
+ actionSubjectId: null,
199
+ attributes: {
200
+ reason,
201
+ },
202
+ eventType: EVENT_TYPE.TRACK,
203
+ })(tr);
204
+ },
205
+ }) as SafePlugin,
206
+ },
182
207
  {
183
208
  name: 'tableStickyHeaders',
184
209
  plugin: ({ dispatch, eventDispatcher }) =>
@@ -432,6 +457,7 @@ const tablesPlugin = (options?: TablePluginOptions): EditorPlugin => {
432
457
  floatingToolbar: getToolbarConfig(
433
458
  defaultGetEditorContainerWidth,
434
459
  options?.editorAnalyticsAPI,
460
+ options?.getEditorFeatureFlags || defaultGetEditorFeatureFlags,
435
461
  )(pluginConfig(options?.tableOptions)),
436
462
  },
437
463
  };
@@ -11,10 +11,10 @@ import {
11
11
  INPUT_METHOD,
12
12
  } from '@atlaskit/editor-common/analytics';
13
13
  import {
14
+ triggerUnlessTableHeader,
14
15
  createTable,
15
16
  goToNextCell,
16
17
  moveCursorBackward,
17
- triggerUnlessTableHeader,
18
18
  } from '../commands';
19
19
  import {
20
20
  addRowAroundSelection,
@@ -10,7 +10,6 @@
10
10
  * TODO: https://product-fabric.atlassian.net/browse/ED-12714
11
11
  *
12
12
  */
13
- // import { Dispatch } from '../../../event-dispatcher';
14
13
  import { Dispatch } from '@atlaskit/editor-common/event-dispatcher';
15
14
  import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
16
15
  import { EditorState, PluginKey, Transaction } from 'prosemirror-state';
@@ -19,7 +18,6 @@ import rafSchedule from 'raf-schd';
19
18
 
20
19
  import { uuid } from '@atlaskit/adf-schema';
21
20
 
22
- // import { stepAddsOneOf } from '../../../utils/step';
23
21
  import { stepAddsOneOf } from '@atlaskit/editor-common/utils';
24
22
 
25
23
  interface TableLocalIdPluginState {
@@ -1,3 +1,4 @@
1
1
  export { createPlugin } from './plugin';
2
2
  export { scaleTable } from './commands';
3
3
  export { pluginKey } from './plugin-key';
4
+ export { getPluginState } from './plugin-factory';