@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,7 @@
|
|
|
1
1
|
import { IEditorPluginConstructor } from "../../../types/kernel.js";
|
|
2
|
+
import "../../../types/index.js";
|
|
2
3
|
import { DiffNode } from "../node/DiffNode.js";
|
|
3
4
|
import { LexicalEditor } from "lexical";
|
|
4
|
-
|
|
5
5
|
//#region src/plugins/litexml/plugin/index.d.ts
|
|
6
6
|
/**
|
|
7
7
|
* LitexmlPluginOptions - Configuration options for the Litexml plugin
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import LexicalPortalContainer from "../../../../editor-kernel/react/PortalContainer.js";
|
|
1
|
+
import { LexicalPortalContainer } from "../../../../editor-kernel/react/PortalContainer.js";
|
|
2
2
|
import { LITEXML_DIFFNODE_COMMAND } from "../../command/symbols.js";
|
|
3
3
|
import { useTranslation } from "../../../../editor-kernel/react/useTranslation.js";
|
|
4
4
|
import { styles } from "./style.js";
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { IServiceID } from "../../../types/kernel.js";
|
|
2
|
+
import "../../../types/index.js";
|
|
2
3
|
import { LexicalNode } from "lexical";
|
|
3
|
-
|
|
4
4
|
//#region src/plugins/litexml/service/litexml-service.d.ts
|
|
5
5
|
/**
|
|
6
6
|
* XML Reader function type - converts XML element to Lexical node
|
|
7
7
|
*/
|
|
8
|
-
type XMLReaderFunc = (xmlElement:
|
|
8
|
+
type XMLReaderFunc = (xmlElement: any, children: any[]) => any | any[] | false;
|
|
9
9
|
/**
|
|
10
10
|
* XML Writer function type - converts Lexical node to XML string
|
|
11
11
|
*/
|
|
@@ -90,4 +90,4 @@ declare class LitexmlService implements ILitexmlService {
|
|
|
90
90
|
hasXMLWriter(nodeType: string): boolean;
|
|
91
91
|
}
|
|
92
92
|
//#endregion
|
|
93
|
-
export { ILitexmlService, LitexmlService, XMLReaderFunc, XMLReaderRecord, XMLWriterFunc, XMLWriterRecord };
|
|
93
|
+
export { HandleChildrenResult, ILitexmlService, IWriterContext, IXmlNode, LitexmlService, XMLReaderFunc, XMLReaderRecord, XMLWriterFunc, XMLWriterRecord };
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
+
import "../../../types/index.js";
|
|
2
|
+
import "../service/shortcut.js";
|
|
1
3
|
import { HistoryStateEntry } from "@lexical/history";
|
|
2
|
-
import * as _$lexical from "lexical";
|
|
3
4
|
import { LexicalEditor } from "lexical";
|
|
4
|
-
|
|
5
5
|
//#region src/plugins/markdown/command/index.d.ts
|
|
6
|
-
declare const INSERT_MARKDOWN_COMMAND:
|
|
6
|
+
declare const INSERT_MARKDOWN_COMMAND: import("lexical").LexicalCommand<{
|
|
7
7
|
historyState: HistoryStateEntry | null;
|
|
8
8
|
markdown: string;
|
|
9
9
|
}>;
|
|
10
|
-
declare const GET_MARKDOWN_SELECTION_COMMAND:
|
|
10
|
+
declare const GET_MARKDOWN_SELECTION_COMMAND: import("lexical").LexicalCommand<{
|
|
11
11
|
onResult: (startLine: number, endLine: number) => void;
|
|
12
12
|
}>;
|
|
13
13
|
//#endregion
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { IElementNode } from "../../../../editor-kernel/inode/i-element-node.js";
|
|
2
2
|
import { INode } from "../../../../editor-kernel/inode/i-node.js";
|
|
3
3
|
import { ITextNode } from "../../../../editor-kernel/inode/text-node.js";
|
|
4
|
+
import "../../../../editor-kernel/inode/index.js";
|
|
4
5
|
import { PhrasingContent, Root, RootContent } from "../../../../node_modules/.pnpm/@types_mdast@4.0.4/node_modules/@types/mdast/index.js";
|
|
5
|
-
|
|
6
6
|
//#region src/plugins/markdown/data-source/markdown/parse.d.ts
|
|
7
7
|
type MarkdownReadNode = INode | ITextNode | IElementNode;
|
|
8
8
|
type MarkdownNode = Root | RootContent | PhrasingContent;
|
|
9
9
|
type MarkdownReaderFunc<K> = (node: Extract<MarkdownNode, {
|
|
10
10
|
type: K;
|
|
11
11
|
}>, children: MarkdownReadNode[], index: number) => MarkdownReadNode | MarkdownReadNode[] | false;
|
|
12
|
-
type TransformerRecord = { [K in MarkdownNode['type']]?: MarkdownReaderFunc<K> | Array<MarkdownReaderFunc<K
|
|
12
|
+
type TransformerRecord = { [K in MarkdownNode['type']]?: MarkdownReaderFunc<K> | Array<MarkdownReaderFunc<K>>; };
|
|
13
13
|
//#endregion
|
|
14
|
-
export { MarkdownReaderFunc, TransformerRecord };
|
|
14
|
+
export { MarkdownNode, MarkdownReadNode, MarkdownReaderFunc, TransformerRecord };
|
|
@@ -6,7 +6,7 @@ import remarkGfm from "remark-gfm";
|
|
|
6
6
|
import remarkMath from "remark-math";
|
|
7
7
|
//#region src/plugins/markdown/data-source/markdown/parse.ts
|
|
8
8
|
init_helper();
|
|
9
|
-
const selfClosingHtmlTags = new Set([
|
|
9
|
+
const selfClosingHtmlTags = /* @__PURE__ */ new Set([
|
|
10
10
|
"area",
|
|
11
11
|
"base",
|
|
12
12
|
"br",
|
|
@@ -64,7 +64,7 @@ function convertMdastToLexical(node, index, ctx, markdownReaders = {}, parentTyp
|
|
|
64
64
|
if (!markdownReaders[node.type]) return createFallbackRawNode(node, ctx, parentType);
|
|
65
65
|
let children = [];
|
|
66
66
|
if ("children" in node && Array.isArray(node.children)) {
|
|
67
|
-
|
|
67
|
+
const htmlStack = [];
|
|
68
68
|
children = node.children.reduce((ret, child, index) => {
|
|
69
69
|
if (child.type === "html") {
|
|
70
70
|
if (!markdownReaders["html"]) {
|
|
@@ -52,7 +52,7 @@ var MarkdownDataSource = class extends DataSource {
|
|
|
52
52
|
const firstNode = selectedNodes[0];
|
|
53
53
|
const lastNode = selectedNodes[lastIndex];
|
|
54
54
|
const [anchorOffset, focusOffset] = $getCharacterOffsets(selection);
|
|
55
|
-
|
|
55
|
+
const lastElement = [];
|
|
56
56
|
const rootNodes = [];
|
|
57
57
|
for (let i = 0; i < selectedNodes.length; i++) {
|
|
58
58
|
const node = selectedNodes[i];
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { IMarkdownShortCutService, MARKDOWN_READER_LEVEL, MARKDOWN_READER_LEVEL_HIGH, MARKDOWN_READER_LEVEL_NORMAL, MARKDOWN_WRITER_LEVEL_MAX } from "./service/shortcut.js";
|
|
2
2
|
import { GET_MARKDOWN_SELECTION_COMMAND, INSERT_MARKDOWN_COMMAND } from "./command/index.js";
|
|
3
3
|
import { MarkdownPlugin } from "./plugin/index.js";
|
|
4
|
-
import
|
|
4
|
+
import ReactMarkdownPlugin from "./react/index.js";
|
|
5
5
|
import { isPunctuationChar } from "./utils/index.js";
|
|
6
6
|
import { detectCodeLanguage, detectLanguage } from "./utils/detectLanguage.js";
|
|
7
|
-
import { isPureUrl, isValidUrl } from "../../utils/url.js";
|
|
7
|
+
import { isPureUrl, isValidUrl } from "../../utils/url.js";
|
|
8
|
+
export { GET_MARKDOWN_SELECTION_COMMAND, IMarkdownShortCutService, INSERT_MARKDOWN_COMMAND, type MARKDOWN_READER_LEVEL, MARKDOWN_READER_LEVEL_HIGH, MARKDOWN_READER_LEVEL_NORMAL, MARKDOWN_WRITER_LEVEL_MAX, MarkdownPlugin, ReactMarkdownPlugin, detectCodeLanguage, detectLanguage, isPunctuationChar };
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { IEditorPluginConstructor } from "../../../types/kernel.js";
|
|
2
|
+
import "../../../types/index.js";
|
|
2
3
|
//#region src/plugins/markdown/plugin/index.d.ts
|
|
3
4
|
interface MarkdownPluginOptions {
|
|
4
5
|
/**
|
|
@@ -19,4 +20,4 @@ interface MarkdownPluginOptions {
|
|
|
19
20
|
}
|
|
20
21
|
declare const MarkdownPlugin: IEditorPluginConstructor<MarkdownPluginOptions>;
|
|
21
22
|
//#endregion
|
|
22
|
-
export { MarkdownPlugin };
|
|
23
|
+
export { MarkdownPlugin, MarkdownPluginOptions };
|
|
@@ -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
|
});
|
|
@@ -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 };
|