@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
@@ -1 +0,0 @@
1
- export var sendLogs = function sendLogs(_a) {};
package/dist/esm/types.js DELETED
@@ -1 +0,0 @@
1
- export {};
@@ -1,4 +0,0 @@
1
- import { EditorState, PluginKey } from 'prosemirror-state';
2
- import { TablePluginState } from '../types';
3
- export declare const pluginKey: PluginKey<TablePluginState, any>;
4
- export declare const getPluginState: (state: EditorState) => TablePluginState | undefined | null;
@@ -1 +0,0 @@
1
- export declare const sendLogs: (_a?: any) => void;
@@ -1,3 +0,0 @@
1
- export interface TablePluginState {
2
- scaffold?: boolean;
3
- }
@@ -1,4 +0,0 @@
1
- import { EditorState, PluginKey } from 'prosemirror-state';
2
- import { TablePluginState } from '../types';
3
- export declare const pluginKey: PluginKey<TablePluginState, any>;
4
- export declare const getPluginState: (state: EditorState) => TablePluginState | undefined | null;
@@ -1 +0,0 @@
1
- export declare const sendLogs: (_a?: any) => void;
@@ -1,3 +0,0 @@
1
- export interface TablePluginState {
2
- scaffold?: boolean;
3
- }
@@ -1,7 +0,0 @@
1
- import { EditorState, PluginKey } from 'prosemirror-state';
2
- import { TablePluginState } from '../types';
3
-
4
- export const pluginKey = new PluginKey<TablePluginState>('nextTablePlugin');
5
- export const getPluginState = (
6
- state: EditorState,
7
- ): TablePluginState | undefined | null => state && pluginKey.getState(state);
@@ -1,70 +0,0 @@
1
- //TODO: [ED-15027] remove and relocate this test once the behaviour has been corrected.\
2
- import { BrowserTestCase } from '@atlaskit/webdriver-runner/runner';
3
- import { BrowserObject } from '@atlaskit/webdriver-runner/wd-wrapper';
4
- import {
5
- goToEditorTestingWDExample,
6
- mountEditor,
7
- } from '@atlaskit/editor-test-helpers/testing-example-page';
8
- import {
9
- fullpage,
10
- expectToMatchSelection,
11
- setProseMirrorTextSelection,
12
- } from '@atlaskit/editor-test-helpers/integration/helpers';
13
- import type { WebDriverPage } from '@atlaskit/editor-test-helpers/integration/types';
14
- import adf from './__fixtures__/table-with-multiline-date.adf.json';
15
-
16
- describe('table with multiline date', () => {
17
- const initEditor = async ({
18
- client,
19
- selection,
20
- adf,
21
- }: {
22
- client: BrowserObject;
23
- selection: { anchor: number; head: number };
24
- adf: string;
25
- }): Promise<WebDriverPage> => {
26
- const page = await goToEditorTestingWDExample(
27
- client,
28
- 'editor-plugin-table',
29
- );
30
- const props = {
31
- appearance: fullpage.appearance,
32
- defaultValue: adf,
33
- allowTextAlignment: true,
34
- allowTables: {
35
- advanced: true,
36
- allowColumnResizing: true,
37
- },
38
- allowDate: true,
39
- };
40
-
41
- await mountEditor(page, props, undefined, { clickInEditor: false });
42
-
43
- await page.waitForSelector('.inlineNodeView');
44
-
45
- await setProseMirrorTextSelection(page, selection);
46
-
47
- return page;
48
- };
49
- BrowserTestCase(
50
- 'Does not select table corner controls when navigating up from a multiline node inside a table',
51
- {
52
- skip: ['firefox', 'safari'],
53
- },
54
- async (client: BrowserObject) => {
55
- const page = await initEditor({
56
- client,
57
- selection: { anchor: 27, head: 27 },
58
- adf,
59
- });
60
-
61
- await page.keys('ArrowUp');
62
-
63
- await expectToMatchSelection(page, {
64
- type: 'text',
65
- anchor: 27,
66
- head: 27,
67
- });
68
- },
69
- );
70
- });
@@ -1,130 +0,0 @@
1
- import {
2
- createProsemirrorEditorFactory,
3
- LightEditorPlugin,
4
- Preset,
5
- } from '@atlaskit/editor-test-helpers/create-prosemirror-editor';
6
- import {
7
- doc,
8
- p,
9
- table,
10
- td,
11
- tdCursor,
12
- tdEmpty,
13
- tr,
14
- DocBuilder,
15
- } from '@atlaskit/editor-test-helpers/doc-builder';
16
-
17
- import tablePlugin from '../../../table';
18
- import { handleMouseOut, handleMouseDown } from '../../event-handlers';
19
- import { pluginKey } from '../../pm-plugins/plugin-key';
20
- import { TableCssClassName as ClassName } from '../../types';
21
-
22
- describe('table plugin: decorations', () => {
23
- const createEditor = createProsemirrorEditorFactory();
24
- const editor = (doc: DocBuilder) =>
25
- createEditor({
26
- doc,
27
- preset: new Preset<LightEditorPlugin>().add(tablePlugin),
28
- pluginKey,
29
- });
30
- describe('#handleMouseDown', () => {
31
- beforeEach(() => {
32
- jest.resetAllMocks();
33
- });
34
- it('should return true & prevent default behaviour for table wrappers: pm-table-contianer', () => {
35
- const { editorView } = editor(
36
- doc(table()(tr(td({})(p())), tr(td({})(p())), tr(td({})(p())))),
37
- );
38
- const tableContainer = document.createElement('div');
39
- tableContainer.className = 'pm-table-container';
40
- const event = new MouseEvent('mousedown');
41
- Object.defineProperty(event, 'target', { value: tableContainer });
42
- const preventDefaultSpy = jest.spyOn(
43
- MouseEvent.prototype,
44
- 'preventDefault',
45
- );
46
-
47
- expect(handleMouseDown(editorView, event)).toEqual(true);
48
- expect(preventDefaultSpy).toHaveBeenCalledTimes(1);
49
- });
50
-
51
- it('should return true & prevent default behaviour for table wrappers: pm-table-wrapper', () => {
52
- const { editorView } = editor(
53
- doc(table()(tr(td({})(p())), tr(td({})(p())), tr(td({})(p())))),
54
- );
55
- const tableContainer = document.createElement('div');
56
- tableContainer.className = 'pm-table-wrapper';
57
- const event = new MouseEvent('mousedown');
58
- Object.defineProperty(event, 'target', { value: tableContainer });
59
- const preventDefaultSpy = jest.spyOn(
60
- MouseEvent.prototype,
61
- 'preventDefault',
62
- );
63
-
64
- expect(handleMouseDown(editorView, event)).toEqual(true);
65
- expect(preventDefaultSpy).toHaveBeenCalledTimes(1);
66
- });
67
-
68
- it('should return false & not prevent default behaviour for editor content area: ak-editor-content-area', () => {
69
- const { editorView } = editor(
70
- doc(table()(tr(td({})(p())), tr(td({})(p())), tr(td({})(p())))),
71
- );
72
- const editorContentArea = document.createElement('div');
73
- editorContentArea.className = 'ak-editor-content-area';
74
- const event = new MouseEvent('mousedown');
75
- Object.defineProperty(event, 'target', { value: editorContentArea });
76
- const preventDefaultSpy = jest.spyOn(
77
- MouseEvent.prototype,
78
- 'preventDefault',
79
- );
80
-
81
- expect(handleMouseDown(editorView, event)).toEqual(false);
82
- expect(preventDefaultSpy).toHaveBeenCalledTimes(0);
83
- });
84
- });
85
- describe('#handleMouseOut', () => {
86
- describe('when the target is a resize handle column', () => {
87
- it('should return true', () => {
88
- const { editorView } = editor(
89
- doc(table()(tr(tdCursor, tdEmpty), tr(td()(p('{o}')), tdEmpty))),
90
- );
91
- const firstCell = document.createElement('div');
92
- firstCell.classList.add(ClassName.RESIZE_HANDLE_DECORATION);
93
-
94
- // event.target = secondCell.node;
95
- const spy = jest
96
- .spyOn(MouseEvent.prototype, 'target', 'get')
97
- .mockReturnValue(firstCell);
98
-
99
- const event = new MouseEvent('opa');
100
-
101
- expect(handleMouseOut(editorView, event)).toEqual(true);
102
- spy.mockRestore();
103
- });
104
- });
105
-
106
- describe('when the relatedTarget is a resize handle column too', () => {
107
- it('should return false', () => {
108
- const { editorView } = editor(
109
- doc(table()(tr(tdCursor, tdEmpty), tr(td()(p('{o}')), tdEmpty))),
110
- );
111
- const firstCell = document.createElement('div');
112
- firstCell.classList.add(ClassName.RESIZE_HANDLE_DECORATION);
113
- const secondCell = document.createElement('div');
114
- secondCell.classList.add(ClassName.RESIZE_HANDLE_DECORATION);
115
-
116
- // event.target = secondCell.node;
117
- const spy = jest
118
- .spyOn(MouseEvent.prototype, 'target', 'get')
119
- .mockReturnValue(secondCell);
120
-
121
- const event = new MouseEvent('opa', {
122
- relatedTarget: firstCell,
123
- });
124
-
125
- expect(handleMouseOut(editorView, event)).toEqual(false);
126
- spy.mockRestore();
127
- });
128
- });
129
- });
130
- });
@@ -1 +0,0 @@
1
- export const sendLogs = (_a?: any) => {};
package/src/types.ts DELETED
@@ -1,3 +0,0 @@
1
- export interface TablePluginState {
2
- scaffold?: boolean;
3
- }
@@ -1,91 +0,0 @@
1
- ## API Report File for "@atlaskit/editor-plugin-table"
2
-
3
- > Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/).
4
-
5
- ```ts
6
-
7
- import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
8
- import type { EditorPlugin } from '@atlaskit/editor-common/types';
9
- import type { EditorSelectionAPI } from '@atlaskit/editor-common/selection';
10
- import type { GetEditorFeatureFlags } from '@atlaskit/editor-common/types';
11
- import { TableLayout } from '@atlaskit/adf-schema';
12
-
13
- // @public (undocumented)
14
- type PermittedLayoutsDescriptor = 'all' | TableLayout[];
15
-
16
- // @public (undocumented)
17
- interface PluginConfig {
18
- // (undocumented)
19
- advanced?: boolean;
20
- // (undocumented)
21
- allowAddColumnWithCustomStep?: boolean;
22
- // (undocumented)
23
- allowBackgroundColor?: boolean;
24
- // (undocumented)
25
- allowCellOptionsInFloatingToolbar?: boolean;
26
- // (undocumented)
27
- allowCollapse?: boolean;
28
- // (undocumented)
29
- allowColumnResizing?: boolean;
30
- // (undocumented)
31
- allowColumnSorting?: boolean;
32
- // (undocumented)
33
- allowControls?: boolean;
34
- // (undocumented)
35
- allowDistributeColumns?: boolean;
36
- // (undocumented)
37
- allowHeaderColumn?: boolean;
38
- // (undocumented)
39
- allowHeaderRow?: boolean;
40
- // (undocumented)
41
- allowMergeCells?: boolean;
42
- // (undocumented)
43
- allowNumberColumn?: boolean;
44
- // (undocumented)
45
- initialRenderOptimization?: boolean;
46
- // (undocumented)
47
- isHeaderRowRequired?: boolean;
48
- // (undocumented)
49
- mouseMoveOptimization?: boolean;
50
- // (undocumented)
51
- permittedLayouts?: PermittedLayoutsDescriptor;
52
- // (undocumented)
53
- stickToolbarToBottom?: boolean;
54
- // (undocumented)
55
- stickyHeaders?: boolean;
56
- // (undocumented)
57
- stickyHeadersOptimization?: boolean;
58
- // (undocumented)
59
- tableCellOptimization?: boolean;
60
- // (undocumented)
61
- tableOverflowShadowsOptimization?: boolean;
62
- // (undocumented)
63
- tableRenderOptimization?: boolean;
64
- }
65
-
66
- // @public (undocumented)
67
- interface TablePluginOptions {
68
- // (undocumented)
69
- allowContextualMenu?: boolean;
70
- // (undocumented)
71
- breakoutEnabled?: boolean;
72
- // (undocumented)
73
- editorAnalyticsAPI?: EditorAnalyticsAPI;
74
- // (undocumented)
75
- editorSelectionAPI?: EditorSelectionAPI;
76
- // (undocumented)
77
- fullWidthEnabled?: boolean;
78
- // (undocumented)
79
- getEditorFeatureFlags?: GetEditorFeatureFlags;
80
- // (undocumented)
81
- tableOptions: PluginConfig;
82
- // (undocumented)
83
- wasFullWidthEnabled?: boolean;
84
- }
85
-
86
- // @public (undocumented)
87
- export const tablesPlugin: (options?: TablePluginOptions | undefined) => EditorPlugin;
88
-
89
- // (No @packageDocumentation comment for this package)
90
-
91
- ```