@lobehub/editor 4.5.0 → 4.6.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/es/ReactSlashPlugin-GxCNaj2T.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 +37 -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,723 +0,0 @@
|
|
|
1
|
-
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
|
-
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
3
|
-
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
4
|
-
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
|
|
5
|
-
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); }
|
|
6
|
-
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; }
|
|
7
|
-
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
8
|
-
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
|
|
9
|
-
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
10
|
-
function _get() { if (typeof Reflect !== "undefined" && Reflect.get) { _get = Reflect.get.bind(); } else { _get = function _get(target, property, receiver) { var base = _superPropBase(target, property); if (!base) return; var desc = Object.getOwnPropertyDescriptor(base, property); if (desc.get) { return desc.get.call(arguments.length < 3 ? target : receiver); } return desc.value; }; } return _get.apply(this, arguments); }
|
|
11
|
-
function _superPropBase(object, property) { while (!Object.prototype.hasOwnProperty.call(object, property)) { object = _getPrototypeOf(object); if (object === null) break; } return object; }
|
|
12
|
-
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
|
13
|
-
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
14
|
-
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
15
|
-
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
|
|
16
|
-
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
17
|
-
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
18
|
-
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
19
|
-
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
20
|
-
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
21
|
-
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
22
|
-
/* eslint-disable @typescript-eslint/no-use-before-define */
|
|
23
|
-
import { $findMatchingParent, addClassNamesToElement, isHTMLAnchorElement } from '@lexical/utils';
|
|
24
|
-
import { $applyNodeReplacement, $getSelection, $isElementNode, $isNodeSelection, $isRangeSelection, $normalizeSelection__EXPERIMENTAL, $setSelection, ElementNode, createCommand } from 'lexical';
|
|
25
|
-
import { assert } from "../../../editor-kernel/utils";
|
|
26
|
-
import { createDebugLogger } from "../../../utils/debug";
|
|
27
|
-
var logger = createDebugLogger('plugin', 'link');
|
|
28
|
-
var SUPPORTED_URL_PROTOCOLS = new Set(['http:', 'https:', 'mailto:', 'sms:', 'tel:']);
|
|
29
|
-
export var HOVER_LINK_COMMAND = createCommand('HOVER_LINK_COMMAND');
|
|
30
|
-
export var HOVER_OUT_LINK_COMMAND = createCommand('HOVER_OUT_LINK_COMMAND');
|
|
31
|
-
|
|
32
|
-
/** @noInheritDoc */
|
|
33
|
-
export var LinkNode = /*#__PURE__*/function (_ElementNode) {
|
|
34
|
-
_inherits(LinkNode, _ElementNode);
|
|
35
|
-
var _super = _createSuper(LinkNode);
|
|
36
|
-
function LinkNode() {
|
|
37
|
-
var _this;
|
|
38
|
-
var url = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
|
|
39
|
-
var attributes = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
40
|
-
var key = arguments.length > 2 ? arguments[2] : undefined;
|
|
41
|
-
_classCallCheck(this, LinkNode);
|
|
42
|
-
_this = _super.call(this, key);
|
|
43
|
-
/** @internal */
|
|
44
|
-
_defineProperty(_assertThisInitialized(_this), "__url", void 0);
|
|
45
|
-
/** @internal */
|
|
46
|
-
_defineProperty(_assertThisInitialized(_this), "__target", void 0);
|
|
47
|
-
/** @internal */
|
|
48
|
-
_defineProperty(_assertThisInitialized(_this), "__rel", void 0);
|
|
49
|
-
/** @internal */
|
|
50
|
-
_defineProperty(_assertThisInitialized(_this), "__title", void 0);
|
|
51
|
-
var _attributes$target = attributes.target,
|
|
52
|
-
target = _attributes$target === void 0 ? null : _attributes$target,
|
|
53
|
-
_attributes$rel = attributes.rel,
|
|
54
|
-
rel = _attributes$rel === void 0 ? null : _attributes$rel,
|
|
55
|
-
_attributes$title = attributes.title,
|
|
56
|
-
title = _attributes$title === void 0 ? null : _attributes$title;
|
|
57
|
-
_this.__url = url;
|
|
58
|
-
_this.__target = target;
|
|
59
|
-
_this.__rel = rel;
|
|
60
|
-
_this.__title = title;
|
|
61
|
-
return _this;
|
|
62
|
-
}
|
|
63
|
-
_createClass(LinkNode, [{
|
|
64
|
-
key: "createDOM",
|
|
65
|
-
value: function createDOM(config, editor) {
|
|
66
|
-
var _this2 = this;
|
|
67
|
-
logger.debug('🔍 config', config);
|
|
68
|
-
var element = document.createElement('a');
|
|
69
|
-
this.updateLinkDOM(null, element, config);
|
|
70
|
-
addClassNamesToElement(element, config.theme.link);
|
|
71
|
-
element.addEventListener('mouseenter', function (event) {
|
|
72
|
-
if (event.target instanceof HTMLElement) {
|
|
73
|
-
event.target.classList.add('hover');
|
|
74
|
-
editor.dispatchCommand(HOVER_LINK_COMMAND, {
|
|
75
|
-
event: event,
|
|
76
|
-
linkNode: _this2
|
|
77
|
-
});
|
|
78
|
-
}
|
|
79
|
-
});
|
|
80
|
-
element.addEventListener('mouseleave', function (event) {
|
|
81
|
-
if (event.target instanceof HTMLElement) {
|
|
82
|
-
event.target.classList.remove('hover');
|
|
83
|
-
editor.dispatchCommand(HOVER_OUT_LINK_COMMAND, {
|
|
84
|
-
event: event
|
|
85
|
-
});
|
|
86
|
-
}
|
|
87
|
-
});
|
|
88
|
-
return element;
|
|
89
|
-
}
|
|
90
|
-
}, {
|
|
91
|
-
key: "updateLinkDOM",
|
|
92
|
-
value: function updateLinkDOM(prevNode, anchor,
|
|
93
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
94
|
-
_config) {
|
|
95
|
-
if (isHTMLAnchorElement(anchor)) {
|
|
96
|
-
if (!prevNode || prevNode.__url !== this.__url) {
|
|
97
|
-
anchor.href = this.sanitizeUrl(this.__url);
|
|
98
|
-
}
|
|
99
|
-
var _iterator = _createForOfIteratorHelper(['target', 'rel', 'title']),
|
|
100
|
-
_step;
|
|
101
|
-
try {
|
|
102
|
-
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
103
|
-
var attr = _step.value;
|
|
104
|
-
var key = "__".concat(attr);
|
|
105
|
-
var value = this[key];
|
|
106
|
-
if (!prevNode || prevNode[key] !== value) {
|
|
107
|
-
if (value) {
|
|
108
|
-
anchor[attr] = value;
|
|
109
|
-
} else {
|
|
110
|
-
anchor.removeAttribute(attr);
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
} catch (err) {
|
|
115
|
-
_iterator.e(err);
|
|
116
|
-
} finally {
|
|
117
|
-
_iterator.f();
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
}, {
|
|
122
|
-
key: "updateDOM",
|
|
123
|
-
value: function updateDOM(prevNode, anchor, config) {
|
|
124
|
-
this.updateLinkDOM(prevNode, anchor, config);
|
|
125
|
-
return false;
|
|
126
|
-
}
|
|
127
|
-
}, {
|
|
128
|
-
key: "updateFromJSON",
|
|
129
|
-
value: function updateFromJSON(serializedNode) {
|
|
130
|
-
return _get(_getPrototypeOf(LinkNode.prototype), "updateFromJSON", this).call(this, serializedNode).setURL(serializedNode.url).setRel(serializedNode.rel || null).setTarget(serializedNode.target || null).setTitle(serializedNode.title || null);
|
|
131
|
-
}
|
|
132
|
-
}, {
|
|
133
|
-
key: "sanitizeUrl",
|
|
134
|
-
value: function sanitizeUrl(url) {
|
|
135
|
-
// eslint-disable-next-line no-param-reassign
|
|
136
|
-
url = formatUrl(url);
|
|
137
|
-
try {
|
|
138
|
-
var parsedUrl = new URL(formatUrl(url));
|
|
139
|
-
// eslint-disable-next-line no-script-url
|
|
140
|
-
if (!SUPPORTED_URL_PROTOCOLS.has(parsedUrl.protocol)) {
|
|
141
|
-
return 'about:blank';
|
|
142
|
-
}
|
|
143
|
-
} catch (_unused) {
|
|
144
|
-
return url;
|
|
145
|
-
}
|
|
146
|
-
return url;
|
|
147
|
-
}
|
|
148
|
-
}, {
|
|
149
|
-
key: "exportJSON",
|
|
150
|
-
value: function exportJSON() {
|
|
151
|
-
return _objectSpread(_objectSpread({}, _get(_getPrototypeOf(LinkNode.prototype), "exportJSON", this).call(this)), {}, {
|
|
152
|
-
rel: this.getRel(),
|
|
153
|
-
target: this.getTarget(),
|
|
154
|
-
title: this.getTitle(),
|
|
155
|
-
url: this.getURL()
|
|
156
|
-
});
|
|
157
|
-
}
|
|
158
|
-
}, {
|
|
159
|
-
key: "getURL",
|
|
160
|
-
value: function getURL() {
|
|
161
|
-
return this.getLatest().__url;
|
|
162
|
-
}
|
|
163
|
-
}, {
|
|
164
|
-
key: "setURL",
|
|
165
|
-
value: function setURL(url) {
|
|
166
|
-
var writable = this.getWritable();
|
|
167
|
-
writable.__url = url;
|
|
168
|
-
return writable;
|
|
169
|
-
}
|
|
170
|
-
}, {
|
|
171
|
-
key: "getTarget",
|
|
172
|
-
value: function getTarget() {
|
|
173
|
-
return this.getLatest().__target;
|
|
174
|
-
}
|
|
175
|
-
}, {
|
|
176
|
-
key: "setTarget",
|
|
177
|
-
value: function setTarget(target) {
|
|
178
|
-
var writable = this.getWritable();
|
|
179
|
-
writable.__target = target;
|
|
180
|
-
return writable;
|
|
181
|
-
}
|
|
182
|
-
}, {
|
|
183
|
-
key: "getRel",
|
|
184
|
-
value: function getRel() {
|
|
185
|
-
return this.getLatest().__rel;
|
|
186
|
-
}
|
|
187
|
-
}, {
|
|
188
|
-
key: "setRel",
|
|
189
|
-
value: function setRel(rel) {
|
|
190
|
-
var writable = this.getWritable();
|
|
191
|
-
writable.__rel = rel;
|
|
192
|
-
return writable;
|
|
193
|
-
}
|
|
194
|
-
}, {
|
|
195
|
-
key: "getTitle",
|
|
196
|
-
value: function getTitle() {
|
|
197
|
-
return this.getLatest().__title;
|
|
198
|
-
}
|
|
199
|
-
}, {
|
|
200
|
-
key: "setTitle",
|
|
201
|
-
value: function setTitle(title) {
|
|
202
|
-
var writable = this.getWritable();
|
|
203
|
-
writable.__title = title;
|
|
204
|
-
return writable;
|
|
205
|
-
}
|
|
206
|
-
}, {
|
|
207
|
-
key: "insertNewAfter",
|
|
208
|
-
value: function insertNewAfter(_) {
|
|
209
|
-
var restoreSelection = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
|
|
210
|
-
var linkNode = $createLinkNode(this.__url, {
|
|
211
|
-
rel: this.__rel,
|
|
212
|
-
target: this.__target,
|
|
213
|
-
title: this.__title
|
|
214
|
-
});
|
|
215
|
-
this.insertAfter(linkNode, restoreSelection);
|
|
216
|
-
return linkNode;
|
|
217
|
-
}
|
|
218
|
-
}, {
|
|
219
|
-
key: "canInsertTextBefore",
|
|
220
|
-
value: function canInsertTextBefore() {
|
|
221
|
-
return false;
|
|
222
|
-
}
|
|
223
|
-
}, {
|
|
224
|
-
key: "canInsertTextAfter",
|
|
225
|
-
value: function canInsertTextAfter() {
|
|
226
|
-
return false;
|
|
227
|
-
}
|
|
228
|
-
}, {
|
|
229
|
-
key: "canBeEmpty",
|
|
230
|
-
value: function canBeEmpty() {
|
|
231
|
-
return false;
|
|
232
|
-
}
|
|
233
|
-
}, {
|
|
234
|
-
key: "isInline",
|
|
235
|
-
value: function isInline() {
|
|
236
|
-
return true;
|
|
237
|
-
}
|
|
238
|
-
}, {
|
|
239
|
-
key: "extractWithChild",
|
|
240
|
-
value: function extractWithChild(child, selection) {
|
|
241
|
-
if (!$isRangeSelection(selection)) {
|
|
242
|
-
return false;
|
|
243
|
-
}
|
|
244
|
-
var anchorNode = selection.anchor.getNode();
|
|
245
|
-
var focusNode = selection.focus.getNode();
|
|
246
|
-
return this.isParentOf(anchorNode) && this.isParentOf(focusNode) && selection.getTextContent().length > 0;
|
|
247
|
-
}
|
|
248
|
-
}, {
|
|
249
|
-
key: "isEmailURI",
|
|
250
|
-
value: function isEmailURI() {
|
|
251
|
-
return this.__url.startsWith('mailto:');
|
|
252
|
-
}
|
|
253
|
-
}, {
|
|
254
|
-
key: "isWebSiteURI",
|
|
255
|
-
value: function isWebSiteURI() {
|
|
256
|
-
return this.__url.startsWith('https://') || this.__url.startsWith('http://');
|
|
257
|
-
}
|
|
258
|
-
}], [{
|
|
259
|
-
key: "getType",
|
|
260
|
-
value: function getType() {
|
|
261
|
-
return 'link';
|
|
262
|
-
}
|
|
263
|
-
}, {
|
|
264
|
-
key: "clone",
|
|
265
|
-
value: function clone(node) {
|
|
266
|
-
return new LinkNode(node.__url, {
|
|
267
|
-
rel: node.__rel,
|
|
268
|
-
target: node.__target,
|
|
269
|
-
title: node.__title
|
|
270
|
-
}, node.__key);
|
|
271
|
-
}
|
|
272
|
-
}, {
|
|
273
|
-
key: "importDOM",
|
|
274
|
-
value: function importDOM() {
|
|
275
|
-
return {
|
|
276
|
-
a: function a() {
|
|
277
|
-
return {
|
|
278
|
-
conversion: $convertAnchorElement,
|
|
279
|
-
priority: 1
|
|
280
|
-
};
|
|
281
|
-
}
|
|
282
|
-
};
|
|
283
|
-
}
|
|
284
|
-
}, {
|
|
285
|
-
key: "importJSON",
|
|
286
|
-
value: function importJSON(serializedNode) {
|
|
287
|
-
return $createLinkNode().updateFromJSON(serializedNode);
|
|
288
|
-
}
|
|
289
|
-
}]);
|
|
290
|
-
return LinkNode;
|
|
291
|
-
}(ElementNode);
|
|
292
|
-
function $convertAnchorElement(domNode) {
|
|
293
|
-
var node = null;
|
|
294
|
-
if (isHTMLAnchorElement(domNode)) {
|
|
295
|
-
var content = domNode.textContent;
|
|
296
|
-
if (content !== null && content !== '' || domNode.children.length > 0) {
|
|
297
|
-
node = $createLinkNode(domNode.getAttribute('href') || '', {
|
|
298
|
-
rel: domNode.getAttribute('rel'),
|
|
299
|
-
target: domNode.getAttribute('target'),
|
|
300
|
-
title: domNode.getAttribute('title')
|
|
301
|
-
});
|
|
302
|
-
}
|
|
303
|
-
}
|
|
304
|
-
return {
|
|
305
|
-
node: node
|
|
306
|
-
};
|
|
307
|
-
}
|
|
308
|
-
|
|
309
|
-
/**
|
|
310
|
-
* Takes a URL and creates a LinkNode.
|
|
311
|
-
* @param url - The URL the LinkNode should direct to.
|
|
312
|
-
* @param attributes - Optional HTML a tag attributes \\{ target, rel, title \\}
|
|
313
|
-
* @returns The LinkNode.
|
|
314
|
-
*/
|
|
315
|
-
export function $createLinkNode() {
|
|
316
|
-
var url = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
|
|
317
|
-
var attributes = arguments.length > 1 ? arguments[1] : undefined;
|
|
318
|
-
return $applyNodeReplacement(new LinkNode(url, attributes));
|
|
319
|
-
}
|
|
320
|
-
|
|
321
|
-
/**
|
|
322
|
-
* Determines if node is a LinkNode.
|
|
323
|
-
* @param node - The node to be checked.
|
|
324
|
-
* @returns true if node is a LinkNode, false otherwise.
|
|
325
|
-
*/
|
|
326
|
-
export function $isLinkNode(node) {
|
|
327
|
-
return node instanceof LinkNode;
|
|
328
|
-
}
|
|
329
|
-
// Custom node type to override `canInsertTextAfter` that will
|
|
330
|
-
// allow typing within the link
|
|
331
|
-
export var AutoLinkNode = /*#__PURE__*/function (_LinkNode) {
|
|
332
|
-
_inherits(AutoLinkNode, _LinkNode);
|
|
333
|
-
var _super2 = _createSuper(AutoLinkNode);
|
|
334
|
-
function AutoLinkNode() {
|
|
335
|
-
var _this3;
|
|
336
|
-
var url = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
|
|
337
|
-
var attributes = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
338
|
-
var key = arguments.length > 2 ? arguments[2] : undefined;
|
|
339
|
-
_classCallCheck(this, AutoLinkNode);
|
|
340
|
-
_this3 = _super2.call(this, url, attributes, key);
|
|
341
|
-
/** @internal */
|
|
342
|
-
/** Indicates whether the autolink was ever unlinked. **/
|
|
343
|
-
_defineProperty(_assertThisInitialized(_this3), "__isUnlinked", void 0);
|
|
344
|
-
_this3.__isUnlinked = attributes.isUnlinked !== undefined && attributes.isUnlinked !== null ? attributes.isUnlinked : false;
|
|
345
|
-
return _this3;
|
|
346
|
-
}
|
|
347
|
-
_createClass(AutoLinkNode, [{
|
|
348
|
-
key: "getIsUnlinked",
|
|
349
|
-
value: function getIsUnlinked() {
|
|
350
|
-
return this.__isUnlinked;
|
|
351
|
-
}
|
|
352
|
-
}, {
|
|
353
|
-
key: "setIsUnlinked",
|
|
354
|
-
value: function setIsUnlinked(value) {
|
|
355
|
-
var self = this.getWritable();
|
|
356
|
-
self.__isUnlinked = value;
|
|
357
|
-
return self;
|
|
358
|
-
}
|
|
359
|
-
}, {
|
|
360
|
-
key: "createDOM",
|
|
361
|
-
value: function createDOM(config, editor) {
|
|
362
|
-
logger.debug('🔍 config', config);
|
|
363
|
-
if (this.__isUnlinked) {
|
|
364
|
-
return document.createElement('span');
|
|
365
|
-
} else {
|
|
366
|
-
return _get(_getPrototypeOf(AutoLinkNode.prototype), "createDOM", this).call(this, config, editor);
|
|
367
|
-
}
|
|
368
|
-
}
|
|
369
|
-
}, {
|
|
370
|
-
key: "updateDOM",
|
|
371
|
-
value: function updateDOM(prevNode, anchor, config) {
|
|
372
|
-
return _get(_getPrototypeOf(AutoLinkNode.prototype), "updateDOM", this).call(this, prevNode, anchor, config) || prevNode.__isUnlinked !== this.__isUnlinked;
|
|
373
|
-
}
|
|
374
|
-
}, {
|
|
375
|
-
key: "updateFromJSON",
|
|
376
|
-
value: function updateFromJSON(serializedNode) {
|
|
377
|
-
return _get(_getPrototypeOf(AutoLinkNode.prototype), "updateFromJSON", this).call(this, serializedNode).setIsUnlinked(serializedNode.isUnlinked || false);
|
|
378
|
-
}
|
|
379
|
-
}, {
|
|
380
|
-
key: "exportJSON",
|
|
381
|
-
value: function exportJSON() {
|
|
382
|
-
return _objectSpread(_objectSpread({}, _get(_getPrototypeOf(AutoLinkNode.prototype), "exportJSON", this).call(this)), {}, {
|
|
383
|
-
isUnlinked: this.__isUnlinked
|
|
384
|
-
});
|
|
385
|
-
}
|
|
386
|
-
}, {
|
|
387
|
-
key: "insertNewAfter",
|
|
388
|
-
value: function insertNewAfter(selection) {
|
|
389
|
-
var restoreSelection = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
|
|
390
|
-
var element = this.getParentOrThrow().insertNewAfter(selection, restoreSelection);
|
|
391
|
-
if ($isElementNode(element)) {
|
|
392
|
-
var linkNode = $createAutoLinkNode(this.__url, {
|
|
393
|
-
isUnlinked: this.__isUnlinked,
|
|
394
|
-
rel: this.__rel,
|
|
395
|
-
target: this.__target,
|
|
396
|
-
title: this.__title
|
|
397
|
-
});
|
|
398
|
-
element.append(linkNode);
|
|
399
|
-
return linkNode;
|
|
400
|
-
}
|
|
401
|
-
return null;
|
|
402
|
-
}
|
|
403
|
-
}], [{
|
|
404
|
-
key: "getType",
|
|
405
|
-
value: function getType() {
|
|
406
|
-
return 'autolink';
|
|
407
|
-
}
|
|
408
|
-
}, {
|
|
409
|
-
key: "clone",
|
|
410
|
-
value: function clone(node) {
|
|
411
|
-
return new AutoLinkNode(node.__url, {
|
|
412
|
-
isUnlinked: node.__isUnlinked,
|
|
413
|
-
rel: node.__rel,
|
|
414
|
-
target: node.__target,
|
|
415
|
-
title: node.__title
|
|
416
|
-
}, node.__key);
|
|
417
|
-
}
|
|
418
|
-
}, {
|
|
419
|
-
key: "importJSON",
|
|
420
|
-
value: function importJSON(serializedNode) {
|
|
421
|
-
return $createAutoLinkNode().updateFromJSON(serializedNode);
|
|
422
|
-
}
|
|
423
|
-
}, {
|
|
424
|
-
key: "importDOM",
|
|
425
|
-
value: function importDOM() {
|
|
426
|
-
// TODO: Should link node should handle the import over autolink?
|
|
427
|
-
return null;
|
|
428
|
-
}
|
|
429
|
-
}]);
|
|
430
|
-
return AutoLinkNode;
|
|
431
|
-
}(LinkNode);
|
|
432
|
-
|
|
433
|
-
/**
|
|
434
|
-
* Takes a URL and creates an AutoLinkNode. AutoLinkNodes are generally automatically generated
|
|
435
|
-
* during typing, which is especially useful when a button to generate a LinkNode is not practical.
|
|
436
|
-
* @param url - The URL the LinkNode should direct to.
|
|
437
|
-
* @param attributes - Optional HTML a tag attributes. \\{ target, rel, title \\}
|
|
438
|
-
* @returns The LinkNode.
|
|
439
|
-
*/
|
|
440
|
-
export function $createAutoLinkNode() {
|
|
441
|
-
var url = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
|
|
442
|
-
var attributes = arguments.length > 1 ? arguments[1] : undefined;
|
|
443
|
-
return $applyNodeReplacement(new AutoLinkNode(url, attributes));
|
|
444
|
-
}
|
|
445
|
-
|
|
446
|
-
/**
|
|
447
|
-
* Determines if node is an AutoLinkNode.
|
|
448
|
-
* @param node - The node to be checked.
|
|
449
|
-
* @returns true if node is an AutoLinkNode, false otherwise.
|
|
450
|
-
*/
|
|
451
|
-
export function $isAutoLinkNode(node) {
|
|
452
|
-
return node instanceof AutoLinkNode;
|
|
453
|
-
}
|
|
454
|
-
export var TOGGLE_LINK_COMMAND = createCommand('TOGGLE_LINK_COMMAND');
|
|
455
|
-
function $getPointNode(point, offset) {
|
|
456
|
-
if (point.type === 'element') {
|
|
457
|
-
var node = point.getNode();
|
|
458
|
-
assert($isElementNode(node), '$getPointNode: element point is not an ElementNode');
|
|
459
|
-
var childNode = node.getChildren()[point.offset + offset];
|
|
460
|
-
return childNode || null;
|
|
461
|
-
}
|
|
462
|
-
return null;
|
|
463
|
-
}
|
|
464
|
-
|
|
465
|
-
/**
|
|
466
|
-
* Preserve the logical start/end of a RangeSelection in situations where
|
|
467
|
-
* the point is an element that may be reparented in the callback.
|
|
468
|
-
*
|
|
469
|
-
* @param $fn The function to run
|
|
470
|
-
* @returns The result of the callback
|
|
471
|
-
*/
|
|
472
|
-
function $withSelectedNodes($fn) {
|
|
473
|
-
var initialSelection = $getSelection();
|
|
474
|
-
if (!$isRangeSelection(initialSelection)) {
|
|
475
|
-
return $fn();
|
|
476
|
-
}
|
|
477
|
-
var normalized = $normalizeSelection__EXPERIMENTAL(initialSelection);
|
|
478
|
-
var isBackwards = normalized.isBackward();
|
|
479
|
-
var anchorNode = $getPointNode(normalized.anchor, isBackwards ? -1 : 0);
|
|
480
|
-
var focusNode = $getPointNode(normalized.focus, isBackwards ? 0 : -1);
|
|
481
|
-
var rval = $fn();
|
|
482
|
-
if (anchorNode || focusNode) {
|
|
483
|
-
var updatedSelection = $getSelection();
|
|
484
|
-
if ($isRangeSelection(updatedSelection)) {
|
|
485
|
-
var finalSelection = updatedSelection.clone();
|
|
486
|
-
if (anchorNode) {
|
|
487
|
-
var anchorParent = anchorNode.getParent();
|
|
488
|
-
if (anchorParent) {
|
|
489
|
-
finalSelection.anchor.set(anchorParent.getKey(), anchorNode.getIndexWithinParent() + (isBackwards ? 1 : 0), 'element');
|
|
490
|
-
}
|
|
491
|
-
}
|
|
492
|
-
if (focusNode) {
|
|
493
|
-
var focusParent = focusNode.getParent();
|
|
494
|
-
if (focusParent) {
|
|
495
|
-
finalSelection.focus.set(focusParent.getKey(), focusNode.getIndexWithinParent() + (isBackwards ? 0 : 1), 'element');
|
|
496
|
-
}
|
|
497
|
-
}
|
|
498
|
-
$setSelection($normalizeSelection__EXPERIMENTAL(finalSelection));
|
|
499
|
-
}
|
|
500
|
-
}
|
|
501
|
-
return rval;
|
|
502
|
-
}
|
|
503
|
-
|
|
504
|
-
/**
|
|
505
|
-
* Generates or updates a LinkNode. It can also delete a LinkNode if the URL is null,
|
|
506
|
-
* but saves any children and brings them up to the parent node.
|
|
507
|
-
* @param url - The URL the link directs to.
|
|
508
|
-
* @param attributes - Optional HTML a tag attributes. \\{ target, rel, title \\}
|
|
509
|
-
*/
|
|
510
|
-
export function $toggleLink(url) {
|
|
511
|
-
var attributes = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
512
|
-
var target = attributes.target,
|
|
513
|
-
title = attributes.title;
|
|
514
|
-
var rel = attributes.rel === undefined ? 'noreferrer' : attributes.rel;
|
|
515
|
-
var selection = $getSelection();
|
|
516
|
-
if (selection === null || !$isRangeSelection(selection) && !$isNodeSelection(selection)) {
|
|
517
|
-
return;
|
|
518
|
-
}
|
|
519
|
-
if ($isNodeSelection(selection)) {
|
|
520
|
-
var _nodes = selection.getNodes();
|
|
521
|
-
if (_nodes.length === 0) {
|
|
522
|
-
return;
|
|
523
|
-
}
|
|
524
|
-
|
|
525
|
-
// Handle all selected nodes
|
|
526
|
-
_nodes.forEach(function (node) {
|
|
527
|
-
if (url === null) {
|
|
528
|
-
// Remove link
|
|
529
|
-
var linkParent = $findMatchingParent(node, function (parent) {
|
|
530
|
-
return !$isAutoLinkNode(parent) && $isLinkNode(parent);
|
|
531
|
-
});
|
|
532
|
-
if (linkParent) {
|
|
533
|
-
linkParent.insertBefore(node);
|
|
534
|
-
if (linkParent.getChildren().length === 0) {
|
|
535
|
-
linkParent.remove();
|
|
536
|
-
}
|
|
537
|
-
}
|
|
538
|
-
} else {
|
|
539
|
-
// Add/Update link
|
|
540
|
-
var existingLink = $findMatchingParent(node, function (parent) {
|
|
541
|
-
return !$isAutoLinkNode(parent) && $isLinkNode(parent);
|
|
542
|
-
});
|
|
543
|
-
if (existingLink) {
|
|
544
|
-
existingLink.setURL(url);
|
|
545
|
-
if (target !== undefined) {
|
|
546
|
-
existingLink.setTarget(target);
|
|
547
|
-
}
|
|
548
|
-
if (rel !== undefined) {
|
|
549
|
-
existingLink.setRel(rel);
|
|
550
|
-
}
|
|
551
|
-
} else {
|
|
552
|
-
var linkNode = $createLinkNode(url, {
|
|
553
|
-
rel: rel,
|
|
554
|
-
target: target
|
|
555
|
-
});
|
|
556
|
-
node.insertBefore(linkNode);
|
|
557
|
-
linkNode.append(node);
|
|
558
|
-
}
|
|
559
|
-
}
|
|
560
|
-
});
|
|
561
|
-
return;
|
|
562
|
-
}
|
|
563
|
-
|
|
564
|
-
// Handle RangeSelection
|
|
565
|
-
var nodes = selection.extract();
|
|
566
|
-
if (url === null) {
|
|
567
|
-
// Remove LinkNodes
|
|
568
|
-
nodes.forEach(function (node) {
|
|
569
|
-
var parentLink = $findMatchingParent(node, function (parent) {
|
|
570
|
-
return !$isAutoLinkNode(parent) && $isLinkNode(parent);
|
|
571
|
-
});
|
|
572
|
-
if (parentLink) {
|
|
573
|
-
var children = parentLink.getChildren();
|
|
574
|
-
var _iterator2 = _createForOfIteratorHelper(children),
|
|
575
|
-
_step2;
|
|
576
|
-
try {
|
|
577
|
-
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
|
578
|
-
var child = _step2.value;
|
|
579
|
-
parentLink.insertBefore(child);
|
|
580
|
-
}
|
|
581
|
-
} catch (err) {
|
|
582
|
-
_iterator2.e(err);
|
|
583
|
-
} finally {
|
|
584
|
-
_iterator2.f();
|
|
585
|
-
}
|
|
586
|
-
parentLink.remove();
|
|
587
|
-
}
|
|
588
|
-
});
|
|
589
|
-
return;
|
|
590
|
-
}
|
|
591
|
-
var updatedNodes = new Set();
|
|
592
|
-
var updateLinkNode = function updateLinkNode(linkNode) {
|
|
593
|
-
if (updatedNodes.has(linkNode.getKey())) {
|
|
594
|
-
return;
|
|
595
|
-
}
|
|
596
|
-
updatedNodes.add(linkNode.getKey());
|
|
597
|
-
linkNode.setURL(url);
|
|
598
|
-
if (target !== undefined) {
|
|
599
|
-
linkNode.setTarget(target);
|
|
600
|
-
}
|
|
601
|
-
if (rel !== undefined) {
|
|
602
|
-
linkNode.setRel(rel);
|
|
603
|
-
}
|
|
604
|
-
if (title !== undefined) {
|
|
605
|
-
linkNode.setTitle(title);
|
|
606
|
-
}
|
|
607
|
-
};
|
|
608
|
-
// Add or merge LinkNodes
|
|
609
|
-
if (nodes.length === 1) {
|
|
610
|
-
var firstNode = nodes[0];
|
|
611
|
-
// if the first node is a LinkNode or if its
|
|
612
|
-
// parent is a LinkNode, we update the URL, target and rel.
|
|
613
|
-
var linkNode = $getAncestor(firstNode, $isLinkNode);
|
|
614
|
-
if (linkNode !== null) {
|
|
615
|
-
return updateLinkNode(linkNode);
|
|
616
|
-
}
|
|
617
|
-
}
|
|
618
|
-
$withSelectedNodes(function () {
|
|
619
|
-
var linkNode = null;
|
|
620
|
-
var _iterator3 = _createForOfIteratorHelper(nodes),
|
|
621
|
-
_step3;
|
|
622
|
-
try {
|
|
623
|
-
for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
|
|
624
|
-
var node = _step3.value;
|
|
625
|
-
if (!node.isAttached()) {
|
|
626
|
-
continue;
|
|
627
|
-
}
|
|
628
|
-
var parentLinkNode = $getAncestor(node, $isLinkNode);
|
|
629
|
-
if (parentLinkNode) {
|
|
630
|
-
updateLinkNode(parentLinkNode);
|
|
631
|
-
continue;
|
|
632
|
-
}
|
|
633
|
-
if ($isElementNode(node)) {
|
|
634
|
-
if (!node.isInline()) {
|
|
635
|
-
// Ignore block nodes, if there are any children we will see them
|
|
636
|
-
// later and wrap in a new LinkNode
|
|
637
|
-
continue;
|
|
638
|
-
}
|
|
639
|
-
if ($isLinkNode(node)) {
|
|
640
|
-
// If it's not an autolink node and we don't already have a LinkNode
|
|
641
|
-
// in this block then we can update it and re-use it
|
|
642
|
-
if (!$isAutoLinkNode(node) && (linkNode === null || !linkNode.getParentOrThrow().isParentOf(node))) {
|
|
643
|
-
updateLinkNode(node);
|
|
644
|
-
linkNode = node;
|
|
645
|
-
continue;
|
|
646
|
-
}
|
|
647
|
-
// Unwrap LinkNode, we already have one or it's an AutoLinkNode
|
|
648
|
-
var _iterator4 = _createForOfIteratorHelper(node.getChildren()),
|
|
649
|
-
_step4;
|
|
650
|
-
try {
|
|
651
|
-
for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
|
|
652
|
-
var child = _step4.value;
|
|
653
|
-
node.insertBefore(child);
|
|
654
|
-
}
|
|
655
|
-
} catch (err) {
|
|
656
|
-
_iterator4.e(err);
|
|
657
|
-
} finally {
|
|
658
|
-
_iterator4.f();
|
|
659
|
-
}
|
|
660
|
-
node.remove();
|
|
661
|
-
continue;
|
|
662
|
-
}
|
|
663
|
-
}
|
|
664
|
-
var prevLinkNode = node.getPreviousSibling();
|
|
665
|
-
if ($isLinkNode(prevLinkNode) && prevLinkNode.is(linkNode)) {
|
|
666
|
-
prevLinkNode.append(node);
|
|
667
|
-
continue;
|
|
668
|
-
}
|
|
669
|
-
linkNode = $createLinkNode(url, {
|
|
670
|
-
rel: rel,
|
|
671
|
-
target: target,
|
|
672
|
-
title: title
|
|
673
|
-
});
|
|
674
|
-
node.insertAfter(linkNode);
|
|
675
|
-
linkNode.append(node);
|
|
676
|
-
}
|
|
677
|
-
} catch (err) {
|
|
678
|
-
_iterator3.e(err);
|
|
679
|
-
} finally {
|
|
680
|
-
_iterator3.f();
|
|
681
|
-
}
|
|
682
|
-
});
|
|
683
|
-
}
|
|
684
|
-
/** @deprecated renamed to {@link $toggleLink} by @lexical/eslint-plugin rules-of-lexical */
|
|
685
|
-
export var toggleLink = $toggleLink;
|
|
686
|
-
function $getAncestor(node, predicate) {
|
|
687
|
-
var parent = node;
|
|
688
|
-
while (parent !== null && parent.getParent() !== null && !predicate(parent)) {
|
|
689
|
-
parent = parent.getParentOrThrow();
|
|
690
|
-
}
|
|
691
|
-
return predicate(parent) ? parent : null;
|
|
692
|
-
}
|
|
693
|
-
var PHONE_NUMBER_REGEX = /^\+?[\d\s()-]{5,}$/;
|
|
694
|
-
|
|
695
|
-
/**
|
|
696
|
-
* Formats a URL string by adding appropriate protocol if missing
|
|
697
|
-
*
|
|
698
|
-
* @param url - URL to format
|
|
699
|
-
* @returns Formatted URL with appropriate protocol
|
|
700
|
-
*/
|
|
701
|
-
export function formatUrl(url) {
|
|
702
|
-
// Check if URL already has a protocol
|
|
703
|
-
if (/^[a-z][\d+.a-z-]*:/i.test(url)) {
|
|
704
|
-
// URL already has a protocol, leave it as is
|
|
705
|
-
return url;
|
|
706
|
-
}
|
|
707
|
-
// Check if it's a relative path (starting with '/', '.', or '#')
|
|
708
|
-
else if (/^[#./]/.test(url)) {
|
|
709
|
-
// Relative path, leave it as is
|
|
710
|
-
return url;
|
|
711
|
-
}
|
|
712
|
-
|
|
713
|
-
// Check for email address
|
|
714
|
-
else if (url.includes('@')) {
|
|
715
|
-
return "mailto:".concat(url);
|
|
716
|
-
}
|
|
717
|
-
|
|
718
|
-
// Check for phone number
|
|
719
|
-
else if (PHONE_NUMBER_REGEX.test(url)) {
|
|
720
|
-
return "tel:".concat(url);
|
|
721
|
-
}
|
|
722
|
-
return url;
|
|
723
|
-
}
|