@atlaskit/editor-plugin-table 0.1.0 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (190) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/dist/cjs/plugins/table/ui/FloatingDeleteButton/index.js +2 -1
  3. package/dist/cjs/version.json +1 -1
  4. package/dist/es2019/plugins/table/ui/FloatingDeleteButton/index.js +2 -1
  5. package/dist/es2019/version.json +1 -1
  6. package/dist/esm/plugins/table/ui/FloatingDeleteButton/index.js +2 -1
  7. package/dist/esm/version.json +1 -1
  8. package/examples/99-testing.tsx +35 -30
  9. package/package.json +2 -11
  10. package/src/__tests__/integration/__fixtures__/auto-size-documents.ts +5 -10
  11. package/src/__tests__/integration/__fixtures__/layout-documents.ts +1 -2
  12. package/src/__tests__/integration/__fixtures__/resize-documents.ts +5 -10
  13. package/src/__tests__/integration/resize.ts +1 -2
  14. package/src/__tests__/unit/analytics.ts +33 -32
  15. package/src/__tests__/unit/collab.ts +12 -9
  16. package/src/__tests__/unit/commands/sort.ts +28 -28
  17. package/src/__tests__/unit/copy-paste.ts +6 -8
  18. package/src/__tests__/unit/event-handlers.ts +7 -10
  19. package/src/__tests__/unit/fix-tables.ts +17 -23
  20. package/src/__tests__/unit/get-toolbar-config.ts +0 -5
  21. package/src/__tests__/unit/hover-selection.ts +1 -66
  22. package/src/__tests__/unit/index-with-fake-timers.ts +1 -1
  23. package/src/__tests__/unit/index.ts +5 -5
  24. package/src/__tests__/unit/nodeviews/TableComponent.tsx +11 -218
  25. package/src/__tests__/unit/nodeviews/cell.ts +12 -10
  26. package/src/__tests__/unit/nodeviews/table.ts +25 -26
  27. package/src/__tests__/unit/pm-plugins/safari-delete-composition-text-issue-workaround.ts +11 -8
  28. package/src/__tests__/unit/pm-plugins/sticky-headers/tableRow.tsx +11 -12
  29. package/src/__tests__/unit/toolbar.ts +18 -5
  30. package/src/__tests__/unit/ui/ContextualMenu.tsx +55 -0
  31. package/src/__tests__/unit/ui/CornerControls.tsx +7 -7
  32. package/src/__tests__/unit/ui/FloatingContextualButton.tsx +45 -49
  33. package/src/__tests__/unit/ui/FloatingContextualMenu.tsx +49 -0
  34. package/src/__tests__/unit/ui/FloatingDeleteButton.tsx +30 -2
  35. package/src/__tests__/unit/ui/FloatingInsertButton.tsx +143 -111
  36. package/src/__tests__/unit/ui/RowControls.tsx +112 -141
  37. package/src/__tests__/unit/ui/TableFloatingControls.tsx +18 -15
  38. package/src/__tests__/unit/undo-redo.ts +10 -9
  39. package/src/__tests__/unit/utils/nodes.ts +8 -4
  40. package/src/__tests__/unit/utils/row-controls.ts +8 -4
  41. package/src/plugins/table/commands/clear.ts +30 -29
  42. package/src/plugins/table/commands/go-to-next-cell.ts +41 -38
  43. package/src/plugins/table/commands/insert.ts +91 -91
  44. package/src/plugins/table/commands/misc.ts +123 -125
  45. package/src/plugins/table/commands/selection.ts +329 -319
  46. package/src/plugins/table/commands-with-analytics.ts +299 -294
  47. package/src/plugins/table/event-handlers.ts +111 -111
  48. package/src/plugins/table/handlers.ts +95 -94
  49. package/src/plugins/table/nodeviews/OverflowShadowsObserver.ts +4 -3
  50. package/src/plugins/table/nodeviews/TableComponent.tsx +6 -9
  51. package/src/plugins/table/nodeviews/update-overflow-shadows.ts +39 -39
  52. package/src/plugins/table/pm-plugins/decorations/utils/column-controls.ts +7 -9
  53. package/src/plugins/table/pm-plugins/decorations/utils/column-resizing.ts +30 -30
  54. package/src/plugins/table/pm-plugins/decorations/utils/compose-decorations.ts +7 -7
  55. package/src/plugins/table/pm-plugins/plugin-factory.ts +33 -33
  56. package/src/plugins/table/pm-plugins/safari-delete-composition-text-issue-workaround.ts +6 -9
  57. package/src/plugins/table/pm-plugins/sticky-headers/nodeviews/tableRow.ts +3 -2
  58. package/src/plugins/table/pm-plugins/table-resizing/commands.ts +98 -90
  59. package/src/plugins/table/pm-plugins/table-resizing/utils/dom.ts +46 -47
  60. package/src/plugins/table/toolbar.tsx +116 -113
  61. package/src/plugins/table/transforms/column-width.ts +143 -146
  62. package/src/plugins/table/transforms/delete-columns.ts +144 -142
  63. package/src/plugins/table/transforms/delete-rows.ts +110 -111
  64. package/src/plugins/table/transforms/metadata.ts +9 -9
  65. package/src/plugins/table/ui/FloatingContextualMenu/ContextualMenu.tsx +7 -6
  66. package/src/plugins/table/ui/FloatingDeleteButton/index.tsx +3 -2
  67. package/src/plugins/table/ui/FloatingInsertButton/index.tsx +2 -5
  68. package/src/plugins/table/ui/LayoutButton/index.tsx +2 -6
  69. package/src/plugins/table/ui/common-styles.ts +1 -3
  70. package/src/plugins/table/utils/analytics.ts +24 -25
  71. package/src/plugins/table/utils/dom.ts +3 -3
  72. package/src/plugins/table/utils/row-controls.ts +92 -93
  73. package/dist/types-ts4.0/index.d.ts +0 -1
  74. package/dist/types-ts4.0/plugins/table/commands/clear.d.ts +0 -3
  75. package/dist/types-ts4.0/plugins/table/commands/collapse.d.ts +0 -2
  76. package/dist/types-ts4.0/plugins/table/commands/go-to-next-cell.d.ts +0 -4
  77. package/dist/types-ts4.0/plugins/table/commands/hover.d.ts +0 -8
  78. package/dist/types-ts4.0/plugins/table/commands/index.d.ts +0 -7
  79. package/dist/types-ts4.0/plugins/table/commands/insert.d.ts +0 -10
  80. package/dist/types-ts4.0/plugins/table/commands/misc.d.ts +0 -27
  81. package/dist/types-ts4.0/plugins/table/commands/selection.d.ts +0 -8
  82. package/dist/types-ts4.0/plugins/table/commands/sort.d.ts +0 -3
  83. package/dist/types-ts4.0/plugins/table/commands/split-cell.d.ts +0 -6
  84. package/dist/types-ts4.0/plugins/table/commands/toggle.d.ts +0 -12
  85. package/dist/types-ts4.0/plugins/table/commands-with-analytics.d.ts +0 -26
  86. package/dist/types-ts4.0/plugins/table/create-plugin-config.d.ts +0 -2
  87. package/dist/types-ts4.0/plugins/table/event-handlers.d.ts +0 -16
  88. package/dist/types-ts4.0/plugins/table/handlers.d.ts +0 -3
  89. package/dist/types-ts4.0/plugins/table/index.d.ts +0 -17
  90. package/dist/types-ts4.0/plugins/table/nodeviews/OverflowShadowsObserver.d.ts +0 -26
  91. package/dist/types-ts4.0/plugins/table/nodeviews/TableComponent.d.ts +0 -72
  92. package/dist/types-ts4.0/plugins/table/nodeviews/__mocks__/OverflowShadowsObserver.d.ts +0 -9
  93. package/dist/types-ts4.0/plugins/table/nodeviews/__mocks__/OverridableMock.d.ts +0 -9
  94. package/dist/types-ts4.0/plugins/table/nodeviews/table.d.ts +0 -31
  95. package/dist/types-ts4.0/plugins/table/nodeviews/tableCell.d.ts +0 -19
  96. package/dist/types-ts4.0/plugins/table/nodeviews/types.d.ts +0 -24
  97. package/dist/types-ts4.0/plugins/table/nodeviews/update-overflow-shadows.d.ts +0 -8
  98. package/dist/types-ts4.0/plugins/table/pm-plugins/decorations/plugin.d.ts +0 -7
  99. package/dist/types-ts4.0/plugins/table/pm-plugins/decorations/utils/column-controls.d.ts +0 -3
  100. package/dist/types-ts4.0/plugins/table/pm-plugins/decorations/utils/column-resizing.d.ts +0 -2
  101. package/dist/types-ts4.0/plugins/table/pm-plugins/decorations/utils/compose-decorations.d.ts +0 -2
  102. package/dist/types-ts4.0/plugins/table/pm-plugins/decorations/utils/index.d.ts +0 -3
  103. package/dist/types-ts4.0/plugins/table/pm-plugins/decorations/utils/types.d.ts +0 -6
  104. package/dist/types-ts4.0/plugins/table/pm-plugins/default-table-selection.d.ts +0 -5
  105. package/dist/types-ts4.0/plugins/table/pm-plugins/keymap.d.ts +0 -5
  106. package/dist/types-ts4.0/plugins/table/pm-plugins/main.d.ts +0 -8
  107. package/dist/types-ts4.0/plugins/table/pm-plugins/plugin-factory.d.ts +0 -1
  108. package/dist/types-ts4.0/plugins/table/pm-plugins/plugin-key.d.ts +0 -3
  109. package/dist/types-ts4.0/plugins/table/pm-plugins/safari-delayed-dom-selection-syncing-workaround.d.ts +0 -4
  110. package/dist/types-ts4.0/plugins/table/pm-plugins/safari-delete-composition-text-issue-workaround.d.ts +0 -15
  111. package/dist/types-ts4.0/plugins/table/pm-plugins/sticky-headers/commands.d.ts +0 -3
  112. package/dist/types-ts4.0/plugins/table/pm-plugins/sticky-headers/index.d.ts +0 -6
  113. package/dist/types-ts4.0/plugins/table/pm-plugins/sticky-headers/nodeviews/dom.d.ts +0 -6
  114. package/dist/types-ts4.0/plugins/table/pm-plugins/sticky-headers/nodeviews/tableRow.d.ts +0 -65
  115. package/dist/types-ts4.0/plugins/table/pm-plugins/sticky-headers/plugin-key.d.ts +0 -3
  116. package/dist/types-ts4.0/plugins/table/pm-plugins/sticky-headers/plugin-state.d.ts +0 -3
  117. package/dist/types-ts4.0/plugins/table/pm-plugins/sticky-headers/plugin.d.ts +0 -4
  118. package/dist/types-ts4.0/plugins/table/pm-plugins/sticky-headers/types.d.ts +0 -16
  119. package/dist/types-ts4.0/plugins/table/pm-plugins/sticky-headers/util.d.ts +0 -2
  120. package/dist/types-ts4.0/plugins/table/pm-plugins/table-local-id.d.ts +0 -22
  121. package/dist/types-ts4.0/plugins/table/pm-plugins/table-resizing/commands.d.ts +0 -25
  122. package/dist/types-ts4.0/plugins/table/pm-plugins/table-resizing/event-handlers.d.ts +0 -4
  123. package/dist/types-ts4.0/plugins/table/pm-plugins/table-resizing/index.d.ts +0 -4
  124. package/dist/types-ts4.0/plugins/table/pm-plugins/table-resizing/plugin-factory.d.ts +0 -4
  125. package/dist/types-ts4.0/plugins/table/pm-plugins/table-resizing/plugin-key.d.ts +0 -3
  126. package/dist/types-ts4.0/plugins/table/pm-plugins/table-resizing/plugin.d.ts +0 -6
  127. package/dist/types-ts4.0/plugins/table/pm-plugins/table-resizing/reducer.d.ts +0 -3
  128. package/dist/types-ts4.0/plugins/table/pm-plugins/table-resizing/utils/colgroup.d.ts +0 -8
  129. package/dist/types-ts4.0/plugins/table/pm-plugins/table-resizing/utils/column-state.d.ts +0 -14
  130. package/dist/types-ts4.0/plugins/table/pm-plugins/table-resizing/utils/content-width.d.ts +0 -4
  131. package/dist/types-ts4.0/plugins/table/pm-plugins/table-resizing/utils/dom.d.ts +0 -13
  132. package/dist/types-ts4.0/plugins/table/pm-plugins/table-resizing/utils/index.d.ts +0 -12
  133. package/dist/types-ts4.0/plugins/table/pm-plugins/table-resizing/utils/misc.d.ts +0 -22
  134. package/dist/types-ts4.0/plugins/table/pm-plugins/table-resizing/utils/resize-column.d.ts +0 -2
  135. package/dist/types-ts4.0/plugins/table/pm-plugins/table-resizing/utils/resize-logic.d.ts +0 -4
  136. package/dist/types-ts4.0/plugins/table/pm-plugins/table-resizing/utils/resize-state.d.ts +0 -29
  137. package/dist/types-ts4.0/plugins/table/pm-plugins/table-resizing/utils/scale-table.d.ts +0 -17
  138. package/dist/types-ts4.0/plugins/table/pm-plugins/table-resizing/utils/types.d.ts +0 -22
  139. package/dist/types-ts4.0/plugins/table/pm-plugins/table-resizing/utils/unit-to-number.d.ts +0 -1
  140. package/dist/types-ts4.0/plugins/table/pm-plugins/table-selection-keymap.d.ts +0 -4
  141. package/dist/types-ts4.0/plugins/table/reducer.d.ts +0 -3
  142. package/dist/types-ts4.0/plugins/table/toolbar.d.ts +0 -36
  143. package/dist/types-ts4.0/plugins/table/transforms/column-width.d.ts +0 -18
  144. package/dist/types-ts4.0/plugins/table/transforms/delete-columns.d.ts +0 -3
  145. package/dist/types-ts4.0/plugins/table/transforms/delete-rows.d.ts +0 -3
  146. package/dist/types-ts4.0/plugins/table/transforms/fix-tables.d.ts +0 -10
  147. package/dist/types-ts4.0/plugins/table/transforms/index.d.ts +0 -7
  148. package/dist/types-ts4.0/plugins/table/transforms/merge.d.ts +0 -5
  149. package/dist/types-ts4.0/plugins/table/transforms/metadata.d.ts +0 -21
  150. package/dist/types-ts4.0/plugins/table/transforms/replace-table.d.ts +0 -5
  151. package/dist/types-ts4.0/plugins/table/transforms/split.d.ts +0 -9
  152. package/dist/types-ts4.0/plugins/table/types.d.ts +0 -328
  153. package/dist/types-ts4.0/plugins/table/ui/FloatingContextualButton/index.d.ts +0 -29
  154. package/dist/types-ts4.0/plugins/table/ui/FloatingContextualButton/styles.d.ts +0 -1
  155. package/dist/types-ts4.0/plugins/table/ui/FloatingContextualMenu/ContextualMenu.d.ts +0 -87
  156. package/dist/types-ts4.0/plugins/table/ui/FloatingContextualMenu/index.d.ts +0 -22
  157. package/dist/types-ts4.0/plugins/table/ui/FloatingContextualMenu/styles.d.ts +0 -2
  158. package/dist/types-ts4.0/plugins/table/ui/FloatingDeleteButton/DeleteButton.d.ts +0 -14
  159. package/dist/types-ts4.0/plugins/table/ui/FloatingDeleteButton/getPopUpOptions.d.ts +0 -10
  160. package/dist/types-ts4.0/plugins/table/ui/FloatingDeleteButton/index.d.ts +0 -54
  161. package/dist/types-ts4.0/plugins/table/ui/FloatingDeleteButton/types.d.ts +0 -1
  162. package/dist/types-ts4.0/plugins/table/ui/FloatingInsertButton/InsertButton.d.ts +0 -12
  163. package/dist/types-ts4.0/plugins/table/ui/FloatingInsertButton/getPopupOptions.d.ts +0 -3
  164. package/dist/types-ts4.0/plugins/table/ui/FloatingInsertButton/index.d.ts +0 -35
  165. package/dist/types-ts4.0/plugins/table/ui/LayoutButton/index.d.ts +0 -21
  166. package/dist/types-ts4.0/plugins/table/ui/TableFloatingControls/CornerControls/index.d.ts +0 -16
  167. package/dist/types-ts4.0/plugins/table/ui/TableFloatingControls/NumberColumn/index.d.ts +0 -21
  168. package/dist/types-ts4.0/plugins/table/ui/TableFloatingControls/RowControls/index.d.ts +0 -17
  169. package/dist/types-ts4.0/plugins/table/ui/TableFloatingControls/index.d.ts +0 -40
  170. package/dist/types-ts4.0/plugins/table/ui/common-styles.d.ts +0 -4
  171. package/dist/types-ts4.0/plugins/table/ui/consts.d.ts +0 -39
  172. package/dist/types-ts4.0/plugins/table/ui/messages.d.ts +0 -38
  173. package/dist/types-ts4.0/plugins/table/ui/ui-styles.d.ts +0 -15
  174. package/dist/types-ts4.0/plugins/table/utils/analytics.d.ts +0 -18
  175. package/dist/types-ts4.0/plugins/table/utils/collapse.d.ts +0 -29
  176. package/dist/types-ts4.0/plugins/table/utils/column-controls.d.ts +0 -10
  177. package/dist/types-ts4.0/plugins/table/utils/decoration.d.ts +0 -16
  178. package/dist/types-ts4.0/plugins/table/utils/dom.d.ts +0 -20
  179. package/dist/types-ts4.0/plugins/table/utils/get-allow-add-column-custom-step.d.ts +0 -2
  180. package/dist/types-ts4.0/plugins/table/utils/index.d.ts +0 -11
  181. package/dist/types-ts4.0/plugins/table/utils/nodes.d.ts +0 -12
  182. package/dist/types-ts4.0/plugins/table/utils/paste.d.ts +0 -14
  183. package/dist/types-ts4.0/plugins/table/utils/referentiality.d.ts +0 -2
  184. package/dist/types-ts4.0/plugins/table/utils/row-controls.d.ts +0 -16
  185. package/dist/types-ts4.0/plugins/table/utils/selection.d.ts +0 -6
  186. package/dist/types-ts4.0/plugins/table/utils/table.d.ts +0 -4
  187. package/dist/types-ts4.0/plugins/table/utils/update-plugin-state-decorations.d.ts +0 -4
  188. package/dist/types-ts4.0/plugins/table-plugin.d.ts +0 -2
  189. package/src/plugins/table/ui/FloatingContextualMenu/__tests__/ContextualMenu.tsx +0 -56
  190. package/src/plugins/table/ui/FloatingContextualMenu/__tests__/FloatingContextualMenu.tsx +0 -50
