@atlaskit/editor-plugin-table 7.19.11 → 7.20.0
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 +28 -0
- package/dist/cjs/commands/column-resize.js +1 -1
- package/dist/cjs/commands/selection.js +25 -4
- package/dist/cjs/nodeviews/table.js +2 -4
- package/dist/cjs/plugin.js +59 -56
- package/dist/cjs/pm-plugins/drag-and-drop/commands-with-analytics.js +23 -9
- package/dist/cjs/pm-plugins/keymap.js +6 -6
- package/dist/cjs/pm-plugins/main.js +1 -1
- package/dist/cjs/pm-plugins/table-selection-keymap.js +6 -3
- package/dist/cjs/toolbar.js +8 -5
- package/dist/cjs/ui/FloatingDragMenu/DragMenu.js +3 -2
- package/dist/cjs/ui/FloatingDragMenu/index.js +5 -3
- package/dist/cjs/ui/TableFloatingControls/index.js +8 -2
- package/dist/cjs/utils/drag-menu.js +5 -1
- package/dist/es2019/commands/column-resize.js +2 -2
- package/dist/es2019/commands/selection.js +25 -4
- package/dist/es2019/nodeviews/table.js +3 -5
- package/dist/es2019/plugin.js +11 -7
- package/dist/es2019/pm-plugins/drag-and-drop/commands-with-analytics.js +18 -3
- package/dist/es2019/pm-plugins/keymap.js +7 -7
- package/dist/es2019/pm-plugins/main.js +2 -2
- package/dist/es2019/pm-plugins/table-selection-keymap.js +6 -3
- package/dist/es2019/toolbar.js +8 -5
- package/dist/es2019/ui/FloatingDragMenu/DragMenu.js +3 -2
- package/dist/es2019/ui/FloatingDragMenu/index.js +6 -4
- package/dist/es2019/ui/TableFloatingControls/index.js +9 -3
- package/dist/es2019/utils/drag-menu.js +6 -2
- package/dist/esm/commands/column-resize.js +2 -2
- package/dist/esm/commands/selection.js +25 -4
- package/dist/esm/nodeviews/table.js +3 -5
- package/dist/esm/plugin.js +60 -57
- package/dist/esm/pm-plugins/drag-and-drop/commands-with-analytics.js +23 -9
- package/dist/esm/pm-plugins/keymap.js +7 -7
- package/dist/esm/pm-plugins/main.js +2 -2
- package/dist/esm/pm-plugins/table-selection-keymap.js +6 -3
- package/dist/esm/toolbar.js +8 -5
- package/dist/esm/ui/FloatingDragMenu/DragMenu.js +3 -2
- package/dist/esm/ui/FloatingDragMenu/index.js +6 -4
- package/dist/esm/ui/TableFloatingControls/index.js +9 -3
- package/dist/esm/utils/drag-menu.js +5 -1
- package/dist/types/commands/selection.d.ts +4 -2
- package/dist/types/nodeviews/table.d.ts +1 -2
- package/dist/types/nodeviews/types.d.ts +1 -3
- package/dist/types/pm-plugins/drag-and-drop/commands-with-analytics.d.ts +4 -2
- package/dist/types/pm-plugins/main.d.ts +1 -2
- package/dist/types/pm-plugins/table-selection-keymap.d.ts +3 -3
- package/dist/types/toolbar.d.ts +2 -2
- package/dist/types/ui/FloatingDragMenu/DragMenu.d.ts +3 -1
- package/dist/types/ui/FloatingDragMenu/index.d.ts +3 -1
- package/dist/types/utils/drag-menu.d.ts +2 -1
- package/dist/types-ts4.5/commands/selection.d.ts +4 -2
- package/dist/types-ts4.5/nodeviews/table.d.ts +1 -2
- package/dist/types-ts4.5/nodeviews/types.d.ts +1 -3
- package/dist/types-ts4.5/pm-plugins/drag-and-drop/commands-with-analytics.d.ts +4 -2
- package/dist/types-ts4.5/pm-plugins/main.d.ts +1 -2
- package/dist/types-ts4.5/pm-plugins/table-selection-keymap.d.ts +3 -3
- package/dist/types-ts4.5/toolbar.d.ts +2 -2
- package/dist/types-ts4.5/ui/FloatingDragMenu/DragMenu.d.ts +3 -1
- package/dist/types-ts4.5/ui/FloatingDragMenu/index.d.ts +3 -1
- package/dist/types-ts4.5/utils/drag-menu.d.ts +2 -1
- package/package.json +8 -5
- package/src/commands/column-resize.ts +2 -2
- package/src/commands/selection.ts +49 -4
- package/src/nodeviews/table.tsx +3 -10
- package/src/nodeviews/types.ts +1 -3
- package/src/plugin.tsx +8 -7
- package/src/pm-plugins/drag-and-drop/commands-with-analytics.ts +43 -3
- package/src/pm-plugins/keymap.ts +23 -7
- package/src/pm-plugins/main.ts +3 -4
- package/src/pm-plugins/table-selection-keymap.ts +18 -6
- package/src/toolbar.tsx +7 -1
- package/src/ui/FloatingDragMenu/DragMenu.tsx +7 -0
- package/src/ui/FloatingDragMenu/index.tsx +9 -2
- package/src/ui/TableFloatingControls/index.tsx +12 -4
- package/src/utils/drag-menu.ts +8 -1
|
@@ -1,14 +1,17 @@
|
|
|
1
1
|
import React, { useCallback } from 'react';
|
|
2
2
|
import { useSharedPluginState } from '@atlaskit/editor-common/hooks';
|
|
3
3
|
import { browser } from '@atlaskit/editor-common/utils';
|
|
4
|
-
import {
|
|
4
|
+
import { findTable } from '@atlaskit/editor-tables/utils';
|
|
5
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
5
6
|
import { hoverCell, hoverRows, selectRow, selectRows } from '../../commands';
|
|
6
7
|
import { TableCssClassName as ClassName } from '../../types';
|
|
8
|
+
import { isTableNested } from '../../utils/nodes';
|
|
7
9
|
import { CornerControls, DragCornerControls, DragCornerControlsWithSelection } from './CornerControls';
|
|
8
10
|
import { FloatingControlsWithSelection } from './FloatingControlsWithSelection';
|
|
9
11
|
import NumberColumn from './NumberColumn';
|
|
10
12
|
import { DragControls, RowControls } from './RowControls';
|
|
11
13
|
export var TableFloatingControls = function TableFloatingControls(_ref) {
|
|
14
|
+
var _findTable;
|
|
12
15
|
var editorView = _ref.editorView,
|
|
13
16
|
tableRef = _ref.tableRef,
|
|
14
17
|
tableNode = _ref.tableNode,
|
|
@@ -69,6 +72,9 @@ export var TableFloatingControls = function TableFloatingControls(_ref) {
|
|
|
69
72
|
}
|
|
70
73
|
var stickyTop = stickyHeader && stickyHeader.sticky && hasHeaderRow ? stickyHeader.top : undefined;
|
|
71
74
|
var wrapperClassName = isDragAndDropEnabled ? ClassName.DRAG_ROW_CONTROLS_WRAPPER : ClassName.ROW_CONTROLS_WRAPPER;
|
|
75
|
+
var tablePos = (_findTable = findTable(editorView.state.selection)) === null || _findTable === void 0 ? void 0 : _findTable.pos;
|
|
76
|
+
var isNested = tablePos !== undefined && isTableNested(editorView.state, tablePos);
|
|
77
|
+
var shouldShowCornerControls = fg('platform_editor_element_drag_and_drop_ed_24041') ? !(featureFlagsState !== null && featureFlagsState !== void 0 && featureFlagsState.elementDragAndDrop) || isNested : !(featureFlagsState !== null && featureFlagsState !== void 0 && featureFlagsState.elementDragAndDrop);
|
|
72
78
|
return (
|
|
73
79
|
/*#__PURE__*/
|
|
74
80
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
@@ -91,7 +97,7 @@ export var TableFloatingControls = function TableFloatingControls(_ref) {
|
|
|
91
97
|
updateCellHoverLocation: updateCellHoverLocation,
|
|
92
98
|
stickyTop: stickyTop,
|
|
93
99
|
isDragAndDropEnabled: isDragAndDropEnabled
|
|
94
|
-
}) : null, tableActive && /*#__PURE__*/React.createElement(React.Fragment, null, isDragAndDropEnabled ? /*#__PURE__*/React.createElement(React.Fragment, null,
|
|
100
|
+
}) : null, tableActive && /*#__PURE__*/React.createElement(React.Fragment, null, isDragAndDropEnabled ? /*#__PURE__*/React.createElement(React.Fragment, null, shouldShowCornerControls && (fg('platform.editor.table.use-shared-state-hook') ? /*#__PURE__*/React.createElement(DragCornerControlsWithSelection, {
|
|
95
101
|
editorView: editorView,
|
|
96
102
|
tableRef: tableRef,
|
|
97
103
|
isInDanger: isInDanger,
|
|
@@ -116,7 +122,7 @@ export var TableFloatingControls = function TableFloatingControls(_ref) {
|
|
|
116
122
|
selectRow: _selectRow,
|
|
117
123
|
selectRows: _selectRows,
|
|
118
124
|
updateCellHoverLocation: updateCellHoverLocation
|
|
119
|
-
})) :
|
|
125
|
+
})) : fg('platform.editor.table.use-shared-state-hook') ? /*#__PURE__*/React.createElement(FloatingControlsWithSelection, {
|
|
120
126
|
editorView: editorView,
|
|
121
127
|
tableRef: tableRef,
|
|
122
128
|
isInDanger: isInDanger,
|
|
@@ -13,6 +13,7 @@ import HipchatChevronDoubleDownIcon from '@atlaskit/icon/glyph/hipchat/chevron-d
|
|
|
13
13
|
import HipchatChevronDoubleUpIcon from '@atlaskit/icon/glyph/hipchat/chevron-double-up';
|
|
14
14
|
import { deleteColumnsWithAnalytics, deleteRowsWithAnalytics, distributeColumnsWidthsWithAnalytics, emptyMultipleCellsWithAnalytics, insertColumnWithAnalytics, insertRowWithAnalytics, sortColumnWithAnalytics } from '../commands-with-analytics';
|
|
15
15
|
import { moveSourceWithAnalytics } from '../pm-plugins/drag-and-drop/commands-with-analytics';
|
|
16
|
+
import { getPluginState as getTablePluginState } from '../pm-plugins/plugin-factory';
|
|
16
17
|
import { getNewResizeStateFromSelectedColumns } from '../pm-plugins/table-resizing/utils/resize-state';
|
|
17
18
|
import { getClosestSelectionRect } from '../toolbar';
|
|
18
19
|
import { AddColLeftIcon, AddColRightIcon, AddRowAboveIcon, AddRowBelowIcon } from '../ui/icons';
|
|
@@ -67,7 +68,10 @@ export var getDragMenuConfig = function getDragMenuConfig(direction, getEditorCo
|
|
|
67
68
|
var isTableFixedColumnWidthsOptionEnabled = arguments.length > 12 && arguments[12] !== undefined ? arguments[12] : false;
|
|
68
69
|
var shouldUseIncreasedScalingPercent = arguments.length > 13 && arguments[13] !== undefined ? arguments[13] : false;
|
|
69
70
|
var tableSortColumnReorder = arguments.length > 14 && arguments[14] !== undefined ? arguments[14] : false;
|
|
71
|
+
var ariaNotifyPlugin = arguments.length > 15 ? arguments[15] : undefined;
|
|
70
72
|
var selection = editorView.state.selection;
|
|
73
|
+
var _getTablePluginState = getTablePluginState(editorView.state),
|
|
74
|
+
getIntl = _getTablePluginState.getIntl;
|
|
71
75
|
var addOptions = direction === 'row' ? [{
|
|
72
76
|
label: 'above',
|
|
73
77
|
offset: 0,
|
|
@@ -226,7 +230,7 @@ export var getDragMenuConfig = function getDragMenuConfig(direction, getEditorCo
|
|
|
226
230
|
onClick: function onClick(state, dispatch) {
|
|
227
231
|
if (canMove) {
|
|
228
232
|
requestAnimationFrame(function () {
|
|
229
|
-
moveSourceWithAnalytics(editorAnalyticsAPI)(INPUT_METHOD.TABLE_CONTEXT_MENU, "table-".concat(direction), getOriginIndexes(selectionRect), getTargetIndex(selectionRect))(editorView.state, editorView.dispatch);
|
|
233
|
+
moveSourceWithAnalytics(editorAnalyticsAPI, ariaNotifyPlugin, getIntl)(INPUT_METHOD.TABLE_CONTEXT_MENU, "table-".concat(direction), getOriginIndexes(selectionRect), getTargetIndex(selectionRect))(editorView.state, editorView.dispatch);
|
|
230
234
|
});
|
|
231
235
|
return true;
|
|
232
236
|
}
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
+
import { type IntlShape } from 'react-intl-next/src/types';
|
|
1
2
|
import type { Command, ExtractInjectionAPI } from '@atlaskit/editor-common/types';
|
|
3
|
+
import type { AriaLiveElementAttributes } from '@atlaskit/editor-plugin-accessibility-utils';
|
|
2
4
|
import type tablePlugin from '../plugin';
|
|
3
5
|
export declare enum TableSelectionDirection {
|
|
4
6
|
TopToBottom = "TopToBottom",
|
|
@@ -6,7 +8,7 @@ export declare enum TableSelectionDirection {
|
|
|
6
8
|
}
|
|
7
9
|
export declare const arrowLeftFromTable: (editorSelectionAPI: ExtractInjectionAPI<typeof tablePlugin>['selection'] | undefined) => () => Command;
|
|
8
10
|
export declare const arrowRightFromTable: (editorSelectionAPI: ExtractInjectionAPI<typeof tablePlugin>['selection'] | undefined) => () => Command;
|
|
9
|
-
export declare const selectColumns: (editorSelectionAPI: ExtractInjectionAPI<typeof tablePlugin>['selection'] | undefined) => (triggeredByKeyboard?: boolean) => Command;
|
|
10
|
-
export declare const selectRows: (editorSelectionAPI: ExtractInjectionAPI<typeof tablePlugin>['selection'] | undefined) => (triggeredByKeyboard?: boolean) => Command;
|
|
11
|
+
export declare const selectColumns: (editorSelectionAPI: ExtractInjectionAPI<typeof tablePlugin>['selection'] | undefined, ariaNotify?: ((message: string, ariaLiveElementAttributes?: AriaLiveElementAttributes) => void) | undefined, getIntl?: () => IntlShape) => (triggeredByKeyboard?: boolean) => Command;
|
|
12
|
+
export declare const selectRows: (editorSelectionAPI: ExtractInjectionAPI<typeof tablePlugin>['selection'] | undefined, ariaNotify?: ((message: string, ariaLiveElementAttributes?: AriaLiveElementAttributes) => void) | undefined, getIntl?: () => IntlShape) => (triggeredByKeyboard?: boolean) => Command;
|
|
11
13
|
export declare const shiftArrowUpFromTable: (editorSelectionAPI: ExtractInjectionAPI<typeof tablePlugin>['selection'] | undefined) => () => Command;
|
|
12
14
|
export declare const modASelectTable: (editorSelectionAPI: ExtractInjectionAPI<typeof tablePlugin>['selection'] | undefined) => () => Command;
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
import type { DispatchAnalyticsEvent } from '@atlaskit/editor-common/analytics';
|
|
3
3
|
import type { EventDispatcher } from '@atlaskit/editor-common/event-dispatcher';
|
|
4
4
|
import { type PortalProviderAPI } from '@atlaskit/editor-common/portal';
|
|
5
|
-
import type { LegacyPortalProviderAPI } from '@atlaskit/editor-common/portal-provider';
|
|
6
5
|
import ReactNodeView from '@atlaskit/editor-common/react-node-view';
|
|
7
6
|
import type { GetEditorContainerWidth, GetEditorFeatureFlags, getPosHandler, getPosHandlerNode } from '@atlaskit/editor-common/types';
|
|
8
7
|
import type { Node as PmNode } from '@atlaskit/editor-prosemirror/model';
|
|
@@ -33,5 +32,5 @@ export default class TableView extends ReactNodeView<Props> {
|
|
|
33
32
|
}): boolean;
|
|
34
33
|
destroy(): void;
|
|
35
34
|
}
|
|
36
|
-
export declare const createTableView: (node: PmNode, view: EditorView, getPos: getPosHandler, portalProviderAPI:
|
|
35
|
+
export declare const createTableView: (node: PmNode, view: EditorView, getPos: getPosHandler, portalProviderAPI: PortalProviderAPI, eventDispatcher: EventDispatcher, getEditorContainerWidth: GetEditorContainerWidth, getEditorFeatureFlags: GetEditorFeatureFlags, dispatchAnalyticsEvent: DispatchAnalyticsEvent, pluginInjectionApi?: PluginInjectionAPI, isTableAlignmentEnabled?: boolean) => NodeView;
|
|
37
36
|
export {};
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import type { DispatchAnalyticsEvent } from '@atlaskit/editor-common/analytics';
|
|
2
2
|
import type { EventDispatcher } from '@atlaskit/editor-common/event-dispatcher';
|
|
3
3
|
import { type PortalProviderAPI } from '@atlaskit/editor-common/portal';
|
|
4
|
-
import type { LegacyPortalProviderAPI } from '@atlaskit/editor-common/portal-provider';
|
|
5
4
|
import type { GetEditorContainerWidth, GetEditorFeatureFlags } from '@atlaskit/editor-common/types';
|
|
6
5
|
import type { Node as PmNode } from '@atlaskit/editor-prosemirror/model';
|
|
7
6
|
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
@@ -20,13 +19,12 @@ export interface Props {
|
|
|
20
19
|
allowColumnResizing?: boolean;
|
|
21
20
|
allowControls?: boolean;
|
|
22
21
|
cellMinWidth?: number;
|
|
23
|
-
portalProviderAPI:
|
|
22
|
+
portalProviderAPI: PortalProviderAPI;
|
|
24
23
|
eventDispatcher: EventDispatcher;
|
|
25
24
|
getPos: () => number | undefined;
|
|
26
25
|
options?: TableOptions;
|
|
27
26
|
getEditorContainerWidth: GetEditorContainerWidth;
|
|
28
27
|
getEditorFeatureFlags: GetEditorFeatureFlags;
|
|
29
28
|
dispatchAnalyticsEvent: DispatchAnalyticsEvent;
|
|
30
|
-
hasIntlContext: boolean;
|
|
31
29
|
pluginInjectionApi?: PluginInjectionAPI;
|
|
32
30
|
}
|
|
@@ -1,9 +1,11 @@
|
|
|
1
|
+
import { type IntlShape } from 'react-intl-next/src/types';
|
|
1
2
|
import { INPUT_METHOD, TABLE_STATUS } from '@atlaskit/editor-common/analytics';
|
|
2
3
|
import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
|
|
3
4
|
import type { Command } from '@atlaskit/editor-common/types';
|
|
5
|
+
import type { AriaLiveElementAttributes } from '@atlaskit/editor-plugin-accessibility-utils';
|
|
4
6
|
import type { Transaction } from '@atlaskit/editor-prosemirror/state';
|
|
5
7
|
import type { DraggableData, DraggableType } from '../../types';
|
|
6
8
|
export declare const clearDropTargetWithAnalytics: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null) => (inputMethod: INPUT_METHOD.TABLE_CONTEXT_MENU | INPUT_METHOD.DRAG_AND_DROP, sourceType: DraggableType, sourceIndexes: number[] | undefined, status: TABLE_STATUS.CANCELLED | TABLE_STATUS.INVALID, tr?: Transaction) => Command;
|
|
7
|
-
export declare const moveSourceWithAnalytics: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null) => (inputMethod: INPUT_METHOD.TABLE_CONTEXT_MENU | INPUT_METHOD.DRAG_AND_DROP | INPUT_METHOD.SHORTCUT, sourceType: DraggableType, sourceIndexes: number[], targetIndex: number, tr?: Transaction) => Command;
|
|
8
|
-
export declare const moveSourceWithAnalyticsViaShortcut: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null) => (sourceType: DraggableType, direction: DraggableData['direction']) => Command;
|
|
9
|
+
export declare const moveSourceWithAnalytics: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null, ariaNotify?: ((message: string, ariaLiveElementAttributes?: AriaLiveElementAttributes) => void) | undefined, getIntl?: () => IntlShape) => (inputMethod: INPUT_METHOD.TABLE_CONTEXT_MENU | INPUT_METHOD.DRAG_AND_DROP | INPUT_METHOD.SHORTCUT, sourceType: DraggableType, sourceIndexes: number[], targetIndex: number, tr?: Transaction) => Command;
|
|
10
|
+
export declare const moveSourceWithAnalyticsViaShortcut: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null, ariaNotify?: ((message: string, ariaLiveElementAttributes?: AriaLiveElementAttributes) => void) | undefined, getIntl?: () => IntlShape) => (sourceType: DraggableType, direction: DraggableData['direction']) => Command;
|
|
9
11
|
export declare const cloneSourceWithAnalytics: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null) => (inputMethod: INPUT_METHOD.TABLE_CONTEXT_MENU | INPUT_METHOD.DRAG_AND_DROP | INPUT_METHOD.SHORTCUT, sourceType: DraggableType, sourceIndexes: number[], targetIndex: number, targetDirection: 'start' | 'end', tr?: Transaction) => Command;
|
|
@@ -2,8 +2,7 @@ import type { IntlShape } from 'react-intl-next';
|
|
|
2
2
|
import type { DispatchAnalyticsEvent, EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
|
|
3
3
|
import type { Dispatch, EventDispatcher } from '@atlaskit/editor-common/event-dispatcher';
|
|
4
4
|
import { type PortalProviderAPI } from '@atlaskit/editor-common/portal';
|
|
5
|
-
import type { LegacyPortalProviderAPI } from '@atlaskit/editor-common/portal-provider';
|
|
6
5
|
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
7
6
|
import type { GetEditorContainerWidth, GetEditorFeatureFlags } from '@atlaskit/editor-common/types';
|
|
8
7
|
import type { PluginConfig, PluginInjectionAPI } from '../types';
|
|
9
|
-
export declare const createPlugin: (dispatchAnalyticsEvent: DispatchAnalyticsEvent, dispatch: Dispatch, portalProviderAPI:
|
|
8
|
+
export declare const createPlugin: (dispatchAnalyticsEvent: DispatchAnalyticsEvent, dispatch: Dispatch, portalProviderAPI: PortalProviderAPI, eventDispatcher: EventDispatcher, pluginConfig: PluginConfig, getEditorContainerWidth: GetEditorContainerWidth, getEditorFeatureFlags: GetEditorFeatureFlags, getIntl: () => IntlShape, tableResizingEnabled?: boolean, fullWidthModeEnabled?: boolean, previousFullWidthModeEnabled?: boolean, dragAndDropEnabled?: boolean, editorAnalyticsAPI?: EditorAnalyticsAPI, pluginInjectionApi?: PluginInjectionAPI, isTableScalingEnabled?: boolean, isTableAlignmentEnabled?: boolean, shouldUseIncreasedScalingPercent?: boolean) => SafePlugin<import("../types").TablePluginState>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
+
import { type IntlShape } from 'react-intl-next/src/types';
|
|
1
2
|
import type { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
2
|
-
import type
|
|
3
|
-
|
|
4
|
-
export declare function tableSelectionKeymapPlugin(editorSelectionAPI: ExtractInjectionAPI<typeof tablePlugin>['selection'] | undefined): SafePlugin;
|
|
3
|
+
import { type PluginInjectionAPI } from '../types';
|
|
4
|
+
export declare function tableSelectionKeymapPlugin(pluginInjectionApi?: PluginInjectionAPI, getIntl?: () => IntlShape): SafePlugin;
|
|
5
5
|
export default tableSelectionKeymapPlugin;
|
package/dist/types/toolbar.d.ts
CHANGED
|
@@ -18,7 +18,7 @@ type AlignmentIcon = {
|
|
|
18
18
|
value: AlignmentOptions;
|
|
19
19
|
icon: React.ComponentClass<any>;
|
|
20
20
|
};
|
|
21
|
-
export declare const getAlignmentOptionsConfig: (editorState: EditorState, { formatMessage }: ToolbarMenuContext, editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null, getEditorContainerWidth: GetEditorContainerWidth, getDomRef: (editorView: EditorView) => HTMLElement | undefined, editorView: EditorView | null, shouldUseIncreasedScalingPercent: boolean) => Array<FloatingToolbarDropdown<Command>>;
|
|
21
|
+
export declare const getAlignmentOptionsConfig: (editorState: EditorState, { formatMessage }: ToolbarMenuContext, editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null, getEditorContainerWidth: GetEditorContainerWidth, getDomRef: (editorView: EditorView) => HTMLElement | undefined, editorView: EditorView | null, shouldUseIncreasedScalingPercent: boolean, isFullWidthEditor?: boolean) => Array<FloatingToolbarDropdown<Command>>;
|
|
22
22
|
export declare const getSelectedAlignmentIcon: (alignmentIcons: AlignmentIcon[], selectedNode: PMNode) => AlignmentIcon | undefined;
|
|
23
|
-
export declare const isLayoutOptionDisabled: (selectedNode: PMNode, getEditorContainerWidth: GetEditorContainerWidth, getDomRef: (editorView: EditorView) => HTMLElement | undefined, editorView: EditorView | null, shouldUseIncreasedScalingPercent: boolean) => boolean;
|
|
23
|
+
export declare const isLayoutOptionDisabled: (selectedNode: PMNode, getEditorContainerWidth: GetEditorContainerWidth, getDomRef: (editorView: EditorView) => HTMLElement | undefined, editorView: EditorView | null, shouldUseIncreasedScalingPercent: boolean, isFullWidthEditor: boolean | undefined) => boolean;
|
|
24
24
|
export {};
|
|
@@ -5,6 +5,7 @@ import { jsx } from '@emotion/react';
|
|
|
5
5
|
import type { WrappedComponentProps } from 'react-intl-next';
|
|
6
6
|
import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
|
|
7
7
|
import type { GetEditorContainerWidth } from '@atlaskit/editor-common/types';
|
|
8
|
+
import type { AriaLiveElementAttributes } from '@atlaskit/editor-plugin-accessibility-utils';
|
|
8
9
|
import type { Node as PmNode } from '@atlaskit/editor-prosemirror/model';
|
|
9
10
|
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
10
11
|
import type { PluginConfig, TableDirection } from '../../types';
|
|
@@ -29,8 +30,9 @@ type DragMenuProps = {
|
|
|
29
30
|
shouldUseIncreasedScalingPercent?: boolean;
|
|
30
31
|
isTableFixedColumnWidthsOptionEnabled?: boolean;
|
|
31
32
|
tableSortColumnReorder?: boolean;
|
|
33
|
+
ariaNotifyPlugin?: (message: string, ariaLiveElementAttributes?: AriaLiveElementAttributes) => void;
|
|
32
34
|
};
|
|
33
|
-
export declare const DragMenu: React.MemoExoticComponent<({ direction, index, target, isOpen, editorView, tableNode, targetCellPosition, getEditorContainerWidth, editorAnalyticsAPI, pluginConfig, intl: { formatMessage }, fitHeight, fitWidth, mountPoint, scrollableElement, boundariesElement, isTableScalingEnabled, tableDuplicateCellColouring, shouldUseIncreasedScalingPercent, isTableFixedColumnWidthsOptionEnabled, tableSortColumnReorder, }: DragMenuProps & WrappedComponentProps) => jsx.JSX.Element | null>;
|
|
35
|
+
export declare const DragMenu: React.MemoExoticComponent<({ direction, index, target, isOpen, editorView, tableNode, targetCellPosition, getEditorContainerWidth, editorAnalyticsAPI, pluginConfig, intl: { formatMessage }, fitHeight, fitWidth, mountPoint, scrollableElement, boundariesElement, isTableScalingEnabled, tableDuplicateCellColouring, shouldUseIncreasedScalingPercent, isTableFixedColumnWidthsOptionEnabled, tableSortColumnReorder, ariaNotifyPlugin, }: DragMenuProps & WrappedComponentProps) => jsx.JSX.Element | null>;
|
|
34
36
|
declare const _default: React.FC<import("react-intl-next").WithIntlProps<DragMenuProps & WrappedComponentProps>> & {
|
|
35
37
|
WrappedComponent: React.ComponentType<DragMenuProps & WrappedComponentProps>;
|
|
36
38
|
};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
|
|
3
3
|
import type { GetEditorContainerWidth, GetEditorFeatureFlags } from '@atlaskit/editor-common/types';
|
|
4
|
+
import type { AriaLiveElementAttributes } from '@atlaskit/editor-plugin-accessibility-utils';
|
|
4
5
|
import type { Node as PmNode } from '@atlaskit/editor-prosemirror/model';
|
|
5
6
|
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
6
7
|
import type { RowStickyState } from '../../pm-plugins/sticky-headers';
|
|
@@ -22,9 +23,10 @@ export interface Props {
|
|
|
22
23
|
pluginConfig?: PluginConfig;
|
|
23
24
|
isTableScalingEnabled?: boolean;
|
|
24
25
|
getEditorFeatureFlags?: GetEditorFeatureFlags;
|
|
26
|
+
ariaNotifyPlugin?: (message: string, ariaLiveElementAttributes?: AriaLiveElementAttributes) => void;
|
|
25
27
|
}
|
|
26
28
|
declare const FloatingDragMenu: {
|
|
27
|
-
({ mountPoint, boundariesElement, scrollableElement, editorView, isOpen, tableNode, direction, index, targetCellPosition, getEditorContainerWidth, editorAnalyticsAPI, stickyHeaders, pluginConfig, isTableScalingEnabled, getEditorFeatureFlags, }: Props): JSX.Element | null;
|
|
29
|
+
({ mountPoint, boundariesElement, scrollableElement, editorView, isOpen, tableNode, direction, index, targetCellPosition, getEditorContainerWidth, editorAnalyticsAPI, stickyHeaders, pluginConfig, isTableScalingEnabled, getEditorFeatureFlags, ariaNotifyPlugin, }: Props): JSX.Element | null;
|
|
28
30
|
displayName: string;
|
|
29
31
|
};
|
|
30
32
|
export default FloatingDragMenu;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
|
|
3
3
|
import type { Command, DropdownOptionT, GetEditorContainerWidth, IconProps } from '@atlaskit/editor-common/types';
|
|
4
|
+
import type { AriaLiveElementAttributes } from '@atlaskit/editor-plugin-accessibility-utils';
|
|
4
5
|
import type { Selection } from '@atlaskit/editor-prosemirror/state';
|
|
5
6
|
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
6
7
|
import type { Rect, TableMap } from '@atlaskit/editor-tables/table-map';
|
|
@@ -13,4 +14,4 @@ export interface DragMenuConfig extends Omit<DropdownOptionT<Command>, 'icon'> {
|
|
|
13
14
|
icon?: React.ComponentType<React.PropsWithChildren<IconProps>>;
|
|
14
15
|
keymap?: string;
|
|
15
16
|
}
|
|
16
|
-
export declare const getDragMenuConfig: (direction: TableDirection, getEditorContainerWidth: GetEditorContainerWidth, hasMergedCellsInTable: boolean, editorView: EditorView, tableMap?: TableMap, index?: number, targetCellPosition?: number, selectionRect?: Rect, editorAnalyticsAPI?: EditorAnalyticsAPI, isHeaderRowRequired?: boolean, isTableScalingEnabled?: boolean, tableDuplicateCellColouring?: boolean, isTableFixedColumnWidthsOptionEnabled?: boolean, shouldUseIncreasedScalingPercent?: boolean, tableSortColumnReorder?: boolean) => DragMenuConfig[];
|
|
17
|
+
export declare const getDragMenuConfig: (direction: TableDirection, getEditorContainerWidth: GetEditorContainerWidth, hasMergedCellsInTable: boolean, editorView: EditorView, tableMap?: TableMap, index?: number, targetCellPosition?: number, selectionRect?: Rect, editorAnalyticsAPI?: EditorAnalyticsAPI, isHeaderRowRequired?: boolean, isTableScalingEnabled?: boolean, tableDuplicateCellColouring?: boolean, isTableFixedColumnWidthsOptionEnabled?: boolean, shouldUseIncreasedScalingPercent?: boolean, tableSortColumnReorder?: boolean, ariaNotifyPlugin?: ((message: string, ariaLiveElementAttributes?: AriaLiveElementAttributes) => void) | undefined) => DragMenuConfig[];
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
+
import { type IntlShape } from 'react-intl-next/src/types';
|
|
1
2
|
import type { Command, ExtractInjectionAPI } from '@atlaskit/editor-common/types';
|
|
3
|
+
import type { AriaLiveElementAttributes } from '@atlaskit/editor-plugin-accessibility-utils';
|
|
2
4
|
import type tablePlugin from '../plugin';
|
|
3
5
|
export declare enum TableSelectionDirection {
|
|
4
6
|
TopToBottom = "TopToBottom",
|
|
@@ -6,7 +8,7 @@ export declare enum TableSelectionDirection {
|
|
|
6
8
|
}
|
|
7
9
|
export declare const arrowLeftFromTable: (editorSelectionAPI: ExtractInjectionAPI<typeof tablePlugin>['selection'] | undefined) => () => Command;
|
|
8
10
|
export declare const arrowRightFromTable: (editorSelectionAPI: ExtractInjectionAPI<typeof tablePlugin>['selection'] | undefined) => () => Command;
|
|
9
|
-
export declare const selectColumns: (editorSelectionAPI: ExtractInjectionAPI<typeof tablePlugin>['selection'] | undefined) => (triggeredByKeyboard?: boolean) => Command;
|
|
10
|
-
export declare const selectRows: (editorSelectionAPI: ExtractInjectionAPI<typeof tablePlugin>['selection'] | undefined) => (triggeredByKeyboard?: boolean) => Command;
|
|
11
|
+
export declare const selectColumns: (editorSelectionAPI: ExtractInjectionAPI<typeof tablePlugin>['selection'] | undefined, ariaNotify?: ((message: string, ariaLiveElementAttributes?: AriaLiveElementAttributes) => void) | undefined, getIntl?: () => IntlShape) => (triggeredByKeyboard?: boolean) => Command;
|
|
12
|
+
export declare const selectRows: (editorSelectionAPI: ExtractInjectionAPI<typeof tablePlugin>['selection'] | undefined, ariaNotify?: ((message: string, ariaLiveElementAttributes?: AriaLiveElementAttributes) => void) | undefined, getIntl?: () => IntlShape) => (triggeredByKeyboard?: boolean) => Command;
|
|
11
13
|
export declare const shiftArrowUpFromTable: (editorSelectionAPI: ExtractInjectionAPI<typeof tablePlugin>['selection'] | undefined) => () => Command;
|
|
12
14
|
export declare const modASelectTable: (editorSelectionAPI: ExtractInjectionAPI<typeof tablePlugin>['selection'] | undefined) => () => Command;
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
import type { DispatchAnalyticsEvent } from '@atlaskit/editor-common/analytics';
|
|
3
3
|
import type { EventDispatcher } from '@atlaskit/editor-common/event-dispatcher';
|
|
4
4
|
import { type PortalProviderAPI } from '@atlaskit/editor-common/portal';
|
|
5
|
-
import type { LegacyPortalProviderAPI } from '@atlaskit/editor-common/portal-provider';
|
|
6
5
|
import ReactNodeView from '@atlaskit/editor-common/react-node-view';
|
|
7
6
|
import type { GetEditorContainerWidth, GetEditorFeatureFlags, getPosHandler, getPosHandlerNode } from '@atlaskit/editor-common/types';
|
|
8
7
|
import type { Node as PmNode } from '@atlaskit/editor-prosemirror/model';
|
|
@@ -33,5 +32,5 @@ export default class TableView extends ReactNodeView<Props> {
|
|
|
33
32
|
}): boolean;
|
|
34
33
|
destroy(): void;
|
|
35
34
|
}
|
|
36
|
-
export declare const createTableView: (node: PmNode, view: EditorView, getPos: getPosHandler, portalProviderAPI:
|
|
35
|
+
export declare const createTableView: (node: PmNode, view: EditorView, getPos: getPosHandler, portalProviderAPI: PortalProviderAPI, eventDispatcher: EventDispatcher, getEditorContainerWidth: GetEditorContainerWidth, getEditorFeatureFlags: GetEditorFeatureFlags, dispatchAnalyticsEvent: DispatchAnalyticsEvent, pluginInjectionApi?: PluginInjectionAPI, isTableAlignmentEnabled?: boolean) => NodeView;
|
|
37
36
|
export {};
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import type { DispatchAnalyticsEvent } from '@atlaskit/editor-common/analytics';
|
|
2
2
|
import type { EventDispatcher } from '@atlaskit/editor-common/event-dispatcher';
|
|
3
3
|
import { type PortalProviderAPI } from '@atlaskit/editor-common/portal';
|
|
4
|
-
import type { LegacyPortalProviderAPI } from '@atlaskit/editor-common/portal-provider';
|
|
5
4
|
import type { GetEditorContainerWidth, GetEditorFeatureFlags } from '@atlaskit/editor-common/types';
|
|
6
5
|
import type { Node as PmNode } from '@atlaskit/editor-prosemirror/model';
|
|
7
6
|
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
@@ -20,13 +19,12 @@ export interface Props {
|
|
|
20
19
|
allowColumnResizing?: boolean;
|
|
21
20
|
allowControls?: boolean;
|
|
22
21
|
cellMinWidth?: number;
|
|
23
|
-
portalProviderAPI:
|
|
22
|
+
portalProviderAPI: PortalProviderAPI;
|
|
24
23
|
eventDispatcher: EventDispatcher;
|
|
25
24
|
getPos: () => number | undefined;
|
|
26
25
|
options?: TableOptions;
|
|
27
26
|
getEditorContainerWidth: GetEditorContainerWidth;
|
|
28
27
|
getEditorFeatureFlags: GetEditorFeatureFlags;
|
|
29
28
|
dispatchAnalyticsEvent: DispatchAnalyticsEvent;
|
|
30
|
-
hasIntlContext: boolean;
|
|
31
29
|
pluginInjectionApi?: PluginInjectionAPI;
|
|
32
30
|
}
|
|
@@ -1,9 +1,11 @@
|
|
|
1
|
+
import { type IntlShape } from 'react-intl-next/src/types';
|
|
1
2
|
import { INPUT_METHOD, TABLE_STATUS } from '@atlaskit/editor-common/analytics';
|
|
2
3
|
import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
|
|
3
4
|
import type { Command } from '@atlaskit/editor-common/types';
|
|
5
|
+
import type { AriaLiveElementAttributes } from '@atlaskit/editor-plugin-accessibility-utils';
|
|
4
6
|
import type { Transaction } from '@atlaskit/editor-prosemirror/state';
|
|
5
7
|
import type { DraggableData, DraggableType } from '../../types';
|
|
6
8
|
export declare const clearDropTargetWithAnalytics: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null) => (inputMethod: INPUT_METHOD.TABLE_CONTEXT_MENU | INPUT_METHOD.DRAG_AND_DROP, sourceType: DraggableType, sourceIndexes: number[] | undefined, status: TABLE_STATUS.CANCELLED | TABLE_STATUS.INVALID, tr?: Transaction) => Command;
|
|
7
|
-
export declare const moveSourceWithAnalytics: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null) => (inputMethod: INPUT_METHOD.TABLE_CONTEXT_MENU | INPUT_METHOD.DRAG_AND_DROP | INPUT_METHOD.SHORTCUT, sourceType: DraggableType, sourceIndexes: number[], targetIndex: number, tr?: Transaction) => Command;
|
|
8
|
-
export declare const moveSourceWithAnalyticsViaShortcut: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null) => (sourceType: DraggableType, direction: DraggableData['direction']) => Command;
|
|
9
|
+
export declare const moveSourceWithAnalytics: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null, ariaNotify?: ((message: string, ariaLiveElementAttributes?: AriaLiveElementAttributes) => void) | undefined, getIntl?: () => IntlShape) => (inputMethod: INPUT_METHOD.TABLE_CONTEXT_MENU | INPUT_METHOD.DRAG_AND_DROP | INPUT_METHOD.SHORTCUT, sourceType: DraggableType, sourceIndexes: number[], targetIndex: number, tr?: Transaction) => Command;
|
|
10
|
+
export declare const moveSourceWithAnalyticsViaShortcut: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null, ariaNotify?: ((message: string, ariaLiveElementAttributes?: AriaLiveElementAttributes) => void) | undefined, getIntl?: () => IntlShape) => (sourceType: DraggableType, direction: DraggableData['direction']) => Command;
|
|
9
11
|
export declare const cloneSourceWithAnalytics: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null) => (inputMethod: INPUT_METHOD.TABLE_CONTEXT_MENU | INPUT_METHOD.DRAG_AND_DROP | INPUT_METHOD.SHORTCUT, sourceType: DraggableType, sourceIndexes: number[], targetIndex: number, targetDirection: 'start' | 'end', tr?: Transaction) => Command;
|
|
@@ -2,8 +2,7 @@ import type { IntlShape } from 'react-intl-next';
|
|
|
2
2
|
import type { DispatchAnalyticsEvent, EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
|
|
3
3
|
import type { Dispatch, EventDispatcher } from '@atlaskit/editor-common/event-dispatcher';
|
|
4
4
|
import { type PortalProviderAPI } from '@atlaskit/editor-common/portal';
|
|
5
|
-
import type { LegacyPortalProviderAPI } from '@atlaskit/editor-common/portal-provider';
|
|
6
5
|
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
7
6
|
import type { GetEditorContainerWidth, GetEditorFeatureFlags } from '@atlaskit/editor-common/types';
|
|
8
7
|
import type { PluginConfig, PluginInjectionAPI } from '../types';
|
|
9
|
-
export declare const createPlugin: (dispatchAnalyticsEvent: DispatchAnalyticsEvent, dispatch: Dispatch, portalProviderAPI:
|
|
8
|
+
export declare const createPlugin: (dispatchAnalyticsEvent: DispatchAnalyticsEvent, dispatch: Dispatch, portalProviderAPI: PortalProviderAPI, eventDispatcher: EventDispatcher, pluginConfig: PluginConfig, getEditorContainerWidth: GetEditorContainerWidth, getEditorFeatureFlags: GetEditorFeatureFlags, getIntl: () => IntlShape, tableResizingEnabled?: boolean, fullWidthModeEnabled?: boolean, previousFullWidthModeEnabled?: boolean, dragAndDropEnabled?: boolean, editorAnalyticsAPI?: EditorAnalyticsAPI, pluginInjectionApi?: PluginInjectionAPI, isTableScalingEnabled?: boolean, isTableAlignmentEnabled?: boolean, shouldUseIncreasedScalingPercent?: boolean) => SafePlugin<import("../types").TablePluginState>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
+
import { type IntlShape } from 'react-intl-next/src/types';
|
|
1
2
|
import type { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
2
|
-
import type
|
|
3
|
-
|
|
4
|
-
export declare function tableSelectionKeymapPlugin(editorSelectionAPI: ExtractInjectionAPI<typeof tablePlugin>['selection'] | undefined): SafePlugin;
|
|
3
|
+
import { type PluginInjectionAPI } from '../types';
|
|
4
|
+
export declare function tableSelectionKeymapPlugin(pluginInjectionApi?: PluginInjectionAPI, getIntl?: () => IntlShape): SafePlugin;
|
|
5
5
|
export default tableSelectionKeymapPlugin;
|
|
@@ -18,7 +18,7 @@ type AlignmentIcon = {
|
|
|
18
18
|
value: AlignmentOptions;
|
|
19
19
|
icon: React.ComponentClass<any>;
|
|
20
20
|
};
|
|
21
|
-
export declare const getAlignmentOptionsConfig: (editorState: EditorState, { formatMessage }: ToolbarMenuContext, editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null, getEditorContainerWidth: GetEditorContainerWidth, getDomRef: (editorView: EditorView) => HTMLElement | undefined, editorView: EditorView | null, shouldUseIncreasedScalingPercent: boolean) => Array<FloatingToolbarDropdown<Command>>;
|
|
21
|
+
export declare const getAlignmentOptionsConfig: (editorState: EditorState, { formatMessage }: ToolbarMenuContext, editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null, getEditorContainerWidth: GetEditorContainerWidth, getDomRef: (editorView: EditorView) => HTMLElement | undefined, editorView: EditorView | null, shouldUseIncreasedScalingPercent: boolean, isFullWidthEditor?: boolean) => Array<FloatingToolbarDropdown<Command>>;
|
|
22
22
|
export declare const getSelectedAlignmentIcon: (alignmentIcons: AlignmentIcon[], selectedNode: PMNode) => AlignmentIcon | undefined;
|
|
23
|
-
export declare const isLayoutOptionDisabled: (selectedNode: PMNode, getEditorContainerWidth: GetEditorContainerWidth, getDomRef: (editorView: EditorView) => HTMLElement | undefined, editorView: EditorView | null, shouldUseIncreasedScalingPercent: boolean) => boolean;
|
|
23
|
+
export declare const isLayoutOptionDisabled: (selectedNode: PMNode, getEditorContainerWidth: GetEditorContainerWidth, getDomRef: (editorView: EditorView) => HTMLElement | undefined, editorView: EditorView | null, shouldUseIncreasedScalingPercent: boolean, isFullWidthEditor: boolean | undefined) => boolean;
|
|
24
24
|
export {};
|
|
@@ -5,6 +5,7 @@ import { jsx } from '@emotion/react';
|
|
|
5
5
|
import type { WrappedComponentProps } from 'react-intl-next';
|
|
6
6
|
import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
|
|
7
7
|
import type { GetEditorContainerWidth } from '@atlaskit/editor-common/types';
|
|
8
|
+
import type { AriaLiveElementAttributes } from '@atlaskit/editor-plugin-accessibility-utils';
|
|
8
9
|
import type { Node as PmNode } from '@atlaskit/editor-prosemirror/model';
|
|
9
10
|
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
10
11
|
import type { PluginConfig, TableDirection } from '../../types';
|
|
@@ -29,8 +30,9 @@ type DragMenuProps = {
|
|
|
29
30
|
shouldUseIncreasedScalingPercent?: boolean;
|
|
30
31
|
isTableFixedColumnWidthsOptionEnabled?: boolean;
|
|
31
32
|
tableSortColumnReorder?: boolean;
|
|
33
|
+
ariaNotifyPlugin?: (message: string, ariaLiveElementAttributes?: AriaLiveElementAttributes) => void;
|
|
32
34
|
};
|
|
33
|
-
export declare const DragMenu: React.MemoExoticComponent<({ direction, index, target, isOpen, editorView, tableNode, targetCellPosition, getEditorContainerWidth, editorAnalyticsAPI, pluginConfig, intl: { formatMessage }, fitHeight, fitWidth, mountPoint, scrollableElement, boundariesElement, isTableScalingEnabled, tableDuplicateCellColouring, shouldUseIncreasedScalingPercent, isTableFixedColumnWidthsOptionEnabled, tableSortColumnReorder, }: DragMenuProps & WrappedComponentProps) => jsx.JSX.Element | null>;
|
|
35
|
+
export declare const DragMenu: React.MemoExoticComponent<({ direction, index, target, isOpen, editorView, tableNode, targetCellPosition, getEditorContainerWidth, editorAnalyticsAPI, pluginConfig, intl: { formatMessage }, fitHeight, fitWidth, mountPoint, scrollableElement, boundariesElement, isTableScalingEnabled, tableDuplicateCellColouring, shouldUseIncreasedScalingPercent, isTableFixedColumnWidthsOptionEnabled, tableSortColumnReorder, ariaNotifyPlugin, }: DragMenuProps & WrappedComponentProps) => jsx.JSX.Element | null>;
|
|
34
36
|
declare const _default: React.FC<import("react-intl-next").WithIntlProps<DragMenuProps & WrappedComponentProps>> & {
|
|
35
37
|
WrappedComponent: React.ComponentType<DragMenuProps & WrappedComponentProps>;
|
|
36
38
|
};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
|
|
3
3
|
import type { GetEditorContainerWidth, GetEditorFeatureFlags } from '@atlaskit/editor-common/types';
|
|
4
|
+
import type { AriaLiveElementAttributes } from '@atlaskit/editor-plugin-accessibility-utils';
|
|
4
5
|
import type { Node as PmNode } from '@atlaskit/editor-prosemirror/model';
|
|
5
6
|
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
6
7
|
import type { RowStickyState } from '../../pm-plugins/sticky-headers';
|
|
@@ -22,9 +23,10 @@ export interface Props {
|
|
|
22
23
|
pluginConfig?: PluginConfig;
|
|
23
24
|
isTableScalingEnabled?: boolean;
|
|
24
25
|
getEditorFeatureFlags?: GetEditorFeatureFlags;
|
|
26
|
+
ariaNotifyPlugin?: (message: string, ariaLiveElementAttributes?: AriaLiveElementAttributes) => void;
|
|
25
27
|
}
|
|
26
28
|
declare const FloatingDragMenu: {
|
|
27
|
-
({ mountPoint, boundariesElement, scrollableElement, editorView, isOpen, tableNode, direction, index, targetCellPosition, getEditorContainerWidth, editorAnalyticsAPI, stickyHeaders, pluginConfig, isTableScalingEnabled, getEditorFeatureFlags, }: Props): JSX.Element | null;
|
|
29
|
+
({ mountPoint, boundariesElement, scrollableElement, editorView, isOpen, tableNode, direction, index, targetCellPosition, getEditorContainerWidth, editorAnalyticsAPI, stickyHeaders, pluginConfig, isTableScalingEnabled, getEditorFeatureFlags, ariaNotifyPlugin, }: Props): JSX.Element | null;
|
|
28
30
|
displayName: string;
|
|
29
31
|
};
|
|
30
32
|
export default FloatingDragMenu;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
|
|
3
3
|
import type { Command, DropdownOptionT, GetEditorContainerWidth, IconProps } from '@atlaskit/editor-common/types';
|
|
4
|
+
import type { AriaLiveElementAttributes } from '@atlaskit/editor-plugin-accessibility-utils';
|
|
4
5
|
import type { Selection } from '@atlaskit/editor-prosemirror/state';
|
|
5
6
|
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
6
7
|
import type { Rect, TableMap } from '@atlaskit/editor-tables/table-map';
|
|
@@ -13,4 +14,4 @@ export interface DragMenuConfig extends Omit<DropdownOptionT<Command>, 'icon'> {
|
|
|
13
14
|
icon?: React.ComponentType<React.PropsWithChildren<IconProps>>;
|
|
14
15
|
keymap?: string;
|
|
15
16
|
}
|
|
16
|
-
export declare const getDragMenuConfig: (direction: TableDirection, getEditorContainerWidth: GetEditorContainerWidth, hasMergedCellsInTable: boolean, editorView: EditorView, tableMap?: TableMap, index?: number, targetCellPosition?: number, selectionRect?: Rect, editorAnalyticsAPI?: EditorAnalyticsAPI, isHeaderRowRequired?: boolean, isTableScalingEnabled?: boolean, tableDuplicateCellColouring?: boolean, isTableFixedColumnWidthsOptionEnabled?: boolean, shouldUseIncreasedScalingPercent?: boolean, tableSortColumnReorder?: boolean) => DragMenuConfig[];
|
|
17
|
+
export declare const getDragMenuConfig: (direction: TableDirection, getEditorContainerWidth: GetEditorContainerWidth, hasMergedCellsInTable: boolean, editorView: EditorView, tableMap?: TableMap, index?: number, targetCellPosition?: number, selectionRect?: Rect, editorAnalyticsAPI?: EditorAnalyticsAPI, isHeaderRowRequired?: boolean, isTableScalingEnabled?: boolean, tableDuplicateCellColouring?: boolean, isTableFixedColumnWidthsOptionEnabled?: boolean, shouldUseIncreasedScalingPercent?: boolean, tableSortColumnReorder?: boolean, ariaNotifyPlugin?: ((message: string, ariaLiveElementAttributes?: AriaLiveElementAttributes) => void) | undefined) => DragMenuConfig[];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-table",
|
|
3
|
-
"version": "7.
|
|
3
|
+
"version": "7.20.0",
|
|
4
4
|
"description": "Table plugin for the @atlaskit/editor",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -29,9 +29,9 @@
|
|
|
29
29
|
},
|
|
30
30
|
"dependencies": {
|
|
31
31
|
"@atlaskit/adf-schema": "^39.0.3",
|
|
32
|
-
"@atlaskit/button": "^18.
|
|
32
|
+
"@atlaskit/button": "^18.4.0",
|
|
33
33
|
"@atlaskit/custom-steps": "^0.4.0",
|
|
34
|
-
"@atlaskit/editor-common": "^
|
|
34
|
+
"@atlaskit/editor-common": "^85.0.0",
|
|
35
35
|
"@atlaskit/editor-palette": "1.6.0",
|
|
36
36
|
"@atlaskit/editor-plugin-accessibility-utils": "^1.1.0",
|
|
37
37
|
"@atlaskit/editor-plugin-analytics": "^1.4.0",
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
"@atlaskit/editor-shared-styles": "^2.13.0",
|
|
45
45
|
"@atlaskit/editor-tables": "^2.7.0",
|
|
46
46
|
"@atlaskit/icon": "^22.6.0",
|
|
47
|
-
"@atlaskit/menu": "^2.
|
|
47
|
+
"@atlaskit/menu": "^2.8.0",
|
|
48
48
|
"@atlaskit/platform-feature-flags": "^0.3.0",
|
|
49
49
|
"@atlaskit/pragmatic-drag-and-drop": "^1.2.0",
|
|
50
50
|
"@atlaskit/pragmatic-drag-and-drop-auto-scroll": "^1.4.0",
|
|
@@ -52,7 +52,7 @@
|
|
|
52
52
|
"@atlaskit/primitives": "^11.0.0",
|
|
53
53
|
"@atlaskit/theme": "^12.11.0",
|
|
54
54
|
"@atlaskit/toggle": "^13.2.0",
|
|
55
|
-
"@atlaskit/tokens": "^1.
|
|
55
|
+
"@atlaskit/tokens": "^1.54.0",
|
|
56
56
|
"@atlaskit/tooltip": "^18.5.0",
|
|
57
57
|
"@babel/runtime": "^7.0.0",
|
|
58
58
|
"@emotion/react": "^11.7.1",
|
|
@@ -122,6 +122,9 @@
|
|
|
122
122
|
},
|
|
123
123
|
"platform.editor.a11y-table-context-menu_y4c9c": {
|
|
124
124
|
"type": "boolean"
|
|
125
|
+
},
|
|
126
|
+
"platform_editor_element_drag_and_drop_ed_24041": {
|
|
127
|
+
"type": "boolean"
|
|
125
128
|
}
|
|
126
129
|
}
|
|
127
130
|
}
|
|
@@ -15,7 +15,7 @@ import {
|
|
|
15
15
|
isSelectionType,
|
|
16
16
|
nextCell,
|
|
17
17
|
} from '@atlaskit/editor-tables/utils';
|
|
18
|
-
import {
|
|
18
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
19
19
|
|
|
20
20
|
import { getDecorations } from '../pm-plugins/decorations/plugin';
|
|
21
21
|
import {
|
|
@@ -320,7 +320,7 @@ export const changeColumnWidthByStep =
|
|
|
320
320
|
}
|
|
321
321
|
const shouldUseIncreasedScalingPercent =
|
|
322
322
|
isTableScalingWithFixedColumnWidthsOptionEnabled &&
|
|
323
|
-
|
|
323
|
+
fg('platform.editor.table.use-increased-scaling-percent');
|
|
324
324
|
|
|
325
325
|
const initialResizeState = getResizeState({
|
|
326
326
|
minWidth: tableCellMinWidth,
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import { type IntlShape } from 'react-intl-next/src/types';
|
|
2
|
+
|
|
3
|
+
import { tableMessages as messages } from '@atlaskit/editor-common/messages';
|
|
1
4
|
import type { SelectionSharedState } from '@atlaskit/editor-common/selection';
|
|
2
5
|
import {
|
|
3
6
|
GapCursorSelection,
|
|
@@ -7,6 +10,7 @@ import {
|
|
|
7
10
|
Side,
|
|
8
11
|
} from '@atlaskit/editor-common/selection';
|
|
9
12
|
import type { Command, ExtractInjectionAPI } from '@atlaskit/editor-common/types';
|
|
13
|
+
import type { AriaLiveElementAttributes } from '@atlaskit/editor-plugin-accessibility-utils';
|
|
10
14
|
import type { Node as PmNode, ResolvedPos } from '@atlaskit/editor-prosemirror/model';
|
|
11
15
|
import { Selection, TextSelection } from '@atlaskit/editor-prosemirror/state';
|
|
12
16
|
import { CellSelection } from '@atlaskit/editor-tables/cell-selection';
|
|
@@ -106,7 +110,11 @@ const arrowRightFromCellSelection =
|
|
|
106
110
|
};
|
|
107
111
|
|
|
108
112
|
export const selectColumns =
|
|
109
|
-
(
|
|
113
|
+
(
|
|
114
|
+
editorSelectionAPI: ExtractInjectionAPI<typeof tablePlugin>['selection'] | undefined,
|
|
115
|
+
ariaNotify?: (message: string, ariaLiveElementAttributes?: AriaLiveElementAttributes) => void,
|
|
116
|
+
getIntl?: () => IntlShape,
|
|
117
|
+
) =>
|
|
110
118
|
(triggeredByKeyboard = false): Command =>
|
|
111
119
|
(state, dispatch) => {
|
|
112
120
|
const { selection } = state;
|
|
@@ -120,13 +128,36 @@ export const selectColumns =
|
|
|
120
128
|
})(state, dispatch);
|
|
121
129
|
}
|
|
122
130
|
if (table && rect) {
|
|
123
|
-
|
|
131
|
+
const selectColumnCommand = selectColumn(
|
|
132
|
+
rect.left,
|
|
133
|
+
undefined,
|
|
134
|
+
triggeredByKeyboard,
|
|
135
|
+
)(state, dispatch);
|
|
136
|
+
const map = TableMap.get(table.node);
|
|
137
|
+
|
|
138
|
+
if (ariaNotify && getIntl) {
|
|
139
|
+
ariaNotify(
|
|
140
|
+
getIntl().formatMessage(messages.columnSelected, {
|
|
141
|
+
index: rect.left + 1,
|
|
142
|
+
total: map.width,
|
|
143
|
+
}),
|
|
144
|
+
{
|
|
145
|
+
priority: 'important',
|
|
146
|
+
},
|
|
147
|
+
);
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
return selectColumnCommand;
|
|
124
151
|
}
|
|
125
152
|
return false;
|
|
126
153
|
};
|
|
127
154
|
|
|
128
155
|
export const selectRows =
|
|
129
|
-
(
|
|
156
|
+
(
|
|
157
|
+
editorSelectionAPI: ExtractInjectionAPI<typeof tablePlugin>['selection'] | undefined,
|
|
158
|
+
ariaNotify?: (message: string, ariaLiveElementAttributes?: AriaLiveElementAttributes) => void,
|
|
159
|
+
getIntl?: () => IntlShape,
|
|
160
|
+
) =>
|
|
130
161
|
(triggeredByKeyboard = false): Command =>
|
|
131
162
|
(state, dispatch) => {
|
|
132
163
|
const { selection } = state;
|
|
@@ -140,7 +171,21 @@ export const selectRows =
|
|
|
140
171
|
})(state, dispatch);
|
|
141
172
|
}
|
|
142
173
|
if (table && rect) {
|
|
143
|
-
|
|
174
|
+
const selectRowCommand = selectRow(rect.top, undefined, triggeredByKeyboard)(state, dispatch);
|
|
175
|
+
const map = TableMap.get(table.node);
|
|
176
|
+
|
|
177
|
+
if (ariaNotify && getIntl) {
|
|
178
|
+
ariaNotify(
|
|
179
|
+
getIntl().formatMessage(messages.rowSelected, {
|
|
180
|
+
index: rect.top + 1,
|
|
181
|
+
total: map.height,
|
|
182
|
+
}),
|
|
183
|
+
{
|
|
184
|
+
priority: 'important',
|
|
185
|
+
},
|
|
186
|
+
);
|
|
187
|
+
}
|
|
188
|
+
return selectRowCommand;
|
|
144
189
|
}
|
|
145
190
|
return false;
|
|
146
191
|
};
|