@atlaskit/editor-plugin-table 5.3.14 → 5.3.16
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 +14 -0
- package/dist/cjs/plugins/table/event-handlers.js +4 -3
- package/dist/cjs/plugins/table/index.js +2 -1
- package/dist/cjs/plugins/table/pm-plugins/drag-and-drop/plugin.js +1 -0
- package/dist/cjs/plugins/table/types.js +5 -3
- package/dist/cjs/plugins/table/ui/FloatingDragMenu/DragMenu.js +49 -11
- package/dist/cjs/plugins/table/ui/FloatingDragMenu/index.js +5 -2
- package/dist/cjs/plugins/table/ui/FloatingInsertButton/index.js +5 -0
- package/dist/cjs/plugins/table/ui/TableFloatingColumnControls/ColumnControls/index.js +3 -11
- package/dist/cjs/plugins/table/ui/TableFloatingColumnControls/ColumnDropTargets/index.js +2 -2
- package/dist/cjs/plugins/table/ui/TableFloatingColumnControls/index.js +1 -1
- package/dist/cjs/plugins/table/ui/TableFloatingControls/CornerControls/ClassicCornerControls.js +114 -0
- package/dist/cjs/plugins/table/ui/TableFloatingControls/CornerControls/DragCornerControls.js +60 -0
- package/dist/cjs/plugins/table/ui/TableFloatingControls/CornerControls/index.js +11 -112
- package/dist/cjs/plugins/table/ui/TableFloatingControls/CornerControls/types.js +5 -0
- package/dist/cjs/plugins/table/ui/TableFloatingControls/RowControls/DragControls.js +1 -7
- package/dist/cjs/plugins/table/ui/TableFloatingControls/index.js +7 -2
- package/dist/cjs/plugins/table/ui/common-styles.js +1 -1
- package/dist/cjs/plugins/table/ui/icons/AddColLeftIcon.js +44 -0
- package/dist/cjs/plugins/table/ui/icons/AddColRightIcon.js +44 -0
- package/dist/cjs/plugins/table/ui/icons/AddRowAboveIcon.js +45 -0
- package/dist/cjs/plugins/table/ui/icons/AddRowBelowIcon.js +40 -0
- package/dist/cjs/plugins/table/ui/icons/index.js +29 -1
- package/dist/cjs/plugins/table/ui/messages.js +5 -0
- package/dist/cjs/plugins/table/ui/ui-styles.js +28 -25
- package/dist/cjs/plugins/table/utils/dom.js +16 -7
- package/dist/cjs/plugins/table/utils/drag-menu.js +122 -10
- package/dist/cjs/plugins/table/utils/index.js +12 -6
- package/dist/es2019/plugins/table/event-handlers.js +5 -4
- package/dist/es2019/plugins/table/index.js +2 -1
- package/dist/es2019/plugins/table/pm-plugins/drag-and-drop/plugin.js +2 -1
- package/dist/es2019/plugins/table/types.js +5 -3
- package/dist/es2019/plugins/table/ui/FloatingDragMenu/DragMenu.js +52 -8
- package/dist/es2019/plugins/table/ui/FloatingDragMenu/index.js +5 -2
- package/dist/es2019/plugins/table/ui/FloatingInsertButton/index.js +5 -0
- package/dist/es2019/plugins/table/ui/TableFloatingColumnControls/ColumnControls/index.js +3 -11
- package/dist/es2019/plugins/table/ui/TableFloatingColumnControls/ColumnDropTargets/index.js +2 -2
- package/dist/es2019/plugins/table/ui/TableFloatingColumnControls/index.js +1 -1
- package/dist/es2019/plugins/table/ui/TableFloatingControls/CornerControls/ClassicCornerControls.js +93 -0
- package/dist/es2019/plugins/table/ui/TableFloatingControls/CornerControls/DragCornerControls.js +61 -0
- package/dist/es2019/plugins/table/ui/TableFloatingControls/CornerControls/index.js +2 -99
- package/dist/es2019/plugins/table/ui/TableFloatingControls/CornerControls/types.js +1 -0
- package/dist/es2019/plugins/table/ui/TableFloatingControls/RowControls/DragControls.js +1 -7
- package/dist/es2019/plugins/table/ui/TableFloatingControls/index.js +8 -3
- package/dist/es2019/plugins/table/ui/common-styles.js +8 -6
- package/dist/es2019/plugins/table/ui/icons/AddColLeftIcon.js +35 -0
- package/dist/es2019/plugins/table/ui/icons/AddColRightIcon.js +35 -0
- package/dist/es2019/plugins/table/ui/icons/AddRowAboveIcon.js +36 -0
- package/dist/es2019/plugins/table/ui/icons/AddRowBelowIcon.js +31 -0
- package/dist/es2019/plugins/table/ui/icons/index.js +5 -1
- package/dist/es2019/plugins/table/ui/messages.js +5 -0
- package/dist/es2019/plugins/table/ui/ui-styles.js +44 -3
- package/dist/es2019/plugins/table/utils/dom.js +13 -6
- package/dist/es2019/plugins/table/utils/drag-menu.js +118 -8
- package/dist/es2019/plugins/table/utils/index.js +1 -1
- package/dist/esm/plugins/table/event-handlers.js +5 -4
- package/dist/esm/plugins/table/index.js +2 -1
- package/dist/esm/plugins/table/pm-plugins/drag-and-drop/plugin.js +2 -1
- package/dist/esm/plugins/table/types.js +5 -3
- package/dist/esm/plugins/table/ui/FloatingDragMenu/DragMenu.js +46 -8
- package/dist/esm/plugins/table/ui/FloatingDragMenu/index.js +5 -2
- package/dist/esm/plugins/table/ui/FloatingInsertButton/index.js +5 -0
- package/dist/esm/plugins/table/ui/TableFloatingColumnControls/ColumnControls/index.js +3 -11
- package/dist/esm/plugins/table/ui/TableFloatingColumnControls/ColumnDropTargets/index.js +2 -2
- package/dist/esm/plugins/table/ui/TableFloatingColumnControls/index.js +1 -1
- package/dist/esm/plugins/table/ui/TableFloatingControls/CornerControls/ClassicCornerControls.js +104 -0
- package/dist/esm/plugins/table/ui/TableFloatingControls/CornerControls/DragCornerControls.js +50 -0
- package/dist/esm/plugins/table/ui/TableFloatingControls/CornerControls/index.js +2 -110
- package/dist/esm/plugins/table/ui/TableFloatingControls/CornerControls/types.js +1 -0
- package/dist/esm/plugins/table/ui/TableFloatingControls/RowControls/DragControls.js +1 -7
- package/dist/esm/plugins/table/ui/TableFloatingControls/index.js +8 -3
- package/dist/esm/plugins/table/ui/common-styles.js +2 -2
- package/dist/esm/plugins/table/ui/icons/AddColLeftIcon.js +37 -0
- package/dist/esm/plugins/table/ui/icons/AddColRightIcon.js +37 -0
- package/dist/esm/plugins/table/ui/icons/AddRowAboveIcon.js +38 -0
- package/dist/esm/plugins/table/ui/icons/AddRowBelowIcon.js +33 -0
- package/dist/esm/plugins/table/ui/icons/index.js +5 -1
- package/dist/esm/plugins/table/ui/messages.js +5 -0
- package/dist/esm/plugins/table/ui/ui-styles.js +27 -24
- package/dist/esm/plugins/table/utils/dom.js +15 -6
- package/dist/esm/plugins/table/utils/drag-menu.js +120 -8
- package/dist/esm/plugins/table/utils/index.js +1 -1
- package/dist/types/plugins/table/types.d.ts +5 -3
- package/dist/types/plugins/table/ui/FloatingDragMenu/DragMenu.d.ts +5 -2
- package/dist/types/plugins/table/ui/FloatingDragMenu/index.d.ts +3 -1
- package/dist/types/plugins/table/ui/TableFloatingControls/CornerControls/ClassicCornerControls.d.ts +6 -0
- package/dist/types/plugins/table/ui/TableFloatingControls/CornerControls/DragCornerControls.d.ts +6 -0
- package/dist/types/plugins/table/ui/TableFloatingControls/CornerControls/index.d.ts +2 -16
- package/dist/types/plugins/table/ui/TableFloatingControls/CornerControls/types.d.ts +11 -0
- package/dist/types/plugins/table/ui/icons/AddColLeftIcon.d.ts +2 -0
- package/dist/types/plugins/table/ui/icons/AddColRightIcon.d.ts +2 -0
- package/dist/types/plugins/table/ui/icons/AddRowAboveIcon.d.ts +2 -0
- package/dist/types/plugins/table/ui/icons/AddRowBelowIcon.d.ts +2 -0
- package/dist/types/plugins/table/ui/icons/index.d.ts +4 -0
- package/dist/types/plugins/table/ui/messages.d.ts +5 -0
- package/dist/types/plugins/table/ui/ui-styles.d.ts +1 -0
- package/dist/types/plugins/table/utils/dom.d.ts +3 -2
- package/dist/types/plugins/table/utils/drag-menu.d.ts +6 -3
- package/dist/types/plugins/table/utils/index.d.ts +1 -1
- package/dist/types-ts4.5/plugins/table/types.d.ts +5 -3
- package/dist/types-ts4.5/plugins/table/ui/FloatingDragMenu/DragMenu.d.ts +5 -2
- package/dist/types-ts4.5/plugins/table/ui/FloatingDragMenu/index.d.ts +3 -1
- package/dist/types-ts4.5/plugins/table/ui/TableFloatingControls/CornerControls/ClassicCornerControls.d.ts +6 -0
- package/dist/types-ts4.5/plugins/table/ui/TableFloatingControls/CornerControls/DragCornerControls.d.ts +6 -0
- package/dist/types-ts4.5/plugins/table/ui/TableFloatingControls/CornerControls/index.d.ts +2 -16
- package/dist/types-ts4.5/plugins/table/ui/TableFloatingControls/CornerControls/types.d.ts +11 -0
- package/dist/types-ts4.5/plugins/table/ui/icons/AddColLeftIcon.d.ts +2 -0
- package/dist/types-ts4.5/plugins/table/ui/icons/AddColRightIcon.d.ts +2 -0
- package/dist/types-ts4.5/plugins/table/ui/icons/AddRowAboveIcon.d.ts +2 -0
- package/dist/types-ts4.5/plugins/table/ui/icons/AddRowBelowIcon.d.ts +2 -0
- package/dist/types-ts4.5/plugins/table/ui/icons/index.d.ts +4 -0
- package/dist/types-ts4.5/plugins/table/ui/messages.d.ts +5 -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 +3 -2
- package/dist/types-ts4.5/plugins/table/utils/drag-menu.d.ts +6 -3
- package/dist/types-ts4.5/plugins/table/utils/index.d.ts +1 -1
- package/package.json +2 -2
- package/src/plugins/table/event-handlers.ts +7 -2
- package/src/plugins/table/index.tsx +1 -0
- package/src/plugins/table/pm-plugins/drag-and-drop/plugin.ts +7 -1
- package/src/plugins/table/types.ts +7 -4
- package/src/plugins/table/ui/FloatingDragMenu/DragMenu.tsx +73 -6
- package/src/plugins/table/ui/FloatingDragMenu/index.tsx +5 -0
- package/src/plugins/table/ui/FloatingInsertButton/index.tsx +8 -0
- package/src/plugins/table/ui/TableFloatingColumnControls/ColumnControls/index.tsx +5 -7
- package/src/plugins/table/ui/TableFloatingColumnControls/ColumnDropTargets/index.tsx +2 -2
- package/src/plugins/table/ui/TableFloatingColumnControls/index.tsx +1 -1
- package/src/plugins/table/ui/TableFloatingControls/CornerControls/ClassicCornerControls.tsx +107 -0
- package/src/plugins/table/ui/TableFloatingControls/CornerControls/DragCornerControls.tsx +66 -0
- package/src/plugins/table/ui/TableFloatingControls/CornerControls/index.tsx +2 -125
- package/src/plugins/table/ui/TableFloatingControls/CornerControls/types.ts +12 -0
- package/src/plugins/table/ui/TableFloatingControls/RowControls/DragControls.tsx +3 -3
- package/src/plugins/table/ui/TableFloatingControls/index.tsx +22 -14
- package/src/plugins/table/ui/common-styles.ts +8 -5
- package/src/plugins/table/ui/icons/AddColLeftIcon.tsx +43 -0
- package/src/plugins/table/ui/icons/AddColRightIcon.tsx +43 -0
- package/src/plugins/table/ui/icons/AddRowAboveIcon.tsx +42 -0
- package/src/plugins/table/ui/icons/AddRowBelowIcon.tsx +36 -0
- package/src/plugins/table/ui/icons/index.ts +4 -0
- package/src/plugins/table/ui/messages.ts +6 -0
- package/src/plugins/table/ui/ui-styles.ts +45 -3
- package/src/plugins/table/utils/dom.ts +16 -4
- package/src/plugins/table/utils/drag-menu.ts +158 -5
- package/src/plugins/table/utils/index.ts +2 -1
|
@@ -1,2 +1,6 @@
|
|
|
1
1
|
export { DragHandleIcon } from './DragHandleIcon';
|
|
2
2
|
export { DragInMotionIcon } from './DragInMotionIcon';
|
|
3
|
+
export { AddRowAboveIcon } from './AddRowAboveIcon';
|
|
4
|
+
export { AddRowBelowIcon } from './AddRowBelowIcon';
|
|
5
|
+
export { AddColLeftIcon } from './AddColLeftIcon';
|
|
6
|
+
export { AddColRightIcon } from './AddColRightIcon';
|
|
@@ -4,6 +4,7 @@ export declare const HeaderButton: (props: ThemeProps, cssString?: string) => im
|
|
|
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
6
|
export declare const dragInsertButtonWrapper: (props: ThemeProps) => import("@emotion/react").SerializedStyles;
|
|
7
|
+
export declare const dragCornerControlButton: (props: ThemeProps) => import("@emotion/react").SerializedStyles;
|
|
7
8
|
export declare const insertColumnButtonWrapper: (props: ThemeProps) => import("@emotion/react").SerializedStyles;
|
|
8
9
|
export declare const insertRowButtonWrapper: (props: ThemeProps) => import("@emotion/react").SerializedStyles;
|
|
9
10
|
export declare const columnControlsLineMarker: () => import("@emotion/react").SerializedStyles;
|
|
@@ -9,10 +9,11 @@ export declare const isResizeHandleDecoration: (node: HTMLElement | null) => boo
|
|
|
9
9
|
export declare const isTableControlsButton: (node: HTMLElement | null) => boolean;
|
|
10
10
|
export declare const isTableContainerOrWrapper: (node: HTMLElement | null) => boolean;
|
|
11
11
|
/** drag-and-drop classes */
|
|
12
|
-
export declare const
|
|
12
|
+
export declare const isDragRowControlsButton: (node: HTMLElement | null) => true | HTMLElement | null;
|
|
13
13
|
export declare const isDragRowFloatingInsertDot: (node: HTMLElement | null) => boolean;
|
|
14
14
|
export declare const isDragColumnFloatingInsertDot: (node: HTMLElement | null) => boolean;
|
|
15
|
-
export declare const
|
|
15
|
+
export declare const isDragCornerButton: (node: HTMLElement | null) => boolean;
|
|
16
|
+
export declare const getMousePositionHorizontalRelativeByElement: (mouseEvent: MouseEvent, elementContentRects?: ElementContentRects, gapInPixels?: number, isDragAndDropEnabled?: boolean) => 'left' | 'right' | null;
|
|
16
17
|
export declare const getMousePositionVerticalRelativeByElement: (mouseEvent: MouseEvent) => 'top' | 'bottom' | null;
|
|
17
18
|
export declare const updateResizeHandles: (tableRef?: HTMLElement) => void;
|
|
18
19
|
export declare const hasResizeHandler: ({ columnEndIndexTarget, target, }: {
|
|
@@ -1,7 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
import type {
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import type { Command, DropdownOptionT, GetEditorContainerWidth, IconProps } from '@atlaskit/editor-common/types';
|
|
3
|
+
import type { Rect, TableMap } from '@atlaskit/editor-tables/table-map';
|
|
3
4
|
import type { TableDirection } from '../types';
|
|
4
5
|
export interface DragMenuConfig extends DropdownOptionT<Command> {
|
|
5
6
|
id: string;
|
|
7
|
+
icon?: React.ComponentType<IconProps>;
|
|
8
|
+
keymap?: string;
|
|
6
9
|
}
|
|
7
|
-
export declare const getDragMenuConfig: (direction: TableDirection, tableMap?: TableMap, index?: number) => DragMenuConfig[];
|
|
10
|
+
export declare const getDragMenuConfig: (direction: TableDirection, getEditorContainerWidth: GetEditorContainerWidth, tableMap?: TableMap, index?: number, targetCellPosition?: number, selectionRect?: Rect) => DragMenuConfig[];
|
|
@@ -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,
|
|
5
|
+
export { isCell, isCornerButton, isInsertRowButton, isColumnControlsDecorations, isTableControlsButton, isTableContainerOrWrapper, isRowControlsButton, isDragRowControlsButton, isDragColumnFloatingInsertDot, isDragRowFloatingInsertDot, isDragCornerButton, 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';
|
|
@@ -253,9 +253,6 @@ export declare const TableCssClassName: {
|
|
|
253
253
|
COLUMN_CONTROLS: string;
|
|
254
254
|
COLUMN_CONTROLS_DECORATIONS: string;
|
|
255
255
|
COLUMN_SELECTED: string;
|
|
256
|
-
COLUMN_CONTROLS_WRAPPER: string;
|
|
257
|
-
COLUMN_DROP_TARGET_CONTROLS: string;
|
|
258
|
-
COLUMN_CONTROLS_INNER: string;
|
|
259
256
|
ROW_CONTROLS_WRAPPER: string;
|
|
260
257
|
ROW_CONTROLS: string;
|
|
261
258
|
ROW_CONTROLS_INNER: string;
|
|
@@ -290,7 +287,12 @@ export declare const TableCssClassName: {
|
|
|
290
287
|
DRAG_COLUMN_CONTROLS: string;
|
|
291
288
|
DRAG_COLUMN_FLOATING_INSERT_DOT_WRAPPER: string;
|
|
292
289
|
DRAG_COLUMN_FLOATING_INSERT_DOT: string;
|
|
290
|
+
DRAG_COLUMN_CONTROLS_WRAPPER: string;
|
|
291
|
+
DRAG_COLUMN_DROP_TARGET_CONTROLS: string;
|
|
292
|
+
DRAG_COLUMN_CONTROLS_INNER: string;
|
|
293
293
|
DRAG_HANDLE_BUTTON_CONTAINER: string;
|
|
294
|
+
DRAG_CORNER_BUTTON: string;
|
|
295
|
+
DRAG_CORNER_BUTTON_INNER: string;
|
|
294
296
|
/** Other classes */
|
|
295
297
|
NUMBERED_COLUMN: string;
|
|
296
298
|
NUMBERED_COLUMN_BUTTON: string;
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
/** @jsx jsx */
|
|
2
|
+
import { jsx } from '@emotion/react';
|
|
3
|
+
import type { GetEditorContainerWidth } from '@atlaskit/editor-common/types';
|
|
2
4
|
import type { Node as PmNode } from '@atlaskit/editor-prosemirror/model';
|
|
3
5
|
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
4
6
|
import type { PluginConfig, TableDirection } from '../../types';
|
|
@@ -14,6 +16,7 @@ type DragMenuProps = {
|
|
|
14
16
|
boundariesElement?: HTMLElement;
|
|
15
17
|
scrollableElement?: HTMLElement;
|
|
16
18
|
pluginConfig?: PluginConfig;
|
|
19
|
+
getEditorContainerWidth: GetEditorContainerWidth;
|
|
17
20
|
};
|
|
18
|
-
export declare const DragMenu: ({ direction, index, isOpen, editorView, tableNode, mountPoint, boundariesElement, scrollableElement, }: DragMenuProps) => JSX.Element | null;
|
|
21
|
+
export declare const DragMenu: ({ direction, index, isOpen, editorView, tableNode, mountPoint, boundariesElement, scrollableElement, targetCellPosition, getEditorContainerWidth, }: DragMenuProps) => jsx.JSX.Element | null;
|
|
19
22
|
export {};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
+
import type { GetEditorContainerWidth } from '@atlaskit/editor-common/types';
|
|
2
3
|
import type { Node as PmNode } from '@atlaskit/editor-prosemirror/model';
|
|
3
4
|
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
4
5
|
import type { TableDirection } from '../../types';
|
|
@@ -13,9 +14,10 @@ export interface Props {
|
|
|
13
14
|
direction?: TableDirection;
|
|
14
15
|
index?: number;
|
|
15
16
|
targetCellPosition?: number;
|
|
17
|
+
getEditorContainerWidth: GetEditorContainerWidth;
|
|
16
18
|
}
|
|
17
19
|
declare const FloatingDragMenu: {
|
|
18
|
-
({ mountPoint, boundariesElement, scrollableElement, editorView, isOpen, tableRef, tableNode, direction, index, targetCellPosition, }: Props): JSX.Element | null;
|
|
20
|
+
({ mountPoint, boundariesElement, scrollableElement, editorView, isOpen, tableRef, tableNode, direction, index, targetCellPosition, getEditorContainerWidth, }: Props): JSX.Element | null;
|
|
19
21
|
displayName: string;
|
|
20
22
|
};
|
|
21
23
|
export default FloatingDragMenu;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { WrappedComponentProps } from 'react-intl-next';
|
|
3
|
+
import type { CornerControlProps } from './types';
|
|
4
|
+
export declare const CornerControls: React.FC<import("react-intl-next").WithIntlProps<CornerControlProps & WrappedComponentProps<"intl">>> & {
|
|
5
|
+
WrappedComponent: React.ComponentType<CornerControlProps & WrappedComponentProps<"intl">>;
|
|
6
|
+
};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { WrappedComponentProps } from 'react-intl-next';
|
|
3
|
+
import type { CornerControlProps } from './types';
|
|
4
|
+
export declare const DragCornerControls: React.FC<import("react-intl-next").WithIntlProps<CornerControlProps & WrappedComponentProps<"intl">>> & {
|
|
5
|
+
WrappedComponent: React.ComponentType<CornerControlProps & WrappedComponentProps<"intl">>;
|
|
6
|
+
};
|
|
@@ -1,16 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
4
|
-
export interface Props {
|
|
5
|
-
editorView: EditorView;
|
|
6
|
-
tableRef?: HTMLTableElement;
|
|
7
|
-
isInDanger?: boolean;
|
|
8
|
-
isResizing?: boolean;
|
|
9
|
-
hoveredRows?: number[];
|
|
10
|
-
isHeaderColumnEnabled?: boolean;
|
|
11
|
-
isHeaderRowEnabled?: boolean;
|
|
12
|
-
stickyTop?: number;
|
|
13
|
-
}
|
|
14
|
-
export declare const CornerControls: React.FC<import("react-intl-next").WithIntlProps<Props & WrappedComponentProps<"intl">>> & {
|
|
15
|
-
WrappedComponent: React.ComponentType<Props & WrappedComponentProps<"intl">>;
|
|
16
|
-
};
|
|
1
|
+
export { CornerControls } from './ClassicCornerControls';
|
|
2
|
+
export { DragCornerControls } from './DragCornerControls';
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
2
|
+
export type CornerControlProps = {
|
|
3
|
+
editorView: EditorView;
|
|
4
|
+
tableRef?: HTMLTableElement;
|
|
5
|
+
isInDanger?: boolean;
|
|
6
|
+
isResizing?: boolean;
|
|
7
|
+
hoveredRows?: number[];
|
|
8
|
+
isHeaderColumnEnabled?: boolean;
|
|
9
|
+
isHeaderRowEnabled?: boolean;
|
|
10
|
+
stickyTop?: number;
|
|
11
|
+
};
|
|
@@ -1,2 +1,6 @@
|
|
|
1
1
|
export { DragHandleIcon } from './DragHandleIcon';
|
|
2
2
|
export { DragInMotionIcon } from './DragInMotionIcon';
|
|
3
|
+
export { AddRowAboveIcon } from './AddRowAboveIcon';
|
|
4
|
+
export { AddRowBelowIcon } from './AddRowBelowIcon';
|
|
5
|
+
export { AddColLeftIcon } from './AddColLeftIcon';
|
|
6
|
+
export { AddColRightIcon } from './AddColRightIcon';
|
|
@@ -4,6 +4,7 @@ export declare const HeaderButton: (props: ThemeProps, cssString?: string) => im
|
|
|
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
6
|
export declare const dragInsertButtonWrapper: (props: ThemeProps) => import("@emotion/react").SerializedStyles;
|
|
7
|
+
export declare const dragCornerControlButton: (props: ThemeProps) => import("@emotion/react").SerializedStyles;
|
|
7
8
|
export declare const insertColumnButtonWrapper: (props: ThemeProps) => import("@emotion/react").SerializedStyles;
|
|
8
9
|
export declare const insertRowButtonWrapper: (props: ThemeProps) => import("@emotion/react").SerializedStyles;
|
|
9
10
|
export declare const columnControlsLineMarker: () => import("@emotion/react").SerializedStyles;
|
|
@@ -12,10 +12,11 @@ export declare const isResizeHandleDecoration: (node: HTMLElement | null) => boo
|
|
|
12
12
|
export declare const isTableControlsButton: (node: HTMLElement | null) => boolean;
|
|
13
13
|
export declare const isTableContainerOrWrapper: (node: HTMLElement | null) => boolean;
|
|
14
14
|
/** drag-and-drop classes */
|
|
15
|
-
export declare const
|
|
15
|
+
export declare const isDragRowControlsButton: (node: HTMLElement | null) => true | HTMLElement | null;
|
|
16
16
|
export declare const isDragRowFloatingInsertDot: (node: HTMLElement | null) => boolean;
|
|
17
17
|
export declare const isDragColumnFloatingInsertDot: (node: HTMLElement | null) => boolean;
|
|
18
|
-
export declare const
|
|
18
|
+
export declare const isDragCornerButton: (node: HTMLElement | null) => boolean;
|
|
19
|
+
export declare const getMousePositionHorizontalRelativeByElement: (mouseEvent: MouseEvent, elementContentRects?: ElementContentRects, gapInPixels?: number, isDragAndDropEnabled?: boolean) => 'left' | 'right' | null;
|
|
19
20
|
export declare const getMousePositionVerticalRelativeByElement: (mouseEvent: MouseEvent) => 'top' | 'bottom' | null;
|
|
20
21
|
export declare const updateResizeHandles: (tableRef?: HTMLElement) => void;
|
|
21
22
|
export declare const hasResizeHandler: ({ columnEndIndexTarget, target, }: {
|
|
@@ -1,7 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
import type {
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import type { Command, DropdownOptionT, GetEditorContainerWidth, IconProps } from '@atlaskit/editor-common/types';
|
|
3
|
+
import type { Rect, TableMap } from '@atlaskit/editor-tables/table-map';
|
|
3
4
|
import type { TableDirection } from '../types';
|
|
4
5
|
export interface DragMenuConfig extends DropdownOptionT<Command> {
|
|
5
6
|
id: string;
|
|
7
|
+
icon?: React.ComponentType<IconProps>;
|
|
8
|
+
keymap?: string;
|
|
6
9
|
}
|
|
7
|
-
export declare const getDragMenuConfig: (direction: TableDirection, tableMap?: TableMap, index?: number) => DragMenuConfig[];
|
|
10
|
+
export declare const getDragMenuConfig: (direction: TableDirection, getEditorContainerWidth: GetEditorContainerWidth, tableMap?: TableMap, index?: number, targetCellPosition?: number, selectionRect?: Rect) => DragMenuConfig[];
|
|
@@ -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,
|
|
5
|
+
export { isCell, isCornerButton, isInsertRowButton, isColumnControlsDecorations, isTableControlsButton, isTableContainerOrWrapper, isRowControlsButton, isDragRowControlsButton, isDragColumnFloatingInsertDot, isDragRowFloatingInsertDot, isDragCornerButton, 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.16",
|
|
4
4
|
"description": "Table plugin for the @atlaskit/editor",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
"dependencies": {
|
|
30
30
|
"@atlaskit/adf-schema": "^32.0.0",
|
|
31
31
|
"@atlaskit/custom-steps": "^0.0.2",
|
|
32
|
-
"@atlaskit/editor-common": "^76.
|
|
32
|
+
"@atlaskit/editor-common": "^76.16.0",
|
|
33
33
|
"@atlaskit/editor-palette": "1.5.1",
|
|
34
34
|
"@atlaskit/editor-plugin-analytics": "^0.2.0",
|
|
35
35
|
"@atlaskit/editor-plugin-content-insertion": "^0.1.0",
|
|
@@ -56,6 +56,7 @@ import {
|
|
|
56
56
|
isColumnControlsDecorations,
|
|
57
57
|
isCornerButton,
|
|
58
58
|
isDragColumnFloatingInsertDot,
|
|
59
|
+
isDragCornerButton,
|
|
59
60
|
isDragRowFloatingInsertDot,
|
|
60
61
|
isInsertRowButton,
|
|
61
62
|
isResizeHandleDecoration,
|
|
@@ -237,7 +238,8 @@ export const handleMouseDown = (_: EditorView, event: Event) => {
|
|
|
237
238
|
event.target instanceof HTMLElement &&
|
|
238
239
|
(isTableContainerOrWrapper(event.target) ||
|
|
239
240
|
isColumnControlsDecorations(event.target) ||
|
|
240
|
-
isRowControlsButton(event.target)
|
|
241
|
+
isRowControlsButton(event.target) ||
|
|
242
|
+
isDragCornerButton(event.target))
|
|
241
243
|
);
|
|
242
244
|
|
|
243
245
|
if (isControl) {
|
|
@@ -326,13 +328,16 @@ export const handleMouseMove = (
|
|
|
326
328
|
isDragColumnFloatingInsertDot(element)
|
|
327
329
|
) {
|
|
328
330
|
const { state, dispatch } = view;
|
|
329
|
-
const { insertColumnButtonIndex } =
|
|
331
|
+
const { insertColumnButtonIndex, isDragAndDropEnabled } =
|
|
332
|
+
getPluginState(state);
|
|
330
333
|
const [startIndex, endIndex] = getColumnOrRowIndex(element);
|
|
331
334
|
|
|
332
335
|
const positionColumn =
|
|
333
336
|
getMousePositionHorizontalRelativeByElement(
|
|
334
337
|
event as MouseEvent,
|
|
335
338
|
elementContentRects,
|
|
339
|
+
undefined,
|
|
340
|
+
isDragAndDropEnabled,
|
|
336
341
|
) === 'right'
|
|
337
342
|
? endIndex
|
|
338
343
|
: startIndex;
|
|
@@ -482,6 +482,7 @@ const tablesPlugin: TablePlugin = ({ config: options, api }) => {
|
|
|
482
482
|
direction={dragAndDropState?.dragMenuDirection}
|
|
483
483
|
index={dragAndDropState?.dragMenuIndex}
|
|
484
484
|
isOpen={!!dragAndDropState?.isDragMenuOpen && !isResizing}
|
|
485
|
+
getEditorContainerWidth={defaultGetEditorContainerWidth}
|
|
485
486
|
/>
|
|
486
487
|
)}
|
|
487
488
|
{allowControls && !isDragAndDropEnabled && !isResizing && (
|
|
@@ -17,7 +17,12 @@ import {
|
|
|
17
17
|
import { getPluginState as getTablePluginState } from '../plugin-factory';
|
|
18
18
|
|
|
19
19
|
import { DragAndDropActionType } from './actions';
|
|
20
|
-
import {
|
|
20
|
+
import {
|
|
21
|
+
clearDropTarget,
|
|
22
|
+
moveSource,
|
|
23
|
+
setDropTarget,
|
|
24
|
+
toggleDragMenu,
|
|
25
|
+
} from './commands';
|
|
21
26
|
import { DropTargetType } from './consts';
|
|
22
27
|
import { createPluginState, getPluginState } from './plugin-factory';
|
|
23
28
|
import { pluginKey } from './plugin-key';
|
|
@@ -99,6 +104,7 @@ export const createPlugin = (
|
|
|
99
104
|
},
|
|
100
105
|
onDragStart: ({ location }) => {
|
|
101
106
|
autoScroller.start({ input: location.current.input });
|
|
107
|
+
toggleDragMenu(false)(editorView.state, editorView.dispatch);
|
|
102
108
|
},
|
|
103
109
|
onDrag(event) {
|
|
104
110
|
autoScroller.updateInput({
|
|
@@ -273,10 +273,6 @@ export const TableCssClassName = {
|
|
|
273
273
|
COLUMN_CONTROLS_DECORATIONS: `${tablePrefixSelector}-column-controls-decoration`,
|
|
274
274
|
COLUMN_SELECTED: `${tablePrefixSelector}-column__selected`,
|
|
275
275
|
|
|
276
|
-
COLUMN_CONTROLS_WRAPPER: `${tablePrefixSelector}-col-controls-wrapper`,
|
|
277
|
-
COLUMN_DROP_TARGET_CONTROLS: `${tablePrefixSelector}-col-drop-target-controls`,
|
|
278
|
-
COLUMN_CONTROLS_INNER: `${tablePrefixSelector}-col-controls__inner`,
|
|
279
|
-
|
|
280
276
|
ROW_CONTROLS_WRAPPER: `${tablePrefixSelector}-row-controls-wrapper`,
|
|
281
277
|
ROW_CONTROLS: `${tablePrefixSelector}-row-controls`,
|
|
282
278
|
ROW_CONTROLS_INNER: `${tablePrefixSelector}-row-controls__inner`,
|
|
@@ -320,8 +316,15 @@ export const TableCssClassName = {
|
|
|
320
316
|
DRAG_COLUMN_FLOATING_INSERT_DOT_WRAPPER: `${tablePrefixSelector}-drag-columns-floating-insert-dot-wrapper`,
|
|
321
317
|
DRAG_COLUMN_FLOATING_INSERT_DOT: `${tablePrefixSelector}-drag-columns-floating-insert-dot`,
|
|
322
318
|
|
|
319
|
+
DRAG_COLUMN_CONTROLS_WRAPPER: `${tablePrefixSelector}-col-controls-wrapper`,
|
|
320
|
+
DRAG_COLUMN_DROP_TARGET_CONTROLS: `${tablePrefixSelector}-col-drop-target-controls`,
|
|
321
|
+
DRAG_COLUMN_CONTROLS_INNER: `${tablePrefixSelector}-col-controls__inner`,
|
|
322
|
+
|
|
323
323
|
DRAG_HANDLE_BUTTON_CONTAINER: `${tablePrefixSelector}-drag-handle-button-container`,
|
|
324
324
|
|
|
325
|
+
DRAG_CORNER_BUTTON: `${tablePrefixSelector}-drag-corner-button`,
|
|
326
|
+
DRAG_CORNER_BUTTON_INNER: `${tablePrefixSelector}-drag-corner-button-inner`,
|
|
327
|
+
|
|
325
328
|
/** Other classes */
|
|
326
329
|
NUMBERED_COLUMN: `${tablePrefixSelector}-numbered-column`,
|
|
327
330
|
NUMBERED_COLUMN_BUTTON: `${tablePrefixSelector}-numbered-column__button`,
|
|
@@ -1,6 +1,10 @@
|
|
|
1
|
-
|
|
1
|
+
/** @jsx jsx */
|
|
2
|
+
import { jsx } from '@emotion/react';
|
|
2
3
|
|
|
3
|
-
import type {
|
|
4
|
+
import type {
|
|
5
|
+
Command,
|
|
6
|
+
GetEditorContainerWidth,
|
|
7
|
+
} from '@atlaskit/editor-common/types';
|
|
4
8
|
import {
|
|
5
9
|
ArrowKeyNavigationType,
|
|
6
10
|
DropdownMenu,
|
|
@@ -8,10 +12,19 @@ import {
|
|
|
8
12
|
import type { MenuItem } from '@atlaskit/editor-common/ui-menu';
|
|
9
13
|
import type { Node as PmNode } from '@atlaskit/editor-prosemirror/model';
|
|
10
14
|
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
15
|
+
import { shortcutStyle } from '@atlaskit/editor-shared-styles/shortcut';
|
|
11
16
|
import { TableMap } from '@atlaskit/editor-tables/table-map';
|
|
17
|
+
import {
|
|
18
|
+
findCellRectClosestToPos,
|
|
19
|
+
getSelectionRect,
|
|
20
|
+
isSelectionType,
|
|
21
|
+
} from '@atlaskit/editor-tables/utils';
|
|
22
|
+
import { token } from '@atlaskit/tokens';
|
|
12
23
|
|
|
24
|
+
import { clearHoverSelection, hoverColumns, hoverRows } from '../../commands';
|
|
13
25
|
import { toggleDragMenu } from '../../pm-plugins/drag-and-drop/commands';
|
|
14
26
|
import type { PluginConfig, TableDirection } from '../../types';
|
|
27
|
+
import { getSelectedColumnIndexes, getSelectedRowIndexes } from '../../utils';
|
|
15
28
|
import type { DragMenuConfig } from '../../utils/drag-menu';
|
|
16
29
|
import { getDragMenuConfig } from '../../utils/drag-menu';
|
|
17
30
|
import { dragMenuDropdownWidth } from '../consts';
|
|
@@ -28,6 +41,7 @@ type DragMenuProps = {
|
|
|
28
41
|
boundariesElement?: HTMLElement;
|
|
29
42
|
scrollableElement?: HTMLElement;
|
|
30
43
|
pluginConfig?: PluginConfig;
|
|
44
|
+
getEditorContainerWidth: GetEditorContainerWidth;
|
|
31
45
|
};
|
|
32
46
|
|
|
33
47
|
const convertToDropdownItems = (dragMenuConfig: DragMenuConfig[]) => {
|
|
@@ -39,6 +53,19 @@ const convertToDropdownItems = (dragMenuConfig: DragMenuConfig[]) => {
|
|
|
39
53
|
content: item.title,
|
|
40
54
|
value: { name: item.id },
|
|
41
55
|
isDisabled: item.disabled,
|
|
56
|
+
elemBefore: item.icon ? (
|
|
57
|
+
<div
|
|
58
|
+
style={{
|
|
59
|
+
marginRight: token('space.negative.075', '-6px'),
|
|
60
|
+
display: 'flex',
|
|
61
|
+
}}
|
|
62
|
+
>
|
|
63
|
+
<item.icon label={item.title} />
|
|
64
|
+
</div>
|
|
65
|
+
) : undefined,
|
|
66
|
+
elemAfter: item.keymap ? (
|
|
67
|
+
<div css={shortcutStyle}>{item.keymap}</div>
|
|
68
|
+
) : undefined,
|
|
42
69
|
});
|
|
43
70
|
item.onClick && (menuCallback[item.id] = item.onClick);
|
|
44
71
|
});
|
|
@@ -54,10 +81,25 @@ export const DragMenu = ({
|
|
|
54
81
|
mountPoint,
|
|
55
82
|
boundariesElement,
|
|
56
83
|
scrollableElement,
|
|
84
|
+
targetCellPosition,
|
|
85
|
+
getEditorContainerWidth,
|
|
57
86
|
}: DragMenuProps) => {
|
|
58
87
|
const tableMap = tableNode ? TableMap.get(tableNode) : undefined;
|
|
59
88
|
|
|
60
|
-
const
|
|
89
|
+
const { state, dispatch } = editorView;
|
|
90
|
+
const { selection } = state;
|
|
91
|
+
const selectionRect = isSelectionType(selection, 'cell')
|
|
92
|
+
? getSelectionRect(selection)!
|
|
93
|
+
: findCellRectClosestToPos(selection.$from);
|
|
94
|
+
|
|
95
|
+
const dragMenuConfig = getDragMenuConfig(
|
|
96
|
+
direction,
|
|
97
|
+
getEditorContainerWidth,
|
|
98
|
+
tableMap,
|
|
99
|
+
index,
|
|
100
|
+
targetCellPosition,
|
|
101
|
+
selectionRect,
|
|
102
|
+
);
|
|
61
103
|
|
|
62
104
|
const { menuItems, menuCallback } = convertToDropdownItems(dragMenuConfig);
|
|
63
105
|
|
|
@@ -66,11 +108,34 @@ export const DragMenu = ({
|
|
|
66
108
|
toggleDragMenu(false)(state, dispatch);
|
|
67
109
|
};
|
|
68
110
|
|
|
69
|
-
const
|
|
70
|
-
menuCallback[item.value.name]?.(
|
|
111
|
+
const handleMenuItemActivated = ({ item }: { item: MenuItem }) => {
|
|
112
|
+
menuCallback[item.value.name]?.(state, dispatch);
|
|
71
113
|
closeMenu();
|
|
72
114
|
};
|
|
73
115
|
|
|
116
|
+
const handleItemMouseEnter = ({ item }: { item: MenuItem }) => {
|
|
117
|
+
if (!selectionRect || !item.value.name?.startsWith('delete')) {
|
|
118
|
+
return;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
(item.value.name === 'delete_column'
|
|
122
|
+
? hoverColumns(getSelectedColumnIndexes(selectionRect), true)
|
|
123
|
+
: hoverRows(getSelectedRowIndexes(selectionRect), true))(state, dispatch);
|
|
124
|
+
};
|
|
125
|
+
|
|
126
|
+
const handleItemMouseLeave = ({ item }: { item: any }) => {
|
|
127
|
+
if (
|
|
128
|
+
[
|
|
129
|
+
'sort_column_asc',
|
|
130
|
+
'sort_column_desc',
|
|
131
|
+
'delete_column',
|
|
132
|
+
'delete_row',
|
|
133
|
+
].indexOf(item.value.name) > -1
|
|
134
|
+
) {
|
|
135
|
+
clearHoverSelection()(state, dispatch);
|
|
136
|
+
}
|
|
137
|
+
};
|
|
138
|
+
|
|
74
139
|
if (!menuItems) {
|
|
75
140
|
return null;
|
|
76
141
|
}
|
|
@@ -91,7 +156,9 @@ export const DragMenu = ({
|
|
|
91
156
|
]}
|
|
92
157
|
isOpen={isOpen}
|
|
93
158
|
onOpenChange={closeMenu}
|
|
94
|
-
onItemActivated={
|
|
159
|
+
onItemActivated={handleMenuItemActivated}
|
|
160
|
+
onMouseEnter={handleItemMouseEnter}
|
|
161
|
+
onMouseLeave={handleItemMouseLeave}
|
|
95
162
|
fitWidth={dragMenuDropdownWidth}
|
|
96
163
|
boundariesElement={boundariesElement}
|
|
97
164
|
/>
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
|
|
3
|
+
import type { GetEditorContainerWidth } from '@atlaskit/editor-common/types';
|
|
3
4
|
import { Popup } from '@atlaskit/editor-common/ui';
|
|
4
5
|
import type { Node as PmNode } from '@atlaskit/editor-prosemirror/model';
|
|
5
6
|
import { findDomRefAtPos } from '@atlaskit/editor-prosemirror/utils';
|
|
@@ -23,6 +24,7 @@ export interface Props {
|
|
|
23
24
|
direction?: TableDirection;
|
|
24
25
|
index?: number;
|
|
25
26
|
targetCellPosition?: number;
|
|
27
|
+
getEditorContainerWidth: GetEditorContainerWidth;
|
|
26
28
|
}
|
|
27
29
|
|
|
28
30
|
const FloatingDragMenu = ({
|
|
@@ -36,6 +38,7 @@ const FloatingDragMenu = ({
|
|
|
36
38
|
direction,
|
|
37
39
|
index,
|
|
38
40
|
targetCellPosition,
|
|
41
|
+
getEditorContainerWidth,
|
|
39
42
|
}: Props) => {
|
|
40
43
|
if (
|
|
41
44
|
!isOpen ||
|
|
@@ -81,6 +84,8 @@ const FloatingDragMenu = ({
|
|
|
81
84
|
tableNode={tableNode}
|
|
82
85
|
direction={direction}
|
|
83
86
|
index={index}
|
|
87
|
+
targetCellPosition={targetCellPosition}
|
|
88
|
+
getEditorContainerWidth={getEditorContainerWidth}
|
|
84
89
|
/>
|
|
85
90
|
</Popup>
|
|
86
91
|
);
|
|
@@ -81,6 +81,14 @@ export class FloatingInsertButton extends React.Component<
|
|
|
81
81
|
dispatchAnalyticsEvent,
|
|
82
82
|
} = this.props;
|
|
83
83
|
|
|
84
|
+
// TODO: temporarily disable insert button for first column and row https://atlassian.slack.com/archives/C05U8HRQM50/p1698363744682219?thread_ts=1698209039.104909&cid=C05U8HRQM50
|
|
85
|
+
if (
|
|
86
|
+
isDragAndDropEnabled &&
|
|
87
|
+
(insertColumnButtonIndex === 0 || insertRowButtonIndex === 0)
|
|
88
|
+
) {
|
|
89
|
+
return null;
|
|
90
|
+
}
|
|
91
|
+
|
|
84
92
|
const type =
|
|
85
93
|
typeof insertColumnButtonIndex !== 'undefined'
|
|
86
94
|
? 'column'
|
|
@@ -5,7 +5,6 @@ import type { Selection } from '@atlaskit/editor-prosemirror/state';
|
|
|
5
5
|
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
6
6
|
import { CellSelection } from '@atlaskit/editor-tables';
|
|
7
7
|
import { getSelectionRect } from '@atlaskit/editor-tables/utils';
|
|
8
|
-
import { token } from '@atlaskit/tokens';
|
|
9
8
|
|
|
10
9
|
import {
|
|
11
10
|
clearHoverSelection,
|
|
@@ -108,7 +107,7 @@ export const ColumnControls = ({
|
|
|
108
107
|
return (
|
|
109
108
|
<div className={ClassName.DRAG_COLUMN_CONTROLS}>
|
|
110
109
|
<div
|
|
111
|
-
className={ClassName.
|
|
110
|
+
className={ClassName.DRAG_COLUMN_CONTROLS_INNER}
|
|
112
111
|
data-testid="table-floating-column-controls"
|
|
113
112
|
style={{
|
|
114
113
|
gridTemplateColumns: widths,
|
|
@@ -127,7 +126,8 @@ export const ColumnControls = ({
|
|
|
127
126
|
contentEditable={false}
|
|
128
127
|
key={index}
|
|
129
128
|
>
|
|
130
|
-
{
|
|
129
|
+
{/* TODO: Disabling first column insert button https://atlassian.slack.com/archives/C05U8HRQM50/p1698363744682219?thread_ts=1698209039.104909&cid=C05U8HRQM50 */}
|
|
130
|
+
{/* {!hasHeaderColumn && index === 0 && (
|
|
131
131
|
<div
|
|
132
132
|
style={{
|
|
133
133
|
left: '0px',
|
|
@@ -135,7 +135,7 @@ export const ColumnControls = ({
|
|
|
135
135
|
}}
|
|
136
136
|
className={ClassName.DRAG_COLUMN_FLOATING_INSERT_DOT}
|
|
137
137
|
/>
|
|
138
|
-
)}
|
|
138
|
+
)} */}
|
|
139
139
|
<div
|
|
140
140
|
className={ClassName.DRAG_COLUMN_FLOATING_INSERT_DOT}
|
|
141
141
|
style={columnParams.length - 1 === index ? { right: '0' } : {}}
|
|
@@ -149,12 +149,10 @@ export const ColumnControls = ({
|
|
|
149
149
|
<div
|
|
150
150
|
style={{
|
|
151
151
|
gridColumn: gridColumnPosition,
|
|
152
|
-
zIndex: 99,
|
|
153
152
|
display: 'flex',
|
|
154
|
-
width: '100%',
|
|
155
153
|
justifyContent: 'center',
|
|
156
154
|
alignItems: 'center',
|
|
157
|
-
|
|
155
|
+
zIndex: 99,
|
|
158
156
|
}}
|
|
159
157
|
data-column-control-index={hoveredCell.colIndex}
|
|
160
158
|
data-testid="table-floating-column-control"
|