@atlaskit/editor-plugin-table 7.2.2 → 7.2.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 +8 -0
- package/dist/cjs/pm-plugins/drag-and-drop/commands-with-analytics.js +3 -19
- package/dist/cjs/utils/drag-menu.js +37 -23
- package/dist/cjs/utils/merged-cells.js +66 -1
- package/dist/es2019/pm-plugins/drag-and-drop/commands-with-analytics.js +4 -20
- package/dist/es2019/utils/drag-menu.js +38 -14
- package/dist/es2019/utils/merged-cells.js +73 -0
- package/dist/esm/pm-plugins/drag-and-drop/commands-with-analytics.js +4 -20
- package/dist/esm/utils/drag-menu.js +36 -22
- package/dist/esm/utils/merged-cells.js +65 -0
- package/dist/types/utils/drag-menu.d.ts +4 -1
- package/dist/types/utils/merged-cells.d.ts +2 -0
- package/dist/types-ts4.5/utils/drag-menu.d.ts +4 -1
- package/dist/types-ts4.5/utils/merged-cells.d.ts +2 -0
- package/package.json +9 -16
- package/src/pm-plugins/drag-and-drop/commands-with-analytics.ts +11 -32
- package/src/utils/drag-menu.ts +94 -20
- package/src/utils/merged-cells.ts +78 -0
- package/tsconfig.dev.json +0 -69
- package/tsconfig.json +2 -877
- package/examples/99-testing.tsx +0 -140
- package/examples/config.jsonc +0 -14
- package/src/__tests__/unit/analytics.ts +0 -888
- package/src/__tests__/unit/collab.ts +0 -93
- package/src/__tests__/unit/commands/go-to-next-cell.ts +0 -173
- package/src/__tests__/unit/commands/insert.ts +0 -137
- package/src/__tests__/unit/commands/misc.ts +0 -185
- package/src/__tests__/unit/commands/sort.ts +0 -128
- package/src/__tests__/unit/commands.ts +0 -745
- package/src/__tests__/unit/copy-button.ts +0 -22
- package/src/__tests__/unit/copy-paste.ts +0 -677
- package/src/__tests__/unit/event-handlers/index.ts +0 -125
- package/src/__tests__/unit/event-handlers.ts +0 -296
- package/src/__tests__/unit/fix-tables.ts +0 -164
- package/src/__tests__/unit/get-toolbar-config.ts +0 -127
- package/src/__tests__/unit/handlers.ts +0 -98
- package/src/__tests__/unit/hover-selection.ts +0 -230
- package/src/__tests__/unit/index-with-fake-timers.ts +0 -111
- package/src/__tests__/unit/index.ts +0 -912
- package/src/__tests__/unit/layout.ts +0 -146
- package/src/__tests__/unit/nodeviews/OverflowShadowsObserver.ts +0 -162
- package/src/__tests__/unit/nodeviews/TableComponent.tsx +0 -280
- package/src/__tests__/unit/nodeviews/TableContainer.tsx +0 -525
- package/src/__tests__/unit/nodeviews/cell.ts +0 -132
- package/src/__tests__/unit/nodeviews/table.ts +0 -129
- package/src/__tests__/unit/pm-plugins/analytics.ts +0 -327
- package/src/__tests__/unit/pm-plugins/decorations/column-controls.ts +0 -94
- package/src/__tests__/unit/pm-plugins/decorations/column-resizing.ts +0 -176
- package/src/__tests__/unit/pm-plugins/decorations/plugin.ts +0 -211
- package/src/__tests__/unit/pm-plugins/main.ts +0 -214
- package/src/__tests__/unit/pm-plugins/safari-delete-composition-text-issue-workaround.ts +0 -101
- package/src/__tests__/unit/pm-plugins/sticky-headers/tableRow.tsx +0 -562
- package/src/__tests__/unit/pm-plugins/table-local-id.ts +0 -507
- package/src/__tests__/unit/pm-plugins/table-resizing/colgroup.ts +0 -269
- package/src/__tests__/unit/pm-plugins/table-resizing/event-handlers.ts +0 -192
- package/src/__tests__/unit/pm-plugins/table-resizing/utils/resize-state.ts +0 -33
- package/src/__tests__/unit/pm-plugins/table-width.ts +0 -292
- package/src/__tests__/unit/sort-column.ts +0 -399
- package/src/__tests__/unit/toolbar.ts +0 -512
- package/src/__tests__/unit/transforms/delete-columns.ts +0 -597
- package/src/__tests__/unit/transforms/delete-rows.ts +0 -620
- package/src/__tests__/unit/transforms/merging.ts +0 -392
- package/src/__tests__/unit/ui/ContextualMenu.tsx +0 -71
- package/src/__tests__/unit/ui/CornerControls.tsx +0 -99
- package/src/__tests__/unit/ui/DeleteButton.tsx +0 -38
- package/src/__tests__/unit/ui/FixedButton.tsx +0 -217
- package/src/__tests__/unit/ui/FloatingContextualButton.tsx +0 -123
- package/src/__tests__/unit/ui/FloatingContextualMenu.tsx +0 -68
- package/src/__tests__/unit/ui/FloatingDeleteButton.tsx +0 -178
- package/src/__tests__/unit/ui/FloatingDragMenu.tsx +0 -511
- package/src/__tests__/unit/ui/FloatingInsertButton.tsx +0 -322
- package/src/__tests__/unit/ui/NumberColumn.tsx +0 -146
- package/src/__tests__/unit/ui/RowControls.tsx +0 -294
- package/src/__tests__/unit/ui/RowDragControls.tsx +0 -129
- package/src/__tests__/unit/ui/TableFloatingColumnControls.tsx +0 -189
- package/src/__tests__/unit/ui/TableFloatingControls.tsx +0 -118
- package/src/__tests__/unit/undo-redo.ts +0 -220
- package/src/__tests__/unit/utils/analytics.ts +0 -98
- package/src/__tests__/unit/utils/collapse.ts +0 -57
- package/src/__tests__/unit/utils/column-controls.ts +0 -205
- package/src/__tests__/unit/utils/dom.ts +0 -180
- package/src/__tests__/unit/utils/merged-cells.ts +0 -156
- package/src/__tests__/unit/utils/nodes.ts +0 -79
- package/src/__tests__/unit/utils/row-controls.ts +0 -195
- package/src/__tests__/unit/utils/table.ts +0 -96
- package/src/__tests__/unit/utils.ts +0 -670
- package/src/__tests__/visual-regression/__fixtures__/sticky-header-with-horizontal-scroll.json +0 -5228
- package/src/__tests__/visual-regression/__fixtures__/table-with-100-numbered-list-items.json +0 -20272
- package/src/__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 -3
- package/src/__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 -3
- package/src/__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 -3
- package/src/__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 -3
- package/src/__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 -3
- package/src/__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 -3
- package/src/__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 -3
- package/src/__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 -3
- package/src/__tests__/visual-regression/__image_snapshots__/sticky-header-ts-snapshot-test-table-sticky-header-should-align-with-table-cell-when-active-1-snap.png +0 -3
- package/src/__tests__/visual-regression/__image_snapshots__/sticky-header-ts-snapshot-test-table-sticky-header-should-align-with-table-cell-when-active-2-snap.png +0 -3
- package/src/__tests__/visual-regression/cell-options-menu.ts +0 -101
- package/src/__tests__/visual-regression/copy-button.ts +0 -181
- package/src/__tests__/visual-regression/index.ts +0 -62
- package/src/__tests__/visual-regression/sticky-header.ts +0 -61
|
@@ -1,128 +0,0 @@
|
|
|
1
|
-
import { uuid } from '@atlaskit/adf-schema';
|
|
2
|
-
import { TableSortOrder as SortOrder } from '@atlaskit/custom-steps';
|
|
3
|
-
// eslint-disable-next-line import/no-extraneous-dependencies -- Removed import for fixing circular dependencies
|
|
4
|
-
import { analyticsPlugin } from '@atlaskit/editor-plugin-analytics';
|
|
5
|
-
import { contentInsertionPlugin } from '@atlaskit/editor-plugin-content-insertion';
|
|
6
|
-
import { featureFlagsPlugin } from '@atlaskit/editor-plugin-feature-flags';
|
|
7
|
-
import { guidelinePlugin } from '@atlaskit/editor-plugin-guideline';
|
|
8
|
-
import { selectionPlugin } from '@atlaskit/editor-plugin-selection';
|
|
9
|
-
import { widthPlugin } from '@atlaskit/editor-plugin-width';
|
|
10
|
-
// eslint-disable-next-line import/no-extraneous-dependencies
|
|
11
|
-
import type { LightEditorPlugin } from '@atlaskit/editor-test-helpers/create-prosemirror-editor';
|
|
12
|
-
// eslint-disable-next-line import/no-extraneous-dependencies -- Removed import for fixing circular dependencies
|
|
13
|
-
import {
|
|
14
|
-
createProsemirrorEditorFactory,
|
|
15
|
-
Preset,
|
|
16
|
-
} from '@atlaskit/editor-test-helpers/create-prosemirror-editor';
|
|
17
|
-
// eslint-disable-next-line import/no-extraneous-dependencies -- Removed import for fixing circular dependencies
|
|
18
|
-
import {
|
|
19
|
-
doc,
|
|
20
|
-
p,
|
|
21
|
-
table,
|
|
22
|
-
td,
|
|
23
|
-
th,
|
|
24
|
-
tr,
|
|
25
|
-
} from '@atlaskit/editor-test-helpers/doc-builder';
|
|
26
|
-
|
|
27
|
-
import { sortByColumn } from '../../../commands/sort';
|
|
28
|
-
import tablePlugin from '../../../plugin';
|
|
29
|
-
|
|
30
|
-
const TABLE_LOCAL_ID = 'test-table-local-id';
|
|
31
|
-
|
|
32
|
-
describe('Sort Table', () => {
|
|
33
|
-
beforeAll(() => {
|
|
34
|
-
uuid.setStatic(TABLE_LOCAL_ID);
|
|
35
|
-
});
|
|
36
|
-
|
|
37
|
-
afterAll(() => {
|
|
38
|
-
uuid.setStatic(false);
|
|
39
|
-
});
|
|
40
|
-
|
|
41
|
-
const createEditor = createProsemirrorEditorFactory();
|
|
42
|
-
it('should test a basic table with heading', () => {
|
|
43
|
-
const { editorView } = createEditor({
|
|
44
|
-
preset: new Preset<LightEditorPlugin>()
|
|
45
|
-
.add([featureFlagsPlugin, {}])
|
|
46
|
-
.add([analyticsPlugin, {}])
|
|
47
|
-
.add(contentInsertionPlugin)
|
|
48
|
-
.add(widthPlugin)
|
|
49
|
-
.add(guidelinePlugin)
|
|
50
|
-
.add(selectionPlugin)
|
|
51
|
-
.add([tablePlugin, { tableOptions: { allowHeaderRow: true } }]),
|
|
52
|
-
doc: doc(
|
|
53
|
-
table()(
|
|
54
|
-
tr(th({})(p('Number{<>}'))),
|
|
55
|
-
tr(td({})(p('10{<>}'))),
|
|
56
|
-
tr(td({})(p('0'))),
|
|
57
|
-
tr(td({})(p('5'))),
|
|
58
|
-
),
|
|
59
|
-
),
|
|
60
|
-
});
|
|
61
|
-
sortByColumn(0)(editorView.state, editorView.dispatch);
|
|
62
|
-
|
|
63
|
-
expect(editorView.state.doc).toEqualDocument(
|
|
64
|
-
doc(
|
|
65
|
-
table({ localId: TABLE_LOCAL_ID })(
|
|
66
|
-
tr(th({})(p('Number'))),
|
|
67
|
-
tr(td({})(p('10'))),
|
|
68
|
-
tr(td({})(p('5'))),
|
|
69
|
-
tr(td({})(p('0'))),
|
|
70
|
-
),
|
|
71
|
-
),
|
|
72
|
-
);
|
|
73
|
-
});
|
|
74
|
-
|
|
75
|
-
it('should test a basic table descending', () => {
|
|
76
|
-
const { editorView } = createEditor({
|
|
77
|
-
preset: new Preset<LightEditorPlugin>()
|
|
78
|
-
.add([featureFlagsPlugin, {}])
|
|
79
|
-
.add([analyticsPlugin, {}])
|
|
80
|
-
.add(contentInsertionPlugin)
|
|
81
|
-
.add(widthPlugin)
|
|
82
|
-
.add(guidelinePlugin)
|
|
83
|
-
.add(selectionPlugin)
|
|
84
|
-
.add([tablePlugin, { tableOptions: { allowHeaderRow: true } }]),
|
|
85
|
-
doc: doc(
|
|
86
|
-
table()(tr(td({})(p('2{<>}'))), tr(td({})(p('5'))), tr(td({})(p('4')))),
|
|
87
|
-
),
|
|
88
|
-
});
|
|
89
|
-
sortByColumn(0)(editorView.state, editorView.dispatch);
|
|
90
|
-
|
|
91
|
-
expect(editorView.state.doc).toEqualDocument(
|
|
92
|
-
doc(
|
|
93
|
-
table({ localId: TABLE_LOCAL_ID })(
|
|
94
|
-
tr(td({})(p('5'))),
|
|
95
|
-
tr(td({})(p('4'))),
|
|
96
|
-
tr(td({})(p('2'))),
|
|
97
|
-
),
|
|
98
|
-
),
|
|
99
|
-
);
|
|
100
|
-
});
|
|
101
|
-
|
|
102
|
-
it('should test a basic table ascending', () => {
|
|
103
|
-
const { editorView } = createEditor({
|
|
104
|
-
preset: new Preset<LightEditorPlugin>()
|
|
105
|
-
.add([featureFlagsPlugin, {}])
|
|
106
|
-
.add([analyticsPlugin, {}])
|
|
107
|
-
.add(contentInsertionPlugin)
|
|
108
|
-
.add(widthPlugin)
|
|
109
|
-
.add(guidelinePlugin)
|
|
110
|
-
.add(selectionPlugin)
|
|
111
|
-
.add([tablePlugin, { tableOptions: { allowHeaderRow: true } }]),
|
|
112
|
-
doc: doc(
|
|
113
|
-
table()(tr(td({})(p('2{<>}'))), tr(td({})(p('5'))), tr(td({})(p('4')))),
|
|
114
|
-
),
|
|
115
|
-
});
|
|
116
|
-
sortByColumn(0, SortOrder.ASC)(editorView.state, editorView.dispatch);
|
|
117
|
-
|
|
118
|
-
expect(editorView.state.doc).toEqualDocument(
|
|
119
|
-
doc(
|
|
120
|
-
table({ localId: TABLE_LOCAL_ID })(
|
|
121
|
-
tr(td({})(p('2'))),
|
|
122
|
-
tr(td({})(p('4'))),
|
|
123
|
-
tr(td({})(p('5'))),
|
|
124
|
-
),
|
|
125
|
-
),
|
|
126
|
-
);
|
|
127
|
-
});
|
|
128
|
-
});
|