@lobehub/editor 4.21.0 → 4.23.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +16 -15
- package/es/_virtual/_rolldown/runtime.js +8 -1
- package/es/codemirror/components/CopyButton.d.ts +0 -1
- package/es/codemirror/components/LanguageSelect.d.ts +0 -1
- package/es/codemirror/components/MoreOptions.d.ts +0 -1
- package/es/codemirror/components/Toolbar.d.ts +0 -1
- package/es/codemirror/constants.d.ts +0 -1
- package/es/codemirror/types.d.ts +0 -1
- package/es/common/sys.js +1 -1
- package/es/editor-kernel/data-source.d.ts +1 -2
- package/es/editor-kernel/event.d.ts +1 -3
- package/es/editor-kernel/index.d.ts +3 -2
- package/es/editor-kernel/index.js +4 -4
- package/es/editor-kernel/inode/i-element-node.d.ts +0 -1
- package/es/editor-kernel/inode/i-node.d.ts +0 -1
- package/es/editor-kernel/inode/index.d.ts +3 -1
- package/es/editor-kernel/inode/paragraph-node.d.ts +1 -1
- package/es/editor-kernel/inode/root-node.d.ts +0 -1
- package/es/editor-kernel/inode/text-node.d.ts +0 -1
- package/es/editor-kernel/kernel.d.ts +1 -2
- package/es/editor-kernel/react/LexicalErrorBoundary.d.ts +2 -6
- package/es/editor-kernel/react/PortalContainer.d.ts +7 -3
- package/es/editor-kernel/react/PortalContainer.js +4 -4
- package/es/editor-kernel/react/index.d.ts +2 -1
- package/es/editor-kernel/react/react-context.d.ts +3 -2
- package/es/editor-kernel/react/react-editor.d.ts +2 -2
- package/es/editor-kernel/react/useDecorators.js +3 -2
- package/es/editor-kernel/react/useLexicalEditor.d.ts +0 -1
- package/es/editor-kernel/react/useLexicalEditor.js +1 -1
- package/es/editor-kernel/utils.d.ts +2 -3
- package/es/headless/extract-media-from-editor-state.d.ts +0 -1
- package/es/headless/extract-media-from-editor-state.js +1 -1
- package/es/headless/index.d.ts +3 -2
- package/es/headless/index.js +4 -3
- package/es/headless.d.ts +2 -3
- package/es/headless.js +20 -41
- package/es/index.d.ts +45 -21
- package/es/index.js +6 -6
- package/es/locale/index.d.ts +1 -1
- package/es/node_modules/.pnpm/@types_mdast@4.0.4/node_modules/@types/mdast/index.d.ts +1 -2
- package/es/node_modules/.pnpm/@types_unist@3.0.3/node_modules/@types/unist/index.d.ts +1 -1
- package/es/plugins/auto-complete/index.d.ts +3 -1
- package/es/plugins/auto-complete/node/placeholderNode.js +1 -1
- package/es/plugins/auto-complete/plugin/index.d.ts +2 -1
- package/es/plugins/auto-complete/react/ReactAutoCompletePlugin.d.ts +1 -2
- package/es/plugins/auto-complete/react/index.d.ts +2 -1
- package/es/plugins/auto-complete/react/type.d.ts +1 -0
- package/es/plugins/block/command/index.d.ts +1 -3
- package/es/plugins/block/index.d.ts +5 -2
- package/es/plugins/block/plugin/index.d.ts +1 -0
- package/es/plugins/block/react/ReactBlockPlugin.d.ts +3 -2
- package/es/plugins/block/react/ReactBlockPlugin.js +5 -3
- package/es/plugins/block/react/core/types.d.ts +0 -1
- package/es/plugins/block/react/index.d.ts +3 -2
- package/es/plugins/block/service/i-block-menu-service.d.ts +1 -1
- package/es/plugins/block/service/i-block-menu-service.js +2 -1
- package/es/plugins/block/service/index.d.ts +2 -1
- package/es/plugins/code/command/index.d.ts +1 -3
- package/es/plugins/code/index.d.ts +3 -1
- package/es/plugins/code/plugin/index.d.ts +2 -1
- package/es/plugins/code/react/CodeReactPlugin.d.ts +1 -2
- package/es/plugins/code/react/index.d.ts +2 -1
- package/es/plugins/codeblock/command/index.d.ts +3 -1
- package/es/plugins/codeblock/command/index.js +1 -1
- package/es/plugins/codeblock/command/symbols.d.ts +1 -3
- package/es/plugins/codeblock/index.d.ts +3 -1
- package/es/plugins/codeblock/index.js +4 -4
- package/es/plugins/codeblock/plugin/index.d.ts +1 -0
- package/es/plugins/codeblock/react/ReactCodeblockPlugin.d.ts +1 -2
- package/es/plugins/codeblock/react/ReactCodeblockPlugin.js +1 -1
- package/es/plugins/codeblock/react/index.d.ts +2 -1
- package/es/plugins/codeblock/react/style.js +0 -1
- package/es/plugins/codeblock/react/type.d.ts +1 -0
- package/es/plugins/codemirror-block/command/index.d.ts +3 -5
- package/es/plugins/codemirror-block/index.d.ts +3 -1
- package/es/plugins/codemirror-block/node/CodeMirrorNode.d.ts +1 -2
- package/es/plugins/codemirror-block/plugin/index.d.ts +1 -1
- package/es/plugins/codemirror-block/react/ReactCodemirrorNode.d.ts +1 -2
- package/es/plugins/codemirror-block/react/index.d.ts +2 -1
- package/es/plugins/collaboration/index.d.ts +3 -1
- package/es/plugins/collaboration/react/ReactCollaborationPlugin.d.ts +1 -2
- package/es/plugins/collaboration/react/ReactCollaborationPlugin.js +1 -1
- package/es/plugins/collaboration/react/index.d.ts +2 -1
- package/es/plugins/collaboration/react/type.d.ts +0 -1
- package/es/plugins/collaboration/utils.d.ts +0 -1
- package/es/plugins/collaboration/utils.js +1 -1
- package/es/plugins/common/command/index.d.ts +2 -4
- package/es/plugins/common/data-source/json-data-source.js +1 -1
- package/es/plugins/common/index.d.ts +4 -2
- package/es/plugins/common/node/cursor.d.ts +1 -2
- package/es/plugins/common/plugin/index.d.ts +1 -1
- package/es/plugins/common/plugin/index.js +2 -1
- package/es/plugins/common/plugin/paste-handler.d.ts +0 -1
- package/es/plugins/common/plugin/register.js +4 -3
- package/es/plugins/common/react/Placeholder/index.js +2 -1
- package/es/plugins/common/react/ReactEditorContent.d.ts +1 -2
- package/es/plugins/common/react/ReactPlainText.d.ts +2 -4
- package/es/plugins/common/react/index.d.ts +3 -2
- package/es/plugins/common/react/type.d.ts +2 -1
- package/es/plugins/common/utils/index.js +1 -1
- package/es/plugins/content-blocks/data-source/content-blocks-data-source.d.ts +2 -2
- package/es/plugins/content-blocks/index.d.ts +2 -1
- package/es/plugins/content-blocks/plugin/index.d.ts +1 -1
- package/es/plugins/content-blocks/types.d.ts +1 -2
- package/es/plugins/content-blocks/utils/extract-media-lists.d.ts +0 -1
- package/es/plugins/content-blocks/utils/extract.d.ts +0 -1
- package/es/plugins/content-blocks/utils/extract.js +2 -2
- package/es/plugins/file/command/index.d.ts +1 -3
- package/es/plugins/file/index.d.ts +3 -1
- package/es/plugins/file/node/FileNode.d.ts +1 -2
- package/es/plugins/file/plugin/index.d.ts +1 -1
- package/es/plugins/file/react/ReactFilePlugin.d.ts +1 -2
- package/es/plugins/file/react/index.d.ts +2 -1
- package/es/plugins/file/react/type.d.ts +1 -1
- package/es/plugins/hr/command/index.d.ts +1 -3
- package/es/plugins/hr/index.d.ts +3 -1
- package/es/plugins/hr/node/HorizontalRuleNode.d.ts +1 -2
- package/es/plugins/hr/plugin/index.d.ts +1 -1
- package/es/plugins/hr/react/ReactHRPlugin.d.ts +1 -2
- package/es/plugins/hr/react/index.d.ts +2 -1
- package/es/plugins/image/command/index.d.ts +1 -3
- package/es/plugins/image/index.d.ts +3 -1
- package/es/plugins/image/node/basie-image-node.d.ts +0 -1
- package/es/plugins/image/node/block-image-node.d.ts +0 -1
- package/es/plugins/image/node/image-node.d.ts +0 -1
- package/es/plugins/image/plugin/index.d.ts +1 -1
- package/es/plugins/image/react/ReactImagePlugin.d.ts +1 -2
- package/es/plugins/image/react/components/Image.js +4 -2
- package/es/plugins/image/react/components/style.js +3 -3
- package/es/plugins/image/react/components/useSupenseImage.js +1 -1
- package/es/plugins/image/react/index.d.ts +2 -1
- package/es/plugins/inode/index.d.ts +2 -1
- package/es/plugins/inode/plugin/index.d.ts +1 -0
- package/es/plugins/inode/react/index.d.ts +1 -2
- package/es/plugins/inode/react/index.js +1 -1
- package/es/plugins/inode/service/index.d.ts +2 -0
- package/es/plugins/inode/service/index.js +2 -1
- package/es/plugins/link/command/index.d.ts +1 -3
- package/es/plugins/link/index.d.ts +3 -1
- package/es/plugins/link/node/LinkNode.d.ts +0 -1
- package/es/plugins/link/node/LinkNode.js +2 -2
- package/es/plugins/link/plugin/index.d.ts +1 -1
- package/es/plugins/link/plugin/registry.js +2 -1
- package/es/plugins/link/react/ReactLinkPlugin.d.ts +1 -2
- package/es/plugins/link/react/ReactLinkPlugin.js +1 -1
- package/es/plugins/link/react/index.d.ts +2 -1
- package/es/plugins/link/react/type.d.ts +0 -1
- package/es/plugins/link/service/i-link-service.d.ts +1 -1
- package/es/plugins/link/service/i-link-service.js +2 -1
- package/es/plugins/link/utils/index.js +1 -1
- package/es/plugins/link-highlight/command/index.d.ts +1 -3
- package/es/plugins/link-highlight/index.d.ts +3 -1
- package/es/plugins/link-highlight/plugin/index.d.ts +1 -0
- package/es/plugins/link-highlight/react/ReactLinkHighlightPlugin.d.ts +1 -2
- package/es/plugins/link-highlight/react/index.d.ts +2 -1
- package/es/plugins/list/command/index.d.ts +1 -1
- package/es/plugins/list/command/index.js +2 -2
- package/es/plugins/list/index.d.ts +3 -1
- package/es/plugins/list/plugin/checkList.d.ts +0 -1
- package/es/plugins/list/plugin/checkList.js +0 -7
- package/es/plugins/list/plugin/index.d.ts +1 -0
- package/es/plugins/list/react/ReactListPlugin.d.ts +1 -2
- package/es/plugins/list/react/index.d.ts +2 -1
- package/es/plugins/list/react/style.js +1 -1
- package/es/plugins/litexml/command/diffCommand.d.ts +2 -1
- package/es/plugins/litexml/command/diffCommand.js +2 -2
- package/es/plugins/litexml/command/index.d.ts +3 -1
- package/es/plugins/litexml/command/index.js +3 -2
- package/es/plugins/litexml/command/symbols.d.ts +6 -8
- package/es/plugins/litexml/data-source/litexml-data-source.d.ts +4 -3
- package/es/plugins/litexml/data-source/litexml-data-source.js +4 -2
- package/es/plugins/litexml/index.d.ts +5 -2
- package/es/plugins/litexml/node/DiffNode.d.ts +1 -2
- package/es/plugins/litexml/plugin/index.d.ts +1 -1
- package/es/plugins/litexml/react/DiffNodeToolbar/index.js +1 -1
- package/es/plugins/litexml/react/hooks/useHasDiffNode.d.ts +1 -0
- package/es/plugins/litexml/react/index.d.ts +1 -2
- package/es/plugins/litexml/react/index.js +1 -1
- package/es/plugins/litexml/service/litexml-service.d.ts +3 -3
- package/es/plugins/litexml/service/litexml-service.js +2 -1
- package/es/plugins/markdown/command/index.d.ts +4 -4
- package/es/plugins/markdown/data-source/markdown/parse.d.ts +3 -3
- package/es/plugins/markdown/data-source/markdown/parse.js +2 -2
- package/es/plugins/markdown/data-source/markdown-data-source.js +1 -1
- package/es/plugins/markdown/index.d.ts +3 -2
- package/es/plugins/markdown/plugin/index.d.ts +2 -1
- package/es/plugins/markdown/react/index.d.ts +1 -2
- package/es/plugins/markdown/service/shortcut.d.ts +2 -2
- package/es/plugins/markdown/service/shortcut.js +2 -1
- package/es/plugins/markdown/service/transformers.d.ts +1 -3
- package/es/plugins/markdown/utils/index.d.ts +1 -1
- package/es/plugins/markdown/utils/index.js +1 -1
- package/es/plugins/math/command/index.d.ts +1 -3
- package/es/plugins/math/index.d.ts +2 -1
- package/es/plugins/math/node/index.d.ts +1 -2
- package/es/plugins/math/node/index.js +3 -2
- package/es/plugins/math/plugin/index.d.ts +2 -2
- package/es/plugins/math/react/components/MathEditorContent.js +2 -1
- package/es/plugins/math/react/components/MathInline.js +2 -2
- package/es/plugins/math/react/index.d.ts +0 -1
- package/es/plugins/math/react/type.d.ts +0 -1
- package/es/plugins/mention/command/index.d.ts +1 -3
- package/es/plugins/mention/index.d.ts +3 -1
- package/es/plugins/mention/node/MentionNode.d.ts +0 -1
- package/es/plugins/mention/plugin/index.d.ts +2 -1
- package/es/plugins/mention/react/ReactMentionPlugin.d.ts +1 -2
- package/es/plugins/mention/react/index.d.ts +2 -1
- package/es/plugins/mention/react/type.d.ts +0 -1
- package/es/plugins/slash/index.d.ts +5 -3
- package/es/plugins/slash/plugin/index.d.ts +1 -1
- package/es/plugins/slash/react/ReactSlashOption.d.ts +1 -2
- package/es/plugins/slash/react/ReactSlashPlugin.d.ts +1 -2
- package/es/plugins/slash/react/ReactSlashPlugin.js +2 -1
- package/es/plugins/slash/react/components/SlashMenu.d.ts +1 -2
- package/es/plugins/slash/react/index.d.ts +4 -3
- package/es/plugins/slash/react/type.d.ts +2 -1
- package/es/plugins/slash/service/i-slash-service.d.ts +2 -1
- package/es/plugins/slash/service/i-slash-service.js +2 -1
- package/es/plugins/slash/utils/utils.js +1 -1
- package/es/plugins/table/command/index.d.ts +4 -6
- package/es/plugins/table/command/index.js +4 -4
- package/es/plugins/table/index.d.ts +3 -1
- package/es/plugins/table/node/index.js +2 -1
- package/es/plugins/table/plugin/index.d.ts +1 -1
- package/es/plugins/table/plugin/index.js +1 -2
- package/es/plugins/table/react/TableActionMenu/index.js +0 -7
- package/es/plugins/table/react/TableColController.js +2 -2
- package/es/plugins/table/react/TableController/hooks.js +3 -2
- package/es/plugins/table/react/TableHoverActions/utils.js +1 -1
- package/es/plugins/table/react/TableResize/index.js +1 -1
- package/es/plugins/table/react/TableRowController.js +1 -1
- package/es/plugins/table/react/hooks.js +0 -7
- package/es/plugins/table/react/index.d.ts +0 -1
- package/es/plugins/table/react/index.js +1 -1
- package/es/plugins/table/react/type.d.ts +2 -1
- package/es/plugins/table/service/i-table-controller-menu-service.d.ts +1 -1
- package/es/plugins/table/service/i-table-controller-menu-service.js +2 -1
- package/es/plugins/table/service/index.d.ts +2 -1
- package/es/plugins/table/utils/index.js +1 -1
- package/es/plugins/toolbar/command/index.d.ts +0 -1
- package/es/plugins/toolbar/index.d.ts +2 -1
- package/es/plugins/toolbar/react/index.d.ts +0 -1
- package/es/plugins/toolbar/react/type.d.ts +0 -1
- package/es/plugins/upload/index.d.ts +2 -1
- package/es/plugins/upload/plugin/index.d.ts +1 -0
- package/es/plugins/upload/service/i-upload-service.d.ts +2 -1
- package/es/plugins/upload/service/i-upload-service.js +2 -1
- package/es/plugins/virtual-block/index.d.ts +3 -1
- package/es/plugins/virtual-block/plugin/index.d.ts +1 -0
- package/es/plugins/virtual-block/plugin/register.js +3 -2
- package/es/plugins/virtual-block/react/ReactVirtualBlock.d.ts +1 -2
- package/es/plugins/virtual-block/react/index.d.ts +2 -1
- package/es/react/ChatInput/ChatInput.d.ts +1 -2
- package/es/react/ChatInput/ChatInput.js +2 -1
- package/es/react/ChatInput/index.d.ts +2 -1
- package/es/react/ChatInput/type.d.ts +0 -1
- package/es/react/ChatInputActionBar/ChatInputActionBar.d.ts +1 -2
- package/es/react/ChatInputActionBar/index.d.ts +2 -1
- package/es/react/ChatInputActionBar/type.d.ts +0 -1
- package/es/react/ChatInputActions/ChatInputActions.d.ts +2 -4
- package/es/react/ChatInputActions/index.d.ts +2 -1
- package/es/react/ChatInputActions/type.d.ts +0 -1
- package/es/react/CodeLanguageSelect/CodeLanguageSelect.d.ts +1 -2
- package/es/react/CodeLanguageSelect/index.d.ts +2 -1
- package/es/react/CodeLanguageSelect/type.d.ts +0 -1
- package/es/react/Editor/Editor.js +1 -1
- package/es/react/Editor/index.d.ts +1 -2
- package/es/react/Editor/index.js +1 -1
- package/es/react/Editor/type.d.ts +5 -1
- package/es/react/Editor/utils.d.ts +0 -1
- package/es/react/EditorProvider/index.d.ts +2 -7
- package/es/react/EditorProvider/index.js +1 -1
- package/es/react/FloatActions/FloatActions.d.ts +1 -2
- package/es/react/FloatActions/index.d.ts +2 -1
- package/es/react/FloatActions/type.d.ts +0 -1
- package/es/react/SendButton/SendButton.d.ts +1 -2
- package/es/react/SendButton/index.d.ts +2 -1
- package/es/react/SendButton/type.d.ts +0 -1
- package/es/react/hooks/useEditor.d.ts +1 -0
- package/es/react/hooks/useEditorState/index.d.ts +1 -0
- package/es/react/hooks/useEditorState/index.js +8 -4
- package/es/react.d.ts +14 -7
- package/es/renderer/LexicalDiff.d.ts +1 -16
- package/es/renderer/LexicalDiff.js +1 -1
- package/es/renderer/LexicalRenderer.d.ts +1 -11
- package/es/renderer/diff/style.js +1 -1
- package/es/renderer/diff/types.d.ts +0 -1
- package/es/renderer/engine/render-builtin-node.js +1 -1
- package/es/renderer/nodes/index.d.ts +0 -1
- package/es/renderer/renderers/index.d.ts +0 -1
- package/es/renderer/renderers/index.js +1 -1
- package/es/renderer/renderers/math.js +2 -2
- package/es/renderer/types.d.ts +0 -1
- package/es/{symbols-DEEvsKq4.d.ts → symbols-Do7jD4Tt.d.ts} +6 -8
- package/es/types/hotkey.d.ts +0 -1
- package/es/types/index.d.ts +2 -1
- package/es/types/kernel.d.ts +1 -2
- package/es/types/locale.d.ts +2 -3
- package/es/utils/debug.d.ts +1 -2
- package/es/utils/debug.js +1 -1
- package/es/utils/hotkey/parseHotkeys.js +1 -1
- package/es/utils/hotkey/registerHotkey.d.ts +0 -1
- package/package.json +19 -19
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { getKernelFromEditor, getKernelFromEditorConfig, reconcileDecorator } from "../../../editor-kernel/utils.js";
|
|
1
|
+
import { getKernelFromEditor, getKernelFromEditorConfig, init_utils, reconcileDecorator } from "../../../editor-kernel/utils.js";
|
|
2
2
|
import { TableNode, TableNode as TableNode$1 } from "@lexical/table";
|
|
3
3
|
import { setDOMUnmanaged } from "lexical";
|
|
4
4
|
//#region src/plugins/table/node/index.ts
|
|
5
|
+
init_utils();
|
|
5
6
|
const OriginalCreateDOM = TableNode.prototype.createDOM;
|
|
6
7
|
const OriginalUpdateDOM = TableNode.prototype.updateDOM;
|
|
7
8
|
const SCROLL_INDICATOR_WIDTH = 24;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { IEditorPluginConstructor } from "../../../types/kernel.js";
|
|
2
|
+
import "../../../types/index.js";
|
|
2
3
|
import { TableNode } from "../node/index.js";
|
|
3
4
|
import { ReactNode } from "react";
|
|
4
5
|
import { LexicalEditor } from "lexical";
|
|
5
|
-
|
|
6
6
|
//#region src/plugins/table/plugin/index.d.ts
|
|
7
7
|
interface TablePluginOptions {
|
|
8
8
|
decoratorCol?: (node: TableNode, editor: LexicalEditor) => ReactNode;
|
|
@@ -84,8 +84,7 @@ const TablePlugin = class extends KernelPlugin {
|
|
|
84
84
|
if (!$isTableNode(node)) return false;
|
|
85
85
|
const [tableMap] = $computeTableMapSkipCellCheck(node, null, null);
|
|
86
86
|
const firstCell = tableMap[0]?.[0]?.cell;
|
|
87
|
-
const
|
|
88
|
-
const lastCell = lastRow?.[lastRow.length - 1]?.cell;
|
|
87
|
+
const lastCell = [...tableMap].reverse().find((row) => row.length > 0)?.at(-1)?.cell;
|
|
89
88
|
if (!firstCell || !lastCell) return false;
|
|
90
89
|
const tableSelection = $createTableSelection();
|
|
91
90
|
tableSelection.set(node.getKey(), firstCell.getKey(), lastCell.getKey());
|
|
@@ -10,13 +10,6 @@ import { $getTableCellNodeFromLexicalNode, $getTableNodeFromLexicalNodeOrThrow,
|
|
|
10
10
|
import { $getNodeByKey, $getSelection, $isRangeSelection, COMMAND_PRIORITY_CRITICAL, SELECTION_CHANGE_COMMAND, getDOMSelection } from "lexical";
|
|
11
11
|
import { mergeRegister } from "@lexical/utils";
|
|
12
12
|
//#region src/plugins/table/react/TableActionMenu/index.tsx
|
|
13
|
-
/**
|
|
14
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
15
|
-
*
|
|
16
|
-
* This source code is licensed under the MIT license found in the
|
|
17
|
-
* LICENSE file in the root directory of this source tree.
|
|
18
|
-
*
|
|
19
|
-
*/
|
|
20
13
|
const TableActionMenu = memo(({ cellMerge, editor }) => {
|
|
21
14
|
const anchorElem = useAnchor();
|
|
22
15
|
const menuButtonRef = useRef(null);
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import LexicalPortalContainer from "../../../editor-kernel/react/PortalContainer.js";
|
|
1
|
+
import { LexicalPortalContainer } from "../../../editor-kernel/react/PortalContainer.js";
|
|
2
2
|
import { INSERT_TABLE_COLUMN_COMMAND, MOVE_TABLE_COLUMN_COMMAND, SELECT_TABLE_COMMAND } from "../command/index.js";
|
|
3
|
+
import { useTableControllerSelection } from "./hooks.js";
|
|
3
4
|
import { sum, useTableAxisDrag, useTableColumnMetrics } from "./TableController/hooks.js";
|
|
4
5
|
import { styles } from "./TableController/style.js";
|
|
5
6
|
import { createTableDragImage } from "./TableController/utils.js";
|
|
6
7
|
import TableControllerMenu from "./TableControllerMenu.js";
|
|
7
8
|
import TableInsertButton from "./TableInsertButton.js";
|
|
8
|
-
import { useTableControllerSelection } from "./hooks.js";
|
|
9
9
|
import { memo, useCallback, useEffect, useRef, useState } from "react";
|
|
10
10
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
11
11
|
import { cx } from "antd-style";
|
|
@@ -98,9 +98,10 @@ const useTableRowMetrics = (editor, node) => {
|
|
|
98
98
|
const rows = tableElement.querySelectorAll("tr");
|
|
99
99
|
if (rows.length === 0) return;
|
|
100
100
|
const tableRect = table instanceof HTMLElement ? table.getBoundingClientRect() : null;
|
|
101
|
-
const
|
|
101
|
+
const measuredHeights = Array.from(rows, (row, index) => {
|
|
102
102
|
return normalizeRowControllerHeight(row.getBoundingClientRect().height, index + 1 === rows.length);
|
|
103
|
-
})
|
|
103
|
+
});
|
|
104
|
+
const nextHeights = getControlledRowHeights(measuredHeights, tableRect?.height || 0);
|
|
104
105
|
setRowHeights((currentHeights) => {
|
|
105
106
|
if (currentHeights.length === nextHeights.length && currentHeights.every((height, index) => height === nextHeights[index])) return currentHeights;
|
|
106
107
|
return nextHeights;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { INSERT_TABLE_ROW_COMMAND, MOVE_TABLE_ROW_COMMAND, SELECT_TABLE_COMMAND } from "../command/index.js";
|
|
2
|
+
import { useTableControllerSelection } from "./hooks.js";
|
|
2
3
|
import { sum, useTableAxisDrag, useTableRowMetrics } from "./TableController/hooks.js";
|
|
3
4
|
import { styles } from "./TableController/style.js";
|
|
4
5
|
import { createTableDragImage } from "./TableController/utils.js";
|
|
5
6
|
import TableControllerMenu from "./TableControllerMenu.js";
|
|
6
7
|
import TableInsertButton from "./TableInsertButton.js";
|
|
7
|
-
import { useTableControllerSelection } from "./hooks.js";
|
|
8
8
|
import { memo, useCallback, useEffect, useRef, useState } from "react";
|
|
9
9
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
10
10
|
import { cx } from "antd-style";
|
|
@@ -4,13 +4,6 @@ import { $findTableNode, $isTableSelection } from "@lexical/table";
|
|
|
4
4
|
import "es-toolkit/compat";
|
|
5
5
|
import { $getNodeByKey, $getSelection, $isRangeSelection } from "lexical";
|
|
6
6
|
//#region src/plugins/table/react/hooks.ts
|
|
7
|
-
/**
|
|
8
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
9
|
-
*
|
|
10
|
-
* This source code is licensed under the MIT license found in the
|
|
11
|
-
* LICENSE file in the root directory of this source tree.
|
|
12
|
-
*
|
|
13
|
-
*/
|
|
14
7
|
const isSameSelection = (current, next) => {
|
|
15
8
|
return current.isTableFocused === next.isTableFocused && current.isTableSelected === next.isTableSelected && current.selectedColumns.length === next.selectedColumns.length && current.selectedRows.length === next.selectedRows.length && current.selectedColumns.every((column, index) => column === next.selectedColumns[index]) && current.selectedRows.every((row, index) => row === next.selectedRows[index]);
|
|
16
9
|
};
|
|
@@ -6,12 +6,12 @@ import { $updateDOMForSelection } from "../utils/index.js";
|
|
|
6
6
|
import { ITableControllerMenuService } from "../service/i-table-controller-menu-service.js";
|
|
7
7
|
import { TablePlugin } from "../plugin/index.js";
|
|
8
8
|
import PortalAnchor from "../../../editor-kernel/react/PortalAnchor.js";
|
|
9
|
+
import { selectionOutlineStyles, styles } from "./style.js";
|
|
9
10
|
import TableActionMenu from "./TableActionMenu/index.js";
|
|
10
11
|
import TableColController from "./TableColController.js";
|
|
11
12
|
import TableHoverActions from "./TableHoverActions/index.js";
|
|
12
13
|
import TableResize_default from "./TableResize/index.js";
|
|
13
14
|
import TableRowController from "./TableRowController.js";
|
|
14
|
-
import { selectionOutlineStyles, styles } from "./style.js";
|
|
15
15
|
import { useAutoFitPastedTable } from "./useAutoFitPastedTable.js";
|
|
16
16
|
import { useCallback, useEffect, useLayoutEffect, useMemo, useState } from "react";
|
|
17
17
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { ILocaleKeys } from "../../../types/locale.js";
|
|
2
|
+
import "../../../types/index.js";
|
|
2
3
|
//#region src/plugins/table/react/type.d.ts
|
|
3
4
|
type TableResizeMode = 'realtime' | 'deferred';
|
|
4
5
|
interface ReactTablePluginProps {
|
|
@@ -7,4 +8,4 @@ interface ReactTablePluginProps {
|
|
|
7
8
|
resizeMode?: TableResizeMode;
|
|
8
9
|
}
|
|
9
10
|
//#endregion
|
|
10
|
-
export { ReactTablePluginProps };
|
|
11
|
+
export { ReactTablePluginProps, TableResizeMode };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { IServiceID } from "../../../types/kernel.js";
|
|
2
|
+
import "../../../types/index.js";
|
|
2
3
|
import { TableNode } from "@lexical/table";
|
|
3
4
|
import { LexicalEditor } from "lexical";
|
|
4
|
-
|
|
5
5
|
//#region src/plugins/table/service/i-table-controller-menu-service.d.ts
|
|
6
6
|
type TableControllerMenuAxis = 'column' | 'row';
|
|
7
7
|
interface ITableControllerMenuRenderContext {
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { genServiceId } from "../../../editor-kernel/utils.js";
|
|
1
|
+
import { genServiceId, init_utils } from "../../../editor-kernel/utils.js";
|
|
2
2
|
//#region src/plugins/table/service/i-table-controller-menu-service.ts
|
|
3
|
+
init_utils();
|
|
3
4
|
const ITableControllerMenuService = genServiceId("TableControllerMenuService");
|
|
4
5
|
var TableControllerMenuService = class {
|
|
5
6
|
constructor() {
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
import { ITableControllerMenuActionItem, ITableControllerMenuItem, ITableControllerMenuRenderContext, ITableControllerMenuSeparatorItem, ITableControllerMenuService, TableControllerMenuAxis, TableControllerMenuService } from "./i-table-controller-menu-service.js";
|
|
1
|
+
import { ITableControllerMenuActionItem, ITableControllerMenuItem, ITableControllerMenuRenderContext, ITableControllerMenuSeparatorItem, ITableControllerMenuService, TableControllerMenuAxis, TableControllerMenuService } from "./i-table-controller-menu-service.js";
|
|
2
|
+
export { ITableControllerMenuActionItem, ITableControllerMenuItem, ITableControllerMenuRenderContext, ITableControllerMenuSeparatorItem, ITableControllerMenuService, TableControllerMenuAxis, TableControllerMenuService };
|
|
@@ -145,4 +145,4 @@ function $updateDOMForSelection(editor, table, selection) {
|
|
|
145
145
|
return $isTableSelection(selection) ? getTableSelectionOutlineRect([...selectedCells], table, selection) : null;
|
|
146
146
|
}
|
|
147
147
|
//#endregion
|
|
148
|
-
export { $updateDOMForSelection, createDefaultTableColWidths, getTableSelectionIndexes, isTableFullySelected, syncTableWidthDOM };
|
|
148
|
+
export { $forEachTableCell, $updateDOMForSelection, createDefaultTableColWidths, getSelectedTableColumnIndexes, getSelectedTableRowIndexes, getTableSelectionIndexes, isTableFullySelected, syncTableWidthDOM };
|
|
@@ -1,2 +1,3 @@
|
|
|
1
1
|
import { HIDE_TOOLBAR_COMMAND, SHOW_TOOLBAR_COMMAND, ToolbarCommandOptions, registerToolbarCommand } from "./command/index.js";
|
|
2
|
-
import { ReactToolbarPlugin } from "./react/index.js";
|
|
2
|
+
import { ReactToolbarPlugin } from "./react/index.js";
|
|
3
|
+
export { HIDE_TOOLBAR_COMMAND, ReactToolbarPlugin, SHOW_TOOLBAR_COMMAND, ToolbarCommandOptions, registerToolbarCommand };
|
|
@@ -1,2 +1,3 @@
|
|
|
1
1
|
import { UploadPlugin, UploadPluginOptions } from "./plugin/index.js";
|
|
2
|
-
import { IUploadService, UPLOAD_PRIORITY_HIGH, UPLOAD_PRIORITY_LOW, UPLOAD_PRIORITY_MEDIUM } from "./service/i-upload-service.js";
|
|
2
|
+
import { IUploadService, UPLOAD_PRIORITY_HIGH, UPLOAD_PRIORITY_LOW, UPLOAD_PRIORITY_MEDIUM } from "./service/i-upload-service.js";
|
|
3
|
+
export { IUploadService, UPLOAD_PRIORITY_HIGH, UPLOAD_PRIORITY_LOW, UPLOAD_PRIORITY_MEDIUM, UploadPlugin, UploadPluginOptions };
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { IServiceID } from "../../../types/kernel.js";
|
|
2
|
+
import "../../../types/index.js";
|
|
2
3
|
//#region src/plugins/upload/service/i-upload-service.d.ts
|
|
3
4
|
declare const UPLOAD_PRIORITY_LOW = 2;
|
|
4
5
|
declare const UPLOAD_PRIORITY_MEDIUM = 1;
|
|
@@ -10,4 +11,4 @@ interface IUploadService {
|
|
|
10
11
|
}
|
|
11
12
|
declare const IUploadService: IServiceID<IUploadService>;
|
|
12
13
|
//#endregion
|
|
13
|
-
export { IUploadService, UPLOAD_PRIORITY_HIGH, UPLOAD_PRIORITY_LOW, UPLOAD_PRIORITY_MEDIUM };
|
|
14
|
+
export { IUploadService, UPLOAD_PRIORITY, UPLOAD_PRIORITY_HIGH, UPLOAD_PRIORITY_LOW, UPLOAD_PRIORITY_MEDIUM };
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { genServiceId } from "../../../editor-kernel/utils.js";
|
|
1
|
+
import { genServiceId, init_utils } from "../../../editor-kernel/utils.js";
|
|
2
2
|
//#region src/plugins/upload/service/i-upload-service.ts
|
|
3
|
+
init_utils();
|
|
3
4
|
const UPLOAD_PRIORITY_LOW = 2;
|
|
4
5
|
const UPLOAD_PRIORITY_MEDIUM = 1;
|
|
5
6
|
const UPLOAD_PRIORITY_HIGH = 0;
|
|
@@ -1,2 +1,4 @@
|
|
|
1
1
|
import { VirtualBlockPlugin, VirtualBlockPluginOptions } from "./plugin/index.js";
|
|
2
|
-
import
|
|
2
|
+
import ReactVirtualBlockPlugin from "./react/ReactVirtualBlock.js";
|
|
3
|
+
import "./react/index.js";
|
|
4
|
+
export { ReactVirtualBlockPlugin, VirtualBlockPlugin, VirtualBlockPluginOptions };
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { createDebugLogger, init_debug } from "../../../utils/debug.js";
|
|
2
|
-
import { $closest } from "../../../editor-kernel/utils.js";
|
|
2
|
+
import { $closest, init_utils } from "../../../editor-kernel/utils.js";
|
|
3
3
|
import { SELECT_AFTER_CODEMIRROR_COMMAND, SELECT_BEFORE_CODEMIRROR_COMMAND } from "../../codemirror-block/command/index.js";
|
|
4
4
|
import { $createParagraphNode, $getNodeByKey, $getRoot, $getSelection, $isDecoratorNode, $isNodeSelection, $isRangeSelection, $isRootOrShadowRoot, $isTextNode, COMMAND_PRIORITY_NORMAL, KEY_ARROW_DOWN_COMMAND, KEY_ARROW_UP_COMMAND, ParagraphNode } from "lexical";
|
|
5
5
|
import { mergeRegister } from "@lexical/utils";
|
|
6
6
|
import "@lexical/code-core";
|
|
7
7
|
//#region src/plugins/virtual-block/plugin/register.ts
|
|
8
|
+
init_utils();
|
|
8
9
|
init_debug();
|
|
9
10
|
const logger = createDebugLogger("plugin", "virtual-block");
|
|
10
11
|
function toRootElement(node) {
|
|
@@ -147,4 +148,4 @@ function registerRichKeydown(editor, kernel) {
|
|
|
147
148
|
}, COMMAND_PRIORITY_NORMAL));
|
|
148
149
|
}
|
|
149
150
|
//#endregion
|
|
150
|
-
export { registerRichKeydown };
|
|
151
|
+
export { registerRichKeydown, toRootElement };
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
import
|
|
1
|
+
import ReactVirtualBlockPlugin from "./ReactVirtualBlock.js";
|
|
2
|
+
export { ReactVirtualBlockPlugin };
|
|
@@ -18,7 +18,8 @@ const ChatInput = (props) => {
|
|
|
18
18
|
value: height
|
|
19
19
|
});
|
|
20
20
|
const handleResizeStop = useCallback((e, direction, ref) => {
|
|
21
|
-
|
|
21
|
+
const newHeight = ref.style.height ? parseInt(ref.style.height) : defaultHeight;
|
|
22
|
+
setCurrentHeight(newHeight);
|
|
22
23
|
}, [setCurrentHeight, defaultHeight]);
|
|
23
24
|
const handleResize = useCallback((e, direction, ref) => {
|
|
24
25
|
const newHeight = ref.style.height ? parseInt(ref.style.height) : defaultHeight;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { ChatInputActionBarProps } from "./type.js";
|
|
2
2
|
import { FC } from "react";
|
|
3
|
-
|
|
4
3
|
//#region src/react/ChatInputActionBar/ChatInputActionBar.d.ts
|
|
5
4
|
declare const ChatInputActionBar: FC<ChatInputActionBarProps>;
|
|
6
5
|
//#endregion
|
|
7
|
-
export { ChatInputActionBar };
|
|
6
|
+
export { ChatInputActionBar as default };
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import { ChatInputActionsProps } from "./type.js";
|
|
2
|
-
import * as _$react from "react";
|
|
3
|
-
|
|
4
2
|
//#region src/react/ChatInputActions/ChatInputActions.d.ts
|
|
5
|
-
declare const ChatInputActions:
|
|
3
|
+
declare const ChatInputActions: import("react").NamedExoticComponent<ChatInputActionsProps>;
|
|
6
4
|
//#endregion
|
|
7
|
-
export { ChatInputActions };
|
|
5
|
+
export { ChatInputActions as default };
|
|
@@ -1,2 +1,3 @@
|
|
|
1
1
|
import { ActionItem, ChatInputActionEvent, ChatInputActionItem, ChatInputActionsProps, CollapseItem, DividerItem, DropdownItem } from "./type.js";
|
|
2
|
-
import
|
|
2
|
+
import ChatInputActions from "./ChatInputActions.js";
|
|
3
|
+
export { type ActionItem, type ChatInputActionEvent, type ChatInputActionItem, type ChatInputActionsProps, type CollapseItem, type DividerItem, type DropdownItem, ChatInputActions as default };
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { FlexboxProps, MenuInfo, MenuItemType, TooltipProps } from "@lobehub/ui";
|
|
2
2
|
import { ReactNode } from "react";
|
|
3
|
-
|
|
4
3
|
//#region src/react/ChatInputActions/type.d.ts
|
|
5
4
|
type ChatInputActionEvent = Pick<MenuInfo, 'key' | 'keyPath' | 'domEvent'>;
|
|
6
5
|
interface ActionItem extends MenuItemType {
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { CodeLanguageSelectProps } from "./type.js";
|
|
2
2
|
import { FC } from "react";
|
|
3
|
-
|
|
4
3
|
//#region src/react/CodeLanguageSelect/CodeLanguageSelect.d.ts
|
|
5
4
|
declare const CodeLanguageSelect: FC<CodeLanguageSelectProps>;
|
|
6
5
|
//#endregion
|
|
7
|
-
export { CodeLanguageSelect };
|
|
6
|
+
export { CodeLanguageSelect as default };
|
|
@@ -3,7 +3,7 @@ import { ReactEditor } from "../../editor-kernel/react/react-editor.js";
|
|
|
3
3
|
import ReactMarkdownPlugin from "../../plugins/markdown/react/index.js";
|
|
4
4
|
import ReactEditorContent from "../../plugins/common/react/ReactEditorContent.js";
|
|
5
5
|
import ReactPlainText from "../../plugins/common/react/ReactPlainText.js";
|
|
6
|
-
import ReactCollaborationPlugin from "../../plugins/collaboration/react/ReactCollaborationPlugin.js";
|
|
6
|
+
import { ReactCollaborationPlugin } from "../../plugins/collaboration/react/ReactCollaborationPlugin.js";
|
|
7
7
|
import ReactMentionPlugin from "../../plugins/mention/react/ReactMentionPlugin.js";
|
|
8
8
|
import ReactSlashOption from "../../plugins/slash/react/ReactSlashOption.js";
|
|
9
9
|
import ReactSlashPlugin from "../../plugins/slash/react/ReactSlashPlugin.js";
|
|
@@ -3,7 +3,6 @@ import { useEditorState } from "../hooks/useEditorState/index.js";
|
|
|
3
3
|
import { EditorPlugin, EditorProps } from "./type.js";
|
|
4
4
|
import { withProps } from "./utils.js";
|
|
5
5
|
import { ReactNode } from "react";
|
|
6
|
-
|
|
7
6
|
//#region src/react/Editor/index.d.ts
|
|
8
7
|
interface IEditor {
|
|
9
8
|
(props: EditorProps): ReactNode;
|
|
@@ -13,4 +12,4 @@ interface IEditor {
|
|
|
13
12
|
}
|
|
14
13
|
declare const Editor: IEditor;
|
|
15
14
|
//#endregion
|
|
16
|
-
export { Editor };
|
|
15
|
+
export { EditorPlugin, EditorProps, Editor as default, withProps };
|
package/es/react/Editor/index.js
CHANGED
|
@@ -1,10 +1,14 @@
|
|
|
1
1
|
import { IEditor } from "../../types/kernel.js";
|
|
2
|
+
import "../../types/index.js";
|
|
2
3
|
import { EditorCollaborationConfig } from "../../plugins/collaboration/react/type.js";
|
|
4
|
+
import "../../plugins/collaboration/index.js";
|
|
3
5
|
import { ReactEditorContentProps, ReactPlainTextProps } from "../../plugins/common/react/type.js";
|
|
6
|
+
import "../../plugins/common/react/index.js";
|
|
4
7
|
import { ReactMentionPluginProps } from "../../plugins/mention/react/type.js";
|
|
8
|
+
import "../../plugins/mention/react/index.js";
|
|
5
9
|
import { ReactSlashOptionProps } from "../../plugins/slash/react/type.js";
|
|
10
|
+
import "../../plugins/slash/react/index.js";
|
|
6
11
|
import { CSSProperties, FC, ReactNode } from "react";
|
|
7
|
-
|
|
8
12
|
//#region src/react/Editor/type.d.ts
|
|
9
13
|
type EditorPlugin = FC<any> | [FC<any>, Record<string, any>];
|
|
10
14
|
interface MentionOption extends Partial<ReactSlashOptionProps> {
|
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
import
|
|
2
|
-
import * as _$react from "react";
|
|
1
|
+
import _default from "../../locale/index.js";
|
|
3
2
|
import { ReactNode } from "react";
|
|
4
|
-
|
|
5
3
|
//#region src/react/EditorProvider/index.d.ts
|
|
6
4
|
type LocaleType = typeof _default;
|
|
7
5
|
interface EditorProviderConfig {
|
|
@@ -17,10 +15,7 @@ interface EditorProviderProps {
|
|
|
17
15
|
config?: EditorProviderConfig;
|
|
18
16
|
}
|
|
19
17
|
declare const EditorProvider: {
|
|
20
|
-
({
|
|
21
|
-
children,
|
|
22
|
-
config
|
|
23
|
-
}: EditorProviderProps): _$react.JSX.Element;
|
|
18
|
+
({ children, config }: EditorProviderProps): import("react").JSX.Element;
|
|
24
19
|
displayName: string;
|
|
25
20
|
};
|
|
26
21
|
declare const useEditorContent: () => EditorContextValue;
|
|
@@ -5,7 +5,7 @@ import { jsx } from "react/jsx-runtime";
|
|
|
5
5
|
const EditorContext = createContext({ config: {} });
|
|
6
6
|
const EditorProvider = ({ children, config = {} }) => {
|
|
7
7
|
const value = useMemo(() => ({ config }), [config]);
|
|
8
|
-
return /* @__PURE__ */ jsx(EditorContext
|
|
8
|
+
return /* @__PURE__ */ jsx(EditorContext, {
|
|
9
9
|
value,
|
|
10
10
|
children
|
|
11
11
|
});
|
|
@@ -1,2 +1,3 @@
|
|
|
1
1
|
import { ActionItem, CollapseItem, DividerItem, DropdownItem, FloatActionsEvent, FloatActionsItem, FloatActionsProps } from "./type.js";
|
|
2
|
-
import
|
|
2
|
+
import FloatActions from "./FloatActions.js";
|
|
3
|
+
export { type ActionItem, type CollapseItem, type DividerItem, type DropdownItem, type FloatActionsEvent, type FloatActionsItem, type FloatActionsProps, FloatActions as default };
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { FlexboxProps, MenuInfo, MenuItemType, TooltipProps } from "@lobehub/ui";
|
|
2
2
|
import { ReactNode } from "react";
|
|
3
|
-
|
|
4
3
|
//#region src/react/FloatActions/type.d.ts
|
|
5
4
|
type FloatActionsEvent = Pick<MenuInfo, 'key' | 'keyPath' | 'domEvent'>;
|
|
6
5
|
interface ActionItem extends MenuItemType {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { $isRootTextContentEmpty, init_utils } from "../../../plugins/common/utils/index.js";
|
|
2
|
-
import { noop } from "../../../editor-kernel/utils.js";
|
|
2
|
+
import { init_utils as init_utils$1, noop } from "../../../editor-kernel/utils.js";
|
|
3
3
|
import { $createCodeMirrorNode, $isCodeMirrorNode } from "../../../plugins/codemirror-block/node/CodeMirrorNode.js";
|
|
4
4
|
import { $isSelectionInCodeInline } from "../../../plugins/code/node/code.js";
|
|
5
5
|
import { INSERT_CODEINLINE_COMMAND } from "../../../plugins/code/command/index.js";
|
|
@@ -20,6 +20,7 @@ import { $isListNode, INSERT_ORDERED_LIST_COMMAND, INSERT_UNORDERED_LIST_COMMAND
|
|
|
20
20
|
import { $createCodeNode, $isCodeNode } from "@lexical/code-core";
|
|
21
21
|
import { debounce } from "es-toolkit";
|
|
22
22
|
//#region src/react/hooks/useEditorState/index.ts
|
|
23
|
+
init_utils$1();
|
|
23
24
|
init_utils();
|
|
24
25
|
/**
|
|
25
26
|
* Provide toolbar state and toolbar methods
|
|
@@ -45,7 +46,8 @@ function useEditorState(editor) {
|
|
|
45
46
|
const [isSelected, setIsSelected] = useState(false);
|
|
46
47
|
const [blockType, setBlockType] = useState(null);
|
|
47
48
|
const $handleHeadingNode = useCallback((selectedElement) => {
|
|
48
|
-
|
|
49
|
+
const type = $isHeadingNode(selectedElement) ? selectedElement.getTag() : selectedElement.getType();
|
|
50
|
+
setBlockType(type);
|
|
49
51
|
}, [setBlockType]);
|
|
50
52
|
const $updateToolbar = useCallback(() => {
|
|
51
53
|
const selection = $getSelection();
|
|
@@ -77,10 +79,12 @@ function useEditorState(editor) {
|
|
|
77
79
|
if (isLexicalCodeBlock) setCodeblockLang(element.getLanguage());
|
|
78
80
|
else if (isCodeMirrorBlock) setCodeblockLang(element.lang);
|
|
79
81
|
else setCodeblockLang("");
|
|
80
|
-
|
|
82
|
+
const isBlockquote = $isQuoteNode(element) && $isQuoteNode(focusElement) && elementKey === focusElement.getKey();
|
|
83
|
+
setIsInBlockquote(isBlockquote);
|
|
81
84
|
if (elementDOM !== null) if ($isListNode(element)) {
|
|
82
85
|
const parentList = $getNearestNodeOfType(anchorNode, ListNode);
|
|
83
|
-
|
|
86
|
+
const type = parentList ? parentList.getListType() : element.getListType();
|
|
87
|
+
setBlockType(type);
|
|
84
88
|
} else $handleHeadingNode(element);
|
|
85
89
|
} else if (!selection) {
|
|
86
90
|
setIsSelected(false);
|