@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,6 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { n as semanticClassNames, r as sharedStyles } from "./shared.css-DRoqE_U-.js";
|
|
2
|
+
import { t as clsx } from "./utils-i78C9io3.js";
|
|
3
|
+
import { createContext, createElement, use, useCallback } from "react";
|
|
4
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
4
5
|
import { rgbaToThumbHash, thumbHashToDataURL } from "thumbhash";
|
|
5
6
|
//#region src/types/renderer-keys.ts
|
|
6
7
|
/**
|
|
@@ -30,27 +31,12 @@ var RUBY_NODE_KEY = "Ruby";
|
|
|
30
31
|
var TAG_NODE_KEY = "Tag";
|
|
31
32
|
var VIDEO_NODE_KEY = "Video";
|
|
32
33
|
//#endregion
|
|
33
|
-
//#region src/context/RendererConfigContext.
|
|
34
|
+
//#region src/context/RendererConfigContext.ts
|
|
34
35
|
var RendererConfigContext = createContext({
|
|
35
36
|
config: void 0,
|
|
36
37
|
mode: "renderer",
|
|
37
38
|
variant: "article"
|
|
38
39
|
});
|
|
39
|
-
function RendererConfigProvider({ config, mode, variant, children }) {
|
|
40
|
-
const value = useMemo(() => ({
|
|
41
|
-
config,
|
|
42
|
-
mode,
|
|
43
|
-
variant
|
|
44
|
-
}), [
|
|
45
|
-
config,
|
|
46
|
-
mode,
|
|
47
|
-
variant
|
|
48
|
-
]);
|
|
49
|
-
return /* @__PURE__ */ jsx(RendererConfigContext.Provider, {
|
|
50
|
-
value,
|
|
51
|
-
children
|
|
52
|
-
});
|
|
53
|
-
}
|
|
54
40
|
function useRendererConfig() {
|
|
55
41
|
return use(RendererConfigContext).config;
|
|
56
42
|
}
|
|
@@ -71,6 +57,8 @@ function RendererWrapper({ rendererKey, defaultRenderer, props }) {
|
|
|
71
57
|
if (!Renderer) return null;
|
|
72
58
|
return /* @__PURE__ */ jsx(Renderer, { ...props });
|
|
73
59
|
}
|
|
60
|
+
//#endregion
|
|
61
|
+
//#region src/components/renderer-decoration.ts
|
|
74
62
|
/**
|
|
75
63
|
* Type-safe helper for creating RendererWrapper elements from .ts node files.
|
|
76
64
|
* Avoids the createElement + discriminated-union typing limitation.
|
|
@@ -88,21 +76,68 @@ function createRendererDecoration(rendererKey, defaultRenderer, props) {
|
|
|
88
76
|
});
|
|
89
77
|
}
|
|
90
78
|
//#endregion
|
|
91
|
-
//#region src/
|
|
79
|
+
//#region src/utils/file-meta.ts
|
|
80
|
+
function formatFileSize(bytes) {
|
|
81
|
+
if (bytes == null || !Number.isFinite(bytes) || bytes < 0) return null;
|
|
82
|
+
if (bytes < 1024) return `${bytes} B`;
|
|
83
|
+
const units = [
|
|
84
|
+
"KB",
|
|
85
|
+
"MB",
|
|
86
|
+
"GB",
|
|
87
|
+
"TB"
|
|
88
|
+
];
|
|
89
|
+
let value = bytes;
|
|
90
|
+
let unit = "";
|
|
91
|
+
for (const next of units) {
|
|
92
|
+
value /= 1024;
|
|
93
|
+
unit = next;
|
|
94
|
+
if (value < 1024) break;
|
|
95
|
+
}
|
|
96
|
+
return `${value >= 100 ? Math.round(value) : value.toFixed(1)} ${unit}`;
|
|
97
|
+
}
|
|
98
|
+
function fileExtension(name, ext) {
|
|
99
|
+
if (ext) return ext.toUpperCase();
|
|
100
|
+
const index = name.lastIndexOf(".");
|
|
101
|
+
if (index <= 0 || index === name.length - 1) return null;
|
|
102
|
+
const derived = name.slice(index + 1);
|
|
103
|
+
return derived.length > 8 ? null : derived.toUpperCase();
|
|
104
|
+
}
|
|
105
|
+
function fileMetaText(name, size, ext) {
|
|
106
|
+
return [formatFileSize(size), fileExtension(name, ext)].filter(Boolean).join(" · ");
|
|
107
|
+
}
|
|
108
|
+
//#endregion
|
|
109
|
+
//#region src/components/renderers/FileRenderer.tsx
|
|
110
|
+
function FileRenderer({ src, name, size, ext, display }) {
|
|
111
|
+
if (display === "inline") return /* @__PURE__ */ jsx("a", {
|
|
112
|
+
className: "rich-file-chip",
|
|
113
|
+
download: name,
|
|
114
|
+
href: src || void 0,
|
|
115
|
+
rel: "noopener noreferrer",
|
|
116
|
+
target: "_blank",
|
|
117
|
+
children: name
|
|
118
|
+
});
|
|
119
|
+
const meta = fileMetaText(name, size, ext);
|
|
120
|
+
return /* @__PURE__ */ jsxs("a", {
|
|
121
|
+
className: "rich-file-card",
|
|
122
|
+
download: name,
|
|
123
|
+
href: src || void 0,
|
|
124
|
+
rel: "noopener noreferrer",
|
|
125
|
+
target: "_blank",
|
|
126
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
127
|
+
className: "rich-file-card-name",
|
|
128
|
+
children: name
|
|
129
|
+
}), meta && /* @__PURE__ */ jsx("span", {
|
|
130
|
+
className: "rich-file-card-meta",
|
|
131
|
+
children: meta
|
|
132
|
+
})]
|
|
133
|
+
});
|
|
134
|
+
}
|
|
135
|
+
//#endregion
|
|
136
|
+
//#region src/context/FootnoteDefinitionsContext.ts
|
|
92
137
|
var FootnoteDefinitionsContext = createContext({
|
|
93
138
|
definitions: {},
|
|
94
139
|
displayNumberMap: {}
|
|
95
140
|
});
|
|
96
|
-
function FootnoteDefinitionsProvider({ definitions, displayNumberMap, children }) {
|
|
97
|
-
const value = useMemo(() => ({
|
|
98
|
-
definitions,
|
|
99
|
-
displayNumberMap
|
|
100
|
-
}), [definitions, displayNumberMap]);
|
|
101
|
-
return /* @__PURE__ */ jsx(FootnoteDefinitionsContext, {
|
|
102
|
-
value,
|
|
103
|
-
children
|
|
104
|
-
});
|
|
105
|
-
}
|
|
106
141
|
function useFootnoteDefinitions() {
|
|
107
142
|
return use(FootnoteDefinitionsContext);
|
|
108
143
|
}
|
|
@@ -203,4 +238,47 @@ function base64ToUint8(str) {
|
|
|
203
238
|
return bytes;
|
|
204
239
|
}
|
|
205
240
|
//#endregion
|
|
206
|
-
|
|
241
|
+
//#region src/components/renderers/LinkCardRenderer.tsx
|
|
242
|
+
function LinkCardRenderer({ url, title, description, favicon, image }) {
|
|
243
|
+
return /* @__PURE__ */ jsxs("a", {
|
|
244
|
+
className: "rich-link-card",
|
|
245
|
+
href: url,
|
|
246
|
+
rel: "noopener noreferrer",
|
|
247
|
+
target: "_blank",
|
|
248
|
+
children: [image && /* @__PURE__ */ jsx("span", {
|
|
249
|
+
className: "rich-link-card-image",
|
|
250
|
+
children: /* @__PURE__ */ jsx("img", {
|
|
251
|
+
alt: "",
|
|
252
|
+
loading: "lazy",
|
|
253
|
+
src: image
|
|
254
|
+
})
|
|
255
|
+
}), /* @__PURE__ */ jsxs("span", {
|
|
256
|
+
className: "rich-link-card-content",
|
|
257
|
+
children: [
|
|
258
|
+
/* @__PURE__ */ jsxs("span", {
|
|
259
|
+
className: "rich-link-card-title",
|
|
260
|
+
children: [favicon && /* @__PURE__ */ jsx("img", {
|
|
261
|
+
alt: "",
|
|
262
|
+
className: "rich-link-card-favicon",
|
|
263
|
+
height: 16,
|
|
264
|
+
src: favicon,
|
|
265
|
+
width: 16,
|
|
266
|
+
onError: (e) => {
|
|
267
|
+
e.target.style.display = "none";
|
|
268
|
+
}
|
|
269
|
+
}), title || url]
|
|
270
|
+
}),
|
|
271
|
+
description && /* @__PURE__ */ jsx("span", {
|
|
272
|
+
className: "rich-link-card-description",
|
|
273
|
+
children: description
|
|
274
|
+
}),
|
|
275
|
+
/* @__PURE__ */ jsx("span", {
|
|
276
|
+
className: "rich-link-card-url",
|
|
277
|
+
children: url
|
|
278
|
+
})
|
|
279
|
+
]
|
|
280
|
+
})]
|
|
281
|
+
});
|
|
282
|
+
}
|
|
283
|
+
//#endregion
|
|
284
|
+
export { RUBY_NODE_KEY as A, FOOTNOTE_NODE_KEY as C, LINK_CARD_NODE_KEY as D, KATEX_NODE_KEY as E, VIDEO_NODE_KEY as M, MENTION_NODE_KEY as O, FILE_NODE_KEY as S, IMAGE_NODE_KEY as T, useRendererMode as _, FootnoteDefinitionsContext as a, BANNER_NODE_KEY as b, useFootnoteDisplayNumber as c, fileMetaText as d, formatFileSize as f, useRendererConfig as g, RendererConfigContext as h, FootnoteStaticRenderer as i, TAG_NODE_KEY as j, MERMAID_NODE_KEY as k, FileRenderer as l, RendererWrapper as m, computeImageMeta as n, useFootnoteContent as o, createRendererDecoration as p, decodeThumbHash as r, useFootnoteDefinitions as s, LinkCardRenderer as t, fileExtension as u, useVariant as v, FOOTNOTE_SECTION_NODE_KEY as w, CODE_BLOCK_NODE_KEY as x, ALERT_NODE_KEY as y };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { createContext, use } from "react";
|
|
2
|
+
//#region src/context/NestedEditorPluginsContext.ts
|
|
3
|
+
var NestedEditorPluginsContext = createContext(null);
|
|
4
|
+
function useNestedEditorPlugins() {
|
|
5
|
+
return use(NestedEditorPluginsContext)?.plugins ?? null;
|
|
6
|
+
}
|
|
7
|
+
//#endregion
|
|
8
|
+
export { useNestedEditorPlugins as n, NestedEditorPluginsContext as t };
|
|
@@ -1,5 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { t as ColorSchemeContext } from "./ColorSchemeContext-DLWz8vFw.js";
|
|
2
|
+
import { h as RendererConfigContext } from "./LinkCardRenderer-D4mQbUQo.js";
|
|
3
|
+
import { n as semanticClassNames, r as sharedStyles } from "./shared.css-DRoqE_U-.js";
|
|
4
|
+
import { t as clsx } from "./utils-i78C9io3.js";
|
|
5
|
+
import { i as probeFavicon, r as getHostname } from "./normalizeSerializedEditorState-CNUAQd3l.js";
|
|
3
6
|
import { createContext, use, useEffect, useMemo, useState } from "react";
|
|
4
7
|
import { jsx } from "react/jsx-runtime";
|
|
5
8
|
import { Globe, Mail } from "lucide-react";
|
|
@@ -51,17 +54,44 @@ function LinkFavicon({ href, source, noIcon = false, className, platformIconMap,
|
|
|
51
54
|
});
|
|
52
55
|
}
|
|
53
56
|
//#endregion
|
|
54
|
-
//#region src/context/ExtraNodesContext.
|
|
57
|
+
//#region src/context/ExtraNodesContext.ts
|
|
55
58
|
var ExtraNodesContext = createContext(void 0);
|
|
59
|
+
function useExtraNodes() {
|
|
60
|
+
return use(ExtraNodesContext);
|
|
61
|
+
}
|
|
62
|
+
//#endregion
|
|
63
|
+
//#region src/context/ExtraNodesProvider.tsx
|
|
56
64
|
function ExtraNodesProvider({ children, extraNodes }) {
|
|
57
65
|
const value = useMemo(() => extraNodes, [extraNodes]);
|
|
58
|
-
return /* @__PURE__ */ jsx(ExtraNodesContext
|
|
66
|
+
return /* @__PURE__ */ jsx(ExtraNodesContext, {
|
|
59
67
|
value,
|
|
60
68
|
children
|
|
61
69
|
});
|
|
62
70
|
}
|
|
63
|
-
|
|
64
|
-
|
|
71
|
+
//#endregion
|
|
72
|
+
//#region src/context/ColorSchemeProvider.tsx
|
|
73
|
+
function ColorSchemeProvider({ colorScheme, children }) {
|
|
74
|
+
return /* @__PURE__ */ jsx(ColorSchemeContext, {
|
|
75
|
+
value: colorScheme,
|
|
76
|
+
children
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
//#endregion
|
|
80
|
+
//#region src/context/RendererConfigProvider.tsx
|
|
81
|
+
function RendererConfigProvider({ config, mode, variant, children }) {
|
|
82
|
+
const value = useMemo(() => ({
|
|
83
|
+
config,
|
|
84
|
+
mode,
|
|
85
|
+
variant
|
|
86
|
+
}), [
|
|
87
|
+
config,
|
|
88
|
+
mode,
|
|
89
|
+
variant
|
|
90
|
+
]);
|
|
91
|
+
return /* @__PURE__ */ jsx(RendererConfigContext, {
|
|
92
|
+
value,
|
|
93
|
+
children
|
|
94
|
+
});
|
|
65
95
|
}
|
|
66
96
|
//#endregion
|
|
67
|
-
export { useExtraNodes as n,
|
|
97
|
+
export { LinkFavicon as a, useExtraNodes as i, ColorSchemeProvider as n, ExtraNodesProvider as r, RendererConfigProvider as t };
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { n as semanticClassNames, r as sharedStyles } from "./shared.css-DRoqE_U-.js";
|
|
2
|
+
import { t as clsx } from "./utils-i78C9io3.js";
|
|
2
3
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
3
4
|
//#region src/components/renderers/RubyRenderer.tsx
|
|
4
5
|
function RubyRenderer({ reading, children }) {
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { n as semanticClassNames, r as sharedStyles } from "./shared.css-DRoqE_U-.js";
|
|
2
|
+
import { ElementNode, createCommand } from "lexical";
|
|
3
|
+
//#region src/utils/extractTextContent.ts
|
|
4
|
+
function extractTextContent(state) {
|
|
5
|
+
function walk(node) {
|
|
6
|
+
if (node.text) return node.text;
|
|
7
|
+
if (node.children) return node.children.map(walk).join("");
|
|
8
|
+
if (node.root) return walk(node.root);
|
|
9
|
+
return "";
|
|
10
|
+
}
|
|
11
|
+
return walk(state);
|
|
12
|
+
}
|
|
13
|
+
//#endregion
|
|
14
|
+
//#region src/plugins/file-upload-command.ts
|
|
15
|
+
var OPEN_FILE_PICKER_COMMAND = createCommand("OPEN_FILE_PICKER_COMMAND");
|
|
16
|
+
//#endregion
|
|
17
|
+
//#region src/plugins/image-upload-command.ts
|
|
18
|
+
var OPEN_IMAGE_UPLOAD_DIALOG_COMMAND = createCommand("OPEN_IMAGE_UPLOAD_DIALOG_COMMAND");
|
|
19
|
+
//#endregion
|
|
20
|
+
//#region src/nodes/SpoilerNode.ts
|
|
21
|
+
var SpoilerNode = class SpoilerNode extends ElementNode {
|
|
22
|
+
static getType() {
|
|
23
|
+
return "spoiler";
|
|
24
|
+
}
|
|
25
|
+
static clone(node) {
|
|
26
|
+
return new SpoilerNode(node.__key);
|
|
27
|
+
}
|
|
28
|
+
constructor(key) {
|
|
29
|
+
super(key);
|
|
30
|
+
}
|
|
31
|
+
createDOM(_config) {
|
|
32
|
+
const span = document.createElement("span");
|
|
33
|
+
span.className = `${semanticClassNames.spoiler} ${sharedStyles.spoiler}`;
|
|
34
|
+
span.setAttribute("role", "button");
|
|
35
|
+
span.setAttribute("tabindex", "0");
|
|
36
|
+
span.setAttribute("aria-label", "Spoiler (click to reveal)");
|
|
37
|
+
const toggle = () => {
|
|
38
|
+
if (span.isContentEditable) return;
|
|
39
|
+
span.classList.toggle(semanticClassNames.spoilerRevealed);
|
|
40
|
+
const revealed = span.classList.toggle(sharedStyles.spoilerRevealed);
|
|
41
|
+
span.setAttribute("aria-label", revealed ? "Spoiler (revealed)" : "Spoiler (click to reveal)");
|
|
42
|
+
};
|
|
43
|
+
span.addEventListener("click", toggle);
|
|
44
|
+
span.addEventListener("keydown", (e) => {
|
|
45
|
+
if (e.key === "Enter" || e.key === " ") {
|
|
46
|
+
e.preventDefault();
|
|
47
|
+
toggle();
|
|
48
|
+
}
|
|
49
|
+
});
|
|
50
|
+
return span;
|
|
51
|
+
}
|
|
52
|
+
updateDOM() {
|
|
53
|
+
return false;
|
|
54
|
+
}
|
|
55
|
+
static importJSON(_serializedNode) {
|
|
56
|
+
return $createSpoilerNode().updateFromJSON(_serializedNode);
|
|
57
|
+
}
|
|
58
|
+
exportJSON() {
|
|
59
|
+
return {
|
|
60
|
+
...super.exportJSON(),
|
|
61
|
+
type: "spoiler",
|
|
62
|
+
version: 1
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
canInsertTextBefore() {
|
|
66
|
+
return true;
|
|
67
|
+
}
|
|
68
|
+
canInsertTextAfter() {
|
|
69
|
+
return true;
|
|
70
|
+
}
|
|
71
|
+
isInline() {
|
|
72
|
+
return true;
|
|
73
|
+
}
|
|
74
|
+
};
|
|
75
|
+
function $createSpoilerNode() {
|
|
76
|
+
return new SpoilerNode();
|
|
77
|
+
}
|
|
78
|
+
function $isSpoilerNode(node) {
|
|
79
|
+
return node instanceof SpoilerNode;
|
|
80
|
+
}
|
|
81
|
+
//#endregion
|
|
82
|
+
export { OPEN_FILE_PICKER_COMMAND as a, OPEN_IMAGE_UPLOAD_DIALOG_COMMAND as i, $isSpoilerNode as n, extractTextContent as o, SpoilerNode as r, $createSpoilerNode as t };
|
|
@@ -2,34 +2,20 @@ import { LexicalComposerContext, useLexicalComposerContext } from "@lexical/reac
|
|
|
2
2
|
import { Fragment, Suspense, createContext, lazy, use, useCallback, useEffect, useId, useLayoutEffect, useMemo, useRef, useState, useSyncExternalStore } from "react";
|
|
3
3
|
import { CAN_REDO_COMMAND, CAN_UNDO_COMMAND, COMMAND_PRIORITY_LOW } from "lexical";
|
|
4
4
|
import { jsx } from "react/jsx-runtime";
|
|
5
|
-
//#region src/context/EditorSurfaceContext.
|
|
6
|
-
var
|
|
5
|
+
//#region src/context/EditorSurfaceContext.ts
|
|
6
|
+
var EditorSurfaceContext = createContext(null);
|
|
7
|
+
function useEditorSurface() {
|
|
8
|
+
const context = use(EditorSurfaceContext);
|
|
9
|
+
if (!context) throw new Error("Editor surface extensions must be mounted inside RichEditor");
|
|
10
|
+
return context;
|
|
11
|
+
}
|
|
12
|
+
function useActiveEditor() {
|
|
13
|
+
return useEditorSurface().activeEditor;
|
|
14
|
+
}
|
|
15
|
+
//#endregion
|
|
16
|
+
//#region src/context/EditorSurface.tsx
|
|
7
17
|
function EditorSurfaceProvider({ children }) {
|
|
8
18
|
const [documentEditor] = useLexicalComposerContext();
|
|
9
|
-
const [activeEditor, setActiveEditor] = useState(documentEditor);
|
|
10
|
-
const active = useRef(activeEditor);
|
|
11
|
-
active.current = activeEditor;
|
|
12
|
-
const history = useRef({
|
|
13
|
-
undo: false,
|
|
14
|
-
redo: false
|
|
15
|
-
});
|
|
16
|
-
useEffect(() => {
|
|
17
|
-
const register = (command, key) => documentEditor.registerCommand(command, (value, fromEditor) => {
|
|
18
|
-
if (fromEditor !== documentEditor) return false;
|
|
19
|
-
history.current[key] = value;
|
|
20
|
-
const target = active.current;
|
|
21
|
-
if (target && target !== documentEditor) target.dispatchCommand(command, value);
|
|
22
|
-
return false;
|
|
23
|
-
}, COMMAND_PRIORITY_LOW);
|
|
24
|
-
const unregister = [register(CAN_UNDO_COMMAND, "undo"), register(CAN_REDO_COMMAND, "redo")];
|
|
25
|
-
return () => unregister.forEach((dispose) => dispose());
|
|
26
|
-
}, [documentEditor]);
|
|
27
|
-
useEffect(() => {
|
|
28
|
-
if (activeEditor && activeEditor !== documentEditor) {
|
|
29
|
-
activeEditor.dispatchCommand(CAN_UNDO_COMMAND, history.current.undo);
|
|
30
|
-
activeEditor.dispatchCommand(CAN_REDO_COMMAND, history.current.redo);
|
|
31
|
-
}
|
|
32
|
-
}, [activeEditor, documentEditor]);
|
|
33
19
|
const [surfaces, setSurfaces] = useState(() => /* @__PURE__ */ new Map());
|
|
34
20
|
const [injections, setInjections] = useState(() => /* @__PURE__ */ new Map());
|
|
35
21
|
const registerSurface = useCallback((key, surface, priority) => {
|
|
@@ -56,28 +42,81 @@ function EditorSurfaceProvider({ children }) {
|
|
|
56
42
|
for (const entry of surfaces.values()) if (!selected || entry.priority >= selected.priority) selected = entry;
|
|
57
43
|
return selected?.surface ?? null;
|
|
58
44
|
}, [surfaces]);
|
|
59
|
-
const [
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
const
|
|
64
|
-
|
|
45
|
+
const [lease, setLease] = useState({
|
|
46
|
+
count: 0,
|
|
47
|
+
surface: null
|
|
48
|
+
});
|
|
49
|
+
const leaseCountRef = useRef(0);
|
|
50
|
+
const heldSurfaceRef = useRef(null);
|
|
51
|
+
const surface = lease.count > 0 ? lease.surface : requested;
|
|
52
|
+
const currentSurfaceRef = useRef(surface);
|
|
53
|
+
useLayoutEffect(() => {
|
|
54
|
+
currentSurfaceRef.current = surface;
|
|
55
|
+
});
|
|
65
56
|
const retainSurface = useCallback(() => {
|
|
66
|
-
|
|
67
|
-
|
|
57
|
+
const publish = () => {
|
|
58
|
+
const count = leaseCountRef.current;
|
|
59
|
+
const held = heldSurfaceRef.current;
|
|
60
|
+
setLease((previous) => previous.count === count && previous.surface === held ? previous : {
|
|
61
|
+
count,
|
|
62
|
+
surface: held
|
|
63
|
+
});
|
|
64
|
+
};
|
|
65
|
+
if (leaseCountRef.current++ === 0) heldSurfaceRef.current = currentSurfaceRef.current;
|
|
66
|
+
publish();
|
|
68
67
|
let released = false;
|
|
69
68
|
return () => {
|
|
70
69
|
if (released) return;
|
|
71
70
|
released = true;
|
|
72
|
-
|
|
71
|
+
leaseCountRef.current--;
|
|
72
|
+
publish();
|
|
73
73
|
};
|
|
74
74
|
}, []);
|
|
75
|
+
const [active, setActive] = useState(() => ({
|
|
76
|
+
documentEditor,
|
|
77
|
+
surface,
|
|
78
|
+
editor: surface ? null : documentEditor
|
|
79
|
+
}));
|
|
80
|
+
if (active.surface !== surface || active.documentEditor !== documentEditor) setActive({
|
|
81
|
+
documentEditor,
|
|
82
|
+
surface,
|
|
83
|
+
editor: surface ? null : documentEditor
|
|
84
|
+
});
|
|
85
|
+
const activeEditor = active.editor;
|
|
86
|
+
const activateEditor = useCallback((owner, editor) => setActive((previous) => previous.surface === owner && previous.editor !== editor ? {
|
|
87
|
+
...previous,
|
|
88
|
+
editor
|
|
89
|
+
} : previous), []);
|
|
90
|
+
const activeEditorRef = useRef(activeEditor);
|
|
91
|
+
useLayoutEffect(() => {
|
|
92
|
+
activeEditorRef.current = activeEditor;
|
|
93
|
+
});
|
|
94
|
+
const historyRef = useRef({
|
|
95
|
+
undo: false,
|
|
96
|
+
redo: false
|
|
97
|
+
});
|
|
98
|
+
useEffect(() => {
|
|
99
|
+
const register = (command, key) => documentEditor.registerCommand(command, (value, fromEditor) => {
|
|
100
|
+
if (fromEditor !== documentEditor) return false;
|
|
101
|
+
historyRef.current[key] = value;
|
|
102
|
+
const target = activeEditorRef.current;
|
|
103
|
+
if (target && target !== documentEditor) target.dispatchCommand(command, value);
|
|
104
|
+
return false;
|
|
105
|
+
}, COMMAND_PRIORITY_LOW);
|
|
106
|
+
const unregister = [register(CAN_UNDO_COMMAND, "undo"), register(CAN_REDO_COMMAND, "redo")];
|
|
107
|
+
return () => unregister.forEach((dispose) => dispose());
|
|
108
|
+
}, [documentEditor]);
|
|
109
|
+
useEffect(() => {
|
|
110
|
+
if (activeEditor && activeEditor !== documentEditor) {
|
|
111
|
+
activeEditor.dispatchCommand(CAN_UNDO_COMMAND, historyRef.current.undo);
|
|
112
|
+
activeEditor.dispatchCommand(CAN_REDO_COMMAND, historyRef.current.redo);
|
|
113
|
+
}
|
|
114
|
+
}, [activeEditor, documentEditor]);
|
|
75
115
|
const plugins = useMemo(() => [...injections].map(([key, node]) => /* @__PURE__ */ jsx(Fragment, { children: node }, key)), [injections]);
|
|
76
|
-
useLayoutEffect(() => setActiveEditor(surface ? null : documentEditor), [documentEditor, surface]);
|
|
77
116
|
const value = useMemo(() => ({
|
|
78
117
|
surface,
|
|
79
118
|
activeEditor,
|
|
80
|
-
|
|
119
|
+
activateEditor,
|
|
81
120
|
plugins,
|
|
82
121
|
registerSurface,
|
|
83
122
|
registerPlugins,
|
|
@@ -85,27 +124,23 @@ function EditorSurfaceProvider({ children }) {
|
|
|
85
124
|
}), [
|
|
86
125
|
surface,
|
|
87
126
|
activeEditor,
|
|
127
|
+
activateEditor,
|
|
88
128
|
plugins,
|
|
89
129
|
registerSurface,
|
|
90
130
|
registerPlugins,
|
|
91
131
|
retainSurface
|
|
92
132
|
]);
|
|
93
|
-
return /* @__PURE__ */ jsx(
|
|
133
|
+
return /* @__PURE__ */ jsx(EditorSurfaceContext, {
|
|
94
134
|
value,
|
|
95
135
|
children
|
|
96
136
|
});
|
|
97
137
|
}
|
|
98
|
-
function useEditorSurface() {
|
|
99
|
-
const context = use(Context);
|
|
100
|
-
if (!context) throw new Error("Editor surface extensions must be mounted inside RichEditor");
|
|
101
|
-
return context;
|
|
102
|
-
}
|
|
103
138
|
/** Register an editing surface; null explicitly selects the standard surface. */
|
|
104
139
|
function EditorSurfacePlugin({ surface, priority = 0 }) {
|
|
105
|
-
const
|
|
140
|
+
const id = useId();
|
|
106
141
|
const { registerSurface } = useEditorSurface();
|
|
107
|
-
useLayoutEffect(() => registerSurface(
|
|
108
|
-
|
|
142
|
+
useLayoutEffect(() => registerSurface(id, surface, priority), [
|
|
143
|
+
id,
|
|
109
144
|
priority,
|
|
110
145
|
registerSurface,
|
|
111
146
|
surface
|
|
@@ -114,11 +149,11 @@ function EditorSurfacePlugin({ surface, priority = 0 }) {
|
|
|
114
149
|
}
|
|
115
150
|
/** Mount DOM/selection plugins inside whichever editing surface is installed. */
|
|
116
151
|
function EditorSurfacePlugins({ children }) {
|
|
117
|
-
const
|
|
152
|
+
const id = useId();
|
|
118
153
|
const { registerPlugins } = useEditorSurface();
|
|
119
154
|
const [slot] = useState(() => createPluginSlot(children));
|
|
120
|
-
useLayoutEffect(() => registerPlugins(
|
|
121
|
-
|
|
155
|
+
useLayoutEffect(() => registerPlugins(id, /* @__PURE__ */ jsx(PluginSlotOutlet, { slot })), [
|
|
156
|
+
id,
|
|
122
157
|
registerPlugins,
|
|
123
158
|
slot
|
|
124
159
|
]);
|
|
@@ -144,9 +179,6 @@ function createPluginSlot(initial) {
|
|
|
144
179
|
function PluginSlotOutlet({ slot }) {
|
|
145
180
|
return useSyncExternalStore(slot.subscribe, slot.get, slot.get);
|
|
146
181
|
}
|
|
147
|
-
function useActiveEditor() {
|
|
148
|
-
return useEditorSurface().activeEditor;
|
|
149
|
-
}
|
|
150
182
|
/** Keep document-level history/save outside this scope; toolbar actions belong inside it. */
|
|
151
183
|
function ActiveEditorScope({ children }) {
|
|
152
184
|
const [documentEditor, context] = useLexicalComposerContext();
|
|
@@ -163,7 +195,7 @@ function ActiveEditorScope({ children }) {
|
|
|
163
195
|
}
|
|
164
196
|
//#endregion
|
|
165
197
|
//#region src/virtualization/VirtualizationPlugin.tsx
|
|
166
|
-
var VirtualizedEditor = lazy(() => import("./VirtualizedEditor-
|
|
198
|
+
var VirtualizedEditor = lazy(() => import("./VirtualizedEditor-D099IYqN.js").then((module) => ({ default: module.VirtualizedEditor })));
|
|
167
199
|
function VirtualizationPlugin({ scrollContainer, overscan, estimateBlockHeight, preserveCapacity, selectionMergeLimit, priority = 0 }) {
|
|
168
200
|
const surface = useMemo(() => {
|
|
169
201
|
const options = {
|