@lobehub/editor 1.8.2 → 1.8.3

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.
Files changed (32) hide show
  1. package/es/editor-kernel/react/PortalAnchor.d.ts +5 -0
  2. package/es/editor-kernel/react/PortalAnchor.js +13 -0
  3. package/es/editor-kernel/react/useAnchor.d.ts +1 -0
  4. package/es/editor-kernel/react/useAnchor.js +23 -0
  5. package/es/plugins/link/react/ReactLinkPlugin.js +9 -104
  6. package/es/plugins/link/react/components/LinkEdit.d.ts +6 -2
  7. package/es/plugins/link/react/components/LinkEdit.js +21 -25
  8. package/es/plugins/link/react/components/LinkToolbar.d.ts +1 -4
  9. package/es/plugins/link/react/components/LinkToolbar.js +103 -21
  10. package/es/plugins/math/react/{component → components}/MathEditor.js +11 -8
  11. package/es/plugins/math/react/{component → components}/MathEditorContainer.d.ts +2 -1
  12. package/es/plugins/math/react/{component → components}/MathEditorContainer.js +3 -2
  13. package/es/plugins/math/react/{component → components}/MathEditorContent.d.ts +2 -1
  14. package/es/plugins/math/react/{component → components}/MathEditorContent.js +3 -2
  15. package/es/plugins/math/react/index.js +2 -2
  16. package/es/plugins/slash/react/components/DefaultSlashMenu.d.ts +5 -0
  17. package/es/plugins/slash/react/components/DefaultSlashMenu.js +48 -0
  18. package/es/plugins/slash/react/components/SlashMenu.d.ts +2 -2
  19. package/es/plugins/slash/react/components/SlashMenu.js +16 -36
  20. package/es/plugins/table/react/TableActionMenu/ActionMenu.d.ts +18 -0
  21. package/es/plugins/table/react/TableActionMenu/ActionMenu.js +309 -0
  22. package/es/plugins/table/react/TableActionMenu/index.d.ts +2 -3
  23. package/es/plugins/table/react/TableActionMenu/index.js +17 -321
  24. package/es/plugins/table/react/TableHoverActions/index.d.ts +3 -4
  25. package/es/plugins/table/react/TableHoverActions/index.js +7 -20
  26. package/es/plugins/table/react/index.js +8 -5
  27. package/package.json +1 -1
  28. /package/es/plugins/math/react/{component → components}/MathEditor.d.ts +0 -0
  29. /package/es/plugins/math/react/{component → components}/MathInline.d.ts +0 -0
  30. /package/es/plugins/math/react/{component → components}/MathInline.js +0 -0
  31. /package/es/plugins/math/react/{component → components}/Placeholder.d.ts +0 -0
  32. /package/es/plugins/math/react/{component → components}/Placeholder.js +0 -0
@@ -0,0 +1,48 @@
1
+ 'use client';
2
+
3
+ import { Dropdown } from '@lobehub/ui';
4
+ import { memo, useCallback } from 'react';
5
+ import { jsx as _jsx } from "react/jsx-runtime";
6
+ var DefaultSlashMenu = /*#__PURE__*/memo(function (_ref) {
7
+ var activeKey = _ref.activeKey,
8
+ anchorClassName = _ref.anchorClassName,
9
+ loading = _ref.loading,
10
+ onSelect = _ref.onSelect,
11
+ open = _ref.open,
12
+ options = _ref.options,
13
+ position = _ref.position,
14
+ _onClose = _ref.onClose;
15
+ var handleMenuClick = useCallback(function (_ref2) {
16
+ var key = _ref2.key;
17
+ var option = options.find(function (item) {
18
+ return 'key' in item && item.key === key;
19
+ });
20
+ if (option) onSelect(option);
21
+ }, [options, onSelect]);
22
+ return /*#__PURE__*/_jsx("div", {
23
+ style: {
24
+ left: position.x,
25
+ position: 'fixed',
26
+ top: position.y,
27
+ zIndex: 9999
28
+ },
29
+ children: /*#__PURE__*/_jsx(Dropdown, {
30
+ menu: {
31
+ // @ts-ignore
32
+ activeKey: activeKey,
33
+ items: loading ? [{
34
+ disabled: true,
35
+ key: 'loading',
36
+ label: 'Loading...'
37
+ }] : options,
38
+ onClick: handleMenuClick
39
+ },
40
+ open: open,
41
+ children: /*#__PURE__*/_jsx("span", {
42
+ className: anchorClassName
43
+ })
44
+ })
45
+ });
46
+ });
47
+ DefaultSlashMenu.displayName = 'DefaultSlashMenu';
48
+ export default DefaultSlashMenu;
@@ -1,8 +1,8 @@
1
- import { type FC } from 'react';
1
+ /// <reference types="react" />
2
2
  import type { SlashMenuProps } from '../type';