package/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # @atlaskit/editor-plugin-table
2
2
 
3
+ ## 0.1.1
4
+
5
+ ### Patch Changes
6
+
7
+ - [`2ce5df13885`](https://bitbucket.org/atlassian/atlassian-frontend/commits/2ce5df13885) - [ux] Prevent cursor selection from being reset when delete button is clicked
8
+ The fix ensures that when removing a row or column via the delete button, the cursor will stay within the table.
9
+ Reference https://discuss.prosemirror.net/t/setting-selection-to-newly-inserted-text-node/3615/6
10
+
3
11
  ## 0.1.0
4
12
 
5
13
  ### Minor Changes
@@ -154,7 +154,8 @@ var FloatingDeleteButton = /*#__PURE__*/function (_Component) {
154
154
  dispatch = _this$props$editorVie2.dispatch;
155
155
  return (0, _commands.clearHoverSelection)()(state, dispatch);
156
156
  });
157
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "handleClick", function () {
157
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "handleClick", function (event) {
158
+ event.preventDefault();
158
159
  var editorAnalyticsAPI = _this.props.editorAnalyticsAPI;
159
160
  var _this$props$editorVie3 = _this.props.editorView,
160
161
  state = _this$props$editorVie3.state,
@@ -1,4 +1,4 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-table",
3
- "version": "0.1.0"
3
+ "version": "0.1.1"
4
4
  }
@@ -96,7 +96,8 @@ class FloatingDeleteButton extends Component {
96
96
  return clearHoverSelection()(state, dispatch);
97
97
  });
