@atlaskit/editor-plugin-table 23.3.4 → 23.3.6
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 +13 -0
- package/dist/cjs/pm-plugins/commands/active-table-menu.js +19 -8
- package/dist/cjs/pm-plugins/commands/commands-with-analytics.js +9 -49
- package/dist/cjs/pm-plugins/drag-and-drop/plugin.js +1 -1
- package/dist/cjs/pm-plugins/handlers.js +1 -1
- package/dist/cjs/pm-plugins/main.js +4 -1
- package/dist/cjs/ui/ContentComponent.js +11 -1
- package/dist/cjs/ui/FloatingContextualButton/index.js +2 -2
- package/dist/cjs/ui/FloatingContextualMenu/CellMenuPopup.js +2 -2
- package/dist/cjs/ui/FloatingDragMenu/index.js +10 -38
- package/dist/cjs/ui/FloatingTableMenu/index.js +175 -0
- package/dist/cjs/ui/TableFloatingColumnControls/ColumnControls/index.js +43 -11
- package/dist/cjs/ui/TableFloatingControls/RowControls/DragControls.js +57 -26
- package/dist/cjs/ui/TableMenu/cell/items/MergeCellsItem.js +1 -1
- package/dist/cjs/ui/TableMenu/cell/items/SplitCellItem.js +1 -1
- package/dist/cjs/ui/TableMenu/cell/items/VerticalAlignDropdownItem.js +1 -1
- package/dist/cjs/ui/TableMenu/column/items/AddColumnLeftItem.js +1 -1
- package/dist/cjs/ui/TableMenu/column/items/AddColumnRightItem.js +1 -1
- package/dist/cjs/ui/TableMenu/column/items/DeleteColumnItem.js +1 -1
- package/dist/cjs/ui/TableMenu/column/items/DistributeColumnsItem.js +1 -1
- package/dist/cjs/ui/TableMenu/column/items/MoveColumnLeftItem.js +1 -1
- package/dist/cjs/ui/TableMenu/column/items/MoveColumnRightItem.js +1 -1
- package/dist/cjs/ui/TableMenu/column/items/SortDecreasingItem.js +1 -1
- package/dist/cjs/ui/TableMenu/column/items/SortIncreasingItem.js +1 -1
- package/dist/cjs/ui/TableMenu/row/items/AddRowAboveItem.js +1 -1
- package/dist/cjs/ui/TableMenu/row/items/AddRowBelowItem.js +1 -1
- package/dist/cjs/ui/TableMenu/row/items/DeleteRowItem.js +1 -1
- package/dist/cjs/ui/TableMenu/row/items/MoveRowDownItem.js +1 -1
- package/dist/cjs/ui/TableMenu/row/items/MoveRowUpItem.js +1 -1
- package/dist/cjs/ui/TableMenu/shared/TableMenu.js +8 -8
- package/dist/cjs/ui/TableMenu/shared/consts.js +1 -1
- package/dist/cjs/ui/TableMenu/shared/items/BackgroundColorItem.js +1 -1
- package/dist/cjs/ui/TableMenu/shared/items/ClearCellsItem.js +1 -1
- package/dist/es2019/pm-plugins/commands/active-table-menu.js +19 -8
- package/dist/es2019/pm-plugins/commands/commands-with-analytics.js +0 -39
- package/dist/es2019/pm-plugins/drag-and-drop/plugin.js +1 -1
- package/dist/es2019/pm-plugins/handlers.js +1 -1
- package/dist/es2019/pm-plugins/main.js +3 -0
- package/dist/es2019/ui/ContentComponent.js +11 -1
- package/dist/es2019/ui/FloatingContextualButton/index.js +2 -2
- package/dist/es2019/ui/FloatingContextualMenu/CellMenuPopup.js +2 -2
- package/dist/es2019/ui/FloatingDragMenu/index.js +11 -40
- package/dist/es2019/ui/FloatingTableMenu/index.js +165 -0
- package/dist/es2019/ui/TableFloatingColumnControls/ColumnControls/index.js +41 -7
- package/dist/es2019/ui/TableFloatingControls/RowControls/DragControls.js +40 -7
- package/dist/es2019/ui/TableMenu/cell/items/MergeCellsItem.js +1 -1
- package/dist/es2019/ui/TableMenu/cell/items/SplitCellItem.js +1 -1
- package/dist/es2019/ui/TableMenu/cell/items/VerticalAlignDropdownItem.js +1 -1
- package/dist/es2019/ui/TableMenu/column/items/AddColumnLeftItem.js +1 -1
- package/dist/es2019/ui/TableMenu/column/items/AddColumnRightItem.js +1 -1
- package/dist/es2019/ui/TableMenu/column/items/DeleteColumnItem.js +1 -1
- package/dist/es2019/ui/TableMenu/column/items/DistributeColumnsItem.js +1 -1
- package/dist/es2019/ui/TableMenu/column/items/MoveColumnLeftItem.js +1 -1
- package/dist/es2019/ui/TableMenu/column/items/MoveColumnRightItem.js +1 -1
- package/dist/es2019/ui/TableMenu/column/items/SortDecreasingItem.js +1 -1
- package/dist/es2019/ui/TableMenu/column/items/SortIncreasingItem.js +1 -1
- package/dist/es2019/ui/TableMenu/row/items/AddRowAboveItem.js +1 -1
- package/dist/es2019/ui/TableMenu/row/items/AddRowBelowItem.js +1 -1
- package/dist/es2019/ui/TableMenu/row/items/DeleteRowItem.js +1 -1
- package/dist/es2019/ui/TableMenu/row/items/MoveRowDownItem.js +1 -1
- package/dist/es2019/ui/TableMenu/row/items/MoveRowUpItem.js +1 -1
- package/dist/es2019/ui/TableMenu/shared/TableMenu.js +8 -8
- package/dist/es2019/ui/TableMenu/shared/consts.js +1 -1
- package/dist/es2019/ui/TableMenu/shared/items/BackgroundColorItem.js +1 -1
- package/dist/es2019/ui/TableMenu/shared/items/ClearCellsItem.js +1 -1
- package/dist/esm/pm-plugins/commands/active-table-menu.js +19 -8
- package/dist/esm/pm-plugins/commands/commands-with-analytics.js +8 -48
- package/dist/esm/pm-plugins/drag-and-drop/plugin.js +1 -1
- package/dist/esm/pm-plugins/handlers.js +1 -1
- package/dist/esm/pm-plugins/main.js +4 -1
- package/dist/esm/ui/ContentComponent.js +11 -1
- package/dist/esm/ui/FloatingContextualButton/index.js +2 -2
- package/dist/esm/ui/FloatingContextualMenu/CellMenuPopup.js +2 -2
- package/dist/esm/ui/FloatingDragMenu/index.js +11 -39
- package/dist/esm/ui/FloatingTableMenu/index.js +167 -0
- package/dist/esm/ui/TableFloatingColumnControls/ColumnControls/index.js +42 -10
- package/dist/esm/ui/TableFloatingControls/RowControls/DragControls.js +56 -25
- package/dist/esm/ui/TableMenu/cell/items/MergeCellsItem.js +1 -1
- package/dist/esm/ui/TableMenu/cell/items/SplitCellItem.js +1 -1
- package/dist/esm/ui/TableMenu/cell/items/VerticalAlignDropdownItem.js +1 -1
- package/dist/esm/ui/TableMenu/column/items/AddColumnLeftItem.js +1 -1
- package/dist/esm/ui/TableMenu/column/items/AddColumnRightItem.js +1 -1
- package/dist/esm/ui/TableMenu/column/items/DeleteColumnItem.js +1 -1
- package/dist/esm/ui/TableMenu/column/items/DistributeColumnsItem.js +1 -1
- package/dist/esm/ui/TableMenu/column/items/MoveColumnLeftItem.js +1 -1
- package/dist/esm/ui/TableMenu/column/items/MoveColumnRightItem.js +1 -1
- package/dist/esm/ui/TableMenu/column/items/SortDecreasingItem.js +1 -1
- package/dist/esm/ui/TableMenu/column/items/SortIncreasingItem.js +1 -1
- package/dist/esm/ui/TableMenu/row/items/AddRowAboveItem.js +1 -1
- package/dist/esm/ui/TableMenu/row/items/AddRowBelowItem.js +1 -1
- package/dist/esm/ui/TableMenu/row/items/DeleteRowItem.js +1 -1
- package/dist/esm/ui/TableMenu/row/items/MoveRowDownItem.js +1 -1
- package/dist/esm/ui/TableMenu/row/items/MoveRowUpItem.js +1 -1
- package/dist/esm/ui/TableMenu/shared/TableMenu.js +8 -8
- package/dist/esm/ui/TableMenu/shared/consts.js +1 -1
- package/dist/esm/ui/TableMenu/shared/items/BackgroundColorItem.js +1 -1
- package/dist/esm/ui/TableMenu/shared/items/ClearCellsItem.js +1 -1
- package/dist/types/pm-plugins/commands/active-table-menu.d.ts +3 -3
- package/dist/types/pm-plugins/commands/commands-with-analytics.d.ts +1 -3
- package/dist/types/ui/FloatingTableMenu/index.d.ts +23 -0
- package/dist/types/ui/TableMenu/shared/consts.d.ts +1 -1
- package/dist/types-ts4.5/pm-plugins/commands/active-table-menu.d.ts +3 -3
- package/dist/types-ts4.5/pm-plugins/commands/commands-with-analytics.d.ts +1 -3
- package/dist/types-ts4.5/ui/FloatingTableMenu/index.d.ts +23 -0
- package/dist/types-ts4.5/ui/TableMenu/shared/consts.d.ts +1 -1
- package/package.json +5 -5
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
/* eslint-disable @atlaskit/design-system/prefer-primitives */
|
|
2
2
|
|
|
3
3
|
import React, { useCallback, useMemo, useRef } from 'react';
|
|
4
|
+
import { ACTION_SUBJECT, EVENT_TYPE, INPUT_METHOD, TABLE_ACTION } from '@atlaskit/editor-common/analytics';
|
|
4
5
|
import { useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
|
|
5
6
|
import { tableCellMinWidth } from '@atlaskit/editor-common/styles';
|
|
6
7
|
import { akEditorTableNumberColumnWidth } from '@atlaskit/editor-shared-styles';
|
|
7
8
|
import { CellSelection } from '@atlaskit/editor-tables';
|
|
8
9
|
import { getSelectionRect } from '@atlaskit/editor-tables/utils';
|
|
9
10
|
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
10
|
-
import { clearHoverSelection, hoverCell, hoverColumns, selectColumn, selectColumns } from '../../../pm-plugins/commands';
|
|
11
|
-
import { toggleActiveTableMenuWithAnalytics } from '../../../pm-plugins/commands/commands-with-analytics';
|
|
11
|
+
import { clearHoverSelection, closeActiveTableMenu, hoverCell, hoverColumns, selectColumn, selectColumns, toggleActiveTableMenu } from '../../../pm-plugins/commands';
|
|
12
12
|
import { toggleDragMenuWithAnalytics } from '../../../pm-plugins/drag-and-drop/commands-with-analytics';
|
|
13
|
+
import { getPluginState as getTablePluginState } from '../../../pm-plugins/plugin-factory';
|
|
13
14
|
import { getRowsParams } from '../../../pm-plugins/utils/row-controls';
|
|
14
15
|
import { getSelectedColumnIndexes } from '../../../pm-plugins/utils/selection';
|
|
15
16
|
import { TableCssClassName as ClassName } from '../../../types';
|
|
@@ -25,7 +26,7 @@ var getSelectedColumns = function getSelectedColumns(selection) {
|
|
|
25
26
|
return [];
|
|
26
27
|
};
|
|
27
28
|
export var ColumnControls = function ColumnControls(_ref) {
|
|
28
|
-
var _colWidths$map$join
|
|
29
|
+
var _colWidths$map$join;
|
|
29
30
|
var editorView = _ref.editorView,
|
|
30
31
|
tableActive = _ref.tableActive,
|
|
31
32
|
tableRef = _ref.tableRef,
|
|
@@ -122,17 +123,48 @@ export var ColumnControls = function ColumnControls(_ref) {
|
|
|
122
123
|
var state = editorView.state,
|
|
123
124
|
dispatch = editorView.dispatch;
|
|
124
125
|
if (event !== null && event !== void 0 && event.shiftKey) {
|
|
126
|
+
// Shift-click extends the selection rather than toggling the menu, but the
|
|
127
|
+
// open drag menu would otherwise stay anchored to a stale column. Close it here
|
|
128
|
+
// for the updated menu (legacy menu closes via outside-click on its dropdown).
|
|
129
|
+
if (expValEquals('platform_editor_table_menu_updates', 'isEnabled', true)) {
|
|
130
|
+
api === null || api === void 0 || api.core.actions.execute(closeActiveTableMenu(api));
|
|
131
|
+
}
|
|
125
132
|
return;
|
|
126
133
|
}
|
|
127
134
|
if (expValEquals('platform_editor_table_menu_updates', 'isEnabled', true)) {
|
|
128
|
-
if (colIndex !== undefined) {
|
|
129
|
-
var
|
|
130
|
-
|
|
135
|
+
if (colIndex !== undefined && api) {
|
|
136
|
+
var _getTablePluginState = getTablePluginState(state),
|
|
137
|
+
currentActiveTableMenu = _getTablePluginState.activeTableMenu;
|
|
138
|
+
var isSameActiveMenu = (currentActiveTableMenu === null || currentActiveTableMenu === void 0 ? void 0 : currentActiveTableMenu.type) === 'column' && currentActiveTableMenu.index === colIndex;
|
|
139
|
+
api.core.actions.execute(function (_ref2) {
|
|
140
|
+
var tr = _ref2.tr;
|
|
141
|
+
if (!isSameActiveMenu) {
|
|
142
|
+
var _api$analytics;
|
|
143
|
+
(_api$analytics = api.analytics) === null || _api$analytics === void 0 || (_api$analytics = _api$analytics.actions) === null || _api$analytics === void 0 || _api$analytics.attachAnalyticsEvent({
|
|
144
|
+
action: TABLE_ACTION.DRAG_MENU_OPENED,
|
|
145
|
+
actionSubject: ACTION_SUBJECT.TABLE,
|
|
146
|
+
actionSubjectId: null,
|
|
147
|
+
eventType: EVENT_TYPE.TRACK,
|
|
148
|
+
attributes: {
|
|
149
|
+
inputMethod: trigger === 'keyboard' ? INPUT_METHOD.KEYBOARD : INPUT_METHOD.MOUSE,
|
|
150
|
+
direction: 'column'
|
|
151
|
+
}
|
|
152
|
+
})(tr);
|
|
153
|
+
}
|
|
154
|
+
toggleActiveTableMenu({
|
|
155
|
+
type: 'column',
|
|
156
|
+
index: colIndex,
|
|
157
|
+
openedBy: trigger
|
|
158
|
+
}, currentActiveTableMenu, api)({
|
|
159
|
+
tr: tr
|
|
160
|
+
});
|
|
161
|
+
return tr;
|
|
162
|
+
});
|
|
131
163
|
}
|
|
132
164
|
return;
|
|
133
165
|
}
|
|
134
166
|
toggleDragMenuWithAnalytics(api === null || api === void 0 || (_api$analytics2 = api.analytics) === null || _api$analytics2 === void 0 ? void 0 : _api$analytics2.actions)(undefined, 'column', colIndex, trigger)(state, dispatch);
|
|
135
|
-
}, [editorView, colIndex, api
|
|
167
|
+
}, [editorView, colIndex, api]);
|
|
136
168
|
var colIndexes = useMemo(function () {
|
|
137
169
|
// Ignored via go/ees005
|
|
138
170
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
@@ -239,9 +271,9 @@ export var ColumnControls = function ColumnControls(_ref) {
|
|
|
239
271
|
overflowX: stickyTop ? 'hidden' : 'visible',
|
|
240
272
|
pointerEvents: isDragging ? 'none' : undefined
|
|
241
273
|
}
|
|
242
|
-
}, columnParams.map(function (
|
|
243
|
-
var startIndex =
|
|
244
|
-
endIndex =
|
|
274
|
+
}, columnParams.map(function (_ref3, index) {
|
|
275
|
+
var startIndex = _ref3.startIndex,
|
|
276
|
+
endIndex = _ref3.endIndex;
|
|
245
277
|
return /*#__PURE__*/React.createElement("div", {
|
|
246
278
|
style: {
|
|
247
279
|
gridColumn: "".concat(startIndex + 1, " / span 1")
|
|
@@ -2,13 +2,13 @@ import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
|
2
2
|
/* eslint-disable @atlaskit/design-system/prefer-primitives */
|
|
3
3
|
|
|
4
4
|
import React, { Fragment, useCallback, useEffect, useMemo, useState } from 'react';
|
|
5
|
+
import { ACTION_SUBJECT, EVENT_TYPE, INPUT_METHOD, TABLE_ACTION } from '@atlaskit/editor-common/analytics';
|
|
5
6
|
import { useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
|
|
6
7
|
import { CellSelection } from '@atlaskit/editor-tables';
|
|
7
8
|
import { getSelectionRect } from '@atlaskit/editor-tables/utils';
|
|
8
9
|
import { monitorForElements } from '@atlaskit/pragmatic-drag-and-drop/element/adapter';
|
|
9
10
|
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
10
|
-
import { clearHoverSelection } from '../../../pm-plugins/commands';
|
|
11
|
-
import { toggleActiveTableMenuWithAnalytics } from '../../../pm-plugins/commands/commands-with-analytics';
|
|
11
|
+
import { clearHoverSelection, closeActiveTableMenu, toggleActiveTableMenu } from '../../../pm-plugins/commands';
|
|
12
12
|
import { toggleDragMenuWithAnalytics } from '../../../pm-plugins/drag-and-drop/commands-with-analytics';
|
|
13
13
|
import { getPluginState as getTablePluginState } from '../../../pm-plugins/plugin-factory';
|
|
14
14
|
import { getRowHeights, getRowsParams } from '../../../pm-plugins/utils/row-controls';
|
|
@@ -28,7 +28,7 @@ var getSelectedRows = function getSelectedRows(selection) {
|
|
|
28
28
|
return [];
|
|
29
29
|
};
|
|
30
30
|
export var DragControls = function DragControls(_ref) {
|
|
31
|
-
var _tableNode$attrs$loca, _tableNode$attrs
|
|
31
|
+
var _tableNode$attrs$loca, _tableNode$attrs;
|
|
32
32
|
var tableRef = _ref.tableRef,
|
|
33
33
|
tableNode = _ref.tableNode,
|
|
34
34
|
tableWidth = _ref.tableWidth,
|
|
@@ -83,18 +83,49 @@ export var DragControls = function DragControls(_ref) {
|
|
|
83
83
|
var toggleDragMenuHandler = useCallback(function (trigger, event) {
|
|
84
84
|
var _api$analytics2;
|
|
85
85
|
if (event !== null && event !== void 0 && event.shiftKey) {
|
|
86
|
+
// Shift-click extends the selection rather than toggling the menu, but the
|
|
87
|
+
// open drag menu would otherwise stay anchored to a stale row. Close it here
|
|
88
|
+
// for the updated menu (legacy menu closes via outside-click on its dropdown).
|
|
89
|
+
if (expValEquals('platform_editor_table_menu_updates', 'isEnabled', true)) {
|
|
90
|
+
api === null || api === void 0 || api.core.actions.execute(closeActiveTableMenu(api));
|
|
91
|
+
}
|
|
86
92
|
return;
|
|
87
93
|
}
|
|
88
94
|
var rowIndex = hoveredCell === null || hoveredCell === void 0 ? void 0 : hoveredCell.rowIndex;
|
|
89
95
|
if (expValEquals('platform_editor_table_menu_updates', 'isEnabled', true)) {
|
|
90
|
-
if (rowIndex !== undefined) {
|
|
91
|
-
var
|
|
92
|
-
|
|
96
|
+
if (rowIndex !== undefined && api) {
|
|
97
|
+
var _getTablePluginState2 = getTablePluginState(editorView.state),
|
|
98
|
+
currentActiveTableMenu = _getTablePluginState2.activeTableMenu;
|
|
99
|
+
var isSameActiveMenu = (currentActiveTableMenu === null || currentActiveTableMenu === void 0 ? void 0 : currentActiveTableMenu.type) === 'row' && currentActiveTableMenu.index === rowIndex;
|
|
100
|
+
api.core.actions.execute(function (_ref4) {
|
|
101
|
+
var tr = _ref4.tr;
|
|
102
|
+
if (!isSameActiveMenu) {
|
|
103
|
+
var _api$analytics;
|
|
104
|
+
(_api$analytics = api.analytics) === null || _api$analytics === void 0 || (_api$analytics = _api$analytics.actions) === null || _api$analytics === void 0 || _api$analytics.attachAnalyticsEvent({
|
|
105
|
+
action: TABLE_ACTION.DRAG_MENU_OPENED,
|
|
106
|
+
actionSubject: ACTION_SUBJECT.TABLE,
|
|
107
|
+
actionSubjectId: null,
|
|
108
|
+
eventType: EVENT_TYPE.TRACK,
|
|
109
|
+
attributes: {
|
|
110
|
+
inputMethod: trigger === 'keyboard' ? INPUT_METHOD.KEYBOARD : INPUT_METHOD.MOUSE,
|
|
111
|
+
direction: 'row'
|
|
112
|
+
}
|
|
113
|
+
})(tr);
|
|
114
|
+
}
|
|
115
|
+
toggleActiveTableMenu({
|
|
116
|
+
type: 'row',
|
|
117
|
+
index: rowIndex,
|
|
118
|
+
openedBy: trigger
|
|
119
|
+
}, currentActiveTableMenu, api)({
|
|
120
|
+
tr: tr
|
|
121
|
+
});
|
|
122
|
+
return tr;
|
|
123
|
+
});
|
|
93
124
|
}
|
|
94
125
|
return;
|
|
95
126
|
}
|
|
96
127
|
toggleDragMenuWithAnalytics(api === null || api === void 0 || (_api$analytics2 = api.analytics) === null || _api$analytics2 === void 0 ? void 0 : _api$analytics2.actions)(undefined, 'row', rowIndex, trigger)(editorView.state, editorView.dispatch);
|
|
97
|
-
}, [editorView, hoveredCell === null || hoveredCell === void 0 ? void 0 : hoveredCell.rowIndex, api
|
|
128
|
+
}, [editorView, hoveredCell === null || hoveredCell === void 0 ? void 0 : hoveredCell.rowIndex, api]);
|
|
98
129
|
var rowIndex = hoveredCell === null || hoveredCell === void 0 ? void 0 : hoveredCell.rowIndex;
|
|
99
130
|
var handleMouseOut = useCallback(function () {
|
|
100
131
|
if (tableActive) {
|
|
@@ -225,9 +256,9 @@ export var DragControls = function DragControls(_ref) {
|
|
|
225
256
|
},
|
|
226
257
|
onMouseMove: handleMouseMove,
|
|
227
258
|
contentEditable: false
|
|
228
|
-
}, rowsParams.map(function (
|
|
229
|
-
var startIndex =
|
|
230
|
-
endIndex =
|
|
259
|
+
}, rowsParams.map(function (_ref5, index) {
|
|
260
|
+
var startIndex = _ref5.startIndex,
|
|
261
|
+
endIndex = _ref5.endIndex;
|
|
231
262
|
return (
|
|
232
263
|
/*#__PURE__*/
|
|
233
264
|
// Ignored via go/ees005
|
|
@@ -278,21 +309,21 @@ export var DragControls = function DragControls(_ref) {
|
|
|
278
309
|
);
|
|
279
310
|
}), rowHandles());
|
|
280
311
|
};
|
|
281
|
-
export var DragControlsWithSelection = function DragControlsWithSelection(
|
|
282
|
-
var editorView =
|
|
283
|
-
tableRef =
|
|
284
|
-
tableNode =
|
|
285
|
-
tableWidth =
|
|
286
|
-
tableActive =
|
|
287
|
-
hoveredCell =
|
|
288
|
-
isInDanger =
|
|
289
|
-
isTableHovered =
|
|
290
|
-
isResizing =
|
|
291
|
-
hoverRows =
|
|
292
|
-
selectRow =
|
|
293
|
-
selectRows =
|
|
294
|
-
updateCellHoverLocation =
|
|
295
|
-
api =
|
|
312
|
+
export var DragControlsWithSelection = function DragControlsWithSelection(_ref6) {
|
|
313
|
+
var editorView = _ref6.editorView,
|
|
314
|
+
tableRef = _ref6.tableRef,
|
|
315
|
+
tableNode = _ref6.tableNode,
|
|
316
|
+
tableWidth = _ref6.tableWidth,
|
|
317
|
+
tableActive = _ref6.tableActive,
|
|
318
|
+
hoveredCell = _ref6.hoveredCell,
|
|
319
|
+
isInDanger = _ref6.isInDanger,
|
|
320
|
+
isTableHovered = _ref6.isTableHovered,
|
|
321
|
+
isResizing = _ref6.isResizing,
|
|
322
|
+
hoverRows = _ref6.hoverRows,
|
|
323
|
+
selectRow = _ref6.selectRow,
|
|
324
|
+
selectRows = _ref6.selectRows,
|
|
325
|
+
updateCellHoverLocation = _ref6.updateCellHoverLocation,
|
|
326
|
+
api = _ref6.api;
|
|
296
327
|
var _useSharedPluginState = useSharedPluginStateWithSelector(api, ['selection'], function (states) {
|
|
297
328
|
var _states$selectionStat;
|
|
298
329
|
return {
|
|
@@ -26,7 +26,7 @@ export var MergeCellsItem = function MergeCellsItem(_ref) {
|
|
|
26
26
|
return;
|
|
27
27
|
}
|
|
28
28
|
mergeCellsWithAnalytics(api === null || api === void 0 || (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions)(INPUT_METHOD.CONTEXT_MENU)(editorView.state, editorView.dispatch);
|
|
29
|
-
api === null || api === void 0 || api.core.actions.execute(closeActiveTableMenu());
|
|
29
|
+
api === null || api === void 0 || api.core.actions.execute(closeActiveTableMenu(api));
|
|
30
30
|
api === null || api === void 0 || api.core.actions.focus();
|
|
31
31
|
};
|
|
32
32
|
if (!shouldShowMergeCells(tableMenuContext)) {
|
|
@@ -26,7 +26,7 @@ export var SplitCellItem = function SplitCellItem(_ref) {
|
|
|
26
26
|
return;
|
|
27
27
|
}
|
|
28
28
|
splitCellWithAnalytics(api === null || api === void 0 || (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions)(INPUT_METHOD.CONTEXT_MENU)(editorView.state, editorView.dispatch);
|
|
29
|
-
api === null || api === void 0 || api.core.actions.execute(closeActiveTableMenu());
|
|
29
|
+
api === null || api === void 0 || api.core.actions.execute(closeActiveTableMenu(api));
|
|
30
30
|
api === null || api === void 0 || api.core.actions.focus();
|
|
31
31
|
};
|
|
32
32
|
if (!shouldShowSplitCell(tableMenuContext)) {
|
|
@@ -39,7 +39,7 @@ export var AddColumnLeftItem = function AddColumnLeftItem(_ref) {
|
|
|
39
39
|
}
|
|
40
40
|
var shouldUseIncreasedScalingPercent = isTableScalingEnabled && (isTableFixedColumnWidthsOptionEnabled || isCommentEditor);
|
|
41
41
|
insertColumnWithAnalytics(api, api === null || api === void 0 || (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions, isTableScalingEnabled, isTableFixedColumnWidthsOptionEnabled, shouldUseIncreasedScalingPercent, isCommentEditor)(INPUT_METHOD.TABLE_CONTEXT_MENU, index)(editorView.state, editorView.dispatch, editorView);
|
|
42
|
-
api === null || api === void 0 || api.core.actions.execute(closeActiveTableMenu());
|
|
42
|
+
api === null || api === void 0 || api.core.actions.execute(closeActiveTableMenu(api));
|
|
43
43
|
api === null || api === void 0 || api.core.actions.focus();
|
|
44
44
|
};
|
|
45
45
|
return /*#__PURE__*/React.createElement(ToolbarDropdownItem, {
|
|
@@ -39,7 +39,7 @@ export var AddColumnRightItem = function AddColumnRightItem(_ref) {
|
|
|
39
39
|
}
|
|
40
40
|
var shouldUseIncreasedScalingPercent = isTableScalingEnabled && (isTableFixedColumnWidthsOptionEnabled || isCommentEditor);
|
|
41
41
|
insertColumnWithAnalytics(api, api === null || api === void 0 || (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions, isTableScalingEnabled, isTableFixedColumnWidthsOptionEnabled, shouldUseIncreasedScalingPercent, isCommentEditor)(INPUT_METHOD.TABLE_CONTEXT_MENU, index)(editorView.state, editorView.dispatch, editorView);
|
|
42
|
-
api === null || api === void 0 || api.core.actions.execute(closeActiveTableMenu());
|
|
42
|
+
api === null || api === void 0 || api.core.actions.execute(closeActiveTableMenu(api));
|
|
43
43
|
api === null || api === void 0 || api.core.actions.focus();
|
|
44
44
|
};
|
|
45
45
|
return /*#__PURE__*/React.createElement(ToolbarDropdownItem, {
|
|
@@ -57,7 +57,7 @@ export var DeleteColumnItem = function DeleteColumnItem(_ref) {
|
|
|
57
57
|
}
|
|
58
58
|
var shouldUseIncreasedScalingPercent = isTableScalingEnabled && (isTableFixedColumnWidthsOptionEnabled || isCommentEditor);
|
|
59
59
|
deleteColumnsWithAnalytics(api === null || api === void 0 || (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions, api, isTableScalingEnabled, isTableFixedColumnWidthsOptionEnabled, shouldUseIncreasedScalingPercent, isCommentEditor)(INPUT_METHOD.TABLE_CONTEXT_MENU, selectionRect)(editorView.state, editorView.dispatch, editorView);
|
|
60
|
-
api === null || api === void 0 || api.core.actions.execute(closeActiveTableMenu());
|
|
60
|
+
api === null || api === void 0 || api.core.actions.execute(closeActiveTableMenu(api));
|
|
61
61
|
api === null || api === void 0 || api.core.actions.focus();
|
|
62
62
|
};
|
|
63
63
|
return /*#__PURE__*/React.createElement(ToolbarDropdownItem, {
|
|
@@ -48,7 +48,7 @@ export var DistributeColumnsItem = function DistributeColumnsItem(_ref) {
|
|
|
48
48
|
return;
|
|
49
49
|
}
|
|
50
50
|
distributeColumnsWidthsWithAnalytics(api === null || api === void 0 || (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions, api)(INPUT_METHOD.TABLE_CONTEXT_MENU, newResizeState)(editorView.state, editorView.dispatch);
|
|
51
|
-
api === null || api === void 0 || api.core.actions.execute(closeActiveTableMenu());
|
|
51
|
+
api === null || api === void 0 || api.core.actions.execute(closeActiveTableMenu(api));
|
|
52
52
|
api === null || api === void 0 || api.core.actions.focus();
|
|
53
53
|
};
|
|
54
54
|
if (!shouldShowDistributeColumns(tableMenuContext === null || tableMenuContext === void 0 ? void 0 : tableMenuContext.selectedColumnCount)) {
|
|
@@ -42,7 +42,7 @@ export var MoveColumnLeftItem = function MoveColumnLeftItem(props) {
|
|
|
42
42
|
return;
|
|
43
43
|
}
|
|
44
44
|
moveSourceWithAnalytics(api === null || api === void 0 || (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions, api === null || api === void 0 || (_api$accessibilityUti = api.accessibilityUtils) === null || _api$accessibilityUti === void 0 ? void 0 : _api$accessibilityUti.actions.ariaNotify, getPluginState(editorView.state).getIntl)(INPUT_METHOD.TABLE_CONTEXT_MENU, TABLE_COLUMN, getSelectedColumnIndexes(selectionRect), selectionRect.left - 1)(editorView.state, editorView.dispatch);
|
|
45
|
-
api === null || api === void 0 || api.core.actions.execute(closeActiveTableMenu());
|
|
45
|
+
api === null || api === void 0 || api.core.actions.execute(closeActiveTableMenu(api));
|
|
46
46
|
api === null || api === void 0 || api.core.actions.focus();
|
|
47
47
|
};
|
|
48
48
|
if (!tableNode || !shouldShowMoveColumnLeft(tableMenuContext === null || tableMenuContext === void 0 ? void 0 : tableMenuContext.isFirstColumn)) {
|
|
@@ -41,7 +41,7 @@ export var MoveColumnRightItem = function MoveColumnRightItem(props) {
|
|
|
41
41
|
return;
|
|
42
42
|
}
|
|
43
43
|
moveSourceWithAnalytics(api === null || api === void 0 || (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions, api === null || api === void 0 || (_api$accessibilityUti = api.accessibilityUtils) === null || _api$accessibilityUti === void 0 ? void 0 : _api$accessibilityUti.actions.ariaNotify, getPluginState(editorView.state).getIntl)(INPUT_METHOD.TABLE_CONTEXT_MENU, TABLE_COLUMN, getSelectedColumnIndexes(selectionRect), selectionRect.right)(editorView.state, editorView.dispatch);
|
|
44
|
-
api === null || api === void 0 || api.core.actions.execute(closeActiveTableMenu());
|
|
44
|
+
api === null || api === void 0 || api.core.actions.execute(closeActiveTableMenu(api));
|
|
45
45
|
api === null || api === void 0 || api.core.actions.focus();
|
|
46
46
|
};
|
|
47
47
|
if (!tableNode || !shouldShowMoveColumnRight(tableMenuContext === null || tableMenuContext === void 0 ? void 0 : tableMenuContext.isLastColumn)) {
|
|
@@ -26,7 +26,7 @@ export var SortDecreasingItem = function SortDecreasingItem(_ref) {
|
|
|
26
26
|
return;
|
|
27
27
|
}
|
|
28
28
|
sortColumnWithAnalytics(api === null || api === void 0 || (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions)(INPUT_METHOD.TABLE_CONTEXT_MENU, columnIndex, SortOrder.DESC)(editorView.state, editorView.dispatch);
|
|
29
|
-
api === null || api === void 0 || api.core.actions.execute(closeActiveTableMenu());
|
|
29
|
+
api === null || api === void 0 || api.core.actions.execute(closeActiveTableMenu(api));
|
|
30
30
|
api === null || api === void 0 || api.core.actions.focus();
|
|
31
31
|
};
|
|
32
32
|
return /*#__PURE__*/React.createElement(ToolbarDropdownItem, {
|
|
@@ -26,7 +26,7 @@ export var SortIncreasingItem = function SortIncreasingItem(_ref) {
|
|
|
26
26
|
return;
|
|
27
27
|
}
|
|
28
28
|
sortColumnWithAnalytics(api === null || api === void 0 || (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions)(INPUT_METHOD.TABLE_CONTEXT_MENU, columnIndex, SortOrder.ASC)(editorView.state, editorView.dispatch);
|
|
29
|
-
api === null || api === void 0 || api.core.actions.execute(closeActiveTableMenu());
|
|
29
|
+
api === null || api === void 0 || api.core.actions.execute(closeActiveTableMenu(api));
|
|
30
30
|
api === null || api === void 0 || api.core.actions.focus();
|
|
31
31
|
};
|
|
32
32
|
return /*#__PURE__*/React.createElement(ToolbarDropdownItem, {
|
|
@@ -29,7 +29,7 @@ export var AddRowAboveItem = function AddRowAboveItem(props) {
|
|
|
29
29
|
index: index,
|
|
30
30
|
moveCursorToInsertedRow: true
|
|
31
31
|
})(editorView.state, editorView.dispatch);
|
|
32
|
-
api === null || api === void 0 || api.core.actions.execute(closeActiveTableMenu());
|
|
32
|
+
api === null || api === void 0 || api.core.actions.execute(closeActiveTableMenu(api));
|
|
33
33
|
api === null || api === void 0 || api.core.actions.focus();
|
|
34
34
|
};
|
|
35
35
|
return /*#__PURE__*/React.createElement(ToolbarDropdownItem, {
|
|
@@ -29,7 +29,7 @@ export var AddRowBelowItem = function AddRowBelowItem(props) {
|
|
|
29
29
|
index: index,
|
|
30
30
|
moveCursorToInsertedRow: true
|
|
31
31
|
})(editorView.state, editorView.dispatch);
|
|
32
|
-
api === null || api === void 0 || api.core.actions.execute(closeActiveTableMenu());
|
|
32
|
+
api === null || api === void 0 || api.core.actions.execute(closeActiveTableMenu(api));
|
|
33
33
|
api === null || api === void 0 || api.core.actions.focus();
|
|
34
34
|
};
|
|
35
35
|
return /*#__PURE__*/React.createElement(ToolbarDropdownItem, {
|
|
@@ -52,7 +52,7 @@ export var DeleteRowItem = function DeleteRowItem(props) {
|
|
|
52
52
|
return;
|
|
53
53
|
}
|
|
54
54
|
deleteRowsWithAnalytics(api === null || api === void 0 || (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions)(INPUT_METHOD.TABLE_CONTEXT_MENU, selectionRect, !!isHeaderRowRequired)(editorView.state, editorView.dispatch);
|
|
55
|
-
api === null || api === void 0 || api.core.actions.execute(closeActiveTableMenu());
|
|
55
|
+
api === null || api === void 0 || api.core.actions.execute(closeActiveTableMenu(api));
|
|
56
56
|
api === null || api === void 0 || api.core.actions.focus();
|
|
57
57
|
};
|
|
58
58
|
return /*#__PURE__*/React.createElement(ToolbarDropdownItem, {
|
|
@@ -41,7 +41,7 @@ export var MoveRowDownItem = function MoveRowDownItem(props) {
|
|
|
41
41
|
return;
|
|
42
42
|
}
|
|
43
43
|
moveSourceWithAnalytics(api === null || api === void 0 || (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions, api === null || api === void 0 || (_api$accessibilityUti = api.accessibilityUtils) === null || _api$accessibilityUti === void 0 ? void 0 : _api$accessibilityUti.actions.ariaNotify, getPluginState(editorView.state).getIntl)(INPUT_METHOD.TABLE_CONTEXT_MENU, TABLE_ROW, getSelectedRowIndexes(selectionRect), selectionRect.bottom)(editorView.state, editorView.dispatch);
|
|
44
|
-
api === null || api === void 0 || api.core.actions.execute(closeActiveTableMenu());
|
|
44
|
+
api === null || api === void 0 || api.core.actions.execute(closeActiveTableMenu(api));
|
|
45
45
|
api === null || api === void 0 || api.core.actions.focus();
|
|
46
46
|
};
|
|
47
47
|
if (!tableNode || !shouldShowMoveRowDown(tableMenuContext === null || tableMenuContext === void 0 ? void 0 : tableMenuContext.isLastRow)) {
|
|
@@ -41,7 +41,7 @@ export var MoveRowUpItem = function MoveRowUpItem(props) {
|
|
|
41
41
|
return;
|
|
42
42
|
}
|
|
43
43
|
moveSourceWithAnalytics(api === null || api === void 0 || (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions, api === null || api === void 0 || (_api$accessibilityUti = api.accessibilityUtils) === null || _api$accessibilityUti === void 0 ? void 0 : _api$accessibilityUti.actions.ariaNotify, getPluginState(editorView.state).getIntl)(INPUT_METHOD.TABLE_CONTEXT_MENU, TABLE_ROW, getSelectedRowIndexes(selectionRect), selectionRect.top - 1)(editorView.state, editorView.dispatch);
|
|
44
|
-
api === null || api === void 0 || api.core.actions.execute(closeActiveTableMenu());
|
|
44
|
+
api === null || api === void 0 || api.core.actions.execute(closeActiveTableMenu(api));
|
|
45
45
|
api === null || api === void 0 || api.core.actions.focus();
|
|
46
46
|
};
|
|
47
47
|
if (!tableNode || !shouldShowMoveRowUp(tableMenuContext === null || tableMenuContext === void 0 ? void 0 : tableMenuContext.isFirstRow)) {
|
|
@@ -28,17 +28,17 @@ export var TableMenu = /*#__PURE__*/memo(function (_ref) {
|
|
|
28
28
|
tableNode = _useSharedPluginState.tableNode,
|
|
29
29
|
selection = _useSharedPluginState.selection;
|
|
30
30
|
var tableMenuContext = useMemo(function () {
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
31
|
+
// rely on selection plugins state to re-render the row/column menu, but use editorView.selection
|
|
32
|
+
// for cell menu state as the selection plugin won't update when text selection changes within cells
|
|
33
|
+
if (!tableNode || !editorView || !selection) {
|
|
34
|
+
return undefined;
|
|
35
35
|
}
|
|
36
36
|
var tableMap = TableMap.get(tableNode);
|
|
37
|
-
var selectionRect = getSelectionRect(selection);
|
|
37
|
+
var selectionRect = getSelectionRect(editorView.state.selection);
|
|
38
38
|
var cellOps = {
|
|
39
39
|
editorView: editorView,
|
|
40
|
-
canMergeCells: canMergeCellSelection(selection),
|
|
41
|
-
canSplitCell: canSplitCellSelection(selection),
|
|
40
|
+
canMergeCells: canMergeCellSelection(editorView.state.selection),
|
|
41
|
+
canSplitCell: canSplitCellSelection(editorView.state.selection),
|
|
42
42
|
hasMergedCellsInTable: tableMap.hasMergedCells()
|
|
43
43
|
};
|
|
44
44
|
if (!selectionRect) {
|
|
@@ -52,7 +52,7 @@ export var TableMenu = /*#__PURE__*/memo(function (_ref) {
|
|
|
52
52
|
isLastColumn: selectionRect.right === tableMap.width,
|
|
53
53
|
selectedColumnCount: selectionRect.right - selectionRect.left
|
|
54
54
|
});
|
|
55
|
-
}, [editorView,
|
|
55
|
+
}, [editorView, tableNode, selection]);
|
|
56
56
|
if (components.length === 0) {
|
|
57
57
|
return null;
|
|
58
58
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export var TABLE_MENU_WIDTH = 280;
|
|
2
|
-
export var TABLE_MENU_SELECTOR = '[data-testid="column-handle-menu"], [data-testid="row-handle-menu"], [data-toolbar-nested-dropdown-menu]';
|
|
2
|
+
export var TABLE_MENU_SELECTOR = '[data-testid="column-handle-menu"], [data-testid="row-handle-menu"], [data-toolbar-component="menu"], [data-toolbar-nested-dropdown-menu]';
|
|
3
3
|
export var TABLE_ROW = 'table-row';
|
|
4
4
|
export var TABLE_COLUMN = 'table-column';
|
|
@@ -42,7 +42,7 @@ export var BackgroundColorItem = function BackgroundColorItem(_ref) {
|
|
|
42
42
|
return;
|
|
43
43
|
}
|
|
44
44
|
setColorWithAnalytics(api === null || api === void 0 || (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions)(INPUT_METHOD.TABLE_CONTEXT_MENU, color, editorView)(editorView.state, editorView.dispatch);
|
|
45
|
-
api === null || api === void 0 || api.core.actions.execute(closeActiveTableMenu());
|
|
45
|
+
api === null || api === void 0 || api.core.actions.execute(closeActiveTableMenu(api));
|
|
46
46
|
api === null || api === void 0 || api.core.actions.focus();
|
|
47
47
|
}, [api, editorView]);
|
|
48
48
|
// eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage
|
|
@@ -25,7 +25,7 @@ export var ClearCellsItem = function ClearCellsItem(_ref) {
|
|
|
25
25
|
var _getPluginState = getPluginState(editorView.state),
|
|
26
26
|
targetCellPosition = _getPluginState.targetCellPosition;
|
|
27
27
|
emptyMultipleCellsWithAnalytics(api === null || api === void 0 || (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions)(INPUT_METHOD.TABLE_CONTEXT_MENU, targetCellPosition)(editorView.state, editorView.dispatch);
|
|
28
|
-
api === null || api === void 0 || api.core.actions.execute(closeActiveTableMenu());
|
|
28
|
+
api === null || api === void 0 || api.core.actions.execute(closeActiveTableMenu(api));
|
|
29
29
|
api === null || api === void 0 || api.core.actions.focus();
|
|
30
30
|
};
|
|
31
31
|
return /*#__PURE__*/React.createElement(ToolbarDropdownItem, {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { EditorCommand } from '@atlaskit/editor-common/types';
|
|
2
|
-
import type { ActiveTableMenu } from '../../types';
|
|
3
|
-
export declare const closeActiveTableMenu: () => EditorCommand;
|
|
2
|
+
import type { ActiveTableMenu, PluginInjectionAPI } from '../../types';
|
|
3
|
+
export declare const closeActiveTableMenu: (api?: PluginInjectionAPI | null) => EditorCommand;
|
|
4
4
|
export declare const toggleActiveTableMenu: (activeTableMenu: Exclude<ActiveTableMenu, {
|
|
5
5
|
type: "none";
|
|
6
|
-
}>, currentActiveTableMenu: ActiveTableMenu | undefined) => EditorCommand;
|
|
6
|
+
}>, currentActiveTableMenu: ActiveTableMenu | undefined, api?: PluginInjectionAPI | null) => EditorCommand;
|
|
@@ -7,10 +7,8 @@ import type { Command, GetEditorContainerWidth } from '@atlaskit/editor-common/t
|
|
|
7
7
|
import type { NodeWithPos } from '@atlaskit/editor-prosemirror/utils';
|
|
8
8
|
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
9
9
|
import type { Rect } from '@atlaskit/editor-tables/table-map';
|
|
10
|
-
import type { AlignmentOptions, InsertRowMethods, InsertRowOptions, PluginInjectionAPI, RowInsertPosition
|
|
11
|
-
import type { TriggerType } from '../drag-and-drop/types';
|
|
10
|
+
import type { AlignmentOptions, InsertRowMethods, InsertRowOptions, PluginInjectionAPI, RowInsertPosition } from '../../types';
|
|
12
11
|
import type { ResizeStateWithAnalytics } from '../table-resizing/utils/types';
|
|
13
|
-
export declare const toggleActiveTableMenuWithAnalytics: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null) => (direction: TableDirection, index: number, trigger?: TriggerType) => Command;
|
|
14
12
|
export declare const emptyMultipleCellsWithAnalytics: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null) => (inputMethod: INPUT_METHOD.CONTEXT_MENU | INPUT_METHOD.KEYBOARD | INPUT_METHOD.FLOATING_TB | INPUT_METHOD.TABLE_CONTEXT_MENU, targetCellPosition?: number) => Command;
|
|
15
13
|
export declare const mergeCellsWithAnalytics: (editorAnalyticsAPI: EditorAnalyticsAPI | null | undefined) => (inputMethod: INPUT_METHOD.CONTEXT_MENU | INPUT_METHOD.FLOATING_TB) => Command;
|
|
16
14
|
export declare const splitCellWithAnalytics: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null) => (inputMethod: INPUT_METHOD.CONTEXT_MENU | INPUT_METHOD.FLOATING_TB) => Command;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
3
|
+
import type { RowStickyState } from '../../pm-plugins/sticky-headers/types';
|
|
4
|
+
import type { PluginInjectionAPI } from '../../types';
|
|
5
|
+
interface Props {
|
|
6
|
+
api: PluginInjectionAPI | undefined | null;
|
|
7
|
+
boundariesElement?: HTMLElement;
|
|
8
|
+
editorView: EditorView;
|
|
9
|
+
mountPoint?: HTMLElement;
|
|
10
|
+
scrollableElement?: HTMLElement;
|
|
11
|
+
stickyHeaders?: RowStickyState;
|
|
12
|
+
tableWrapper?: HTMLElement;
|
|
13
|
+
targetCellPosition?: number;
|
|
14
|
+
}
|
|
15
|
+
interface FloatingTableMenuFunction {
|
|
16
|
+
(props: Props): React.JSX.Element | null;
|
|
17
|
+
displayName: string;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Row and column menu for table.
|
|
21
|
+
*/
|
|
22
|
+
declare const FloatingTableMenu: FloatingTableMenuFunction;
|
|
23
|
+
export default FloatingTableMenu;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export declare const TABLE_MENU_WIDTH = 280;
|
|
2
|
-
export declare const TABLE_MENU_SELECTOR = "[data-testid=\"column-handle-menu\"], [data-testid=\"row-handle-menu\"], [data-toolbar-nested-dropdown-menu]";
|
|
2
|
+
export declare const TABLE_MENU_SELECTOR = "[data-testid=\"column-handle-menu\"], [data-testid=\"row-handle-menu\"], [data-toolbar-component=\"menu\"], [data-toolbar-nested-dropdown-menu]";
|
|
3
3
|
export declare const TABLE_ROW = "table-row";
|
|
4
4
|
export declare const TABLE_COLUMN = "table-column";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { EditorCommand } from '@atlaskit/editor-common/types';
|
|
2
|
-
import type { ActiveTableMenu } from '../../types';
|
|
3
|
-
export declare const closeActiveTableMenu: () => EditorCommand;
|
|
2
|
+
import type { ActiveTableMenu, PluginInjectionAPI } from '../../types';
|
|
3
|
+
export declare const closeActiveTableMenu: (api?: PluginInjectionAPI | null) => EditorCommand;
|
|
4
4
|
export declare const toggleActiveTableMenu: (activeTableMenu: Exclude<ActiveTableMenu, {
|
|
5
5
|
type: "none";
|
|
6
|
-
}>, currentActiveTableMenu: ActiveTableMenu | undefined) => EditorCommand;
|
|
6
|
+
}>, currentActiveTableMenu: ActiveTableMenu | undefined, api?: PluginInjectionAPI | null) => EditorCommand;
|
|
@@ -7,10 +7,8 @@ import type { Command, GetEditorContainerWidth } from '@atlaskit/editor-common/t
|
|
|
7
7
|
import type { NodeWithPos } from '@atlaskit/editor-prosemirror/utils';
|
|
8
8
|
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
9
9
|
import type { Rect } from '@atlaskit/editor-tables/table-map';
|
|
10
|
-
import type { AlignmentOptions, InsertRowMethods, InsertRowOptions, PluginInjectionAPI, RowInsertPosition
|
|
11
|
-
import type { TriggerType } from '../drag-and-drop/types';
|
|
10
|
+
import type { AlignmentOptions, InsertRowMethods, InsertRowOptions, PluginInjectionAPI, RowInsertPosition } from '../../types';
|
|
12
11
|
import type { ResizeStateWithAnalytics } from '../table-resizing/utils/types';
|
|
13
|
-
export declare const toggleActiveTableMenuWithAnalytics: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null) => (direction: TableDirection, index: number, trigger?: TriggerType) => Command;
|
|
14
12
|
export declare const emptyMultipleCellsWithAnalytics: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null) => (inputMethod: INPUT_METHOD.CONTEXT_MENU | INPUT_METHOD.KEYBOARD | INPUT_METHOD.FLOATING_TB | INPUT_METHOD.TABLE_CONTEXT_MENU, targetCellPosition?: number) => Command;
|
|
15
13
|
export declare const mergeCellsWithAnalytics: (editorAnalyticsAPI: EditorAnalyticsAPI | null | undefined) => (inputMethod: INPUT_METHOD.CONTEXT_MENU | INPUT_METHOD.FLOATING_TB) => Command;
|
|
16
14
|
export declare const splitCellWithAnalytics: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null) => (inputMethod: INPUT_METHOD.CONTEXT_MENU | INPUT_METHOD.FLOATING_TB) => Command;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
3
|
+
import type { RowStickyState } from '../../pm-plugins/sticky-headers/types';
|
|
4
|
+
import type { PluginInjectionAPI } from '../../types';
|
|
5
|
+
interface Props {
|
|
6
|
+
api: PluginInjectionAPI | undefined | null;
|
|
7
|
+
boundariesElement?: HTMLElement;
|
|
8
|
+
editorView: EditorView;
|
|
9
|
+
mountPoint?: HTMLElement;
|
|
10
|
+
scrollableElement?: HTMLElement;
|
|
11
|
+
stickyHeaders?: RowStickyState;
|
|
12
|
+
tableWrapper?: HTMLElement;
|
|
13
|
+
targetCellPosition?: number;
|
|
14
|
+
}
|
|
15
|
+
interface FloatingTableMenuFunction {
|
|
16
|
+
(props: Props): React.JSX.Element | null;
|
|
17
|
+
displayName: string;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Row and column menu for table.
|
|
21
|
+
*/
|
|
22
|
+
declare const FloatingTableMenu: FloatingTableMenuFunction;
|
|
23
|
+
export default FloatingTableMenu;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export declare const TABLE_MENU_WIDTH = 280;
|
|
2
|
-
export declare const TABLE_MENU_SELECTOR = "[data-testid=\"column-handle-menu\"], [data-testid=\"row-handle-menu\"], [data-toolbar-nested-dropdown-menu]";
|
|
2
|
+
export declare const TABLE_MENU_SELECTOR = "[data-testid=\"column-handle-menu\"], [data-testid=\"row-handle-menu\"], [data-toolbar-component=\"menu\"], [data-toolbar-nested-dropdown-menu]";
|
|
3
3
|
export declare const TABLE_ROW = "table-row";
|
|
4
4
|
export declare const TABLE_COLUMN = "table-column";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-table",
|
|
3
|
-
"version": "23.3.
|
|
3
|
+
"version": "23.3.6",
|
|
4
4
|
"description": "Table plugin for the @atlaskit/editor",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
"@atlaskit/editor-plugin-batch-attribute-updates": "^11.0.0",
|
|
38
38
|
"@atlaskit/editor-plugin-content-insertion": "^11.0.0",
|
|
39
39
|
"@atlaskit/editor-plugin-editor-viewmode": "^13.0.0",
|
|
40
|
-
"@atlaskit/editor-plugin-extension": "14.1.
|
|
40
|
+
"@atlaskit/editor-plugin-extension": "14.1.5",
|
|
41
41
|
"@atlaskit/editor-plugin-guideline": "^11.0.0",
|
|
42
42
|
"@atlaskit/editor-plugin-interaction": "^20.0.0",
|
|
43
43
|
"@atlaskit/editor-plugin-limited-mode": "^8.0.0",
|
|
@@ -60,12 +60,12 @@
|
|
|
60
60
|
"@atlaskit/pragmatic-drag-and-drop-auto-scroll": "^2.1.0",
|
|
61
61
|
"@atlaskit/pragmatic-drag-and-drop-hitbox": "^1.2.0",
|
|
62
62
|
"@atlaskit/primitives": "^19.0.0",
|
|
63
|
-
"@atlaskit/tmp-editor-statsig": "^
|
|
63
|
+
"@atlaskit/tmp-editor-statsig": "^94.0.0",
|
|
64
64
|
"@atlaskit/toggle": "^16.1.0",
|
|
65
65
|
"@atlaskit/tokens": "^13.3.0",
|
|
66
66
|
"@atlaskit/tooltip": "^22.6.0",
|
|
67
67
|
"@babel/runtime": "^7.0.0",
|
|
68
|
-
"@compiled/react": "
|
|
68
|
+
"@compiled/react": "^0.20.0",
|
|
69
69
|
"@emotion/react": "^11.7.1",
|
|
70
70
|
"bind-event-listener": "^3.0.0",
|
|
71
71
|
"classnames": "^2.2.5",
|
|
@@ -75,7 +75,7 @@
|
|
|
75
75
|
"uuid": "^3.1.0"
|
|
76
76
|
},
|
|
77
77
|
"peerDependencies": {
|
|
78
|
-
"@atlaskit/editor-common": "^115.
|
|
78
|
+
"@atlaskit/editor-common": "^115.8.0",
|
|
79
79
|
"react": "^18.2.0",
|
|
80
80
|
"react-dom": "^18.2.0",
|
|
81
81
|
"react-intl": "^5.25.1 || ^6.0.0 || ^7.0.0"
|