3
3
  /**
4
4
  * SlashMenu component - Only responsible for rendering the menu UI
5
5
  * All state management and plugin registration is handled by ReactSlashPlugin
6
6
  */
7
- declare const SlashMenu: FC<SlashMenuProps>;
7
+ declare const SlashMenu: import("react").NamedExoticComponent<SlashMenuProps>;
8
8
  export default SlashMenu;
@@ -1,13 +1,14 @@
1
1
  'use client';
2
2
 
3
- import { Dropdown } from '@lobehub/ui';
4
- import { useCallback } from 'react';
5
- import { jsx as _jsx } from "react/jsx-runtime";
3
+ import { memo, useCallback } from 'react';
4
+ import DefaultSlashMenu from "./DefaultSlashMenu";
5
+
6
6
  /**
7
7
  * SlashMenu component - Only responsible for rendering the menu UI
8
8
  * All state management and plugin registration is handled by ReactSlashPlugin
9
9
  */
10
- var SlashMenu = function SlashMenu(_ref) {
10
+ import { jsx as _jsx } from "react/jsx-runtime";
11
+ var SlashMenu = /*#__PURE__*/memo(function (_ref) {
11
12
  var activeKey = _ref.activeKey,
12
13
  anchorClassName = _ref.anchorClassName,
13
14
  CustomRender = _ref.customRender,
@@ -17,18 +18,11 @@ var SlashMenu = function SlashMenu(_ref) {
17
18
  open = _ref.open,
18
19
  options = _ref.options,
19
20
  position = _ref.position,
20
- _onClose = _ref.onClose;
21
+ onClose = _ref.onClose;
21
22
  // Adapter for custom render component onSelect
22
23
  var customRenderOnSelect = useCallback(function (option) {
23
24
  onSelect(option);
24
25
  }, [onSelect]);
25
- var handleMenuClick = useCallback(function (_ref2) {
26
- var key = _ref2.key;
27
- var option = options.find(function (item) {
28
- return 'key' in item && item.key === key;
29
- });
30
- if (option) onSelect(option);
31
- }, [options, onSelect]);
32
26
 
33
27
  /**
34
28
  * Render the custom component if it exists
@@ -43,30 +37,16 @@ var SlashMenu = function SlashMenu(_ref) {
43
37
  setActiveKey: onActiveKeyChange
44
38
  });
45
39
  }
46
- return /*#__PURE__*/_jsx("div", {
47
- style: {
48
- left: position.x,
49
- position: 'fixed',
50
- top: position.y,
51
- zIndex: 1050
52
- },
53
- children: /*#__PURE__*/_jsx(Dropdown, {
54
- menu: {
55
- // @ts-ignore
56
- activeKey: activeKey,
57
- items: loading ? [{
58
- disabled: true,
59
- key: 'loading',
60
- label: 'Loading...'
61
- }] : options,
62
- onClick: handleMenuClick
63
- },
64
- open: open,
65
- children: /*#__PURE__*/_jsx("span", {
66
- className: anchorClassName
67
- })
68
- })
40
+ return /*#__PURE__*/_jsx(DefaultSlashMenu, {
41
+ activeKey: activeKey,
42
+ anchorClassName: anchorClassName,
43
+ loading: loading,
44
+ onClose: onClose,
45
+ onSelect: onSelect,
46
+ open: open,
47
+ options: options,
48
+ position: position
69
49
  });
70
- };
50
+ });
71
51
  SlashMenu.displayName = 'SlashMenu';
72
52
  export default SlashMenu;
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ *
7
+ */
8
+ import { TableCellNode } from '@lexical/table';
9
+ import type { LexicalEditor } from 'lexical';
10
+ import { type ReactNode } from 'react';
11
+ interface TableCellActionMenuProps {
12
+ cellMerge?: boolean;
13
+ children: ReactNode;
14
+ editor: LexicalEditor;
15
+ tableCellNode: TableCellNode;
16
+ }
17
+ declare const TableActionMenu: import("react").NamedExoticComponent<TableCellActionMenuProps>;
18
+ export default TableActionMenu;
@@ -0,0 +1,309 @@
1
+ function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
2
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
3
+ function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
4
+ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
5
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
6
+ function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
7
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
8
+ /**
9
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
10
+ *
11
+ * This source code is licensed under the MIT license found in the
12
+ * LICENSE file in the root directory of this source tree.
13
+ *
14
+ */
15
+ import { $computeTableMapSkipCellCheck, $deleteTableColumnAtSelection, $deleteTableRowAtSelection, $getTableColumnIndexFromTableCellNode, $getTableNodeFromLexicalNodeOrThrow, $getTableRowIndexFromTableCellNode, $insertTableColumnAtSelection, $insertTableRowAtSelection, $isTableCellNode, $isTableSelection, $mergeCells, $unmergeCell, TableCellHeaderStates, TableCellNode, getTableElement, getTableObserverFromTableElement } from '@lexical/table';
16
+ import { Dropdown } from '@lobehub/ui';
17
+ import { $getSelection, $setSelection } from 'lexical';
18
+ import { Grid2X2XIcon, PanelBottomCloseIcon, PanelLeftCloseIcon, PanelRightCloseIcon, PanelTopCloseIcon, TableColumnsSplitIcon, TableRowsSplitIcon } from 'lucide-react';
19
+ import { memo, useCallback, useEffect, useMemo, useState } from 'react';
20
+ import { useTranslation } from "../../../../editor-kernel/react/useTranslation";
21
+ import { $canUnmerge, $selectLastDescendant, computeSelectionCount, currentCellBackgroundColor } from "./utils";
22
+ import { jsx as _jsx } from "react/jsx-runtime";
23
+ var TableActionMenu = /*#__PURE__*/memo(function (_ref) {
24
+ var editor = _ref.editor,
25
+ _tableCellNode = _ref.tableCellNode,
26
+ cellMerge = _ref.cellMerge,
27
+ children = _ref.children;
28
+ var _useState = useState(_tableCellNode),
29
+ _useState2 = _slicedToArray(_useState, 2),
30
+ tableCellNode = _useState2[0],
31
+ updateTableCellNode = _useState2[1];
32
+ var _useState3 = useState({
33
+ columns: 1,
34
+ rows: 1
35
+ }),
36
+ _useState4 = _slicedToArray(_useState3, 2),
37
+ selectionCounts = _useState4[0],
38
+ updateSelectionCounts = _useState4[1];
39
+ var _useState5 = useState(false),
40
+ _useState6 = _slicedToArray(_useState5, 2),
41
+ canMergeCells = _useState6[0],
42
+ setCanMergeCells = _useState6[1];
43
+ var _useState7 = useState(false),
44
+ _useState8 = _slicedToArray(_useState7, 2),
45
+ canUnmergeCell = _useState8[0],
46
+ setCanUnmergeCell = _useState8[1];
47
+ var _useState9 = useState(function () {
48
+ return currentCellBackgroundColor(editor) || '';
49
+ }),
50
+ _useState10 = _slicedToArray(_useState9, 2),
51
+ setBackgroundColor = _useState10[1];
52
+ var t = useTranslation();
53
+ useEffect(function () {
54
+ return editor.registerMutationListener(TableCellNode, function (nodeMutations) {
55
+ var nodeUpdated = nodeMutations.get(tableCellNode.getKey()) === 'updated';
56
+ if (nodeUpdated) {
57
+ editor.getEditorState().read(function () {
58
+ updateTableCellNode(tableCellNode.getLatest());
59
+ });
60
+ setBackgroundColor(currentCellBackgroundColor(editor) || '');
61
+ }
62
+ }, {
63
+ skipInitialization: true
64
+ });
65
+ }, [editor, tableCellNode]);
66
+ useEffect(function () {
67
+ editor.getEditorState().read(function () {
68
+ var selection = $getSelection();
69
+ // Merge cells
70
+ if ($isTableSelection(selection)) {
71
+ var currentSelectionCounts = computeSelectionCount(selection);
72
+ updateSelectionCounts(computeSelectionCount(selection));
73
+ setCanMergeCells(currentSelectionCounts.columns > 1 || currentSelectionCounts.rows > 1);
74
+ }
75
+ // Unmerge cell
76
+ setCanUnmergeCell($canUnmerge());
77
+ });
78
+ }, [editor]);
79
+ var clearTableSelection = useCallback(function () {
80
+ editor.update(function () {
81
+ if (tableCellNode.isAttached()) {
82
+ var tableNode = $getTableNodeFromLexicalNodeOrThrow(tableCellNode);
83
+ var tableElement = getTableElement(tableNode, editor.getElementByKey(tableNode.getKey()));
84
+ if (tableElement === null) {
85
+ throw new Error('TableActionMenu: Expected to find tableElement in DOM');
86
+ }
87
+ var tableObserver = getTableObserverFromTableElement(tableElement);
88
+ if (tableObserver !== null) {
89
+ tableObserver.$clearHighlight();
90
+ }
91
+ tableNode.markDirty();
92
+ updateTableCellNode(tableCellNode.getLatest());
93
+ }
94
+ $setSelection(null);
95
+ });
96
+ }, [editor, tableCellNode]);
97
+ var mergeTableCellsAtSelection = function mergeTableCellsAtSelection() {
98
+ editor.update(function () {
99
+ var selection = $getSelection();
100
+ if (!$isTableSelection(selection)) {
101
+ return;
102
+ }
103
+ var nodes = selection.getNodes();
104
+ var tableCells = nodes.filter($isTableCellNode);
105
+ var targetCell = $mergeCells(tableCells);
106
+ if (targetCell) {
107
+ $selectLastDescendant(targetCell);
108
+ }
109
+ });
110
+ };
111
+ var unmergeTableCellsAtSelection = function unmergeTableCellsAtSelection() {
112
+ editor.update(function () {
113
+ $unmergeCell();
114
+ });
115
+ };
116
+ var insertTableRowAtSelection = useCallback(function (shouldInsertAfter) {
117
+ editor.update(function () {
118
+ for (var i = 0; i < selectionCounts.rows; i++) {
119
+ $insertTableRowAtSelection(shouldInsertAfter);
120
+ }
121
+ });
122
+ }, [editor, selectionCounts.rows]);
123
+ var insertTableColumnAtSelection = useCallback(function (shouldInsertAfter) {
124
+ editor.update(function () {
125
+ for (var i = 0; i < selectionCounts.columns; i++) {
126
+ $insertTableColumnAtSelection(shouldInsertAfter);
127
+ }
128
+ });
129
+ }, [editor, selectionCounts.columns]);
130
+ var deleteTableRowAtSelection = useCallback(function () {
131
+ editor.update(function () {
132
+ $deleteTableRowAtSelection();
133
+ });
134
+ }, [editor]);
135
+ var deleteTableAtSelection = useCallback(function () {
136
+ editor.update(function () {
137
+ var tableNode = $getTableNodeFromLexicalNodeOrThrow(tableCellNode);
138
+ tableNode.remove();
139
+ clearTableSelection();
140
+ });
141
+ }, [editor, tableCellNode, clearTableSelection]);
142
+ var deleteTableColumnAtSelection = useCallback(function () {
143
+ editor.update(function () {
144
+ $deleteTableColumnAtSelection();
145
+ });
146
+ }, [editor]);
147
+ var toggleTableRowIsHeader = useCallback(function () {
148
+ editor.update(function () {
149
+ var tableNode = $getTableNodeFromLexicalNodeOrThrow(tableCellNode);
150
+ var tableRowIndex = $getTableRowIndexFromTableCellNode(tableCellNode);
151
+ var _$computeTableMapSkip = $computeTableMapSkipCellCheck(tableNode, null, null),
152
+ _$computeTableMapSkip2 = _slicedToArray(_$computeTableMapSkip, 1),
153
+ gridMap = _$computeTableMapSkip2[0];
154
+ var rowCells = new Set();
155
+ var newStyle = tableCellNode.getHeaderStyles() ^ TableCellHeaderStates.ROW;
156
+ for (var col = 0; col < gridMap[tableRowIndex].length; col++) {
157
+ var mapCell = gridMap[tableRowIndex][col];
158
+ if (!(mapCell !== null && mapCell !== void 0 && mapCell.cell)) {
159
+ continue;
160
+ }
161
+ if (!rowCells.has(mapCell.cell)) {
162
+ rowCells.add(mapCell.cell);
163
+ mapCell.cell.setHeaderStyles(newStyle, TableCellHeaderStates.ROW);
164
+ }
165
+ }
166
+ clearTableSelection();
167
+ });
168
+ }, [editor, tableCellNode, clearTableSelection]);
169
+ var toggleTableColumnIsHeader = useCallback(function () {
170
+ editor.update(function () {
171
+ var tableNode = $getTableNodeFromLexicalNodeOrThrow(tableCellNode);
172
+ var tableColumnIndex = $getTableColumnIndexFromTableCellNode(tableCellNode);
173
+ var _$computeTableMapSkip3 = $computeTableMapSkipCellCheck(tableNode, null, null),
174
+ _$computeTableMapSkip4 = _slicedToArray(_$computeTableMapSkip3, 1),
175
+ gridMap = _$computeTableMapSkip4[0];
176
+ var columnCells = new Set();
177
+ var newStyle = tableCellNode.getHeaderStyles() ^ TableCellHeaderStates.COLUMN;
178
+ var _iterator = _createForOfIteratorHelper(gridMap),
179
+ _step;
180
+ try {
181
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
182
+ var element = _step.value;
183
+ var mapCell = element[tableColumnIndex];
184
+ if (!(mapCell !== null && mapCell !== void 0 && mapCell.cell)) {
185
+ continue;
186
+ }
187
+ if (!columnCells.has(mapCell.cell)) {
188
+ columnCells.add(mapCell.cell);
189
+ mapCell.cell.setHeaderStyles(newStyle, TableCellHeaderStates.COLUMN);
190
+ }
191
+ }
192
+ } catch (err) {
193
+ _iterator.e(err);
194
+ } finally {
195
+ _iterator.f();
196
+ }
197
+ clearTableSelection();
198
+ });
199
+ }, [editor, tableCellNode, clearTableSelection]);
200
+
201
+ // Create menu items array with useMemo for performance
202
+ var menuItems = useMemo(function () {
203
+ return [
204
+ // // Merge/Unmerge cells (conditional)
205
+ // ...(cellMerge && canMergeCells
206
+ // ? [
207
+ // {
208
+ // key: 'table-merge-cells',
209
+ // label: 'Merge cells',
210
+ // onClick: () => mergeTableCellsAtSelection(),
211
+ // },
212
+ // ]
213
+ // : []),
214
+ // ...(cellMerge && canUnmergeCell
215
+ // ? [
216
+ // {
217
+ // key: 'table-unmerge-cells',
218
+ // label: 'Unmerge cells',
219
+ // onClick: () => unmergeTableCellsAtSelection(),
220
+ // },
221
+ // ]
222
+ // : []),
223
+ // // Divider after merge operations (if any merge operations exist)
224
+ // ...(cellMerge && (canMergeCells || canUnmergeCell) ? [{ type: 'divider' as const }] : []),
225
+ //
226
+ // // Row operations
227
+ {
228
+ icon: PanelTopCloseIcon,
229
+ key: 'table-insert-row-above',
230
+ label: t("table.insertRowAbove", {
231
+ count: selectionCounts.rows
232
+ }),
233
+ onClick: function onClick() {
234
+ return insertTableRowAtSelection(false);
235
+ }
236
+ }, {
237
+ icon: PanelBottomCloseIcon,
238
+ key: 'table-insert-row-below',
239
+ label: t("table.insertRowBelow", {
240
+ count: selectionCounts.rows
241
+ }),
242
+ onClick: function onClick() {
243
+ return insertTableRowAtSelection(true);
244
+ }
245
+ }, {
246
+ type: 'divider'
247
+ },
248
+ // Column operations
249
+ {
250
+ icon: PanelLeftCloseIcon,
251
+ key: 'table-insert-column-before',
252
+ // label: `Insert ${selectionCounts.columns === 1 ? 'column' : `${selectionCounts.columns} columns`} left`,
253
+ label: t("table.insertColumnLeft", {
254
+ count: selectionCounts.columns
255
+ }),
256
+ onClick: function onClick() {
257
+ return insertTableColumnAtSelection(false);
258
+ }
259
+ }, {
260
+ icon: PanelRightCloseIcon,
261
+ key: 'table-insert-column-after',
262
+ // label: `Insert ${selectionCounts.columns === 1 ? 'column' : `${selectionCounts.columns} columns`} right`,
263
+ label: t("table.insertColumnRight", {
264
+ count: selectionCounts.columns
265
+ }),
266
+ onClick: function onClick() {
267
+ return insertTableColumnAtSelection(true);
268
+ }
269
+ }, {
270
+ type: 'divider'
271
+ },
272
+ // Delete operations
273
+ {
274
+ icon: TableColumnsSplitIcon,
275
+ key: 'table-delete-columns',
276
+ // label: 'Delete column',
277
+ label: t("table.deleteColumn"),
278
+ onClick: function onClick() {
279
+ return deleteTableColumnAtSelection();
280
+ }
281
+ }, {
282
+ icon: TableRowsSplitIcon,
283
+ key: 'table-delete-rows',
284
+ // label: 'Delete row',
285
+ label: t("table.deleteRow"),
286
+ onClick: function onClick() {
287
+ return deleteTableRowAtSelection();
288
+ }
289
+ }, {
290
+ type: 'divider'
291
+ }, {
292
+ icon: Grid2X2XIcon,
293
+ key: 'table-delete',
294
+ // label: 'Delete table',
295
+ label: t("table.delete"),
296
+ onClick: function onClick() {
297
+ return deleteTableAtSelection();
298
+ }
299
+ }];
300
+ }, [cellMerge, canMergeCells, canUnmergeCell, selectionCounts.rows, selectionCounts.columns, tableCellNode.__headerState, mergeTableCellsAtSelection, unmergeTableCellsAtSelection, insertTableRowAtSelection, insertTableColumnAtSelection, deleteTableColumnAtSelection, deleteTableRowAtSelection, deleteTableAtSelection, toggleTableRowIsHeader, toggleTableColumnIsHeader]);
301
+ return /*#__PURE__*/_jsx(Dropdown, {
302
+ menu: {
303
+ items: menuItems
304
+ },
305
+ children: children
306
+ });
307
+ });
308
+ TableActionMenu.displayName = 'TableActionMenu';
309
+ export default TableActionMenu;
@@ -1,8 +1,7 @@
1
1
  /// <reference types="react" />
2
2
  import type { LexicalEditor } from 'lexical';
3
- declare const _default: import("react").NamedExoticComponent<{
4
- anchorElem?: HTMLElement | undefined;
3
+ declare const TableActionMenu: import("react").NamedExoticComponent<{
5
4
  cellMerge?: boolean | undefined;
6
5
  editor: LexicalEditor;
7
6
  }>;
8
- export default _default;
7
+ export default TableActionMenu;