@atlaskit/editor-plugin-table 5.3.13 → 5.3.14
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 +10 -0
- package/dist/cjs/plugins/table/event-handlers.js +6 -3
- package/dist/cjs/plugins/table/index.js +4 -3
- package/dist/cjs/plugins/table/pm-plugins/decorations/plugin.js +3 -7
- package/dist/cjs/plugins/table/pm-plugins/decorations/utils/column-controls.js +1 -3
- package/dist/cjs/plugins/table/pm-plugins/drag-and-drop/plugin.js +11 -0
- package/dist/cjs/plugins/table/types.js +9 -2
- package/dist/cjs/plugins/table/ui/FloatingDragMenu/index.js +5 -3
- package/dist/cjs/plugins/table/ui/FloatingInsertButton/InsertButton.js +57 -9
- package/dist/cjs/plugins/table/ui/FloatingInsertButton/getPopupOptions.js +9 -7
- package/dist/cjs/plugins/table/ui/FloatingInsertButton/index.js +13 -4
- package/dist/cjs/plugins/table/ui/TableFloatingColumnControls/ColumnControls/index.js +44 -5
- package/dist/cjs/plugins/table/ui/TableFloatingColumnControls/index.js +6 -4
- package/dist/cjs/plugins/table/ui/TableFloatingControls/RowControls/DragControls.js +35 -13
- package/dist/cjs/plugins/table/ui/TableFloatingControls/index.js +2 -0
- package/dist/cjs/plugins/table/ui/common-styles.js +1 -1
- package/dist/cjs/plugins/table/ui/ui-styles.js +27 -24
- package/dist/cjs/plugins/table/utils/dom.js +12 -4
- package/dist/cjs/plugins/table/utils/index.js +12 -0
- package/dist/es2019/plugins/table/event-handlers.js +5 -4
- package/dist/es2019/plugins/table/index.js +4 -3
- package/dist/es2019/plugins/table/pm-plugins/decorations/plugin.js +3 -7
- package/dist/es2019/plugins/table/pm-plugins/decorations/utils/column-controls.js +1 -3
- package/dist/es2019/plugins/table/pm-plugins/drag-and-drop/plugin.js +12 -0
- package/dist/es2019/plugins/table/types.js +9 -2
- package/dist/es2019/plugins/table/ui/FloatingDragMenu/index.js +5 -3
- package/dist/es2019/plugins/table/ui/FloatingInsertButton/InsertButton.js +58 -7
- package/dist/es2019/plugins/table/ui/FloatingInsertButton/getPopupOptions.js +9 -7
- package/dist/es2019/plugins/table/ui/FloatingInsertButton/index.js +10 -4
- package/dist/es2019/plugins/table/ui/TableFloatingColumnControls/ColumnControls/index.js +46 -6
- package/dist/es2019/plugins/table/ui/TableFloatingColumnControls/index.js +7 -5
- package/dist/es2019/plugins/table/ui/TableFloatingControls/RowControls/DragControls.js +35 -14
- package/dist/es2019/plugins/table/ui/TableFloatingControls/index.js +2 -0
- package/dist/es2019/plugins/table/ui/common-styles.js +51 -3
- package/dist/es2019/plugins/table/ui/ui-styles.js +23 -1
- package/dist/es2019/plugins/table/utils/dom.js +5 -1
- package/dist/es2019/plugins/table/utils/index.js +1 -1
- package/dist/esm/plugins/table/event-handlers.js +7 -4
- package/dist/esm/plugins/table/index.js +4 -3
- package/dist/esm/plugins/table/pm-plugins/decorations/plugin.js +3 -7
- package/dist/esm/plugins/table/pm-plugins/decorations/utils/column-controls.js +1 -3
- package/dist/esm/plugins/table/pm-plugins/drag-and-drop/plugin.js +11 -0
- package/dist/esm/plugins/table/types.js +9 -2
- package/dist/esm/plugins/table/ui/FloatingDragMenu/index.js +5 -3
- package/dist/esm/plugins/table/ui/FloatingInsertButton/InsertButton.js +56 -8
- package/dist/esm/plugins/table/ui/FloatingInsertButton/getPopupOptions.js +9 -7
- package/dist/esm/plugins/table/ui/FloatingInsertButton/index.js +10 -4
- package/dist/esm/plugins/table/ui/TableFloatingColumnControls/ColumnControls/index.js +45 -6
- package/dist/esm/plugins/table/ui/TableFloatingColumnControls/index.js +7 -5
- package/dist/esm/plugins/table/ui/TableFloatingControls/RowControls/DragControls.js +36 -14
- package/dist/esm/plugins/table/ui/TableFloatingControls/index.js +2 -0
- package/dist/esm/plugins/table/ui/common-styles.js +2 -2
- package/dist/esm/plugins/table/ui/ui-styles.js +26 -23
- package/dist/esm/plugins/table/utils/dom.js +11 -3
- package/dist/esm/plugins/table/utils/index.js +1 -1
- package/dist/types/plugins/table/types.d.ts +9 -2
- package/dist/types/plugins/table/ui/FloatingInsertButton/InsertButton.d.ts +5 -1
- package/dist/types/plugins/table/ui/FloatingInsertButton/getPopupOptions.d.ts +1 -1
- package/dist/types/plugins/table/ui/FloatingInsertButton/index.d.ts +1 -0
- package/dist/types/plugins/table/ui/TableFloatingColumnControls/ColumnControls/index.d.ts +2 -1
- package/dist/types/plugins/table/ui/TableFloatingControls/RowControls/DragControls.d.ts +2 -0
- package/dist/types/plugins/table/ui/ui-styles.d.ts +1 -0
- package/dist/types/plugins/table/utils/dom.d.ts +4 -1
- package/dist/types/plugins/table/utils/index.d.ts +1 -1
- package/dist/types-ts4.5/plugins/table/types.d.ts +9 -2
- package/dist/types-ts4.5/plugins/table/ui/FloatingInsertButton/InsertButton.d.ts +5 -1
- package/dist/types-ts4.5/plugins/table/ui/FloatingInsertButton/getPopupOptions.d.ts +1 -1
- package/dist/types-ts4.5/plugins/table/ui/FloatingInsertButton/index.d.ts +1 -0
- package/dist/types-ts4.5/plugins/table/ui/TableFloatingColumnControls/ColumnControls/index.d.ts +2 -1
- package/dist/types-ts4.5/plugins/table/ui/TableFloatingControls/RowControls/DragControls.d.ts +2 -0
- package/dist/types-ts4.5/plugins/table/ui/ui-styles.d.ts +1 -0
- package/dist/types-ts4.5/plugins/table/utils/dom.d.ts +4 -1
- package/dist/types-ts4.5/plugins/table/utils/index.d.ts +1 -1
- package/package.json +2 -1
- package/src/__tests__/unit/pm-plugins/decorations/plugin.ts +40 -194
- package/src/__tests__/unit/ui/RowDragControls.tsx +9 -11
- package/src/plugins/table/event-handlers.ts +15 -3
- package/src/plugins/table/index.tsx +3 -2
- package/src/plugins/table/pm-plugins/decorations/plugin.ts +2 -9
- package/src/plugins/table/pm-plugins/decorations/utils/column-controls.ts +1 -3
- package/src/plugins/table/pm-plugins/drag-and-drop/plugin.ts +9 -0
- package/src/plugins/table/types.ts +12 -2
- package/src/plugins/table/ui/FloatingDragMenu/index.tsx +10 -3
- package/src/plugins/table/ui/FloatingInsertButton/InsertButton.tsx +82 -8
- package/src/plugins/table/ui/FloatingInsertButton/getPopupOptions.ts +28 -5
- package/src/plugins/table/ui/FloatingInsertButton/index.tsx +19 -7
- package/src/plugins/table/ui/TableFloatingColumnControls/ColumnControls/index.tsx +47 -3
- package/src/plugins/table/ui/TableFloatingColumnControls/index.tsx +11 -4
- package/src/plugins/table/ui/TableFloatingControls/RowControls/DragControls.tsx +49 -18
- package/src/plugins/table/ui/TableFloatingControls/index.tsx +2 -0
- package/src/plugins/table/ui/common-styles.ts +57 -2
- package/src/plugins/table/ui/ui-styles.ts +27 -1
- package/src/plugins/table/utils/dom.ts +11 -4
- package/src/plugins/table/utils/index.ts +2 -0
- package/tsconfig.app.json +3 -0
|
@@ -20,9 +20,6 @@ export var isColumnControlsDecorations = function isColumnControlsDecorations(no
|
|
|
20
20
|
export var isRowControlsButton = function isRowControlsButton(node) {
|
|
21
21
|
return containsClassName(node, ClassName.ROW_CONTROLS_BUTTON) || containsClassName(node, ClassName.NUMBERED_COLUMN_BUTTON);
|
|
22
22
|
};
|
|
23
|
-
export var isRowDragControlsButton = function isRowDragControlsButton(node) {
|
|
24
|
-
return containsClassName(node, ClassName.ROW_CONTROLS_WITH_DRAG) || closestElement(node, ".".concat(ClassName.ROW_CONTROLS_WITH_DRAG));
|
|
25
|
-
};
|
|
26
23
|
export var isResizeHandleDecoration = function isResizeHandleDecoration(node) {
|
|
27
24
|
return containsClassName(node, ClassName.RESIZE_HANDLE_DECORATION);
|
|
28
25
|
};
|
|
@@ -33,6 +30,17 @@ export var isTableContainerOrWrapper = function isTableContainerOrWrapper(node)
|
|
|
33
30
|
return containsClassName(node, ClassName.TABLE_CONTAINER) || containsClassName(node, ClassName.TABLE_NODE_WRAPPER);
|
|
34
31
|
};
|
|
35
32
|
|
|
33
|
+
/** drag-and-drop classes */
|
|
34
|
+
export var isRowDragControlsButton = function isRowDragControlsButton(node) {
|
|
35
|
+
return containsClassName(node, ClassName.DRAG_ROW_CONTROLS) || closestElement(node, ".".concat(ClassName.DRAG_ROW_CONTROLS));
|
|
36
|
+
};
|
|
37
|
+
export var isDragRowFloatingInsertDot = function isDragRowFloatingInsertDot(node) {
|
|
38
|
+
return containsClassName(node, ClassName.DRAG_ROW_FLOATING_INSERT_DOT_WRAPPER);
|
|
39
|
+
};
|
|
40
|
+
export var isDragColumnFloatingInsertDot = function isDragColumnFloatingInsertDot(node) {
|
|
41
|
+
return containsClassName(node, ClassName.DRAG_COLUMN_FLOATING_INSERT_DOT_WRAPPER);
|
|
42
|
+
};
|
|
43
|
+
|
|
36
44
|
/*
|
|
37
45
|
* This function returns which side of a given element the mouse cursor is,
|
|
38
46
|
* using as a base the half of the width by default, for example:
|
|
@@ -2,7 +2,7 @@ export { getSelectedColumnIndexes, getSelectedRowIndexes, normalizeSelection, is
|
|
|
2
2
|
export { findControlsHoverDecoration, createControlsHoverDecoration, createColumnControlsDecoration, createColumnSelectedDecoration, createCellHoverDecoration, updateDecorations, createResizeHandleDecoration, createColumnInsertLine, createColumnLineResize, createRowInsertLine } from './decoration';
|
|
3
3
|
export { isIsolating, containsHeaderColumn, containsHeaderRow, checkIfHeaderColumnEnabled, checkIfHeaderRowEnabled, checkIfNumberColumnEnabled, isLayoutSupported, getTableWidth, tablesHaveDifferentColumnWidths, tablesHaveDifferentNoOfColumns, isTableNested, anyChildCellMergedAcrossRow, supportedHeaderRow } from './nodes';
|
|
4
4
|
export { unwrapContentFromTable, removeTableFromFirstChild, removeTableFromLastChild, transformSliceToRemoveOpenTable, transformSliceToCorrectEmptyTableCells, transformSliceToFixHardBreakProblemOnCopyFromCell } from './paste';
|
|
5
|
-
export { isCell, isCornerButton, isInsertRowButton, isColumnControlsDecorations, isTableControlsButton, isTableContainerOrWrapper, isRowDragControlsButton, isRowControlsButton, getColumnOrRowIndex, getMousePositionHorizontalRelativeByElement, getMousePositionVerticalRelativeByElement, updateResizeHandles, isResizeHandleDecoration, hasResizeHandler } from './dom';
|
|
5
|
+
export { isCell, isCornerButton, isInsertRowButton, isColumnControlsDecorations, isTableControlsButton, isTableContainerOrWrapper, isRowDragControlsButton, isRowControlsButton, isDragColumnFloatingInsertDot, isDragRowFloatingInsertDot, getColumnOrRowIndex, getMousePositionHorizontalRelativeByElement, getMousePositionVerticalRelativeByElement, updateResizeHandles, isResizeHandleDecoration, hasResizeHandler } from './dom';
|
|
6
6
|
export { getColumnsWidths, isColumnDeleteButtonVisible, getColumnDeleteButtonParams, getColumnClassNames } from './column-controls';
|
|
7
7
|
export { getRowHeights, isRowDeleteButtonVisible, getRowDeleteButtonParams, getRowsParams, getRowClassNames, copyPreviousRow } from './row-controls';
|
|
8
8
|
export { getSelectedTableInfo, getSelectedCellInfo } from './analytics';
|
|
@@ -269,6 +269,9 @@ export declare const TableCssClassName: {
|
|
|
269
269
|
CONTROLS_INSERT_LINE: string;
|
|
270
270
|
CONTROLS_BUTTON_OVERLAY: string;
|
|
271
271
|
LAYOUT_BUTTON: string;
|
|
272
|
+
DRAG_CONTROLS_INSERT_BUTTON: string;
|
|
273
|
+
DRAG_CONTROLS_INSERT_BUTTON_INNER: string;
|
|
274
|
+
DRAG_CONTROLS_INSERT_BUTTON_WRAP: string;
|
|
272
275
|
CONTROLS_INSERT_MARKER: string;
|
|
273
276
|
CONTROLS_INSERT_COLUMN: string;
|
|
274
277
|
CONTROLS_INSERT_ROW: string;
|
|
@@ -281,8 +284,12 @@ export declare const TableCssClassName: {
|
|
|
281
284
|
CORNER_CONTROLS_INSERT_COLUMN_MARKER: string;
|
|
282
285
|
CONTROLS_CORNER_BUTTON: string;
|
|
283
286
|
/** Controls with drag handle */
|
|
284
|
-
|
|
285
|
-
|
|
287
|
+
DRAG_ROW_CONTROLS: string;
|
|
288
|
+
DRAG_ROW_FLOATING_INSERT_DOT_WRAPPER: string;
|
|
289
|
+
DRAG_ROW_FLOATING_INSERT_DOT: string;
|
|
290
|
+
DRAG_COLUMN_CONTROLS: string;
|
|
291
|
+
DRAG_COLUMN_FLOATING_INSERT_DOT_WRAPPER: string;
|
|
292
|
+
DRAG_COLUMN_FLOATING_INSERT_DOT: string;
|
|
286
293
|
DRAG_HANDLE_BUTTON_CONTAINER: string;
|
|
287
294
|
/** Other classes */
|
|
288
295
|
NUMBERED_COLUMN: string;
|
|
@@ -3,11 +3,15 @@ import React from 'react';
|
|
|
3
3
|
import type { WrappedComponentProps } from 'react-intl-next';
|
|
4
4
|
import type { TableDirection } from '../../types';
|
|
5
5
|
export interface ButtonProps {
|
|
6
|
-
|
|
6
|
+
type: TableDirection;
|
|
7
7
|
tableRef: HTMLElement;
|
|
8
8
|
onMouseDown: (event: SyntheticEvent<HTMLButtonElement>) => void;
|
|
9
9
|
hasStickyHeaders: boolean;
|
|
10
10
|
}
|
|
11
|
+
export declare const InsertButtonForDragAndDrop: ({ onMouseDown, tableRef, type, intl: { formatMessage }, hasStickyHeaders, }: ButtonProps & WrappedComponentProps) => JSX.Element;
|
|
12
|
+
export declare const DragAndDropInsertButton: React.FC<import("react-intl-next").WithIntlProps<ButtonProps & WrappedComponentProps<"intl">>> & {
|
|
13
|
+
WrappedComponent: React.ComponentType<ButtonProps & WrappedComponentProps<"intl">>;
|
|
14
|
+
};
|
|
11
15
|
declare const _default: React.FC<import("react-intl-next").WithIntlProps<ButtonProps & WrappedComponentProps<"intl">>> & {
|
|
12
16
|
WrappedComponent: React.ComponentType<ButtonProps & WrappedComponentProps<"intl">>;
|
|
13
17
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { PopupProps } from '@atlaskit/editor-common/ui';
|
|
2
2
|
import type { TableDirection } from '../../types';
|
|
3
|
-
declare function getPopupOptions(direction: TableDirection, index: number, hasNumberedColumns: boolean, tableContainer: HTMLElement | null): Partial<PopupProps>;
|
|
3
|
+
declare function getPopupOptions(direction: TableDirection, index: number, hasNumberedColumns: boolean, isDragAndDropEnabled: boolean, tableContainer: HTMLElement | null): Partial<PopupProps>;
|
|
4
4
|
export default getPopupOptions;
|
|
@@ -13,6 +13,7 @@ export interface Props {
|
|
|
13
13
|
insertRowButtonIndex?: number;
|
|
14
14
|
isHeaderColumnEnabled?: boolean;
|
|
15
15
|
isHeaderRowEnabled?: boolean;
|
|
16
|
+
isDragAndDropEnabled?: boolean;
|
|
16
17
|
mountPoint?: HTMLElement;
|
|
17
18
|
boundariesElement?: HTMLElement;
|
|
18
19
|
scrollableElement?: HTMLElement;
|
|
@@ -12,6 +12,7 @@ export interface ColumnControlsProps {
|
|
|
12
12
|
localId?: string;
|
|
13
13
|
rowHeights?: number[];
|
|
14
14
|
colWidths?: (number | undefined)[];
|
|
15
|
+
hasHeaderColumn?: boolean;
|
|
15
16
|
}
|
|
16
|
-
export declare const ColumnControls: ({ editorView, tableActive, tableRef, hoveredCell, isResizing, stickyTop, localId, isInDanger, rowHeights, colWidths, }: ColumnControlsProps) => JSX.Element;
|
|
17
|
+
export declare const ColumnControls: ({ editorView, tableActive, tableRef, hoveredCell, isResizing, stickyTop, localId, isInDanger, rowHeights, colWidths, hasHeaderColumn, }: ColumnControlsProps) => JSX.Element;
|
|
17
18
|
export default ColumnControls;
|
|
@@ -10,6 +10,8 @@ type DragControlsProps = {
|
|
|
10
10
|
tableActive?: boolean;
|
|
11
11
|
hoveredCell?: CellHoverMeta;
|
|
12
12
|
isInDanger?: boolean;
|
|
13
|
+
isResizing?: boolean;
|
|
14
|
+
hasHeaderRow?: boolean;
|
|
13
15
|
hoverRows: (rows: number[], danger?: boolean) => void;
|
|
14
16
|
selectRow: (row: number, expand: boolean) => void;
|
|
15
17
|
updateCellHoverLocation: (rowIndex: number) => void;
|
|
@@ -3,6 +3,7 @@ export declare const InsertMarker: (props: ThemeProps, cssString?: string) => im
|
|
|
3
3
|
export declare const HeaderButton: (props: ThemeProps, cssString?: string) => import("@emotion/react").SerializedStyles;
|
|
4
4
|
export declare const HeaderButtonHover: (props: ThemeProps) => import("@emotion/react").SerializedStyles;
|
|
5
5
|
export declare const HeaderButtonDanger: (props: ThemeProps) => import("@emotion/react").SerializedStyles;
|
|
6
|
+
export declare const dragInsertButtonWrapper: (props: ThemeProps) => import("@emotion/react").SerializedStyles;
|
|
6
7
|
export declare const insertColumnButtonWrapper: (props: ThemeProps) => import("@emotion/react").SerializedStyles;
|
|
7
8
|
export declare const insertRowButtonWrapper: (props: ThemeProps) => import("@emotion/react").SerializedStyles;
|
|
8
9
|
export declare const columnControlsLineMarker: () => import("@emotion/react").SerializedStyles;
|
|
@@ -5,10 +5,13 @@ export declare const isInsertRowButton: (node: HTMLElement | null) => boolean |
|
|
|
5
5
|
export declare const getColumnOrRowIndex: (target: HTMLElement) => [number, number];
|
|
6
6
|
export declare const isColumnControlsDecorations: (node: HTMLElement | null) => boolean;
|
|
7
7
|
export declare const isRowControlsButton: (node: HTMLElement | null) => boolean;
|
|
8
|
-
export declare const isRowDragControlsButton: (node: HTMLElement | null) => true | HTMLElement | null;
|
|
9
8
|
export declare const isResizeHandleDecoration: (node: HTMLElement | null) => boolean;
|
|
10
9
|
export declare const isTableControlsButton: (node: HTMLElement | null) => boolean;
|
|
11
10
|
export declare const isTableContainerOrWrapper: (node: HTMLElement | null) => boolean;
|
|
11
|
+
/** drag-and-drop classes */
|
|
12
|
+
export declare const isRowDragControlsButton: (node: HTMLElement | null) => true | HTMLElement | null;
|
|
13
|
+
export declare const isDragRowFloatingInsertDot: (node: HTMLElement | null) => boolean;
|
|
14
|
+
export declare const isDragColumnFloatingInsertDot: (node: HTMLElement | null) => boolean;
|
|
12
15
|
export declare const getMousePositionHorizontalRelativeByElement: (mouseEvent: MouseEvent, elementContentRects?: ElementContentRects, gapInPixels?: number) => 'left' | 'right' | null;
|
|
13
16
|
export declare const getMousePositionVerticalRelativeByElement: (mouseEvent: MouseEvent) => 'top' | 'bottom' | null;
|
|
14
17
|
export declare const updateResizeHandles: (tableRef?: HTMLElement) => void;
|
|
@@ -2,7 +2,7 @@ export { getSelectedColumnIndexes, getSelectedRowIndexes, normalizeSelection, is
|
|
|
2
2
|
export { findControlsHoverDecoration, createControlsHoverDecoration, createColumnControlsDecoration, createColumnSelectedDecoration, createCellHoverDecoration, updateDecorations, createResizeHandleDecoration, createColumnInsertLine, createColumnLineResize, createRowInsertLine, } from './decoration';
|
|
3
3
|
export { isIsolating, containsHeaderColumn, containsHeaderRow, checkIfHeaderColumnEnabled, checkIfHeaderRowEnabled, checkIfNumberColumnEnabled, isLayoutSupported, getTableWidth, tablesHaveDifferentColumnWidths, tablesHaveDifferentNoOfColumns, isTableNested, anyChildCellMergedAcrossRow, supportedHeaderRow, } from './nodes';
|
|
4
4
|
export { unwrapContentFromTable, removeTableFromFirstChild, removeTableFromLastChild, transformSliceToRemoveOpenTable, transformSliceToCorrectEmptyTableCells, transformSliceToFixHardBreakProblemOnCopyFromCell, } from './paste';
|
|
5
|
-
export { isCell, isCornerButton, isInsertRowButton, isColumnControlsDecorations, isTableControlsButton, isTableContainerOrWrapper, isRowDragControlsButton, isRowControlsButton, getColumnOrRowIndex, getMousePositionHorizontalRelativeByElement, getMousePositionVerticalRelativeByElement, updateResizeHandles, isResizeHandleDecoration, hasResizeHandler, } from './dom';
|
|
5
|
+
export { isCell, isCornerButton, isInsertRowButton, isColumnControlsDecorations, isTableControlsButton, isTableContainerOrWrapper, isRowDragControlsButton, isRowControlsButton, isDragColumnFloatingInsertDot, isDragRowFloatingInsertDot, getColumnOrRowIndex, getMousePositionHorizontalRelativeByElement, getMousePositionVerticalRelativeByElement, updateResizeHandles, isResizeHandleDecoration, hasResizeHandler, } from './dom';
|
|
6
6
|
export { getColumnsWidths, isColumnDeleteButtonVisible, getColumnDeleteButtonParams, getColumnClassNames, } from './column-controls';
|
|
7
7
|
export { getRowHeights, isRowDeleteButtonVisible, getRowDeleteButtonParams, getRowsParams, getRowClassNames, copyPreviousRow, } from './row-controls';
|
|
8
8
|
export type { RowParams } from './row-controls';
|
|
@@ -269,6 +269,9 @@ export declare const TableCssClassName: {
|
|
|
269
269
|
CONTROLS_INSERT_LINE: string;
|
|
270
270
|
CONTROLS_BUTTON_OVERLAY: string;
|
|
271
271
|
LAYOUT_BUTTON: string;
|
|
272
|
+
DRAG_CONTROLS_INSERT_BUTTON: string;
|
|
273
|
+
DRAG_CONTROLS_INSERT_BUTTON_INNER: string;
|
|
274
|
+
DRAG_CONTROLS_INSERT_BUTTON_WRAP: string;
|
|
272
275
|
CONTROLS_INSERT_MARKER: string;
|
|
273
276
|
CONTROLS_INSERT_COLUMN: string;
|
|
274
277
|
CONTROLS_INSERT_ROW: string;
|
|
@@ -281,8 +284,12 @@ export declare const TableCssClassName: {
|
|
|
281
284
|
CORNER_CONTROLS_INSERT_COLUMN_MARKER: string;
|
|
282
285
|
CONTROLS_CORNER_BUTTON: string;
|
|
283
286
|
/** Controls with drag handle */
|
|
284
|
-
|
|
285
|
-
|
|
287
|
+
DRAG_ROW_CONTROLS: string;
|
|
288
|
+
DRAG_ROW_FLOATING_INSERT_DOT_WRAPPER: string;
|
|
289
|
+
DRAG_ROW_FLOATING_INSERT_DOT: string;
|
|
290
|
+
DRAG_COLUMN_CONTROLS: string;
|
|
291
|
+
DRAG_COLUMN_FLOATING_INSERT_DOT_WRAPPER: string;
|
|
292
|
+
DRAG_COLUMN_FLOATING_INSERT_DOT: string;
|
|
286
293
|
DRAG_HANDLE_BUTTON_CONTAINER: string;
|
|
287
294
|
/** Other classes */
|
|
288
295
|
NUMBERED_COLUMN: string;
|
|
@@ -3,11 +3,15 @@ import React from 'react';
|
|
|
3
3
|
import type { WrappedComponentProps } from 'react-intl-next';
|
|
4
4
|
import type { TableDirection } from '../../types';
|
|
5
5
|
export interface ButtonProps {
|
|
6
|
-
|
|
6
|
+
type: TableDirection;
|
|
7
7
|
tableRef: HTMLElement;
|
|
8
8
|
onMouseDown: (event: SyntheticEvent<HTMLButtonElement>) => void;
|
|
9
9
|
hasStickyHeaders: boolean;
|
|
10
10
|
}
|
|
11
|
+
export declare const InsertButtonForDragAndDrop: ({ onMouseDown, tableRef, type, intl: { formatMessage }, hasStickyHeaders, }: ButtonProps & WrappedComponentProps) => JSX.Element;
|
|
12
|
+
export declare const DragAndDropInsertButton: React.FC<import("react-intl-next").WithIntlProps<ButtonProps & WrappedComponentProps<"intl">>> & {
|
|
13
|
+
WrappedComponent: React.ComponentType<ButtonProps & WrappedComponentProps<"intl">>;
|
|
14
|
+
};
|
|
11
15
|
declare const _default: React.FC<import("react-intl-next").WithIntlProps<ButtonProps & WrappedComponentProps<"intl">>> & {
|
|
12
16
|
WrappedComponent: React.ComponentType<ButtonProps & WrappedComponentProps<"intl">>;
|
|
13
17
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { PopupProps } from '@atlaskit/editor-common/ui';
|
|
2
2
|
import type { TableDirection } from '../../types';
|
|
3
|
-
declare function getPopupOptions(direction: TableDirection, index: number, hasNumberedColumns: boolean, tableContainer: HTMLElement | null): Partial<PopupProps>;
|
|
3
|
+
declare function getPopupOptions(direction: TableDirection, index: number, hasNumberedColumns: boolean, isDragAndDropEnabled: boolean, tableContainer: HTMLElement | null): Partial<PopupProps>;
|
|
4
4
|
export default getPopupOptions;
|
|
@@ -13,6 +13,7 @@ export interface Props {
|
|
|
13
13
|
insertRowButtonIndex?: number;
|
|
14
14
|
isHeaderColumnEnabled?: boolean;
|
|
15
15
|
isHeaderRowEnabled?: boolean;
|
|
16
|
+
isDragAndDropEnabled?: boolean;
|
|
16
17
|
mountPoint?: HTMLElement;
|
|
17
18
|
boundariesElement?: HTMLElement;
|
|
18
19
|
scrollableElement?: HTMLElement;
|
package/dist/types-ts4.5/plugins/table/ui/TableFloatingColumnControls/ColumnControls/index.d.ts
CHANGED
|
@@ -12,6 +12,7 @@ export interface ColumnControlsProps {
|
|
|
12
12
|
localId?: string;
|
|
13
13
|
rowHeights?: number[];
|
|
14
14
|
colWidths?: (number | undefined)[];
|
|
15
|
+
hasHeaderColumn?: boolean;
|
|
15
16
|
}
|
|
16
|
-
export declare const ColumnControls: ({ editorView, tableActive, tableRef, hoveredCell, isResizing, stickyTop, localId, isInDanger, rowHeights, colWidths, }: ColumnControlsProps) => JSX.Element;
|
|
17
|
+
export declare const ColumnControls: ({ editorView, tableActive, tableRef, hoveredCell, isResizing, stickyTop, localId, isInDanger, rowHeights, colWidths, hasHeaderColumn, }: ColumnControlsProps) => JSX.Element;
|
|
17
18
|
export default ColumnControls;
|
package/dist/types-ts4.5/plugins/table/ui/TableFloatingControls/RowControls/DragControls.d.ts
CHANGED
|
@@ -10,6 +10,8 @@ type DragControlsProps = {
|
|
|
10
10
|
tableActive?: boolean;
|
|
11
11
|
hoveredCell?: CellHoverMeta;
|
|
12
12
|
isInDanger?: boolean;
|
|
13
|
+
isResizing?: boolean;
|
|
14
|
+
hasHeaderRow?: boolean;
|
|
13
15
|
hoverRows: (rows: number[], danger?: boolean) => void;
|
|
14
16
|
selectRow: (row: number, expand: boolean) => void;
|
|
15
17
|
updateCellHoverLocation: (rowIndex: number) => void;
|
|
@@ -3,6 +3,7 @@ export declare const InsertMarker: (props: ThemeProps, cssString?: string) => im
|
|
|
3
3
|
export declare const HeaderButton: (props: ThemeProps, cssString?: string) => import("@emotion/react").SerializedStyles;
|
|
4
4
|
export declare const HeaderButtonHover: (props: ThemeProps) => import("@emotion/react").SerializedStyles;
|
|
5
5
|
export declare const HeaderButtonDanger: (props: ThemeProps) => import("@emotion/react").SerializedStyles;
|
|
6
|
+
export declare const dragInsertButtonWrapper: (props: ThemeProps) => import("@emotion/react").SerializedStyles;
|
|
6
7
|
export declare const insertColumnButtonWrapper: (props: ThemeProps) => import("@emotion/react").SerializedStyles;
|
|
7
8
|
export declare const insertRowButtonWrapper: (props: ThemeProps) => import("@emotion/react").SerializedStyles;
|
|
8
9
|
export declare const columnControlsLineMarker: () => import("@emotion/react").SerializedStyles;
|
|
@@ -8,10 +8,13 @@ export declare const getColumnOrRowIndex: (target: HTMLElement) => [
|
|
|
8
8
|
];
|
|
9
9
|
export declare const isColumnControlsDecorations: (node: HTMLElement | null) => boolean;
|
|
10
10
|
export declare const isRowControlsButton: (node: HTMLElement | null) => boolean;
|
|
11
|
-
export declare const isRowDragControlsButton: (node: HTMLElement | null) => true | HTMLElement | null;
|
|
12
11
|
export declare const isResizeHandleDecoration: (node: HTMLElement | null) => boolean;
|
|
13
12
|
export declare const isTableControlsButton: (node: HTMLElement | null) => boolean;
|
|
14
13
|
export declare const isTableContainerOrWrapper: (node: HTMLElement | null) => boolean;
|
|
14
|
+
/** drag-and-drop classes */
|
|
15
|
+
export declare const isRowDragControlsButton: (node: HTMLElement | null) => true | HTMLElement | null;
|
|
16
|
+
export declare const isDragRowFloatingInsertDot: (node: HTMLElement | null) => boolean;
|
|
17
|
+
export declare const isDragColumnFloatingInsertDot: (node: HTMLElement | null) => boolean;
|
|
15
18
|
export declare const getMousePositionHorizontalRelativeByElement: (mouseEvent: MouseEvent, elementContentRects?: ElementContentRects, gapInPixels?: number) => 'left' | 'right' | null;
|
|
16
19
|
export declare const getMousePositionVerticalRelativeByElement: (mouseEvent: MouseEvent) => 'top' | 'bottom' | null;
|
|
17
20
|
export declare const updateResizeHandles: (tableRef?: HTMLElement) => void;
|
|
@@ -2,7 +2,7 @@ export { getSelectedColumnIndexes, getSelectedRowIndexes, normalizeSelection, is
|
|
|
2
2
|
export { findControlsHoverDecoration, createControlsHoverDecoration, createColumnControlsDecoration, createColumnSelectedDecoration, createCellHoverDecoration, updateDecorations, createResizeHandleDecoration, createColumnInsertLine, createColumnLineResize, createRowInsertLine, } from './decoration';
|
|
3
3
|
export { isIsolating, containsHeaderColumn, containsHeaderRow, checkIfHeaderColumnEnabled, checkIfHeaderRowEnabled, checkIfNumberColumnEnabled, isLayoutSupported, getTableWidth, tablesHaveDifferentColumnWidths, tablesHaveDifferentNoOfColumns, isTableNested, anyChildCellMergedAcrossRow, supportedHeaderRow, } from './nodes';
|
|
4
4
|
export { unwrapContentFromTable, removeTableFromFirstChild, removeTableFromLastChild, transformSliceToRemoveOpenTable, transformSliceToCorrectEmptyTableCells, transformSliceToFixHardBreakProblemOnCopyFromCell, } from './paste';
|
|
5
|
-
export { isCell, isCornerButton, isInsertRowButton, isColumnControlsDecorations, isTableControlsButton, isTableContainerOrWrapper, isRowDragControlsButton, isRowControlsButton, getColumnOrRowIndex, getMousePositionHorizontalRelativeByElement, getMousePositionVerticalRelativeByElement, updateResizeHandles, isResizeHandleDecoration, hasResizeHandler, } from './dom';
|
|
5
|
+
export { isCell, isCornerButton, isInsertRowButton, isColumnControlsDecorations, isTableControlsButton, isTableContainerOrWrapper, isRowDragControlsButton, isRowControlsButton, isDragColumnFloatingInsertDot, isDragRowFloatingInsertDot, getColumnOrRowIndex, getMousePositionHorizontalRelativeByElement, getMousePositionVerticalRelativeByElement, updateResizeHandles, isResizeHandleDecoration, hasResizeHandler, } from './dom';
|
|
6
6
|
export { getColumnsWidths, isColumnDeleteButtonVisible, getColumnDeleteButtonParams, getColumnClassNames, } from './column-controls';
|
|
7
7
|
export { getRowHeights, isRowDeleteButtonVisible, getRowDeleteButtonParams, getRowsParams, getRowClassNames, copyPreviousRow, } from './row-controls';
|
|
8
8
|
export type { RowParams } from './row-controls';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-table",
|
|
3
|
-
"version": "5.3.
|
|
3
|
+
"version": "5.3.14",
|
|
4
4
|
"description": "Table plugin for the @atlaskit/editor",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -40,6 +40,7 @@
|
|
|
40
40
|
"@atlaskit/platform-feature-flags": "^0.2.1",
|
|
41
41
|
"@atlaskit/pragmatic-drag-and-drop": "^0.23.0",
|
|
42
42
|
"@atlaskit/pragmatic-drag-and-drop-hitbox": "^0.11.8",
|
|
43
|
+
"@atlaskit/pragmatic-drag-and-drop-react-beautiful-dnd-autoscroll": "^0.6.4",
|
|
43
44
|
"@atlaskit/primitives": "^1.7.0",
|
|
44
45
|
"@atlaskit/theme": "^12.6.0",
|
|
45
46
|
"@atlaskit/tokens": "^1.28.0",
|
|
@@ -23,7 +23,6 @@ import {
|
|
|
23
23
|
tdEmpty,
|
|
24
24
|
tr,
|
|
25
25
|
} from '@atlaskit/editor-test-helpers/doc-builder';
|
|
26
|
-
import { ffTest } from '@atlassian/feature-flags-test-utils';
|
|
27
26
|
|
|
28
27
|
import tablePlugin from '../../../../plugins/table';
|
|
29
28
|
import { selectColumn } from '../../../../plugins/table/commands';
|
|
@@ -55,141 +54,27 @@ describe('decorations plugin', () => {
|
|
|
55
54
|
// ED-8457
|
|
56
55
|
describe('when there is a selection pointer set', () => {
|
|
57
56
|
describe('should remove the column selected decorations', () => {
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
() => {
|
|
61
|
-
const { editorView } = editor(
|
|
62
|
-
doc(table()(tr(tdCursor, tdEmpty), tr(tdEmpty, tdEmpty))),
|
|
63
|
-
);
|
|
64
|
-
|
|
65
|
-
selectColumn(1)(editorView.state, editorView.dispatch);
|
|
66
|
-
|
|
67
|
-
const { tr: transaction } = editorView.state;
|
|
68
|
-
|
|
69
|
-
transaction.setMeta('pointer', true);
|
|
70
|
-
transaction.setSelection(Selection.atStart(transaction.doc));
|
|
71
|
-
editorView.dispatch(transaction);
|
|
72
|
-
|
|
73
|
-
const decorationSet = getDecorations(editorView.state);
|
|
74
|
-
|
|
75
|
-
const columnSelectedDecorations = decorationSet.find(
|
|
76
|
-
undefined,
|
|
77
|
-
undefined,
|
|
78
|
-
(spec) => spec.key.indexOf(TableDecorations.COLUMN_SELECTED) > -1,
|
|
79
|
-
);
|
|
80
|
-
|
|
81
|
-
expect(columnSelectedDecorations).toHaveLength(0);
|
|
82
|
-
},
|
|
83
|
-
() => {
|
|
84
|
-
const { editorView } = editor(
|
|
85
|
-
doc(table()(tr(tdCursor, tdEmpty), tr(tdEmpty, tdEmpty))),
|
|
86
|
-
);
|
|
87
|
-
|
|
88
|
-
selectColumn(1)(editorView.state, editorView.dispatch);
|
|
89
|
-
|
|
90
|
-
const { tr: transaction } = editorView.state;
|
|
91
|
-
|
|
92
|
-
transaction.setMeta('pointer', true);
|
|
93
|
-
transaction.setSelection(Selection.atStart(transaction.doc));
|
|
94
|
-
editorView.dispatch(transaction);
|
|
95
|
-
|
|
96
|
-
const decorationSet = getDecorations(editorView.state);
|
|
97
|
-
|
|
98
|
-
const columnSelectedDecorations = decorationSet.find(
|
|
99
|
-
undefined,
|
|
100
|
-
undefined,
|
|
101
|
-
(spec) => spec.key.indexOf(TableDecorations.COLUMN_SELECTED) > -1,
|
|
102
|
-
);
|
|
103
|
-
|
|
104
|
-
expect(columnSelectedDecorations).toHaveLength(0);
|
|
105
|
-
},
|
|
57
|
+
const { editorView } = editor(
|
|
58
|
+
doc(table()(tr(tdCursor, tdEmpty), tr(tdEmpty, tdEmpty))),
|
|
106
59
|
);
|
|
107
|
-
});
|
|
108
|
-
});
|
|
109
60
|
|
|
110
|
-
|
|
111
|
-
describe('should not add column control decorations', () => {
|
|
112
|
-
ffTest(
|
|
113
|
-
'platform.editor.table.drag-and-drop',
|
|
114
|
-
() => {
|
|
115
|
-
const pluginState = DecorationSet.empty;
|
|
116
|
-
const { editorView } = editor(
|
|
117
|
-
doc(table()(tr(tdCursor, tdEmpty), tr(tdEmpty, tdEmpty))),
|
|
118
|
-
);
|
|
61
|
+
selectColumn(1)(editorView.state, editorView.dispatch);
|
|
119
62
|
|
|
120
|
-
|
|
121
|
-
type: 'HOVER_CELL',
|
|
122
|
-
data: {
|
|
123
|
-
colIndex: 0,
|
|
124
|
-
rowIndex: 0,
|
|
125
|
-
},
|
|
126
|
-
});
|
|
127
|
-
|
|
128
|
-
const oldState = handleDocOrSelectionChanged(
|
|
129
|
-
transaction,
|
|
130
|
-
pluginState,
|
|
131
|
-
editorView.state,
|
|
132
|
-
editorView.state,
|
|
133
|
-
);
|
|
134
|
-
|
|
135
|
-
editorView.dispatch(transaction);
|
|
136
|
-
const newState = handleDocOrSelectionChanged(
|
|
137
|
-
transaction,
|
|
138
|
-
oldState,
|
|
139
|
-
editorView.state,
|
|
140
|
-
editorView.state,
|
|
141
|
-
);
|
|
63
|
+
const { tr: transaction } = editorView.state;
|
|
142
64
|
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
(spec) =>
|
|
147
|
-
spec.key.indexOf(TableDecorations.COLUMN_CONTROLS_DECORATIONS) >
|
|
148
|
-
-1,
|
|
149
|
-
);
|
|
65
|
+
transaction.setMeta('pointer', true);
|
|
66
|
+
transaction.setSelection(Selection.atStart(transaction.doc));
|
|
67
|
+
editorView.dispatch(transaction);
|
|
150
68
|
|
|
151
|
-
|
|
152
|
-
},
|
|
153
|
-
() => {
|
|
154
|
-
const pluginState = DecorationSet.empty;
|
|
155
|
-
const { editorView } = editor(
|
|
156
|
-
doc(table()(tr(tdCursor, tdEmpty), tr(tdEmpty, tdEmpty))),
|
|
157
|
-
);
|
|
158
|
-
|
|
159
|
-
const transaction = editorView.state.tr.setMeta(pluginKey, {
|
|
160
|
-
type: 'HOVER_CELL',
|
|
161
|
-
data: {
|
|
162
|
-
colIndex: 0,
|
|
163
|
-
rowIndex: 0,
|
|
164
|
-
},
|
|
165
|
-
});
|
|
69
|
+
const decorationSet = getDecorations(editorView.state);
|
|
166
70
|
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
editorView.state,
|
|
172
|
-
);
|
|
173
|
-
|
|
174
|
-
editorView.dispatch(transaction);
|
|
175
|
-
const newState = handleDocOrSelectionChanged(
|
|
176
|
-
transaction,
|
|
177
|
-
oldState,
|
|
178
|
-
editorView.state,
|
|
179
|
-
editorView.state,
|
|
180
|
-
);
|
|
181
|
-
|
|
182
|
-
const columnDecorations = newState.find(
|
|
183
|
-
undefined,
|
|
184
|
-
undefined,
|
|
185
|
-
(spec) =>
|
|
186
|
-
spec.key.indexOf(TableDecorations.COLUMN_CONTROLS_DECORATIONS) >
|
|
187
|
-
-1,
|
|
188
|
-
);
|
|
189
|
-
|
|
190
|
-
expect(columnDecorations).toHaveLength(2);
|
|
191
|
-
},
|
|
71
|
+
const columnSelectedDecorations = decorationSet.find(
|
|
72
|
+
undefined,
|
|
73
|
+
undefined,
|
|
74
|
+
(spec) => spec.key.indexOf(TableDecorations.COLUMN_SELECTED) > -1,
|
|
192
75
|
);
|
|
76
|
+
|
|
77
|
+
expect(columnSelectedDecorations).toHaveLength(0);
|
|
193
78
|
});
|
|
194
79
|
});
|
|
195
80
|
|
|
@@ -220,75 +105,36 @@ describe('decorations plugin', () => {
|
|
|
220
105
|
|
|
221
106
|
describe('when the table changed', () => {
|
|
222
107
|
describe('should not re-create the column controls decorations', () => {
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
doc(table()(tr(tdCursor, tdEmpty), tr(tdEmpty, tdEmpty))),
|
|
228
|
-
);
|
|
229
|
-
const { state } = editorView;
|
|
230
|
-
|
|
231
|
-
const nextPluginState = handleDocOrSelectionChanged(
|
|
232
|
-
editorView.state.tr,
|
|
233
|
-
DecorationSet.empty,
|
|
234
|
-
editorView.state,
|
|
235
|
-
state,
|
|
236
|
-
);
|
|
237
|
-
|
|
238
|
-
const { tr: transaction } = state;
|
|
239
|
-
editorView.dispatch(addColumnAt(2)(transaction));
|
|
240
|
-
|
|
241
|
-
const newState = handleDocOrSelectionChanged(
|
|
242
|
-
transaction,
|
|
243
|
-
nextPluginState,
|
|
244
|
-
editorView.state,
|
|
245
|
-
state,
|
|
246
|
-
);
|
|
247
|
-
const expectedDecorationSet = newState;
|
|
248
|
-
const decorations = expectedDecorationSet.find(
|
|
249
|
-
undefined,
|
|
250
|
-
undefined,
|
|
251
|
-
(spec) =>
|
|
252
|
-
spec.key.indexOf(TableDecorations.COLUMN_CONTROLS_DECORATIONS) >
|
|
253
|
-
-1,
|
|
254
|
-
);
|
|
255
|
-
|
|
256
|
-
expect(decorations).toHaveLength(0);
|
|
257
|
-
},
|
|
258
|
-
() => {
|
|
259
|
-
const { editorView } = editor(
|
|
260
|
-
doc(table()(tr(tdCursor, tdEmpty), tr(tdEmpty, tdEmpty))),
|
|
261
|
-
);
|
|
262
|
-
const { state } = editorView;
|
|
263
|
-
|
|
264
|
-
const nextPluginState = handleDocOrSelectionChanged(
|
|
265
|
-
editorView.state.tr,
|
|
266
|
-
DecorationSet.empty,
|
|
267
|
-
editorView.state,
|
|
268
|
-
state,
|
|
269
|
-
);
|
|
108
|
+
const { editorView } = editor(
|
|
109
|
+
doc(table()(tr(tdCursor, tdEmpty), tr(tdEmpty, tdEmpty))),
|
|
110
|
+
);
|
|
111
|
+
const { state } = editorView;
|
|
270
112
|
|
|
271
|
-
|
|
272
|
-
|
|
113
|
+
const nextPluginState = handleDocOrSelectionChanged(
|
|
114
|
+
editorView.state.tr,
|
|
115
|
+
DecorationSet.empty,
|
|
116
|
+
editorView.state,
|
|
117
|
+
state,
|
|
118
|
+
);
|
|
273
119
|
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
nextPluginState,
|
|
277
|
-
editorView.state,
|
|
278
|
-
state,
|
|
279
|
-
);
|
|
280
|
-
const expectedDecorationSet = newState;
|
|
281
|
-
const decorations = expectedDecorationSet.find(
|
|
282
|
-
undefined,
|
|
283
|
-
undefined,
|
|
284
|
-
(spec) =>
|
|
285
|
-
spec.key.indexOf(TableDecorations.COLUMN_CONTROLS_DECORATIONS) >
|
|
286
|
-
-1,
|
|
287
|
-
);
|
|
120
|
+
const { tr: transaction } = state;
|
|
121
|
+
editorView.dispatch(addColumnAt(2)(transaction));
|
|
288
122
|
|
|
289
|
-
|
|
290
|
-
|
|
123
|
+
const newState = handleDocOrSelectionChanged(
|
|
124
|
+
transaction,
|
|
125
|
+
nextPluginState,
|
|
126
|
+
editorView.state,
|
|
127
|
+
state,
|
|
291
128
|
);
|
|
129
|
+
const expectedDecorationSet = newState;
|
|
130
|
+
const decorations = expectedDecorationSet.find(
|
|
131
|
+
undefined,
|
|
132
|
+
undefined,
|
|
133
|
+
(spec) =>
|
|
134
|
+
spec.key.indexOf(TableDecorations.COLUMN_CONTROLS_DECORATIONS) > -1,
|
|
135
|
+
);
|
|
136
|
+
|
|
137
|
+
expect(decorations).toHaveLength(3);
|
|
292
138
|
});
|
|
293
139
|
});
|
|
294
140
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
|
|
3
|
-
import { render } from '@testing-library/react';
|
|
3
|
+
import { render, screen } from '@testing-library/react';
|
|
4
4
|
import { IntlProvider } from 'react-intl-next';
|
|
5
5
|
|
|
6
6
|
import type { DocBuilder } from '@atlaskit/editor-common/types';
|
|
@@ -29,7 +29,7 @@ import {
|
|
|
29
29
|
|
|
30
30
|
import tablePlugin from '../../../plugins/table-plugin';
|
|
31
31
|
import { pluginKey } from '../../../plugins/table/pm-plugins/plugin-key';
|
|
32
|
-
import { TableCssClassName as ClassName } from '../../../plugins/table/types';
|
|
32
|
+
// import { TableCssClassName as ClassName } from '../../../plugins/table/types';
|
|
33
33
|
import { DragControls } from '../../../plugins/table/ui/TableFloatingControls/RowControls';
|
|
34
34
|
|
|
35
35
|
describe('NumberColumn', () => {
|
|
@@ -63,7 +63,7 @@ describe('NumberColumn', () => {
|
|
|
63
63
|
);
|
|
64
64
|
const ref = editorView.dom.querySelector('table');
|
|
65
65
|
|
|
66
|
-
|
|
66
|
+
render(
|
|
67
67
|
<IntlProvider locale="en">
|
|
68
68
|
<DragControls
|
|
69
69
|
tableRef={ref!}
|
|
@@ -77,11 +77,9 @@ describe('NumberColumn', () => {
|
|
|
77
77
|
</IntlProvider>,
|
|
78
78
|
);
|
|
79
79
|
|
|
80
|
-
const
|
|
81
|
-
`.${ClassName.ROW_CONTROLS_WITH_DRAG}`,
|
|
82
|
-
);
|
|
80
|
+
const dragHandle = screen.getAllByTestId('table-floating-row-drag-handle');
|
|
83
81
|
|
|
84
|
-
expect(
|
|
82
|
+
expect(dragHandle.length).toBe(1);
|
|
85
83
|
});
|
|
86
84
|
|
|
87
85
|
it('should not render any drag handle containers if hoveredCell is undefined', () => {
|
|
@@ -98,7 +96,7 @@ describe('NumberColumn', () => {
|
|
|
98
96
|
);
|
|
99
97
|
const ref = editorView.dom.querySelector('table');
|
|
100
98
|
|
|
101
|
-
|
|
99
|
+
render(
|
|
102
100
|
<IntlProvider locale="en">
|
|
103
101
|
<DragControls
|
|
104
102
|
tableRef={ref!}
|
|
@@ -115,10 +113,10 @@ describe('NumberColumn', () => {
|
|
|
115
113
|
</IntlProvider>,
|
|
116
114
|
);
|
|
117
115
|
|
|
118
|
-
const
|
|
119
|
-
|
|
116
|
+
const dragHandle = screen.queryAllByTestId(
|
|
117
|
+
'table-floating-row-drag-handle',
|
|
120
118
|
);
|
|
121
119
|
|
|
122
|
-
expect(
|
|
120
|
+
expect(dragHandle.length).toBe(0);
|
|
123
121
|
});
|
|
124
122
|
});
|