@atlaskit/editor-plugin-table 22.4.7 → 22.4.8
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 +8 -0
- package/dist/cjs/ui/FloatingContextualButton/index.js +5 -0
- package/dist/cjs/ui/FloatingContextualMenu/CellMenuPopup.js +103 -0
- package/dist/cjs/ui/FloatingContextualMenu/index.js +13 -2
- package/dist/cjs/ui/TableMenu/cell/getCellMenuComponents.js +77 -0
- package/dist/cjs/ui/TableMenu/cell/items/MergeCellsItem.js +21 -0
- package/dist/cjs/ui/TableMenu/cell/items/SplitCellItem.js +21 -0
- package/dist/cjs/ui/TableMenu/cell/keys.js +40 -0
- package/dist/cjs/ui/TableMenu/column/items/MoveColumnRightItem.js +2 -6
- package/dist/cjs/ui/TableMenu/shared/TableMenu.js +2 -1
- package/dist/cjs/ui/TableMenu/shared/getSharedItems.js +28 -19
- package/dist/cjs/ui/TableMenu/shared/getTableMenuComponents.js +2 -1
- package/dist/es2019/ui/FloatingContextualButton/index.js +5 -0
- package/dist/es2019/ui/FloatingContextualMenu/CellMenuPopup.js +99 -0
- package/dist/es2019/ui/FloatingContextualMenu/index.js +13 -3
- package/dist/es2019/ui/TableMenu/cell/getCellMenuComponents.js +61 -0
- package/dist/es2019/ui/TableMenu/cell/items/MergeCellsItem.js +15 -0
- package/dist/es2019/ui/TableMenu/cell/items/SplitCellItem.js +15 -0
- package/dist/es2019/ui/TableMenu/cell/keys.js +42 -0
- package/dist/es2019/ui/TableMenu/column/items/MoveColumnRightItem.js +3 -5
- package/dist/es2019/ui/TableMenu/shared/TableMenu.js +2 -1
- package/dist/es2019/ui/TableMenu/shared/getSharedItems.js +9 -0
- package/dist/es2019/ui/TableMenu/shared/getTableMenuComponents.js +2 -1
- package/dist/esm/ui/FloatingContextualButton/index.js +5 -0
- package/dist/esm/ui/FloatingContextualMenu/CellMenuPopup.js +95 -0
- package/dist/esm/ui/FloatingContextualMenu/index.js +13 -3
- package/dist/esm/ui/TableMenu/cell/getCellMenuComponents.js +71 -0
- package/dist/esm/ui/TableMenu/cell/items/MergeCellsItem.js +14 -0
- package/dist/esm/ui/TableMenu/cell/items/SplitCellItem.js +14 -0
- package/dist/esm/ui/TableMenu/cell/keys.js +34 -0
- package/dist/esm/ui/TableMenu/column/items/MoveColumnRightItem.js +3 -7
- package/dist/esm/ui/TableMenu/shared/TableMenu.js +2 -1
- package/dist/esm/ui/TableMenu/shared/getSharedItems.js +9 -0
- package/dist/esm/ui/TableMenu/shared/getTableMenuComponents.js +2 -1
- package/dist/types/ui/FloatingContextualMenu/CellMenuPopup.d.ts +12 -0
- package/dist/types/ui/TableMenu/cell/getCellMenuComponents.d.ts +9 -0
- package/dist/types/ui/TableMenu/cell/items/MergeCellsItem.d.ts +2 -0
- package/dist/types/ui/TableMenu/cell/items/SplitCellItem.d.ts +2 -0
- package/dist/types/ui/TableMenu/cell/keys.d.ts +9 -0
- package/dist/types-ts4.5/ui/FloatingContextualMenu/CellMenuPopup.d.ts +12 -0
- package/dist/types-ts4.5/ui/TableMenu/cell/getCellMenuComponents.d.ts +9 -0
- package/dist/types-ts4.5/ui/TableMenu/cell/items/MergeCellsItem.d.ts +2 -0
- package/dist/types-ts4.5/ui/TableMenu/cell/items/SplitCellItem.d.ts +2 -0
- package/dist/types-ts4.5/ui/TableMenu/cell/keys.d.ts +9 -0
- package/package.json +3 -3
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { useIntl } from 'react-intl';
|
|
3
|
+
import { tableMessages as messages } from '@atlaskit/editor-common/messages';
|
|
4
|
+
import { TableCellMergeIcon, ToolbarDropdownItem } from '@atlaskit/editor-toolbar';
|
|
5
|
+
export const MergeCellsItem = () => {
|
|
6
|
+
const {
|
|
7
|
+
formatMessage
|
|
8
|
+
} = useIntl();
|
|
9
|
+
return /*#__PURE__*/React.createElement(ToolbarDropdownItem, {
|
|
10
|
+
elemBefore: /*#__PURE__*/React.createElement(TableCellMergeIcon, {
|
|
11
|
+
label: "",
|
|
12
|
+
size: "small"
|
|
13
|
+
})
|
|
14
|
+
}, formatMessage(messages.mergeCells));
|
|
15
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { useIntl } from 'react-intl';
|
|
3
|
+
import { tableMessages as messages } from '@atlaskit/editor-common/messages';
|
|
4
|
+
import { TableCellSplitIcon, ToolbarDropdownItem } from '@atlaskit/editor-toolbar';
|
|
5
|
+
export const SplitCellItem = () => {
|
|
6
|
+
const {
|
|
7
|
+
formatMessage
|
|
8
|
+
} = useIntl();
|
|
9
|
+
return /*#__PURE__*/React.createElement(ToolbarDropdownItem, {
|
|
10
|
+
elemBefore: /*#__PURE__*/React.createElement(TableCellSplitIcon, {
|
|
11
|
+
label: "",
|
|
12
|
+
size: "small"
|
|
13
|
+
})
|
|
14
|
+
}, formatMessage(messages.splitCell));
|
|
15
|
+
};
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { BACKGROUND_COLOR_ITEM, CLEAR_CELLS_ITEM } from '../shared/keys';
|
|
2
|
+
|
|
3
|
+
// --- Menu surface ---
|
|
4
|
+
|
|
5
|
+
export const CELL_MENU = {
|
|
6
|
+
type: 'menu',
|
|
7
|
+
key: 'cell-contextual-menu'
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
// --- Sections ---
|
|
11
|
+
|
|
12
|
+
export const CELL_ACTION_SECTION = {
|
|
13
|
+
type: 'menu-section',
|
|
14
|
+
key: 'cell-action-section'
|
|
15
|
+
};
|
|
16
|
+
export const CELL_DANGER_SECTION = {
|
|
17
|
+
type: 'menu-section',
|
|
18
|
+
key: 'cell-danger-section'
|
|
19
|
+
};
|
|
20
|
+
export const CELL_MENU_SECTION_RANK = {
|
|
21
|
+
[CELL_ACTION_SECTION.key]: 100,
|
|
22
|
+
[CELL_DANGER_SECTION.key]: 200
|
|
23
|
+
};
|
|
24
|
+
export const MERGE_CELLS_ITEM = {
|
|
25
|
+
type: 'menu-item',
|
|
26
|
+
key: 'merge-cells'
|
|
27
|
+
};
|
|
28
|
+
export const SPLIT_CELL_ITEM = {
|
|
29
|
+
type: 'menu-item',
|
|
30
|
+
key: 'split-cell'
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
// --- Item ranks within their sections ---
|
|
34
|
+
|
|
35
|
+
export const CELL_ACTION_SECTION_RANK = {
|
|
36
|
+
[BACKGROUND_COLOR_ITEM.key]: 100,
|
|
37
|
+
[MERGE_CELLS_ITEM.key]: 200,
|
|
38
|
+
[SPLIT_CELL_ITEM.key]: 300
|
|
39
|
+
};
|
|
40
|
+
export const CELL_DANGER_SECTION_RANK = {
|
|
41
|
+
[CLEAR_CELLS_ITEM.key]: 100
|
|
42
|
+
};
|
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { useIntl } from 'react-intl';
|
|
3
|
-
import { moveColumnRight,
|
|
3
|
+
import { moveColumnRight, tooltip } from '@atlaskit/editor-common/keymaps';
|
|
4
4
|
import { tableMessages as messages } from '@atlaskit/editor-common/messages';
|
|
5
5
|
import { TableColumnMoveRightIcon, ToolbarDropdownItem, ToolbarKeyboardShortcutHint } from '@atlaskit/editor-toolbar';
|
|
6
|
-
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
7
|
-
const getMoveColumnRightShortcut = () => tooltip(expValEquals('editor-a11y-fy26-keyboard-move-row-column', 'isEnabled', true) ? moveColumnRight : moveColumnRightOld);
|
|
8
6
|
export const MoveColumnRightItem = () => {
|
|
9
|
-
var
|
|
7
|
+
var _tooltip;
|
|
10
8
|
const {
|
|
11
9
|
formatMessage
|
|
12
10
|
} = useIntl();
|
|
@@ -17,7 +15,7 @@ export const MoveColumnRightItem = () => {
|
|
|
17
15
|
size: "small"
|
|
18
16
|
}),
|
|
19
17
|
elemAfter: /*#__PURE__*/React.createElement(ToolbarKeyboardShortcutHint, {
|
|
20
|
-
shortcut: (
|
|
18
|
+
shortcut: (_tooltip = tooltip(moveColumnRight)) !== null && _tooltip !== void 0 ? _tooltip : ''
|
|
21
19
|
})
|
|
22
20
|
}, formatMessage(messages.moveColumnRight, {
|
|
23
21
|
0: 1
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
import { CELL_ACTION_SECTION, CELL_DANGER_SECTION, CELL_ACTION_SECTION_RANK, CELL_DANGER_SECTION_RANK } from '../cell/keys';
|
|
2
3
|
import { COLUMN_BACKGROUND_SECTION, COLUMN_DANGER_SECTION, COLUMN_BACKGROUND_SECTION_RANK, COLUMN_DANGER_SECTION_RANK } from '../column/keys';
|
|
3
4
|
import { ROW_BACKGROUND_SECTION, ROW_DANGER_SECTION, ROW_BACKGROUND_SECTION_RANK, ROW_DANGER_SECTION_RANK } from '../row/keys';
|
|
4
5
|
import { BackgroundColorItem } from './items/BackgroundColorItem';
|
|
@@ -15,6 +16,10 @@ export const getSharedItems = () => [{
|
|
|
15
16
|
type: COLUMN_BACKGROUND_SECTION.type,
|
|
16
17
|
key: COLUMN_BACKGROUND_SECTION.key,
|
|
17
18
|
rank: COLUMN_BACKGROUND_SECTION_RANK[BACKGROUND_COLOR_ITEM.key]
|
|
19
|
+
}, {
|
|
20
|
+
type: CELL_ACTION_SECTION.type,
|
|
21
|
+
key: CELL_ACTION_SECTION.key,
|
|
22
|
+
rank: CELL_ACTION_SECTION_RANK[BACKGROUND_COLOR_ITEM.key]
|
|
18
23
|
}],
|
|
19
24
|
component: () => /*#__PURE__*/React.createElement(BackgroundColorItem, null)
|
|
20
25
|
}, {
|
|
@@ -28,6 +33,10 @@ export const getSharedItems = () => [{
|
|
|
28
33
|
type: COLUMN_DANGER_SECTION.type,
|
|
29
34
|
key: COLUMN_DANGER_SECTION.key,
|
|
30
35
|
rank: COLUMN_DANGER_SECTION_RANK[CLEAR_CELLS_ITEM.key]
|
|
36
|
+
}, {
|
|
37
|
+
type: CELL_DANGER_SECTION.type,
|
|
38
|
+
key: CELL_DANGER_SECTION.key,
|
|
39
|
+
rank: CELL_DANGER_SECTION_RANK[CLEAR_CELLS_ITEM.key]
|
|
31
40
|
}],
|
|
32
41
|
component: () => /*#__PURE__*/React.createElement(ClearCellsItem, null)
|
|
33
42
|
}];
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
+
import { getCellMenuComponents } from '../cell/getCellMenuComponents';
|
|
1
2
|
import { getColumnMenuComponents } from '../column/getColumnMenuComponents';
|
|
2
3
|
import { getRowMenuComponents } from '../row/getRowMenuComponents';
|
|
3
4
|
import { getSharedItems } from './getSharedItems';
|
|
4
|
-
export const getTableMenuComponents = () => [...getRowMenuComponents(), ...getColumnMenuComponents(), ...getSharedItems()];
|
|
5
|
+
export const getTableMenuComponents = () => [...getRowMenuComponents(), ...getColumnMenuComponents(), ...getCellMenuComponents(), ...getSharedItems()];
|
|
@@ -46,6 +46,11 @@ var FloatingContextualButtonInner = /*#__PURE__*/React.memo(function (props) {
|
|
|
46
46
|
var handleClick = function handleClick() {
|
|
47
47
|
var state = editorView.state,
|
|
48
48
|
dispatch = editorView.dispatch;
|
|
49
|
+
if (expValEquals('platform_editor_table_menu_updates', 'isEnabled', true)) {
|
|
50
|
+
toggleContextualMenu()(state, dispatch);
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
|
|
49
54
|
// Clicking outside the dropdown handles toggling the menu closed
|
|
50
55
|
// (otherwise these two toggles combat each other).
|
|
51
56
|
// In the event a user clicks the chevron button again
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import React, { useCallback, useEffect, useRef } from 'react';
|
|
2
|
+
import { bind } from 'bind-event-listener';
|
|
3
|
+
import { useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
|
|
4
|
+
import { UserIntentPopupWrapper } from '@atlaskit/editor-common/user-intent';
|
|
5
|
+
import { setFocusToCellMenu, toggleContextualMenu } from '../../pm-plugins/commands';
|
|
6
|
+
import { TableCssClassName as ClassName } from '../../types';
|
|
7
|
+
import { CELL_MENU } from '../TableMenu/cell/keys';
|
|
8
|
+
import { TableMenu } from '../TableMenu/shared/TableMenu';
|
|
9
|
+
export var CellMenuPopup = function CellMenuPopup(_ref) {
|
|
10
|
+
var api = _ref.api,
|
|
11
|
+
editorView = _ref.editorView,
|
|
12
|
+
isCellMenuOpenByKeyboard = _ref.isCellMenuOpenByKeyboard,
|
|
13
|
+
isOpen = _ref.isOpen,
|
|
14
|
+
targetCellRef = _ref.targetCellRef;
|
|
15
|
+
var tableMenuRef = useRef(null);
|
|
16
|
+
var _useSharedPluginState = useSharedPluginStateWithSelector(api, ['userIntent'], function (states) {
|
|
17
|
+
var _states$userIntentSta;
|
|
18
|
+
return {
|
|
19
|
+
currentUserIntent: (_states$userIntentSta = states.userIntentState) === null || _states$userIntentSta === void 0 ? void 0 : _states$userIntentSta.currentUserIntent
|
|
20
|
+
};
|
|
21
|
+
}),
|
|
22
|
+
currentUserIntent = _useSharedPluginState.currentUserIntent;
|
|
23
|
+
var closeCellMenu = useCallback(function () {
|
|
24
|
+
var state = editorView.state,
|
|
25
|
+
dispatch = editorView.dispatch,
|
|
26
|
+
dom = editorView.dom;
|
|
27
|
+
toggleContextualMenu()(state, dispatch);
|
|
28
|
+
if (isCellMenuOpenByKeyboard) {
|
|
29
|
+
setFocusToCellMenu(false)(state, dispatch);
|
|
30
|
+
dom.focus();
|
|
31
|
+
}
|
|
32
|
+
}, [editorView, isCellMenuOpenByKeyboard]);
|
|
33
|
+
useEffect(function () {
|
|
34
|
+
if (!isOpen || currentUserIntent !== 'tableDragMenuPopupOpen') {
|
|
35
|
+
return;
|
|
36
|
+
}
|
|
37
|
+
closeCellMenu();
|
|
38
|
+
}, [closeCellMenu, currentUserIntent, isOpen]);
|
|
39
|
+
useEffect(function () {
|
|
40
|
+
if (!isOpen) {
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
43
|
+
if (!(targetCellRef instanceof HTMLElement)) {
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
var ownerDocument = targetCellRef.ownerDocument;
|
|
47
|
+
var handlePointerDown = function handlePointerDown(event) {
|
|
48
|
+
var _tableMenuRef$current;
|
|
49
|
+
var target = event.target;
|
|
50
|
+
if (!(target instanceof Node)) {
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
if ((_tableMenuRef$current = tableMenuRef.current) !== null && _tableMenuRef$current !== void 0 && _tableMenuRef$current.contains(target)) {
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
56
|
+
var cellMenuButton = ownerDocument.querySelector(".".concat(ClassName.CONTEXTUAL_MENU_BUTTON));
|
|
57
|
+
if (cellMenuButton !== null && cellMenuButton !== void 0 && cellMenuButton.contains(target)) {
|
|
58
|
+
return;
|
|
59
|
+
}
|
|
60
|
+
closeCellMenu();
|
|
61
|
+
};
|
|
62
|
+
var handleKeyDown = function handleKeyDown(event) {
|
|
63
|
+
if (event.key === 'Escape') {
|
|
64
|
+
closeCellMenu();
|
|
65
|
+
}
|
|
66
|
+
};
|
|
67
|
+
var unbindPointerDown = bind(ownerDocument, {
|
|
68
|
+
type: 'pointerdown',
|
|
69
|
+
listener: handlePointerDown,
|
|
70
|
+
options: {
|
|
71
|
+
capture: true
|
|
72
|
+
}
|
|
73
|
+
});
|
|
74
|
+
var unbindKeyDown = bind(ownerDocument, {
|
|
75
|
+
type: 'keydown',
|
|
76
|
+
listener: handleKeyDown,
|
|
77
|
+
options: {
|
|
78
|
+
capture: true
|
|
79
|
+
}
|
|
80
|
+
});
|
|
81
|
+
return function () {
|
|
82
|
+
unbindPointerDown();
|
|
83
|
+
unbindKeyDown();
|
|
84
|
+
};
|
|
85
|
+
}, [closeCellMenu, isOpen, targetCellRef]);
|
|
86
|
+
return /*#__PURE__*/React.createElement(UserIntentPopupWrapper, {
|
|
87
|
+
api: api,
|
|
88
|
+
userIntent: "tableContextualMenuPopupOpen"
|
|
89
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
90
|
+
ref: tableMenuRef
|
|
91
|
+
}, /*#__PURE__*/React.createElement(TableMenu, {
|
|
92
|
+
api: api,
|
|
93
|
+
surface: CELL_MENU
|
|
94
|
+
})));
|
|
95
|
+
};
|
|
@@ -8,9 +8,11 @@ import { Popup } from '@atlaskit/editor-common/ui';
|
|
|
8
8
|
import { findDomRefAtPos } from '@atlaskit/editor-prosemirror/utils';
|
|
9
9
|
import { akEditorFloatingDialogZIndex, akEditorFloatingOverlapPanelZIndex } from '@atlaskit/editor-shared-styles';
|
|
10
10
|
import { findCellRectClosestToPos, getSelectionRect, isSelectionType } from '@atlaskit/editor-tables/utils';
|
|
11
|
+
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
11
12
|
import { getPluginState } from '../../pm-plugins/plugin-factory';
|
|
12
13
|
import { contextualMenuDropdownWidthDnD, contextualMenuTriggerSize, tablePopupMenuFitHeight } from '../consts';
|
|
13
|
-
|
|
14
|
+
import { TABLE_MENU_WIDTH } from '../TableMenu/shared/consts';
|
|
15
|
+
import { CellMenuPopup } from './CellMenuPopup';
|
|
14
16
|
// Ignored via go/ees005
|
|
15
17
|
// eslint-disable-next-line import/no-named-as-default
|
|
16
18
|
import ContextualMenu from './ContextualMenu';
|
|
@@ -64,7 +66,7 @@ var FloatingContextualMenu = function FloatingContextualMenu(_ref) {
|
|
|
64
66
|
boundariesElement: boundariesElement,
|
|
65
67
|
scrollableElement: scrollableElement,
|
|
66
68
|
fitHeight: tablePopupMenuFitHeight,
|
|
67
|
-
fitWidth: contextualMenuDropdownWidthDnD
|
|
69
|
+
fitWidth: expValEquals('platform_editor_table_menu_updates', 'isEnabled', true) ? TABLE_MENU_WIDTH : contextualMenuDropdownWidthDnD
|
|
68
70
|
// z-index value below is to ensure that this menu is above other floating menu
|
|
69
71
|
// in table, but below floating dialogs like typeaheads, pickers, etc.
|
|
70
72
|
,
|
|
@@ -74,7 +76,15 @@ var FloatingContextualMenu = function FloatingContextualMenu(_ref) {
|
|
|
74
76
|
,
|
|
75
77
|
offset: [-7, 0],
|
|
76
78
|
stick: true
|
|
77
|
-
}, jsx(
|
|
79
|
+
}, expValEquals('platform_editor_table_menu_updates', 'isEnabled', true) ? jsx(CellMenuPopup, {
|
|
80
|
+
api: api,
|
|
81
|
+
editorView: editorView,
|
|
82
|
+
isCellMenuOpenByKeyboard: isCellMenuOpenByKeyboard,
|
|
83
|
+
isOpen: isOpen,
|
|
84
|
+
targetCellRef: targetCellRef
|
|
85
|
+
}) :
|
|
86
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/design-system/consistent-css-prop-usage -- Ignored via go/DSP-18766
|
|
87
|
+
jsx("div", {
|
|
78
88
|
css: tablePopupStyles()
|
|
79
89
|
}, jsx(ContextualMenu, {
|
|
80
90
|
editorView: editorView
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { ToolbarDropdownItemSection } from '@atlaskit/editor-toolbar';
|
|
3
|
+
import { MergeCellsItem } from './items/MergeCellsItem';
|
|
4
|
+
import { SplitCellItem } from './items/SplitCellItem';
|
|
5
|
+
import { CELL_MENU, CELL_ACTION_SECTION, CELL_DANGER_SECTION, CELL_MENU_SECTION_RANK, MERGE_CELLS_ITEM, SPLIT_CELL_ITEM, CELL_ACTION_SECTION_RANK } from './keys';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Returns the RegisterComponent[] array defining the cell contextual menu surface.
|
|
9
|
+
*
|
|
10
|
+
* This is a **UI-only stub** — all items are always visible with no conditional
|
|
11
|
+
* logic and no wired actions. Functional behaviour (actions, conditional visibility)
|
|
12
|
+
* will be connected in follow-up tickets.
|
|
13
|
+
*/
|
|
14
|
+
export var getCellMenuComponents = function getCellMenuComponents() {
|
|
15
|
+
return [
|
|
16
|
+
// --- Menu surface ---
|
|
17
|
+
{
|
|
18
|
+
type: CELL_MENU.type,
|
|
19
|
+
key: CELL_MENU.key
|
|
20
|
+
},
|
|
21
|
+
// --- Main action section (Background color, Merge cells, Split cell) ---
|
|
22
|
+
{
|
|
23
|
+
type: CELL_ACTION_SECTION.type,
|
|
24
|
+
key: CELL_ACTION_SECTION.key,
|
|
25
|
+
parents: [{
|
|
26
|
+
type: CELL_MENU.type,
|
|
27
|
+
key: CELL_MENU.key,
|
|
28
|
+
rank: CELL_MENU_SECTION_RANK[CELL_ACTION_SECTION.key]
|
|
29
|
+
}],
|
|
30
|
+
component: function component(props) {
|
|
31
|
+
return /*#__PURE__*/React.createElement(ToolbarDropdownItemSection, null, props.children);
|
|
32
|
+
}
|
|
33
|
+
}, {
|
|
34
|
+
type: MERGE_CELLS_ITEM.type,
|
|
35
|
+
key: MERGE_CELLS_ITEM.key,
|
|
36
|
+
parents: [{
|
|
37
|
+
type: CELL_ACTION_SECTION.type,
|
|
38
|
+
key: CELL_ACTION_SECTION.key,
|
|
39
|
+
rank: CELL_ACTION_SECTION_RANK[MERGE_CELLS_ITEM.key]
|
|
40
|
+
}],
|
|
41
|
+
component: function component() {
|
|
42
|
+
return /*#__PURE__*/React.createElement(MergeCellsItem, null);
|
|
43
|
+
}
|
|
44
|
+
}, {
|
|
45
|
+
type: SPLIT_CELL_ITEM.type,
|
|
46
|
+
key: SPLIT_CELL_ITEM.key,
|
|
47
|
+
parents: [{
|
|
48
|
+
type: CELL_ACTION_SECTION.type,
|
|
49
|
+
key: CELL_ACTION_SECTION.key,
|
|
50
|
+
rank: CELL_ACTION_SECTION_RANK[SPLIT_CELL_ITEM.key]
|
|
51
|
+
}],
|
|
52
|
+
component: function component() {
|
|
53
|
+
return /*#__PURE__*/React.createElement(SplitCellItem, null);
|
|
54
|
+
}
|
|
55
|
+
},
|
|
56
|
+
// --- Danger section (Clear cell) ---
|
|
57
|
+
{
|
|
58
|
+
type: CELL_DANGER_SECTION.type,
|
|
59
|
+
key: CELL_DANGER_SECTION.key,
|
|
60
|
+
parents: [{
|
|
61
|
+
type: CELL_MENU.type,
|
|
62
|
+
key: CELL_MENU.key,
|
|
63
|
+
rank: CELL_MENU_SECTION_RANK[CELL_DANGER_SECTION.key]
|
|
64
|
+
}],
|
|
65
|
+
component: function component(props) {
|
|
66
|
+
return /*#__PURE__*/React.createElement(ToolbarDropdownItemSection, {
|
|
67
|
+
hasSeparator: true
|
|
68
|
+
}, props.children);
|
|
69
|
+
}
|
|
70
|
+
}];
|
|
71
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { useIntl } from 'react-intl';
|
|
3
|
+
import { tableMessages as messages } from '@atlaskit/editor-common/messages';
|
|
4
|
+
import { TableCellMergeIcon, ToolbarDropdownItem } from '@atlaskit/editor-toolbar';
|
|
5
|
+
export var MergeCellsItem = function MergeCellsItem() {
|
|
6
|
+
var _useIntl = useIntl(),
|
|
7
|
+
formatMessage = _useIntl.formatMessage;
|
|
8
|
+
return /*#__PURE__*/React.createElement(ToolbarDropdownItem, {
|
|
9
|
+
elemBefore: /*#__PURE__*/React.createElement(TableCellMergeIcon, {
|
|
10
|
+
label: "",
|
|
11
|
+
size: "small"
|
|
12
|
+
})
|
|
13
|
+
}, formatMessage(messages.mergeCells));
|
|
14
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { useIntl } from 'react-intl';
|
|
3
|
+
import { tableMessages as messages } from '@atlaskit/editor-common/messages';
|
|
4
|
+
import { TableCellSplitIcon, ToolbarDropdownItem } from '@atlaskit/editor-toolbar';
|
|
5
|
+
export var SplitCellItem = function SplitCellItem() {
|
|
6
|
+
var _useIntl = useIntl(),
|
|
7
|
+
formatMessage = _useIntl.formatMessage;
|
|
8
|
+
return /*#__PURE__*/React.createElement(ToolbarDropdownItem, {
|
|
9
|
+
elemBefore: /*#__PURE__*/React.createElement(TableCellSplitIcon, {
|
|
10
|
+
label: "",
|
|
11
|
+
size: "small"
|
|
12
|
+
})
|
|
13
|
+
}, formatMessage(messages.splitCell));
|
|
14
|
+
};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
|
+
import { BACKGROUND_COLOR_ITEM, CLEAR_CELLS_ITEM } from '../shared/keys';
|
|
3
|
+
|
|
4
|
+
// --- Menu surface ---
|
|
5
|
+
|
|
6
|
+
export var CELL_MENU = {
|
|
7
|
+
type: 'menu',
|
|
8
|
+
key: 'cell-contextual-menu'
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
// --- Sections ---
|
|
12
|
+
|
|
13
|
+
export var CELL_ACTION_SECTION = {
|
|
14
|
+
type: 'menu-section',
|
|
15
|
+
key: 'cell-action-section'
|
|
16
|
+
};
|
|
17
|
+
export var CELL_DANGER_SECTION = {
|
|
18
|
+
type: 'menu-section',
|
|
19
|
+
key: 'cell-danger-section'
|
|
20
|
+
};
|
|
21
|
+
export var CELL_MENU_SECTION_RANK = _defineProperty(_defineProperty({}, CELL_ACTION_SECTION.key, 100), CELL_DANGER_SECTION.key, 200);
|
|
22
|
+
export var MERGE_CELLS_ITEM = {
|
|
23
|
+
type: 'menu-item',
|
|
24
|
+
key: 'merge-cells'
|
|
25
|
+
};
|
|
26
|
+
export var SPLIT_CELL_ITEM = {
|
|
27
|
+
type: 'menu-item',
|
|
28
|
+
key: 'split-cell'
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
// --- Item ranks within their sections ---
|
|
32
|
+
|
|
33
|
+
export var CELL_ACTION_SECTION_RANK = _defineProperty(_defineProperty(_defineProperty({}, BACKGROUND_COLOR_ITEM.key, 100), MERGE_CELLS_ITEM.key, 200), SPLIT_CELL_ITEM.key, 300);
|
|
34
|
+
export var CELL_DANGER_SECTION_RANK = _defineProperty({}, CLEAR_CELLS_ITEM.key, 100);
|
|
@@ -1,14 +1,10 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { useIntl } from 'react-intl';
|
|
3
|
-
import { moveColumnRight,
|
|
3
|
+
import { moveColumnRight, tooltip } from '@atlaskit/editor-common/keymaps';
|
|
4
4
|
import { tableMessages as messages } from '@atlaskit/editor-common/messages';
|
|
5
5
|
import { TableColumnMoveRightIcon, ToolbarDropdownItem, ToolbarKeyboardShortcutHint } from '@atlaskit/editor-toolbar';
|
|
6
|
-
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
7
|
-
var getMoveColumnRightShortcut = function getMoveColumnRightShortcut() {
|
|
8
|
-
return tooltip(expValEquals('editor-a11y-fy26-keyboard-move-row-column', 'isEnabled', true) ? moveColumnRight : moveColumnRightOld);
|
|
9
|
-
};
|
|
10
6
|
export var MoveColumnRightItem = function MoveColumnRightItem() {
|
|
11
|
-
var
|
|
7
|
+
var _tooltip;
|
|
12
8
|
var _useIntl = useIntl(),
|
|
13
9
|
formatMessage = _useIntl.formatMessage;
|
|
14
10
|
return /*#__PURE__*/React.createElement(ToolbarDropdownItem, {
|
|
@@ -18,7 +14,7 @@ export var MoveColumnRightItem = function MoveColumnRightItem() {
|
|
|
18
14
|
size: "small"
|
|
19
15
|
}),
|
|
20
16
|
elemAfter: /*#__PURE__*/React.createElement(ToolbarKeyboardShortcutHint, {
|
|
21
|
-
shortcut: (
|
|
17
|
+
shortcut: (_tooltip = tooltip(moveColumnRight)) !== null && _tooltip !== void 0 ? _tooltip : ''
|
|
22
18
|
})
|
|
23
19
|
}, formatMessage(messages.moveColumnRight, {
|
|
24
20
|
0: 1
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
import { CELL_ACTION_SECTION, CELL_DANGER_SECTION, CELL_ACTION_SECTION_RANK, CELL_DANGER_SECTION_RANK } from '../cell/keys';
|
|
2
3
|
import { COLUMN_BACKGROUND_SECTION, COLUMN_DANGER_SECTION, COLUMN_BACKGROUND_SECTION_RANK, COLUMN_DANGER_SECTION_RANK } from '../column/keys';
|
|
3
4
|
import { ROW_BACKGROUND_SECTION, ROW_DANGER_SECTION, ROW_BACKGROUND_SECTION_RANK, ROW_DANGER_SECTION_RANK } from '../row/keys';
|
|
4
5
|
import { BackgroundColorItem } from './items/BackgroundColorItem';
|
|
@@ -16,6 +17,10 @@ export var getSharedItems = function getSharedItems() {
|
|
|
16
17
|
type: COLUMN_BACKGROUND_SECTION.type,
|
|
17
18
|
key: COLUMN_BACKGROUND_SECTION.key,
|
|
18
19
|
rank: COLUMN_BACKGROUND_SECTION_RANK[BACKGROUND_COLOR_ITEM.key]
|
|
20
|
+
}, {
|
|
21
|
+
type: CELL_ACTION_SECTION.type,
|
|
22
|
+
key: CELL_ACTION_SECTION.key,
|
|
23
|
+
rank: CELL_ACTION_SECTION_RANK[BACKGROUND_COLOR_ITEM.key]
|
|
19
24
|
}],
|
|
20
25
|
component: function component() {
|
|
21
26
|
return /*#__PURE__*/React.createElement(BackgroundColorItem, null);
|
|
@@ -31,6 +36,10 @@ export var getSharedItems = function getSharedItems() {
|
|
|
31
36
|
type: COLUMN_DANGER_SECTION.type,
|
|
32
37
|
key: COLUMN_DANGER_SECTION.key,
|
|
33
38
|
rank: COLUMN_DANGER_SECTION_RANK[CLEAR_CELLS_ITEM.key]
|
|
39
|
+
}, {
|
|
40
|
+
type: CELL_DANGER_SECTION.type,
|
|
41
|
+
key: CELL_DANGER_SECTION.key,
|
|
42
|
+
rank: CELL_DANGER_SECTION_RANK[CLEAR_CELLS_ITEM.key]
|
|
34
43
|
}],
|
|
35
44
|
component: function component() {
|
|
36
45
|
return /*#__PURE__*/React.createElement(ClearCellsItem, null);
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
|
|
2
|
+
import { getCellMenuComponents } from '../cell/getCellMenuComponents';
|
|
2
3
|
import { getColumnMenuComponents } from '../column/getColumnMenuComponents';
|
|
3
4
|
import { getRowMenuComponents } from '../row/getRowMenuComponents';
|
|
4
5
|
import { getSharedItems } from './getSharedItems';
|
|
5
6
|
export var getTableMenuComponents = function getTableMenuComponents() {
|
|
6
|
-
return [].concat(_toConsumableArray(getRowMenuComponents()), _toConsumableArray(getColumnMenuComponents()), _toConsumableArray(getSharedItems()));
|
|
7
|
+
return [].concat(_toConsumableArray(getRowMenuComponents()), _toConsumableArray(getColumnMenuComponents()), _toConsumableArray(getCellMenuComponents()), _toConsumableArray(getSharedItems()));
|
|
7
8
|
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
3
|
+
import type { PluginInjectionAPI } from '../../types';
|
|
4
|
+
type CellMenuPopupProps = {
|
|
5
|
+
api: PluginInjectionAPI | undefined | null;
|
|
6
|
+
editorView: EditorView;
|
|
7
|
+
isCellMenuOpenByKeyboard?: boolean;
|
|
8
|
+
isOpen: boolean;
|
|
9
|
+
targetCellRef: Node;
|
|
10
|
+
};
|
|
11
|
+
export declare const CellMenuPopup: ({ api, editorView, isCellMenuOpenByKeyboard, isOpen, targetCellRef, }: CellMenuPopupProps) => React.JSX.Element;
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { RegisterComponent } from '@atlaskit/editor-ui-control-model';
|
|
2
|
+
/**
|
|
3
|
+
* Returns the RegisterComponent[] array defining the cell contextual menu surface.
|
|
4
|
+
*
|
|
5
|
+
* This is a **UI-only stub** — all items are always visible with no conditional
|
|
6
|
+
* logic and no wired actions. Functional behaviour (actions, conditional visibility)
|
|
7
|
+
* will be connected in follow-up tickets.
|
|
8
|
+
*/
|
|
9
|
+
export declare const getCellMenuComponents: () => RegisterComponent[];
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { MenuItemType, MenuSectionType, MenuType } from '@atlaskit/editor-ui-control-model';
|
|
2
|
+
export declare const CELL_MENU: MenuType;
|
|
3
|
+
export declare const CELL_ACTION_SECTION: MenuSectionType;
|
|
4
|
+
export declare const CELL_DANGER_SECTION: MenuSectionType;
|
|
5
|
+
export declare const CELL_MENU_SECTION_RANK: Record<string, number>;
|
|
6
|
+
export declare const MERGE_CELLS_ITEM: MenuItemType;
|
|
7
|
+
export declare const SPLIT_CELL_ITEM: MenuItemType;
|
|
8
|
+
export declare const CELL_ACTION_SECTION_RANK: Record<string, number>;
|
|
9
|
+
export declare const CELL_DANGER_SECTION_RANK: Record<string, number>;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
3
|
+
import type { PluginInjectionAPI } from '../../types';
|
|
4
|
+
type CellMenuPopupProps = {
|
|
5
|
+
api: PluginInjectionAPI | undefined | null;
|
|
6
|
+
editorView: EditorView;
|
|
7
|
+
isCellMenuOpenByKeyboard?: boolean;
|
|
8
|
+
isOpen: boolean;
|
|
9
|
+
targetCellRef: Node;
|
|
10
|
+
};
|
|
11
|
+
export declare const CellMenuPopup: ({ api, editorView, isCellMenuOpenByKeyboard, isOpen, targetCellRef, }: CellMenuPopupProps) => React.JSX.Element;
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { RegisterComponent } from '@atlaskit/editor-ui-control-model';
|
|
2
|
+
/**
|
|
3
|
+
* Returns the RegisterComponent[] array defining the cell contextual menu surface.
|
|
4
|
+
*
|
|
5
|
+
* This is a **UI-only stub** — all items are always visible with no conditional
|
|
6
|
+
* logic and no wired actions. Functional behaviour (actions, conditional visibility)
|
|
7
|
+
* will be connected in follow-up tickets.
|
|
8
|
+
*/
|
|
9
|
+
export declare const getCellMenuComponents: () => RegisterComponent[];
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { MenuItemType, MenuSectionType, MenuType } from '@atlaskit/editor-ui-control-model';
|
|
2
|
+
export declare const CELL_MENU: MenuType;
|
|
3
|
+
export declare const CELL_ACTION_SECTION: MenuSectionType;
|
|
4
|
+
export declare const CELL_DANGER_SECTION: MenuSectionType;
|
|
5
|
+
export declare const CELL_MENU_SECTION_RANK: Record<string, number>;
|
|
6
|
+
export declare const MERGE_CELLS_ITEM: MenuItemType;
|
|
7
|
+
export declare const SPLIT_CELL_ITEM: MenuItemType;
|
|
8
|
+
export declare const CELL_ACTION_SECTION_RANK: Record<string, number>;
|
|
9
|
+
export declare const CELL_DANGER_SECTION_RANK: Record<string, number>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-table",
|
|
3
|
-
"version": "22.4.
|
|
3
|
+
"version": "22.4.8",
|
|
4
4
|
"description": "Table plugin for the @atlaskit/editor",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
"singleton": true
|
|
29
29
|
},
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@atlaskit/adf-schema": "^52.
|
|
31
|
+
"@atlaskit/adf-schema": "^52.12.0",
|
|
32
32
|
"@atlaskit/button": "^23.11.0",
|
|
33
33
|
"@atlaskit/custom-steps": "^0.17.0",
|
|
34
34
|
"@atlaskit/editor-palette": "^2.2.0",
|
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
"@atlaskit/editor-prosemirror": "^7.3.0",
|
|
50
50
|
"@atlaskit/editor-shared-styles": "^3.11.0",
|
|
51
51
|
"@atlaskit/editor-tables": "^2.10.0",
|
|
52
|
-
"@atlaskit/editor-toolbar": "^1.
|
|
52
|
+
"@atlaskit/editor-toolbar": "^1.6.0",
|
|
53
53
|
"@atlaskit/editor-ui-control-model": "^1.2.0",
|
|
54
54
|
"@atlaskit/icon": "^35.0.0",
|
|
55
55
|
"@atlaskit/insm": "^0.4.0",
|