@lobehub/editor 4.22.0 → 4.23.1
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/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/style.js +2 -2
- 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 +13 -13
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { IServiceID } from "../../../types/kernel.js";
|
|
2
2
|
import { IRootNode } from "../../../editor-kernel/inode/root-node.js";
|
|
3
|
+
import "../../../editor-kernel/inode/index.js";
|
|
3
4
|
import { MarkdownReaderFunc, TransformerRecord } from "../data-source/markdown/parse.js";
|
|
4
5
|
import { Transformer } from "./transformers.js";
|
|
5
6
|
import { BaseSelection, ElementNode, LexicalEditor, LexicalNode, TextNode } from "lexical";
|
|
6
|
-
|
|
7
7
|
//#region src/plugins/markdown/service/shortcut.d.ts
|
|
8
8
|
interface IMarkdownWriterContext {
|
|
9
9
|
/**
|
|
@@ -54,4 +54,4 @@ interface IMarkdownShortCutService {
|
|
|
54
54
|
}
|
|
55
55
|
declare const IMarkdownShortCutService: IServiceID<IMarkdownShortCutService>;
|
|
56
56
|
//#endregion
|
|
57
|
-
export { IMarkdownShortCutService, MARKDOWN_READER_LEVEL, MARKDOWN_READER_LEVEL_HIGH, MARKDOWN_READER_LEVEL_NORMAL, MARKDOWN_WRITER_LEVEL_MAX };
|
|
57
|
+
export { IMarkdownShortCutService, IMarkdownWriterContext, MARKDOWN_READER_LEVEL, MARKDOWN_READER_LEVEL_HIGH, MARKDOWN_READER_LEVEL_NORMAL, MARKDOWN_WRITER_LEVEL_MAX };
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { createDebugLogger, init_debug } from "../../../utils/debug.js";
|
|
2
|
-
import { genServiceId } from "../../../editor-kernel/utils.js";
|
|
2
|
+
import { genServiceId, init_utils } from "../../../editor-kernel/utils.js";
|
|
3
3
|
import { parseMarkdownToLexical } from "../data-source/markdown/parse.js";
|
|
4
4
|
import { indexBy, insertIRootNode } from "../utils/index.js";
|
|
5
5
|
import { $runTextFormatTransformers, runElementTransformers, runTextMatchTransformers, testElementTransformers } from "./transformers.js";
|
|
6
6
|
//#region src/plugins/markdown/service/shortcut.ts
|
|
7
|
+
init_utils();
|
|
7
8
|
init_debug();
|
|
8
9
|
const MARKDOWN_WRITER_LEVEL_MAX = 0;
|
|
9
10
|
const MARKDOWN_READER_LEVEL_HIGH = 1;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { ElementNode, LexicalNode, RangeSelection, TextFormatType, TextNode } from "lexical";
|
|
2
|
-
|
|
3
2
|
//#region src/plugins/markdown/service/transformers.d.ts
|
|
4
3
|
type TextFormatTransformer = Readonly<{
|
|
5
4
|
format?: ReadonlyArray<TextFormatType>;
|
|
@@ -51,11 +50,10 @@ type ElementTransformer = {
|
|
|
51
50
|
/**
|
|
52
51
|
* Whether the match is from an import operation (e.g. through `$convertFromMarkdownString`) or not (e.g. through typing in the editor).
|
|
53
52
|
*/
|
|
54
|
-
|
|
55
53
|
isImport: boolean) => boolean | void;
|
|
56
54
|
trigger?: 'enter';
|
|
57
55
|
type: 'element';
|
|
58
56
|
};
|
|
59
57
|
type Transformer = ElementTransformer | TextFormatTransformer | TextMatchTransformer;
|
|
60
58
|
//#endregion
|
|
61
|
-
export { Transformer };
|
|
59
|
+
export { ElementTransformer, TextFormatTransformer, TextMatchTransformer, Transformer };
|
|
@@ -140,4 +140,4 @@ function insertIRootNode(editor, root, selection) {
|
|
|
140
140
|
$insertGeneratedNodes(editor, $generateNodesFromSerializedNodes(root.children), selection);
|
|
141
141
|
}
|
|
142
142
|
//#endregion
|
|
143
|
-
export { $generateNodesFromSerializedNodes, $insertGeneratedNodes, PUNCTUATION_OR_SPACE, canContainTransformableMarkdown, getOpenTagStartIndex, indexBy, insertIRootNode, isEqualSubString, isPunctuationChar };
|
|
143
|
+
export { $addNodeStyle, $generateNodesFromSerializedNodes, $insertGeneratedNodes, CSS_TO_STYLES, PUNCTUATION_OR_SPACE, canContainTransformableMarkdown, getOpenTagStartIndex, getStyleObjectFromRawCSS, indexBy, insertIRootNode, isEqualSubString, isPunctuationChar };
|
|
@@ -1,8 +1,6 @@
|
|
|
1
|
-
import * as _$lexical from "lexical";
|
|
2
1
|
import { LexicalEditor } from "lexical";
|
|
3
|
-
|
|
4
2
|
//#region src/plugins/math/command/index.d.ts
|
|
5
|
-
declare const INSERT_MATH_COMMAND:
|
|
3
|
+
declare const INSERT_MATH_COMMAND: import("lexical").LexicalCommand<{
|
|
6
4
|
code: string;
|
|
7
5
|
}>;
|
|
8
6
|
//#endregion
|
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
import { INSERT_MATH_COMMAND } from "./command/index.js";
|
|
2
2
|
import { MathPlugin } from "./plugin/index.js";
|
|
3
|
-
import { ReactMathPlugin } from "./react/index.js";
|
|
3
|
+
import { ReactMathPlugin } from "./react/index.js";
|
|
4
|
+
export { INSERT_MATH_COMMAND, MathPlugin, ReactMathPlugin };
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { DOMConversionMap, DOMExportOutput, DecoratorNode, EditorConfig, LexicalEditor, LexicalNode, LexicalUpdateJSON, SerializedLexicalNode, Spread } from "lexical";
|
|
2
|
-
|
|
3
2
|
//#region src/plugins/math/node/index.d.ts
|
|
4
3
|
type SerializedMathInlineNode = Spread<{
|
|
5
4
|
code: string;
|
|
@@ -41,4 +40,4 @@ declare class MathBlockNode extends DecoratorNode<unknown> {
|
|
|
41
40
|
decorate(editor: LexicalEditor): unknown;
|
|
42
41
|
}
|
|
43
42
|
//#endregion
|
|
44
|
-
export { MathBlockNode, MathInlineNode };
|
|
43
|
+
export { MathBlockNode, MathInlineNode, SerializedMathInlineNode };
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { getKernelFromEditor } from "../../../editor-kernel/utils.js";
|
|
1
|
+
import { getKernelFromEditor, init_utils } from "../../../editor-kernel/utils.js";
|
|
2
2
|
import { $applyNodeReplacement, DecoratorNode } from "lexical";
|
|
3
3
|
import { addClassNamesToElement } from "@lexical/utils";
|
|
4
4
|
//#region src/plugins/math/node/index.ts
|
|
5
|
+
init_utils();
|
|
5
6
|
var MathInlineNode = class MathInlineNode extends DecoratorNode {
|
|
6
7
|
static getType() {
|
|
7
8
|
return "math";
|
|
@@ -158,4 +159,4 @@ function $isMathNode(node) {
|
|
|
158
159
|
return node instanceof MathInlineNode || node instanceof MathBlockNode;
|
|
159
160
|
}
|
|
160
161
|
//#endregion
|
|
161
|
-
export { $createMathBlockNode, $createMathInlineNode, $isMathNode, MathBlockNode, MathInlineNode };
|
|
162
|
+
export { $convertMathBlockElement, $convertMathInlineElement, $createMathBlockNode, $createMathInlineNode, $isMathNode, MathBlockNode, MathInlineNode };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { IEditorPluginConstructor } from "../../../types/kernel.js";
|
|
2
|
+
import "../../../types/index.js";
|
|
2
3
|
import { MathBlockNode, MathInlineNode } from "../node/index.js";
|
|
3
4
|
import { LexicalEditor } from "lexical";
|
|
4
|
-
|
|
5
5
|
//#region src/plugins/math/plugin/index.d.ts
|
|
6
6
|
interface MathPluginOptions {
|
|
7
7
|
decorator?: (node: MathInlineNode | MathBlockNode, editor: LexicalEditor) => unknown;
|
|
@@ -12,4 +12,4 @@ interface MathPluginOptions {
|
|
|
12
12
|
}
|
|
13
13
|
declare const MathPlugin: IEditorPluginConstructor<MathPluginOptions>;
|
|
14
14
|
//#endregion
|
|
15
|
-
export { MathPlugin };
|
|
15
|
+
export { MathPlugin, MathPluginOptions };
|
|
@@ -31,7 +31,8 @@ const MathEditorContent = memo(({ focusRef, mathNode, onArrowLeft, onArrowRight,
|
|
|
31
31
|
setLatexError("");
|
|
32
32
|
onValidationChange?.(true);
|
|
33
33
|
} catch (error) {
|
|
34
|
-
|
|
34
|
+
const errorMessage = error instanceof Error ? error.message : "LaTeX Parse Error";
|
|
35
|
+
setLatexError(errorMessage);
|
|
35
36
|
onValidationChange?.(false);
|
|
36
37
|
}
|
|
37
38
|
}, 50);
|
|
@@ -7,7 +7,7 @@ import { useCallback, useEffect, useRef, useState } from "react";
|
|
|
7
7
|
import { jsx } from "react/jsx-runtime";
|
|
8
8
|
import { $getSelection, $isNodeSelection } from "lexical";
|
|
9
9
|
import { addClassNamesToElement, removeClassNamesFromElement } from "@lexical/utils";
|
|
10
|
-
import
|
|
10
|
+
import Katex from "katex";
|
|
11
11
|
//#region src/plugins/math/react/components/MathInline.tsx
|
|
12
12
|
init_debug();
|
|
13
13
|
const logger = createDebugLogger("plugin", "math");
|
|
@@ -17,7 +17,7 @@ const MathInline = ({ editor, node, className }) => {
|
|
|
17
17
|
const [isEditing, setIsEditing] = useState(false);
|
|
18
18
|
const isMathBlock = node instanceof MathBlockNode;
|
|
19
19
|
useEffect(() => {
|
|
20
|
-
if (ref.current && node.code)
|
|
20
|
+
if (ref.current && node.code) Katex.render(node.code, ref.current, {
|
|
21
21
|
displayMode: node instanceof MathBlockNode,
|
|
22
22
|
throwOnError: false
|
|
23
23
|
});
|
|
@@ -14,12 +14,12 @@ const styles = createStaticStyles(({ css, cssVar }) => {
|
|
|
14
14
|
overflow: auto hidden;
|
|
15
15
|
padding: 3px;
|
|
16
16
|
|
|
17
|
-
.base {
|
|
17
|
+
.katex-base {
|
|
18
18
|
margin-block: 0;
|
|
19
19
|
margin-inline: auto;
|
|
20
20
|
}
|
|
21
21
|
|
|
22
|
-
.tag {
|
|
22
|
+
.katex-tag {
|
|
23
23
|
position: relative !important;
|
|
24
24
|
display: inline-block;
|
|
25
25
|
padding-inline-start: 0.5rem;
|
|
@@ -1,8 +1,6 @@
|
|
|
1
|
-
import * as _$lexical from "lexical";
|
|
2
1
|
import { LexicalEditor } from "lexical";
|
|
3
|
-
|
|
4
2
|
//#region src/plugins/mention/command/index.d.ts
|
|
5
|
-
declare const INSERT_MENTION_COMMAND:
|
|
3
|
+
declare const INSERT_MENTION_COMMAND: import("lexical").LexicalCommand<{
|
|
6
4
|
label: string;
|
|
7
5
|
metadata?: Record<string, unknown>;
|
|
8
6
|
}>;
|
|
@@ -2,4 +2,6 @@ import { INSERT_MENTION_COMMAND } from "./command/index.js";
|
|
|
2
2
|
import { SerializedMentionNode } from "./node/MentionNode.js";
|
|
3
3
|
import { MentionPlugin, MentionPluginOptions } from "./plugin/index.js";
|
|
4
4
|
import { ReactMentionPluginProps } from "./react/type.js";
|
|
5
|
-
import
|
|
5
|
+
import ReactMentionPlugin from "./react/ReactMentionPlugin.js";
|
|
6
|
+
import "./react/index.js";
|
|
7
|
+
export { INSERT_MENTION_COMMAND, MentionPlugin, MentionPluginOptions, ReactMentionPlugin, type ReactMentionPluginProps, type SerializedMentionNode };
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { DOMConversionMap, DOMExportOutput, DecoratorNode, EditorConfig, LexicalEditor, LexicalNode, LexicalUpdateJSON, SerializedLexicalNode, Spread } from "lexical";
|
|
2
|
-
|
|
3
2
|
//#region src/plugins/mention/node/MentionNode.d.ts
|
|
4
3
|
type SerializedMentionNode = Spread<{
|
|
5
4
|
label?: string;
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { IEditorPluginConstructor } from "../../../types/kernel.js";
|
|
2
|
+
import "../../../types/index.js";
|
|
2
3
|
import { INode } from "../../../editor-kernel/inode/i-node.js";
|
|
4
|
+
import "../../../editor-kernel/inode/index.js";
|
|
3
5
|
import { Html } from "../../../node_modules/.pnpm/@types_mdast@4.0.4/node_modules/@types/mdast/index.js";
|
|
4
6
|
import { MentionNode, SerializedMentionNode } from "../node/MentionNode.js";
|
|
5
7
|
import { LexicalEditor } from "lexical";
|
|
6
|
-
|
|
7
8
|
//#region src/plugins/mention/plugin/index.d.ts
|
|
8
9
|
interface MentionPluginOptions {
|
|
9
10
|
decorator?: (node: MentionNode, editor: LexicalEditor) => any;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { ReactMentionPluginProps } from "./type.js";
|
|
2
2
|
import { FC } from "react";
|
|
3
|
-
|
|
4
3
|
//#region src/plugins/mention/react/ReactMentionPlugin.d.ts
|
|
5
4
|
declare const ReactMentionPlugin: FC<ReactMentionPluginProps>;
|
|
6
5
|
//#endregion
|
|
7
|
-
export { ReactMentionPlugin };
|
|
6
|
+
export { ReactMentionPlugin as default };
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { ISlashDividerOption, ISlashMenuOption, ISlashOption, ISlashSectionOption, ISlashService, SlashOptions, flattenSlashOptions, isSlashDividerOption, isSlashMenuOption, isSlashSectionOption } from "./service/i-slash-service.js";
|
|
2
2
|
import { ITriggerContext, SlashPlugin, SlashPluginOptions } from "./plugin/index.js";
|
|
3
3
|
import { MenuRenderProps, ReactSlashOptionProps, ReactSlashPluginProps, SlashMenuProps } from "./react/type.js";
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
4
|
+
import SlashMenu from "./react/components/SlashMenu.js";
|
|
5
|
+
import ReactSlashOption from "./react/ReactSlashOption.js";
|
|
6
|
+
import ReactSlashPlugin from "./react/ReactSlashPlugin.js";
|
|
7
|
+
import "./react/index.js";
|
|
8
|
+
export { type ISlashDividerOption, type ISlashMenuOption, type ISlashOption, type ISlashSectionOption, type ISlashService, ITriggerContext, type MenuRenderProps, ReactSlashOption, type ReactSlashOptionProps, ReactSlashPlugin, type ReactSlashPluginProps, SlashMenu, type SlashMenuProps, type SlashOptions, SlashPlugin, SlashPluginOptions, flattenSlashOptions, isSlashDividerOption, isSlashMenuOption, isSlashSectionOption };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { IEditorPluginConstructor } from "../../../types/kernel.js";
|
|
2
|
+
import "../../../types/index.js";
|
|
2
3
|
import { ISlashOption, SlashOptions } from "../service/i-slash-service.js";
|
|
3
|
-
|
|
4
4
|
//#region src/plugins/slash/plugin/index.d.ts
|
|
5
5
|
interface ITriggerContext {
|
|
6
6
|
getRect: () => DOMRect;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { ReactSlashOptionProps } from "./type.js";
|
|
2
2
|
import { FC } from "react";
|
|
3
|
-
|
|
4
3
|
//#region src/plugins/slash/react/ReactSlashOption.d.ts
|
|
5
4
|
declare const ReactSlashOption: FC<ReactSlashOptionProps>;
|
|
6
5
|
//#endregion
|
|
7
|
-
export { ReactSlashOption };
|
|
6
|
+
export { ReactSlashOption as default };
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { ReactSlashPluginProps } from "./type.js";
|
|
2
2
|
import { FC } from "react";
|
|
3
|
-
|
|
4
3
|
//#region src/plugins/slash/react/ReactSlashPlugin.d.ts
|
|
5
4
|
declare const ReactSlashPlugin: FC<ReactSlashPluginProps>;
|
|
6
5
|
//#endregion
|
|
7
|
-
export { ReactSlashPlugin };
|
|
6
|
+
export { ReactSlashPlugin as default };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { noop } from "../../../editor-kernel/utils.js";
|
|
2
|
+
import { init_utils, noop } from "../../../editor-kernel/utils.js";
|
|
3
3
|
import { useLexicalComposerContext } from "../../../editor-kernel/react/react-context.js";
|
|
4
4
|
import { useLexicalEditor } from "../../../editor-kernel/react/useLexicalEditor.js";
|
|
5
5
|
import { $splitNodeContainingQuery } from "../utils/utils.js";
|
|
@@ -12,6 +12,7 @@ import { jsx } from "react/jsx-runtime";
|
|
|
12
12
|
import { COMMAND_PRIORITY_CRITICAL, KEY_ARROW_DOWN_COMMAND, KEY_ARROW_UP_COMMAND, KEY_DOWN_COMMAND, KEY_ESCAPE_COMMAND, KEY_TAB_COMMAND } from "lexical";
|
|
13
13
|
import { mergeRegister } from "@lexical/utils";
|
|
14
14
|
//#region src/plugins/slash/react/ReactSlashPlugin.tsx
|
|
15
|
+
init_utils();
|
|
15
16
|
const ReactSlashPlugin = ({ children, anchorClassName, getPopupContainer, placement }) => {
|
|
16
17
|
const [editor] = useLexicalComposerContext();
|
|
17
18
|
const [isOpen, setIsOpen] = useState(false);
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { SlashMenuProps } from "../type.js";
|
|
2
2
|
import { FC } from "react";
|
|
3
|
-
|
|
4
3
|
//#region src/plugins/slash/react/components/SlashMenu.d.ts
|
|
5
4
|
/**
|
|
6
5
|
* SlashMenu component - Only responsible for rendering the menu UI
|
|
@@ -8,4 +7,4 @@ import { FC } from "react";
|
|
|
8
7
|
*/
|
|
9
8
|
declare const SlashMenu: FC<SlashMenuProps>;
|
|
10
9
|
//#endregion
|
|
11
|
-
export { SlashMenu };
|
|
10
|
+
export { SlashMenu as default };
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { MenuRenderProps, ReactSlashOptionProps, ReactSlashPluginProps, SlashMenuProps } from "./type.js";
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
2
|
+
import SlashMenu from "./components/SlashMenu.js";
|
|
3
|
+
import ReactSlashOption from "./ReactSlashOption.js";
|
|
4
|
+
import ReactSlashPlugin from "./ReactSlashPlugin.js";
|
|
5
|
+
export { type MenuRenderProps, ReactSlashOption, type ReactSlashOptionProps, ReactSlashPlugin, type ReactSlashPluginProps, SlashMenu, type SlashMenuProps };
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { IEditor } from "../../../types/kernel.js";
|
|
2
|
+
import "../../../types/index.js";
|
|
2
3
|
import { ISlashMenuOption, ISlashOption, SlashOptions } from "../service/i-slash-service.js";
|
|
4
|
+
import "../index.js";
|
|
3
5
|
import { FC, ReactElement } from "react";
|
|
4
6
|
import { IFuseOptions } from "fuse.js";
|
|
5
|
-
|
|
6
7
|
//#region src/plugins/slash/react/type.d.ts
|
|
7
8
|
interface ReactSlashOptionProps {
|
|
8
9
|
/**
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { IEditor, IServiceID } from "../../../types/kernel.js";
|
|
2
|
+
import "../../../types/index.js";
|
|
3
|
+
import "../utils/utils.js";
|
|
2
4
|
import { DropdownMenuItemType } from "@lobehub/ui";
|
|
3
5
|
import { ReactNode } from "react";
|
|
4
6
|
import Fuse, { IFuseOptions } from "fuse.js";
|
|
5
|
-
|
|
6
7
|
//#region src/plugins/slash/service/i-slash-service.d.ts
|
|
7
8
|
type ISlashDividerOption = {
|
|
8
9
|
type: 'divider';
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { createDebugLogger, init_debug } from "../../../utils/debug.js";
|
|
2
|
-
import { genServiceId } from "../../../editor-kernel/utils.js";
|
|
2
|
+
import { genServiceId, init_utils } from "../../../editor-kernel/utils.js";
|
|
3
3
|
import { getBasicTypeaheadTriggerMatch } from "../utils/utils.js";
|
|
4
4
|
import Fuse from "fuse.js";
|
|
5
5
|
//#region src/plugins/slash/service/i-slash-service.ts
|
|
6
|
+
init_utils();
|
|
6
7
|
init_debug();
|
|
7
8
|
const isSlashDividerOption = (option) => "type" in option && option.type === "divider";
|
|
8
9
|
const isSlashSectionOption = (option) => "type" in option && option.type === "section";
|
|
@@ -94,4 +94,4 @@ function $splitNodeContainingQuery(match) {
|
|
|
94
94
|
return newNode;
|
|
95
95
|
}
|
|
96
96
|
//#endregion
|
|
97
|
-
export { $splitNodeContainingQuery, getBasicTypeaheadTriggerMatch, getQueryTextForSearch, tryToPositionRange };
|
|
97
|
+
export { $splitNodeContainingQuery, PUNCTUATION, getBasicTypeaheadTriggerMatch, getQueryTextForSearch, getTextUpToAnchor, tryToPositionRange };
|
|
@@ -1,26 +1,24 @@
|
|
|
1
1
|
import { InsertTableCommandPayloadHeaders } from "@lexical/table";
|
|
2
|
-
import * as _$lexical from "lexical";
|
|
3
2
|
import { LexicalEditor } from "lexical";
|
|
4
|
-
|
|
5
3
|
//#region src/plugins/table/command/index.d.ts
|
|
6
|
-
declare const INSERT_TABLE_COMMAND:
|
|
4
|
+
declare const INSERT_TABLE_COMMAND: import("lexical").LexicalCommand<{
|
|
7
5
|
columns: string;
|
|
8
6
|
includeHeaders?: InsertTableCommandPayloadHeaders;
|
|
9
7
|
rows: string;
|
|
10
8
|
}>;
|
|
11
|
-
declare const SELECT_TABLE_COMMAND:
|
|
9
|
+
declare const SELECT_TABLE_COMMAND: import("lexical").LexicalCommand<{
|
|
12
10
|
anchorIndex?: number;
|
|
13
11
|
columnIndex?: number;
|
|
14
12
|
extend?: boolean;
|
|
15
13
|
rowIndex?: number;
|
|
16
14
|
table: string;
|
|
17
15
|
}>;
|
|
18
|
-
declare const INSERT_TABLE_COLUMN_COMMAND:
|
|
16
|
+
declare const INSERT_TABLE_COLUMN_COMMAND: import("lexical").LexicalCommand<{
|
|
19
17
|
columnIndex: number;
|
|
20
18
|
insertAfter?: boolean;
|
|
21
19
|
table: string;
|
|
22
20
|
}>;
|
|
23
|
-
declare const INSERT_TABLE_ROW_COMMAND:
|
|
21
|
+
declare const INSERT_TABLE_ROW_COMMAND: import("lexical").LexicalCommand<{
|
|
24
22
|
insertAfter?: boolean;
|
|
25
23
|
rowIndex: number;
|
|
26
24
|
table: string;
|
|
@@ -44,7 +44,7 @@ const $selectTableRows = (tableNode, from, to) => {
|
|
|
44
44
|
const firstRow = tableMap[from];
|
|
45
45
|
const lastRow = tableMap[to];
|
|
46
46
|
const firstCell = firstRow?.[0]?.cell;
|
|
47
|
-
const lastCell = lastRow?.
|
|
47
|
+
const lastCell = lastRow?.at(-1)?.cell;
|
|
48
48
|
if (!firstCell || !lastCell) return false;
|
|
49
49
|
const tableSelection = $createTableSelection();
|
|
50
50
|
tableSelection.set(tableNode.getKey(), firstCell.getKey(), lastCell.getKey());
|
|
@@ -116,7 +116,7 @@ function registerTableCommand(editor) {
|
|
|
116
116
|
const [tableMap] = $computeTableMapSkipCellCheck(tableNode, null, null);
|
|
117
117
|
const row = tableMap[rowIndex];
|
|
118
118
|
const firstCell = row?.[0]?.cell;
|
|
119
|
-
const lastCell = row?.
|
|
119
|
+
const lastCell = row?.at(-1)?.cell;
|
|
120
120
|
if (!firstCell || !lastCell) return false;
|
|
121
121
|
const tableSelection = $createTableSelection();
|
|
122
122
|
tableSelection.set(table, firstCell.getKey(), lastCell.getKey());
|
|
@@ -206,7 +206,7 @@ function registerTableCommand(editor) {
|
|
|
206
206
|
const firstRow = tableMap[from];
|
|
207
207
|
const lastRow = tableMap[to];
|
|
208
208
|
const firstCell = firstRow?.[0]?.cell;
|
|
209
|
-
const lastCell = lastRow?.
|
|
209
|
+
const lastCell = lastRow?.at(-1)?.cell;
|
|
210
210
|
if (!firstCell || !lastCell) return false;
|
|
211
211
|
tableSelection.set(table, firstCell.getKey(), lastCell.getKey());
|
|
212
212
|
$setSelection(tableSelection);
|
|
@@ -227,7 +227,7 @@ function registerTableCommand(editor) {
|
|
|
227
227
|
const firstRow = tableMap[0];
|
|
228
228
|
const lastRow = tableMap.at(-1);
|
|
229
229
|
const firstCell = firstRow?.[0]?.cell;
|
|
230
|
-
const lastCell = lastRow?.
|
|
230
|
+
const lastCell = lastRow?.at(-1)?.cell;
|
|
231
231
|
if (!firstCell || !lastCell) return false;
|
|
232
232
|
tableSelection.set(table, firstCell.getKey(), lastCell.getKey());
|
|
233
233
|
$setSelection(tableSelection);
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { INSERT_TABLE_COLUMN_COMMAND, INSERT_TABLE_COMMAND, INSERT_TABLE_ROW_COMMAND, SELECT_TABLE_COMMAND } from "./command/index.js";
|
|
2
2
|
import { TablePlugin, TablePluginOptions } from "./plugin/index.js";
|
|
3
3
|
import { ReactTablePlugin } from "./react/index.js";
|
|
4
|
-
import { ITableControllerMenuActionItem, ITableControllerMenuItem, ITableControllerMenuRenderContext, ITableControllerMenuSeparatorItem, ITableControllerMenuService, TableControllerMenuAxis, TableControllerMenuService } from "./service/i-table-controller-menu-service.js";
|
|
4
|
+
import { ITableControllerMenuActionItem, ITableControllerMenuItem, ITableControllerMenuRenderContext, ITableControllerMenuSeparatorItem, ITableControllerMenuService, TableControllerMenuAxis, TableControllerMenuService } from "./service/i-table-controller-menu-service.js";
|
|
5
|
+
import "./service/index.js";
|
|
6
|
+
export { INSERT_TABLE_COLUMN_COMMAND, INSERT_TABLE_COMMAND, INSERT_TABLE_ROW_COMMAND, ITableControllerMenuActionItem, ITableControllerMenuItem, ITableControllerMenuRenderContext, ITableControllerMenuSeparatorItem, ITableControllerMenuService, ReactTablePlugin, SELECT_TABLE_COMMAND, TableControllerMenuAxis, TableControllerMenuService, TablePlugin, TablePluginOptions };
|
|
@@ -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";
|