@atlaskit/editor-plugin-table 3.0.2 → 3.0.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 +9 -0
- package/dist/cjs/plugins/table/pm-plugins/sticky-headers/nodeviews/tableRow.js +12 -1
- package/dist/cjs/plugins/table/ui/consts.js +6 -4
- package/dist/cjs/plugins/table/ui/ui-styles.js +1 -1
- package/dist/es2019/plugins/table/pm-plugins/sticky-headers/nodeviews/tableRow.js +14 -3
- package/dist/es2019/plugins/table/ui/consts.js +5 -4
- package/dist/es2019/plugins/table/ui/ui-styles.js +2 -2
- package/dist/esm/plugins/table/pm-plugins/sticky-headers/nodeviews/tableRow.js +14 -3
- package/dist/esm/plugins/table/ui/consts.js +5 -4
- package/dist/esm/plugins/table/ui/ui-styles.js +1 -1
- package/dist/types/plugins/table/pm-plugins/sticky-headers/nodeviews/tableRow.d.ts +6 -5
- package/dist/types/plugins/table/pm-plugins/sticky-headers/util.d.ts +1 -1
- package/dist/types/plugins/table/ui/consts.d.ts +2 -1
- package/dist/types-ts4.5/plugins/table/pm-plugins/sticky-headers/nodeviews/tableRow.d.ts +6 -5
- package/dist/types-ts4.5/plugins/table/pm-plugins/sticky-headers/util.d.ts +1 -1
- package/dist/types-ts4.5/plugins/table/ui/consts.d.ts +2 -1
- package/package.json +4 -4
- package/src/__tests__/integration/arrow-down-into-table.ts +2 -0
- package/src/__tests__/integration/auto-size.ts +3 -0
- package/src/__tests__/integration/cell-selection.ts +3 -0
- package/src/__tests__/integration/delete-columns.ts +2 -0
- package/src/__tests__/integration/delete-last-column-in-full-width.ts +2 -0
- package/src/__tests__/integration/delete-last-column-with-empty-action.ts +2 -0
- package/src/__tests__/integration/delete-last-row-with-empty-action.ts +2 -0
- package/src/__tests__/integration/delete-rows.ts +3 -0
- package/src/__tests__/integration/delete-table-when-selected.ts +3 -0
- package/src/__tests__/integration/deleting-empty-paragraph-under-table.ts +2 -0
- package/src/__tests__/integration/even-columns.ts +3 -0
- package/src/__tests__/integration/horizontal-scroll-shadows.ts +2 -0
- package/src/__tests__/integration/horizontal-scroll.ts +4 -1
- package/src/__tests__/integration/insert-cell-header-with-strong-mark.ts +2 -0
- package/src/__tests__/integration/insert-row-inside-layout.ts +3 -0
- package/src/__tests__/integration/layout.ts +3 -0
- package/src/__tests__/integration/meta-arrowup-cursor-in-first-row.ts +2 -0
- package/src/__tests__/integration/resize-handler.ts +3 -0
- package/src/__tests__/integration/resize.ts +4 -1
- package/src/__tests__/integration/scale.ts +3 -0
- package/src/__tests__/integration/sticky-header.ts +3 -1
- package/src/__tests__/unit/analytics.ts +4 -0
- package/src/__tests__/unit/collab.ts +3 -0
- package/src/__tests__/unit/commands/go-to-next-cell.ts +3 -0
- package/src/__tests__/unit/commands/insert.ts +3 -0
- package/src/__tests__/unit/commands/misc.ts +3 -0
- package/src/__tests__/unit/commands/sort.ts +3 -0
- package/src/__tests__/unit/commands.ts +3 -0
- package/src/__tests__/unit/copy-paste.ts +5 -0
- package/src/__tests__/unit/event-handlers/index.ts +3 -0
- package/src/__tests__/unit/event-handlers.ts +3 -0
- package/src/__tests__/unit/fix-tables.ts +3 -0
- package/src/__tests__/unit/get-toolbar-config.ts +3 -0
- package/src/__tests__/unit/handlers.ts +3 -0
- package/src/__tests__/unit/hover-selection.ts +4 -0
- package/src/__tests__/unit/index-with-fake-timers.ts +2 -0
- package/src/__tests__/unit/index.ts +4 -0
- package/src/__tests__/unit/layout.ts +3 -0
- package/src/__tests__/unit/nodeviews/OverflowShadowsObserver.ts +1 -0
- package/src/__tests__/unit/nodeviews/TableComponent.tsx +2 -0
- package/src/__tests__/unit/nodeviews/TableContainer.tsx +2 -0
- package/src/__tests__/unit/nodeviews/cell.ts +3 -0
- package/src/__tests__/unit/nodeviews/table.ts +4 -0
- package/src/__tests__/unit/pm-plugins/decorations/column-controls.ts +2 -0
- package/src/__tests__/unit/pm-plugins/decorations/column-resizing.ts +3 -0
- package/src/__tests__/unit/pm-plugins/decorations/plugin.ts +3 -0
- package/src/__tests__/unit/pm-plugins/main.ts +3 -0
- package/src/__tests__/unit/pm-plugins/safari-delete-composition-text-issue-workaround.ts +3 -0
- package/src/__tests__/unit/pm-plugins/sticky-headers/tableRow.tsx +5 -1
- package/src/__tests__/unit/pm-plugins/table-local-id.ts +4 -0
- package/src/__tests__/unit/pm-plugins/table-resizing/colgroup.ts +2 -0
- package/src/__tests__/unit/pm-plugins/table-resizing/event-handlers.ts +3 -0
- package/src/__tests__/unit/pm-plugins/table-width.ts +3 -0
- package/src/__tests__/unit/sort-column.ts +3 -0
- package/src/__tests__/unit/toolbar.ts +3 -0
- package/src/__tests__/unit/transforms/delete-columns.ts +3 -0
- package/src/__tests__/unit/transforms/delete-rows.ts +3 -0
- package/src/__tests__/unit/transforms/merging.ts +3 -0
- package/src/__tests__/unit/ui/ContextualMenu.tsx +3 -0
- package/src/__tests__/unit/ui/CornerControls.tsx +3 -0
- package/src/__tests__/unit/ui/FloatingContextualButton.tsx +3 -0
- package/src/__tests__/unit/ui/FloatingContextualMenu.tsx +3 -0
- package/src/__tests__/unit/ui/FloatingDeleteButton.tsx +3 -0
- package/src/__tests__/unit/ui/FloatingInsertButton.tsx +3 -0
- package/src/__tests__/unit/ui/RowControls.tsx +4 -0
- package/src/__tests__/unit/ui/TableFloatingControls.tsx +3 -0
- package/src/__tests__/unit/undo-redo.ts +4 -0
- package/src/__tests__/unit/utils/collapse.ts +3 -0
- package/src/__tests__/unit/utils/nodes.ts +3 -0
- package/src/__tests__/unit/utils/row-controls.ts +3 -0
- package/src/__tests__/unit/utils/table.ts +2 -0
- package/src/__tests__/unit/utils.ts +3 -0
- 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 +2 -2
- 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 +2 -2
- 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 +2 -2
- 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 +2 -2
- package/src/__tests__/visual-regression/cell-options-menu.ts +3 -1
- package/src/__tests__/visual-regression/index.ts +4 -1
- package/src/__tests__/visual-regression/sticky-header.ts +4 -1
- package/src/plugins/table/pm-plugins/sticky-headers/nodeviews/tableRow.ts +26 -7
- package/src/plugins/table/pm-plugins/sticky-headers/util.ts +1 -1
- package/src/plugins/table/ui/consts.ts +13 -2
- package/src/plugins/table/ui/ui-styles.ts +2 -2
- package/src/__tests__/integration/__snapshots__/floating-toolbar.ts.snap +0 -613
- package/src/__tests__/integration/floating-toolbar.ts +0 -374
|
@@ -1,13 +1,16 @@
|
|
|
1
|
+
// eslint-disable-next-line import/no-extraneous-dependencies -- Removed import for fixing circular dependencies
|
|
1
2
|
import {
|
|
2
3
|
scrollToBottom,
|
|
3
4
|
scrollToElement,
|
|
4
5
|
} from '@atlaskit/editor-test-helpers/page-objects/editor';
|
|
6
|
+
// eslint-disable-next-line import/no-extraneous-dependencies -- Removed import for fixing circular dependencies
|
|
5
7
|
import {
|
|
6
8
|
initFullPageEditorWithAdf,
|
|
7
9
|
snapshot,
|
|
8
10
|
} from '@atlaskit/editor-test-helpers/vr-utils/base-utils';
|
|
11
|
+
// eslint-disable-next-line import/no-extraneous-dependencies -- Removed import for fixing circular dependencies
|
|
9
12
|
import { Device } from '@atlaskit/editor-test-helpers/vr-utils/device-viewport';
|
|
10
|
-
import { PuppeteerPage } from '@atlaskit/visual-regression/helper';
|
|
13
|
+
import type { PuppeteerPage } from '@atlaskit/visual-regression/helper';
|
|
11
14
|
|
|
12
15
|
import tableWith100ListItemsADF from './__fixtures__/table-with-100-numbered-list-items.json';
|
|
13
16
|
|
|
@@ -1,11 +1,14 @@
|
|
|
1
|
+
// eslint-disable-next-line import/no-extraneous-dependencies -- Removed import for fixing circular dependencies
|
|
1
2
|
import { scrollToElement } from '@atlaskit/editor-test-helpers/page-objects/editor';
|
|
3
|
+
// eslint-disable-next-line import/no-extraneous-dependencies -- Removed import for fixing circular dependencies
|
|
2
4
|
import { clickFirstCell } from '@atlaskit/editor-test-helpers/page-objects/table';
|
|
5
|
+
// eslint-disable-next-line import/no-extraneous-dependencies -- Removed import for fixing circular dependencies
|
|
3
6
|
import {
|
|
4
7
|
Appearance,
|
|
5
8
|
initEditorWithAdf,
|
|
6
9
|
snapshot,
|
|
7
10
|
} from '@atlaskit/editor-test-helpers/vr-utils/base-utils';
|
|
8
|
-
import { PuppeteerPage } from '@atlaskit/visual-regression/helper';
|
|
11
|
+
import type { PuppeteerPage } from '@atlaskit/visual-regression/helper';
|
|
9
12
|
|
|
10
13
|
import stickyHeaderWithHorizontalScroll from './__fixtures__/sticky-header-with-horizontal-scroll.json';
|
|
11
14
|
|
|
@@ -1,18 +1,19 @@
|
|
|
1
1
|
import debounce from 'lodash/debounce';
|
|
2
2
|
import throttle from 'lodash/throttle';
|
|
3
3
|
|
|
4
|
-
import { EventDispatcher } from '@atlaskit/editor-common/event-dispatcher';
|
|
4
|
+
import type { EventDispatcher } from '@atlaskit/editor-common/event-dispatcher';
|
|
5
5
|
import { findOverflowScrollParent } from '@atlaskit/editor-common/ui';
|
|
6
|
-
import { mapChildren } from '@atlaskit/editor-common/utils';
|
|
7
|
-
import { Node as PmNode } from '@atlaskit/editor-prosemirror/model';
|
|
8
|
-
import { EditorView, NodeView } from '@atlaskit/editor-prosemirror/view';
|
|
6
|
+
import { browser, mapChildren } from '@atlaskit/editor-common/utils';
|
|
7
|
+
import type { Node as PmNode } from '@atlaskit/editor-prosemirror/model';
|
|
8
|
+
import type { EditorView, NodeView } from '@atlaskit/editor-prosemirror/view';
|
|
9
9
|
|
|
10
|
+
import type { TablePluginState } from '../../../types';
|
|
10
11
|
import {
|
|
11
12
|
TableCssClassName as ClassName,
|
|
12
13
|
TableCssClassName,
|
|
13
|
-
TablePluginState,
|
|
14
14
|
} from '../../../types';
|
|
15
15
|
import {
|
|
16
|
+
STICKY_HEADER_TOGGLE_TOLERANCE_MS,
|
|
16
17
|
stickyHeaderBorderBottomWidth,
|
|
17
18
|
stickyRowOffsetTop,
|
|
18
19
|
tableControlsSpacing,
|
|
@@ -25,7 +26,8 @@ import {
|
|
|
25
26
|
} from '../../table-resizing/utils/dom';
|
|
26
27
|
import { updateStickyState } from '../commands';
|
|
27
28
|
|
|
28
|
-
import {
|
|
29
|
+
import type { TableDOMElements } from './dom';
|
|
30
|
+
import { getTop, getTree } from './dom';
|
|
29
31
|
|
|
30
32
|
// limit scroll event calls
|
|
31
33
|
const HEADER_ROW_SCROLL_THROTTLE_TIMEOUT = 200;
|
|
@@ -73,6 +75,7 @@ export class TableRowNodeView implements NodeView {
|
|
|
73
75
|
focused = false;
|
|
74
76
|
topPosEditorElement = 0;
|
|
75
77
|
isSticky: boolean;
|
|
78
|
+
lastStickyTimestamp: number | undefined;
|
|
76
79
|
lastTimePainted: number;
|
|
77
80
|
|
|
78
81
|
private intersectionObserver?: IntersectionObserver;
|
|
@@ -104,6 +107,7 @@ export class TableRowNodeView implements NodeView {
|
|
|
104
107
|
this.lastTimePainted = 0;
|
|
105
108
|
this.isHeaderRow = supportedHeaderRow(node);
|
|
106
109
|
this.isSticky = false;
|
|
110
|
+
this.lastStickyTimestamp = undefined;
|
|
107
111
|
|
|
108
112
|
if (this.isHeaderRow) {
|
|
109
113
|
this.dom.setAttribute('data-header-row', 'true');
|
|
@@ -257,6 +261,7 @@ export class TableRowNodeView implements NodeView {
|
|
|
257
261
|
this.sentinels.bottom.style.bottom = `${
|
|
258
262
|
tableScrollbarOffset + stickyRowOffsetTop + newHeight
|
|
259
263
|
}px`;
|
|
264
|
+
|
|
260
265
|
updateTableMargin(table);
|
|
261
266
|
}
|
|
262
267
|
}
|
|
@@ -293,6 +298,7 @@ export class TableRowNodeView implements NodeView {
|
|
|
293
298
|
if (!entry.isIntersecting && !sentinelIsBelowScrollArea) {
|
|
294
299
|
this.tree &&
|
|
295
300
|
this.makeHeaderRowSticky(this.tree, entry.rootBounds?.top);
|
|
301
|
+
this.lastStickyTimestamp = Date.now();
|
|
296
302
|
} else {
|
|
297
303
|
table && this.makeRowHeaderNotSticky(table);
|
|
298
304
|
}
|
|
@@ -306,12 +312,25 @@ export class TableRowNodeView implements NodeView {
|
|
|
306
312
|
(entry.rootBounds?.top || 0);
|
|
307
313
|
|
|
308
314
|
if (table && !entry.isIntersecting && sentinelIsAboveScrollArea) {
|
|
309
|
-
this
|
|
315
|
+
// Not a perfect solution, but need to this code specific for FireFox ED-19177
|
|
316
|
+
if (browser.gecko) {
|
|
317
|
+
if (
|
|
318
|
+
this.lastStickyTimestamp &&
|
|
319
|
+
Date.now() - this.lastStickyTimestamp >
|
|
320
|
+
STICKY_HEADER_TOGGLE_TOLERANCE_MS
|
|
321
|
+
) {
|
|
322
|
+
this.makeRowHeaderNotSticky(table);
|
|
323
|
+
}
|
|
324
|
+
} else {
|
|
325
|
+
this.makeRowHeaderNotSticky(table);
|
|
326
|
+
}
|
|
310
327
|
} else if (entry.isIntersecting && sentinelIsAboveScrollArea) {
|
|
311
328
|
this.tree &&
|
|
312
329
|
this.makeHeaderRowSticky(this.tree, entry?.rootBounds?.top);
|
|
330
|
+
this.lastStickyTimestamp = Date.now();
|
|
313
331
|
}
|
|
314
332
|
}
|
|
333
|
+
return;
|
|
315
334
|
});
|
|
316
335
|
},
|
|
317
336
|
{ root: this.editorScrollableElement as Element },
|
|
@@ -8,6 +8,8 @@ import {
|
|
|
8
8
|
akEditorTableBorderSelected,
|
|
9
9
|
akEditorTableCellBlanketDeleted,
|
|
10
10
|
akEditorTableCellBlanketSelected,
|
|
11
|
+
akEditorTableHeaderCellBackground,
|
|
12
|
+
akEditorTableHeaderCellBackgroundDark,
|
|
11
13
|
akEditorTableToolbar,
|
|
12
14
|
akEditorTableToolbarDark,
|
|
13
15
|
akEditorTableToolbarSize,
|
|
@@ -42,10 +44,18 @@ export const tableCellBackgroundColor = themed({
|
|
|
42
44
|
light: token('elevation.surface', N0),
|
|
43
45
|
dark: token('elevation.surface', DN30),
|
|
44
46
|
});
|
|
47
|
+
|
|
45
48
|
export const tableHeaderCellBackgroundColor = themed({
|
|
46
|
-
light: token(
|
|
47
|
-
|
|
49
|
+
light: token(
|
|
50
|
+
'color.background.accent.gray.subtlest',
|
|
51
|
+
akEditorTableHeaderCellBackground,
|
|
52
|
+
),
|
|
53
|
+
dark: token(
|
|
54
|
+
'color.background.accent.gray.subtlest',
|
|
55
|
+
akEditorTableHeaderCellBackgroundDark,
|
|
56
|
+
),
|
|
48
57
|
});
|
|
58
|
+
|
|
49
59
|
export const tableToolbarColor = themed({
|
|
50
60
|
light: token('color.background.neutral.subtle', akEditorTableToolbar),
|
|
51
61
|
dark: token('color.background.neutral.subtle', akEditorTableToolbarDark),
|
|
@@ -135,3 +145,4 @@ export const tableOverflowShadowWidth = 8;
|
|
|
135
145
|
export const TABLE_SNAP_GAP = 9;
|
|
136
146
|
export const TABLE_HIGHLIGHT_GAP = 10;
|
|
137
147
|
export const TABLE_HIGHLIGHT_TOLERANCE = 2;
|
|
148
|
+
export const STICKY_HEADER_TOGGLE_TOLERANCE_MS = 5;
|
|
@@ -510,7 +510,7 @@ export const resizeHandle = (props: ThemeProps) => css`
|
|
|
510
510
|
td.${ClassName.WITH_RESIZE_LINE}::before {
|
|
511
511
|
content: ' ';
|
|
512
512
|
position: absolute;
|
|
513
|
-
left: -2px;
|
|
513
|
+
left: ${token('space.negative.025', '-2px')};
|
|
514
514
|
top: -1px;
|
|
515
515
|
width: ${resizeLineWidth}px;
|
|
516
516
|
height: calc(100% + 2px);
|
|
@@ -520,7 +520,7 @@ export const resizeHandle = (props: ThemeProps) => css`
|
|
|
520
520
|
|
|
521
521
|
th.${ClassName.WITH_RESIZE_LINE}::before {
|
|
522
522
|
content: ' ';
|
|
523
|
-
left: -2px;
|
|
523
|
+
left: ${token('space.negative.025', '-2px')};
|
|
524
524
|
position: absolute;
|
|
525
525
|
width: ${resizeLineWidth}px;
|
|
526
526
|
height: calc(100% + ${tableToolbarSize + tableCellBorderWidth}px);
|