@atlaskit/editor-plugin-table 1.2.0 → 1.2.2
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 +26 -0
- package/dist/cjs/i18n/en.js +43 -0
- package/dist/cjs/i18n/en_GB.js +43 -0
- package/dist/cjs/plugins/table/index.js +2 -1
- package/dist/cjs/plugins/table/nodeviews/OverflowShadowsObserver.js +13 -26
- package/dist/cjs/plugins/table/nodeviews/TableComponent.js +18 -3
- package/dist/cjs/plugins/table/nodeviews/table.js +7 -0
- package/dist/cjs/plugins/table/pm-plugins/sticky-headers/nodeviews/tableRow.js +32 -17
- package/dist/cjs/plugins/table/pm-plugins/table-resizing/event-handlers.js +1 -5
- package/dist/cjs/plugins/table/pm-plugins/table-resizing/utils/misc.js +3 -38
- package/dist/cjs/plugins/table/transforms/delete-rows.js +1 -1
- package/dist/cjs/plugins/table/transforms/index.js +3 -3
- package/dist/cjs/plugins/table/transforms/merge.js +39 -54
- package/dist/cjs/plugins/table/ui/FloatingContextualMenu/ContextualMenu.js +16 -3
- package/dist/cjs/plugins/table/ui/FloatingContextualMenu/index.js +6 -3
- package/dist/cjs/plugins/table/ui/common-styles.js +2 -2
- package/dist/cjs/plugins/table/utils/row-controls.js +3 -2
- package/dist/cjs/types/i18n.js +5 -0
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/i18n/en.js +36 -0
- package/dist/es2019/i18n/en_GB.js +36 -0
- package/dist/es2019/plugins/table/index.js +2 -1
- package/dist/es2019/plugins/table/nodeviews/OverflowShadowsObserver.js +13 -26
- package/dist/es2019/plugins/table/nodeviews/TableComponent.js +22 -3
- package/dist/es2019/plugins/table/nodeviews/table.js +7 -0
- package/dist/es2019/plugins/table/pm-plugins/sticky-headers/nodeviews/tableRow.js +32 -17
- package/dist/es2019/plugins/table/pm-plugins/table-resizing/event-handlers.js +1 -5
- package/dist/es2019/plugins/table/pm-plugins/table-resizing/utils/misc.js +1 -37
- package/dist/es2019/plugins/table/transforms/delete-rows.js +2 -2
- package/dist/es2019/plugins/table/transforms/index.js +1 -1
- package/dist/es2019/plugins/table/transforms/merge.js +39 -43
- package/dist/es2019/plugins/table/ui/FloatingContextualMenu/ContextualMenu.js +18 -4
- package/dist/es2019/plugins/table/ui/FloatingContextualMenu/index.js +6 -3
- package/dist/es2019/plugins/table/ui/common-styles.js +21 -1
- package/dist/es2019/plugins/table/utils/row-controls.js +3 -2
- package/dist/es2019/types/i18n.js +1 -0
- package/dist/es2019/version.json +1 -1
- package/dist/esm/i18n/en.js +36 -0
- package/dist/esm/i18n/en_GB.js +36 -0
- package/dist/esm/plugins/table/index.js +2 -1
- package/dist/esm/plugins/table/nodeviews/OverflowShadowsObserver.js +13 -26
- package/dist/esm/plugins/table/nodeviews/TableComponent.js +18 -3
- package/dist/esm/plugins/table/nodeviews/table.js +7 -0
- package/dist/esm/plugins/table/pm-plugins/sticky-headers/nodeviews/tableRow.js +32 -17
- package/dist/esm/plugins/table/pm-plugins/table-resizing/event-handlers.js +1 -5
- package/dist/esm/plugins/table/pm-plugins/table-resizing/utils/misc.js +1 -35
- package/dist/esm/plugins/table/transforms/delete-rows.js +2 -2
- package/dist/esm/plugins/table/transforms/index.js +1 -1
- package/dist/esm/plugins/table/transforms/merge.js +38 -53
- package/dist/esm/plugins/table/ui/FloatingContextualMenu/ContextualMenu.js +17 -4
- package/dist/esm/plugins/table/ui/FloatingContextualMenu/index.js +6 -3
- package/dist/esm/plugins/table/ui/common-styles.js +2 -2
- package/dist/esm/plugins/table/utils/row-controls.js +3 -2
- package/dist/esm/types/i18n.js +1 -0
- package/dist/esm/version.json +1 -1
- package/dist/types/i18n/en.d.ts +35 -0
- package/dist/types/i18n/en_GB.d.ts +35 -0
- package/dist/types/plugins/table/nodeviews/OverflowShadowsObserver.d.ts +4 -5
- package/dist/types/plugins/table/nodeviews/TableComponent.d.ts +1 -0
- package/dist/types/plugins/table/nodeviews/__mocks__/OverflowShadowsObserver.d.ts +3 -3
- package/dist/types/plugins/table/pm-plugins/sticky-headers/nodeviews/tableRow.d.ts +2 -2
- package/dist/types/plugins/table/pm-plugins/table-resizing/utils/misc.d.ts +1 -2
- package/dist/types/plugins/table/transforms/index.d.ts +1 -1
- package/dist/types/plugins/table/transforms/merge.d.ts +1 -1
- package/dist/types/plugins/table/types.d.ts +2 -0
- package/dist/types/plugins/table/ui/FloatingContextualMenu/ContextualMenu.d.ts +2 -1
- package/dist/types/plugins/table/ui/FloatingContextualMenu/index.d.ts +3 -2
- package/dist/types/types/i18n.d.ts +5 -0
- package/package.json +10 -9
- package/src/__tests__/integration/__fixtures__/table-and-paragraph-adf.ts +130 -0
- package/src/__tests__/integration/horizontal-scroll-shadows.ts +199 -0
- package/src/__tests__/integration/horizontal-scroll.ts +4 -9
- package/src/__tests__/integration/meta-arrowup-cursor-in-first-row.ts +4 -2
- package/src/__tests__/integration/sticky-header.ts +61 -1
- package/src/__tests__/unit/commands/insert.ts +8 -8
- package/src/__tests__/unit/commands/sort.ts +4 -0
- package/src/__tests__/unit/commands.ts +2 -0
- package/src/__tests__/unit/index.ts +2 -0
- package/src/__tests__/unit/keymap.ts +4 -2
- package/src/__tests__/unit/layout.ts +2 -0
- package/src/__tests__/unit/nodeviews/OverflowShadowsObserver.ts +20 -11
- package/src/__tests__/unit/nodeviews/cell.ts +14 -0
- package/src/__tests__/unit/pm-plugins/main-with-allow-collapse.ts +2 -0
- package/src/__tests__/unit/pm-plugins/sticky-headers/tableRow.tsx +2 -2
- package/src/__tests__/unit/transforms/delete-rows.ts +45 -0
- package/src/__tests__/unit/ui/ContextualMenu.tsx +2 -0
- package/src/__tests__/unit/ui/FloatingContextualMenu.tsx +1 -0
- package/src/__tests__/unit/utils/collapse.ts +4 -1
- package/src/i18n/en.ts +36 -0
- package/src/i18n/en_GB.ts +36 -0
- package/src/plugins/table/index.tsx +4 -0
- package/src/plugins/table/nodeviews/OverflowShadowsObserver.ts +24 -40
- package/src/plugins/table/nodeviews/TableComponent.tsx +20 -4
- package/src/plugins/table/nodeviews/__mocks__/OverflowShadowsObserver.ts +3 -3
- package/src/plugins/table/nodeviews/table.tsx +12 -0
- package/src/plugins/table/pm-plugins/sticky-headers/nodeviews/tableRow.ts +40 -23
- package/src/plugins/table/pm-plugins/table-resizing/event-handlers.ts +1 -9
- package/src/plugins/table/pm-plugins/table-resizing/utils/misc.ts +1 -57
- package/src/plugins/table/transforms/delete-rows.ts +2 -2
- package/src/plugins/table/transforms/index.ts +1 -1
- package/src/plugins/table/transforms/merge.ts +41 -43
- package/src/plugins/table/ui/FloatingContextualMenu/ContextualMenu.tsx +21 -2
- package/src/plugins/table/ui/FloatingContextualMenu/index.tsx +8 -1
- package/src/plugins/table/ui/common-styles.ts +21 -0
- package/src/plugins/table/utils/row-controls.ts +3 -2
- package/src/types/i18n.ts +5 -0
- package/src/__tests__/integration/__fixtures__/table-and-paragraph-adf.json +0 -130
|
@@ -10,8 +10,9 @@ import { TableCssClassName as ClassName } from '../types';
|
|
|
10
10
|
import { tableDeleteButtonSize } from '../ui/consts';
|
|
11
11
|
export var getRowHeights = function getRowHeights(tableRef) {
|
|
12
12
|
var heights = [];
|
|
13
|
-
|
|
14
|
-
|
|
13
|
+
var tableBody = tableRef.querySelector('tbody');
|
|
14
|
+
if (tableBody) {
|
|
15
|
+
var rows = tableBody.childNodes;
|
|
15
16
|
for (var i = 0, count = rows.length; i < count; i++) {
|
|
16
17
|
var row = rows[i];
|
|
17
18
|
heights[i] = row.getBoundingClientRect().height + 1;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/esm/version.json
CHANGED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
declare const _default: {
|
|
2
|
+
'fabric.editor.canNotSortTable': string;
|
|
3
|
+
'fabric.editor.cellBackground': string;
|
|
4
|
+
'fabric.editor.cellOptions': string;
|
|
5
|
+
'fabric.editor.clearCells': string;
|
|
6
|
+
'fabric.editor.collapseTable': string;
|
|
7
|
+
'fabric.editor.cornerControl': string;
|
|
8
|
+
'fabric.editor.distributeColumns': string;
|
|
9
|
+
'fabric.editor.extension.confirmDeleteLinkedModalMessagePrefix': string;
|
|
10
|
+
'fabric.editor.extension.deleteElementTitle': string;
|
|
11
|
+
'fabric.editor.extension.sourceNoTitledName': string;
|
|
12
|
+
'fabric.editor.floatingToolbar.confirmModalCheckboxLabel': string;
|
|
13
|
+
'fabric.editor.headerColumn': string;
|
|
14
|
+
'fabric.editor.headerRow': string;
|
|
15
|
+
'fabric.editor.insertColumn': string;
|
|
16
|
+
'fabric.editor.insertRow': string;
|
|
17
|
+
'fabric.editor.mergeCells': string;
|
|
18
|
+
'fabric.editor.numberedColumn': string;
|
|
19
|
+
'fabric.editor.removeColumns': string;
|
|
20
|
+
'fabric.editor.removeRows': string;
|
|
21
|
+
'fabric.editor.rowControl': string;
|
|
22
|
+
'fabric.editor.sortColumnASC': string;
|
|
23
|
+
'fabric.editor.sortColumnDESC': string;
|
|
24
|
+
'fabric.editor.splitCell': string;
|
|
25
|
+
'fabric.editor.tableOptions': string;
|
|
26
|
+
'fabric.editor.tables.confirmDeleteLinkedModalMessage': string;
|
|
27
|
+
'fabric.editor.tables.confirmDeleteLinkedModalOKButton': string;
|
|
28
|
+
};
|
|
29
|
+
/**
|
|
30
|
+
* NOTE:
|
|
31
|
+
*
|
|
32
|
+
* This file is automatically generated by Traduki 2.0.
|
|
33
|
+
* DO NOT CHANGE IT BY HAND or your changes will be lost.
|
|
34
|
+
*/
|
|
35
|
+
export default _default;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
declare const _default: {
|
|
2
|
+
'fabric.editor.canNotSortTable': string;
|
|
3
|
+
'fabric.editor.cellBackground': string;
|
|
4
|
+
'fabric.editor.cellOptions': string;
|
|
5
|
+
'fabric.editor.clearCells': string;
|
|
6
|
+
'fabric.editor.collapseTable': string;
|
|
7
|
+
'fabric.editor.cornerControl': string;
|
|
8
|
+
'fabric.editor.distributeColumns': string;
|
|
9
|
+
'fabric.editor.extension.confirmDeleteLinkedModalMessagePrefix': string;
|
|
10
|
+
'fabric.editor.extension.deleteElementTitle': string;
|
|
11
|
+
'fabric.editor.extension.sourceNoTitledName': string;
|
|
12
|
+
'fabric.editor.floatingToolbar.confirmModalCheckboxLabel': string;
|
|
13
|
+
'fabric.editor.headerColumn': string;
|
|
14
|
+
'fabric.editor.headerRow': string;
|
|
15
|
+
'fabric.editor.insertColumn': string;
|
|
16
|
+
'fabric.editor.insertRow': string;
|
|
17
|
+
'fabric.editor.mergeCells': string;
|
|
18
|
+
'fabric.editor.numberedColumn': string;
|
|
19
|
+
'fabric.editor.removeColumns': string;
|
|
20
|
+
'fabric.editor.removeRows': string;
|
|
21
|
+
'fabric.editor.rowControl': string;
|
|
22
|
+
'fabric.editor.sortColumnASC': string;
|
|
23
|
+
'fabric.editor.sortColumnDESC': string;
|
|
24
|
+
'fabric.editor.splitCell': string;
|
|
25
|
+
'fabric.editor.tableOptions': string;
|
|
26
|
+
'fabric.editor.tables.confirmDeleteLinkedModalMessage': string;
|
|
27
|
+
'fabric.editor.tables.confirmDeleteLinkedModalOKButton': string;
|
|
28
|
+
};
|
|
29
|
+
/**
|
|
30
|
+
* NOTE:
|
|
31
|
+
*
|
|
32
|
+
* This file is automatically generated by Traduki 2.0.
|
|
33
|
+
* DO NOT CHANGE IT BY HAND or your changes will be lost.
|
|
34
|
+
*/
|
|
35
|
+
export default _default;
|
|
@@ -4,10 +4,9 @@ export declare class OverflowShadowsObserver {
|
|
|
4
4
|
private updateShadowState;
|
|
5
5
|
private table;
|
|
6
6
|
private wrapper;
|
|
7
|
-
private
|
|
8
|
-
private
|
|
9
|
-
private
|
|
10
|
-
private getLastCell;
|
|
7
|
+
private leftShadowSentinel;
|
|
8
|
+
private rightShadowSentinel;
|
|
9
|
+
private shadowsObserved;
|
|
11
10
|
private isSticky;
|
|
12
11
|
private stickyRowHeight;
|
|
13
12
|
constructor(updateShadowState: (shadowKey: ShadowEvent, value: boolean) => void, table: HTMLElement, wrapper: HTMLDivElement);
|
|
@@ -15,7 +14,7 @@ export declare class OverflowShadowsObserver {
|
|
|
15
14
|
private checkIntersectionEvent;
|
|
16
15
|
private updateStickyShadowsHeightIfChanged;
|
|
17
16
|
private getStickyCell;
|
|
18
|
-
|
|
17
|
+
observeShadowSentinels: (isSticky?: boolean | undefined) => void;
|
|
19
18
|
/**
|
|
20
19
|
* Takes a heightStyle if it can be computed in a less expensive manner,
|
|
21
20
|
* e.g. bounds on an IntersectionObserverEntry, otherwise proceed with
|
|
@@ -50,6 +50,7 @@ declare class TableComponent extends React.Component<ComponentProps, TableState>
|
|
|
50
50
|
componentDidUpdate(prevProps: ComponentProps): void;
|
|
51
51
|
private updateShadows;
|
|
52
52
|
private updateShadowState;
|
|
53
|
+
private createShadowSentinels;
|
|
53
54
|
onStickyState: (state: StickyPluginState) => void;
|
|
54
55
|
prevTableState: any;
|
|
55
56
|
render(): JSX.Element;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { OverridableMock } from './OverridableMock';
|
|
2
2
|
export declare class OverflowShadowsObserver extends OverridableMock {
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
leftShadowSentinel: HTMLElement | null;
|
|
4
|
+
rightShadowSentinel: HTMLElement | null;
|
|
5
5
|
constructor(...inputs: any[]);
|
|
6
|
-
|
|
6
|
+
observeShadowSentinels: any;
|
|
7
7
|
updateStickyShadows: any;
|
|
8
8
|
dispose: any;
|
|
9
9
|
}
|
|
@@ -57,9 +57,9 @@ export declare class TableRowNodeView implements NodeView {
|
|
|
57
57
|
target: Element;
|
|
58
58
|
}): boolean;
|
|
59
59
|
onTablePluginState: (state: TablePluginState) => void;
|
|
60
|
-
|
|
60
|
+
updateStickyHeaderWidth: () => void;
|
|
61
61
|
shouldHeaderStick: (tree: TableDOMElements) => boolean;
|
|
62
|
-
makeHeaderRowSticky: (tree: TableDOMElements) => void;
|
|
62
|
+
makeHeaderRowSticky: (tree: TableDOMElements, scrollTop?: number | undefined) => void;
|
|
63
63
|
makeRowHeaderNotSticky: (table: HTMLElement, isEditorDestroyed?: boolean) => void;
|
|
64
64
|
getWrapperoffset: (inverse?: boolean) => number;
|
|
65
65
|
getWrapperRefTop: (wrapper: HTMLElement) => number;
|
|
@@ -18,6 +18,5 @@ interface getTableMaxWidthProps {
|
|
|
18
18
|
layout: TableLayout;
|
|
19
19
|
getEditorContainerWidth: GetEditorContainerWidth;
|
|
20
20
|
}
|
|
21
|
-
export declare const getTableMaxWidth: ({ table, tableStart, state, layout, getEditorContainerWidth, }: getTableMaxWidthProps) =>
|
|
22
|
-
export declare const getParentWidthWithoutPadding: (parentWidth: number, tableStartPos: number, state: EditorState) => number | undefined;
|
|
21
|
+
export declare const getTableMaxWidth: ({ table, tableStart, state, layout, getEditorContainerWidth, }: getTableMaxWidthProps) => any;
|
|
23
22
|
export {};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export { mergeCells, canMergeCells, removeEmptyColumns } from './merge';
|
|
2
1
|
export { fireAnalytics, fixTables, fixAutoSizedTable } from './fix-tables';
|
|
2
|
+
export { mergeCells, canMergeCells, mergeEmptyColumns } from './merge';
|
|
3
3
|
export { deleteColumns } from './delete-columns';
|
|
4
4
|
export { deleteRows } from './delete-rows';
|
|
5
5
|
export { updateColumnWidths } from './column-width';
|
|
@@ -2,4 +2,4 @@ import { Node as PMNode } from 'prosemirror-model';
|
|
|
2
2
|
import { Transaction } from 'prosemirror-state';
|
|
3
3
|
export declare function mergeCells(tr: Transaction): Transaction;
|
|
4
4
|
export declare function canMergeCells(tr: Transaction): boolean;
|
|
5
|
-
export declare function
|
|
5
|
+
export declare function mergeEmptyColumns(table: PMNode): PMNode | null;
|
|
@@ -291,6 +291,8 @@ export declare const TableCssClassName: {
|
|
|
291
291
|
TABLE_STICKY_WRAPPER: string;
|
|
292
292
|
TABLE_STICKY_SENTINEL_TOP: string;
|
|
293
293
|
TABLE_STICKY_SENTINEL_BOTTOM: string;
|
|
294
|
+
TABLE_SHADOW_SENTINEL_LEFT: string;
|
|
295
|
+
TABLE_SHADOW_SENTINEL_RIGHT: string;
|
|
294
296
|
TABLE_CELL_NODEVIEW_CONTENT_DOM: string;
|
|
295
297
|
TABLE_CELL_WRAPPER: string;
|
|
296
298
|
TABLE_HEADER_CELL_WRAPPER: string;
|
|
@@ -4,7 +4,7 @@ import { jsx } from '@emotion/react';
|
|
|
4
4
|
import { Rect } from '@atlaskit/editor-tables/table-map';
|
|
5
5
|
import { EditorView } from 'prosemirror-view';
|
|
6
6
|
import { WrappedComponentProps } from 'react-intl-next';
|
|
7
|
-
import type { GetEditorContainerWidth } from '@atlaskit/editor-common/types';
|
|
7
|
+
import type { GetEditorContainerWidth, GetEditorFeatureFlags } from '@atlaskit/editor-common/types';
|
|
8
8
|
import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
|
|
9
9
|
export declare const messages: {
|
|
10
10
|
cellBackground: {
|
|
@@ -61,6 +61,7 @@ export interface Props {
|
|
|
61
61
|
offset?: Array<number>;
|
|
62
62
|
editorAnalyticsAPI?: EditorAnalyticsAPI;
|
|
63
63
|
getEditorContainerWidth: GetEditorContainerWidth;
|
|
64
|
+
getEditorFeatureFlags: GetEditorFeatureFlags;
|
|
64
65
|
}
|
|
65
66
|
export interface State {
|
|
66
67
|
isSubmenuOpen: boolean;
|
|
@@ -3,11 +3,12 @@ import { jsx } from '@emotion/react';
|
|
|
3
3
|
import { EditorView } from 'prosemirror-view';
|
|
4
4
|
import { PluginConfig } from '../../types';
|
|
5
5
|
import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
|
|
6
|
-
import type { GetEditorContainerWidth } from '@atlaskit/editor-common/types';
|
|
6
|
+
import type { GetEditorContainerWidth, GetEditorFeatureFlags } from '@atlaskit/editor-common/types';
|
|
7
7
|
export interface Props {
|
|
8
8
|
editorView: EditorView;
|
|
9
9
|
isOpen: boolean;
|
|
10
10
|
getEditorContainerWidth: GetEditorContainerWidth;
|
|
11
|
+
getEditorFeatureFlags: GetEditorFeatureFlags;
|
|
11
12
|
targetCellPosition?: number;
|
|
12
13
|
mountPoint?: HTMLElement;
|
|
13
14
|
boundariesElement?: HTMLElement;
|
|
@@ -16,7 +17,7 @@ export interface Props {
|
|
|
16
17
|
editorAnalyticsAPI?: EditorAnalyticsAPI;
|
|
17
18
|
}
|
|
18
19
|
declare const FloatingContextualMenu: {
|
|
19
|
-
({ mountPoint, boundariesElement, scrollableElement, editorView, isOpen, pluginConfig, editorAnalyticsAPI, getEditorContainerWidth, }: Props): jsx.JSX.Element | null;
|
|
20
|
+
({ mountPoint, boundariesElement, scrollableElement, editorView, isOpen, pluginConfig, editorAnalyticsAPI, getEditorContainerWidth, getEditorFeatureFlags, }: Props): jsx.JSX.Element | null;
|
|
20
21
|
displayName: string;
|
|
21
22
|
};
|
|
22
23
|
export default FloatingContextualMenu;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-table",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.2",
|
|
4
4
|
"description": "Table plugin for the @atlaskit/editor",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -18,12 +18,12 @@
|
|
|
18
18
|
"releaseModel": "scheduled"
|
|
19
19
|
},
|
|
20
20
|
"dependencies": {
|
|
21
|
-
"@atlaskit/adf-schema": "^25.
|
|
22
|
-
"@atlaskit/editor-common": "^72.
|
|
21
|
+
"@atlaskit/adf-schema": "^25.4.0",
|
|
22
|
+
"@atlaskit/editor-common": "^72.7.0",
|
|
23
23
|
"@atlaskit/editor-shared-styles": "^2.3.0",
|
|
24
24
|
"@atlaskit/editor-tables": "^2.2.0",
|
|
25
25
|
"@atlaskit/icon": "^21.11.0",
|
|
26
|
-
"@atlaskit/theme": "^12.
|
|
26
|
+
"@atlaskit/theme": "^12.3.0",
|
|
27
27
|
"@atlaskit/tokens": "^1.2.0",
|
|
28
28
|
"@atlaskit/tooltip": "^17.7.0",
|
|
29
29
|
"@babel/runtime": "^7.0.0",
|
|
@@ -50,14 +50,15 @@
|
|
|
50
50
|
},
|
|
51
51
|
"devDependencies": {
|
|
52
52
|
"@atlaskit/analytics-next": "^9.0.0",
|
|
53
|
-
"@atlaskit/button": "^16.
|
|
54
|
-
"@atlaskit/editor-core": "^
|
|
55
|
-
"@atlaskit/editor-
|
|
53
|
+
"@atlaskit/button": "^16.6.0",
|
|
54
|
+
"@atlaskit/editor-core": "^182.0.0",
|
|
55
|
+
"@atlaskit/editor-plugin-feature-flags": "^0.0.2",
|
|
56
|
+
"@atlaskit/editor-test-helpers": "^18.2.0",
|
|
56
57
|
"@atlaskit/link-provider": "^1.5.0",
|
|
57
58
|
"@atlaskit/logo": "^13.11.0",
|
|
58
59
|
"@atlaskit/media-integration-test-helpers": "^2.6.0",
|
|
59
60
|
"@atlaskit/synchrony-test-helpers": "^2.3.0",
|
|
60
|
-
"@atlaskit/util-data-test": "^17.
|
|
61
|
+
"@atlaskit/util-data-test": "^17.7.0",
|
|
61
62
|
"@atlaskit/visual-regression": "*",
|
|
62
63
|
"@atlaskit/webdriver-runner": "*",
|
|
63
64
|
"@atlassian/atlassian-frontend-prettier-config-1.0.1": "npm:@atlassian/atlassian-frontend-prettier-config@1.0.1",
|
|
@@ -87,4 +88,4 @@
|
|
|
87
88
|
]
|
|
88
89
|
}
|
|
89
90
|
}
|
|
90
|
-
}
|
|
91
|
+
}
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
export default {
|
|
2
|
+
version: 1,
|
|
3
|
+
type: 'doc',
|
|
4
|
+
content: [
|
|
5
|
+
{
|
|
6
|
+
type: 'table',
|
|
7
|
+
attrs: {
|
|
8
|
+
isNumberColumnEnabled: false,
|
|
9
|
+
layout: 'default',
|
|
10
|
+
localId: '79259280-56bc-4cb0-9587-572864b97f39',
|
|
11
|
+
},
|
|
12
|
+
content: [
|
|
13
|
+
{
|
|
14
|
+
type: 'tableRow',
|
|
15
|
+
content: [
|
|
16
|
+
{
|
|
17
|
+
type: 'tableHeader',
|
|
18
|
+
attrs: {},
|
|
19
|
+
content: [
|
|
20
|
+
{
|
|
21
|
+
type: 'paragraph',
|
|
22
|
+
content: [],
|
|
23
|
+
},
|
|
24
|
+
],
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
type: 'tableHeader',
|
|
28
|
+
attrs: {},
|
|
29
|
+
content: [
|
|
30
|
+
{
|
|
31
|
+
type: 'paragraph',
|
|
32
|
+
content: [],
|
|
33
|
+
},
|
|
34
|
+
],
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
type: 'tableHeader',
|
|
38
|
+
attrs: {},
|
|
39
|
+
content: [
|
|
40
|
+
{
|
|
41
|
+
type: 'paragraph',
|
|
42
|
+
content: [],
|
|
43
|
+
},
|
|
44
|
+
],
|
|
45
|
+
},
|
|
46
|
+
],
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
type: 'tableRow',
|
|
50
|
+
content: [
|
|
51
|
+
{
|
|
52
|
+
type: 'tableCell',
|
|
53
|
+
attrs: {},
|
|
54
|
+
content: [
|
|
55
|
+
{
|
|
56
|
+
type: 'paragraph',
|
|
57
|
+
content: [],
|
|
58
|
+
},
|
|
59
|
+
],
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
type: 'tableCell',
|
|
63
|
+
attrs: {},
|
|
64
|
+
content: [
|
|
65
|
+
{
|
|
66
|
+
type: 'paragraph',
|
|
67
|
+
content: [],
|
|
68
|
+
},
|
|
69
|
+
],
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
type: 'tableCell',
|
|
73
|
+
attrs: {},
|
|
74
|
+
content: [
|
|
75
|
+
{
|
|
76
|
+
type: 'paragraph',
|
|
77
|
+
content: [],
|
|
78
|
+
},
|
|
79
|
+
],
|
|
80
|
+
},
|
|
81
|
+
],
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
type: 'tableRow',
|
|
85
|
+
content: [
|
|
86
|
+
{
|
|
87
|
+
type: 'tableCell',
|
|
88
|
+
attrs: {},
|
|
89
|
+
content: [
|
|
90
|
+
{
|
|
91
|
+
type: 'paragraph',
|
|
92
|
+
content: [],
|
|
93
|
+
},
|
|
94
|
+
],
|
|
95
|
+
},
|
|
96
|
+
{
|
|
97
|
+
type: 'tableCell',
|
|
98
|
+
attrs: {},
|
|
99
|
+
content: [
|
|
100
|
+
{
|
|
101
|
+
type: 'paragraph',
|
|
102
|
+
content: [],
|
|
103
|
+
},
|
|
104
|
+
],
|
|
105
|
+
},
|
|
106
|
+
{
|
|
107
|
+
type: 'tableCell',
|
|
108
|
+
attrs: {},
|
|
109
|
+
content: [
|
|
110
|
+
{
|
|
111
|
+
type: 'paragraph',
|
|
112
|
+
content: [],
|
|
113
|
+
},
|
|
114
|
+
],
|
|
115
|
+
},
|
|
116
|
+
],
|
|
117
|
+
},
|
|
118
|
+
],
|
|
119
|
+
},
|
|
120
|
+
{
|
|
121
|
+
type: 'paragraph',
|
|
122
|
+
content: [
|
|
123
|
+
{
|
|
124
|
+
type: 'text',
|
|
125
|
+
text: 'test',
|
|
126
|
+
},
|
|
127
|
+
],
|
|
128
|
+
},
|
|
129
|
+
],
|
|
130
|
+
};
|
|
@@ -0,0 +1,199 @@
|
|
|
1
|
+
import { BrowserTestCase } from '@atlaskit/webdriver-runner/runner';
|
|
2
|
+
import WebdriverPage from '@atlaskit/webdriver-runner/wd-wrapper';
|
|
3
|
+
|
|
4
|
+
import {
|
|
5
|
+
goToEditorTestingWDExample,
|
|
6
|
+
mountEditor,
|
|
7
|
+
} from '@atlaskit/editor-test-helpers/testing-example-page';
|
|
8
|
+
|
|
9
|
+
import {
|
|
10
|
+
fullpage,
|
|
11
|
+
resizeColumn,
|
|
12
|
+
} from '@atlaskit/editor-test-helpers/integration/helpers';
|
|
13
|
+
|
|
14
|
+
import { TableCssClassName as className } from '../../plugins/table/types';
|
|
15
|
+
import basicTable from './__fixtures__/basic-table';
|
|
16
|
+
|
|
17
|
+
const checkShadows = async (page: WebdriverPage, side?: 'left' | 'right') => {
|
|
18
|
+
const leftShadow = await page.$(`.${className.TABLE_LEFT_SHADOW}`);
|
|
19
|
+
const leftShadowStyle = await leftShadow.getAttribute('style');
|
|
20
|
+
const rightShadow = await page.$(`.${className.TABLE_RIGHT_SHADOW}`);
|
|
21
|
+
const rightShadowStyle = await rightShadow.getAttribute('style');
|
|
22
|
+
|
|
23
|
+
if (!side) {
|
|
24
|
+
return (
|
|
25
|
+
leftShadowStyle.includes('display: block;') &&
|
|
26
|
+
rightShadowStyle.includes('display: block;')
|
|
27
|
+
);
|
|
28
|
+
} else if (side === 'left') {
|
|
29
|
+
return leftShadowStyle.includes('display: block;');
|
|
30
|
+
} else if (side === 'right') {
|
|
31
|
+
return rightShadowStyle.includes('display: block;');
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
BrowserTestCase(
|
|
36
|
+
'Table does not show horizontal scroll shadows when there is no scrollbar',
|
|
37
|
+
{},
|
|
38
|
+
async (client: any, testName: string) => {
|
|
39
|
+
const page = await goToEditorTestingWDExample(
|
|
40
|
+
client,
|
|
41
|
+
'editor-plugin-table',
|
|
42
|
+
);
|
|
43
|
+
|
|
44
|
+
await mountEditor(page, {
|
|
45
|
+
appearance: fullpage.appearance,
|
|
46
|
+
defaultValue: JSON.stringify(basicTable),
|
|
47
|
+
allowTables: {
|
|
48
|
+
advanced: true,
|
|
49
|
+
},
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
await page.waitForSelector('table');
|
|
53
|
+
expect(await checkShadows(page)).toBeFalsy();
|
|
54
|
+
},
|
|
55
|
+
);
|
|
56
|
+
|
|
57
|
+
BrowserTestCase(
|
|
58
|
+
'Table shows right shadow when table is scrollable and all the way to the left',
|
|
59
|
+
{},
|
|
60
|
+
async (client: any, testName: string) => {
|
|
61
|
+
const page = await goToEditorTestingWDExample(
|
|
62
|
+
client,
|
|
63
|
+
'editor-plugin-table',
|
|
64
|
+
);
|
|
65
|
+
|
|
66
|
+
await mountEditor(page, {
|
|
67
|
+
appearance: fullpage.appearance,
|
|
68
|
+
defaultValue: JSON.stringify(basicTable),
|
|
69
|
+
allowTables: {
|
|
70
|
+
advanced: true,
|
|
71
|
+
},
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
await page.waitForSelector('table');
|
|
75
|
+
await resizeColumn(page, { cellHandlePos: 2, resizeWidth: 1000 });
|
|
76
|
+
|
|
77
|
+
expect(await checkShadows(page, 'right')).toBeTruthy();
|
|
78
|
+
},
|
|
79
|
+
);
|
|
80
|
+
|
|
81
|
+
BrowserTestCase(
|
|
82
|
+
'Table should not show left shadow when table is scrollable and all the way to the left',
|
|
83
|
+
{},
|
|
84
|
+
async (client: any, testName: string) => {
|
|
85
|
+
const page = await goToEditorTestingWDExample(
|
|
86
|
+
client,
|
|
87
|
+
'editor-plugin-table',
|
|
88
|
+
);
|
|
89
|
+
|
|
90
|
+
await mountEditor(page, {
|
|
91
|
+
appearance: fullpage.appearance,
|
|
92
|
+
defaultValue: JSON.stringify(basicTable),
|
|
93
|
+
allowTables: {
|
|
94
|
+
advanced: true,
|
|
95
|
+
},
|
|
96
|
+
});
|
|
97
|
+
|
|
98
|
+
await page.waitForSelector('table');
|
|
99
|
+
await resizeColumn(page, { cellHandlePos: 2, resizeWidth: 1000 });
|
|
100
|
+
|
|
101
|
+
expect(await checkShadows(page, 'left')).toBeFalsy();
|
|
102
|
+
},
|
|
103
|
+
);
|
|
104
|
+
|
|
105
|
+
BrowserTestCase(
|
|
106
|
+
'Table should show both left and right shadows when table is scrollable and scrolled',
|
|
107
|
+
{},
|
|
108
|
+
async (client: any, testName: string) => {
|
|
109
|
+
const page = await goToEditorTestingWDExample(
|
|
110
|
+
client,
|
|
111
|
+
'editor-plugin-table',
|
|
112
|
+
);
|
|
113
|
+
|
|
114
|
+
await mountEditor(page, {
|
|
115
|
+
appearance: fullpage.appearance,
|
|
116
|
+
defaultValue: JSON.stringify(basicTable),
|
|
117
|
+
allowTables: {
|
|
118
|
+
advanced: true,
|
|
119
|
+
},
|
|
120
|
+
});
|
|
121
|
+
|
|
122
|
+
await page.waitForSelector('table');
|
|
123
|
+
await resizeColumn(page, { cellHandlePos: 2, resizeWidth: 1000 });
|
|
124
|
+
await page.evaluate(() => {
|
|
125
|
+
const tableWrapper =
|
|
126
|
+
document.querySelector<HTMLElement>('.pm-table-wrapper');
|
|
127
|
+
if (tableWrapper) {
|
|
128
|
+
tableWrapper.scrollLeft += 500;
|
|
129
|
+
}
|
|
130
|
+
return tableWrapper;
|
|
131
|
+
});
|
|
132
|
+
|
|
133
|
+
expect(await checkShadows(page)).toBeTruthy();
|
|
134
|
+
},
|
|
135
|
+
);
|
|
136
|
+
|
|
137
|
+
BrowserTestCase(
|
|
138
|
+
'Table should not show right shadow when table is scrollable and scrolled all the way to the right',
|
|
139
|
+
{},
|
|
140
|
+
async (client: any, testName: string) => {
|
|
141
|
+
const page = await goToEditorTestingWDExample(
|
|
142
|
+
client,
|
|
143
|
+
'editor-plugin-table',
|
|
144
|
+
);
|
|
145
|
+
|
|
146
|
+
await mountEditor(page, {
|
|
147
|
+
appearance: fullpage.appearance,
|
|
148
|
+
defaultValue: JSON.stringify(basicTable),
|
|
149
|
+
allowTables: {
|
|
150
|
+
advanced: true,
|
|
151
|
+
},
|
|
152
|
+
});
|
|
153
|
+
|
|
154
|
+
await page.waitForSelector('table');
|
|
155
|
+
await resizeColumn(page, { cellHandlePos: 2, resizeWidth: 1000 });
|
|
156
|
+
await page.evaluate(() => {
|
|
157
|
+
const tableWrapper =
|
|
158
|
+
document.querySelector<HTMLElement>('.pm-table-wrapper');
|
|
159
|
+
if (tableWrapper) {
|
|
160
|
+
tableWrapper.scrollLeft += 1000;
|
|
161
|
+
}
|
|
162
|
+
return tableWrapper;
|
|
163
|
+
});
|
|
164
|
+
|
|
165
|
+
expect(await checkShadows(page, 'right')).toBeFalsy();
|
|
166
|
+
},
|
|
167
|
+
);
|
|
168
|
+
|
|
169
|
+
BrowserTestCase(
|
|
170
|
+
'Table should show left shadow when table is scrollable and scrolled all the way to the right',
|
|
171
|
+
{},
|
|
172
|
+
async (client: any, testName: string) => {
|
|
173
|
+
const page = await goToEditorTestingWDExample(
|
|
174
|
+
client,
|
|
175
|
+
'editor-plugin-table',
|
|
176
|
+
);
|
|
177
|
+
|
|
178
|
+
await mountEditor(page, {
|
|
179
|
+
appearance: fullpage.appearance,
|
|
180
|
+
defaultValue: JSON.stringify(basicTable),
|
|
181
|
+
allowTables: {
|
|
182
|
+
advanced: true,
|
|
183
|
+
},
|
|
184
|
+
});
|
|
185
|
+
|
|
186
|
+
await page.waitForSelector('table');
|
|
187
|
+
await resizeColumn(page, { cellHandlePos: 2, resizeWidth: 1000 });
|
|
188
|
+
await page.evaluate(() => {
|
|
189
|
+
const tableWrapper =
|
|
190
|
+
document.querySelector<HTMLElement>('.pm-table-wrapper');
|
|
191
|
+
if (tableWrapper) {
|
|
192
|
+
tableWrapper.scrollLeft += 1000;
|
|
193
|
+
}
|
|
194
|
+
return tableWrapper;
|
|
195
|
+
});
|
|
196
|
+
|
|
197
|
+
expect(await checkShadows(page, 'left')).toBeTruthy();
|
|
198
|
+
},
|
|
199
|
+
);
|
|
@@ -55,10 +55,9 @@ const assertTableDoesScroll = async (page: WebdriverPage) => {
|
|
|
55
55
|
expect(tableScrollWidth).toBeGreaterThan(tableOffsetWidth);
|
|
56
56
|
};
|
|
57
57
|
|
|
58
|
-
// insertColumn helper doesn't work in Safari
|
|
59
58
|
BrowserTestCase(
|
|
60
59
|
'Table: Does not scroll when column is resized and a new column is inserted',
|
|
61
|
-
{ skip: [
|
|
60
|
+
{ skip: [] },
|
|
62
61
|
async (client: any, testName: string) => {
|
|
63
62
|
for (const screenWidth of screenWidths) {
|
|
64
63
|
const page = await goToEditorTestingWDExample(
|
|
@@ -84,7 +83,6 @@ BrowserTestCase(
|
|
|
84
83
|
},
|
|
85
84
|
);
|
|
86
85
|
|
|
87
|
-
// insertColumn helper doesn't work in Safari
|
|
88
86
|
BrowserTestCase(
|
|
89
87
|
'Table: Does not scroll when column is resized and breakout button is clicked 3x',
|
|
90
88
|
{ skip: ['safari'] },
|
|
@@ -281,10 +279,9 @@ BrowserTestCase(
|
|
|
281
279
|
},
|
|
282
280
|
);
|
|
283
281
|
|
|
284
|
-
// insertColumn helper doesn't work in Safari
|
|
285
282
|
BrowserTestCase(
|
|
286
283
|
'Table: Scrolls when there are more columns added than can fit the current width',
|
|
287
|
-
{ skip: [
|
|
284
|
+
{ skip: [] },
|
|
288
285
|
async (client: any, testName: string) => {
|
|
289
286
|
for (const screenWidth of screenWidths) {
|
|
290
287
|
const page = await goToEditorTestingWDExample(
|
|
@@ -315,10 +312,9 @@ BrowserTestCase(
|
|
|
315
312
|
},
|
|
316
313
|
);
|
|
317
314
|
|
|
318
|
-
// insertColumn helper doesn't work in Safari
|
|
319
315
|
BrowserTestCase(
|
|
320
316
|
'Table: Does not scroll when nested in Bodied Macro, column is resized and breakout button is clicked',
|
|
321
|
-
{ skip: [
|
|
317
|
+
{ skip: [] },
|
|
322
318
|
async (client: any, testName: string) => {
|
|
323
319
|
for (const screenWidth of screenWidths) {
|
|
324
320
|
const page = await goToEditorTestingWDExample(
|
|
@@ -451,10 +447,9 @@ BrowserTestCase(
|
|
|
451
447
|
},
|
|
452
448
|
);
|
|
453
449
|
|
|
454
|
-
// insertColumn helper doesn't work in Safari
|
|
455
450
|
BrowserTestCase(
|
|
456
451
|
'Table: Does not scroll when nested in full-width layout, columns is resized and new column is inserted',
|
|
457
|
-
{ skip: [
|
|
452
|
+
{ skip: [] },
|
|
458
453
|
async (client: any, testName: string) => {
|
|
459
454
|
for (const screenWidth of screenWidths) {
|
|
460
455
|
const page = await goToEditorTestingWDExample(
|