98
98
 
99
- _defineProperty(this, "handleClick", () => {
99
+ _defineProperty(this, "handleClick", event => {
100
+ event.preventDefault();
100
101
  const {
101
102
  editorAnalyticsAPI
102
103
  } = this.props;
@@ -1,4 +1,4 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-table",
3
- "version": "0.1.0"
3
+ "version": "0.1.1"
4
4
  }
@@ -121,7 +121,8 @@ var FloatingDeleteButton = /*#__PURE__*/function (_Component) {
121
121
  return clearHoverSelection()(state, dispatch);
122
122
  });
123
123
 
124
- _defineProperty(_assertThisInitialized(_this), "handleClick", function () {
124
+ _defineProperty(_assertThisInitialized(_this), "handleClick", function (event) {
125
+ event.preventDefault();
125
126
  var editorAnalyticsAPI = _this.props.editorAnalyticsAPI;
126
127
  var _this$props$editorVie3 = _this.props.editorView,
127
128
  state = _this$props$editorVie3.state,
@@ -1,4 +1,4 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-table",
3
- "version": "0.1.0"
3
+ "version": "0.1.1"
4
4
  }
@@ -1,4 +1,5 @@
1
1
  import React from 'react';
2
+ import { IntlProvider } from 'react-intl-next';
2
3
  import Button from '@atlaskit/button/standard-button';
3
4
  import { customInsertMenuItems } from '@atlaskit/editor-test-helpers/mock-insert-menu';
4
5
  import { AtlassianIcon } from '@atlaskit/logo/atlassian-icon';
@@ -52,28 +53,30 @@ const editorSelectionAPI = {
52
53
  // IT IS DANGEROUS AND YOU WILL BREAK SOMETHING
53
54
  return (state as any)['selection$'];
54
55
  },
55
- setSelectionRelativeToNode: ({
56
- selectionRelativeToNode,
57
- selection,
58
- }: {
59
- selectionRelativeToNode?: RelativeSelectionPos;
60
- selection?: Selection | null;
61
- }) => (state: EditorState) => {
62
- const tr = state.tr;
63
-
64
- // THE CODE BELOW IS REALLY WRONG
65
- // DO NOT EVEN THINK TO USE THIS ANYWHERE ELSE
66
- tr.setMeta('selection$', {
67
- type: 'SET_RELATIVE_SELECTION',
56
+ setSelectionRelativeToNode:
57
+ ({
68
58
  selectionRelativeToNode,
69
- });
59
+ selection,
60
+ }: {
61
+ selectionRelativeToNode?: RelativeSelectionPos;
62
+ selection?: Selection | null;
63
+ }) =>
64
+ (state: EditorState) => {
65
+ const tr = state.tr;
66
+
67
+ // THE CODE BELOW IS REALLY WRONG
68
+ // DO NOT EVEN THINK TO USE THIS ANYWHERE ELSE
69
+ tr.setMeta('selection$', {
70
+ type: 'SET_RELATIVE_SELECTION',
71
+ selectionRelativeToNode,
72
+ });
70
73
 
71
- if (selection) {
72
- tr.setSelection(selection);
73
- }
74
+ if (selection) {
75
+ tr.setSelection(selection);
76
+ }
74
77
 
75
- return tr;
76
- },
78
+ return tr;
79
+ },
77
80
  };
78
81
 
79
82
  export default function EditorExampleForIntegrationTests({ clipboard = true }) {
@@ -189,17 +192,19 @@ export default function EditorExampleForIntegrationTests({ clipboard = true }) {
189
192
  const collabEdit = sessionId ? createCollabEdit(sessionId) : undefined;
190
193
 
191
194
  return (
192
- <Editor
193
- {...mapProvidersToProps(nonSerializableProps.providers, props)}
194
- {...nonSerializableProps.providers}
195
- insertMenuItems={customInsertMenuItems}
196
- extensionHandlers={nonSerializableProps.extensionHandlers}
197
- onEditorReady={onMount}
198
- onChange={onChange}
199
- onDestroy={onDestroy}
200
- collabEdit={collabEdit}
201
- dangerouslyAppendPlugins={dangerouslyAppendPlugins}
202
- />
195
+ <IntlProvider locale="en">
196
+ <Editor
197
+ {...mapProvidersToProps(nonSerializableProps.providers, props)}
198
+ {...nonSerializableProps.providers}
199
+ insertMenuItems={customInsertMenuItems}
200
+ extensionHandlers={nonSerializableProps.extensionHandlers}
201
+ onEditorReady={onMount}
202
+ onChange={onChange}
203
+ onDestroy={onDestroy}
204
+ collabEdit={collabEdit}
205
+ dangerouslyAppendPlugins={dangerouslyAppendPlugins}
206
+ />
207
+ </IntlProvider>
203
208
  );
204
209
  };
205
210
  const editorContent = withCollab ? (
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-table",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "Table plugin for the @atlaskit/editor",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -11,14 +11,6 @@
11
11
  "module": "dist/esm/index.js",
12
12
  "module:es2019": "dist/es2019/index.js",
13
13
  "types": "dist/types/index.d.ts",
14
- "typesVersions": {
15
- ">=4.0 <4.5": {
16
- "*": [
17
- "dist/types-ts4.0/*",
18
- "dist/types-ts4.0/index.d.ts"
19
- ]
20
- }
21
- },
22
14
  "atlaskit:src": "src/index.ts",
23
15
  "atlassian": {
24
16
  "team": "Editor",
@@ -64,13 +56,12 @@
64
56
  "@atlaskit/logo": "^13.10.0",
65
57
  "@atlaskit/media-integration-test-helpers": "^2.6.0",
66
58
  "@atlaskit/synchrony-test-helpers": "^2.3.0",
67
- "@atlaskit/util-data-test": "^17.5.5",
59
+ "@atlaskit/util-data-test": "^17.6.0",
68
60
  "@atlaskit/visual-regression": "*",
69
61
  "@atlaskit/webdriver-runner": "*",
70
62
  "@atlassian/atlassian-frontend-prettier-config-1.0.1": "npm:@atlassian/atlassian-frontend-prettier-config@1.0.1",
71
63
  "@testing-library/react": "^12.1.5",
72
64
  "@types/prosemirror-history": "^1.0.1",
73
- "enzyme": "^3.10.0",
74
65
  "prosemirror-history": "^1.1.3",
75
66
  "raf-stub": "^2.0.1",
76
67
  "typescript": "4.5.5"
@@ -169,8 +169,7 @@ const autoSizeToWideLayout = {
169
169
  content: [
170
170
  {
171
171
  type: 'text',
172
- text:
173
- 'Lorem ipsum dolor sit amet, consectetur adipiscing elit.',
172
+ text: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit.',
174
173
  },
175
174
  ],
176
175
  },
@@ -195,8 +194,7 @@ const autoSizeToWideLayout = {
195
194
  content: [
196
195
  {
197
196
  type: 'text',
198
- text:
199
- 'Lorem ipsum dolor sit amet, consectetur adipiscing elit.',
197
+ text: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit.',
200
198
  },
201
199
  ],
202
200
  },
@@ -316,8 +314,7 @@ const autoSizeToFullWidthLayout = {
316
314
  content: [
317
315
  {
318
316
  type: 'text',
319
- text:
320
- 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aenean mi nisl, venenatis eget auctor vitae, venenatis quis lorem. Suspendisse maximus tortor vel dui tincidunt cursus. Vestibulum magna nibh, auctor non auctor id, finibus vitae orci. Nulla viverra ipsum et nunc fringilla ultricies. Pellentesque vitae felis molestie justo finibus accumsan. Suspendisse potenti. Nulla facilisi. Integer dignissim quis velit quis elementum. Sed sit amet varius ante. Duis vestibulum porta augue eu laoreet. Morbi id risus et augue sollicitudin aliquam. In et ligula dolor. Nam ac aliquet diam.',
317
+ text: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aenean mi nisl, venenatis eget auctor vitae, venenatis quis lorem. Suspendisse maximus tortor vel dui tincidunt cursus. Vestibulum magna nibh, auctor non auctor id, finibus vitae orci. Nulla viverra ipsum et nunc fringilla ultricies. Pellentesque vitae felis molestie justo finibus accumsan. Suspendisse potenti. Nulla facilisi. Integer dignissim quis velit quis elementum. Sed sit amet varius ante. Duis vestibulum porta augue eu laoreet. Morbi id risus et augue sollicitudin aliquam. In et ligula dolor. Nam ac aliquet diam.',
321
318
  },
322
319
  ],
323
320
  },
@@ -367,8 +364,7 @@ const autoSizeToFullWidthLayout = {
367
364
  content: [
368
365
  {
369
366
  type: 'text',
370
- text:
371
- 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aenean mi nisl, venenatis eget auctor vitae, venenatis quis lorem. Suspendisse maximus tortor vel dui tincidunt cursus. Vestibulum magna nibh, auctor non auctor id, finibus vitae orci. Nulla viverra ipsum et nunc fringilla ultricies. Pellentesque vitae felis molestie justo finibus accumsan. Suspendisse potenti. Nulla facilisi. Integer dignissim quis velit quis elementum. Sed sit amet varius ante. Duis vestibulum porta augue eu laoreet. Morbi id risus et augue sollicitudin aliquam. In et ligula dolor. Nam ac aliquet diam.',
367
+ text: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aenean mi nisl, venenatis eget auctor vitae, venenatis quis lorem. Suspendisse maximus tortor vel dui tincidunt cursus. Vestibulum magna nibh, auctor non auctor id, finibus vitae orci. Nulla viverra ipsum et nunc fringilla ultricies. Pellentesque vitae felis molestie justo finibus accumsan. Suspendisse potenti. Nulla facilisi. Integer dignissim quis velit quis elementum. Sed sit amet varius ante. Duis vestibulum porta augue eu laoreet. Morbi id risus et augue sollicitudin aliquam. In et ligula dolor. Nam ac aliquet diam.',
372
368
  },
373
369
  ],
374
370
  },
@@ -418,8 +414,7 @@ const autoSizeToFullWidthLayout = {
418
414
  content: [
419
415
  {
420
416
  type: 'text',
421
- text:
422
- 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aenean mi nisl, venenatis eget auctor vitae, venenatis quis lorem. Suspendisse maximus tortor vel dui tincidunt cursus. Vestibulum magna nibh, auctor non auctor id, finibus vitae orci. Nulla viverra ipsum et nunc fringilla ultricies. Pellentesque vitae felis molestie justo finibus accumsan. Suspendisse potenti. Nulla facilisi. Integer dignissim quis velit quis elementum. Sed sit amet varius ante. Duis vestibulum porta augue eu laoreet. Morbi id risus et augue sollicitudin aliquam. In et ligula dolor. Nam ac aliquet diam.',
417
+ text: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aenean mi nisl, venenatis eget auctor vitae, venenatis quis lorem. Suspendisse maximus tortor vel dui tincidunt cursus. Vestibulum magna nibh, auctor non auctor id, finibus vitae orci. Nulla viverra ipsum et nunc fringilla ultricies. Pellentesque vitae felis molestie justo finibus accumsan. Suspendisse potenti. Nulla facilisi. Integer dignissim quis velit quis elementum. Sed sit amet varius ante. Duis vestibulum porta augue eu laoreet. Morbi id risus et augue sollicitudin aliquam. In et ligula dolor. Nam ac aliquet diam.',
423
418
  },
424
419
  ],
425
420
  },
@@ -271,8 +271,7 @@ const nestedTables = {
271
271
  content: [
272
272
  {
273
273
  type: 'text',
274
- text:
275
- 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aenean mi nisl, venenatis eget auctor vitae, venenatis quis lorem. Suspendisse maximus tortor vel dui tincidunt cursus. Vestibulum magna nibh, auctor non auctor id, finibus vitae orci. Nulla viverra ipsum et nunc fringilla ultricies. Pellentesque vitae felis molestie justo finibus accumsan. Suspendisse potenti. Nulla facilisi. Integer dignissim quis velit quis elementum. Sed sit amet varius ante. Duis vestibulum porta augue eu laoreet. Morbi id risus et augue sollicitudin aliquam. In et ligula dolor. Nam ac aliquet diam.',
274
+ text: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aenean mi nisl, venenatis eget auctor vitae, venenatis quis lorem. Suspendisse maximus tortor vel dui tincidunt cursus. Vestibulum magna nibh, auctor non auctor id, finibus vitae orci. Nulla viverra ipsum et nunc fringilla ultricies. Pellentesque vitae felis molestie justo finibus accumsan. Suspendisse potenti. Nulla facilisi. Integer dignissim quis velit quis elementum. Sed sit amet varius ante. Duis vestibulum porta augue eu laoreet. Morbi id risus et augue sollicitudin aliquam. In et ligula dolor. Nam ac aliquet diam.',
276
275
  },
277
276
  ],
278
277
  },
@@ -212,8 +212,7 @@ export const twoColFullWidthTableWithContent = {
212
212
  },
213
213
  {
214
214
  type: 'text',
215
- text:
216
- '2. Paste a jira link in for the href and immediately close the bracket to complete the markdown',
215
+ text: '2. Paste a jira link in for the href and immediately close the bracket to complete the markdown',
217
216
  },
218
217
  ],
219
218
  },
@@ -229,8 +228,7 @@ export const twoColFullWidthTableWithContent = {
229
228
  },
230
229
  {
231
230
  type: 'text',
232
- text:
233
- 'markdown for URL works correctly? or smartcard overrides it?',
231
+ text: 'markdown for URL works correctly? or smartcard overrides it?',
234
232
  },
235
233
  ],
236
234
  },
@@ -246,8 +244,7 @@ export const twoColFullWidthTableWithContent = {
246
244
  },
247
245
  {
248
246
  type: 'text',
249
- text:
250
- 'Smartcard link for Jira is still being processed and is entered as the value for the markdown for the URL ',
247
+ text: 'Smartcard link for Jira is still being processed and is entered as the value for the markdown for the URL ',
251
248
  },
252
249
  {
253
250
  type: 'emoji',
@@ -262,8 +259,7 @@ export const twoColFullWidthTableWithContent = {
262
259
  },
263
260
  {
264
261
  type: 'text',
265
- text:
266
- 'URL ends up pointing to the confluence edit link but without a page ID so 404s',
262
+ text: 'URL ends up pointing to the confluence edit link but without a page ID so 404s',
267
263
  },
268
264
  ],
269
265
  },
@@ -302,8 +298,7 @@ export const twoColFullWidthTableWithContent = {
302
298
  content: [
303
299
  {
304
300
  type: 'text',
305
- text:
306
- "Publishing somewhat big pages doesn't really provide any indication to the user that their page is actually being published and they're going to be navigated away",
301
+ text: "Publishing somewhat big pages doesn't really provide any indication to the user that their page is actually being published and they're going to be navigated away",
307
302
  },
308
303
  ],
309
304
  },
@@ -185,8 +185,7 @@ BrowserTestCase(
185
185
  featureFlags: {},
186
186
  },
187
187
  {
188
- test:
189
- 'Should stack columns to the right and go to overflow with overflowShadowsOptimisation',
188
+ test: 'Should stack columns to the right and go to overflow with overflowShadowsOptimisation',
190
189
  featureFlags: {
191
190
  tableOverflowShadowsOptimization: true,
192
191
  },
@@ -1,5 +1,9 @@
1
1
  import { Rect } from '@atlaskit/editor-tables/table-map';
2
- import { createEditorFactory } from '@atlaskit/editor-test-helpers/create-editor';
2
+ import {
3
+ createProsemirrorEditorFactory,
4
+ LightEditorPlugin,
5
+ Preset,
6
+ } from '@atlaskit/editor-test-helpers/create-prosemirror-editor';
3
7
  import {
4
8
  doc,
5
9
  p,
@@ -14,7 +18,7 @@ import {
14
18
  import sendKeyToPm from '@atlaskit/editor-test-helpers/send-key-to-pm';
15
19
  import { B50 } from '@atlaskit/theme/colors';
16
20
 
17
- import { TablePluginState, PluginConfig } from '../../plugins/table/types';
21
+ import { PluginConfig } from '../../plugins/table/types';
18
22
  import {
19
23
  deleteTableWithAnalytics,
20
24
  emptyMultipleCellsWithAnalytics,
@@ -37,11 +41,15 @@ import { pluginKey } from '../../plugins/table/pm-plugins/plugin-key';
37
41
  import { replaceSelectedTable } from '../../plugins/table/transforms';
38
42
  import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
39
43
  import tablePlugin from '../../plugins/table-plugin';
40
-
41
- const defaultTable = table()(
42
- tr(thEmpty, thEmpty, thEmpty),
43
- tr(tdEmpty, tdEmpty, tdEmpty),
44
- tr(tdEmpty, tdEmpty, tdCursor),
44
+ import typeAheadPlugin from '@atlaskit/editor-core/src/plugins/type-ahead';
45
+ import quickInsertPlugin from '@atlaskit/editor-core/src/plugins/quick-insert';
46
+
47
+ const defaultTableDoc = doc(
48
+ table()(
49
+ tr(thEmpty, thEmpty, thEmpty),
50
+ tr(tdEmpty, tdEmpty, tdEmpty),
51
+ tr(tdEmpty, tdEmpty, tdCursor),
52
+ ),
45
53
  );
46
54
 
47
55
  const secondRow: Rect = { left: 0, top: 1, bottom: 2, right: 3 };
@@ -57,7 +65,7 @@ describe('Table analytic events', () => {
57
65
  };
58
66
  });
59
67
 
60
- const createEditor = createEditorFactory<TablePluginState>();
68
+ const createEditor = createProsemirrorEditorFactory();
61
69
 
62
70
  const editor = (doc: DocBuilder) => {
63
71
  const tableOptions = {
@@ -69,20 +77,13 @@ describe('Table analytic events', () => {
69
77
 
70
78
  const _editor = createEditor({
71
79
  doc,
72
- editorProps: {
73
- allowTables: false,
74
- allowAnalyticsGASV3: true,
75
- appearance: 'full-page',
76
- quickInsert: true,
77
- dangerouslyAppendPlugins: {
78
- __plugins: [
79
- tablePlugin({
80
- tableOptions,
81
- editorAnalyticsAPI: editorAnalyticsAPIFake,
82
- }),
83
- ],
84
- },
85
- },
80
+ preset: new Preset<LightEditorPlugin>()
81
+ .add(typeAheadPlugin)
82
+ .add(quickInsertPlugin)
83
+ .add([
84
+ tablePlugin,
85
+ { tableOptions, editorAnalyticsAPI: editorAnalyticsAPIFake },
86
+ ]),
86
87
  pluginKey,
87
88
  });
88
89
 
@@ -108,7 +109,7 @@ describe('Table analytic events', () => {
108
109
 
109
110
  describe('table deleted', () => {
110
111
  beforeEach(() => {
111
- const { editorView } = editor(doc(defaultTable));
112
+ const { editorView } = editor(defaultTableDoc);
112
113
  deleteTableWithAnalytics(editorAnalyticsAPIFake)(
113
114
  editorView.state,
114
115
  editorView.dispatch,
@@ -334,7 +335,7 @@ describe('Table analytic events', () => {
334
335
 
335
336
  describe('header row toggled', () => {
336
337
  beforeEach(() => {
337
- const { editorView } = editor(defaultTable);
338
+ const { editorView } = editor(defaultTableDoc);
338
339
  toggleHeaderRowWithAnalytics(editorAnalyticsAPIFake)(
339
340
  editorView.state,
340
341
  editorView.dispatch,
@@ -358,7 +359,7 @@ describe('Table analytic events', () => {
358
359
 
359
360
  describe('header column toggled', () => {
360
361
  beforeEach(() => {
361
- const { editorView } = editor(defaultTable);
362
+ const { editorView } = editor(defaultTableDoc);
362
363
  toggleHeaderColumnWithAnalytics(editorAnalyticsAPIFake)(
363
364
  editorView.state,
364
365
  editorView.dispatch,
@@ -382,7 +383,7 @@ describe('Table analytic events', () => {
382
383
 
383
384
  describe('number column toggled', () => {
384
385
  beforeEach(() => {
385
- const { editorView } = editor(defaultTable);
386
+ const { editorView } = editor(defaultTableDoc);
386
387
  toggleNumberColumnWithAnalytics(editorAnalyticsAPIFake)(
387
388
  editorView.state,
388
389
  editorView.dispatch,
@@ -407,7 +408,7 @@ describe('Table analytic events', () => {
407
408
  describe('layout changed', () => {
408
409
  describe('normal', () => {
409
410
  it('should fire v3 analytics', () => {
410
- const { editorView } = editor(defaultTable);
411
+ const { editorView } = editor(defaultTableDoc);
411
412
  toggleTableLayoutWithAnalytics(editorAnalyticsAPIFake)(
412
413
  editorView.state,
413
414
  editorView.dispatch,
@@ -536,7 +537,7 @@ describe('Table analytic events', () => {
536
537
  describe('row added', () => {
537
538
  describe('context menu', () => {
538
539
  beforeEach(() => {
539
- const { editorView } = editor(defaultTable);
540
+ const { editorView } = editor(defaultTableDoc);
540
541
  insertRowWithAnalytics(editorAnalyticsAPIFake)(
541
542
  INPUT_METHOD.CONTEXT_MENU,
542
543
  {
@@ -565,7 +566,7 @@ describe('Table analytic events', () => {
565
566
  describe('keyboard', () => {
566
567
  describe('Tab', () => {
567
568
  beforeEach(() => {
568
- const { editorView } = editor(defaultTable);
569
+ const { editorView } = editor(defaultTableDoc);
569
570
  sendKeyToPm(editorView, 'Tab');
570
571
  });
571
572
 
@@ -622,7 +623,7 @@ describe('Table analytic events', () => {
622
623
  return { width: 500 };
623
624
  };
624
625
  beforeEach(() => {
625
- const { editorView } = editor(defaultTable);
626
+ const { editorView } = editor(defaultTableDoc);
626
627
  insertColumnWithAnalytics(
627
628
  getEditorContainerWidth,
628
629
  editorAnalyticsAPIFake,
@@ -651,7 +652,7 @@ describe('Table analytic events', () => {
651
652
 
652
653
  describe('row deleted', () => {
653
654
  beforeEach(() => {
654
- const { editorView } = editor(defaultTable);
655
+ const { editorView } = editor(defaultTableDoc);
655
656
  deleteRowsWithAnalytics(editorAnalyticsAPIFake)(
656
657
  INPUT_METHOD.CONTEXT_MENU,
657
658
  secondRow,
@@ -678,7 +679,7 @@ describe('Table analytic events', () => {
678
679
 
679
680
  describe('column deleted', () => {
680
681
  beforeEach(() => {
681
- const { editorView } = editor(defaultTable);
682
+ const { editorView } = editor(defaultTableDoc);
682
683
  deleteColumnsWithAnalytics(editorAnalyticsAPIFake)(
683
684
  INPUT_METHOD.CONTEXT_MENU,
684
685
  secondColumn,
@@ -8,16 +8,22 @@ import {
8
8
  DocBuilder,
9
9
  } from '@atlaskit/editor-test-helpers/doc-builder';
10
10
  import { removeColumnAt } from '@atlaskit/editor-tables/utils';
11
- import { TablePluginState, PluginConfig } from '../../plugins/table/types';
11
+ import { PluginConfig } from '../../plugins/table/types';
12
12
 
13
13
  import { setResizeHandlePos } from '../../plugins/table/pm-plugins/table-resizing/commands';
14
14
  import { pluginKey as tablePluginKey } from '../../plugins/table/pm-plugins/plugin-key';
15
- import { createEditorFactory } from '@atlaskit/editor-test-helpers/create-editor';
15
+ import {
16
+ createProsemirrorEditorFactory,
17
+ LightEditorPlugin,
18
+ Preset,
19
+ } from '@atlaskit/editor-test-helpers/create-prosemirror-editor';
16
20
  import tablePlugin from '../../plugins/table-plugin';
21
+ import widthPlugin from '@atlaskit/editor-core/src/plugins/width';
22
+
17
23
  const TABLE_LOCAL_ID = 'test-table-local-id';
18
24
 
19
25
  describe('Tables with Collab editing', () => {
20
- const createEditor = createEditorFactory<TablePluginState>();
26
+ const createEditor = createProsemirrorEditorFactory();
21
27
  const tableOptions = {
22
28
  allowNumberColumn: true,
23
29
  allowHeaderRow: true,
@@ -29,12 +35,9 @@ describe('Tables with Collab editing', () => {
29
35
  const editor = (doc: DocBuilder) => {
30
36
  return createEditor({
31
37
  doc,
32
- editorProps: {
33
- allowTables: false,
34
- dangerouslyAppendPlugins: {
35
- __plugins: [tablePlugin({ tableOptions })],
36
- },
37
- },
38
+ preset: new Preset<LightEditorPlugin>()
39
+ .add([tablePlugin, { tableOptions }])
40
+ .add(widthPlugin),
38
41
  pluginKey: tablePluginKey,
39
42
  });
40
43
  };
@@ -1,4 +1,8 @@
1
- import { createEditorFactory } from '@atlaskit/editor-test-helpers/create-editor';
1
+ import {
2
+ createProsemirrorEditorFactory,
3
+ LightEditorPlugin,
4
+ Preset,
5
+ } from '@atlaskit/editor-test-helpers/create-prosemirror-editor';
2
6
  import {
3
7
  doc,
4
8
  p,
@@ -12,11 +16,14 @@ import {
12
16
  status,
13
17
  } from '@atlaskit/editor-test-helpers/doc-builder';
14
18
  import { EditorView } from 'prosemirror-view';
15
- import { mentionResourceProvider } from '@atlaskit/util-data-test/mention-story-data';
16
19
  import { sortByColumn } from '../../../plugins/table/commands/sort';
17
20
  import { uuid } from '@atlaskit/adf-schema';
18
21
  import { TableSortOrder as SortOrder } from '@atlaskit/adf-schema/steps';
19
22
  import tablePlugin from '../../../plugins/table-plugin';
23
+ import statusPlugin from '@atlaskit/editor-core/src/plugins/status';
24
+ import mentionsPlugin from '@atlaskit/editor-core/src/plugins/mentions';
25
+ import hyperlinkPlugin from '@atlaskit/editor-core/src/plugins/hyperlink';
26
+ import datePlugin from '@atlaskit/editor-core/src/plugins/date';
20
27
 
21
28
  const TABLE_LOCAL_ID = 'test-table-local-id';
22
29
 
@@ -29,14 +36,13 @@ describe('Sort Table', () => {
29
36
  uuid.setStatic(false);
30
37
  });
31
38
 
32
- const createEditor = createEditorFactory();
39
+ const createEditor = createProsemirrorEditorFactory();
33
40
  it('should test a basic table with heading', () => {
34
41
  const { editorView } = createEditor({
35
- editorProps: {
36
- dangerouslyAppendPlugins: {
37
- __plugins: [tablePlugin({ tableOptions: { allowHeaderRow: true } })],
38
- },
39
- },
42
+ preset: new Preset<LightEditorPlugin>().add([
43
+ tablePlugin,
44
+ { tableOptions: { allowHeaderRow: true } },
45
+ ]),
40
46
  doc: doc(
41
47
  table()(
42
48
  tr(th({})(p('Number{<>}'))),
@@ -62,11 +68,10 @@ describe('Sort Table', () => {
62
68
 
63
69
  it('should test a basic table descending', () => {
64
70
  const { editorView } = createEditor({
65
- editorProps: {
66
- dangerouslyAppendPlugins: {
67
- __plugins: [tablePlugin({ tableOptions: { allowHeaderRow: true } })],
68
- },
69
- },
71
+ preset: new Preset<LightEditorPlugin>().add([
72
+ tablePlugin,
73
+ { tableOptions: { allowHeaderRow: true } },
74
+ ]),
70
75
  doc: doc(
71
76
  table()(tr(td({})(p('2{<>}'))), tr(td({})(p('5'))), tr(td({})(p('4')))),
72
77
  ),
@@ -86,11 +91,10 @@ describe('Sort Table', () => {
86
91
 
87
92
  it('should test a basic table ascending', () => {
88
93
  const { editorView } = createEditor({
89
- editorProps: {
90
- dangerouslyAppendPlugins: {
91
- __plugins: [tablePlugin({ tableOptions: { allowHeaderRow: true } })],
92
- },
93
- },
94
+ preset: new Preset<LightEditorPlugin>().add([
95
+ tablePlugin,
96
+ { tableOptions: { allowHeaderRow: true } },
97
+ ]),
94
98
  doc: doc(
95
99
  table()(tr(td({})(p('2{<>}'))), tr(td({})(p('5'))), tr(td({})(p('4')))),
96
100
  ),
@@ -113,16 +117,12 @@ describe('Sort Table', () => {
113
117
 
114
118
  beforeEach(() => {
115
119
  ({ editorView } = createEditor({
116
- editorProps: {
117
- allowStatus: true,
118
- allowDate: true,
119
- dangerouslyAppendPlugins: {
120
- __plugins: [
121
- tablePlugin({ tableOptions: { allowHeaderRow: true } }),
122
- ],
123
- },
124
- mentionProvider: Promise.resolve(mentionResourceProvider),
125
- },
120
+ preset: new Preset<LightEditorPlugin>()
121
+ .add([tablePlugin, { tableOptions: { allowHeaderRow: true } }])
122
+ .add([statusPlugin, { menuDisabled: false }])
123
+ .add(mentionsPlugin)
124
+ .add(hyperlinkPlugin)
125
+ .add(datePlugin),
126
126
  doc: doc(
127
127
  table()(
128
128
  tr(th({})(p('Mixed{<>}'))),
@@ -49,14 +49,12 @@ const array = (...args: any): Node[] => args.map((i: any) => i(defaultSchema));
49
49
  const fragment = (...args: any) =>
50
50
  Fragment.from(args.map((i: any) => i(defaultSchema)));
51
51
 
52
- const selectCell = (cell: {
53
- pos: number;
54
- start: number;
55
- node: ProsemirrorNode;
56
- }) => (tr: Transaction) => {
57
- const $anchor = tr.doc.resolve(cell.pos);
58
- return tr.setSelection(new CellSelection($anchor, $anchor) as any);
59
- };
52
+ const selectCell =
53
+ (cell: { pos: number; start: number; node: ProsemirrorNode }) =>
54
+ (tr: Transaction) => {
55
+ const $anchor = tr.doc.resolve(cell.pos);
56
+ return tr.setSelection(new CellSelection($anchor, $anchor) as any);
57
+ };
60
58
 
61
59
  const copySelectionAndPasteAtPos = ({
62
60
  editorView,