@atlaskit/editor-plugin-table 5.7.10 → 5.8.1
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 +17 -0
- package/afm-cc/tsconfig.json +3 -0
- package/dist/cjs/commands/column-resize.js +155 -0
- package/dist/cjs/commands/go-to-next-cell.js +15 -0
- package/dist/cjs/commands/selection.js +16 -3
- package/dist/cjs/plugin.js +2 -1
- package/dist/cjs/pm-plugins/keymap.js +9 -0
- package/dist/cjs/pm-plugins/table-resizing/event-handlers.js +18 -7
- package/dist/cjs/pm-plugins/table-resizing/utils/index.js +6 -0
- package/dist/cjs/types.js +2 -0
- package/dist/cjs/ui/FloatingDragMenu/DragMenu.js +187 -17
- package/dist/cjs/ui/FloatingDragMenu/index.js +4 -2
- package/dist/cjs/ui/FloatingDragMenu/styles.js +19 -0
- package/dist/cjs/ui/consts.js +2 -1
- package/dist/es2019/commands/column-resize.js +149 -0
- package/dist/es2019/commands/go-to-next-cell.js +13 -0
- package/dist/es2019/commands/selection.js +16 -3
- package/dist/es2019/plugin.js +2 -1
- package/dist/es2019/pm-plugins/keymap.js +10 -1
- package/dist/es2019/pm-plugins/table-resizing/event-handlers.js +19 -8
- package/dist/es2019/pm-plugins/table-resizing/utils/index.js +1 -1
- package/dist/es2019/types.js +2 -0
- package/dist/es2019/ui/FloatingDragMenu/DragMenu.js +177 -7
- package/dist/es2019/ui/FloatingDragMenu/index.js +4 -2
- package/dist/es2019/ui/FloatingDragMenu/styles.js +62 -0
- package/dist/es2019/ui/consts.js +2 -1
- package/dist/esm/commands/column-resize.js +149 -0
- package/dist/esm/commands/go-to-next-cell.js +15 -0
- package/dist/esm/commands/selection.js +16 -3
- package/dist/esm/plugin.js +2 -1
- package/dist/esm/pm-plugins/keymap.js +10 -1
- package/dist/esm/pm-plugins/table-resizing/event-handlers.js +19 -8
- package/dist/esm/pm-plugins/table-resizing/utils/index.js +1 -1
- package/dist/esm/types.js +2 -0
- package/dist/esm/ui/FloatingDragMenu/DragMenu.js +177 -7
- package/dist/esm/ui/FloatingDragMenu/index.js +4 -2
- package/dist/esm/ui/FloatingDragMenu/styles.js +12 -0
- package/dist/esm/ui/consts.js +2 -1
- package/dist/types/commands/column-resize.d.ts +5 -0
- package/dist/types/pm-plugins/table-resizing/utils/index.d.ts +1 -1
- package/dist/types/types.d.ts +2 -0
- package/dist/types/ui/FloatingDragMenu/DragMenu.d.ts +1 -2
- package/dist/types/ui/FloatingDragMenu/index.d.ts +3 -2
- package/dist/types/ui/FloatingDragMenu/styles.d.ts +3 -0
- package/dist/types/ui/consts.d.ts +1 -1
- package/dist/types-ts4.5/commands/column-resize.d.ts +5 -0
- package/dist/types-ts4.5/pm-plugins/table-resizing/utils/index.d.ts +1 -1
- package/dist/types-ts4.5/types.d.ts +2 -0
- package/dist/types-ts4.5/ui/FloatingDragMenu/DragMenu.d.ts +1 -2
- package/dist/types-ts4.5/ui/FloatingDragMenu/index.d.ts +3 -2
- package/dist/types-ts4.5/ui/FloatingDragMenu/styles.d.ts +3 -0
- package/dist/types-ts4.5/ui/consts.d.ts +1 -1
- package/package.json +7 -3
- package/src/__tests__/unit/ui/FloatingDragMenu.tsx +295 -0
- package/src/commands/column-resize.ts +257 -0
- package/src/commands/go-to-next-cell.ts +21 -0
- package/src/commands/selection.ts +19 -2
- package/src/plugin.tsx +1 -0
- package/src/pm-plugins/keymap.ts +35 -0
- package/src/pm-plugins/table-resizing/event-handlers.ts +33 -21
- package/src/pm-plugins/table-resizing/utils/index.ts +1 -0
- package/src/types.ts +3 -0
- package/src/ui/FloatingDragMenu/DragMenu.tsx +226 -7
- package/src/ui/FloatingDragMenu/index.tsx +4 -1
- package/src/ui/FloatingDragMenu/styles.ts +71 -0
- package/src/ui/consts.ts +6 -1
- package/tsconfig.app.json +3 -0
|
@@ -17,7 +17,8 @@ var FloatingDragMenu = function FloatingDragMenu(_ref) {
|
|
|
17
17
|
getEditorContainerWidth = _ref.getEditorContainerWidth,
|
|
18
18
|
canDrag = _ref.canDrag,
|
|
19
19
|
editorAnalyticsAPI = _ref.editorAnalyticsAPI,
|
|
20
|
-
stickyHeaders = _ref.stickyHeaders
|
|
20
|
+
stickyHeaders = _ref.stickyHeaders,
|
|
21
|
+
pluginConfig = _ref.pluginConfig;
|
|
21
22
|
if (!isOpen || !targetCellPosition || editorView.state.doc.nodeSize <= targetCellPosition) {
|
|
22
23
|
return null;
|
|
23
24
|
}
|
|
@@ -55,7 +56,8 @@ var FloatingDragMenu = function FloatingDragMenu(_ref) {
|
|
|
55
56
|
targetCellPosition: targetCellPosition,
|
|
56
57
|
getEditorContainerWidth: getEditorContainerWidth,
|
|
57
58
|
canDrag: canDrag,
|
|
58
|
-
editorAnalyticsAPI: editorAnalyticsAPI
|
|
59
|
+
editorAnalyticsAPI: editorAnalyticsAPI,
|
|
60
|
+
pluginConfig: pluginConfig
|
|
59
61
|
}));
|
|
60
62
|
};
|
|
61
63
|
FloatingDragMenu.displayName = 'FloatingDragMenu';
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
|
|
2
|
+
var _templateObject, _templateObject2, _templateObject3;
|
|
3
|
+
import { css } from '@emotion/react';
|
|
4
|
+
import { tableBackgroundBorderColor } from '@atlaskit/adf-schema';
|
|
5
|
+
import { N60A, N90 } from '@atlaskit/theme/colors';
|
|
6
|
+
import { TableCssClassName as ClassName } from '../../types';
|
|
7
|
+
import { dragMenuDropdownWidth } from '../consts';
|
|
8
|
+
export var cellColourPreviewStyles = function cellColourPreviewStyles(selectedColor) {
|
|
9
|
+
return css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n &::before {\n background: ", ";\n }\n"])), selectedColor);
|
|
10
|
+
};
|
|
11
|
+
export var dragMenuBackgroundColorStyles = css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n .", " {\n border-radius: ", ";\n background: ", ";\n box-shadow: ", ";\n display: block;\n position: absolute;\n top: 0;\n left: ", "px;\n padding: ", ";\n\n > div {\n padding: 0;\n }\n }\n\n .", " {\n display: flex;\n\n &::before {\n content: '';\n display: block;\n border: 1px solid ", ";\n border-radius: ", ";\n width: 14px;\n height: 14px;\n }\n\n &::after {\n content: '\u203A';\n margin-left: ", ";\n line-height: 14px;\n color: ", ";\n }\n }\n"])), ClassName.DRAG_SUBMENU, "var(--ds-border-radius, 3px)", "var(--ds-surface-overlay, white)", "var(--ds-shadow-overlay, ".concat("0 4px 8px -2px ".concat(N60A, ", 0 0 1px ").concat(N60A), ")"), dragMenuDropdownWidth, "var(--ds-space-100, 8px)", ClassName.DRAG_SUBMENU_ICON, tableBackgroundBorderColor, "var(--ds-border-radius, 3px)", "var(--ds-space-050, 4px)", "var(--ds-icon, ".concat(N90, ")"));
|
|
12
|
+
export var toggleStyles = css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n display: flex;\n input[type='checkbox'] {\n width: 30px;\n height: 14px;\n pointer-events: initial;\n cursor: pointer;\n }\n > label {\n margin: 0px;\n pointer-events: none;\n > span {\n pointer-events: none;\n }\n }\n"])));
|
package/dist/esm/ui/consts.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { tableCellBorderWidth, tableMarginTop } from '@atlaskit/editor-common/styles';
|
|
2
2
|
import { akEditorTableBorder, akEditorTableBorderSelected, akEditorTableCellBlanketDeleted, akEditorTableCellBlanketSelected, akEditorTableHeaderCellBackground, akEditorTableToolbar, akEditorTableToolbarSize, akEditorUnitZIndex, akRichMediaResizeZIndex } from '@atlaskit/editor-shared-styles';
|
|
3
|
+
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
3
4
|
import { B200, N0, N20, N200, N20A, N300, R300, R400, R75 } from '@atlaskit/theme/colors';
|
|
4
5
|
import { RESIZE_HANDLE_AREA_DECORATION_GAP } from '../types';
|
|
5
6
|
|
|
@@ -49,7 +50,7 @@ export var resizeHandlerAreaWidth = RESIZE_HANDLE_AREA_DECORATION_GAP / 3;
|
|
|
49
50
|
export var resizeLineWidth = 2;
|
|
50
51
|
export var resizeHandlerZIndex = columnControlsZIndex + akRichMediaResizeZIndex;
|
|
51
52
|
export var contextualMenuTriggerSize = 16;
|
|
52
|
-
export var contextualMenuDropdownWidth = 180;
|
|
53
|
+
export var contextualMenuDropdownWidth = getBooleanFF('platform.editor.table.drag-and-drop') ? 250 : 180;
|
|
53
54
|
export var stickyRowZIndex = resizeHandlerZIndex + 2;
|
|
54
55
|
export var stickyRowOffsetTop = 8;
|
|
55
56
|
export var stickyHeaderBorderBottomWidth = 1;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { Command, GetEditorContainerWidth } from '@atlaskit/editor-common/types';
|
|
2
|
+
import type { Direction } from '@atlaskit/editor-tables/src/types';
|
|
3
|
+
export declare const initiateKeyboardColumnResizing: Command;
|
|
4
|
+
export declare const activateNextResizeArea: (direction: Direction) => Command;
|
|
5
|
+
export declare const changeColumnWidthByStep: (stepSize: number, getEditorContainerWidth: GetEditorContainerWidth) => Command;
|
|
@@ -4,7 +4,7 @@ export { getColumnStateFromDOM, getFreeSpace, getCellsRefsInColumn, calculateCol
|
|
|
4
4
|
export type { ColumnState } from './column-state';
|
|
5
5
|
export { growColumn, shrinkColumn, reduceSpace } from './resize-logic';
|
|
6
6
|
export { getResizeState, updateColgroup, getTotalWidth, evenAllColumnsWidths, bulkColumnsResize, areColumnsEven, adjustColumnsWidths, } from './resize-state';
|
|
7
|
-
export { getLayoutSize, getDefaultLayoutMaxWidth, pointsAtCell, currentColWidth, domCellAround, } from './misc';
|
|
7
|
+
export { getLayoutSize, getDefaultLayoutMaxWidth, pointsAtCell, currentColWidth, domCellAround, getTableMaxWidth, } from './misc';
|
|
8
8
|
export { updateControls, isClickNear, getResizeCellPos } from './dom';
|
|
9
9
|
export { scale, scaleWithParent, scaleTable, previewScaleTable, } from './scale-table';
|
|
10
10
|
export type { ScaleOptions } from './scale-table';
|
package/dist/types/types.d.ts
CHANGED
|
@@ -305,6 +305,8 @@ export declare const TableCssClassName: {
|
|
|
305
305
|
DRAG_HANDLE_DISABLED: string;
|
|
306
306
|
/** minimised handle class */
|
|
307
307
|
DRAG_HANDLE_MINIMISED: string;
|
|
308
|
+
DRAG_SUBMENU: string;
|
|
309
|
+
DRAG_SUBMENU_ICON: string;
|
|
308
310
|
/** Other classes */
|
|
309
311
|
NUMBERED_COLUMN: string;
|
|
310
312
|
NUMBERED_COLUMN_BUTTON: string;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/** @jsx jsx */
|
|
2
1
|
import { jsx } from '@emotion/react';
|
|
3
2
|
import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
|
|
4
3
|
import type { GetEditorContainerWidth } from '@atlaskit/editor-common/types';
|
|
@@ -21,5 +20,5 @@ type DragMenuProps = {
|
|
|
21
20
|
canDrag?: boolean;
|
|
22
21
|
editorAnalyticsAPI?: EditorAnalyticsAPI;
|
|
23
22
|
};
|
|
24
|
-
export declare const DragMenu: ({ direction, index, isOpen, editorView, tableNode, mountPoint, boundariesElement, scrollableElement, targetCellPosition, getEditorContainerWidth, canDrag, editorAnalyticsAPI, }: DragMenuProps) => jsx.JSX.Element | null;
|
|
23
|
+
export declare const DragMenu: ({ direction, index, isOpen, editorView, tableNode, mountPoint, boundariesElement, scrollableElement, targetCellPosition, getEditorContainerWidth, canDrag, editorAnalyticsAPI, pluginConfig, }: DragMenuProps) => jsx.JSX.Element | null;
|
|
25
24
|
export {};
|
|
@@ -4,7 +4,7 @@ import type { GetEditorContainerWidth } from '@atlaskit/editor-common/types';
|
|
|
4
4
|
import type { Node as PmNode } from '@atlaskit/editor-prosemirror/model';
|
|
5
5
|
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
6
6
|
import type { RowStickyState } from '../../pm-plugins/sticky-headers';
|
|
7
|
-
import type { TableDirection } from '../../types';
|
|
7
|
+
import type { PluginConfig, TableDirection } from '../../types';
|
|
8
8
|
export interface Props {
|
|
9
9
|
editorView: EditorView;
|
|
10
10
|
isOpen: boolean;
|
|
@@ -20,9 +20,10 @@ export interface Props {
|
|
|
20
20
|
canDrag?: boolean;
|
|
21
21
|
editorAnalyticsAPI?: EditorAnalyticsAPI;
|
|
22
22
|
stickyHeaders?: RowStickyState;
|
|
23
|
+
pluginConfig?: PluginConfig;
|
|
23
24
|
}
|
|
24
25
|
declare const FloatingDragMenu: {
|
|
25
|
-
({ mountPoint, boundariesElement, scrollableElement, editorView, isOpen, tableNode, direction, index, targetCellPosition, getEditorContainerWidth, canDrag, editorAnalyticsAPI, stickyHeaders, }: Props): JSX.Element | null;
|
|
26
|
+
({ mountPoint, boundariesElement, scrollableElement, editorView, isOpen, tableNode, direction, index, targetCellPosition, getEditorContainerWidth, canDrag, editorAnalyticsAPI, stickyHeaders, pluginConfig, }: Props): JSX.Element | null;
|
|
26
27
|
displayName: string;
|
|
27
28
|
};
|
|
28
29
|
export default FloatingDragMenu;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export declare const cellColourPreviewStyles: (selectedColor: string) => import("@emotion/react").SerializedStyles;
|
|
2
|
+
export declare const dragMenuBackgroundColorStyles: import("@emotion/react").SerializedStyles;
|
|
3
|
+
export declare const toggleStyles: import("@emotion/react").SerializedStyles;
|
|
@@ -40,7 +40,7 @@ export declare const resizeHandlerAreaWidth: number;
|
|
|
40
40
|
export declare const resizeLineWidth = 2;
|
|
41
41
|
export declare const resizeHandlerZIndex: number;
|
|
42
42
|
export declare const contextualMenuTriggerSize = 16;
|
|
43
|
-
export declare const contextualMenuDropdownWidth
|
|
43
|
+
export declare const contextualMenuDropdownWidth: number;
|
|
44
44
|
export declare const stickyRowZIndex: number;
|
|
45
45
|
export declare const stickyRowOffsetTop = 8;
|
|
46
46
|
export declare const stickyHeaderBorderBottomWidth = 1;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { Command, GetEditorContainerWidth } from '@atlaskit/editor-common/types';
|
|
2
|
+
import type { Direction } from '@atlaskit/editor-tables/src/types';
|
|
3
|
+
export declare const initiateKeyboardColumnResizing: Command;
|
|
4
|
+
export declare const activateNextResizeArea: (direction: Direction) => Command;
|
|
5
|
+
export declare const changeColumnWidthByStep: (stepSize: number, getEditorContainerWidth: GetEditorContainerWidth) => Command;
|
|
@@ -4,7 +4,7 @@ export { getColumnStateFromDOM, getFreeSpace, getCellsRefsInColumn, calculateCol
|
|
|
4
4
|
export type { ColumnState } from './column-state';
|
|
5
5
|
export { growColumn, shrinkColumn, reduceSpace } from './resize-logic';
|
|
6
6
|
export { getResizeState, updateColgroup, getTotalWidth, evenAllColumnsWidths, bulkColumnsResize, areColumnsEven, adjustColumnsWidths, } from './resize-state';
|
|
7
|
-
export { getLayoutSize, getDefaultLayoutMaxWidth, pointsAtCell, currentColWidth, domCellAround, } from './misc';
|
|
7
|
+
export { getLayoutSize, getDefaultLayoutMaxWidth, pointsAtCell, currentColWidth, domCellAround, getTableMaxWidth, } from './misc';
|
|
8
8
|
export { updateControls, isClickNear, getResizeCellPos } from './dom';
|
|
9
9
|
export { scale, scaleWithParent, scaleTable, previewScaleTable, } from './scale-table';
|
|
10
10
|
export type { ScaleOptions } from './scale-table';
|
|
@@ -305,6 +305,8 @@ export declare const TableCssClassName: {
|
|
|
305
305
|
DRAG_HANDLE_DISABLED: string;
|
|
306
306
|
/** minimised handle class */
|
|
307
307
|
DRAG_HANDLE_MINIMISED: string;
|
|
308
|
+
DRAG_SUBMENU: string;
|
|
309
|
+
DRAG_SUBMENU_ICON: string;
|
|
308
310
|
/** Other classes */
|
|
309
311
|
NUMBERED_COLUMN: string;
|
|
310
312
|
NUMBERED_COLUMN_BUTTON: string;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/** @jsx jsx */
|
|
2
1
|
import { jsx } from '@emotion/react';
|
|
3
2
|
import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
|
|
4
3
|
import type { GetEditorContainerWidth } from '@atlaskit/editor-common/types';
|
|
@@ -21,5 +20,5 @@ type DragMenuProps = {
|
|
|
21
20
|
canDrag?: boolean;
|
|
22
21
|
editorAnalyticsAPI?: EditorAnalyticsAPI;
|
|
23
22
|
};
|
|
24
|
-
export declare const DragMenu: ({ direction, index, isOpen, editorView, tableNode, mountPoint, boundariesElement, scrollableElement, targetCellPosition, getEditorContainerWidth, canDrag, editorAnalyticsAPI, }: DragMenuProps) => jsx.JSX.Element | null;
|
|
23
|
+
export declare const DragMenu: ({ direction, index, isOpen, editorView, tableNode, mountPoint, boundariesElement, scrollableElement, targetCellPosition, getEditorContainerWidth, canDrag, editorAnalyticsAPI, pluginConfig, }: DragMenuProps) => jsx.JSX.Element | null;
|
|
25
24
|
export {};
|
|
@@ -4,7 +4,7 @@ import type { GetEditorContainerWidth } from '@atlaskit/editor-common/types';
|
|
|
4
4
|
import type { Node as PmNode } from '@atlaskit/editor-prosemirror/model';
|
|
5
5
|
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
6
6
|
import type { RowStickyState } from '../../pm-plugins/sticky-headers';
|
|
7
|
-
import type { TableDirection } from '../../types';
|
|
7
|
+
import type { PluginConfig, TableDirection } from '../../types';
|
|
8
8
|
export interface Props {
|
|
9
9
|
editorView: EditorView;
|
|
10
10
|
isOpen: boolean;
|
|
@@ -20,9 +20,10 @@ export interface Props {
|
|
|
20
20
|
canDrag?: boolean;
|
|
21
21
|
editorAnalyticsAPI?: EditorAnalyticsAPI;
|
|
22
22
|
stickyHeaders?: RowStickyState;
|
|
23
|
+
pluginConfig?: PluginConfig;
|
|
23
24
|
}
|
|
24
25
|
declare const FloatingDragMenu: {
|
|
25
|
-
({ mountPoint, boundariesElement, scrollableElement, editorView, isOpen, tableNode, direction, index, targetCellPosition, getEditorContainerWidth, canDrag, editorAnalyticsAPI, stickyHeaders, }: Props): JSX.Element | null;
|
|
26
|
+
({ mountPoint, boundariesElement, scrollableElement, editorView, isOpen, tableNode, direction, index, targetCellPosition, getEditorContainerWidth, canDrag, editorAnalyticsAPI, stickyHeaders, pluginConfig, }: Props): JSX.Element | null;
|
|
26
27
|
displayName: string;
|
|
27
28
|
};
|
|
28
29
|
export default FloatingDragMenu;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export declare const cellColourPreviewStyles: (selectedColor: string) => import("@emotion/react").SerializedStyles;
|
|
2
|
+
export declare const dragMenuBackgroundColorStyles: import("@emotion/react").SerializedStyles;
|
|
3
|
+
export declare const toggleStyles: import("@emotion/react").SerializedStyles;
|
|
@@ -40,7 +40,7 @@ export declare const resizeHandlerAreaWidth: number;
|
|
|
40
40
|
export declare const resizeLineWidth = 2;
|
|
41
41
|
export declare const resizeHandlerZIndex: number;
|
|
42
42
|
export declare const contextualMenuTriggerSize = 16;
|
|
43
|
-
export declare const contextualMenuDropdownWidth
|
|
43
|
+
export declare const contextualMenuDropdownWidth: number;
|
|
44
44
|
export declare const stickyRowZIndex: number;
|
|
45
45
|
export declare const stickyRowOffsetTop = 8;
|
|
46
46
|
export declare const stickyHeaderBorderBottomWidth = 1;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-table",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.8.1",
|
|
4
4
|
"description": "Table plugin for the @atlaskit/editor",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -30,12 +30,12 @@
|
|
|
30
30
|
"dependencies": {
|
|
31
31
|
"@atlaskit/adf-schema": "^35.3.0",
|
|
32
32
|
"@atlaskit/custom-steps": "^0.0.11",
|
|
33
|
-
"@atlaskit/editor-common": "^76.
|
|
33
|
+
"@atlaskit/editor-common": "^76.39.0",
|
|
34
34
|
"@atlaskit/editor-palette": "1.5.2",
|
|
35
35
|
"@atlaskit/editor-plugin-analytics": "^0.4.0",
|
|
36
36
|
"@atlaskit/editor-plugin-content-insertion": "^0.1.0",
|
|
37
37
|
"@atlaskit/editor-plugin-guideline": "^0.5.0",
|
|
38
|
-
"@atlaskit/editor-plugin-selection": "^0.
|
|
38
|
+
"@atlaskit/editor-plugin-selection": "^0.2.0",
|
|
39
39
|
"@atlaskit/editor-plugin-width": "^0.2.0",
|
|
40
40
|
"@atlaskit/editor-prosemirror": "1.1.0",
|
|
41
41
|
"@atlaskit/editor-shared-styles": "^2.9.0",
|
|
@@ -47,6 +47,7 @@
|
|
|
47
47
|
"@atlaskit/pragmatic-drag-and-drop-hitbox": "^0.12.0",
|
|
48
48
|
"@atlaskit/primitives": "^1.17.0",
|
|
49
49
|
"@atlaskit/theme": "^12.6.0",
|
|
50
|
+
"@atlaskit/toggle": "^13.0.0",
|
|
50
51
|
"@atlaskit/tokens": "^1.33.0",
|
|
51
52
|
"@atlaskit/tooltip": "^18.1.0",
|
|
52
53
|
"@babel/runtime": "^7.0.0",
|
|
@@ -144,6 +145,9 @@
|
|
|
144
145
|
},
|
|
145
146
|
"platform.editor.table.in-danger-hover-merged-cells-fix": {
|
|
146
147
|
"type": "boolean"
|
|
148
|
+
},
|
|
149
|
+
"platform.editor.a11y-column-resizing_emcvz": {
|
|
150
|
+
"type": "boolean"
|
|
147
151
|
}
|
|
148
152
|
}
|
|
149
153
|
}
|
|
@@ -188,5 +188,300 @@ describe('FloatingDragMenu', () => {
|
|
|
188
188
|
]
|
|
189
189
|
`);
|
|
190
190
|
});
|
|
191
|
+
// first row menu item check
|
|
192
|
+
ffTest(
|
|
193
|
+
'platform.editor.table.new-cell-context-menu-styling',
|
|
194
|
+
() => {
|
|
195
|
+
// Run test case when FF platform.editor.table.new-cell-context-menu-styling is true
|
|
196
|
+
|
|
197
|
+
const tableRef = editorView.dom.querySelector('table');
|
|
198
|
+
const editorRef = {
|
|
199
|
+
current: document.createElement('div'),
|
|
200
|
+
};
|
|
201
|
+
render(
|
|
202
|
+
<ReactEditorViewContext.Provider
|
|
203
|
+
value={{
|
|
204
|
+
editorRef,
|
|
205
|
+
}}
|
|
206
|
+
>
|
|
207
|
+
<div id="drag-handle-button-row">dragmenu anchor</div>
|
|
208
|
+
<DragMenu
|
|
209
|
+
editorView={editorView}
|
|
210
|
+
isOpen={true}
|
|
211
|
+
getEditorContainerWidth={jest.fn()}
|
|
212
|
+
tableRef={tableRef as HTMLTableElement}
|
|
213
|
+
tableNode={tableNode?.node}
|
|
214
|
+
direction="row"
|
|
215
|
+
index={0}
|
|
216
|
+
/>
|
|
217
|
+
</ReactEditorViewContext.Provider>,
|
|
218
|
+
);
|
|
219
|
+
|
|
220
|
+
const items = screen.getAllByRole('menuitem');
|
|
221
|
+
const menuitemTextArray = items.map((item) => item.textContent);
|
|
222
|
+
expect(menuitemTextArray).toMatchInlineSnapshot(`
|
|
223
|
+
Array [
|
|
224
|
+
"Add row aboveCtrl+Alt+↑",
|
|
225
|
+
"Add row belowCtrl+Alt+↓",
|
|
226
|
+
"Clear cells⌫",
|
|
227
|
+
"Delete rowCtrl+⌫",
|
|
228
|
+
"Move row upCtrl+Alt+Shift+↑",
|
|
229
|
+
"Move row downCtrl+Alt+Shift+↓",
|
|
230
|
+
"Header row",
|
|
231
|
+
"Row numbers",
|
|
232
|
+
]
|
|
233
|
+
`);
|
|
234
|
+
},
|
|
235
|
+
() => {
|
|
236
|
+
// Run test case when FF platform.editor.table.new-cell-context-menu-styling is false
|
|
237
|
+
const tableRef = editorView.dom.querySelector('table');
|
|
238
|
+
const editorRef = {
|
|
239
|
+
current: document.createElement('div'),
|
|
240
|
+
};
|
|
241
|
+
render(
|
|
242
|
+
<ReactEditorViewContext.Provider
|
|
243
|
+
value={{
|
|
244
|
+
editorRef,
|
|
245
|
+
}}
|
|
246
|
+
>
|
|
247
|
+
<div id="drag-handle-button-row">dragmenu anchor</div>
|
|
248
|
+
<DragMenu
|
|
249
|
+
editorView={editorView}
|
|
250
|
+
isOpen={true}
|
|
251
|
+
getEditorContainerWidth={jest.fn()}
|
|
252
|
+
tableRef={tableRef as HTMLTableElement}
|
|
253
|
+
tableNode={tableNode?.node}
|
|
254
|
+
direction="row"
|
|
255
|
+
index={0}
|
|
256
|
+
/>
|
|
257
|
+
</ReactEditorViewContext.Provider>,
|
|
258
|
+
);
|
|
259
|
+
|
|
260
|
+
const items = screen.getAllByRole('menuitem');
|
|
261
|
+
const menuitemTextArray = items.map((item) => item.textContent);
|
|
262
|
+
expect(menuitemTextArray).toMatchInlineSnapshot(`
|
|
263
|
+
Array [
|
|
264
|
+
"Add row aboveCtrl+Alt+↑",
|
|
265
|
+
"Add row belowCtrl+Alt+↓",
|
|
266
|
+
"Clear cells⌫",
|
|
267
|
+
"Delete rowCtrl+⌫",
|
|
268
|
+
"Move row upCtrl+Alt+Shift+↑",
|
|
269
|
+
"Move row downCtrl+Alt+Shift+↓",
|
|
270
|
+
]
|
|
271
|
+
`);
|
|
272
|
+
},
|
|
273
|
+
);
|
|
274
|
+
// second row menu item check
|
|
275
|
+
ffTest(
|
|
276
|
+
'platform.editor.table.new-cell-context-menu-styling',
|
|
277
|
+
() => {
|
|
278
|
+
// Run test case when FF platform.editor.table.new-cell-context-menu-styling is true
|
|
279
|
+
|
|
280
|
+
const tableRef = editorView.dom.querySelector('table');
|
|
281
|
+
const editorRef = {
|
|
282
|
+
current: document.createElement('div'),
|
|
283
|
+
};
|
|
284
|
+
render(
|
|
285
|
+
<ReactEditorViewContext.Provider
|
|
286
|
+
value={{
|
|
287
|
+
editorRef,
|
|
288
|
+
}}
|
|
289
|
+
>
|
|
290
|
+
<div id="drag-handle-button-row">dragmenu anchor</div>
|
|
291
|
+
<DragMenu
|
|
292
|
+
editorView={editorView}
|
|
293
|
+
isOpen={true}
|
|
294
|
+
getEditorContainerWidth={jest.fn()}
|
|
295
|
+
tableRef={tableRef as HTMLTableElement}
|
|
296
|
+
tableNode={tableNode?.node}
|
|
297
|
+
direction="row"
|
|
298
|
+
index={1}
|
|
299
|
+
/>
|
|
300
|
+
</ReactEditorViewContext.Provider>,
|
|
301
|
+
);
|
|
302
|
+
|
|
303
|
+
const items = screen.getAllByRole('menuitem');
|
|
304
|
+
const menuitemTextArray = items.map((item) => item.textContent);
|
|
305
|
+
expect(menuitemTextArray).toMatchInlineSnapshot(`
|
|
306
|
+
Array [
|
|
307
|
+
"Add row aboveCtrl+Alt+↑",
|
|
308
|
+
"Add row belowCtrl+Alt+↓",
|
|
309
|
+
"Clear cells⌫",
|
|
310
|
+
"Delete rowCtrl+⌫",
|
|
311
|
+
"Move row upCtrl+Alt+Shift+↑",
|
|
312
|
+
"Move row downCtrl+Alt+Shift+↓",
|
|
313
|
+
"Row numbers",
|
|
314
|
+
]
|
|
315
|
+
`);
|
|
316
|
+
},
|
|
317
|
+
() => {
|
|
318
|
+
// Run test case when FF platform.editor.table.new-cell-context-menu-styling is false
|
|
319
|
+
const tableRef = editorView.dom.querySelector('table');
|
|
320
|
+
const editorRef = {
|
|
321
|
+
current: document.createElement('div'),
|
|
322
|
+
};
|
|
323
|
+
render(
|
|
324
|
+
<ReactEditorViewContext.Provider
|
|
325
|
+
value={{
|
|
326
|
+
editorRef,
|
|
327
|
+
}}
|
|
328
|
+
>
|
|
329
|
+
<div id="drag-handle-button-row">dragmenu anchor</div>
|
|
330
|
+
<DragMenu
|
|
331
|
+
editorView={editorView}
|
|
332
|
+
isOpen={true}
|
|
333
|
+
getEditorContainerWidth={jest.fn()}
|
|
334
|
+
tableRef={tableRef as HTMLTableElement}
|
|
335
|
+
tableNode={tableNode?.node}
|
|
336
|
+
direction="row"
|
|
337
|
+
index={1}
|
|
338
|
+
/>
|
|
339
|
+
</ReactEditorViewContext.Provider>,
|
|
340
|
+
);
|
|
341
|
+
|
|
342
|
+
const items = screen.getAllByRole('menuitem');
|
|
343
|
+
const menuitemTextArray = items.map((item) => item.textContent);
|
|
344
|
+
expect(menuitemTextArray).toMatchInlineSnapshot(`
|
|
345
|
+
Array [
|
|
346
|
+
"Add row aboveCtrl+Alt+↑",
|
|
347
|
+
"Add row belowCtrl+Alt+↓",
|
|
348
|
+
"Clear cells⌫",
|
|
349
|
+
"Delete rowCtrl+⌫",
|
|
350
|
+
"Move row upCtrl+Alt+Shift+↑",
|
|
351
|
+
"Move row downCtrl+Alt+Shift+↓",
|
|
352
|
+
]
|
|
353
|
+
`);
|
|
354
|
+
},
|
|
355
|
+
);
|
|
356
|
+
// first column menu item check
|
|
357
|
+
ffTest(
|
|
358
|
+
'platform.editor.table.new-cell-context-menu-styling',
|
|
359
|
+
() => {
|
|
360
|
+
// Run test case when FF platform.editor.table.new-cell-context-menu-styling is true
|
|
361
|
+
|
|
362
|
+
const tableRef = editorView.dom.querySelector('table');
|
|
363
|
+
const editorRef = {
|
|
364
|
+
current: document.createElement('div'),
|
|
365
|
+
};
|
|
366
|
+
render(
|
|
367
|
+
<ReactEditorViewContext.Provider
|
|
368
|
+
value={{
|
|
369
|
+
editorRef,
|
|
370
|
+
}}
|
|
371
|
+
>
|
|
372
|
+
<div id="drag-handle-button-row">dragmenu anchor</div>
|
|
373
|
+
<DragMenu
|
|
374
|
+
editorView={editorView}
|
|
375
|
+
isOpen={true}
|
|
376
|
+
getEditorContainerWidth={jest.fn()}
|
|
377
|
+
tableRef={tableRef as HTMLTableElement}
|
|
378
|
+
tableNode={tableNode?.node}
|
|
379
|
+
direction="column"
|
|
380
|
+
index={0}
|
|
381
|
+
/>
|
|
382
|
+
</ReactEditorViewContext.Provider>,
|
|
383
|
+
);
|
|
384
|
+
|
|
385
|
+
const items = screen.getAllByRole('menuitem');
|
|
386
|
+
const menuitemTextArray = items.map((item) => item.textContent);
|
|
387
|
+
expect(menuitemTextArray).toMatchInlineSnapshot(`
|
|
388
|
+
Array [
|
|
389
|
+
"Add column leftCtrl+Alt+←",
|
|
390
|
+
"Add column rightCtrl+Alt+→",
|
|
391
|
+
"Distribute columns",
|
|
392
|
+
"Clear cells⌫",
|
|
393
|
+
"Delete columnCtrl+⌫",
|
|
394
|
+
"Move column leftCtrl+Alt+Shift+←",
|
|
395
|
+
"Move column rightCtrl+Alt+Shift+→",
|
|
396
|
+
"Sort increasing",
|
|
397
|
+
"Sort decreasing",
|
|
398
|
+
"Header column",
|
|
399
|
+
]
|
|
400
|
+
`);
|
|
401
|
+
},
|
|
402
|
+
() => {
|
|
403
|
+
// Run test case when FF platform.editor.table.new-cell-context-menu-styling is false
|
|
404
|
+
const tableRef = editorView.dom.querySelector('table');
|
|
405
|
+
const editorRef = {
|
|
406
|
+
current: document.createElement('div'),
|
|
407
|
+
};
|
|
408
|
+
render(
|
|
409
|
+
<ReactEditorViewContext.Provider
|
|
410
|
+
value={{
|
|
411
|
+
editorRef,
|
|
412
|
+
}}
|
|
413
|
+
>
|
|
414
|
+
<div id="drag-handle-button-row">dragmenu anchor</div>
|
|
415
|
+
<DragMenu
|
|
416
|
+
editorView={editorView}
|
|
417
|
+
isOpen={true}
|
|
418
|
+
getEditorContainerWidth={jest.fn()}
|
|
419
|
+
tableRef={tableRef as HTMLTableElement}
|
|
420
|
+
tableNode={tableNode?.node}
|
|
421
|
+
direction="column"
|
|
422
|
+
index={0}
|
|
423
|
+
/>
|
|
424
|
+
</ReactEditorViewContext.Provider>,
|
|
425
|
+
);
|
|
426
|
+
|
|
427
|
+
const items = screen.getAllByRole('menuitem');
|
|
428
|
+
const menuitemTextArray = items.map((item) => item.textContent);
|
|
429
|
+
expect(menuitemTextArray).toMatchInlineSnapshot(`
|
|
430
|
+
Array [
|
|
431
|
+
"Add column leftCtrl+Alt+←",
|
|
432
|
+
"Add column rightCtrl+Alt+→",
|
|
433
|
+
"Distribute columns",
|
|
434
|
+
"Clear cells⌫",
|
|
435
|
+
"Delete columnCtrl+⌫",
|
|
436
|
+
"Move column leftCtrl+Alt+Shift+←",
|
|
437
|
+
"Move column rightCtrl+Alt+Shift+→",
|
|
438
|
+
"Sort increasing",
|
|
439
|
+
"Sort decreasing",
|
|
440
|
+
]
|
|
441
|
+
`);
|
|
442
|
+
},
|
|
443
|
+
);
|
|
444
|
+
// second column menu item check
|
|
445
|
+
ffTest('platform.editor.table.new-cell-context-menu-styling', () => {
|
|
446
|
+
// Run test case when FF platform.editor.table.new-cell-context-menu-styling is true
|
|
447
|
+
const tableRef = editorView.dom.querySelector('table');
|
|
448
|
+
const editorRef = {
|
|
449
|
+
current: document.createElement('div'),
|
|
450
|
+
};
|
|
451
|
+
render(
|
|
452
|
+
<ReactEditorViewContext.Provider
|
|
453
|
+
value={{
|
|
454
|
+
editorRef,
|
|
455
|
+
}}
|
|
456
|
+
>
|
|
457
|
+
<div id="drag-handle-button-row">dragmenu anchor</div>
|
|
458
|
+
<DragMenu
|
|
459
|
+
editorView={editorView}
|
|
460
|
+
isOpen={true}
|
|
461
|
+
getEditorContainerWidth={jest.fn()}
|
|
462
|
+
tableRef={tableRef as HTMLTableElement}
|
|
463
|
+
tableNode={tableNode?.node}
|
|
464
|
+
direction="column"
|
|
465
|
+
index={1}
|
|
466
|
+
/>
|
|
467
|
+
</ReactEditorViewContext.Provider>,
|
|
468
|
+
);
|
|
469
|
+
|
|
470
|
+
const items = screen.getAllByRole('menuitem');
|
|
471
|
+
const menuitemTextArray = items.map((item) => item.textContent);
|
|
472
|
+
expect(menuitemTextArray).toMatchInlineSnapshot(`
|
|
473
|
+
Array [
|
|
474
|
+
"Add column leftCtrl+Alt+←",
|
|
475
|
+
"Add column rightCtrl+Alt+→",
|
|
476
|
+
"Distribute columns",
|
|
477
|
+
"Clear cells⌫",
|
|
478
|
+
"Delete columnCtrl+⌫",
|
|
479
|
+
"Move column leftCtrl+Alt+Shift+←",
|
|
480
|
+
"Move column rightCtrl+Alt+Shift+→",
|
|
481
|
+
"Sort increasing",
|
|
482
|
+
"Sort decreasing",
|
|
483
|
+
]
|
|
484
|
+
`);
|
|
485
|
+
});
|
|
191
486
|
});
|
|
192
487
|
});
|