@atlaskit/editor-plugin-table 2.10.1 → 2.10.3
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.
- package/CHANGELOG.md +13 -0
- package/dist/cjs/plugins/table/nodeviews/TableComponent.js +9 -3
- package/dist/cjs/plugins/table/nodeviews/TableContainer.js +28 -2
- package/dist/cjs/plugins/table/nodeviews/TableResizer.js +12 -4
- package/dist/cjs/plugins/table/nodeviews/table.js +4 -2
- package/dist/es2019/plugins/table/nodeviews/TableComponent.js +9 -3
- package/dist/es2019/plugins/table/nodeviews/TableContainer.js +29 -3
- package/dist/es2019/plugins/table/nodeviews/TableResizer.js +12 -4
- package/dist/es2019/plugins/table/nodeviews/table.js +3 -1
- package/dist/esm/plugins/table/nodeviews/TableComponent.js +9 -3
- package/dist/esm/plugins/table/nodeviews/TableContainer.js +29 -3
- package/dist/esm/plugins/table/nodeviews/TableResizer.js +12 -4
- package/dist/esm/plugins/table/nodeviews/table.js +4 -2
- package/dist/types/plugins/table/nodeviews/TableContainer.d.ts +4 -2
- package/dist/types/plugins/table/nodeviews/TableResizer.d.ts +3 -1
- package/dist/types/plugins/table/nodeviews/table.d.ts +4 -4
- package/dist/types-ts4.5/plugins/table/nodeviews/TableContainer.d.ts +4 -2
- package/dist/types-ts4.5/plugins/table/nodeviews/TableResizer.d.ts +3 -1
- package/dist/types-ts4.5/plugins/table/nodeviews/table.d.ts +4 -4
- package/package.json +3 -3
- package/src/__tests__/unit/commands/go-to-next-cell.ts +5 -5
- package/src/__tests__/unit/commands/insert.ts +5 -5
- package/src/__tests__/unit/commands/misc.ts +6 -8
- package/src/__tests__/unit/copy-paste.ts +10 -13
- package/src/__tests__/unit/event-handlers/index.ts +6 -6
- package/src/__tests__/unit/handlers.ts +6 -5
- package/src/__tests__/unit/hover-selection.ts +7 -6
- package/src/__tests__/unit/layout.ts +6 -6
- package/src/__tests__/unit/pm-plugins/decorations/column-resizing.ts +23 -23
- package/src/__tests__/unit/sort-column.ts +5 -5
- package/src/__tests__/unit/transforms/delete-columns.ts +6 -6
- package/src/__tests__/unit/transforms/delete-rows.ts +6 -6
- package/src/__tests__/unit/transforms/merging.ts +5 -5
- package/src/__tests__/unit/ui/TableFloatingControls.tsx +5 -5
- package/src/__tests__/unit/utils.ts +5 -5
- package/src/plugins/table/nodeviews/TableComponent.tsx +20 -3
- package/src/plugins/table/nodeviews/TableContainer.tsx +48 -3
- package/src/plugins/table/nodeviews/TableResizer.tsx +24 -4
- package/src/plugins/table/nodeviews/table.tsx +14 -7
|
@@ -3,10 +3,10 @@ import type { EventDispatcher } from '@atlaskit/editor-common/event-dispatcher';
|
|
|
3
3
|
import type { PortalProviderAPI } from '@atlaskit/editor-common/portal-provider';
|
|
4
4
|
import ReactNodeView from '@atlaskit/editor-common/react-node-view';
|
|
5
5
|
import type { GetEditorContainerWidth, GetEditorFeatureFlags, getPosHandler, getPosHandlerNode } from '@atlaskit/editor-common/types';
|
|
6
|
-
import { Node as PmNode } from '@atlaskit/editor-prosemirror/model';
|
|
7
|
-
import { EditorView, NodeView } from '@atlaskit/editor-prosemirror/view';
|
|
8
|
-
import { PluginInjectionAPI } from '../types';
|
|
9
|
-
import { Props, TableOptions } from './types';
|
|
6
|
+
import type { Node as PmNode } from '@atlaskit/editor-prosemirror/model';
|
|
7
|
+
import type { EditorView, NodeView } from '@atlaskit/editor-prosemirror/view';
|
|
8
|
+
import type { PluginInjectionAPI } from '../types';
|
|
9
|
+
import type { Props, TableOptions } from './types';
|
|
10
10
|
type ForwardRef = (node: HTMLElement | null) => void;
|
|
11
11
|
export default class TableView extends ReactNodeView<Props> {
|
|
12
12
|
private table;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-table",
|
|
3
|
-
"version": "2.10.
|
|
3
|
+
"version": "2.10.3",
|
|
4
4
|
"description": "Table plugin for the @atlaskit/editor",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
},
|
|
29
29
|
"dependencies": {
|
|
30
30
|
"@atlaskit/adf-schema": "^28.1.0",
|
|
31
|
-
"@atlaskit/editor-common": "^74.
|
|
31
|
+
"@atlaskit/editor-common": "^74.49.0",
|
|
32
32
|
"@atlaskit/editor-palette": "1.5.1",
|
|
33
33
|
"@atlaskit/editor-plugin-analytics": "^0.1.0",
|
|
34
34
|
"@atlaskit/editor-plugin-content-insertion": "^0.0.8",
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
"@atlaskit/icon": "^21.12.0",
|
|
39
39
|
"@atlaskit/platform-feature-flags": "^0.2.1",
|
|
40
40
|
"@atlaskit/theme": "^12.5.0",
|
|
41
|
-
"@atlaskit/tokens": "^1.
|
|
41
|
+
"@atlaskit/tokens": "^1.15.0",
|
|
42
42
|
"@atlaskit/tooltip": "^17.8.0",
|
|
43
43
|
"@babel/runtime": "^7.0.0",
|
|
44
44
|
"@emotion/react": "^11.7.1",
|
|
@@ -4,15 +4,15 @@ import { contentInsertionPlugin } from '@atlaskit/editor-plugin-content-insertio
|
|
|
4
4
|
import featureFlagsPlugin from '@atlaskit/editor-plugin-feature-flags';
|
|
5
5
|
import { guidelinePlugin } from '@atlaskit/editor-plugin-guideline';
|
|
6
6
|
import { widthPlugin } from '@atlaskit/editor-plugin-width';
|
|
7
|
-
import { PluginKey } from '@atlaskit/editor-prosemirror/state';
|
|
7
|
+
import type { PluginKey } from '@atlaskit/editor-prosemirror/state';
|
|
8
|
+
import type { LightEditorPlugin } from '@atlaskit/editor-test-helpers/create-prosemirror-editor';
|
|
8
9
|
import {
|
|
9
10
|
createProsemirrorEditorFactory,
|
|
10
|
-
LightEditorPlugin,
|
|
11
11
|
Preset,
|
|
12
12
|
} from '@atlaskit/editor-test-helpers/create-prosemirror-editor';
|
|
13
|
+
import type { DocBuilder } from '@atlaskit/editor-test-helpers/doc-builder';
|
|
13
14
|
import {
|
|
14
15
|
doc,
|
|
15
|
-
DocBuilder,
|
|
16
16
|
p,
|
|
17
17
|
table,
|
|
18
18
|
td,
|
|
@@ -24,7 +24,7 @@ import {
|
|
|
24
24
|
import tablePlugin from '../../../plugins/table';
|
|
25
25
|
import { goToNextCell } from '../../../plugins/table/commands/go-to-next-cell';
|
|
26
26
|
import { pluginKey } from '../../../plugins/table/pm-plugins/plugin-key';
|
|
27
|
-
import { TablePluginState } from '../../../plugins/table/types';
|
|
27
|
+
import type { TablePluginState } from '../../../plugins/table/types';
|
|
28
28
|
|
|
29
29
|
const TABLE_LOCAL_ID = 'test-table-local-id';
|
|
30
30
|
|
|
@@ -43,7 +43,7 @@ describe('table plugin: goToNextCell', () => {
|
|
|
43
43
|
.add(guidelinePlugin)
|
|
44
44
|
.add(tablePlugin);
|
|
45
45
|
const editor = (doc: DocBuilder) =>
|
|
46
|
-
createEditor<TablePluginState, PluginKey>({
|
|
46
|
+
createEditor<TablePluginState, PluginKey, typeof preset>({
|
|
47
47
|
doc,
|
|
48
48
|
preset,
|
|
49
49
|
pluginKey,
|
|
@@ -4,15 +4,15 @@ import { contentInsertionPlugin } from '@atlaskit/editor-plugin-content-insertio
|
|
|
4
4
|
import featureFlagsPlugin from '@atlaskit/editor-plugin-feature-flags';
|
|
5
5
|
import { guidelinePlugin } from '@atlaskit/editor-plugin-guideline';
|
|
6
6
|
import { widthPlugin } from '@atlaskit/editor-plugin-width';
|
|
7
|
-
import { PluginKey } from '@atlaskit/editor-prosemirror/state';
|
|
7
|
+
import type { PluginKey } from '@atlaskit/editor-prosemirror/state';
|
|
8
|
+
import type { LightEditorPlugin } from '@atlaskit/editor-test-helpers/create-prosemirror-editor';
|
|
8
9
|
import {
|
|
9
10
|
createProsemirrorEditorFactory,
|
|
10
|
-
LightEditorPlugin,
|
|
11
11
|
Preset,
|
|
12
12
|
} from '@atlaskit/editor-test-helpers/create-prosemirror-editor';
|
|
13
|
+
import type { DocBuilder } from '@atlaskit/editor-test-helpers/doc-builder';
|
|
13
14
|
import {
|
|
14
15
|
doc,
|
|
15
|
-
DocBuilder,
|
|
16
16
|
p,
|
|
17
17
|
table,
|
|
18
18
|
td,
|
|
@@ -23,7 +23,7 @@ import {
|
|
|
23
23
|
import tablePlugin from '../../../plugins/table';
|
|
24
24
|
import { addColumnAt } from '../../../plugins/table/commands/insert';
|
|
25
25
|
import { pluginKey } from '../../../plugins/table/pm-plugins/plugin-key';
|
|
26
|
-
import { TablePluginState } from '../../../plugins/table/types';
|
|
26
|
+
import type { TablePluginState } from '../../../plugins/table/types';
|
|
27
27
|
|
|
28
28
|
const TABLE_LOCAL_ID = 'test-table-local-id';
|
|
29
29
|
|
|
@@ -54,7 +54,7 @@ describe('table plugin: insert', () => {
|
|
|
54
54
|
]);
|
|
55
55
|
|
|
56
56
|
const editor = (doc: DocBuilder) =>
|
|
57
|
-
createEditor<TablePluginState, PluginKey>({
|
|
57
|
+
createEditor<TablePluginState, PluginKey, typeof preset>({
|
|
58
58
|
doc,
|
|
59
59
|
preset,
|
|
60
60
|
pluginKey,
|
|
@@ -4,16 +4,16 @@ import { decorationsPlugin } from '@atlaskit/editor-plugin-decorations';
|
|
|
4
4
|
import featureFlagsPlugin from '@atlaskit/editor-plugin-feature-flags';
|
|
5
5
|
import { guidelinePlugin } from '@atlaskit/editor-plugin-guideline';
|
|
6
6
|
import { widthPlugin } from '@atlaskit/editor-plugin-width';
|
|
7
|
-
import { PluginKey } from '@atlaskit/editor-prosemirror/state';
|
|
7
|
+
import type { PluginKey } from '@atlaskit/editor-prosemirror/state';
|
|
8
8
|
import { isColumnSelected } from '@atlaskit/editor-tables/utils';
|
|
9
|
+
import type { LightEditorPlugin } from '@atlaskit/editor-test-helpers/create-prosemirror-editor';
|
|
9
10
|
import {
|
|
10
11
|
createProsemirrorEditorFactory,
|
|
11
|
-
LightEditorPlugin,
|
|
12
12
|
Preset,
|
|
13
13
|
} from '@atlaskit/editor-test-helpers/create-prosemirror-editor';
|
|
14
|
+
import type { DocBuilder } from '@atlaskit/editor-test-helpers/doc-builder';
|
|
14
15
|
import {
|
|
15
16
|
doc,
|
|
16
|
-
DocBuilder,
|
|
17
17
|
p,
|
|
18
18
|
table,
|
|
19
19
|
td,
|
|
@@ -29,10 +29,8 @@ import {
|
|
|
29
29
|
import { getDecorations } from '../../../plugins/table/pm-plugins/decorations/plugin';
|
|
30
30
|
import { getPluginState } from '../../../plugins/table/pm-plugins/plugin-factory';
|
|
31
31
|
import { pluginKey } from '../../../plugins/table/pm-plugins/plugin-key';
|
|
32
|
-
import {
|
|
33
|
-
|
|
34
|
-
TablePluginState,
|
|
35
|
-
} from '../../../plugins/table/types';
|
|
32
|
+
import type { TablePluginState } from '../../../plugins/table/types';
|
|
33
|
+
import { TableDecorations } from '../../../plugins/table/types';
|
|
36
34
|
|
|
37
35
|
describe('table plugin: commands', () => {
|
|
38
36
|
const createEditor = createProsemirrorEditorFactory();
|
|
@@ -50,7 +48,7 @@ describe('table plugin: commands', () => {
|
|
|
50
48
|
},
|
|
51
49
|
]);
|
|
52
50
|
const editor = (doc: DocBuilder) =>
|
|
53
|
-
createEditor<TablePluginState, PluginKey>({
|
|
51
|
+
createEditor<TablePluginState, PluginKey, typeof preset>({
|
|
54
52
|
doc,
|
|
55
53
|
preset,
|
|
56
54
|
pluginKey,
|
|
@@ -7,38 +7,35 @@ import { contentInsertionPlugin } from '@atlaskit/editor-plugin-content-insertio
|
|
|
7
7
|
import featureFlagsPlugin from '@atlaskit/editor-plugin-feature-flags';
|
|
8
8
|
import { guidelinePlugin } from '@atlaskit/editor-plugin-guideline';
|
|
9
9
|
import { widthPlugin } from '@atlaskit/editor-plugin-width';
|
|
10
|
-
import {
|
|
11
|
-
Fragment,
|
|
10
|
+
import type {
|
|
12
11
|
Node as ProsemirrorNode,
|
|
13
12
|
Schema,
|
|
14
|
-
Slice,
|
|
15
13
|
} from '@atlaskit/editor-prosemirror/model';
|
|
16
|
-
import {
|
|
14
|
+
import { Fragment, Slice } from '@atlaskit/editor-prosemirror/model';
|
|
15
|
+
import type {
|
|
17
16
|
PluginKey,
|
|
18
|
-
TextSelection,
|
|
19
17
|
Transaction,
|
|
20
18
|
} from '@atlaskit/editor-prosemirror/state';
|
|
21
|
-
import {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
} from '@atlaskit/editor-prosemirror/view';
|
|
19
|
+
import { TextSelection } from '@atlaskit/editor-prosemirror/state';
|
|
20
|
+
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
21
|
+
import { __serializeForClipboard } from '@atlaskit/editor-prosemirror/view';
|
|
25
22
|
import { CellSelection } from '@atlaskit/editor-tables/cell-selection';
|
|
26
23
|
import {
|
|
27
24
|
getCellsInTable,
|
|
28
25
|
selectColumn,
|
|
29
26
|
selectTable,
|
|
30
27
|
} from '@atlaskit/editor-tables/utils';
|
|
28
|
+
import type { LightEditorPlugin } from '@atlaskit/editor-test-helpers/create-prosemirror-editor';
|
|
31
29
|
import {
|
|
32
30
|
createProsemirrorEditorFactory,
|
|
33
|
-
LightEditorPlugin,
|
|
34
31
|
Preset,
|
|
35
32
|
} from '@atlaskit/editor-test-helpers/create-prosemirror-editor';
|
|
36
33
|
import dispatchPasteEvent from '@atlaskit/editor-test-helpers/dispatch-paste-event';
|
|
34
|
+
import type { DocBuilder } from '@atlaskit/editor-test-helpers/doc-builder';
|
|
37
35
|
import {
|
|
38
36
|
br,
|
|
39
37
|
code_block,
|
|
40
38
|
doc,
|
|
41
|
-
DocBuilder,
|
|
42
39
|
expand,
|
|
43
40
|
p,
|
|
44
41
|
panel,
|
|
@@ -51,7 +48,7 @@ import defaultSchema from '@atlaskit/editor-test-helpers/schema';
|
|
|
51
48
|
|
|
52
49
|
import tablePlugin from '../../plugins/table-plugin';
|
|
53
50
|
import { pluginKey as tablePluginKey } from '../../plugins/table/pm-plugins/plugin-key';
|
|
54
|
-
import { PluginConfig, TablePluginState } from '../../plugins/table/types';
|
|
51
|
+
import type { PluginConfig, TablePluginState } from '../../plugins/table/types';
|
|
55
52
|
import {
|
|
56
53
|
removeTableFromFirstChild,
|
|
57
54
|
removeTableFromLastChild,
|
|
@@ -125,7 +122,7 @@ describe('table plugin', () => {
|
|
|
125
122
|
.add([tablePlugin, { tableOptions }]);
|
|
126
123
|
|
|
127
124
|
const editor = (doc: DocBuilder) => {
|
|
128
|
-
return createEditor<TablePluginState, PluginKey>({
|
|
125
|
+
return createEditor<TablePluginState, PluginKey, typeof preset>({
|
|
129
126
|
doc,
|
|
130
127
|
preset,
|
|
131
128
|
pluginKey: tablePluginKey,
|
|
@@ -3,15 +3,15 @@ import { contentInsertionPlugin } from '@atlaskit/editor-plugin-content-insertio
|
|
|
3
3
|
import featureFlagsPlugin from '@atlaskit/editor-plugin-feature-flags';
|
|
4
4
|
import { guidelinePlugin } from '@atlaskit/editor-plugin-guideline';
|
|
5
5
|
import { widthPlugin } from '@atlaskit/editor-plugin-width';
|
|
6
|
-
import { PluginKey } from '@atlaskit/editor-prosemirror/state';
|
|
6
|
+
import type { PluginKey } from '@atlaskit/editor-prosemirror/state';
|
|
7
|
+
import type { LightEditorPlugin } from '@atlaskit/editor-test-helpers/create-prosemirror-editor';
|
|
7
8
|
import {
|
|
8
9
|
createProsemirrorEditorFactory,
|
|
9
|
-
LightEditorPlugin,
|
|
10
10
|
Preset,
|
|
11
11
|
} from '@atlaskit/editor-test-helpers/create-prosemirror-editor';
|
|
12
|
+
import type { DocBuilder } from '@atlaskit/editor-test-helpers/doc-builder';
|
|
12
13
|
import {
|
|
13
14
|
doc,
|
|
14
|
-
DocBuilder,
|
|
15
15
|
table,
|
|
16
16
|
tdCursor,
|
|
17
17
|
tdEmpty,
|
|
@@ -22,7 +22,7 @@ import tablePlugin from '../../../plugins/table-plugin';
|
|
|
22
22
|
import { whenTableInFocus } from '../../../plugins/table/event-handlers';
|
|
23
23
|
import { pluginKey } from '../../../plugins/table/pm-plugins/plugin-key';
|
|
24
24
|
import { setDragging } from '../../../plugins/table/pm-plugins/table-resizing/commands';
|
|
25
|
-
import { TablePluginState } from '../../../plugins/table/types';
|
|
25
|
+
import type { TablePluginState } from '../../../plugins/table/types';
|
|
26
26
|
|
|
27
27
|
describe('event-handlers', () => {
|
|
28
28
|
let editor: any;
|
|
@@ -39,7 +39,7 @@ describe('event-handlers', () => {
|
|
|
39
39
|
.add(guidelinePlugin)
|
|
40
40
|
.add([tablePlugin, { tableOptions: { allowColumnResizing: false } }]);
|
|
41
41
|
editor = (doc: DocBuilder) =>
|
|
42
|
-
createEditor<TablePluginState, PluginKey>({
|
|
42
|
+
createEditor<TablePluginState, PluginKey, typeof preset>({
|
|
43
43
|
doc,
|
|
44
44
|
preset,
|
|
45
45
|
pluginKey,
|
|
@@ -72,7 +72,7 @@ describe('event-handlers', () => {
|
|
|
72
72
|
.add(guidelinePlugin)
|
|
73
73
|
.add([tablePlugin, { tableOptions: { allowColumnResizing: false } }]);
|
|
74
74
|
editor = (doc: DocBuilder) =>
|
|
75
|
-
createEditor<TablePluginState, PluginKey>({
|
|
75
|
+
createEditor<TablePluginState, PluginKey, typeof preset>({
|
|
76
76
|
doc,
|
|
77
77
|
preset,
|
|
78
78
|
pluginKey,
|
|
@@ -3,15 +3,16 @@ import { contentInsertionPlugin } from '@atlaskit/editor-plugin-content-insertio
|
|
|
3
3
|
import featureFlagsPlugin from '@atlaskit/editor-plugin-feature-flags';
|
|
4
4
|
import { guidelinePlugin } from '@atlaskit/editor-plugin-guideline';
|
|
5
5
|
import { widthPlugin } from '@atlaskit/editor-plugin-width';
|
|
6
|
-
import { PluginKey
|
|
6
|
+
import type { PluginKey } from '@atlaskit/editor-prosemirror/state';
|
|
7
|
+
import { TextSelection } from '@atlaskit/editor-prosemirror/state';
|
|
8
|
+
import type { LightEditorPlugin } from '@atlaskit/editor-test-helpers/create-prosemirror-editor';
|
|
7
9
|
import {
|
|
8
10
|
createProsemirrorEditorFactory,
|
|
9
|
-
LightEditorPlugin,
|
|
10
11
|
Preset,
|
|
11
12
|
} from '@atlaskit/editor-test-helpers/create-prosemirror-editor';
|
|
13
|
+
import type { DocBuilder } from '@atlaskit/editor-test-helpers/doc-builder';
|
|
12
14
|
import {
|
|
13
15
|
doc,
|
|
14
|
-
DocBuilder,
|
|
15
16
|
table,
|
|
16
17
|
tdCursor,
|
|
17
18
|
tdEmpty,
|
|
@@ -22,7 +23,7 @@ import tablePlugin from '../../plugins/table-plugin';
|
|
|
22
23
|
import { handleDocOrSelectionChanged } from '../../plugins/table/handlers';
|
|
23
24
|
import { defaultTableSelection } from '../../plugins/table/pm-plugins/default-table-selection';
|
|
24
25
|
import { pluginKey } from '../../plugins/table/pm-plugins/plugin-key';
|
|
25
|
-
import { TablePluginState } from '../../plugins/table/types';
|
|
26
|
+
import type { TablePluginState } from '../../plugins/table/types';
|
|
26
27
|
|
|
27
28
|
describe('table action handlers', () => {
|
|
28
29
|
let editor: any;
|
|
@@ -39,7 +40,7 @@ describe('table action handlers', () => {
|
|
|
39
40
|
.add(tablePlugin);
|
|
40
41
|
|
|
41
42
|
editor = (doc: DocBuilder) =>
|
|
42
|
-
createEditor<TablePluginState, PluginKey>({
|
|
43
|
+
createEditor<TablePluginState, PluginKey, typeof preset>({
|
|
43
44
|
doc,
|
|
44
45
|
preset,
|
|
45
46
|
pluginKey,
|
|
@@ -3,21 +3,21 @@ import { contentInsertionPlugin } from '@atlaskit/editor-plugin-content-insertio
|
|
|
3
3
|
import featureFlagsPlugin from '@atlaskit/editor-plugin-feature-flags';
|
|
4
4
|
import { guidelinePlugin } from '@atlaskit/editor-plugin-guideline';
|
|
5
5
|
import { widthPlugin } from '@atlaskit/editor-plugin-width';
|
|
6
|
-
import { PluginKey } from '@atlaskit/editor-prosemirror/state';
|
|
7
|
-
import { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
6
|
+
import type { PluginKey } from '@atlaskit/editor-prosemirror/state';
|
|
7
|
+
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
8
8
|
import {
|
|
9
9
|
getCellsInColumn,
|
|
10
10
|
getCellsInRow,
|
|
11
11
|
getCellsInTable,
|
|
12
12
|
} from '@atlaskit/editor-tables/utils';
|
|
13
|
+
import type { LightEditorPlugin } from '@atlaskit/editor-test-helpers/create-prosemirror-editor';
|
|
13
14
|
import {
|
|
14
15
|
createProsemirrorEditorFactory,
|
|
15
|
-
LightEditorPlugin,
|
|
16
16
|
Preset,
|
|
17
17
|
} from '@atlaskit/editor-test-helpers/create-prosemirror-editor';
|
|
18
|
+
import type { DocBuilder } from '@atlaskit/editor-test-helpers/doc-builder';
|
|
18
19
|
import {
|
|
19
20
|
doc,
|
|
20
|
-
DocBuilder,
|
|
21
21
|
p,
|
|
22
22
|
table,
|
|
23
23
|
tdCursor,
|
|
@@ -35,7 +35,8 @@ import {
|
|
|
35
35
|
} from '../../plugins/table/commands';
|
|
36
36
|
import { getDecorations } from '../../plugins/table/pm-plugins/decorations/plugin';
|
|
37
37
|
import { pluginKey } from '../../plugins/table/pm-plugins/plugin-key';
|
|
38
|
-
import {
|
|
38
|
+
import type { TablePluginState } from '../../plugins/table/types';
|
|
39
|
+
import { TableDecorations } from '../../plugins/table/types';
|
|
39
40
|
|
|
40
41
|
describe('table hover selection plugin', () => {
|
|
41
42
|
const createEditor = createProsemirrorEditorFactory();
|
|
@@ -48,7 +49,7 @@ describe('table hover selection plugin', () => {
|
|
|
48
49
|
.add(tablePlugin);
|
|
49
50
|
|
|
50
51
|
const editor = (doc: DocBuilder) =>
|
|
51
|
-
createEditor<TablePluginState, PluginKey>({
|
|
52
|
+
createEditor<TablePluginState, PluginKey, typeof preset>({
|
|
52
53
|
doc,
|
|
53
54
|
preset,
|
|
54
55
|
pluginKey,
|
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
import { TableLayout } from '@atlaskit/adf-schema';
|
|
1
|
+
import type { TableLayout } from '@atlaskit/adf-schema';
|
|
2
2
|
import { analyticsPlugin } from '@atlaskit/editor-plugin-analytics';
|
|
3
3
|
import { contentInsertionPlugin } from '@atlaskit/editor-plugin-content-insertion';
|
|
4
4
|
import { decorationsPlugin } from '@atlaskit/editor-plugin-decorations';
|
|
5
5
|
import featureFlagsPlugin from '@atlaskit/editor-plugin-feature-flags';
|
|
6
6
|
import { guidelinePlugin } from '@atlaskit/editor-plugin-guideline';
|
|
7
7
|
import { widthPlugin } from '@atlaskit/editor-plugin-width';
|
|
8
|
-
import { PluginKey } from '@atlaskit/editor-prosemirror/state';
|
|
8
|
+
import type { PluginKey } from '@atlaskit/editor-prosemirror/state';
|
|
9
9
|
import { findTable } from '@atlaskit/editor-tables/utils';
|
|
10
|
+
import type { LightEditorPlugin } from '@atlaskit/editor-test-helpers/create-prosemirror-editor';
|
|
10
11
|
import {
|
|
11
12
|
createProsemirrorEditorFactory,
|
|
12
|
-
LightEditorPlugin,
|
|
13
13
|
Preset,
|
|
14
14
|
} from '@atlaskit/editor-test-helpers/create-prosemirror-editor';
|
|
15
|
+
import type { DocBuilder } from '@atlaskit/editor-test-helpers/doc-builder';
|
|
15
16
|
import {
|
|
16
17
|
doc,
|
|
17
|
-
DocBuilder,
|
|
18
18
|
table,
|
|
19
19
|
tdCursor,
|
|
20
20
|
tdEmpty,
|
|
@@ -25,7 +25,7 @@ import tablePlugin from '../../plugins/table-plugin';
|
|
|
25
25
|
import { toggleTableLayout } from '../../plugins/table/commands';
|
|
26
26
|
import { getPluginState } from '../../plugins/table/pm-plugins/plugin-factory';
|
|
27
27
|
import { pluginKey as tablePluginKey } from '../../plugins/table/pm-plugins/plugin-key';
|
|
28
|
-
import {
|
|
28
|
+
import type {
|
|
29
29
|
PermittedLayoutsDescriptor,
|
|
30
30
|
TablePluginState,
|
|
31
31
|
} from '../../plugins/table/types';
|
|
@@ -49,7 +49,7 @@ describe('table toolbar', () => {
|
|
|
49
49
|
.add([tablePlugin, { tableOptions }]);
|
|
50
50
|
|
|
51
51
|
const editor = (doc: DocBuilder) => {
|
|
52
|
-
return createEditor<TablePluginState, PluginKey>({
|
|
52
|
+
return createEditor<TablePluginState, PluginKey, typeof preset>({
|
|
53
53
|
doc,
|
|
54
54
|
preset,
|
|
55
55
|
pluginKey: tablePluginKey,
|
|
@@ -3,18 +3,19 @@ import { contentInsertionPlugin } from '@atlaskit/editor-plugin-content-insertio
|
|
|
3
3
|
import featureFlagsPlugin from '@atlaskit/editor-plugin-feature-flags';
|
|
4
4
|
import { guidelinePlugin } from '@atlaskit/editor-plugin-guideline';
|
|
5
5
|
import { widthPlugin } from '@atlaskit/editor-plugin-width';
|
|
6
|
-
import { PluginKey } from '@atlaskit/editor-prosemirror/state';
|
|
7
|
-
import { ContentNodeWithPos } from '@atlaskit/editor-prosemirror/utils';
|
|
8
|
-
import {
|
|
6
|
+
import type { PluginKey } from '@atlaskit/editor-prosemirror/state';
|
|
7
|
+
import type { ContentNodeWithPos } from '@atlaskit/editor-prosemirror/utils';
|
|
8
|
+
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
9
|
+
import { DecorationSet } from '@atlaskit/editor-prosemirror/view';
|
|
9
10
|
import { getCellsInColumn } from '@atlaskit/editor-tables/utils';
|
|
11
|
+
import type { LightEditorPlugin } from '@atlaskit/editor-test-helpers/create-prosemirror-editor';
|
|
10
12
|
import {
|
|
11
13
|
createProsemirrorEditorFactory,
|
|
12
|
-
LightEditorPlugin,
|
|
13
14
|
Preset,
|
|
14
15
|
} from '@atlaskit/editor-test-helpers/create-prosemirror-editor';
|
|
16
|
+
import type { DocBuilder } from '@atlaskit/editor-test-helpers/doc-builder';
|
|
15
17
|
import {
|
|
16
18
|
doc,
|
|
17
|
-
DocBuilder,
|
|
18
19
|
p,
|
|
19
20
|
table,
|
|
20
21
|
td,
|
|
@@ -31,30 +32,29 @@ import {
|
|
|
31
32
|
import { getDecorations } from '../../../../plugins/table/pm-plugins/decorations/plugin';
|
|
32
33
|
import { buildColumnResizingDecorations } from '../../../../plugins/table/pm-plugins/decorations/utils';
|
|
33
34
|
import { pluginKey } from '../../../../plugins/table/pm-plugins/plugin-key';
|
|
34
|
-
import {
|
|
35
|
-
|
|
36
|
-
TablePluginState,
|
|
37
|
-
} from '../../../../plugins/table/types';
|
|
35
|
+
import type { TablePluginState } from '../../../../plugins/table/types';
|
|
36
|
+
import { TableDecorations } from '../../../../plugins/table/types';
|
|
38
37
|
|
|
39
38
|
describe('tables: column resizing decorations', () => {
|
|
40
39
|
const createEditor = createProsemirrorEditorFactory();
|
|
41
40
|
const getEditorFeatureFlags = () => ({});
|
|
41
|
+
const preset = new Preset<LightEditorPlugin>()
|
|
42
|
+
.add([featureFlagsPlugin, {}])
|
|
43
|
+
.add([analyticsPlugin, {}])
|
|
44
|
+
.add(contentInsertionPlugin)
|
|
45
|
+
.add(widthPlugin)
|
|
46
|
+
.add(guidelinePlugin)
|
|
47
|
+
.add([
|
|
48
|
+
tablePlugin,
|
|
49
|
+
{
|
|
50
|
+
tableOptions: { allowColumnResizing: true },
|
|
51
|
+
getEditorFeatureFlags,
|
|
52
|
+
},
|
|
53
|
+
]);
|
|
42
54
|
const editor = (doc: DocBuilder) =>
|
|
43
|
-
createEditor<TablePluginState, PluginKey>({
|
|
55
|
+
createEditor<TablePluginState, PluginKey, typeof preset>({
|
|
44
56
|
doc,
|
|
45
|
-
preset
|
|
46
|
-
.add([featureFlagsPlugin, {}])
|
|
47
|
-
.add([analyticsPlugin, {}])
|
|
48
|
-
.add(contentInsertionPlugin)
|
|
49
|
-
.add(widthPlugin)
|
|
50
|
-
.add(guidelinePlugin)
|
|
51
|
-
.add([
|
|
52
|
-
tablePlugin,
|
|
53
|
-
{
|
|
54
|
-
tableOptions: { allowColumnResizing: true },
|
|
55
|
-
getEditorFeatureFlags,
|
|
56
|
-
},
|
|
57
|
-
]),
|
|
57
|
+
preset,
|
|
58
58
|
pluginKey,
|
|
59
59
|
});
|
|
60
60
|
|
|
@@ -5,15 +5,15 @@ import { contentInsertionPlugin } from '@atlaskit/editor-plugin-content-insertio
|
|
|
5
5
|
import featureFlagsPlugin from '@atlaskit/editor-plugin-feature-flags';
|
|
6
6
|
import { guidelinePlugin } from '@atlaskit/editor-plugin-guideline';
|
|
7
7
|
import { widthPlugin } from '@atlaskit/editor-plugin-width';
|
|
8
|
-
import { PluginKey } from '@atlaskit/editor-prosemirror/state';
|
|
8
|
+
import type { PluginKey } from '@atlaskit/editor-prosemirror/state';
|
|
9
|
+
import type { LightEditorPlugin } from '@atlaskit/editor-test-helpers/create-prosemirror-editor';
|
|
9
10
|
import {
|
|
10
11
|
createProsemirrorEditorFactory,
|
|
11
|
-
LightEditorPlugin,
|
|
12
12
|
Preset,
|
|
13
13
|
} from '@atlaskit/editor-test-helpers/create-prosemirror-editor';
|
|
14
|
+
import type { DocBuilder } from '@atlaskit/editor-test-helpers/doc-builder';
|
|
14
15
|
import {
|
|
15
16
|
doc,
|
|
16
|
-
DocBuilder,
|
|
17
17
|
p,
|
|
18
18
|
table,
|
|
19
19
|
td,
|
|
@@ -24,7 +24,7 @@ import {
|
|
|
24
24
|
import tablePlugin from '../../plugins/table-plugin';
|
|
25
25
|
import { sortByColumn } from '../../plugins/table/commands';
|
|
26
26
|
import { pluginKey as tablePluginKey } from '../../plugins/table/pm-plugins/plugin-key';
|
|
27
|
-
import {
|
|
27
|
+
import type {
|
|
28
28
|
PermittedLayoutsDescriptor,
|
|
29
29
|
TablePluginState,
|
|
30
30
|
} from '../../plugins/table/types';
|
|
@@ -58,7 +58,7 @@ describe('table plugin', () => {
|
|
|
58
58
|
.add([tablePlugin, { tableOptions }]);
|
|
59
59
|
|
|
60
60
|
const editor = (doc: DocBuilder) => {
|
|
61
|
-
return createEditor<TablePluginState, PluginKey>({
|
|
61
|
+
return createEditor<TablePluginState, PluginKey, typeof preset>({
|
|
62
62
|
doc,
|
|
63
63
|
preset,
|
|
64
64
|
pluginKey: tablePluginKey,
|
|
@@ -4,17 +4,17 @@ import { contentInsertionPlugin } from '@atlaskit/editor-plugin-content-insertio
|
|
|
4
4
|
import featureFlagsPlugin from '@atlaskit/editor-plugin-feature-flags';
|
|
5
5
|
import { guidelinePlugin } from '@atlaskit/editor-plugin-guideline';
|
|
6
6
|
import { widthPlugin } from '@atlaskit/editor-plugin-width';
|
|
7
|
-
import { PluginKey } from '@atlaskit/editor-prosemirror/state';
|
|
8
|
-
import { Rect } from '@atlaskit/editor-tables/table-map';
|
|
7
|
+
import type { PluginKey } from '@atlaskit/editor-prosemirror/state';
|
|
8
|
+
import type { Rect } from '@atlaskit/editor-tables/table-map';
|
|
9
9
|
import { getSelectionRect } from '@atlaskit/editor-tables/utils';
|
|
10
|
+
import type { LightEditorPlugin } from '@atlaskit/editor-test-helpers/create-prosemirror-editor';
|
|
10
11
|
import {
|
|
11
12
|
createProsemirrorEditorFactory,
|
|
12
|
-
LightEditorPlugin,
|
|
13
13
|
Preset,
|
|
14
14
|
} from '@atlaskit/editor-test-helpers/create-prosemirror-editor';
|
|
15
|
+
import type { DocBuilder } from '@atlaskit/editor-test-helpers/doc-builder';
|
|
15
16
|
import {
|
|
16
17
|
doc,
|
|
17
|
-
DocBuilder,
|
|
18
18
|
p,
|
|
19
19
|
table,
|
|
20
20
|
td,
|
|
@@ -26,7 +26,7 @@ import {
|
|
|
26
26
|
import tablePlugin from '../../../plugins/table-plugin';
|
|
27
27
|
import { pluginKey } from '../../../plugins/table/pm-plugins/plugin-key';
|
|
28
28
|
import { deleteColumns } from '../../../plugins/table/transforms';
|
|
29
|
-
import { TablePluginState } from '../../../plugins/table/types';
|
|
29
|
+
import type { TablePluginState } from '../../../plugins/table/types';
|
|
30
30
|
|
|
31
31
|
const colsToRect = (cols: Array<number>, noOfRows: number): Rect => ({
|
|
32
32
|
left: Math.min(...cols),
|
|
@@ -56,7 +56,7 @@ describe('table plugin -> transforms -> delete columns', () => {
|
|
|
56
56
|
.add(tablePlugin);
|
|
57
57
|
|
|
58
58
|
const editor = (doc: DocBuilder) =>
|
|
59
|
-
createEditor<TablePluginState, PluginKey>({
|
|
59
|
+
createEditor<TablePluginState, PluginKey, typeof preset>({
|
|
60
60
|
doc,
|
|
61
61
|
preset,
|
|
62
62
|
pluginKey,
|
|
@@ -4,17 +4,17 @@ import { contentInsertionPlugin } from '@atlaskit/editor-plugin-content-insertio
|
|
|
4
4
|
import featureFlagsPlugin from '@atlaskit/editor-plugin-feature-flags';
|
|
5
5
|
import { guidelinePlugin } from '@atlaskit/editor-plugin-guideline';
|
|
6
6
|
import { widthPlugin } from '@atlaskit/editor-plugin-width';
|
|
7
|
-
import { PluginKey } from '@atlaskit/editor-prosemirror/state';
|
|
8
|
-
import { Rect } from '@atlaskit/editor-tables/table-map';
|
|
7
|
+
import type { PluginKey } from '@atlaskit/editor-prosemirror/state';
|
|
8
|
+
import type { Rect } from '@atlaskit/editor-tables/table-map';
|
|
9
9
|
import { getSelectionRect } from '@atlaskit/editor-tables/utils';
|
|
10
|
+
import type { LightEditorPlugin } from '@atlaskit/editor-test-helpers/create-prosemirror-editor';
|
|
10
11
|
import {
|
|
11
12
|
createProsemirrorEditorFactory,
|
|
12
|
-
LightEditorPlugin,
|
|
13
13
|
Preset,
|
|
14
14
|
} from '@atlaskit/editor-test-helpers/create-prosemirror-editor';
|
|
15
|
+
import type { DocBuilder } from '@atlaskit/editor-test-helpers/doc-builder';
|
|
15
16
|
import {
|
|
16
17
|
doc,
|
|
17
|
-
DocBuilder,
|
|
18
18
|
p,
|
|
19
19
|
table,
|
|
20
20
|
td,
|
|
@@ -27,7 +27,7 @@ import {
|
|
|
27
27
|
import tablePlugin from '../../../plugins/table-plugin';
|
|
28
28
|
import { pluginKey } from '../../../plugins/table/pm-plugins/plugin-key';
|
|
29
29
|
import { deleteRows } from '../../../plugins/table/transforms';
|
|
30
|
-
import { TablePluginState } from '../../../plugins/table/types';
|
|
30
|
+
import type { TablePluginState } from '../../../plugins/table/types';
|
|
31
31
|
|
|
32
32
|
const rowsToRect = (rows: Array<number>, noOfColumns: number): Rect => ({
|
|
33
33
|
left: 0,
|
|
@@ -56,7 +56,7 @@ describe('table plugin -> transforms -> delete rows', () => {
|
|
|
56
56
|
.add(tablePlugin);
|
|
57
57
|
|
|
58
58
|
const editor = (doc: DocBuilder) =>
|
|
59
|
-
createEditor<TablePluginState, PluginKey>({
|
|
59
|
+
createEditor<TablePluginState, PluginKey, typeof preset>({
|
|
60
60
|
doc,
|
|
61
61
|
preset,
|
|
62
62
|
pluginKey,
|
|
@@ -4,15 +4,15 @@ import { contentInsertionPlugin } from '@atlaskit/editor-plugin-content-insertio
|
|
|
4
4
|
import featureFlagsPlugin from '@atlaskit/editor-plugin-feature-flags';
|
|
5
5
|
import { guidelinePlugin } from '@atlaskit/editor-plugin-guideline';
|
|
6
6
|
import { widthPlugin } from '@atlaskit/editor-plugin-width';
|
|
7
|
-
import { PluginKey } from '@atlaskit/editor-prosemirror/state';
|
|
7
|
+
import type { PluginKey } from '@atlaskit/editor-prosemirror/state';
|
|
8
|
+
import type { LightEditorPlugin } from '@atlaskit/editor-test-helpers/create-prosemirror-editor';
|
|
8
9
|
import {
|
|
9
10
|
createProsemirrorEditorFactory,
|
|
10
|
-
LightEditorPlugin,
|
|
11
11
|
Preset,
|
|
12
12
|
} from '@atlaskit/editor-test-helpers/create-prosemirror-editor';
|
|
13
|
+
import type { DocBuilder } from '@atlaskit/editor-test-helpers/doc-builder';
|
|
13
14
|
import {
|
|
14
15
|
doc,
|
|
15
|
-
DocBuilder,
|
|
16
16
|
p,
|
|
17
17
|
table,
|
|
18
18
|
td,
|
|
@@ -23,7 +23,7 @@ import {
|
|
|
23
23
|
import tablePlugin from '../../../plugins/table-plugin';
|
|
24
24
|
import { pluginKey } from '../../../plugins/table/pm-plugins/plugin-key';
|
|
25
25
|
import { mergeCells } from '../../../plugins/table/transforms';
|
|
26
|
-
import { TablePluginState } from '../../../plugins/table/types';
|
|
26
|
+
import type { TablePluginState } from '../../../plugins/table/types';
|
|
27
27
|
|
|
28
28
|
const TABLE_LOCAL_ID = 'test-table-local-id';
|
|
29
29
|
|
|
@@ -46,7 +46,7 @@ describe('table plugin -> transforms -> merge cells', () => {
|
|
|
46
46
|
.add(tablePlugin);
|
|
47
47
|
|
|
48
48
|
const editor = (doc: DocBuilder) =>
|
|
49
|
-
createEditor<TablePluginState, PluginKey>({
|
|
49
|
+
createEditor<TablePluginState, PluginKey, typeof preset>({
|
|
50
50
|
doc,
|
|
51
51
|
preset,
|
|
52
52
|
pluginKey,
|