@haklex/rich-editor 0.69.0 → 0.69.2
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/dist/{theme-DH4xzxU-.js → ColorSchemeContext-DLWz8vFw.js} +1349 -92
- package/dist/{thumbhash-GjK8OYAb.js → LinkCardRenderer-D4mQbUQo.js} +109 -31
- package/dist/NestedEditorPluginsContext-DKFdozOE.js +8 -0
- package/dist/{ExtraNodesContext-xQ2RNsqH.js → RendererConfigProvider-BPYO0Ip0.js} +37 -7
- package/dist/{RubyRenderer-8HMSMaZz.js → RubyRenderer-BuFWY87e.js} +2 -1
- package/dist/SpoilerNode-D7Tgdo2K.js +82 -0
- package/dist/{VirtualizationPlugin-nD_x-4yR.js → VirtualizationPlugin-CkNi6FW2.js} +85 -53
- package/dist/{VirtualizationPlugin-Bqv4MkJH.js → VirtualizationPlugin-DbAHlGBL.js} +358 -172
- package/dist/{VirtualizedEditor-uWe43zaI.js → VirtualizedEditor-D099IYqN.js} +54 -41
- package/dist/block-id-state-DfN32rR_.js +5 -0
- package/dist/command-registry-entry.d.ts.map +1 -1
- package/dist/commands/registry.d.ts +2 -2
- package/dist/commands/registry.d.ts.map +1 -1
- package/dist/commands-entry.d.ts +1 -4
- package/dist/commands-entry.d.ts.map +1 -1
- package/dist/commands-entry.mjs +2 -2
- package/dist/components/ContentEditable.css.d.ts.map +1 -1
- package/dist/components/ContentEditable.d.ts +1 -1
- package/dist/components/ContentEditable.d.ts.map +1 -1
- package/dist/components/CorePlugins.d.ts +1 -1
- package/dist/components/CorePlugins.d.ts.map +1 -1
- package/dist/components/EditorSurfaceHost.d.ts +2 -2
- package/dist/components/EditorSurfaceHost.d.ts.map +1 -1
- package/dist/components/LinkFavicon.d.ts +1 -1
- package/dist/components/LinkFavicon.d.ts.map +1 -1
- package/dist/components/RendererWrapper.d.ts +5 -16
- package/dist/components/RendererWrapper.d.ts.map +1 -1
- package/dist/components/RichEditor.d.ts +2 -2
- package/dist/components/RichEditor.d.ts.map +1 -1
- package/dist/components/RichEditorShell.d.ts +7 -7
- package/dist/components/RichEditorShell.d.ts.map +1 -1
- package/dist/components/VirtualizationFromProps.d.ts +2 -2
- package/dist/components/VirtualizationFromProps.d.ts.map +1 -1
- package/dist/components/decorators/AlertEditDecorator.d.ts +3 -3
- package/dist/components/decorators/AlertEditDecorator.d.ts.map +1 -1
- package/dist/components/decorators/BannerEditDecorator.d.ts +3 -3
- package/dist/components/decorators/BannerEditDecorator.d.ts.map +1 -1
- package/dist/components/decorators/CodeBlockEditDecorator.d.ts +1 -1
- package/dist/components/decorators/CodeBlockEditDecorator.d.ts.map +1 -1
- package/dist/components/decorators/GridEditDecorator.d.ts +2 -2
- package/dist/components/decorators/GridEditDecorator.d.ts.map +1 -1
- package/dist/components/decorators/NestedEditorCorePlugins.d.ts +1 -1
- package/dist/components/decorators/NestedEditorCorePlugins.d.ts.map +1 -1
- package/dist/components/decorators/gridAutoFocus.d.ts +1 -1
- package/dist/components/decorators/gridAutoFocus.d.ts.map +1 -1
- package/dist/components/decorators/useNestedEditorSync.d.ts +1 -1
- package/dist/components/decorators/useNestedEditorSync.d.ts.map +1 -1
- package/dist/components/renderer-decoration.d.ts +13 -0
- package/dist/components/renderer-decoration.d.ts.map +1 -0
- package/dist/components/renderers/AlertRenderer.d.ts +2 -2
- package/dist/components/renderers/AlertRenderer.d.ts.map +1 -1
- package/dist/components/renderers/AlertStaticDecorator.d.ts +3 -3
- package/dist/components/renderers/AlertStaticDecorator.d.ts.map +1 -1
- package/dist/components/renderers/BannerRenderer.d.ts +2 -2
- package/dist/components/renderers/BannerRenderer.d.ts.map +1 -1
- package/dist/components/renderers/BannerStaticDecorator.d.ts +3 -3
- package/dist/components/renderers/BannerStaticDecorator.d.ts.map +1 -1
- package/dist/components/renderers/CodeBlockRenderer.d.ts +1 -1
- package/dist/components/renderers/CodeBlockRenderer.d.ts.map +1 -1
- package/dist/components/renderers/FileRenderer.d.ts +1 -4
- package/dist/components/renderers/FileRenderer.d.ts.map +1 -1
- package/dist/components/renderers/FootnoteRenderer.d.ts +1 -1
- package/dist/components/renderers/FootnoteRenderer.d.ts.map +1 -1
- package/dist/components/renderers/FootnoteSectionEditRenderer.d.ts +1 -1
- package/dist/components/renderers/FootnoteSectionEditRenderer.d.ts.map +1 -1
- package/dist/components/renderers/FootnoteSectionRenderer.d.ts +1 -1
- package/dist/components/renderers/FootnoteSectionRenderer.d.ts.map +1 -1
- package/dist/components/renderers/FootnoteStaticRenderer.d.ts +1 -1
- package/dist/components/renderers/FootnoteStaticRenderer.d.ts.map +1 -1
- package/dist/components/renderers/GridStaticDecorator.d.ts +2 -2
- package/dist/components/renderers/GridStaticDecorator.d.ts.map +1 -1
- package/dist/components/renderers/ImageRenderer.d.ts +2 -2
- package/dist/components/renderers/ImageRenderer.d.ts.map +1 -1
- package/dist/components/renderers/KaTeXRenderer.d.ts +1 -1
- package/dist/components/renderers/KaTeXRenderer.d.ts.map +1 -1
- package/dist/components/renderers/LinkCardRenderer.d.ts +1 -1
- package/dist/components/renderers/LinkCardRenderer.d.ts.map +1 -1
- package/dist/components/renderers/MentionRenderer.d.ts +1 -1
- package/dist/components/renderers/MentionRenderer.d.ts.map +1 -1
- package/dist/components/renderers/MermaidRenderer.d.ts +1 -1
- package/dist/components/renderers/MermaidRenderer.d.ts.map +1 -1
- package/dist/components/renderers/RubyRenderer.d.ts +2 -2
- package/dist/components/renderers/RubyRenderer.d.ts.map +1 -1
- package/dist/components/renderers/TagRenderer.d.ts +1 -2
- package/dist/components/renderers/TagRenderer.d.ts.map +1 -1
- package/dist/components/renderers/VideoRenderer.d.ts +1 -1
- package/dist/components/renderers/VideoRenderer.d.ts.map +1 -1
- package/dist/components/utils.d.ts +1 -1
- package/dist/components/utils.d.ts.map +1 -1
- package/dist/config-edit.d.ts +1 -1
- package/dist/config-edit.d.ts.map +1 -1
- package/dist/config.d.ts +1 -1
- package/dist/config.d.ts.map +1 -1
- package/dist/context/ColorSchemeContext.d.ts +1 -5
- package/dist/context/ColorSchemeContext.d.ts.map +1 -1
- package/dist/context/ColorSchemeProvider.d.ts +7 -0
- package/dist/context/ColorSchemeProvider.d.ts.map +1 -0
- package/dist/context/EditorBlockContext.d.ts +2 -2
- package/dist/context/EditorBlockContext.d.ts.map +1 -1
- package/dist/context/EditorSurface.d.ts +19 -0
- package/dist/context/EditorSurface.d.ts.map +1 -0
- package/dist/context/EditorSurfaceContext.d.ts +7 -22
- package/dist/context/EditorSurfaceContext.d.ts.map +1 -1
- package/dist/context/ExtraNodesContext.d.ts +2 -6
- package/dist/context/ExtraNodesContext.d.ts.map +1 -1
- package/dist/context/ExtraNodesProvider.d.ts +7 -0
- package/dist/context/ExtraNodesProvider.d.ts.map +1 -0
- package/dist/context/FileUploadContext.d.ts +2 -6
- package/dist/context/FileUploadContext.d.ts.map +1 -1
- package/dist/context/FileUploadProvider.d.ts +7 -0
- package/dist/context/FileUploadProvider.d.ts.map +1 -0
- package/dist/context/FootnoteDefinitionsContext.d.ts +1 -4
- package/dist/context/FootnoteDefinitionsContext.d.ts.map +1 -1
- package/dist/context/FootnoteDefinitionsProvider.d.ts +6 -0
- package/dist/context/FootnoteDefinitionsProvider.d.ts.map +1 -0
- package/dist/context/ImagePreprocessContext.d.ts +2 -4
- package/dist/context/ImagePreprocessContext.d.ts.map +1 -1
- package/dist/context/ImagePreprocessProvider.d.ts +5 -0
- package/dist/context/ImagePreprocessProvider.d.ts.map +1 -0
- package/dist/context/ImageUploadContext.d.ts +2 -6
- package/dist/context/ImageUploadContext.d.ts.map +1 -1
- package/dist/context/ImageUploadProvider.d.ts +7 -0
- package/dist/context/ImageUploadProvider.d.ts.map +1 -0
- package/dist/context/NestedContentRendererContext.d.ts +4 -4
- package/dist/context/NestedContentRendererContext.d.ts.map +1 -1
- package/dist/context/NestedEditorPluginsContext.d.ts +5 -2
- package/dist/context/NestedEditorPluginsContext.d.ts.map +1 -1
- package/dist/context/NestedEditorPluginsProvider.d.ts +3 -0
- package/dist/context/NestedEditorPluginsProvider.d.ts.map +1 -0
- package/dist/context/RendererConfigContext.d.ts +9 -4
- package/dist/context/RendererConfigContext.d.ts.map +1 -1
- package/dist/context/RendererConfigProvider.d.ts +3 -0
- package/dist/context/RendererConfigProvider.d.ts.map +1 -0
- package/dist/context/TextSelectionContext.d.ts +2 -5
- package/dist/context/TextSelectionContext.d.ts.map +1 -1
- package/dist/context/TextSelectionStoreProvider.d.ts +5 -0
- package/dist/context/TextSelectionStoreProvider.d.ts.map +1 -0
- package/dist/context/VideoUploadContext.d.ts +2 -6
- package/dist/context/VideoUploadContext.d.ts.map +1 -1
- package/dist/context/VideoUploadProvider.d.ts +7 -0
- package/dist/context/VideoUploadProvider.d.ts.map +1 -0
- package/dist/{grid.css-DJWKdYpz.js → grid.css-DAMDDTZh.js} +2 -1
- package/dist/index.d.ts +15 -8
- package/dist/index.d.ts.map +1 -1
- package/dist/index.mjs +34 -22
- package/dist/insert-commands-CtLGoIz0.js +9 -0
- package/dist/{katex.css-9crOcnIa.js → katex.css-DJbW49pH.js} +1 -1
- package/dist/{node-registry-DRd8ZbeC.js → node-registry-PtbiwsVu.js} +416 -42
- package/dist/node-registry.d.ts +1 -1
- package/dist/node-registry.d.ts.map +1 -1
- package/dist/nodes/AlertQuoteEditNode.d.ts +4 -4
- package/dist/nodes/AlertQuoteEditNode.d.ts.map +1 -1
- package/dist/nodes/AlertQuoteNode.d.ts +3 -2
- package/dist/nodes/AlertQuoteNode.d.ts.map +1 -1
- package/dist/nodes/BannerEditNode.d.ts +4 -4
- package/dist/nodes/BannerEditNode.d.ts.map +1 -1
- package/dist/nodes/BannerNode.d.ts +3 -2
- package/dist/nodes/BannerNode.d.ts.map +1 -1
- package/dist/nodes/CodeBlockEditNode.d.ts +6 -6
- package/dist/nodes/CodeBlockEditNode.d.ts.map +1 -1
- package/dist/nodes/CodeBlockNode.d.ts +4 -3
- package/dist/nodes/CodeBlockNode.d.ts.map +1 -1
- package/dist/nodes/CommentNode.d.ts +3 -2
- package/dist/nodes/CommentNode.d.ts.map +1 -1
- package/dist/nodes/DetailsNode.d.ts +4 -3
- package/dist/nodes/DetailsNode.d.ts.map +1 -1
- package/dist/nodes/FileNode.d.ts +4 -3
- package/dist/nodes/FileNode.d.ts.map +1 -1
- package/dist/nodes/FootnoteNode.d.ts +3 -2
- package/dist/nodes/FootnoteNode.d.ts.map +1 -1
- package/dist/nodes/FootnoteSectionEditNode.d.ts +2 -2
- package/dist/nodes/FootnoteSectionEditNode.d.ts.map +1 -1
- package/dist/nodes/FootnoteSectionNode.d.ts +3 -2
- package/dist/nodes/FootnoteSectionNode.d.ts.map +1 -1
- package/dist/nodes/GridContainerNode.d.ts +3 -2
- package/dist/nodes/GridContainerNode.d.ts.map +1 -1
- package/dist/nodes/GridEditNode.d.ts +4 -4
- package/dist/nodes/GridEditNode.d.ts.map +1 -1
- package/dist/nodes/ImageNode.d.ts +5 -4
- package/dist/nodes/ImageNode.d.ts.map +1 -1
- package/dist/nodes/KaTeXBlockNode.d.ts +4 -3
- package/dist/nodes/KaTeXBlockNode.d.ts.map +1 -1
- package/dist/nodes/KaTeXInlineNode.d.ts +3 -2
- package/dist/nodes/KaTeXInlineNode.d.ts.map +1 -1
- package/dist/nodes/LinkCardNode.d.ts +4 -3
- package/dist/nodes/LinkCardNode.d.ts.map +1 -1
- package/dist/nodes/MentionNode.d.ts +4 -3
- package/dist/nodes/MentionNode.d.ts.map +1 -1
- package/dist/nodes/MermaidNode.d.ts +4 -3
- package/dist/nodes/MermaidNode.d.ts.map +1 -1
- package/dist/nodes/RichQuoteNode.d.ts +2 -2
- package/dist/nodes/RichQuoteNode.d.ts.map +1 -1
- package/dist/nodes/RubyNode.d.ts +2 -1
- package/dist/nodes/RubyNode.d.ts.map +1 -1
- package/dist/nodes/SpoilerNode.d.ts +2 -1
- package/dist/nodes/SpoilerNode.d.ts.map +1 -1
- package/dist/nodes/TagNode.d.ts +3 -2
- package/dist/nodes/TagNode.d.ts.map +1 -1
- package/dist/nodes/VideoNode.d.ts +4 -3
- package/dist/nodes/VideoNode.d.ts.map +1 -1
- package/dist/nodes/shared.d.ts +1 -1
- package/dist/nodes/shared.d.ts.map +1 -1
- package/dist/nodes-entry.d.ts.map +1 -1
- package/dist/nodes-entry.mjs +2 -4
- package/dist/{normalizeSerializedEditorState-VaI73T09.js → normalizeSerializedEditorState-CNUAQd3l.js} +16 -1
- package/dist/plugins/AlertPlugin.d.ts +0 -2
- package/dist/plugins/AlertPlugin.d.ts.map +1 -1
- package/dist/plugins/AutoFocusPlugin.d.ts.map +1 -1
- package/dist/plugins/AutoLinkPlugin.d.ts +1 -1
- package/dist/plugins/AutoLinkPlugin.d.ts.map +1 -1
- package/dist/plugins/BlockExitPlugin.d.ts +0 -2
- package/dist/plugins/BlockExitPlugin.d.ts.map +1 -1
- package/dist/plugins/BlockIdPlugin.d.ts +0 -1
- package/dist/plugins/BlockIdPlugin.d.ts.map +1 -1
- package/dist/plugins/ClickBelowPlugin.d.ts +0 -2
- package/dist/plugins/ClickBelowPlugin.d.ts.map +1 -1
- package/dist/plugins/EditorRefPlugin.d.ts +1 -1
- package/dist/plugins/EditorRefPlugin.d.ts.map +1 -1
- package/dist/plugins/FileUploadPlugin.d.ts +1 -1
- package/dist/plugins/FileUploadPlugin.d.ts.map +1 -1
- package/dist/plugins/FootnotePlugin.d.ts +1 -1
- package/dist/plugins/FootnotePlugin.d.ts.map +1 -1
- package/dist/plugins/HorizontalRulePlugin.d.ts.map +1 -1
- package/dist/plugins/ImageDialog.d.ts +2 -2
- package/dist/plugins/ImageDialog.d.ts.map +1 -1
- package/dist/plugins/ImageDialogReview.d.ts +2 -2
- package/dist/plugins/ImageDialogReview.d.ts.map +1 -1
- package/dist/plugins/ImageDialogSource.d.ts +1 -1
- package/dist/plugins/ImageDialogSource.d.ts.map +1 -1
- package/dist/plugins/ImagePlugin.d.ts +0 -3
- package/dist/plugins/ImagePlugin.d.ts.map +1 -1
- package/dist/plugins/ImageUploadPlugin.d.ts +1 -13
- package/dist/plugins/ImageUploadPlugin.d.ts.map +1 -1
- package/dist/plugins/InlineDndPlugin.d.ts +1 -3
- package/dist/plugins/InlineDndPlugin.d.ts.map +1 -1
- package/dist/plugins/KaTeXPlugin.d.ts +0 -2
- package/dist/plugins/KaTeXPlugin.d.ts.map +1 -1
- package/dist/plugins/LinkFaviconPlugin.d.ts.map +1 -1
- package/dist/plugins/MarkdownPastePlugin.d.ts.map +1 -1
- package/dist/plugins/MarkdownShortcutsPlugin.d.ts +1 -1
- package/dist/plugins/MarkdownShortcutsPlugin.d.ts.map +1 -1
- package/dist/plugins/MermaidPlugin.d.ts +0 -1
- package/dist/plugins/MermaidPlugin.d.ts.map +1 -1
- package/dist/plugins/OnChangePlugin.d.ts +1 -1
- package/dist/plugins/OnChangePlugin.d.ts.map +1 -1
- package/dist/plugins/PasteLinkPlugin.d.ts.map +1 -1
- package/dist/plugins/SubmitShortcutPlugin.d.ts.map +1 -1
- package/dist/plugins/TextSelectionPlugin.d.ts.map +1 -1
- package/dist/plugins/VideoUploadPlugin.d.ts.map +1 -1
- package/dist/plugins/VirtualizationPlugin.d.ts.map +1 -1
- package/dist/plugins/block-exit-commands.d.ts +3 -0
- package/dist/plugins/block-exit-commands.d.ts.map +1 -0
- package/dist/plugins/block-id-state.d.ts +2 -0
- package/dist/plugins/block-id-state.d.ts.map +1 -0
- package/dist/plugins/click-below-command.d.ts +3 -0
- package/dist/plugins/click-below-command.d.ts.map +1 -0
- package/dist/plugins/file-upload-command.d.ts +1 -1
- package/dist/plugins/file-upload-command.d.ts.map +1 -1
- package/dist/plugins/file-upload-store.d.ts +1 -1
- package/dist/plugins/file-upload-store.d.ts.map +1 -1
- package/dist/plugins/image-dialog-model.d.ts +1 -1
- package/dist/plugins/image-dialog-model.d.ts.map +1 -1
- package/dist/plugins/image-dialog.css.d.ts.map +1 -1
- package/dist/plugins/image-upload-command.d.ts +1 -1
- package/dist/plugins/image-upload-command.d.ts.map +1 -1
- package/dist/plugins/image-upload-fn.d.ts +14 -0
- package/dist/plugins/image-upload-fn.d.ts.map +1 -0
- package/dist/plugins/image-upload-toast.d.ts.map +1 -1
- package/dist/plugins/image-upload.css.d.ts.map +1 -1
- package/dist/plugins/inline-dnd-move.d.ts +4 -0
- package/dist/plugins/inline-dnd-move.d.ts.map +1 -0
- package/dist/plugins/inline-dnd-shared.d.ts.map +1 -1
- package/dist/plugins/inline-dnd.css.d.ts.map +1 -1
- package/dist/plugins/insert-commands.d.ts +9 -0
- package/dist/plugins/insert-commands.d.ts.map +1 -0
- package/dist/plugins/insertion-cursor.d.ts +1 -1
- package/dist/plugins/insertion-cursor.d.ts.map +1 -1
- package/dist/plugins/present-image-dialog.d.ts +1 -1
- package/dist/plugins/present-image-dialog.d.ts.map +1 -1
- package/dist/plugins/text-selection.css.d.ts.map +1 -1
- package/dist/plugins-entry.d.ts +15 -8
- package/dist/plugins-entry.d.ts.map +1 -1
- package/dist/plugins-entry.mjs +5 -6
- package/dist/recycler-entry.d.ts.map +1 -1
- package/dist/renderers-entry.d.ts +4 -2
- package/dist/renderers-entry.d.ts.map +1 -1
- package/dist/renderers-entry.mjs +5 -5
- package/dist/{utils-E6qVk-NR.js → shared.css-DRoqE_U-.js} +1 -24
- package/dist/static-entry.d.ts +12 -6
- package/dist/static-entry.d.ts.map +1 -1
- package/dist/static-entry.mjs +10 -9
- package/dist/styles/article.css.d.ts.map +1 -1
- package/dist/styles/chat.css.d.ts.map +1 -1
- package/dist/styles/comment.css.d.ts.map +1 -1
- package/dist/styles/details.css.d.ts +5 -5
- package/dist/styles/details.css.d.ts.map +1 -1
- package/dist/styles/grid.css.d.ts +10 -10
- package/dist/styles/grid.css.d.ts.map +1 -1
- package/dist/styles/index.d.ts +3 -0
- package/dist/styles/index.d.ts.map +1 -1
- package/dist/styles/katex.css.d.ts +3 -3
- package/dist/styles/katex.css.d.ts.map +1 -1
- package/dist/styles/note.css.d.ts.map +1 -1
- package/dist/styles/shared.css.d.ts +54 -54
- package/dist/styles/shared.css.d.ts.map +1 -1
- package/dist/styles/theme.d.ts +1 -1
- package/dist/styles/theme.d.ts.map +1 -1
- package/dist/styles-entry.d.ts.map +1 -1
- package/dist/styles-entry.mjs +4 -3
- package/dist/transformers/alert.d.ts +1 -1
- package/dist/transformers/alert.d.ts.map +1 -1
- package/dist/transformers/code-block.d.ts +1 -1
- package/dist/transformers/code-block.d.ts.map +1 -1
- package/dist/transformers/comment.d.ts +1 -1
- package/dist/transformers/comment.d.ts.map +1 -1
- package/dist/transformers/container.d.ts +1 -1
- package/dist/transformers/container.d.ts.map +1 -1
- package/dist/transformers/footnote.d.ts +1 -1
- package/dist/transformers/footnote.d.ts.map +1 -1
- package/dist/transformers/grid-container.d.ts +1 -1
- package/dist/transformers/grid-container.d.ts.map +1 -1
- package/dist/transformers/horizontal-rule.d.ts +1 -1
- package/dist/transformers/horizontal-rule.d.ts.map +1 -1
- package/dist/transformers/index.d.ts +1 -1
- package/dist/transformers/index.d.ts.map +1 -1
- package/dist/transformers/insert.d.ts.map +1 -1
- package/dist/transformers/katex.d.ts +1 -1
- package/dist/transformers/katex.d.ts.map +1 -1
- package/dist/transformers/mention.d.ts +1 -1
- package/dist/transformers/mention.d.ts.map +1 -1
- package/dist/transformers/quote.d.ts +1 -1
- package/dist/transformers/quote.d.ts.map +1 -1
- package/dist/transformers/rich-blocks.d.ts.map +1 -1
- package/dist/transformers/ruby.d.ts +1 -1
- package/dist/transformers/ruby.d.ts.map +1 -1
- package/dist/transformers/spoiler.d.ts +1 -1
- package/dist/transformers/spoiler.d.ts.map +1 -1
- package/dist/transformers/superscript-subscript.d.ts.map +1 -1
- package/dist/transformers/table.d.ts +1 -1
- package/dist/transformers/table.d.ts.map +1 -1
- package/dist/types/renderer-config.d.ts +15 -15
- package/dist/types/renderer-config.d.ts.map +1 -1
- package/dist/types/renderer-keys.d.ts +14 -14
- package/dist/types/renderer-keys.d.ts.map +1 -1
- package/dist/types/slash-menu.d.ts +2 -2
- package/dist/types/slash-menu.d.ts.map +1 -1
- package/dist/types.d.ts +5 -5
- package/dist/types.d.ts.map +1 -1
- package/dist/utils/codeBlockSelectionIntent.d.ts +1 -0
- package/dist/utils/codeBlockSelectionIntent.d.ts.map +1 -1
- package/dist/utils/collect-command-items.d.ts +2 -2
- package/dist/utils/collect-command-items.d.ts.map +1 -1
- package/dist/utils/comment-anchor.d.ts +1 -1
- package/dist/utils/comment-anchor.d.ts.map +1 -1
- package/dist/utils/extractTextContent.d.ts +1 -1
- package/dist/utils/extractTextContent.d.ts.map +1 -1
- package/dist/utils/favicon.d.ts.map +1 -1
- package/dist/utils/file-meta.d.ts +4 -0
- package/dist/utils/file-meta.d.ts.map +1 -0
- package/dist/utils/getRegisteredNodeKlass.d.ts +1 -1
- package/dist/utils/getRegisteredNodeKlass.d.ts.map +1 -1
- package/dist/utils/image-display-size.d.ts.map +1 -1
- package/dist/utils/image-insertion.d.ts +1 -1
- package/dist/utils/image-insertion.d.ts.map +1 -1
- package/dist/utils/image-preprocess.d.ts +1 -1
- package/dist/utils/image-preprocess.d.ts.map +1 -1
- package/dist/utils/katex-defaults.d.ts.map +1 -1
- package/dist/utils/lucide-dom.d.ts.map +1 -1
- package/dist/utils/nested-editor-sync.d.ts +1 -1
- package/dist/utils/nested-editor-sync.d.ts.map +1 -1
- package/dist/utils/normalizeSerializedEditorState.d.ts +1 -1
- package/dist/utils/normalizeSerializedEditorState.d.ts.map +1 -1
- package/dist/utils/occurrence-keys.d.ts +7 -0
- package/dist/utils/occurrence-keys.d.ts.map +1 -0
- package/dist/utils/tag-color.d.ts.map +1 -1
- package/dist/utils/text-selection-constants.d.ts.map +1 -1
- package/dist/utils/text-selection.d.ts +1 -1
- package/dist/utils/text-selection.d.ts.map +1 -1
- package/dist/utils/thumbhash.d.ts.map +1 -1
- package/dist/utils/toggle-spoiler.d.ts +1 -1
- package/dist/utils/toggle-spoiler.d.ts.map +1 -1
- package/dist/utils-i78C9io3.js +26 -0
- package/dist/virtualization/VirtualizationPlugin.d.ts +2 -2
- package/dist/virtualization/VirtualizationPlugin.d.ts.map +1 -1
- package/dist/virtualization/VirtualizedEditor.d.ts +3 -3
- package/dist/virtualization/VirtualizedEditor.d.ts.map +1 -1
- package/dist/virtualization/blocks.d.ts +3 -3
- package/dist/virtualization/blocks.d.ts.map +1 -1
- package/dist/virtualization/controller.d.ts +8 -4
- package/dist/virtualization/controller.d.ts.map +1 -1
- package/dist/virtualization/document.d.ts +1 -1
- package/dist/virtualization/document.d.ts.map +1 -1
- package/dist/virtualization/layout.d.ts +1 -1
- package/dist/virtualization/layout.d.ts.map +1 -1
- package/dist/virtualization/preserve.d.ts.map +1 -1
- package/dist/virtualization/style.css.d.ts.map +1 -1
- package/dist/virtualization/sync.d.ts +2 -2
- package/dist/virtualization/sync.d.ts.map +1 -1
- package/dist/virtualization/types.d.ts +2 -2
- package/dist/virtualization/types.d.ts.map +1 -1
- package/dist/virtualization/viewport.d.ts +1 -1
- package/dist/virtualization/viewport.d.ts.map +1 -1
- package/dist/virtualization-entry.d.ts.map +1 -1
- package/dist/virtualization-entry.mjs +1 -1
- package/package.json +4 -6
- package/dist/AlertQuoteEditNode-DFg-xOND.js +0 -372
- package/dist/BlockIdPlugin-Cwv8aV9g.js +0 -106
- package/dist/ColorSchemeContext-Dc_HebHd.js +0 -1336
- package/dist/LinkCardRenderer-BT8P5aJC.js +0 -100
- package/dist/MermaidPlugin-D0Z2_YAe.js +0 -71
- package/dist/NestedEditorPluginsContext-D78UZkmx.js +0 -16
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"style.css.d.ts","
|
|
1
|
+
{"version":3,"file":"style.css.d.ts","sources":["../../src/virtualization/style.css.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,MAAM,QAIjB,CAAC;AACH,eAAO,MAAM,IAAI,QAMf,CAAC;AACH,eAAO,MAAM,QAAQ,QAInB,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ElementNode } from 'lexical';
|
|
2
|
-
import { SerializedBlock } from './document';
|
|
1
|
+
import { type ElementNode } from 'lexical';
|
|
2
|
+
import type { SerializedBlock } from './document';
|
|
3
3
|
export declare function $syncChildren(parent: ElementNode, data: SerializedBlock[]): void;
|
|
4
4
|
//# sourceMappingURL=sync.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sync.d.ts","
|
|
1
|
+
{"version":3,"file":"sync.d.ts","sources":["../../src/virtualization/sync.ts"],"names":[],"mappings":"AAAA,OAAO,EAAwC,KAAK,WAAW,EAAoB,MAAM,SAAS,CAAC;AAEnG,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAclD,wBAAgB,aAAa,CAAC,MAAM,EAAE,WAAW,EAAE,IAAI,EAAE,eAAe,EAAE,QA+BzE"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { RefObject } from 'react';
|
|
2
|
-
import { SerializedBlock } from './document';
|
|
1
|
+
import type { RefObject } from 'react';
|
|
2
|
+
import type { SerializedBlock } from './document';
|
|
3
3
|
export interface EditorVirtualizationOptions {
|
|
4
4
|
estimateBlockHeight?: (block: SerializedBlock, width: number) => number;
|
|
5
5
|
/** Extra rendered pixels before and after the viewport. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","
|
|
1
|
+
{"version":3,"file":"types.d.ts","sources":["../../src/virtualization/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEvC,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAElD,MAAM,WAAW,2BAA2B;IAC1C,mBAAmB,CAAC,EAAE,CAAC,KAAK,EAAE,eAAe,EAAE,KAAK,EAAE,MAAM,KAAK,MAAM,CAAC;IACxE,2DAA2D;IAC3D,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,gGAAgG;IAChG,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,4FAA4F;IAC5F,eAAe,CAAC,EAAE,WAAW,GAAG,SAAS,CAAC,WAAW,GAAG,IAAI,CAAC,GAAG,CAAC,MAAM,WAAW,GAAG,IAAI,CAAC,CAAC;IAC3F,yGAAyG;IACzG,mBAAmB,CAAC,EAAE,MAAM,CAAC;CAC9B;AACD,MAAM,MAAM,oBAAoB,GAAG,OAAO,GAAG,2BAA2B,CAAC"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { EditorVirtualizationOptions } from './types';
|
|
1
|
+
import type { EditorVirtualizationOptions } from './types';
|
|
2
2
|
export declare function resolveScrollContainer(canvas: HTMLElement, configured: EditorVirtualizationOptions['scrollContainer']): HTMLElement | Window;
|
|
3
3
|
//# sourceMappingURL=viewport.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"viewport.d.ts","
|
|
1
|
+
{"version":3,"file":"viewport.d.ts","sources":["../../src/virtualization/viewport.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,SAAS,CAAC;AAE3D,wBAAgB,sBAAsB,CACpC,MAAM,EAAE,WAAW,EACnB,UAAU,EAAE,2BAA2B,CAAC,iBAAiB,CAAC,GACzD,WAAW,GAAG,MAAM,CAgBtB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"virtualization-entry.d.ts","
|
|
1
|
+
{"version":3,"file":"virtualization-entry.d.ts","sources":["../src/virtualization-entry.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,oBAAoB,EAAE,2BAA2B,EAAE,MAAM,wBAAwB,CAAC;AAChG,OAAO,EAAE,oBAAoB,EAAE,MAAM,uCAAuC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { t as VirtualizationPlugin } from "./VirtualizationPlugin-
|
|
1
|
+
export { t as VirtualizationPlugin } from "./VirtualizationPlugin-CkNi6FW2.js";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@haklex/rich-editor",
|
|
3
|
-
"version": "0.69.
|
|
3
|
+
"version": "0.69.2",
|
|
4
4
|
"description": "Core rich text editor based on Lexical",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -57,9 +57,9 @@
|
|
|
57
57
|
"dist"
|
|
58
58
|
],
|
|
59
59
|
"dependencies": {
|
|
60
|
-
"@haklex/rich-editor-ui": "0.69.
|
|
61
|
-
"@haklex/rich-headless": "0.69.
|
|
62
|
-
"@haklex/rich-style-token": "0.69.
|
|
60
|
+
"@haklex/rich-editor-ui": "0.69.2",
|
|
61
|
+
"@haklex/rich-headless": "0.69.2",
|
|
62
|
+
"@haklex/rich-style-token": "0.69.2",
|
|
63
63
|
"@lexical/code-core": "^0.53.0",
|
|
64
64
|
"nanoid": "^6.0.2",
|
|
65
65
|
"thumbhash": "^0.1.1"
|
|
@@ -81,8 +81,6 @@
|
|
|
81
81
|
"lucide-react": "^1.59.0",
|
|
82
82
|
"react": "^19.3.1",
|
|
83
83
|
"react-dom": "^19.3.1",
|
|
84
|
-
"typescript": "^7.0.2",
|
|
85
|
-
"unplugin-dts": "^1.1.2",
|
|
86
84
|
"vite": "^8.3.5"
|
|
87
85
|
},
|
|
88
86
|
"peerDependencies": {
|
|
@@ -1,372 +0,0 @@
|
|
|
1
|
-
import { B as FootnoteNode, G as AlertQuoteNode, H as $isAlertQuoteNode, _ as MentionNode, b as KaTeXInlineNode, c as SpoilerNode, d as RichQuoteNode, i as TagNode, q as AlertRenderer, t as editorTheme } from "./theme-DH4xzxU-.js";
|
|
2
|
-
import { c as RendererWrapper, m as ALERT_NODE_KEY } from "./thumbhash-GjK8OYAb.js";
|
|
3
|
-
import { t as _defineProperty } from "./defineProperty-BYhxpJwd.js";
|
|
4
|
-
import { n as useNestedEditorPlugins } from "./NestedEditorPluginsContext-D78UZkmx.js";
|
|
5
|
-
import { LinkPlugin } from "@lexical/react/LexicalLinkPlugin";
|
|
6
|
-
import { ListPlugin } from "@lexical/react/LexicalListPlugin";
|
|
7
|
-
import { TablePlugin } from "@lexical/react/LexicalTablePlugin";
|
|
8
|
-
import { AutoLinkNode, LinkNode, TOGGLE_LINK_COMMAND } from "@lexical/link";
|
|
9
|
-
import { useLexicalComposerContext } from "@lexical/react/LexicalComposerContext";
|
|
10
|
-
import { createElement, useCallback, useEffect, useMemo } from "react";
|
|
11
|
-
import { HeadingNode, QuoteNode } from "@lexical/rich-text";
|
|
12
|
-
import { $addUpdateTag, $createParagraphNode, $getEditor, $getNodeByKey, $getRoot, $getSelection, $insertNodes, $isParagraphNode, $isRangeSelection, $isTextNode, COMMAND_PRIORITY_CRITICAL, COMMAND_PRIORITY_HIGH, HISTORY_MERGE_TAG, KEY_ARROW_DOWN_COMMAND, KEY_ENTER_COMMAND, PASTE_COMMAND, SKIP_DOM_SELECTION_TAG, createEditor } from "lexical";
|
|
13
|
-
import { HorizontalRuleNode } from "@lexical/extension";
|
|
14
|
-
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
15
|
-
import { CodeNode } from "@lexical/code-core";
|
|
16
|
-
import { ListItemNode, ListNode } from "@lexical/list";
|
|
17
|
-
import { TableCellNode, TableNode, TableRowNode } from "@lexical/table";
|
|
18
|
-
import { Info, Lightbulb, TriangleAlert } from "lucide-react";
|
|
19
|
-
import { ContentEditable } from "@lexical/react/LexicalContentEditable";
|
|
20
|
-
import { LexicalErrorBoundary } from "@lexical/react/LexicalErrorBoundary";
|
|
21
|
-
import { LexicalNestedComposer } from "@lexical/react/LexicalNestedComposer";
|
|
22
|
-
import { RichTextPlugin } from "@lexical/react/LexicalRichTextPlugin";
|
|
23
|
-
//#region src/plugins/PasteLinkPlugin.tsx
|
|
24
|
-
var LINK_PROTOCOLS = /* @__PURE__ */ new Set([
|
|
25
|
-
"http:",
|
|
26
|
-
"https:",
|
|
27
|
-
"mailto:",
|
|
28
|
-
"tel:"
|
|
29
|
-
]);
|
|
30
|
-
function toPureUrl(raw) {
|
|
31
|
-
const text = raw?.trim();
|
|
32
|
-
if (!text || /\s/.test(text)) return null;
|
|
33
|
-
try {
|
|
34
|
-
return LINK_PROTOCOLS.has(new URL(text).protocol) ? text : null;
|
|
35
|
-
} catch {
|
|
36
|
-
return null;
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
function PasteLinkPlugin() {
|
|
40
|
-
const [editor] = useLexicalComposerContext();
|
|
41
|
-
useEffect(() => {
|
|
42
|
-
return editor.registerCommand(PASTE_COMMAND, (event) => {
|
|
43
|
-
if (!(event instanceof ClipboardEvent)) return false;
|
|
44
|
-
const selection = $getSelection();
|
|
45
|
-
if (!$isRangeSelection(selection) || selection.isCollapsed()) return false;
|
|
46
|
-
const url = toPureUrl(event.clipboardData?.getData("text/plain"));
|
|
47
|
-
if (!url) return false;
|
|
48
|
-
const textNodes = selection.getNodes().filter($isTextNode);
|
|
49
|
-
if (textNodes.length === 0) return false;
|
|
50
|
-
if (textNodes.some((node) => !node.isSimpleText())) return false;
|
|
51
|
-
const block = textNodes[0].getTopLevelElement();
|
|
52
|
-
if (!block || textNodes.some((node) => node.getTopLevelElement() !== block)) return false;
|
|
53
|
-
event.preventDefault();
|
|
54
|
-
editor.dispatchCommand(TOGGLE_LINK_COMMAND, url);
|
|
55
|
-
return true;
|
|
56
|
-
}, COMMAND_PRIORITY_HIGH);
|
|
57
|
-
}, [editor]);
|
|
58
|
-
return null;
|
|
59
|
-
}
|
|
60
|
-
//#endregion
|
|
61
|
-
//#region src/components/decorators/NestedEditorCorePlugins.tsx
|
|
62
|
-
function NestedEditorCorePlugins() {
|
|
63
|
-
const [editor] = useLexicalComposerContext();
|
|
64
|
-
const nestedEditorPlugins = useNestedEditorPlugins();
|
|
65
|
-
const hasTables = editor.hasNodes([
|
|
66
|
-
TableNode,
|
|
67
|
-
TableRowNode,
|
|
68
|
-
TableCellNode
|
|
69
|
-
]);
|
|
70
|
-
return /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
71
|
-
/* @__PURE__ */ jsx(ListPlugin, {}),
|
|
72
|
-
/* @__PURE__ */ jsx(LinkPlugin, {}),
|
|
73
|
-
/* @__PURE__ */ jsx(PasteLinkPlugin, {}),
|
|
74
|
-
hasTables && /* @__PURE__ */ jsx(TablePlugin, { hasHorizontalScroll: true }),
|
|
75
|
-
nestedEditorPlugins
|
|
76
|
-
] });
|
|
77
|
-
}
|
|
78
|
-
//#endregion
|
|
79
|
-
//#region src/utils/nested-editor-sync.ts
|
|
80
|
-
function registerNestedEditorSync(parentEditor, nestedEditor, ownerKey) {
|
|
81
|
-
let synced = JSON.stringify(nestedEditor.getEditorState().toJSON());
|
|
82
|
-
return nestedEditor.registerUpdateListener(({ dirtyElements, dirtyLeaves, editorState }) => {
|
|
83
|
-
if (dirtyElements.size === 0 && dirtyLeaves.size === 0) return;
|
|
84
|
-
const content = JSON.stringify(editorState.toJSON());
|
|
85
|
-
if (content === synced) return;
|
|
86
|
-
synced = content;
|
|
87
|
-
parentEditor.update(() => {
|
|
88
|
-
const owner = $getNodeByKey(ownerKey);
|
|
89
|
-
if (!owner) return;
|
|
90
|
-
$addUpdateTag(HISTORY_MERGE_TAG);
|
|
91
|
-
$addUpdateTag(SKIP_DOM_SELECTION_TAG);
|
|
92
|
-
owner.markDirty();
|
|
93
|
-
});
|
|
94
|
-
});
|
|
95
|
-
}
|
|
96
|
-
//#endregion
|
|
97
|
-
//#region src/components/decorators/useNestedEditorSync.ts
|
|
98
|
-
function useNestedEditorSync(nestedEditors, ownerKey) {
|
|
99
|
-
const [editor] = useLexicalComposerContext();
|
|
100
|
-
useEffect(() => {
|
|
101
|
-
const unregisters = nestedEditors.map((nested) => registerNestedEditorSync(editor, nested, ownerKey));
|
|
102
|
-
return () => unregisters.forEach((unregister) => unregister());
|
|
103
|
-
}, [
|
|
104
|
-
editor,
|
|
105
|
-
nestedEditors,
|
|
106
|
-
ownerKey
|
|
107
|
-
]);
|
|
108
|
-
}
|
|
109
|
-
//#endregion
|
|
110
|
-
//#region src/components/decorators/AlertEditDecorator.tsx
|
|
111
|
-
function ExitBlockPlugin({ parentEditor, nodeKey }) {
|
|
112
|
-
const [editor] = useLexicalComposerContext();
|
|
113
|
-
useEffect(() => {
|
|
114
|
-
const focusParent = () => {
|
|
115
|
-
parentEditor.focus(() => {
|
|
116
|
-
parentEditor.update(() => {
|
|
117
|
-
const alertNode = $getNodeByKey(nodeKey);
|
|
118
|
-
if (alertNode) {
|
|
119
|
-
const next = alertNode.getNextSibling();
|
|
120
|
-
if (next) next.selectStart();
|
|
121
|
-
}
|
|
122
|
-
});
|
|
123
|
-
});
|
|
124
|
-
};
|
|
125
|
-
const exitAlert = (removeEmpty) => {
|
|
126
|
-
const root = $getRoot();
|
|
127
|
-
const lastChild = root.getLastChild();
|
|
128
|
-
const shouldRemoveAlert = removeEmpty && root.getChildrenSize() <= 1;
|
|
129
|
-
if (removeEmpty && lastChild) lastChild.remove();
|
|
130
|
-
if (shouldRemoveAlert) parentEditor.update(() => {
|
|
131
|
-
const alertNode = $getNodeByKey(nodeKey);
|
|
132
|
-
if (alertNode) {
|
|
133
|
-
const paragraph = $createParagraphNode();
|
|
134
|
-
alertNode.insertAfter(paragraph);
|
|
135
|
-
alertNode.remove();
|
|
136
|
-
paragraph.selectStart();
|
|
137
|
-
}
|
|
138
|
-
}, { onUpdate: focusParent });
|
|
139
|
-
else parentEditor.update(() => {
|
|
140
|
-
const alertNode = $getNodeByKey(nodeKey);
|
|
141
|
-
if (alertNode) {
|
|
142
|
-
let next = alertNode.getNextSibling();
|
|
143
|
-
if (!next || !$isParagraphNode(next)) {
|
|
144
|
-
next = $createParagraphNode();
|
|
145
|
-
alertNode.insertAfter(next);
|
|
146
|
-
}
|
|
147
|
-
next.selectStart();
|
|
148
|
-
}
|
|
149
|
-
}, { onUpdate: focusParent });
|
|
150
|
-
};
|
|
151
|
-
const isAtLastEmptyParagraph = () => {
|
|
152
|
-
const selection = $getSelection();
|
|
153
|
-
if (!$isRangeSelection(selection) || !selection.isCollapsed()) return false;
|
|
154
|
-
const topLevelElement = selection.anchor.getNode().getTopLevelElement();
|
|
155
|
-
return topLevelElement && $isParagraphNode(topLevelElement) && topLevelElement.getTextContent() === "" && topLevelElement.getNextSibling() === null;
|
|
156
|
-
};
|
|
157
|
-
const unregisterEnter = editor.registerCommand(KEY_ENTER_COMMAND, (event) => {
|
|
158
|
-
if (event?.metaKey || event?.ctrlKey) {
|
|
159
|
-
event.preventDefault();
|
|
160
|
-
exitAlert(false);
|
|
161
|
-
return true;
|
|
162
|
-
}
|
|
163
|
-
if (!isAtLastEmptyParagraph()) return false;
|
|
164
|
-
event?.preventDefault();
|
|
165
|
-
exitAlert(true);
|
|
166
|
-
return true;
|
|
167
|
-
}, COMMAND_PRIORITY_CRITICAL);
|
|
168
|
-
const unregisterArrowDown = editor.registerCommand(KEY_ARROW_DOWN_COMMAND, (event) => {
|
|
169
|
-
if (!isAtLastEmptyParagraph()) return false;
|
|
170
|
-
event?.preventDefault();
|
|
171
|
-
exitAlert(false);
|
|
172
|
-
return true;
|
|
173
|
-
}, COMMAND_PRIORITY_HIGH);
|
|
174
|
-
return () => {
|
|
175
|
-
unregisterEnter();
|
|
176
|
-
unregisterArrowDown();
|
|
177
|
-
};
|
|
178
|
-
}, [
|
|
179
|
-
editor,
|
|
180
|
-
parentEditor,
|
|
181
|
-
nodeKey
|
|
182
|
-
]);
|
|
183
|
-
return null;
|
|
184
|
-
}
|
|
185
|
-
function AlertEditDecorator({ nodeKey, alertType, contentEditor }) {
|
|
186
|
-
const [editor] = useLexicalComposerContext();
|
|
187
|
-
useNestedEditorSync(useMemo(() => [contentEditor], [contentEditor]), nodeKey);
|
|
188
|
-
const editable = editor.isEditable();
|
|
189
|
-
const handleTypeChange = useCallback((newType) => {
|
|
190
|
-
editor.update(() => {
|
|
191
|
-
const node = $getNodeByKey(nodeKey);
|
|
192
|
-
if ($isAlertQuoteNode(node)) node.setAlertType(newType);
|
|
193
|
-
});
|
|
194
|
-
}, [editor, nodeKey]);
|
|
195
|
-
return /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx(RendererWrapper, {
|
|
196
|
-
defaultRenderer: AlertRenderer,
|
|
197
|
-
rendererKey: ALERT_NODE_KEY,
|
|
198
|
-
props: {
|
|
199
|
-
type: alertType,
|
|
200
|
-
editable,
|
|
201
|
-
onTypeChange: editable ? handleTypeChange : void 0
|
|
202
|
-
}
|
|
203
|
-
}), /* @__PURE__ */ jsx("div", {
|
|
204
|
-
className: "rich-alert-content",
|
|
205
|
-
children: /* @__PURE__ */ jsxs(LexicalNestedComposer, {
|
|
206
|
-
initialEditor: contentEditor,
|
|
207
|
-
children: [
|
|
208
|
-
/* @__PURE__ */ jsx(RichTextPlugin, {
|
|
209
|
-
ErrorBoundary: LexicalErrorBoundary,
|
|
210
|
-
contentEditable: /* @__PURE__ */ jsx(ContentEditable, {
|
|
211
|
-
"aria-placeholder": "",
|
|
212
|
-
className: "rich-alert-content-editable",
|
|
213
|
-
placeholder: /* @__PURE__ */ jsx("span", { style: { display: "none" } }),
|
|
214
|
-
style: { outline: "none" }
|
|
215
|
-
})
|
|
216
|
-
}),
|
|
217
|
-
/* @__PURE__ */ jsx(NestedEditorCorePlugins, {}),
|
|
218
|
-
/* @__PURE__ */ jsx(ExitBlockPlugin, {
|
|
219
|
-
nodeKey,
|
|
220
|
-
parentEditor: editor
|
|
221
|
-
})
|
|
222
|
-
]
|
|
223
|
-
})
|
|
224
|
-
})] });
|
|
225
|
-
}
|
|
226
|
-
//#endregion
|
|
227
|
-
//#region src/nodes/shared.ts
|
|
228
|
-
var NESTED_EDITOR_NODES = [
|
|
229
|
-
HeadingNode,
|
|
230
|
-
QuoteNode,
|
|
231
|
-
RichQuoteNode,
|
|
232
|
-
{
|
|
233
|
-
replace: QuoteNode,
|
|
234
|
-
with: () => new RichQuoteNode()
|
|
235
|
-
},
|
|
236
|
-
ListNode,
|
|
237
|
-
ListItemNode,
|
|
238
|
-
LinkNode,
|
|
239
|
-
AutoLinkNode,
|
|
240
|
-
HorizontalRuleNode,
|
|
241
|
-
CodeNode,
|
|
242
|
-
TableNode,
|
|
243
|
-
TableCellNode,
|
|
244
|
-
TableRowNode,
|
|
245
|
-
SpoilerNode,
|
|
246
|
-
MentionNode,
|
|
247
|
-
FootnoteNode,
|
|
248
|
-
KaTeXInlineNode,
|
|
249
|
-
TagNode
|
|
250
|
-
];
|
|
251
|
-
function $tryGetEditor() {
|
|
252
|
-
try {
|
|
253
|
-
return $getEditor();
|
|
254
|
-
} catch {
|
|
255
|
-
return null;
|
|
256
|
-
}
|
|
257
|
-
}
|
|
258
|
-
function createNestedEditor(fallbackNamespace) {
|
|
259
|
-
if ($tryGetEditor()) return createEditor();
|
|
260
|
-
return createEditor({
|
|
261
|
-
namespace: fallbackNamespace,
|
|
262
|
-
nodes: NESTED_EDITOR_NODES,
|
|
263
|
-
theme: editorTheme,
|
|
264
|
-
onError: (error) => console.error(`[${fallbackNamespace}]`, error)
|
|
265
|
-
});
|
|
266
|
-
}
|
|
267
|
-
//#endregion
|
|
268
|
-
//#region src/nodes/AlertQuoteEditNode.ts
|
|
269
|
-
function createContentEditor() {
|
|
270
|
-
return createNestedEditor("AlertContent");
|
|
271
|
-
}
|
|
272
|
-
var AlertQuoteEditNode = class AlertQuoteEditNode extends AlertQuoteNode {
|
|
273
|
-
static clone(node) {
|
|
274
|
-
const cloned = new AlertQuoteEditNode(node.__alertType, node.__contentState, node.__key);
|
|
275
|
-
cloned.__contentEditor = node.__contentEditor;
|
|
276
|
-
return cloned;
|
|
277
|
-
}
|
|
278
|
-
constructor(alertType, contentState, key) {
|
|
279
|
-
super(alertType, contentState, key);
|
|
280
|
-
_defineProperty(this, "__contentEditor", void 0);
|
|
281
|
-
this.__contentEditor = createContentEditor();
|
|
282
|
-
if (contentState) {
|
|
283
|
-
const editorState = this.__contentEditor.parseEditorState(contentState);
|
|
284
|
-
this.__contentEditor.setEditorState(editorState);
|
|
285
|
-
}
|
|
286
|
-
}
|
|
287
|
-
getContentEditor() {
|
|
288
|
-
return this.__contentEditor;
|
|
289
|
-
}
|
|
290
|
-
static importJSON(_serializedNode) {
|
|
291
|
-
const serializedNode = _serializedNode;
|
|
292
|
-
return new AlertQuoteEditNode(serializedNode.alertType, serializedNode.content).updateFromJSON(_serializedNode);
|
|
293
|
-
}
|
|
294
|
-
exportJSON() {
|
|
295
|
-
return {
|
|
296
|
-
...super.exportJSON(),
|
|
297
|
-
type: "alert-quote",
|
|
298
|
-
alertType: this.__alertType,
|
|
299
|
-
content: this.__contentEditor.getEditorState().toJSON(),
|
|
300
|
-
version: 1
|
|
301
|
-
};
|
|
302
|
-
}
|
|
303
|
-
decorate(_editor, _config) {
|
|
304
|
-
return createElement(AlertEditDecorator, {
|
|
305
|
-
nodeKey: this.__key,
|
|
306
|
-
alertType: this.__alertType,
|
|
307
|
-
contentEditor: this.__contentEditor
|
|
308
|
-
});
|
|
309
|
-
}
|
|
310
|
-
};
|
|
311
|
-
_defineProperty(AlertQuoteEditNode, "commandItems", [
|
|
312
|
-
{
|
|
313
|
-
title: "Callout",
|
|
314
|
-
icon: createElement(Info, { size: 20 }),
|
|
315
|
-
description: "Info callout block",
|
|
316
|
-
keywords: [
|
|
317
|
-
"alert",
|
|
318
|
-
"note",
|
|
319
|
-
"info",
|
|
320
|
-
"callout"
|
|
321
|
-
],
|
|
322
|
-
section: "ADVANCED",
|
|
323
|
-
placement: ["slash", "toolbar"],
|
|
324
|
-
group: "insert",
|
|
325
|
-
onSelect: (editor) => {
|
|
326
|
-
editor.update(() => {
|
|
327
|
-
$insertNodes([$createAlertQuoteEditNode("note")]);
|
|
328
|
-
});
|
|
329
|
-
}
|
|
330
|
-
},
|
|
331
|
-
{
|
|
332
|
-
title: "Tip",
|
|
333
|
-
icon: createElement(Lightbulb, { size: 20 }),
|
|
334
|
-
description: "Highlight a useful tip",
|
|
335
|
-
keywords: [
|
|
336
|
-
"alert",
|
|
337
|
-
"tip",
|
|
338
|
-
"hint"
|
|
339
|
-
],
|
|
340
|
-
section: "ADVANCED",
|
|
341
|
-
placement: ["slash", "toolbar"],
|
|
342
|
-
group: "insert",
|
|
343
|
-
onSelect: (editor) => {
|
|
344
|
-
editor.update(() => {
|
|
345
|
-
$insertNodes([$createAlertQuoteEditNode("tip")]);
|
|
346
|
-
});
|
|
347
|
-
}
|
|
348
|
-
},
|
|
349
|
-
{
|
|
350
|
-
title: "Warning",
|
|
351
|
-
icon: createElement(TriangleAlert, { size: 20 }),
|
|
352
|
-
description: "Warn about something",
|
|
353
|
-
keywords: [
|
|
354
|
-
"alert",
|
|
355
|
-
"warning",
|
|
356
|
-
"caution"
|
|
357
|
-
],
|
|
358
|
-
section: "ADVANCED",
|
|
359
|
-
placement: ["slash", "toolbar"],
|
|
360
|
-
group: "insert",
|
|
361
|
-
onSelect: (editor) => {
|
|
362
|
-
editor.update(() => {
|
|
363
|
-
$insertNodes([$createAlertQuoteEditNode("warning")]);
|
|
364
|
-
});
|
|
365
|
-
}
|
|
366
|
-
}
|
|
367
|
-
]);
|
|
368
|
-
function $createAlertQuoteEditNode(alertType, contentState) {
|
|
369
|
-
return new AlertQuoteEditNode(alertType, contentState);
|
|
370
|
-
}
|
|
371
|
-
//#endregion
|
|
372
|
-
export { useNestedEditorSync as a, PasteLinkPlugin as c, createNestedEditor as i, AlertQuoteEditNode as n, registerNestedEditorSync as o, NESTED_EDITOR_NODES as r, NestedEditorCorePlugins as s, $createAlertQuoteEditNode as t };
|
|
@@ -1,106 +0,0 @@
|
|
|
1
|
-
import { useLexicalComposerContext } from "@lexical/react/LexicalComposerContext";
|
|
2
|
-
import { useEffect } from "react";
|
|
3
|
-
import { $addUpdateTag, $getRoot, $getState, $setState, createState } from "lexical";
|
|
4
|
-
import { nanoid } from "nanoid";
|
|
5
|
-
//#region src/plugins/BlockIdPlugin.tsx
|
|
6
|
-
var blockIdState = createState("blockId", { parse: (v) => typeof v === "string" ? v : "" });
|
|
7
|
-
var NORMALIZATION_TAG = "block-id-normalization";
|
|
8
|
-
function buildPreviousIdIndex(editorState) {
|
|
9
|
-
return editorState.read(() => {
|
|
10
|
-
const map = /* @__PURE__ */ new Map();
|
|
11
|
-
for (const child of $getRoot().getChildren()) {
|
|
12
|
-
const id = $getState(child, blockIdState);
|
|
13
|
-
if (!id) continue;
|
|
14
|
-
const set = map.get(id) ?? /* @__PURE__ */ new Set();
|
|
15
|
-
set.add(child.getKey());
|
|
16
|
-
map.set(id, set);
|
|
17
|
-
}
|
|
18
|
-
return map;
|
|
19
|
-
});
|
|
20
|
-
}
|
|
21
|
-
function collectRootChildren(editorState) {
|
|
22
|
-
return editorState.read(() => $getRoot().getChildren().map((child) => $getState(child, blockIdState)));
|
|
23
|
-
}
|
|
24
|
-
function hasDuplicateOrMissingId(children) {
|
|
25
|
-
const seen = /* @__PURE__ */ new Set();
|
|
26
|
-
for (const id of children) {
|
|
27
|
-
if (!id || seen.has(id)) return true;
|
|
28
|
-
seen.add(id);
|
|
29
|
-
}
|
|
30
|
-
return false;
|
|
31
|
-
}
|
|
32
|
-
function generateBlockId(used) {
|
|
33
|
-
while (true) {
|
|
34
|
-
const id = nanoid(8);
|
|
35
|
-
if (!used.has(id)) return id;
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
function pickKeeperKey(nodes, previousKeys) {
|
|
39
|
-
if (!nodes.length) return null;
|
|
40
|
-
if (previousKeys?.size) {
|
|
41
|
-
for (const node of nodes) if (previousKeys.has(node.getKey())) return node.getKey();
|
|
42
|
-
}
|
|
43
|
-
return nodes[0]?.getKey() ?? null;
|
|
44
|
-
}
|
|
45
|
-
function normalizeRootBlockIds(editor, previousIdIndex) {
|
|
46
|
-
editor.update(() => {
|
|
47
|
-
$addUpdateTag("history-merge");
|
|
48
|
-
const children = $getRoot().getChildren();
|
|
49
|
-
const groupedById = /* @__PURE__ */ new Map();
|
|
50
|
-
for (const child of children) {
|
|
51
|
-
const id = $getState(child, blockIdState);
|
|
52
|
-
if (!id) continue;
|
|
53
|
-
const bucket = groupedById.get(id) ?? [];
|
|
54
|
-
bucket.push(child);
|
|
55
|
-
groupedById.set(id, bucket);
|
|
56
|
-
}
|
|
57
|
-
const keeperById = /* @__PURE__ */ new Map();
|
|
58
|
-
for (const [id, nodes] of groupedById) {
|
|
59
|
-
if (nodes.length <= 1) continue;
|
|
60
|
-
const keeperKey = pickKeeperKey(nodes, previousIdIndex.get(id));
|
|
61
|
-
if (keeperKey) keeperById.set(id, keeperKey);
|
|
62
|
-
}
|
|
63
|
-
const used = /* @__PURE__ */ new Set();
|
|
64
|
-
for (const child of children) {
|
|
65
|
-
let id = $getState(child, blockIdState);
|
|
66
|
-
const keeperKey = id ? keeperById.get(id) : null;
|
|
67
|
-
if (!id || used.has(id) || keeperKey !== void 0 && child.getKey() !== keeperKey) {
|
|
68
|
-
id = generateBlockId(used);
|
|
69
|
-
$setState(child, blockIdState, id);
|
|
70
|
-
}
|
|
71
|
-
used.add(id);
|
|
72
|
-
}
|
|
73
|
-
}, { tag: NORMALIZATION_TAG });
|
|
74
|
-
}
|
|
75
|
-
function syncBlockIdAttributes(editor) {
|
|
76
|
-
editor.getEditorState().read(() => {
|
|
77
|
-
for (const child of $getRoot().getChildren()) {
|
|
78
|
-
const id = $getState(child, blockIdState);
|
|
79
|
-
if (!id) continue;
|
|
80
|
-
const dom = editor.getElementByKey(child.getKey());
|
|
81
|
-
if (dom && dom.getAttribute("data-block-id") !== id) dom.setAttribute("data-block-id", id);
|
|
82
|
-
}
|
|
83
|
-
});
|
|
84
|
-
}
|
|
85
|
-
function BlockIdPlugin() {
|
|
86
|
-
const [editor] = useLexicalComposerContext();
|
|
87
|
-
useEffect(() => {
|
|
88
|
-
if (hasDuplicateOrMissingId(collectRootChildren(editor.getEditorState()))) normalizeRootBlockIds(editor, /* @__PURE__ */ new Map());
|
|
89
|
-
syncBlockIdAttributes(editor);
|
|
90
|
-
return editor.registerUpdateListener(({ tags, editorState, prevEditorState }) => {
|
|
91
|
-
if (tags.has(NORMALIZATION_TAG)) {
|
|
92
|
-
syncBlockIdAttributes(editor);
|
|
93
|
-
return;
|
|
94
|
-
}
|
|
95
|
-
if (!hasDuplicateOrMissingId(collectRootChildren(editorState))) {
|
|
96
|
-
syncBlockIdAttributes(editor);
|
|
97
|
-
return;
|
|
98
|
-
}
|
|
99
|
-
const previousIdIndex = buildPreviousIdIndex(prevEditorState);
|
|
100
|
-
normalizeRootBlockIds(editor, previousIdIndex);
|
|
101
|
-
});
|
|
102
|
-
}, [editor]);
|
|
103
|
-
return null;
|
|
104
|
-
}
|
|
105
|
-
//#endregion
|
|
106
|
-
export { blockIdState as n, BlockIdPlugin as t };
|