@lobehub/editor 4.5.0 → 4.6.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/es/ReactSlashPlugin-DURF_w1Z.js +22911 -0
- package/es/index-BfKEHYDe.d.ts +889 -0
- package/es/index.d.ts +2826 -32
- package/es/index.js +7587 -65
- package/es/react.d.ts +335 -0
- package/es/react.js +1573 -0
- package/es/renderer.d.ts +110 -0
- package/es/renderer.js +1254 -0
- package/es/style-CFkese2R.js +999 -0
- package/es/style-Ub1LiKko.js +3005 -0
- package/package.json +38 -27
- package/es/common/canUseDOM.d.ts +0 -8
- package/es/common/canUseDOM.js +0 -9
- package/es/common/sys.d.ts +0 -19
- package/es/common/sys.js +0 -35
- package/es/const/hotkey.d.ts +0 -3
- package/es/const/hotkey.js +0 -63
- package/es/editor-kernel/data-source.d.ts +0 -11
- package/es/editor-kernel/data-source.js +0 -30
- package/es/editor-kernel/event.d.ts +0 -3
- package/es/editor-kernel/event.js +0 -11
- package/es/editor-kernel/index.d.ts +0 -12
- package/es/editor-kernel/index.js +0 -16
- package/es/editor-kernel/inode/helper.d.ts +0 -17
- package/es/editor-kernel/inode/helper.js +0 -89
- package/es/editor-kernel/inode/i-element-node.d.ts +0 -2
- package/es/editor-kernel/inode/i-element-node.js +0 -1
- package/es/editor-kernel/inode/i-node.d.ts +0 -2
- package/es/editor-kernel/inode/i-node.js +0 -1
- package/es/editor-kernel/inode/index.d.ts +0 -5
- package/es/editor-kernel/inode/index.js +0 -5
- package/es/editor-kernel/inode/paragraph-node.d.ts +0 -6
- package/es/editor-kernel/inode/paragraph-node.js +0 -1
- package/es/editor-kernel/inode/root-node.d.ts +0 -5
- package/es/editor-kernel/inode/root-node.js +0 -1
- package/es/editor-kernel/inode/text-node.d.ts +0 -5
- package/es/editor-kernel/inode/text-node.js +0 -1
- package/es/editor-kernel/kernel.d.ts +0 -107
- package/es/editor-kernel/kernel.js +0 -875
- package/es/editor-kernel/lexical/Lexical.dev.js +0 -3052
- package/es/editor-kernel/lexical/Lexical.dev.mjs +0 -15369
- package/es/editor-kernel/lexical/Lexical.js +0 -7634
- package/es/editor-kernel/lexical/Lexical.mjs +0 -7258
- package/es/editor-kernel/lexical/LexicalCommands.d.ts +0 -175
- package/es/editor-kernel/lexical/LexicalConstants.d.ts +0 -54
- package/es/editor-kernel/lexical/LexicalEditor.d.ts +0 -672
- package/es/editor-kernel/lexical/LexicalEditorState.d.ts +0 -39
- package/es/editor-kernel/lexical/LexicalEvents.d.ts +0 -22
- package/es/editor-kernel/lexical/LexicalGC.d.ts +0 -23
- package/es/editor-kernel/lexical/LexicalMutations.d.ts +0 -12
- package/es/editor-kernel/lexical/LexicalNode.d.ts +0 -689
- package/es/editor-kernel/lexical/LexicalNodeState.d.ts +0 -569
- package/es/editor-kernel/lexical/LexicalNormalization.d.ts +0 -11
- package/es/editor-kernel/lexical/LexicalReconciler.d.ts +0 -28
- package/es/editor-kernel/lexical/LexicalSelection.d.ts +0 -368
- package/es/editor-kernel/lexical/LexicalUpdateTags.d.ts +0 -67
- package/es/editor-kernel/lexical/LexicalUpdates.d.ts +0 -72
- package/es/editor-kernel/lexical/LexicalUtils.d.ts +0 -492
- package/es/editor-kernel/lexical/caret/LexicalCaret.d.ts +0 -635
- package/es/editor-kernel/lexical/caret/LexicalCaretUtils.d.ts +0 -224
- package/es/editor-kernel/lexical/extension-core/defineExtension.d.ts +0 -126
- package/es/editor-kernel/lexical/extension-core/index.d.ts +0 -38
- package/es/editor-kernel/lexical/extension-core/internal.d.ts +0 -32
- package/es/editor-kernel/lexical/extension-core/safeCast.d.ts +0 -15
- package/es/editor-kernel/lexical/extension-core/shallowMergeConfig.d.ts +0 -20
- package/es/editor-kernel/lexical/extension-core/types.d.ts +0 -371
- package/es/editor-kernel/lexical/index.d.ts +0 -368
- package/es/editor-kernel/lexical/nodes/ArtificialNode.d.ts +0 -16
- package/es/editor-kernel/lexical/nodes/LexicalDecoratorNode.d.ts +0 -32
- package/es/editor-kernel/lexical/nodes/LexicalElementNode.d.ts +0 -235
- package/es/editor-kernel/lexical/nodes/LexicalLineBreakNode.d.ts +0 -30
- package/es/editor-kernel/lexical/nodes/LexicalParagraphNode.d.ts +0 -39
- package/es/editor-kernel/lexical/nodes/LexicalRootNode.d.ts +0 -35
- package/es/editor-kernel/lexical/nodes/LexicalTabNode.d.ts +0 -30
- package/es/editor-kernel/lexical/nodes/LexicalTextNode.d.ts +0 -311
- package/es/editor-kernel/plugin.d.ts +0 -21
- package/es/editor-kernel/plugin.js +0 -90
- package/es/editor-kernel/react/LexicalErrorBoundary.d.ts +0 -13
- package/es/editor-kernel/react/LexicalErrorBoundary.js +0 -26
- package/es/editor-kernel/react/PortalAnchor.d.ts +0 -6
- package/es/editor-kernel/react/PortalAnchor.js +0 -12
- package/es/editor-kernel/react/PortalContainer.d.ts +0 -11
- package/es/editor-kernel/react/PortalContainer.js +0 -32
- package/es/editor-kernel/react/index.d.ts +0 -5
- package/es/editor-kernel/react/index.js +0 -5
- package/es/editor-kernel/react/react-context.d.ts +0 -10
- package/es/editor-kernel/react/react-context.js +0 -25
- package/es/editor-kernel/react/react-editor.d.ts +0 -15
- package/es/editor-kernel/react/react-editor.js +0 -52
- package/es/editor-kernel/react/useAnchor.d.ts +0 -1
- package/es/editor-kernel/react/useAnchor.js +0 -27
- package/es/editor-kernel/react/useDecorators.d.ts +0 -9
- package/es/editor-kernel/react/useDecorators.js +0 -80
- package/es/editor-kernel/react/useEditable.d.ts +0 -3
- package/es/editor-kernel/react/useEditable.js +0 -37
- package/es/editor-kernel/react/useLexicalEditor.d.ts +0 -2
- package/es/editor-kernel/react/useLexicalEditor.js +0 -31
- package/es/editor-kernel/react/useLexicalNodeSelection.d.ts +0 -17
- package/es/editor-kernel/react/useLexicalNodeSelection.js +0 -120
- package/es/editor-kernel/react/useTranslation.d.ts +0 -3
- package/es/editor-kernel/react/useTranslation.js +0 -19
- package/es/editor-kernel/types.d.ts +0 -0
- package/es/editor-kernel/types.js +0 -0
- package/es/editor-kernel/utils.d.ts +0 -41
- package/es/editor-kernel/utils.js +0 -167
- package/es/global.d.ts +0 -5
- package/es/locale/index.d.ts +0 -57
- package/es/locale/index.js +0 -56
- package/es/plugins/auto-complete/index.d.ts +0 -2
- package/es/plugins/auto-complete/index.js +0 -2
- package/es/plugins/auto-complete/node/placeholderNode.d.ts +0 -30
- package/es/plugins/auto-complete/node/placeholderNode.js +0 -171
- package/es/plugins/auto-complete/plugin/index.d.ts +0 -17
- package/es/plugins/auto-complete/plugin/index.js +0 -400
- package/es/plugins/auto-complete/react/ReactAutoCompletePlugin.d.ts +0 -4
- package/es/plugins/auto-complete/react/ReactAutoCompletePlugin.js +0 -33
- package/es/plugins/auto-complete/react/index.d.ts +0 -1
- package/es/plugins/auto-complete/react/index.js +0 -1
- package/es/plugins/auto-complete/react/style.d.ts +0 -4
- package/es/plugins/auto-complete/react/style.js +0 -10
- package/es/plugins/auto-complete/react/type.d.ts +0 -11
- package/es/plugins/auto-complete/react/type.js +0 -1
- package/es/plugins/code/command/index.d.ts +0 -3
- package/es/plugins/code/command/index.js +0 -48
- package/es/plugins/code/index.d.ts +0 -3
- package/es/plugins/code/index.js +0 -3
- package/es/plugins/code/node/code.d.ts +0 -21
- package/es/plugins/code/node/code.js +0 -167
- package/es/plugins/code/plugin/index.d.ts +0 -6
- package/es/plugins/code/plugin/index.js +0 -112
- package/es/plugins/code/plugin/registry.d.ts +0 -6
- package/es/plugins/code/plugin/registry.js +0 -59
- package/es/plugins/code/react/CodeReactPlugin.d.ts +0 -4
- package/es/plugins/code/react/CodeReactPlugin.js +0 -32
- package/es/plugins/code/react/index.d.ts +0 -1
- package/es/plugins/code/react/index.js +0 -1
- package/es/plugins/code/react/style.d.ts +0 -3
- package/es/plugins/code/react/style.js +0 -10
- package/es/plugins/code/react/type.d.ts +0 -4
- package/es/plugins/code/react/type.js +0 -1
- package/es/plugins/codeblock/command/index.d.ts +0 -17
- package/es/plugins/codeblock/command/index.js +0 -49
- package/es/plugins/codeblock/index.d.ts +0 -4
- package/es/plugins/codeblock/index.js +0 -4
- package/es/plugins/codeblock/plugin/CodeHighlighterShiki.d.ts +0 -25
- package/es/plugins/codeblock/plugin/CodeHighlighterShiki.js +0 -736
- package/es/plugins/codeblock/plugin/FacadeShiki.d.ts +0 -53
- package/es/plugins/codeblock/plugin/FacadeShiki.js +0 -380
- package/es/plugins/codeblock/plugin/index.d.ts +0 -13
- package/es/plugins/codeblock/plugin/index.js +0 -229
- package/es/plugins/codeblock/plugin/invariant.d.ts +0 -8
- package/es/plugins/codeblock/plugin/invariant.js +0 -17
- package/es/plugins/codeblock/react/ReactCodeblockPlugin.d.ts +0 -4
- package/es/plugins/codeblock/react/ReactCodeblockPlugin.js +0 -34
- package/es/plugins/codeblock/react/index.d.ts +0 -2
- package/es/plugins/codeblock/react/index.js +0 -1
- package/es/plugins/codeblock/react/style.d.ts +0 -4
- package/es/plugins/codeblock/react/style.js +0 -11
- package/es/plugins/codeblock/react/type.d.ts +0 -5
- package/es/plugins/codeblock/react/type.js +0 -1
- package/es/plugins/codeblock/utils/language.d.ts +0 -1
- package/es/plugins/codeblock/utils/language.js +0 -12
- package/es/plugins/codemirror-block/command/index.d.ts +0 -9
- package/es/plugins/codemirror-block/command/index.js +0 -92
- package/es/plugins/codemirror-block/index.d.ts +0 -3
- package/es/plugins/codemirror-block/index.js +0 -7
- package/es/plugins/codemirror-block/lib/index.d.ts +0 -63
- package/es/plugins/codemirror-block/lib/index.js +0 -146
- package/es/plugins/codemirror-block/lib/mode.d.ts +0 -25
- package/es/plugins/codemirror-block/lib/mode.js +0 -416
- package/es/plugins/codemirror-block/node/CodeMirrorNode.d.ts +0 -46
- package/es/plugins/codemirror-block/node/CodeMirrorNode.js +0 -343
- package/es/plugins/codemirror-block/plugin/index.d.ts +0 -8
- package/es/plugins/codemirror-block/plugin/index.js +0 -113
- package/es/plugins/codemirror-block/react/CodemirrorNode.d.ts +0 -10
- package/es/plugins/codemirror-block/react/CodemirrorNode.js +0 -345
- package/es/plugins/codemirror-block/react/ReactCodemirrorNode.d.ts +0 -4
- package/es/plugins/codemirror-block/react/ReactCodemirrorNode.js +0 -34
- package/es/plugins/codemirror-block/react/components/CopyButton.d.ts +0 -5
- package/es/plugins/codemirror-block/react/components/CopyButton.js +0 -35
- package/es/plugins/codemirror-block/react/components/LanguageSelect.d.ts +0 -8
- package/es/plugins/codemirror-block/react/components/LanguageSelect.js +0 -77
- package/es/plugins/codemirror-block/react/components/MoreOptions.d.ts +0 -16
- package/es/plugins/codemirror-block/react/components/MoreOptions.js +0 -79
- package/es/plugins/codemirror-block/react/components/Toolbar.d.ts +0 -16
- package/es/plugins/codemirror-block/react/components/Toolbar.js +0 -56
- package/es/plugins/codemirror-block/react/components/style.d.ts +0 -3
- package/es/plugins/codemirror-block/react/components/style.js +0 -9
- package/es/plugins/codemirror-block/react/index.d.ts +0 -1
- package/es/plugins/codemirror-block/react/index.js +0 -1
- package/es/plugins/codemirror-block/react/style.d.ts +0 -1
- package/es/plugins/codemirror-block/react/style.js +0 -8
- package/es/plugins/codemirror-block/react/theme.d.ts +0 -133
- package/es/plugins/codemirror-block/react/theme.js +0 -158
- package/es/plugins/codemirror-block/react/type.d.ts +0 -3
- package/es/plugins/codemirror-block/react/type.js +0 -1
- package/es/plugins/common/command/index.d.ts +0 -7
- package/es/plugins/common/command/index.js +0 -31
- package/es/plugins/common/data-source/json-data-source.d.ts +0 -7
- package/es/plugins/common/data-source/json-data-source.js +0 -219
- package/es/plugins/common/data-source/text-data-source.d.ts +0 -7
- package/es/plugins/common/data-source/text-data-source.js +0 -60
- package/es/plugins/common/index.d.ts +0 -4
- package/es/plugins/common/index.js +0 -4
- package/es/plugins/common/node/ElementDOMSlot.d.ts +0 -3
- package/es/plugins/common/node/ElementDOMSlot.js +0 -33
- package/es/plugins/common/node/cursor.d.ts +0 -14
- package/es/plugins/common/node/cursor.js +0 -332
- package/es/plugins/common/plugin/index.d.ts +0 -39
- package/es/plugins/common/plugin/index.js +0 -553
- package/es/plugins/common/plugin/mdReader.d.ts +0 -2
- package/es/plugins/common/plugin/mdReader.js +0 -84
- package/es/plugins/common/plugin/paste-handler.d.ts +0 -37
- package/es/plugins/common/plugin/paste-handler.js +0 -140
- package/es/plugins/common/plugin/register.d.ts +0 -10
- package/es/plugins/common/plugin/register.js +0 -407
- package/es/plugins/common/react/Placeholder/index.d.ts +0 -8
- package/es/plugins/common/react/Placeholder/index.js +0 -92
- package/es/plugins/common/react/Placeholder/style.d.ts +0 -4
- package/es/plugins/common/react/Placeholder/style.js +0 -12
- package/es/plugins/common/react/ReactEditorContent.d.ts +0 -4
- package/es/plugins/common/react/ReactEditorContent.js +0 -7
- package/es/plugins/common/react/ReactPlainText.d.ts +0 -4
- package/es/plugins/common/react/ReactPlainText.js +0 -244
- package/es/plugins/common/react/index.d.ts +0 -3
- package/es/plugins/common/react/index.js +0 -3
- package/es/plugins/common/react/style.d.ts +0 -23
- package/es/plugins/common/react/style.js +0 -41
- package/es/plugins/common/react/type.d.ts +0 -90
- package/es/plugins/common/react/type.js +0 -1
- package/es/plugins/common/utils/index.d.ts +0 -35
- package/es/plugins/common/utils/index.js +0 -198
- package/es/plugins/file/command/index.d.ts +0 -7
- package/es/plugins/file/command/index.js +0 -30
- package/es/plugins/file/index.d.ts +0 -3
- package/es/plugins/file/index.js +0 -3
- package/es/plugins/file/node/FileNode.d.ts +0 -36
- package/es/plugins/file/node/FileNode.js +0 -187
- package/es/plugins/file/plugin/index.d.ts +0 -14
- package/es/plugins/file/plugin/index.js +0 -164
- package/es/plugins/file/react/ReactFilePlugin.d.ts +0 -4
- package/es/plugins/file/react/ReactFilePlugin.js +0 -72
- package/es/plugins/file/react/components/ReactFile.d.ts +0 -10
- package/es/plugins/file/react/components/ReactFile.js +0 -64
- package/es/plugins/file/react/index.d.ts +0 -2
- package/es/plugins/file/react/index.js +0 -1
- package/es/plugins/file/react/style.d.ts +0 -3
- package/es/plugins/file/react/style.js +0 -11
- package/es/plugins/file/react/type.d.ts +0 -13
- package/es/plugins/file/react/type.js +0 -1
- package/es/plugins/file/utils/index.d.ts +0 -2
- package/es/plugins/file/utils/index.js +0 -45
- package/es/plugins/hr/command/index.d.ts +0 -3
- package/es/plugins/hr/command/index.js +0 -13
- package/es/plugins/hr/index.d.ts +0 -3
- package/es/plugins/hr/index.js +0 -3
- package/es/plugins/hr/node/HorizontalRuleNode.d.ts +0 -16
- package/es/plugins/hr/node/HorizontalRuleNode.js +0 -110
- package/es/plugins/hr/plugin/index.d.ts +0 -8
- package/es/plugins/hr/plugin/index.js +0 -98
- package/es/plugins/hr/react/ReactHRPlugin.d.ts +0 -4
- package/es/plugins/hr/react/ReactHRPlugin.js +0 -36
- package/es/plugins/hr/react/components/HRNode.d.ts +0 -10
- package/es/plugins/hr/react/components/HRNode.js +0 -44
- package/es/plugins/hr/react/index.d.ts +0 -2
- package/es/plugins/hr/react/index.js +0 -1
- package/es/plugins/hr/react/style.d.ts +0 -1
- package/es/plugins/hr/react/style.js +0 -8
- package/es/plugins/hr/react/type.d.ts +0 -3
- package/es/plugins/hr/react/type.js +0 -1
- package/es/plugins/image/command/index.d.ts +0 -10
- package/es/plugins/image/command/index.js +0 -60
- package/es/plugins/image/index.d.ts +0 -3
- package/es/plugins/image/index.js +0 -3
- package/es/plugins/image/node/basie-image-node.d.ts +0 -39
- package/es/plugins/image/node/basie-image-node.js +0 -131
- package/es/plugins/image/node/block-image-node.d.ts +0 -41
- package/es/plugins/image/node/block-image-node.js +0 -228
- package/es/plugins/image/node/image-node.d.ts +0 -39
- package/es/plugins/image/node/image-node.js +0 -212
- package/es/plugins/image/plugin/index.d.ts +0 -20
- package/es/plugins/image/plugin/index.js +0 -273
- package/es/plugins/image/react/ReactImagePlugin.d.ts +0 -4
- package/es/plugins/image/react/ReactImagePlugin.js +0 -57
- package/es/plugins/image/react/components/BrokenImage.d.ts +0 -3
- package/es/plugins/image/react/components/BrokenImage.js +0 -15
- package/es/plugins/image/react/components/Image.d.ts +0 -15
- package/es/plugins/image/react/components/Image.js +0 -265
- package/es/plugins/image/react/components/ImageEditPopover.d.ts +0 -17
- package/es/plugins/image/react/components/ImageEditPopover.js +0 -257
- package/es/plugins/image/react/components/LazyImage.d.ts +0 -15
- package/es/plugins/image/react/components/LazyImage.js +0 -109
- package/es/plugins/image/react/components/ResizeHandle.d.ts +0 -10
- package/es/plugins/image/react/components/ResizeHandle.js +0 -73
- package/es/plugins/image/react/components/style.d.ts +0 -10
- package/es/plugins/image/react/components/style.js +0 -17
- package/es/plugins/image/react/components/useSupenseImage.d.ts +0 -2
- package/es/plugins/image/react/components/useSupenseImage.js +0 -24
- package/es/plugins/image/react/index.d.ts +0 -2
- package/es/plugins/image/react/index.js +0 -1
- package/es/plugins/image/react/style.d.ts +0 -5
- package/es/plugins/image/react/style.js +0 -13
- package/es/plugins/image/react/type.d.ts +0 -20
- package/es/plugins/image/react/type.js +0 -1
- package/es/plugins/inode/index.d.ts +0 -3
- package/es/plugins/inode/index.js +0 -3
- package/es/plugins/inode/plugin/index.d.ts +0 -16
- package/es/plugins/inode/plugin/index.js +0 -49
- package/es/plugins/inode/react/index.d.ts +0 -3
- package/es/plugins/inode/react/index.js +0 -22
- package/es/plugins/inode/service/index.d.ts +0 -25
- package/es/plugins/inode/service/index.js +0 -49
- package/es/plugins/link/command/index.d.ts +0 -10
- package/es/plugins/link/command/index.js +0 -38
- package/es/plugins/link/index.d.ts +0 -4
- package/es/plugins/link/index.js +0 -4
- package/es/plugins/link/node/LinkNode.d.ts +0 -126
- package/es/plugins/link/node/LinkNode.js +0 -723
- package/es/plugins/link/plugin/index.d.ts +0 -12
- package/es/plugins/link/plugin/index.js +0 -157
- package/es/plugins/link/plugin/registry.d.ts +0 -9
- package/es/plugins/link/plugin/registry.js +0 -108
- package/es/plugins/link/react/ReactLinkPlugin.d.ts +0 -4
- package/es/plugins/link/react/ReactLinkPlugin.js +0 -64
- package/es/plugins/link/react/components/LinkEdit.d.ts +0 -12
- package/es/plugins/link/react/components/LinkEdit.js +0 -262
- package/es/plugins/link/react/components/LinkToolbar.d.ts +0 -8
- package/es/plugins/link/react/components/LinkToolbar.js +0 -183
- package/es/plugins/link/react/index.d.ts +0 -2
- package/es/plugins/link/react/index.js +0 -1
- package/es/plugins/link/react/style.d.ts +0 -6
- package/es/plugins/link/react/style.js +0 -14
- package/es/plugins/link/react/type.d.ts +0 -10
- package/es/plugins/link/react/type.js +0 -1
- package/es/plugins/link/service/i-link-service.d.ts +0 -11
- package/es/plugins/link/service/i-link-service.js +0 -46
- package/es/plugins/link/utils/index.d.ts +0 -9
- package/es/plugins/link/utils/index.js +0 -51
- package/es/plugins/link-highlight/command/index.d.ts +0 -3
- package/es/plugins/link-highlight/command/index.js +0 -48
- package/es/plugins/link-highlight/index.d.ts +0 -3
- package/es/plugins/link-highlight/index.js +0 -4
- package/es/plugins/link-highlight/node/link-highlight.d.ts +0 -25
- package/es/plugins/link-highlight/node/link-highlight.js +0 -179
- package/es/plugins/link-highlight/plugin/index.d.ts +0 -15
- package/es/plugins/link-highlight/plugin/index.js +0 -185
- package/es/plugins/link-highlight/plugin/registry.d.ts +0 -6
- package/es/plugins/link-highlight/plugin/registry.js +0 -61
- package/es/plugins/link-highlight/react/ReactLinkHighlightPlugin.d.ts +0 -4
- package/es/plugins/link-highlight/react/ReactLinkHighlightPlugin.js +0 -33
- package/es/plugins/link-highlight/react/index.d.ts +0 -1
- package/es/plugins/link-highlight/react/index.js +0 -1
- package/es/plugins/link-highlight/react/style.d.ts +0 -3
- package/es/plugins/link-highlight/react/style.js +0 -9
- package/es/plugins/link-highlight/react/type.d.ts +0 -13
- package/es/plugins/link-highlight/react/type.js +0 -1
- package/es/plugins/link-highlight/utils/index.d.ts +0 -17
- package/es/plugins/link-highlight/utils/index.js +0 -43
- package/es/plugins/list/command/index.d.ts +0 -2
- package/es/plugins/list/command/index.js +0 -2
- package/es/plugins/list/index.d.ts +0 -3
- package/es/plugins/list/index.js +0 -3
- package/es/plugins/list/plugin/checkList.d.ts +0 -3
- package/es/plugins/list/plugin/checkList.js +0 -167
- package/es/plugins/list/plugin/index.d.ts +0 -6
- package/es/plugins/list/plugin/index.js +0 -253
- package/es/plugins/list/plugin/registry.d.ts +0 -6
- package/es/plugins/list/plugin/registry.js +0 -98
- package/es/plugins/list/react/ReactListPlugin.d.ts +0 -4
- package/es/plugins/list/react/ReactListPlugin.js +0 -30
- package/es/plugins/list/react/index.d.ts +0 -2
- package/es/plugins/list/react/index.js +0 -1
- package/es/plugins/list/react/style.d.ts +0 -1
- package/es/plugins/list/react/style.js +0 -8
- package/es/plugins/list/react/type.d.ts +0 -4
- package/es/plugins/list/react/type.js +0 -1
- package/es/plugins/list/utils/index.d.ts +0 -5
- package/es/plugins/list/utils/index.js +0 -88
- package/es/plugins/litexml/command/diffCommand.d.ts +0 -13
- package/es/plugins/litexml/command/diffCommand.js +0 -119
- package/es/plugins/litexml/command/index.d.ts +0 -35
- package/es/plugins/litexml/command/index.js +0 -499
- package/es/plugins/litexml/data-source/litexml-data-source.d.ts +0 -62
- package/es/plugins/litexml/data-source/litexml-data-source.js +0 -459
- package/es/plugins/litexml/index.d.ts +0 -9
- package/es/plugins/litexml/index.js +0 -7
- package/es/plugins/litexml/node/DiffNode.d.ts +0 -27
- package/es/plugins/litexml/node/DiffNode.js +0 -164
- package/es/plugins/litexml/plugin/index.d.ts +0 -20
- package/es/plugins/litexml/plugin/index.js +0 -157
- package/es/plugins/litexml/react/DiffNodeToolbar/index.d.ts +0 -10
- package/es/plugins/litexml/react/DiffNodeToolbar/index.js +0 -62
- package/es/plugins/litexml/react/DiffNodeToolbar/style.d.ts +0 -6
- package/es/plugins/litexml/react/DiffNodeToolbar/style.js +0 -13
- package/es/plugins/litexml/react/hooks/useHasDiffNode.d.ts +0 -4
- package/es/plugins/litexml/react/hooks/useHasDiffNode.js +0 -70
- package/es/plugins/litexml/react/index.d.ts +0 -3
- package/es/plugins/litexml/react/index.js +0 -35
- package/es/plugins/litexml/react/style.d.ts +0 -1
- package/es/plugins/litexml/react/style.js +0 -8
- package/es/plugins/litexml/service/litexml-service.d.ts +0 -88
- package/es/plugins/litexml/service/litexml-service.js +0 -101
- package/es/plugins/litexml/utils/index.d.ts +0 -6
- package/es/plugins/litexml/utils/index.js +0 -87
- package/es/plugins/markdown/command/index.d.ts +0 -12
- package/es/plugins/markdown/command/index.js +0 -87
- package/es/plugins/markdown/data-source/markdown/parse.d.ts +0 -21
- package/es/plugins/markdown/data-source/markdown/parse.js +0 -244
- package/es/plugins/markdown/data-source/markdown/supersub.d.ts +0 -1
- package/es/plugins/markdown/data-source/markdown/supersub.js +0 -14
- package/es/plugins/markdown/data-source/markdown-data-source.d.ts +0 -14
- package/es/plugins/markdown/data-source/markdown-data-source.js +0 -248
- package/es/plugins/markdown/data-source/markdown-writer-context.d.ts +0 -16
- package/es/plugins/markdown/data-source/markdown-writer-context.js +0 -76
- package/es/plugins/markdown/index.d.ts +0 -8
- package/es/plugins/markdown/index.js +0 -7
- package/es/plugins/markdown/plugin/index.d.ts +0 -19
- package/es/plugins/markdown/plugin/index.js +0 -389
- package/es/plugins/markdown/react/index.d.ts +0 -3
- package/es/plugins/markdown/react/index.js +0 -38
- package/es/plugins/markdown/service/shortcut.d.ts +0 -90
- package/es/plugins/markdown/service/shortcut.js +0 -185
- package/es/plugins/markdown/service/transformers.d.ts +0 -60
- package/es/plugins/markdown/service/transformers.js +0 -298
- package/es/plugins/markdown/utils/detectLanguage.d.ts +0 -20
- package/es/plugins/markdown/utils/detectLanguage.js +0 -267
- package/es/plugins/markdown/utils/index.d.ts +0 -64
- package/es/plugins/markdown/utils/index.js +0 -223
- package/es/plugins/markdown/utils/logger.d.ts +0 -7
- package/es/plugins/markdown/utils/logger.js +0 -2
- package/es/plugins/markdown/utils/url-validator.d.ts +0 -4
- package/es/plugins/markdown/utils/url-validator.js +0 -6
- package/es/plugins/math/command/index.d.ts +0 -13
- package/es/plugins/math/command/index.js +0 -47
- package/es/plugins/math/index.d.ts +0 -3
- package/es/plugins/math/index.js +0 -3
- package/es/plugins/math/node/index.d.ts +0 -45
- package/es/plugins/math/node/index.js +0 -279
- package/es/plugins/math/plugin/index.d.ts +0 -11
- package/es/plugins/math/plugin/index.js +0 -166
- package/es/plugins/math/react/components/MathEditor.d.ts +0 -10
- package/es/plugins/math/react/components/MathEditor.js +0 -299
- package/es/plugins/math/react/components/MathEditorContainer.d.ts +0 -15
- package/es/plugins/math/react/components/MathEditorContainer.js +0 -112
- package/es/plugins/math/react/components/MathEditorContent.d.ts +0 -28
- package/es/plugins/math/react/components/MathEditorContent.js +0 -161
- package/es/plugins/math/react/components/MathInline.d.ts +0 -10
- package/es/plugins/math/react/components/MathInline.js +0 -136
- package/es/plugins/math/react/components/Placeholder.d.ts +0 -6
- package/es/plugins/math/react/components/Placeholder.js +0 -23
- package/es/plugins/math/react/index.d.ts +0 -3
- package/es/plugins/math/react/index.js +0 -41
- package/es/plugins/math/react/style.d.ts +0 -9
- package/es/plugins/math/react/style.js +0 -18
- package/es/plugins/math/react/type.d.ts +0 -13
- package/es/plugins/math/react/type.js +0 -1
- package/es/plugins/math/utils/index.d.ts +0 -13
- package/es/plugins/math/utils/index.js +0 -26
- package/es/plugins/mention/command/index.d.ts +0 -6
- package/es/plugins/mention/command/index.js +0 -20
- package/es/plugins/mention/index.d.ts +0 -4
- package/es/plugins/mention/index.js +0 -3
- package/es/plugins/mention/node/MentionNode.d.ts +0 -26
- package/es/plugins/mention/node/MentionNode.js +0 -153
- package/es/plugins/mention/plugin/index.d.ts +0 -14
- package/es/plugins/mention/plugin/index.js +0 -103
- package/es/plugins/mention/plugin/register.d.ts +0 -2
- package/es/plugins/mention/plugin/register.js +0 -46
- package/es/plugins/mention/react/ReactMentionPlugin.d.ts +0 -4
- package/es/plugins/mention/react/ReactMentionPlugin.js +0 -40
- package/es/plugins/mention/react/components/Mention.d.ts +0 -10
- package/es/plugins/mention/react/components/Mention.js +0 -40
- package/es/plugins/mention/react/index.d.ts +0 -2
- package/es/plugins/mention/react/index.js +0 -1
- package/es/plugins/mention/react/style.d.ts +0 -3
- package/es/plugins/mention/react/style.js +0 -11
- package/es/plugins/mention/react/type.d.ts +0 -8
- package/es/plugins/mention/react/type.js +0 -1
- package/es/plugins/slash/index.d.ts +0 -4
- package/es/plugins/slash/index.js +0 -3
- package/es/plugins/slash/plugin/index.d.ts +0 -23
- package/es/plugins/slash/plugin/index.js +0 -159
- package/es/plugins/slash/react/ReactSlashOption.d.ts +0 -4
- package/es/plugins/slash/react/ReactSlashOption.js +0 -7
- package/es/plugins/slash/react/ReactSlashPlugin.d.ts +0 -4
- package/es/plugins/slash/react/ReactSlashPlugin.js +0 -258
- package/es/plugins/slash/react/components/DefaultSlashMenu.d.ts +0 -5
- package/es/plugins/slash/react/components/DefaultSlashMenu.js +0 -141
- package/es/plugins/slash/react/components/SlashMenu.d.ts +0 -8
- package/es/plugins/slash/react/components/SlashMenu.js +0 -56
- package/es/plugins/slash/react/index.d.ts +0 -4
- package/es/plugins/slash/react/index.js +0 -3
- package/es/plugins/slash/react/style.d.ts +0 -1
- package/es/plugins/slash/react/style.js +0 -9
- package/es/plugins/slash/react/type.d.ts +0 -111
- package/es/plugins/slash/react/type.js +0 -1
- package/es/plugins/slash/react/utils.d.ts +0 -5
- package/es/plugins/slash/react/utils.js +0 -20
- package/es/plugins/slash/service/i-slash-service.d.ts +0 -61
- package/es/plugins/slash/service/i-slash-service.js +0 -91
- package/es/plugins/slash/utils/utils.d.ts +0 -38
- package/es/plugins/slash/utils/utils.js +0 -198
- package/es/plugins/table/command/index.d.ts +0 -13
- package/es/plugins/table/command/index.js +0 -73
- package/es/plugins/table/index.d.ts +0 -3
- package/es/plugins/table/index.js +0 -3
- package/es/plugins/table/node/index.d.ts +0 -2
- package/es/plugins/table/node/index.js +0 -16
- package/es/plugins/table/plugin/index.d.ts +0 -5
- package/es/plugins/table/plugin/index.js +0 -232
- package/es/plugins/table/react/TableActionMenu/ActionMenu.d.ts +0 -19
- package/es/plugins/table/react/TableActionMenu/ActionMenu.js +0 -285
- package/es/plugins/table/react/TableActionMenu/index.d.ts +0 -7
- package/es/plugins/table/react/TableActionMenu/index.js +0 -177
- package/es/plugins/table/react/TableActionMenu/style.d.ts +0 -4
- package/es/plugins/table/react/TableActionMenu/style.js +0 -10
- package/es/plugins/table/react/TableActionMenu/utils.d.ts +0 -9
- package/es/plugins/table/react/TableActionMenu/utils.js +0 -49
- package/es/plugins/table/react/TableHoverActions/index.d.ts +0 -6
- package/es/plugins/table/react/TableHoverActions/index.js +0 -249
- package/es/plugins/table/react/TableHoverActions/style.d.ts +0 -5
- package/es/plugins/table/react/TableHoverActions/style.js +0 -11
- package/es/plugins/table/react/TableHoverActions/utils.d.ts +0 -8
- package/es/plugins/table/react/TableHoverActions/utils.js +0 -43
- package/es/plugins/table/react/TableResize/index.d.ts +0 -10
- package/es/plugins/table/react/TableResize/index.js +0 -378
- package/es/plugins/table/react/TableResize/style.d.ts +0 -3
- package/es/plugins/table/react/TableResize/style.js +0 -10
- package/es/plugins/table/react/TableResize/utils.d.ts +0 -4
- package/es/plugins/table/react/TableResize/utils.js +0 -40
- package/es/plugins/table/react/hooks.d.ts +0 -1
- package/es/plugins/table/react/hooks.js +0 -22
- package/es/plugins/table/react/index.d.ts +0 -3
- package/es/plugins/table/react/index.js +0 -78
- package/es/plugins/table/react/style.d.ts +0 -1
- package/es/plugins/table/react/style.js +0 -8
- package/es/plugins/table/react/type.d.ts +0 -5
- package/es/plugins/table/react/type.js +0 -1
- package/es/plugins/table/utils/index.d.ts +0 -8
- package/es/plugins/table/utils/index.js +0 -83
- package/es/plugins/toolbar/command/index.d.ts +0 -8
- package/es/plugins/toolbar/command/index.js +0 -16
- package/es/plugins/toolbar/index.d.ts +0 -2
- package/es/plugins/toolbar/index.js +0 -2
- package/es/plugins/toolbar/react/index.d.ts +0 -3
- package/es/plugins/toolbar/react/index.js +0 -140
- package/es/plugins/toolbar/react/style.d.ts +0 -5
- package/es/plugins/toolbar/react/style.js +0 -12
- package/es/plugins/toolbar/react/type.d.ts +0 -5
- package/es/plugins/toolbar/react/type.js +0 -1
- package/es/plugins/toolbar/utils/getDOMRangeRect.d.ts +0 -8
- package/es/plugins/toolbar/utils/getDOMRangeRect.js +0 -21
- package/es/plugins/toolbar/utils/setFloatingElemPosition.d.ts +0 -1
- package/es/plugins/toolbar/utils/setFloatingElemPosition.js +0 -68
- package/es/plugins/upload/index.d.ts +0 -3
- package/es/plugins/upload/index.js +0 -3
- package/es/plugins/upload/plugin/index.d.ts +0 -4
- package/es/plugins/upload/plugin/index.js +0 -84
- package/es/plugins/upload/service/i-upload-service.d.ts +0 -15
- package/es/plugins/upload/service/i-upload-service.js +0 -115
- package/es/plugins/upload/utils/index.d.ts +0 -1
- package/es/plugins/upload/utils/index.js +0 -20
- package/es/plugins/virtual-block/index.d.ts +0 -2
- package/es/plugins/virtual-block/index.js +0 -2
- package/es/plugins/virtual-block/plugin/index.d.ts +0 -5
- package/es/plugins/virtual-block/plugin/index.js +0 -41
- package/es/plugins/virtual-block/plugin/register.d.ts +0 -6
- package/es/plugins/virtual-block/plugin/register.js +0 -274
- package/es/plugins/virtual-block/react/ReactVirtualBlock.d.ts +0 -3
- package/es/plugins/virtual-block/react/ReactVirtualBlock.js +0 -22
- package/es/plugins/virtual-block/react/index.d.ts +0 -1
- package/es/plugins/virtual-block/react/index.js +0 -1
- package/es/react/ChatInput/ChatInput.d.ts +0 -4
- package/es/react/ChatInput/ChatInput.js +0 -146
- package/es/react/ChatInput/index.d.ts +0 -2
- package/es/react/ChatInput/index.js +0 -2
- package/es/react/ChatInput/style.d.ts +0 -11
- package/es/react/ChatInput/style.js +0 -18
- package/es/react/ChatInput/type.d.ts +0 -28
- package/es/react/ChatInput/type.js +0 -1
- package/es/react/ChatInputActionBar/ChatInputActionBar.d.ts +0 -4
- package/es/react/ChatInputActionBar/ChatInputActionBar.js +0 -35
- package/es/react/ChatInputActionBar/index.d.ts +0 -2
- package/es/react/ChatInputActionBar/index.js +0 -2
- package/es/react/ChatInputActionBar/style.d.ts +0 -3
- package/es/react/ChatInputActionBar/style.js +0 -9
- package/es/react/ChatInputActionBar/type.d.ts +0 -6
- package/es/react/ChatInputActionBar/type.js +0 -1
- package/es/react/ChatInputActions/ChatInputActions.d.ts +0 -4
- package/es/react/ChatInputActions/ChatInputActions.js +0 -109
- package/es/react/ChatInputActions/components/ActionItem.d.ts +0 -13
- package/es/react/ChatInputActions/components/ActionItem.js +0 -65
- package/es/react/ChatInputActions/components/ActionRender.d.ts +0 -9
- package/es/react/ChatInputActions/components/ActionRender.js +0 -66
- package/es/react/ChatInputActions/components/CollapsedActions.d.ts +0 -4
- package/es/react/ChatInputActions/components/CollapsedActions.js +0 -78
- package/es/react/ChatInputActions/components/useDisplayActionCount.d.ts +0 -13
- package/es/react/ChatInputActions/components/useDisplayActionCount.js +0 -66
- package/es/react/ChatInputActions/index.d.ts +0 -2
- package/es/react/ChatInputActions/index.js +0 -1
- package/es/react/ChatInputActions/style.d.ts +0 -5
- package/es/react/ChatInputActions/style.js +0 -11
- package/es/react/ChatInputActions/type.d.ts +0 -40
- package/es/react/ChatInputActions/type.js +0 -1
- package/es/react/CodeLanguageSelect/CodeLanguageSelect.d.ts +0 -4
- package/es/react/CodeLanguageSelect/CodeLanguageSelect.js +0 -93
- package/es/react/CodeLanguageSelect/index.d.ts +0 -2
- package/es/react/CodeLanguageSelect/index.js +0 -2
- package/es/react/CodeLanguageSelect/style.d.ts +0 -3
- package/es/react/CodeLanguageSelect/style.js +0 -9
- package/es/react/CodeLanguageSelect/type.d.ts +0 -2
- package/es/react/CodeLanguageSelect/type.js +0 -1
- package/es/react/Editor/Editor.d.ts +0 -4
- package/es/react/Editor/Editor.js +0 -154
- package/es/react/Editor/index.d.ts +0 -15
- package/es/react/Editor/index.js +0 -11
- package/es/react/Editor/type.d.ts +0 -61
- package/es/react/Editor/type.js +0 -1
- package/es/react/Editor/utils.d.ts +0 -2
- package/es/react/Editor/utils.js +0 -3
- package/es/react/EditorProvider/index.d.ts +0 -20
- package/es/react/EditorProvider/index.js +0 -25
- package/es/react/FloatActions/FloatActions.d.ts +0 -4
- package/es/react/FloatActions/FloatActions.js +0 -65
- package/es/react/FloatActions/components/ActionItem.d.ts +0 -12
- package/es/react/FloatActions/components/ActionItem.js +0 -64
- package/es/react/FloatActions/components/ActionRender.d.ts +0 -9
- package/es/react/FloatActions/components/ActionRender.js +0 -66
- package/es/react/FloatActions/components/CollapsedActions.d.ts +0 -4
- package/es/react/FloatActions/components/CollapsedActions.js +0 -78
- package/es/react/FloatActions/index.d.ts +0 -2
- package/es/react/FloatActions/index.js +0 -1
- package/es/react/FloatActions/style.d.ts +0 -5
- package/es/react/FloatActions/style.js +0 -11
- package/es/react/FloatActions/type.d.ts +0 -37
- package/es/react/FloatActions/type.js +0 -1
- package/es/react/FloatMenu/FloatMenu.d.ts +0 -4
- package/es/react/FloatMenu/FloatMenu.js +0 -48
- package/es/react/FloatMenu/index.d.ts +0 -2
- package/es/react/FloatMenu/index.js +0 -2
- package/es/react/FloatMenu/style.d.ts +0 -6
- package/es/react/FloatMenu/style.js +0 -13
- package/es/react/FloatMenu/type.d.ts +0 -21
- package/es/react/FloatMenu/type.js +0 -1
- package/es/react/SendButton/SendButton.d.ts +0 -4
- package/es/react/SendButton/SendButton.js +0 -121
- package/es/react/SendButton/components/SendIcon.d.ts +0 -7
- package/es/react/SendButton/components/SendIcon.js +0 -31
- package/es/react/SendButton/components/StopIcon.d.ts +0 -7
- package/es/react/SendButton/components/StopIcon.js +0 -58
- package/es/react/SendButton/index.d.ts +0 -2
- package/es/react/SendButton/index.js +0 -2
- package/es/react/SendButton/style.d.ts +0 -7
- package/es/react/SendButton/style.js +0 -15
- package/es/react/SendButton/type.d.ts +0 -8
- package/es/react/SendButton/type.js +0 -1
- package/es/react/SlashMenu/SlashMenu.d.ts +0 -4
- package/es/react/SlashMenu/SlashMenu.js +0 -58
- package/es/react/SlashMenu/index.d.ts +0 -2
- package/es/react/SlashMenu/index.js +0 -2
- package/es/react/SlashMenu/type.d.ts +0 -13
- package/es/react/SlashMenu/type.js +0 -1
- package/es/react/hooks/useEditor.d.ts +0 -2
- package/es/react/hooks/useEditor.js +0 -7
- package/es/react/hooks/useEditorState/index.d.ts +0 -68
- package/es/react/hooks/useEditorState/index.js +0 -488
- package/es/react/hooks/useEditorState/utils.d.ts +0 -4
- package/es/react/hooks/useEditorState/utils.js +0 -36
- package/es/react/hooks/useSize.d.ts +0 -13
- package/es/react/hooks/useSize.js +0 -77
- package/es/react/index.d.ts +0 -12
- package/es/react/index.js +0 -12
- package/es/renderer/LexicalDiff.d.ts +0 -22
- package/es/renderer/LexicalDiff.js +0 -116
- package/es/renderer/LexicalRenderer.d.ts +0 -3
- package/es/renderer/LexicalRenderer.js +0 -61
- package/es/renderer/diff/compute.d.ts +0 -3
- package/es/renderer/diff/compute.js +0 -510
- package/es/renderer/diff/style.d.ts +0 -13
- package/es/renderer/diff/style.js +0 -20
- package/es/renderer/diff/types.d.ts +0 -28
- package/es/renderer/diff/types.js +0 -1
- package/es/renderer/engine/render-builtin-node.d.ts +0 -2
- package/es/renderer/engine/render-builtin-node.js +0 -211
- package/es/renderer/engine/render-text-node.d.ts +0 -2
- package/es/renderer/engine/render-text-node.js +0 -52
- package/es/renderer/engine/render-tree.d.ts +0 -6
- package/es/renderer/engine/render-tree.js +0 -47
- package/es/renderer/engine/shiki.d.ts +0 -3
- package/es/renderer/engine/shiki.js +0 -183
- package/es/renderer/engine/utils.d.ts +0 -2
- package/es/renderer/engine/utils.js +0 -27
- package/es/renderer/index.d.ts +0 -8
- package/es/renderer/index.js +0 -5
- package/es/renderer/nodes/index.d.ts +0 -2
- package/es/renderer/nodes/index.js +0 -17
- package/es/renderer/renderers/codeblock.d.ts +0 -2
- package/es/renderer/renderers/codeblock.js +0 -162
- package/es/renderer/renderers/file.d.ts +0 -2
- package/es/renderer/renderers/file.js +0 -30
- package/es/renderer/renderers/horizontalrule.d.ts +0 -2
- package/es/renderer/renderers/horizontalrule.js +0 -15
- package/es/renderer/renderers/image.d.ts +0 -3
- package/es/renderer/renderers/image.js +0 -40
- package/es/renderer/renderers/index.d.ts +0 -2
- package/es/renderer/renderers/index.js +0 -9
- package/es/renderer/renderers/math.d.ts +0 -2
- package/es/renderer/renderers/math.js +0 -18
- package/es/renderer/renderers/mention.d.ts +0 -2
- package/es/renderer/renderers/mention.js +0 -13
- package/es/renderer/renderers/mermaid.d.ts +0 -2
- package/es/renderer/renderers/mermaid.js +0 -18
- package/es/renderer/style.d.ts +0 -14
- package/es/renderer/style.js +0 -48
- package/es/renderer/types.d.ts +0 -25
- package/es/renderer/types.js +0 -1
- package/es/types/global.d.ts +0 -88
- package/es/types/hotkey.d.ts +0 -72
- package/es/types/hotkey.js +0 -72
- package/es/types/index.d.ts +0 -2
- package/es/types/index.js +0 -2
- package/es/types/kernel.d.ts +0 -336
- package/es/types/kernel.js +0 -1
- package/es/types/locale.d.ts +0 -10
- package/es/types/locale.js +0 -1
- package/es/utils/debug.d.ts +0 -429
- package/es/utils/debug.js +0 -321
- package/es/utils/hotkey/isHotkeyMatch.d.ts +0 -1
- package/es/utils/hotkey/isHotkeyMatch.js +0 -9
- package/es/utils/hotkey/parseHotkeys.d.ts +0 -6
- package/es/utils/hotkey/parseHotkeys.js +0 -42
- package/es/utils/hotkey/registerHotkey.d.ts +0 -15
- package/es/utils/hotkey/registerHotkey.js +0 -32
- package/es/utils/scrollIntoView.d.ts +0 -5
- package/es/utils/scrollIntoView.js +0 -45
- package/es/utils/updatePosition.d.ts +0 -9
- package/es/utils/updatePosition.js +0 -27
- package/es/utils/url.d.ts +0 -15
- package/es/utils/url.js +0 -51
- package/react.d.ts +0 -1
- package/react.js +0 -1
- package/renderer.d.ts +0 -1
- package/renderer.js +0 -1
- package/scripts/patch-lexical.js +0 -39
|
@@ -1,299 +0,0 @@
|
|
|
1
|
-
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
2
|
-
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
3
|
-
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
4
|
-
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
5
|
-
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
6
|
-
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
7
|
-
import { mergeRegister } from '@lexical/utils';
|
|
8
|
-
import { $getNodeByKey, $getSelection, $isNodeSelection, $isRangeSelection } from 'lexical';
|
|
9
|
-
import { memo, useCallback, useEffect, useRef, useState } from 'react';
|
|
10
|
-
import { useLexicalComposerContext, useLexicalEditor } from "../../../../editor-kernel/react";
|
|
11
|
-
import PortalAnchor from "../../../../editor-kernel/react/PortalAnchor";
|
|
12
|
-
import { compareNodeOrder } from "../../../../editor-kernel/utils";
|
|
13
|
-
import { SELECT_MATH_SIDE_COMMAND, UPDATE_MATH_COMMAND } from "../../command";
|
|
14
|
-
import { $isMathNode, MathBlockNode } from "../../node";
|
|
15
|
-
import MathEditorContainer from "./MathEditorContainer";
|
|
16
|
-
import MathEditorContent from "./MathEditorContent";
|
|
17
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
18
|
-
import { Fragment as _Fragment } from "react/jsx-runtime";
|
|
19
|
-
var MathEdit = /*#__PURE__*/memo(function (_ref) {
|
|
20
|
-
var renderComp = _ref.renderComp;
|
|
21
|
-
var textareaRef = useRef(null);
|
|
22
|
-
var isUpdatingRef = useRef(false);
|
|
23
|
-
var _useState = useState(null),
|
|
24
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
25
|
-
mathNode = _useState2[0],
|
|
26
|
-
setMathNode = _useState2[1];
|
|
27
|
-
var _useState3 = useState(''),
|
|
28
|
-
_useState4 = _slicedToArray(_useState3, 2),
|
|
29
|
-
value = _useState4[0],
|
|
30
|
-
setValue = _useState4[1];
|
|
31
|
-
// 最近一次成功渲染(校验通过)的 LaTeX
|
|
32
|
-
var lastValidRef = useRef('');
|
|
33
|
-
var isInputValidRef = useRef(true);
|
|
34
|
-
var _useState5 = useState(null),
|
|
35
|
-
_useState6 = _slicedToArray(_useState5, 2),
|
|
36
|
-
mathDOM = _useState6[0],
|
|
37
|
-
setMathDOM = _useState6[1];
|
|
38
|
-
var _useState7 = useState(false),
|
|
39
|
-
_useState8 = _slicedToArray(_useState7, 2),
|
|
40
|
-
prev = _useState8[0],
|
|
41
|
-
setPrev = _useState8[1];
|
|
42
|
-
var _useState9 = useState(false),
|
|
43
|
-
_useState10 = _slicedToArray(_useState9, 2),
|
|
44
|
-
isBlockMode = _useState10[0],
|
|
45
|
-
setIsBlockMode = _useState10[1];
|
|
46
|
-
var _useState11 = useState(false),
|
|
47
|
-
_useState12 = _slicedToArray(_useState11, 2),
|
|
48
|
-
isOpen = _useState12[0],
|
|
49
|
-
setIsOpen = _useState12[1];
|
|
50
|
-
var _useLexicalComposerCo = useLexicalComposerContext(),
|
|
51
|
-
_useLexicalComposerCo2 = _slicedToArray(_useLexicalComposerCo, 1),
|
|
52
|
-
editor = _useLexicalComposerCo2[0];
|
|
53
|
-
|
|
54
|
-
// 实时更新节点内容(仅当输入可渲染时才同步到 document)
|
|
55
|
-
useEffect(function () {
|
|
56
|
-
if (!mathNode) return;
|
|
57
|
-
// 输入无效时不同步到文档,避免无限循环;提交时会使用 lastValidRef 作为回退
|
|
58
|
-
if (!isInputValidRef.current) return;
|
|
59
|
-
|
|
60
|
-
// 使用防抖来避免过于频繁的更新
|
|
61
|
-
var timeoutId = setTimeout(function () {
|
|
62
|
-
// 直接更新节点内容
|
|
63
|
-
var lexicalEditor = editor.getLexicalEditor();
|
|
64
|
-
if (lexicalEditor && !isUpdatingRef.current) {
|
|
65
|
-
// 检查当前值是否与节点中的值不同,避免不必要的更新
|
|
66
|
-
var currentCode = mathNode.code;
|
|
67
|
-
if (value && currentCode && currentCode === value) {
|
|
68
|
-
return; // 值相同,无需更新
|
|
69
|
-
}
|
|
70
|
-
isUpdatingRef.current = true;
|
|
71
|
-
lexicalEditor.update(function () {
|
|
72
|
-
var currentNode = lexicalEditor.getEditorState().read(function () {
|
|
73
|
-
return lexicalEditor.getElementByKey(mathNode.getKey());
|
|
74
|
-
});
|
|
75
|
-
if (currentNode) {
|
|
76
|
-
var writableNode = mathNode.getWritable();
|
|
77
|
-
writableNode.__code = value;
|
|
78
|
-
}
|
|
79
|
-
});
|
|
80
|
-
// 延迟重置更新标志,确保更新监听器不会立即触发
|
|
81
|
-
setTimeout(function () {
|
|
82
|
-
isUpdatingRef.current = false;
|
|
83
|
-
}, 50);
|
|
84
|
-
}
|
|
85
|
-
}, 50); // 增加防抖延迟
|
|
86
|
-
|
|
87
|
-
return function () {
|
|
88
|
-
return clearTimeout(timeoutId);
|
|
89
|
-
};
|
|
90
|
-
}, [value, mathNode, editor]);
|
|
91
|
-
|
|
92
|
-
// 提交逻辑
|
|
93
|
-
var handleSubmit = useCallback(function () {
|
|
94
|
-
if (!mathNode) return;
|
|
95
|
-
var lexicalEditor = editor.getLexicalEditor();
|
|
96
|
-
if (lexicalEditor) {
|
|
97
|
-
// 提交时若当前不可渲染,则使用最近一次成功渲染的内容
|
|
98
|
-
var codeToCommit = isInputValidRef.current ? value : lastValidRef.current;
|
|
99
|
-
lexicalEditor.dispatchCommand(UPDATE_MATH_COMMAND, {
|
|
100
|
-
code: codeToCommit,
|
|
101
|
-
key: mathNode.getKey()
|
|
102
|
-
});
|
|
103
|
-
}
|
|
104
|
-
}, [editor, mathNode, value]);
|
|
105
|
-
|
|
106
|
-
// 取消编辑,不保存更改
|
|
107
|
-
var handleCancel = useCallback(function () {
|
|
108
|
-
if (!mathNode) return;
|
|
109
|
-
var lexicalEditor = editor.getLexicalEditor();
|
|
110
|
-
if (lexicalEditor) {
|
|
111
|
-
// 使用命令来正确设置光标位置到数学节点之后
|
|
112
|
-
lexicalEditor.dispatchCommand(SELECT_MATH_SIDE_COMMAND, {
|
|
113
|
-
key: mathNode.getKey(),
|
|
114
|
-
prev: false
|
|
115
|
-
});
|
|
116
|
-
|
|
117
|
-
// 将焦点返回到编辑器
|
|
118
|
-
lexicalEditor.focus();
|
|
119
|
-
}
|
|
120
|
-
}, [mathNode, editor]);
|
|
121
|
-
|
|
122
|
-
// 删除节点
|
|
123
|
-
var handleDelete = useCallback(function () {
|
|
124
|
-
if (!mathNode) return;
|
|
125
|
-
var lexicalEditor = editor.getLexicalEditor();
|
|
126
|
-
if (lexicalEditor) {
|
|
127
|
-
lexicalEditor.update(function () {
|
|
128
|
-
mathNode.remove();
|
|
129
|
-
});
|
|
130
|
-
}
|
|
131
|
-
}, [mathNode, editor]);
|
|
132
|
-
|
|
133
|
-
// 左箭头导航
|
|
134
|
-
var handleArrowLeft = useCallback(function () {
|
|
135
|
-
if (!mathNode) return;
|
|
136
|
-
editor.dispatchCommand(SELECT_MATH_SIDE_COMMAND, {
|
|
137
|
-
key: mathNode.getKey(),
|
|
138
|
-
prev: true
|
|
139
|
-
});
|
|
140
|
-
}, [mathNode, editor]);
|
|
141
|
-
|
|
142
|
-
// 右箭头导航
|
|
143
|
-
var handleArrowRight = useCallback(function () {
|
|
144
|
-
if (!mathNode) return;
|
|
145
|
-
editor.dispatchCommand(SELECT_MATH_SIDE_COMMAND, {
|
|
146
|
-
key: mathNode.getKey(),
|
|
147
|
-
prev: false
|
|
148
|
-
});
|
|
149
|
-
}, [mathNode, editor]);
|
|
150
|
-
|
|
151
|
-
// 处理焦点
|
|
152
|
-
var handleFocus = useCallback(function () {
|
|
153
|
-
var _textareaRef$current;
|
|
154
|
-
(_textareaRef$current = textareaRef.current) === null || _textareaRef$current === void 0 || _textareaRef$current.focus();
|
|
155
|
-
if (prev) {
|
|
156
|
-
var _textareaRef$current2;
|
|
157
|
-
(_textareaRef$current2 = textareaRef.current) === null || _textareaRef$current2 === void 0 || (_textareaRef$current2 = _textareaRef$current2.resizableTextArea) === null || _textareaRef$current2 === void 0 || (_textareaRef$current2 = _textareaRef$current2.textArea) === null || _textareaRef$current2 === void 0 || _textareaRef$current2.setSelectionRange(0, 0);
|
|
158
|
-
}
|
|
159
|
-
}, [prev]);
|
|
160
|
-
|
|
161
|
-
// 设置 textarea ref
|
|
162
|
-
var setTextareaRef = useCallback(function (ref) {
|
|
163
|
-
textareaRef.current = ref;
|
|
164
|
-
}, []);
|
|
165
|
-
useLexicalEditor(function (editor) {
|
|
166
|
-
return mergeRegister(editor.registerUpdateListener(function (_ref2) {
|
|
167
|
-
var prevEditorState = _ref2.prevEditorState;
|
|
168
|
-
// 如果正在更新中,跳过此次监听器调用
|
|
169
|
-
if (isUpdatingRef.current) {
|
|
170
|
-
return;
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
// Handle editor state updates
|
|
174
|
-
var canEdit = editor.getEditorState().read(function () {
|
|
175
|
-
var selection = $getSelection();
|
|
176
|
-
if (!$isNodeSelection(selection)) {
|
|
177
|
-
return false;
|
|
178
|
-
}
|
|
179
|
-
var node = selection.getNodes()[0];
|
|
180
|
-
if (!$isMathNode(node)) {
|
|
181
|
-
// Handle math node
|
|
182
|
-
return false;
|
|
183
|
-
}
|
|
184
|
-
|
|
185
|
-
// 检查是否是同一个节点,避免不必要的状态更新
|
|
186
|
-
var isSameNode = mathNode && mathNode.getKey() === node.getKey();
|
|
187
|
-
setMathNode(node);
|
|
188
|
-
// 只有在不是同一个节点或值真正改变时才更新 value
|
|
189
|
-
if (!isSameNode && node.code !== value) {
|
|
190
|
-
setValue(node.code);
|
|
191
|
-
lastValidRef.current = node.code; // 切换节点时以节点里的内容作为最近一次有效值
|
|
192
|
-
isInputValidRef.current = true; // 重置有效状态
|
|
193
|
-
}
|
|
194
|
-
setMathDOM(editor.getElementByKey(node.getKey()));
|
|
195
|
-
setIsBlockMode(node instanceof MathBlockNode);
|
|
196
|
-
return node;
|
|
197
|
-
});
|
|
198
|
-
if (canEdit) {
|
|
199
|
-
var anchorNodeKey = prevEditorState.read(function () {
|
|
200
|
-
var sel = prevEditorState._selection;
|
|
201
|
-
if (!$isRangeSelection(sel)) {
|
|
202
|
-
return false;
|
|
203
|
-
}
|
|
204
|
-
var node = sel.anchor.key;
|
|
205
|
-
return node;
|
|
206
|
-
});
|
|
207
|
-
editor.getEditorState().read(function () {
|
|
208
|
-
var anchorNode = anchorNodeKey ? $getNodeByKey(anchorNodeKey) : null;
|
|
209
|
-
var isPrev = anchorNode && compareNodeOrder(anchorNode, canEdit) < 0;
|
|
210
|
-
if (isPrev) {
|
|
211
|
-
setPrev(true);
|
|
212
|
-
} else {
|
|
213
|
-
setPrev(false);
|
|
214
|
-
}
|
|
215
|
-
});
|
|
216
|
-
setIsOpen(true);
|
|
217
|
-
}
|
|
218
|
-
if (!canEdit) {
|
|
219
|
-
setMathNode(null);
|
|
220
|
-
setMathDOM(null);
|
|
221
|
-
setValue('');
|
|
222
|
-
lastValidRef.current = '';
|
|
223
|
-
isInputValidRef.current = true;
|
|
224
|
-
setIsBlockMode(false);
|
|
225
|
-
setIsOpen(false);
|
|
226
|
-
}
|
|
227
|
-
}));
|
|
228
|
-
}, [mathNode, value]);
|
|
229
|
-
|
|
230
|
-
// 构建 MathEditorContent 组件
|
|
231
|
-
var mathEditorContent = /*#__PURE__*/_jsx(MathEditorContent, {
|
|
232
|
-
focusRef: setTextareaRef,
|
|
233
|
-
mathNode: mathNode,
|
|
234
|
-
onArrowLeft: handleArrowLeft,
|
|
235
|
-
onArrowRight: handleArrowRight,
|
|
236
|
-
onCancel: handleCancel,
|
|
237
|
-
onDelete: handleDelete,
|
|
238
|
-
onSubmit: handleSubmit,
|
|
239
|
-
onValidationChange: function onValidationChange(isValid) {
|
|
240
|
-
isInputValidRef.current = isValid;
|
|
241
|
-
if (isValid) {
|
|
242
|
-
lastValidRef.current = value;
|
|
243
|
-
}
|
|
244
|
-
},
|
|
245
|
-
onValueChange: setValue
|
|
246
|
-
// prev={prev}
|
|
247
|
-
,
|
|
248
|
-
value: value
|
|
249
|
-
});
|
|
250
|
-
|
|
251
|
-
// 点击编辑器外部时关闭面板
|
|
252
|
-
useEffect(function () {
|
|
253
|
-
if (!isOpen) return;
|
|
254
|
-
var handlePointerDown = function handlePointerDown(event) {
|
|
255
|
-
var target = event.target;
|
|
256
|
-
if (!target) return;
|
|
257
|
-
|
|
258
|
-
// 支持多个容器(例如使用 renderComp 渲染到外部节点时,会有额外容器)
|
|
259
|
-
var containers = Array.from(document.querySelectorAll('[data-math-editor-container]'));
|
|
260
|
-
if (containers.some(function (el) {
|
|
261
|
-
return el && el.contains(target);
|
|
262
|
-
})) return;
|
|
263
|
-
handleCancel();
|
|
264
|
-
};
|
|
265
|
-
document.addEventListener('mousedown', handlePointerDown);
|
|
266
|
-
document.addEventListener('touchstart', handlePointerDown);
|
|
267
|
-
return function () {
|
|
268
|
-
document.removeEventListener('mousedown', handlePointerDown);
|
|
269
|
-
document.removeEventListener('touchstart', handlePointerDown);
|
|
270
|
-
};
|
|
271
|
-
}, [isOpen, handleCancel]);
|
|
272
|
-
|
|
273
|
-
// 如果有自定义渲染组件,使用它来包装 MathEditorContent
|
|
274
|
-
if (renderComp) {
|
|
275
|
-
// 为自定义渲染的内容增加容器标记,便于外部点击检测
|
|
276
|
-
var wrapped = /*#__PURE__*/_jsx("div", {
|
|
277
|
-
"data-math-editor-container": true,
|
|
278
|
-
children: mathEditorContent
|
|
279
|
-
});
|
|
280
|
-
return /*#__PURE__*/_jsx(_Fragment, {
|
|
281
|
-
children: renderComp({
|
|
282
|
-
children: wrapped,
|
|
283
|
-
open: isOpen
|
|
284
|
-
})
|
|
285
|
-
});
|
|
286
|
-
}
|
|
287
|
-
|
|
288
|
-
// 否则使用默认的 MathEditorContainer
|
|
289
|
-
return /*#__PURE__*/_jsx(PortalAnchor, {
|
|
290
|
-
children: /*#__PURE__*/_jsx(MathEditorContainer, {
|
|
291
|
-
isBlockMode: isBlockMode,
|
|
292
|
-
mathDOM: mathDOM,
|
|
293
|
-
onFocus: handleFocus,
|
|
294
|
-
prev: prev,
|
|
295
|
-
children: mathEditorContent
|
|
296
|
-
})
|
|
297
|
-
});
|
|
298
|
-
});
|
|
299
|
-
export default MathEdit;
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { type ReactNode } from 'react';
|
|
2
|
-
export interface MathEditorContainerProps {
|
|
3
|
-
/** 子组件内容 */
|
|
4
|
-
children: ReactNode;
|
|
5
|
-
/** 是否为块模式 */
|
|
6
|
-
isBlockMode: boolean;
|
|
7
|
-
/** 数学节点对应的 DOM 元素 */
|
|
8
|
-
mathDOM: HTMLElement | null;
|
|
9
|
-
/** 焦点回调 */
|
|
10
|
-
onFocus?: () => void;
|
|
11
|
-
/** 是否从前一个位置进入 */
|
|
12
|
-
prev: boolean;
|
|
13
|
-
}
|
|
14
|
-
declare const MathEditorContainer: import("react").NamedExoticComponent<MathEditorContainerProps>;
|
|
15
|
-
export default MathEditorContainer;
|
|
@@ -1,112 +0,0 @@
|
|
|
1
|
-
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
2
|
-
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
3
|
-
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
4
|
-
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
5
|
-
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
6
|
-
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
7
|
-
import { Flexbox, Popover } from '@lobehub/ui';
|
|
8
|
-
import { memo, useCallback, useEffect, useRef, useState } from 'react';
|
|
9
|
-
import { cleanPosition, updatePosition } from "../../../../utils/updatePosition";
|
|
10
|
-
import { styles } from "../style";
|
|
11
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
12
|
-
var MathEditorContainer = /*#__PURE__*/memo(function (_ref) {
|
|
13
|
-
var children = _ref.children,
|
|
14
|
-
isBlockMode = _ref.isBlockMode,
|
|
15
|
-
mathDOM = _ref.mathDOM,
|
|
16
|
-
onFocus = _ref.onFocus,
|
|
17
|
-
prev = _ref.prev;
|
|
18
|
-
var anchorRef = useRef(null);
|
|
19
|
-
var _useState = useState(undefined),
|
|
20
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
21
|
-
blockWidth = _useState2[0],
|
|
22
|
-
setBlockWidth = _useState2[1];
|
|
23
|
-
var lastBlockWidthRef = useRef(undefined);
|
|
24
|
-
var setBlockWidthIfNeeded = useCallback(function (nextWidth) {
|
|
25
|
-
var normalizedWidth = typeof nextWidth === 'number' ? Math.round(nextWidth) : undefined;
|
|
26
|
-
if (lastBlockWidthRef.current === normalizedWidth) return;
|
|
27
|
-
lastBlockWidthRef.current = normalizedWidth;
|
|
28
|
-
setBlockWidth(normalizedWidth);
|
|
29
|
-
}, []);
|
|
30
|
-
var updateBlockWidth = useCallback(function () {
|
|
31
|
-
if (!isBlockMode) {
|
|
32
|
-
setBlockWidthIfNeeded(undefined);
|
|
33
|
-
return;
|
|
34
|
-
}
|
|
35
|
-
var editorContainer = mathDOM === null || mathDOM === void 0 ? void 0 : mathDOM.closest('[contenteditable="true"]');
|
|
36
|
-
if (editorContainer) {
|
|
37
|
-
setBlockWidthIfNeeded(editorContainer.getBoundingClientRect().width);
|
|
38
|
-
}
|
|
39
|
-
}, [isBlockMode, mathDOM, setBlockWidthIfNeeded]);
|
|
40
|
-
var updateAnchorPosition = useCallback(function () {
|
|
41
|
-
return updatePosition({
|
|
42
|
-
callback: function callback() {
|
|
43
|
-
if (!anchorRef.current || !mathDOM) return;
|
|
44
|
-
// 展示的时候聚焦
|
|
45
|
-
onFocus === null || onFocus === void 0 || onFocus();
|
|
46
|
-
updateBlockWidth();
|
|
47
|
-
},
|
|
48
|
-
floating: anchorRef.current,
|
|
49
|
-
placement: isBlockMode ? 'bottom-start' : 'bottom',
|
|
50
|
-
reference: mathDOM
|
|
51
|
-
});
|
|
52
|
-
}, [isBlockMode, mathDOM, onFocus, updateBlockWidth]);
|
|
53
|
-
var handleAnchorClick = useCallback(function () {
|
|
54
|
-
if (!mathDOM) return;
|
|
55
|
-
updateAnchorPosition();
|
|
56
|
-
}, [mathDOM, updateAnchorPosition]);
|
|
57
|
-
useEffect(function () {
|
|
58
|
-
if (!mathDOM || !anchorRef.current) return;
|
|
59
|
-
var floating = anchorRef.current;
|
|
60
|
-
|
|
61
|
-
// 监听尺寸变化,仅更新宽度/位置(不跟随 trigger 尺寸变化)
|
|
62
|
-
var resizeObserver = new ResizeObserver(function () {
|
|
63
|
-
updateBlockWidth();
|
|
64
|
-
});
|
|
65
|
-
resizeObserver.observe(floating);
|
|
66
|
-
var editorContainer = null;
|
|
67
|
-
if (isBlockMode) {
|
|
68
|
-
editorContainer = mathDOM.closest('[contenteditable="true"]');
|
|
69
|
-
if (editorContainer) resizeObserver.observe(editorContainer);
|
|
70
|
-
}
|
|
71
|
-
updateAnchorPosition();
|
|
72
|
-
|
|
73
|
-
// 窗口尺寸变化时也重新定位
|
|
74
|
-
window.addEventListener('resize', updateAnchorPosition);
|
|
75
|
-
return function () {
|
|
76
|
-
resizeObserver.disconnect();
|
|
77
|
-
window.removeEventListener('resize', updateAnchorPosition);
|
|
78
|
-
};
|
|
79
|
-
}, [mathDOM, prev, isBlockMode, updateAnchorPosition]);
|
|
80
|
-
|
|
81
|
-
// 当没有 mathDOM 时,隐藏容器
|
|
82
|
-
useEffect(function () {
|
|
83
|
-
if (mathDOM || !anchorRef.current) return;
|
|
84
|
-
cleanPosition(anchorRef.current);
|
|
85
|
-
}, [mathDOM]);
|
|
86
|
-
return /*#__PURE__*/_jsx(Popover, {
|
|
87
|
-
arrow: false,
|
|
88
|
-
content: /*#__PURE__*/_jsx(Flexbox, {
|
|
89
|
-
className: styles.mathEditor,
|
|
90
|
-
"data-math-editor-container": true,
|
|
91
|
-
style: blockWidth ? {
|
|
92
|
-
width: blockWidth
|
|
93
|
-
} : undefined,
|
|
94
|
-
children: children
|
|
95
|
-
}),
|
|
96
|
-
open: !!mathDOM,
|
|
97
|
-
placement: isBlockMode ? 'bottomLeft' : 'bottom',
|
|
98
|
-
styles: {
|
|
99
|
-
content: {
|
|
100
|
-
borderRadius: '6px',
|
|
101
|
-
padding: 0
|
|
102
|
-
}
|
|
103
|
-
},
|
|
104
|
-
children: /*#__PURE__*/_jsx("span", {
|
|
105
|
-
className: styles.mathEditorAnchor,
|
|
106
|
-
onClick: handleAnchorClick,
|
|
107
|
-
ref: anchorRef
|
|
108
|
-
})
|
|
109
|
-
});
|
|
110
|
-
});
|
|
111
|
-
MathEditorContainer.displayName = 'MathEditorContainer';
|
|
112
|
-
export default MathEditorContainer;
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
|
-
import { type TextAreaRef } from 'antd/es/input/TextArea';
|
|
3
|
-
import { MathBlockNode, MathInlineNode } from '../../node';
|
|
4
|
-
export interface MathEditorContentProps {
|
|
5
|
-
/** 焦点引用 */
|
|
6
|
-
focusRef?: (ref: TextAreaRef | null) => void;
|
|
7
|
-
/** 数学节点 */
|
|
8
|
-
mathNode: MathInlineNode | MathBlockNode | null;
|
|
9
|
-
/** 左箭头回调 */
|
|
10
|
-
onArrowLeft: () => void;
|
|
11
|
-
/** 右箭头回调 */
|
|
12
|
-
onArrowRight: () => void;
|
|
13
|
-
/** 取消回调 */
|
|
14
|
-
onCancel: () => void;
|
|
15
|
-
/** 删除节点回调 */
|
|
16
|
-
onDelete: () => void;
|
|
17
|
-
/** 提交回调 */
|
|
18
|
-
onSubmit: () => void;
|
|
19
|
-
/** 验证状态变化回调 */
|
|
20
|
-
onValidationChange?: (isValid: boolean) => void;
|
|
21
|
-
/** 值变化回调 */
|
|
22
|
-
onValueChange: (value: string) => void;
|
|
23
|
-
/** 是否从前一个位置进入 */
|
|
24
|
-
/** 当前输入值 */
|
|
25
|
-
value: string;
|
|
26
|
-
}
|
|
27
|
-
declare const MathEditorContent: import("react").NamedExoticComponent<MathEditorContentProps>;
|
|
28
|
-
export default MathEditorContent;
|
|
@@ -1,161 +0,0 @@
|
|
|
1
|
-
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
2
|
-
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
3
|
-
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
4
|
-
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
5
|
-
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
6
|
-
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
7
|
-
import { Button, Flexbox, Hotkey, Text, TextArea } from '@lobehub/ui';
|
|
8
|
-
import { renderToString } from 'katex';
|
|
9
|
-
import { isModifierMatch } from 'lexical';
|
|
10
|
-
import { memo, useCallback, useEffect, useRef, useState } from 'react';
|
|
11
|
-
import { CONTROL_OR_META } from "../../../../common/sys";
|
|
12
|
-
import { useTranslation } from "../../../../editor-kernel/react/useTranslation";
|
|
13
|
-
import { styles } from "../style";
|
|
14
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
15
|
-
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
16
|
-
import { Fragment as _Fragment } from "react/jsx-runtime";
|
|
17
|
-
var MathEditorContent = /*#__PURE__*/memo(function (_ref) {
|
|
18
|
-
var focusRef = _ref.focusRef,
|
|
19
|
-
mathNode = _ref.mathNode,
|
|
20
|
-
onArrowLeft = _ref.onArrowLeft,
|
|
21
|
-
onArrowRight = _ref.onArrowRight,
|
|
22
|
-
onCancel = _ref.onCancel,
|
|
23
|
-
onDelete = _ref.onDelete,
|
|
24
|
-
onSubmit = _ref.onSubmit,
|
|
25
|
-
onValidationChange = _ref.onValidationChange,
|
|
26
|
-
onValueChange = _ref.onValueChange,
|
|
27
|
-
value = _ref.value;
|
|
28
|
-
var t = useTranslation();
|
|
29
|
-
var textareaRef = useRef(null);
|
|
30
|
-
var _useState = useState(''),
|
|
31
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
32
|
-
latexError = _useState2[0],
|
|
33
|
-
setLatexError = _useState2[1];
|
|
34
|
-
|
|
35
|
-
// 将 ref 暴露给父组件
|
|
36
|
-
useEffect(function () {
|
|
37
|
-
focusRef === null || focusRef === void 0 || focusRef(textareaRef.current);
|
|
38
|
-
}, [focusRef]);
|
|
39
|
-
|
|
40
|
-
// // 聚焦和光标位置处理
|
|
41
|
-
// useEffect(() => {
|
|
42
|
-
// if (textareaRef.current) {
|
|
43
|
-
// textareaRef.current.focus();
|
|
44
|
-
// if (prev) {
|
|
45
|
-
// textareaRef.current.resizableTextArea?.textArea?.setSelectionRange(0, 0);
|
|
46
|
-
// }
|
|
47
|
-
// }
|
|
48
|
-
// }, [prev]);
|
|
49
|
-
|
|
50
|
-
// 实时验证 LaTeX 语法
|
|
51
|
-
useEffect(function () {
|
|
52
|
-
if (!mathNode) return;
|
|
53
|
-
var isEmpty = !value.trim();
|
|
54
|
-
if (isEmpty) {
|
|
55
|
-
setLatexError('');
|
|
56
|
-
onValidationChange === null || onValidationChange === void 0 || onValidationChange(true); // 空值视为有效
|
|
57
|
-
return;
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
// 使用防抖来避免过于频繁的验证
|
|
61
|
-
var timeoutId = setTimeout(function () {
|
|
62
|
-
try {
|
|
63
|
-
renderToString(value, {
|
|
64
|
-
displayMode: true,
|
|
65
|
-
throwOnError: true
|
|
66
|
-
});
|
|
67
|
-
// 验证成功:清除错误,通知父组件验证通过
|
|
68
|
-
setLatexError('');
|
|
69
|
-
onValidationChange === null || onValidationChange === void 0 || onValidationChange(true);
|
|
70
|
-
} catch (error) {
|
|
71
|
-
// 验证失败:设置错误信息,通知父组件验证失败
|
|
72
|
-
var errorMessage = error instanceof Error ? error.message : 'LaTeX Parse Error';
|
|
73
|
-
setLatexError(errorMessage);
|
|
74
|
-
onValidationChange === null || onValidationChange === void 0 || onValidationChange(false);
|
|
75
|
-
}
|
|
76
|
-
}, 50);
|
|
77
|
-
return function () {
|
|
78
|
-
return clearTimeout(timeoutId);
|
|
79
|
-
};
|
|
80
|
-
}, [value, mathNode, onValidationChange]);
|
|
81
|
-
var handleKeyDown = useCallback(function (e) {
|
|
82
|
-
if (!mathNode) return;
|
|
83
|
-
if (isModifierMatch(e, CONTROL_OR_META) && e.key === 'Enter') {
|
|
84
|
-
e.preventDefault();
|
|
85
|
-
onSubmit();
|
|
86
|
-
return;
|
|
87
|
-
}
|
|
88
|
-
if (e.key === 'Escape') {
|
|
89
|
-
e.preventDefault();
|
|
90
|
-
onCancel();
|
|
91
|
-
return;
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
// 当内容为空且按退格键时,删除数学节点
|
|
95
|
-
if (e.key === 'Backspace' && !value.trim()) {
|
|
96
|
-
e.preventDefault();
|
|
97
|
-
onDelete();
|
|
98
|
-
return;
|
|
99
|
-
}
|
|
100
|
-
if (e.key === 'ArrowLeft' && e.currentTarget.selectionStart === 0) {
|
|
101
|
-
e.preventDefault();
|
|
102
|
-
onArrowLeft();
|
|
103
|
-
}
|
|
104
|
-
if (e.key === 'ArrowRight' && e.currentTarget.selectionStart === e.currentTarget.value.length) {
|
|
105
|
-
e.preventDefault();
|
|
106
|
-
onArrowRight();
|
|
107
|
-
}
|
|
108
|
-
}, [mathNode, onSubmit, onCancel, onDelete, onArrowLeft, onArrowRight, value]);
|
|
109
|
-
return /*#__PURE__*/_jsxs(_Fragment, {
|
|
110
|
-
children: [/*#__PURE__*/_jsx(TextArea, {
|
|
111
|
-
autoFocus: true,
|
|
112
|
-
autoSize: {
|
|
113
|
-
maxRows: 6,
|
|
114
|
-
minRows: 1
|
|
115
|
-
},
|
|
116
|
-
className: styles.mathEditorTextArea,
|
|
117
|
-
onChange: function onChange(e) {
|
|
118
|
-
onValueChange(e.target.value);
|
|
119
|
-
},
|
|
120
|
-
onKeyDown: handleKeyDown,
|
|
121
|
-
placeholder: "".concat(t('math.placeholder'), "..."),
|
|
122
|
-
ref: textareaRef,
|
|
123
|
-
resize: false,
|
|
124
|
-
value: value,
|
|
125
|
-
variant: 'borderless'
|
|
126
|
-
}), latexError && /*#__PURE__*/_jsx(Flexbox, {
|
|
127
|
-
className: styles.mathEditorFooter,
|
|
128
|
-
horizontal: true,
|
|
129
|
-
paddingBlock: 4,
|
|
130
|
-
paddingInline: 12,
|
|
131
|
-
width: '100%',
|
|
132
|
-
children: /*#__PURE__*/_jsx(Text, {
|
|
133
|
-
fontSize: 13,
|
|
134
|
-
type: 'danger',
|
|
135
|
-
children: latexError
|
|
136
|
-
})
|
|
137
|
-
}), /*#__PURE__*/_jsx(Flexbox, {
|
|
138
|
-
className: styles.mathEditorFooter,
|
|
139
|
-
horizontal: true,
|
|
140
|
-
justify: 'flex-end',
|
|
141
|
-
padding: 4,
|
|
142
|
-
width: '100%',
|
|
143
|
-
children: /*#__PURE__*/_jsxs(Button, {
|
|
144
|
-
onClick: function onClick(e) {
|
|
145
|
-
e.preventDefault();
|
|
146
|
-
onSubmit();
|
|
147
|
-
},
|
|
148
|
-
size: 'small',
|
|
149
|
-
type: 'text',
|
|
150
|
-
variant: 'filled',
|
|
151
|
-
children: [t('confirm'), /*#__PURE__*/_jsx(Hotkey, {
|
|
152
|
-
compact: true,
|
|
153
|
-
keys: "mod+enter",
|
|
154
|
-
variant: 'borderless'
|
|
155
|
-
})]
|
|
156
|
-
})
|
|
157
|
-
})]
|
|
158
|
-
});
|
|
159
|
-
});
|
|
160
|
-
MathEditorContent.displayName = 'MathEditorContent';
|
|
161
|
-
export default MathEditorContent;
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { LexicalEditor } from 'lexical';
|
|
2
|
-
import { type FC } from 'react';
|
|
3
|
-
import { MathBlockNode, MathInlineNode } from '../../node';
|
|
4
|
-
export interface MathInlineProps {
|
|
5
|
-
className?: string;
|
|
6
|
-
editor: LexicalEditor;
|
|
7
|
-
node: MathInlineNode | MathBlockNode;
|
|
8
|
-
}
|
|
9
|
-
declare const MathInline: FC<MathInlineProps>;
|
|
10
|
-
export default MathInline;
|