@haklex/rich-editor 0.68.0 → 0.69.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/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,12 +1,19 @@
|
|
|
1
|
-
import { C as MENTION_NODE_KEY,
|
|
2
|
-
import {
|
|
1
|
+
import { C as FOOTNOTE_NODE_KEY, D as LINK_CARD_NODE_KEY, E as KATEX_NODE_KEY, M as VIDEO_NODE_KEY, O as MENTION_NODE_KEY, S as FILE_NODE_KEY, T as IMAGE_NODE_KEY, b as BANNER_NODE_KEY, i as FootnoteStaticRenderer, k as MERMAID_NODE_KEY, l as FileRenderer, m as RendererWrapper, p as createRendererDecoration, r as decodeThumbHash, s as useFootnoteDefinitions, t as LinkCardRenderer, w as FOOTNOTE_SECTION_NODE_KEY, x as CODE_BLOCK_NODE_KEY, y as ALERT_NODE_KEY } from "./LinkCardRenderer-D4mQbUQo.js";
|
|
2
|
+
import { n as semanticClassNames, r as sharedStyles } from "./shared.css-DRoqE_U-.js";
|
|
3
|
+
import { a as OPEN_FILE_PICKER_COMMAND, i as OPEN_IMAGE_UPLOAD_DIALOG_COMMAND, o as extractTextContent, r as SpoilerNode } from "./SpoilerNode-D7Tgdo2K.js";
|
|
3
4
|
import { t as _defineProperty } from "./defineProperty-BYhxpJwd.js";
|
|
5
|
+
import { t as clsx } from "./utils-i78C9io3.js";
|
|
6
|
+
import { i as detailsStyles, n as gridStyles, r as detailsClassNames, t as gridClassNames } from "./grid.css-DAMDDTZh.js";
|
|
7
|
+
import { AutoLinkNode, LinkNode } from "@lexical/link";
|
|
4
8
|
import { createContext, createElement, use, useCallback, useEffect, useMemo, useState } from "react";
|
|
5
|
-
import { QuoteNode } from "@lexical/rich-text";
|
|
6
|
-
import { $getEditor, $getNodeByKey, $getSelection, $insertNodes, $isNodeSelection, $isRangeSelection, DecoratorNode, ElementNode, TextNode,
|
|
9
|
+
import { HeadingNode, QuoteNode } from "@lexical/rich-text";
|
|
10
|
+
import { $createParagraphNode, $createTextNode, $getEditor, $getNodeByKey, $getSelection, $insertNodes, $isNodeSelection, $isRangeSelection, DecoratorNode, ElementNode, TextNode, getRegisteredNode, isHTMLElement, setDOMUnmanaged } from "lexical";
|
|
11
|
+
import { HorizontalRuleNode } from "@lexical/extension";
|
|
7
12
|
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
13
|
+
import { CodeNode } from "@lexical/code-core";
|
|
14
|
+
import { ListItemNode, ListNode } from "@lexical/list";
|
|
15
|
+
import { $getTableCellNodeFromLexicalNode, TableCellNode, TableNode, TableRowNode } from "@lexical/table";
|
|
16
|
+
import { ChevronRight, Code, ImageIcon, Info, Lightbulb, Link, MessageSquareQuote, MessageSquareWarning, OctagonAlert, Paperclip, Sigma, Tag, TriangleAlert, Video, Workflow } from "lucide-react";
|
|
10
17
|
//#region src/plugins/inline-dnd-shared.ts
|
|
11
18
|
var INLINE_DRAG_ATTR = "data-inline-drag";
|
|
12
19
|
var INLINE_DRAG_MIME = "application/x-haklex-inline-node";
|
|
@@ -15,9 +22,9 @@ function markInlineDraggable(el, nodeKey) {
|
|
|
15
22
|
el.setAttribute(INLINE_DRAG_ATTR, nodeKey);
|
|
16
23
|
}
|
|
17
24
|
//#endregion
|
|
18
|
-
//#region src/context/NestedContentRendererContext.
|
|
25
|
+
//#region src/context/NestedContentRendererContext.ts
|
|
19
26
|
var NestedContentRendererContext = createContext(null);
|
|
20
|
-
var NestedContentRendererProvider = NestedContentRendererContext
|
|
27
|
+
var NestedContentRendererProvider = NestedContentRendererContext;
|
|
21
28
|
function useOptionalNestedContentRenderer() {
|
|
22
29
|
return use(NestedContentRendererContext);
|
|
23
30
|
}
|
|
@@ -67,17 +74,6 @@ function AlertStaticDecorator({ alertType, contentState }) {
|
|
|
67
74
|
})] });
|
|
68
75
|
}
|
|
69
76
|
//#endregion
|
|
70
|
-
//#region src/utils/extractTextContent.ts
|
|
71
|
-
function extractTextContent(state) {
|
|
72
|
-
function walk(node) {
|
|
73
|
-
if (node.text) return node.text;
|
|
74
|
-
if (node.children) return node.children.map(walk).join("");
|
|
75
|
-
if (node.root) return walk(node.root);
|
|
76
|
-
return "";
|
|
77
|
-
}
|
|
78
|
-
return walk(state);
|
|
79
|
-
}
|
|
80
|
-
//#endregion
|
|
81
77
|
//#region src/nodes/AlertQuoteNode.ts
|
|
82
78
|
var ALERT_TYPES = [
|
|
83
79
|
"note",
|
|
@@ -159,74 +155,1008 @@ var AlertQuoteNode = class AlertQuoteNode extends DecoratorNode {
|
|
|
159
155
|
exportJSON() {
|
|
160
156
|
return {
|
|
161
157
|
...super.exportJSON(),
|
|
162
|
-
type: "alert-quote",
|
|
163
|
-
alertType: this.__alertType,
|
|
164
|
-
content: this.__contentState,
|
|
158
|
+
type: "alert-quote",
|
|
159
|
+
alertType: this.__alertType,
|
|
160
|
+
content: this.__contentState,
|
|
161
|
+
version: 1
|
|
162
|
+
};
|
|
163
|
+
}
|
|
164
|
+
decorate(_editor, _config) {
|
|
165
|
+
return createElement(AlertStaticDecorator, {
|
|
166
|
+
alertType: this.__alertType,
|
|
167
|
+
contentState: this.__contentState
|
|
168
|
+
});
|
|
169
|
+
}
|
|
170
|
+
};
|
|
171
|
+
function $isAlertQuoteNode(node) {
|
|
172
|
+
return node instanceof AlertQuoteNode;
|
|
173
|
+
}
|
|
174
|
+
//#endregion
|
|
175
|
+
//#region src/components/renderers/BannerRenderer.tsx
|
|
176
|
+
var BannerRenderer = ({ type }) => {
|
|
177
|
+
return /* @__PURE__ */ jsx("span", { className: `rich-banner-icon rich-banner-icon-${type}` });
|
|
178
|
+
};
|
|
179
|
+
//#endregion
|
|
180
|
+
//#region src/components/renderers/BannerStaticDecorator.tsx
|
|
181
|
+
function BannerStaticDecorator({ bannerType, contentState }) {
|
|
182
|
+
const renderContent = useNestedContentRenderer();
|
|
183
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
184
|
+
className: "rich-banner-inner",
|
|
185
|
+
children: [/* @__PURE__ */ jsx(RendererWrapper, {
|
|
186
|
+
defaultRenderer: BannerRenderer,
|
|
187
|
+
props: { type: bannerType },
|
|
188
|
+
rendererKey: BANNER_NODE_KEY
|
|
189
|
+
}), /* @__PURE__ */ jsx("div", {
|
|
190
|
+
className: "rich-banner-content",
|
|
191
|
+
children: renderContent(contentState)
|
|
192
|
+
})]
|
|
193
|
+
});
|
|
194
|
+
}
|
|
195
|
+
//#endregion
|
|
196
|
+
//#region src/nodes/BannerNode.ts
|
|
197
|
+
var LEGACY_TYPE_MAP = {
|
|
198
|
+
info: "note",
|
|
199
|
+
success: "tip",
|
|
200
|
+
error: "caution"
|
|
201
|
+
};
|
|
202
|
+
function normalizeBannerType(type) {
|
|
203
|
+
if (type in LEGACY_TYPE_MAP) return LEGACY_TYPE_MAP[type];
|
|
204
|
+
return type || "note";
|
|
205
|
+
}
|
|
206
|
+
var BANNER_TYPES = [
|
|
207
|
+
"note",
|
|
208
|
+
"tip",
|
|
209
|
+
"important",
|
|
210
|
+
"warning",
|
|
211
|
+
"caution"
|
|
212
|
+
];
|
|
213
|
+
var BANNER_LABELS = {
|
|
214
|
+
note: "Note",
|
|
215
|
+
tip: "Tip",
|
|
216
|
+
important: "Important",
|
|
217
|
+
warning: "Warning",
|
|
218
|
+
caution: "Caution"
|
|
219
|
+
};
|
|
220
|
+
var BannerNode = class BannerNode extends DecoratorNode {
|
|
221
|
+
static getType() {
|
|
222
|
+
return "banner";
|
|
223
|
+
}
|
|
224
|
+
static clone(node) {
|
|
225
|
+
return new BannerNode(node.__bannerType, node.__contentState, node.__key);
|
|
226
|
+
}
|
|
227
|
+
constructor(bannerType, contentState, key) {
|
|
228
|
+
super(key);
|
|
229
|
+
_defineProperty(this, "__bannerType", void 0);
|
|
230
|
+
_defineProperty(this, "__contentState", void 0);
|
|
231
|
+
this.__bannerType = bannerType;
|
|
232
|
+
this.__contentState = contentState || { root: {
|
|
233
|
+
children: [{
|
|
234
|
+
type: "paragraph",
|
|
235
|
+
children: [],
|
|
236
|
+
direction: null,
|
|
237
|
+
format: "",
|
|
238
|
+
indent: 0,
|
|
239
|
+
textFormat: 0,
|
|
240
|
+
textStyle: "",
|
|
241
|
+
version: 1
|
|
242
|
+
}],
|
|
243
|
+
direction: null,
|
|
244
|
+
format: "",
|
|
245
|
+
indent: 0,
|
|
246
|
+
type: "root",
|
|
247
|
+
version: 1
|
|
248
|
+
} };
|
|
249
|
+
}
|
|
250
|
+
createDOM(_config) {
|
|
251
|
+
const div = document.createElement("div");
|
|
252
|
+
div.className = `rich-banner rich-banner-${this.__bannerType}`;
|
|
253
|
+
return div;
|
|
254
|
+
}
|
|
255
|
+
updateDOM(prevNode, dom) {
|
|
256
|
+
if (prevNode.__bannerType !== this.__bannerType) dom.className = `rich-banner rich-banner-${this.__bannerType}`;
|
|
257
|
+
return false;
|
|
258
|
+
}
|
|
259
|
+
isInline() {
|
|
260
|
+
return false;
|
|
261
|
+
}
|
|
262
|
+
getBannerType() {
|
|
263
|
+
return this.__bannerType;
|
|
264
|
+
}
|
|
265
|
+
setBannerType(bannerType) {
|
|
266
|
+
const writable = this.getWritable();
|
|
267
|
+
writable.__bannerType = bannerType;
|
|
268
|
+
}
|
|
269
|
+
getContentState() {
|
|
270
|
+
return this.getLatest().__contentState;
|
|
271
|
+
}
|
|
272
|
+
setContentState(state) {
|
|
273
|
+
const writable = this.getWritable();
|
|
274
|
+
writable.__contentState = state;
|
|
275
|
+
}
|
|
276
|
+
getTextContent() {
|
|
277
|
+
return extractTextContent(this.__contentState);
|
|
278
|
+
}
|
|
279
|
+
static importJSON(_serializedNode) {
|
|
280
|
+
const serializedNode = _serializedNode;
|
|
281
|
+
const legacy = serializedNode;
|
|
282
|
+
const bannerType = normalizeBannerType(serializedNode.bannerType);
|
|
283
|
+
if (serializedNode.content) return new BannerNode(bannerType, serializedNode.content).updateFromJSON(_serializedNode);
|
|
284
|
+
if (legacy.children) {
|
|
285
|
+
const content = { root: {
|
|
286
|
+
children: legacy.children,
|
|
287
|
+
direction: null,
|
|
288
|
+
format: "",
|
|
289
|
+
indent: 0,
|
|
290
|
+
type: "root",
|
|
291
|
+
version: 1
|
|
292
|
+
} };
|
|
293
|
+
return new BannerNode(bannerType, content).updateFromJSON(_serializedNode);
|
|
294
|
+
}
|
|
295
|
+
return new BannerNode(bannerType).updateFromJSON(_serializedNode);
|
|
296
|
+
}
|
|
297
|
+
exportJSON() {
|
|
298
|
+
return {
|
|
299
|
+
...super.exportJSON(),
|
|
300
|
+
type: "banner",
|
|
301
|
+
bannerType: this.__bannerType,
|
|
302
|
+
content: this.__contentState,
|
|
303
|
+
version: 1
|
|
304
|
+
};
|
|
305
|
+
}
|
|
306
|
+
decorate(_editor, _config) {
|
|
307
|
+
return createElement(BannerStaticDecorator, {
|
|
308
|
+
bannerType: this.__bannerType,
|
|
309
|
+
contentState: this.__contentState
|
|
310
|
+
});
|
|
311
|
+
}
|
|
312
|
+
};
|
|
313
|
+
function $isBannerNode(node) {
|
|
314
|
+
return node instanceof BannerNode;
|
|
315
|
+
}
|
|
316
|
+
//#endregion
|
|
317
|
+
//#region src/nodes/CodeBlockNode.ts
|
|
318
|
+
var CodeBlockNode = class CodeBlockNode extends DecoratorNode {
|
|
319
|
+
static getType() {
|
|
320
|
+
return "code-block";
|
|
321
|
+
}
|
|
322
|
+
static clone(node) {
|
|
323
|
+
return new CodeBlockNode(node.__code, node.__language, node.__key);
|
|
324
|
+
}
|
|
325
|
+
constructor(code, language, key) {
|
|
326
|
+
super(key);
|
|
327
|
+
_defineProperty(this, "__code", void 0);
|
|
328
|
+
_defineProperty(this, "__language", void 0);
|
|
329
|
+
this.__code = code;
|
|
330
|
+
this.__language = language;
|
|
331
|
+
}
|
|
332
|
+
createDOM(_config) {
|
|
333
|
+
const div = document.createElement("div");
|
|
334
|
+
div.className = "rich-code-block-wrapper";
|
|
335
|
+
return div;
|
|
336
|
+
}
|
|
337
|
+
updateDOM() {
|
|
338
|
+
return false;
|
|
339
|
+
}
|
|
340
|
+
isInline() {
|
|
341
|
+
return false;
|
|
342
|
+
}
|
|
343
|
+
isKeyboardSelectable() {
|
|
344
|
+
return true;
|
|
345
|
+
}
|
|
346
|
+
static importJSON(_serializedNode) {
|
|
347
|
+
const serializedNode = _serializedNode;
|
|
348
|
+
return $createCodeBlockNode(serializedNode.code, serializedNode.language).updateFromJSON(_serializedNode);
|
|
349
|
+
}
|
|
350
|
+
exportJSON() {
|
|
351
|
+
return {
|
|
352
|
+
...super.exportJSON(),
|
|
353
|
+
type: "code-block",
|
|
354
|
+
code: this.__code,
|
|
355
|
+
language: this.__language,
|
|
356
|
+
version: 1
|
|
357
|
+
};
|
|
358
|
+
}
|
|
359
|
+
getCode() {
|
|
360
|
+
return this.__code;
|
|
361
|
+
}
|
|
362
|
+
setCode(code) {
|
|
363
|
+
const writable = this.getWritable();
|
|
364
|
+
writable.__code = code;
|
|
365
|
+
}
|
|
366
|
+
getLanguage() {
|
|
367
|
+
return this.__language;
|
|
368
|
+
}
|
|
369
|
+
setLanguage(language) {
|
|
370
|
+
const writable = this.getWritable();
|
|
371
|
+
writable.__language = language;
|
|
372
|
+
}
|
|
373
|
+
decorate(_editor, _config) {
|
|
374
|
+
return createRendererDecoration(CODE_BLOCK_NODE_KEY, void 0, {
|
|
375
|
+
code: this.__code,
|
|
376
|
+
language: this.__language
|
|
377
|
+
});
|
|
378
|
+
}
|
|
379
|
+
};
|
|
380
|
+
_defineProperty(CodeBlockNode, "commandItems", [{
|
|
381
|
+
title: "Code Block",
|
|
382
|
+
icon: createElement(Code, { size: 20 }),
|
|
383
|
+
description: "Syntax-highlighted code",
|
|
384
|
+
keywords: [
|
|
385
|
+
"code",
|
|
386
|
+
"snippet",
|
|
387
|
+
"codeblock"
|
|
388
|
+
],
|
|
389
|
+
section: "MEDIA",
|
|
390
|
+
placement: ["slash", "toolbar"],
|
|
391
|
+
group: "insert",
|
|
392
|
+
onSelect: (editor) => {
|
|
393
|
+
editor.update(() => {
|
|
394
|
+
$insertNodes([$createCodeBlockNode("", "text")]);
|
|
395
|
+
});
|
|
396
|
+
}
|
|
397
|
+
}]);
|
|
398
|
+
function $createCodeBlockNode(code, language) {
|
|
399
|
+
return new CodeBlockNode(code, language);
|
|
400
|
+
}
|
|
401
|
+
function $isCodeBlockNode(node) {
|
|
402
|
+
return node instanceof CodeBlockNode;
|
|
403
|
+
}
|
|
404
|
+
//#endregion
|
|
405
|
+
//#region src/nodes/CommentNode.ts
|
|
406
|
+
var DEFAULT_COMMENT_TEXT = "comment";
|
|
407
|
+
var CommentNode = class CommentNode extends TextNode {
|
|
408
|
+
static getType() {
|
|
409
|
+
return "comment";
|
|
410
|
+
}
|
|
411
|
+
static clone(node) {
|
|
412
|
+
return new CommentNode(node.__text, node.__key);
|
|
413
|
+
}
|
|
414
|
+
static importDOM() {
|
|
415
|
+
return {
|
|
416
|
+
"#comment": () => ({
|
|
417
|
+
conversion: (domNode) => {
|
|
418
|
+
if (!(domNode instanceof Comment)) return null;
|
|
419
|
+
return { node: $createCommentNode(domNode.data) };
|
|
420
|
+
},
|
|
421
|
+
priority: 4
|
|
422
|
+
}),
|
|
423
|
+
"span": () => ({
|
|
424
|
+
conversion: (domNode) => {
|
|
425
|
+
if (!(domNode instanceof HTMLElement)) return null;
|
|
426
|
+
if (!domNode.classList.contains(semanticClassNames.comment)) return null;
|
|
427
|
+
return { node: $createCommentNode(domNode.dataset.comment ?? domNode.textContent ?? "") };
|
|
428
|
+
},
|
|
429
|
+
priority: 2
|
|
430
|
+
})
|
|
431
|
+
};
|
|
432
|
+
}
|
|
433
|
+
constructor(text, key) {
|
|
434
|
+
super(text, key);
|
|
435
|
+
}
|
|
436
|
+
createDOM(config) {
|
|
437
|
+
const element = super.createDOM(config);
|
|
438
|
+
element.classList.add(semanticClassNames.comment, sharedStyles.comment);
|
|
439
|
+
element.dataset.comment = this.__text;
|
|
440
|
+
return element;
|
|
441
|
+
}
|
|
442
|
+
updateDOM(prevNode, dom, config) {
|
|
443
|
+
const updated = super.updateDOM(prevNode, dom, config);
|
|
444
|
+
dom.classList.add(semanticClassNames.comment, sharedStyles.comment);
|
|
445
|
+
if (prevNode.__text !== this.__text) dom.dataset.comment = this.__text;
|
|
446
|
+
return updated;
|
|
447
|
+
}
|
|
448
|
+
exportDOM(_editor) {
|
|
449
|
+
return { element: document.createComment(this.getTextContent()) };
|
|
450
|
+
}
|
|
451
|
+
static importJSON(_serializedNode) {
|
|
452
|
+
const serializedNode = _serializedNode;
|
|
453
|
+
const node = $createCommentNode(serializedNode.text ?? "");
|
|
454
|
+
node.setFormat(serializedNode.format ?? 0);
|
|
455
|
+
node.setDetail(serializedNode.detail ?? 0);
|
|
456
|
+
node.setMode(serializedNode.mode ?? "normal");
|
|
457
|
+
node.setStyle(serializedNode.style ?? "");
|
|
458
|
+
return node;
|
|
459
|
+
}
|
|
460
|
+
exportJSON() {
|
|
461
|
+
return {
|
|
462
|
+
...super.exportJSON(),
|
|
463
|
+
type: "comment",
|
|
464
|
+
version: 1
|
|
465
|
+
};
|
|
466
|
+
}
|
|
467
|
+
};
|
|
468
|
+
_defineProperty(CommentNode, "commandItems", [{
|
|
469
|
+
title: "HTML Comment",
|
|
470
|
+
icon: createElement(MessageSquareQuote, { size: 20 }),
|
|
471
|
+
description: "Insert an HTML comment node",
|
|
472
|
+
keywords: [
|
|
473
|
+
"comment",
|
|
474
|
+
"html",
|
|
475
|
+
"annotation",
|
|
476
|
+
"hidden",
|
|
477
|
+
"<!-- -->"
|
|
478
|
+
],
|
|
479
|
+
section: "INLINE",
|
|
480
|
+
placement: ["slash", "toolbar"],
|
|
481
|
+
group: "insert",
|
|
482
|
+
onSelect: (editor, _queryString) => {
|
|
483
|
+
editor.update(() => {
|
|
484
|
+
const node = $createCommentNode(DEFAULT_COMMENT_TEXT);
|
|
485
|
+
$insertNodes([node]);
|
|
486
|
+
node.select(0, node.getTextContentSize());
|
|
487
|
+
});
|
|
488
|
+
}
|
|
489
|
+
}]);
|
|
490
|
+
function $createCommentNode(text) {
|
|
491
|
+
return new CommentNode(text);
|
|
492
|
+
}
|
|
493
|
+
function $createCommentPlaceholderNode() {
|
|
494
|
+
return $createCommentNode(DEFAULT_COMMENT_TEXT);
|
|
495
|
+
}
|
|
496
|
+
function $isCommentNode(node) {
|
|
497
|
+
return node instanceof CommentNode;
|
|
498
|
+
}
|
|
499
|
+
//#endregion
|
|
500
|
+
//#region src/utils/lucide-dom.ts
|
|
501
|
+
var SVG_NS = "http://www.w3.org/2000/svg";
|
|
502
|
+
var DEFAULT_ATTRS = {
|
|
503
|
+
xmlns: SVG_NS,
|
|
504
|
+
width: "24",
|
|
505
|
+
height: "24",
|
|
506
|
+
viewBox: "0 0 24 24",
|
|
507
|
+
fill: "none",
|
|
508
|
+
stroke: "currentColor",
|
|
509
|
+
"stroke-width": "2",
|
|
510
|
+
"stroke-linecap": "round",
|
|
511
|
+
"stroke-linejoin": "round"
|
|
512
|
+
};
|
|
513
|
+
function createLucideSvg(iconNode, attrs = {}) {
|
|
514
|
+
const svg = document.createElementNS(SVG_NS, "svg");
|
|
515
|
+
const merged = {
|
|
516
|
+
...DEFAULT_ATTRS,
|
|
517
|
+
...attrs
|
|
518
|
+
};
|
|
519
|
+
for (const [k, v] of Object.entries(merged)) svg.setAttribute(k, v);
|
|
520
|
+
for (const [tag, elAttrs] of iconNode) {
|
|
521
|
+
const el = document.createElementNS(SVG_NS, tag);
|
|
522
|
+
for (const [k, v] of Object.entries(elAttrs)) {
|
|
523
|
+
if (k === "key") continue;
|
|
524
|
+
el.setAttribute(k, v);
|
|
525
|
+
}
|
|
526
|
+
svg.append(el);
|
|
527
|
+
}
|
|
528
|
+
return svg;
|
|
529
|
+
}
|
|
530
|
+
//#endregion
|
|
531
|
+
//#region src/nodes/DetailsNode.ts
|
|
532
|
+
var ChevronRightIconNode = [["path", { d: "M8 6L12 10L8 14" }]];
|
|
533
|
+
var DetailsNode = class DetailsNode extends ElementNode {
|
|
534
|
+
static getType() {
|
|
535
|
+
return "details";
|
|
536
|
+
}
|
|
537
|
+
static clone(node) {
|
|
538
|
+
return new DetailsNode(node.__summary, node.__open, node.__key);
|
|
539
|
+
}
|
|
540
|
+
constructor(summary, open = false, key) {
|
|
541
|
+
super(key);
|
|
542
|
+
_defineProperty(this, "__summary", void 0);
|
|
543
|
+
_defineProperty(this, "__open", void 0);
|
|
544
|
+
this.__summary = summary;
|
|
545
|
+
this.__open = open;
|
|
546
|
+
}
|
|
547
|
+
createDOM(_config) {
|
|
548
|
+
const details = document.createElement("details");
|
|
549
|
+
details.className = `${detailsClassNames.details} ${detailsStyles.details}`;
|
|
550
|
+
if (this.__open) details.open = true;
|
|
551
|
+
const summary = document.createElement("summary");
|
|
552
|
+
summary.className = `${detailsClassNames.summary} ${detailsStyles.summary}`;
|
|
553
|
+
const chevron = document.createElement("span");
|
|
554
|
+
chevron.className = `${detailsClassNames.chevron} ${detailsStyles.chevron}`;
|
|
555
|
+
chevron.setAttribute("aria-hidden", "true");
|
|
556
|
+
chevron.append(createLucideSvg(ChevronRightIconNode, {
|
|
557
|
+
"width": "20",
|
|
558
|
+
"height": "20",
|
|
559
|
+
"viewBox": "0 0 20 20",
|
|
560
|
+
"stroke-width": "1.5"
|
|
561
|
+
}));
|
|
562
|
+
summary.append(chevron);
|
|
563
|
+
const label = document.createElement("span");
|
|
564
|
+
label.className = `${detailsClassNames.summaryText} ${detailsStyles.summaryText}`;
|
|
565
|
+
label.textContent = this.__summary;
|
|
566
|
+
summary.append(label);
|
|
567
|
+
const content = document.createElement("div");
|
|
568
|
+
content.className = `${detailsClassNames.content} ${detailsStyles.content}`;
|
|
569
|
+
details.append(summary, content);
|
|
570
|
+
return details;
|
|
571
|
+
}
|
|
572
|
+
updateDOM(prevNode, dom) {
|
|
573
|
+
const details = dom;
|
|
574
|
+
if (prevNode.__open !== this.__open) details.open = this.__open;
|
|
575
|
+
if (prevNode.__summary !== this.__summary) {
|
|
576
|
+
const label = dom.querySelector(`.${detailsClassNames.summaryText}`);
|
|
577
|
+
if (label) label.textContent = this.__summary;
|
|
578
|
+
}
|
|
579
|
+
return false;
|
|
580
|
+
}
|
|
581
|
+
static importJSON(_serializedNode) {
|
|
582
|
+
const serializedNode = _serializedNode;
|
|
583
|
+
return $createDetailsNode(serializedNode.summary, serializedNode.open).updateFromJSON(serializedNode);
|
|
584
|
+
}
|
|
585
|
+
exportJSON() {
|
|
586
|
+
return {
|
|
587
|
+
...super.exportJSON(),
|
|
588
|
+
type: "details",
|
|
589
|
+
summary: this.__summary,
|
|
590
|
+
open: this.__open,
|
|
591
|
+
version: 1
|
|
592
|
+
};
|
|
593
|
+
}
|
|
594
|
+
getSummary() {
|
|
595
|
+
return this.getLatest().__summary;
|
|
596
|
+
}
|
|
597
|
+
setSummary(summary) {
|
|
598
|
+
const writable = this.getWritable();
|
|
599
|
+
writable.__summary = summary;
|
|
600
|
+
}
|
|
601
|
+
getOpen() {
|
|
602
|
+
return this.getLatest().__open;
|
|
603
|
+
}
|
|
604
|
+
setOpen(open) {
|
|
605
|
+
const writable = this.getWritable();
|
|
606
|
+
writable.__open = open;
|
|
607
|
+
}
|
|
608
|
+
toggleOpen() {
|
|
609
|
+
this.setOpen(!this.getOpen());
|
|
610
|
+
}
|
|
611
|
+
getDOMSlot(element) {
|
|
612
|
+
const content = element.querySelector(`.${detailsClassNames.content}`);
|
|
613
|
+
return super.getDOMSlot(element).withElement(content);
|
|
614
|
+
}
|
|
615
|
+
isInline() {
|
|
616
|
+
return false;
|
|
617
|
+
}
|
|
618
|
+
};
|
|
619
|
+
_defineProperty(DetailsNode, "slashMenuItems", [{
|
|
620
|
+
title: "Details",
|
|
621
|
+
icon: createElement(ChevronRight, { size: 20 }),
|
|
622
|
+
description: "Collapsible content block",
|
|
623
|
+
keywords: [
|
|
624
|
+
"details",
|
|
625
|
+
"toggle",
|
|
626
|
+
"collapse",
|
|
627
|
+
"accordion"
|
|
628
|
+
],
|
|
629
|
+
section: "ADVANCED",
|
|
630
|
+
onSelect: (editor) => {
|
|
631
|
+
editor.update(() => {
|
|
632
|
+
const details = $createDetailsNode("Details", true);
|
|
633
|
+
const paragraph = $createParagraphNode();
|
|
634
|
+
details.append(paragraph);
|
|
635
|
+
$insertNodes([details]);
|
|
636
|
+
paragraph.selectStart();
|
|
637
|
+
});
|
|
638
|
+
}
|
|
639
|
+
}]);
|
|
640
|
+
function $createDetailsNode(summary, open = false) {
|
|
641
|
+
return new DetailsNode(summary, open);
|
|
642
|
+
}
|
|
643
|
+
//#endregion
|
|
644
|
+
//#region src/nodes/FileNode.ts
|
|
645
|
+
function fileExtFromName(name) {
|
|
646
|
+
const index = name.lastIndexOf(".");
|
|
647
|
+
if (index <= 0 || index === name.length - 1) return void 0;
|
|
648
|
+
const ext = name.slice(index + 1).toLowerCase();
|
|
649
|
+
return ext.length > 8 ? void 0 : ext;
|
|
650
|
+
}
|
|
651
|
+
var FileNode = class FileNode extends DecoratorNode {
|
|
652
|
+
static getType() {
|
|
653
|
+
return "file";
|
|
654
|
+
}
|
|
655
|
+
static clone(node) {
|
|
656
|
+
return new FileNode({
|
|
657
|
+
src: node.__src,
|
|
658
|
+
name: node.__name,
|
|
659
|
+
size: node.__size,
|
|
660
|
+
mimeType: node.__mimeType,
|
|
661
|
+
ext: node.__ext,
|
|
662
|
+
display: node.__display
|
|
663
|
+
}, node.__key);
|
|
664
|
+
}
|
|
665
|
+
constructor(payload, key) {
|
|
666
|
+
super(key);
|
|
667
|
+
_defineProperty(this, "__src", void 0);
|
|
668
|
+
_defineProperty(this, "__name", void 0);
|
|
669
|
+
_defineProperty(this, "__size", void 0);
|
|
670
|
+
_defineProperty(this, "__mimeType", void 0);
|
|
671
|
+
_defineProperty(this, "__ext", void 0);
|
|
672
|
+
_defineProperty(this, "__display", void 0);
|
|
673
|
+
this.__src = payload.src;
|
|
674
|
+
this.__name = payload.name;
|
|
675
|
+
this.__size = payload.size;
|
|
676
|
+
this.__mimeType = payload.mimeType;
|
|
677
|
+
this.__ext = payload.ext;
|
|
678
|
+
this.__display = payload.display ?? "block";
|
|
679
|
+
}
|
|
680
|
+
createDOM(_config) {
|
|
681
|
+
const el = document.createElement(this.__display === "inline" ? "span" : "div");
|
|
682
|
+
el.className = "rich-file-wrapper";
|
|
683
|
+
if (this.__display === "inline") markInlineDraggable(el, this.getKey());
|
|
684
|
+
return el;
|
|
685
|
+
}
|
|
686
|
+
updateDOM() {
|
|
687
|
+
return false;
|
|
688
|
+
}
|
|
689
|
+
isInline() {
|
|
690
|
+
return this.__display === "inline";
|
|
691
|
+
}
|
|
692
|
+
static importJSON(_serializedNode) {
|
|
693
|
+
const serializedNode = _serializedNode;
|
|
694
|
+
return $createFileNode({
|
|
695
|
+
src: serializedNode.src,
|
|
696
|
+
name: serializedNode.name,
|
|
697
|
+
size: serializedNode.size,
|
|
698
|
+
mimeType: serializedNode.mimeType,
|
|
699
|
+
ext: serializedNode.ext,
|
|
700
|
+
display: serializedNode.display
|
|
701
|
+
}).updateFromJSON(_serializedNode);
|
|
702
|
+
}
|
|
703
|
+
exportJSON() {
|
|
704
|
+
return {
|
|
705
|
+
...super.exportJSON(),
|
|
706
|
+
type: "file",
|
|
707
|
+
src: this.__src,
|
|
708
|
+
name: this.__name,
|
|
709
|
+
size: this.__size,
|
|
710
|
+
mimeType: this.__mimeType,
|
|
711
|
+
ext: this.__ext,
|
|
712
|
+
display: this.__display,
|
|
713
|
+
version: 1
|
|
714
|
+
};
|
|
715
|
+
}
|
|
716
|
+
getSrc() {
|
|
717
|
+
return this.getLatest().__src;
|
|
718
|
+
}
|
|
719
|
+
setSrc(src) {
|
|
720
|
+
this.getWritable().__src = src;
|
|
721
|
+
}
|
|
722
|
+
getName() {
|
|
723
|
+
return this.getLatest().__name;
|
|
724
|
+
}
|
|
725
|
+
setName(name) {
|
|
726
|
+
this.getWritable().__name = name;
|
|
727
|
+
}
|
|
728
|
+
getDisplay() {
|
|
729
|
+
return this.getLatest().__display;
|
|
730
|
+
}
|
|
731
|
+
getPayload() {
|
|
732
|
+
const latest = this.getLatest();
|
|
733
|
+
return {
|
|
734
|
+
src: latest.__src,
|
|
735
|
+
name: latest.__name,
|
|
736
|
+
size: latest.__size,
|
|
737
|
+
mimeType: latest.__mimeType,
|
|
738
|
+
ext: latest.__ext,
|
|
739
|
+
display: latest.__display
|
|
740
|
+
};
|
|
741
|
+
}
|
|
742
|
+
setFilePayload(payload) {
|
|
743
|
+
const writable = this.getWritable();
|
|
744
|
+
if (payload.src !== void 0) writable.__src = payload.src;
|
|
745
|
+
if (payload.name !== void 0) writable.__name = payload.name;
|
|
746
|
+
writable.__size = payload.size;
|
|
747
|
+
writable.__mimeType = payload.mimeType;
|
|
748
|
+
writable.__ext = payload.ext;
|
|
749
|
+
}
|
|
750
|
+
decorate(_editor, _config) {
|
|
751
|
+
return createRendererDecoration(FILE_NODE_KEY, FileRenderer, {
|
|
752
|
+
src: this.__src,
|
|
753
|
+
name: this.__name,
|
|
754
|
+
size: this.__size,
|
|
755
|
+
mimeType: this.__mimeType,
|
|
756
|
+
ext: this.__ext,
|
|
757
|
+
display: this.__display,
|
|
758
|
+
nodeKey: this.getKey()
|
|
759
|
+
});
|
|
760
|
+
}
|
|
761
|
+
};
|
|
762
|
+
_defineProperty(FileNode, "commandItems", [{
|
|
763
|
+
title: "File",
|
|
764
|
+
icon: createElement(Paperclip, { size: 20 }),
|
|
765
|
+
description: "Attach a file",
|
|
766
|
+
keywords: [
|
|
767
|
+
"file",
|
|
768
|
+
"attachment",
|
|
769
|
+
"upload",
|
|
770
|
+
"wenjian",
|
|
771
|
+
"fujian"
|
|
772
|
+
],
|
|
773
|
+
section: "MEDIA",
|
|
774
|
+
placement: ["slash", "toolbar"],
|
|
775
|
+
group: "insert",
|
|
776
|
+
onSelect: (editor) => {
|
|
777
|
+
editor.dispatchCommand(OPEN_FILE_PICKER_COMMAND, void 0);
|
|
778
|
+
}
|
|
779
|
+
}]);
|
|
780
|
+
function $createFileNode(payload) {
|
|
781
|
+
return new FileNode(payload);
|
|
782
|
+
}
|
|
783
|
+
function $isFileNode(node) {
|
|
784
|
+
return node instanceof FileNode;
|
|
785
|
+
}
|
|
786
|
+
//#endregion
|
|
787
|
+
//#region src/nodes/FootnoteNode.ts
|
|
788
|
+
var FootnoteNode = class FootnoteNode extends DecoratorNode {
|
|
789
|
+
static getType() {
|
|
790
|
+
return "footnote";
|
|
791
|
+
}
|
|
792
|
+
static clone(node) {
|
|
793
|
+
return new FootnoteNode(node.__identifier, node.__key);
|
|
794
|
+
}
|
|
795
|
+
constructor(identifier, key) {
|
|
796
|
+
super(key);
|
|
797
|
+
_defineProperty(this, "__identifier", void 0);
|
|
798
|
+
this.__identifier = identifier;
|
|
799
|
+
}
|
|
800
|
+
createDOM(_config) {
|
|
801
|
+
const sup = document.createElement("sup");
|
|
802
|
+
sup.className = `${semanticClassNames.footnote} ${sharedStyles.footnote}`;
|
|
803
|
+
return sup;
|
|
804
|
+
}
|
|
805
|
+
updateDOM() {
|
|
806
|
+
return false;
|
|
807
|
+
}
|
|
808
|
+
isInline() {
|
|
809
|
+
return true;
|
|
810
|
+
}
|
|
811
|
+
static importJSON(_serializedNode) {
|
|
812
|
+
return $createFootnoteNode(_serializedNode.identifier).updateFromJSON(_serializedNode);
|
|
813
|
+
}
|
|
814
|
+
exportJSON() {
|
|
815
|
+
return {
|
|
816
|
+
...super.exportJSON(),
|
|
817
|
+
type: "footnote",
|
|
818
|
+
identifier: this.__identifier,
|
|
819
|
+
version: 1
|
|
820
|
+
};
|
|
821
|
+
}
|
|
822
|
+
getIdentifier() {
|
|
823
|
+
return this.getLatest().__identifier;
|
|
824
|
+
}
|
|
825
|
+
setIdentifier(identifier) {
|
|
826
|
+
const writable = this.getWritable();
|
|
827
|
+
writable.__identifier = identifier;
|
|
828
|
+
}
|
|
829
|
+
decorate(_editor, _config) {
|
|
830
|
+
return createRendererDecoration(FOOTNOTE_NODE_KEY, FootnoteStaticRenderer, { identifier: this.__identifier });
|
|
831
|
+
}
|
|
832
|
+
};
|
|
833
|
+
function $createFootnoteNode(identifier) {
|
|
834
|
+
return new FootnoteNode(identifier);
|
|
835
|
+
}
|
|
836
|
+
//#endregion
|
|
837
|
+
//#region src/components/renderers/FootnoteSectionRenderer.tsx
|
|
838
|
+
function FootnoteSectionRenderer({ definitions }) {
|
|
839
|
+
const { displayNumberMap } = useFootnoteDefinitions();
|
|
840
|
+
const sortedEntries = Object.entries(definitions).sort(([a], [b]) => (displayNumberMap[a] ?? 0) - (displayNumberMap[b] ?? 0));
|
|
841
|
+
if (sortedEntries.length === 0) return null;
|
|
842
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
843
|
+
role: "doc-endnotes",
|
|
844
|
+
className: clsx("rich-footnote-section-content", semanticClassNames.footnoteSection, sharedStyles.footnoteSection),
|
|
845
|
+
children: [/* @__PURE__ */ jsx("hr", { className: clsx(semanticClassNames.footnoteSectionDivider, sharedStyles.footnoteSectionDivider) }), /* @__PURE__ */ jsx("ol", {
|
|
846
|
+
className: clsx(semanticClassNames.footnoteSectionList, sharedStyles.footnoteSectionList),
|
|
847
|
+
children: sortedEntries.map(([identifier, content]) => {
|
|
848
|
+
const displayNum = displayNumberMap[identifier] ?? identifier;
|
|
849
|
+
return /* @__PURE__ */ jsx(FootnoteSectionItem, {
|
|
850
|
+
content,
|
|
851
|
+
displayNum,
|
|
852
|
+
identifier
|
|
853
|
+
}, identifier);
|
|
854
|
+
})
|
|
855
|
+
})]
|
|
856
|
+
});
|
|
857
|
+
}
|
|
858
|
+
function FootnoteSectionItem({ identifier, content, displayNum }) {
|
|
859
|
+
const targetId = `footnote-${identifier}`;
|
|
860
|
+
const refId = `footnote-ref-${identifier}`;
|
|
861
|
+
const handleBackClick = useCallback((e) => {
|
|
862
|
+
e.preventDefault();
|
|
863
|
+
const refElement = document.getElementById(refId);
|
|
864
|
+
if (!refElement) return;
|
|
865
|
+
refElement.scrollIntoView({
|
|
866
|
+
behavior: "smooth",
|
|
867
|
+
block: "center"
|
|
868
|
+
});
|
|
869
|
+
refElement.classList.add(semanticClassNames.footnoteHighlight, sharedStyles.footnoteHighlight);
|
|
870
|
+
window.setTimeout(() => {
|
|
871
|
+
refElement.classList.remove(semanticClassNames.footnoteHighlight, sharedStyles.footnoteHighlight);
|
|
872
|
+
}, 1200);
|
|
873
|
+
}, [refId]);
|
|
874
|
+
return /* @__PURE__ */ jsxs("li", {
|
|
875
|
+
className: clsx(semanticClassNames.footnoteSectionItem, sharedStyles.footnoteSectionItem),
|
|
876
|
+
id: targetId,
|
|
877
|
+
value: typeof displayNum === "number" ? displayNum : void 0,
|
|
878
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
879
|
+
className: "rich-footnote-section-item-content",
|
|
880
|
+
children: content
|
|
881
|
+
}), /* @__PURE__ */ jsx("a", {
|
|
882
|
+
"aria-label": `Back to reference ${displayNum}`,
|
|
883
|
+
className: clsx(semanticClassNames.footnoteBackRef, sharedStyles.footnoteBackRef),
|
|
884
|
+
href: `#${refId}`,
|
|
885
|
+
role: "doc-backlink",
|
|
886
|
+
onClick: handleBackClick,
|
|
887
|
+
children: "↩"
|
|
888
|
+
})]
|
|
889
|
+
});
|
|
890
|
+
}
|
|
891
|
+
//#endregion
|
|
892
|
+
//#region src/nodes/FootnoteSectionNode.ts
|
|
893
|
+
var FootnoteSectionNode = class FootnoteSectionNode extends DecoratorNode {
|
|
894
|
+
static getType() {
|
|
895
|
+
return "footnote-section";
|
|
896
|
+
}
|
|
897
|
+
static clone(node) {
|
|
898
|
+
return new FootnoteSectionNode({ ...node.__definitions }, node.__key);
|
|
899
|
+
}
|
|
900
|
+
constructor(definitions, key) {
|
|
901
|
+
super(key);
|
|
902
|
+
_defineProperty(this, "__definitions", void 0);
|
|
903
|
+
this.__definitions = definitions;
|
|
904
|
+
}
|
|
905
|
+
createDOM(_config) {
|
|
906
|
+
const div = document.createElement("div");
|
|
907
|
+
div.className = `${semanticClassNames.footnoteSection} ${sharedStyles.footnoteSection}`;
|
|
908
|
+
return div;
|
|
909
|
+
}
|
|
910
|
+
updateDOM() {
|
|
911
|
+
return false;
|
|
912
|
+
}
|
|
913
|
+
isInline() {
|
|
914
|
+
return false;
|
|
915
|
+
}
|
|
916
|
+
static importJSON(_serializedNode) {
|
|
917
|
+
return $createFootnoteSectionNode(_serializedNode.definitions).updateFromJSON(_serializedNode);
|
|
918
|
+
}
|
|
919
|
+
exportJSON() {
|
|
920
|
+
return {
|
|
921
|
+
...super.exportJSON(),
|
|
922
|
+
type: "footnote-section",
|
|
923
|
+
definitions: this.__definitions,
|
|
165
924
|
version: 1
|
|
166
925
|
};
|
|
167
926
|
}
|
|
927
|
+
getDefinitions() {
|
|
928
|
+
return this.getLatest().__definitions;
|
|
929
|
+
}
|
|
930
|
+
setDefinitions(definitions) {
|
|
931
|
+
const writable = this.getWritable();
|
|
932
|
+
writable.__definitions = definitions;
|
|
933
|
+
}
|
|
934
|
+
getDefinition(identifier) {
|
|
935
|
+
return this.getLatest().__definitions[identifier];
|
|
936
|
+
}
|
|
937
|
+
setDefinition(identifier, content) {
|
|
938
|
+
const writable = this.getWritable();
|
|
939
|
+
writable.__definitions = {
|
|
940
|
+
...writable.__definitions,
|
|
941
|
+
[identifier]: content
|
|
942
|
+
};
|
|
943
|
+
}
|
|
944
|
+
removeDefinition(identifier) {
|
|
945
|
+
const writable = this.getWritable();
|
|
946
|
+
const { [identifier]: _, ...rest } = writable.__definitions;
|
|
947
|
+
writable.__definitions = rest;
|
|
948
|
+
}
|
|
168
949
|
decorate(_editor, _config) {
|
|
169
|
-
return
|
|
170
|
-
|
|
171
|
-
|
|
950
|
+
return createRendererDecoration(FOOTNOTE_SECTION_NODE_KEY, FootnoteSectionRenderer, {
|
|
951
|
+
definitions: this.__definitions,
|
|
952
|
+
nodeKey: this.__key
|
|
172
953
|
});
|
|
173
954
|
}
|
|
174
955
|
};
|
|
175
|
-
function $
|
|
176
|
-
return
|
|
956
|
+
function $createFootnoteSectionNode(definitions = {}) {
|
|
957
|
+
return new FootnoteSectionNode(definitions);
|
|
958
|
+
}
|
|
959
|
+
function $isFootnoteSectionNode(node) {
|
|
960
|
+
return node instanceof FootnoteSectionNode;
|
|
177
961
|
}
|
|
178
962
|
//#endregion
|
|
179
|
-
//#region src/
|
|
180
|
-
|
|
963
|
+
//#region src/utils/occurrence-keys.ts
|
|
964
|
+
/**
|
|
965
|
+
* Content-derived React keys for items without their own identity: each value is
|
|
966
|
+
* suffixed with how many identical values precede it, so duplicates stay unique and
|
|
967
|
+
* unchanged items keep their key when others are inserted or removed around them.
|
|
968
|
+
*/
|
|
969
|
+
function occurrenceKeys(values) {
|
|
970
|
+
const seen = /* @__PURE__ */ new Map();
|
|
971
|
+
return values.map((value) => {
|
|
972
|
+
const occurrence = seen.get(value) ?? 0;
|
|
973
|
+
seen.set(value, occurrence + 1);
|
|
974
|
+
return `${occurrence}:${value}`;
|
|
975
|
+
});
|
|
976
|
+
}
|
|
181
977
|
//#endregion
|
|
182
|
-
//#region src/
|
|
183
|
-
|
|
978
|
+
//#region src/components/renderers/GridStaticDecorator.tsx
|
|
979
|
+
function GridStaticDecorator({ cols, gap, cellStates }) {
|
|
980
|
+
const renderContent = useNestedContentRenderer();
|
|
981
|
+
const cellKeys = useMemo(() => occurrenceKeys(cellStates.map((state) => JSON.stringify(state))), [cellStates]);
|
|
982
|
+
return /* @__PURE__ */ jsx("div", {
|
|
983
|
+
className: clsx(gridClassNames.inner, gridStyles.inner),
|
|
984
|
+
style: {
|
|
985
|
+
display: "grid",
|
|
986
|
+
gridTemplateColumns: `repeat(${cols}, 1fr)`,
|
|
987
|
+
gap
|
|
988
|
+
},
|
|
989
|
+
children: cellStates.map((state, i) => /* @__PURE__ */ jsx("div", {
|
|
990
|
+
className: clsx(gridClassNames.cell, gridStyles.cell),
|
|
991
|
+
children: renderContent(state)
|
|
992
|
+
}, cellKeys[i]))
|
|
993
|
+
});
|
|
994
|
+
}
|
|
995
|
+
//#endregion
|
|
996
|
+
//#region src/nodes/GridContainerNode.ts
|
|
997
|
+
var GridContainerNode = class GridContainerNode extends DecoratorNode {
|
|
184
998
|
static getType() {
|
|
185
|
-
return "
|
|
999
|
+
return "grid-container";
|
|
186
1000
|
}
|
|
187
1001
|
static clone(node) {
|
|
188
|
-
return new
|
|
1002
|
+
return new GridContainerNode(node.__cols, node.__gap, [...node.__cellStates], node.__key);
|
|
189
1003
|
}
|
|
190
|
-
constructor(
|
|
1004
|
+
constructor(cols = 2, gap, cellStates, key) {
|
|
191
1005
|
super(key);
|
|
192
|
-
_defineProperty(this, "
|
|
193
|
-
this
|
|
1006
|
+
_defineProperty(this, "__cols", void 0);
|
|
1007
|
+
_defineProperty(this, "__gap", void 0);
|
|
1008
|
+
_defineProperty(this, "__cellStates", void 0);
|
|
1009
|
+
this.__cols = cols;
|
|
1010
|
+
this.__gap = gap || "16px";
|
|
1011
|
+
if (cellStates) this.__cellStates = cellStates;
|
|
1012
|
+
else {
|
|
1013
|
+
const emptyState = { root: {
|
|
1014
|
+
children: [{
|
|
1015
|
+
type: "paragraph",
|
|
1016
|
+
children: [],
|
|
1017
|
+
direction: null,
|
|
1018
|
+
format: "",
|
|
1019
|
+
indent: 0,
|
|
1020
|
+
textFormat: 0,
|
|
1021
|
+
textStyle: "",
|
|
1022
|
+
version: 1
|
|
1023
|
+
}],
|
|
1024
|
+
direction: null,
|
|
1025
|
+
format: "",
|
|
1026
|
+
indent: 0,
|
|
1027
|
+
type: "root",
|
|
1028
|
+
version: 1
|
|
1029
|
+
} };
|
|
1030
|
+
this.__cellStates = Array.from({ length: cols }, () => emptyState);
|
|
1031
|
+
}
|
|
194
1032
|
}
|
|
195
1033
|
createDOM(_config) {
|
|
196
|
-
const
|
|
197
|
-
|
|
198
|
-
return
|
|
1034
|
+
const div = document.createElement("div");
|
|
1035
|
+
div.className = `${gridClassNames.container} ${gridStyles.container}`;
|
|
1036
|
+
return div;
|
|
199
1037
|
}
|
|
200
1038
|
updateDOM() {
|
|
201
1039
|
return false;
|
|
202
1040
|
}
|
|
203
1041
|
isInline() {
|
|
204
|
-
return
|
|
1042
|
+
return false;
|
|
1043
|
+
}
|
|
1044
|
+
getCols() {
|
|
1045
|
+
return this.getLatest().__cols;
|
|
1046
|
+
}
|
|
1047
|
+
setCols(cols) {
|
|
1048
|
+
const writable = this.getWritable();
|
|
1049
|
+
const prev = writable.__cellStates.length;
|
|
1050
|
+
writable.__cols = cols;
|
|
1051
|
+
if (cols > prev) {
|
|
1052
|
+
const emptyState = { root: {
|
|
1053
|
+
children: [{
|
|
1054
|
+
type: "paragraph",
|
|
1055
|
+
children: [],
|
|
1056
|
+
direction: null,
|
|
1057
|
+
format: "",
|
|
1058
|
+
indent: 0,
|
|
1059
|
+
textFormat: 0,
|
|
1060
|
+
textStyle: "",
|
|
1061
|
+
version: 1
|
|
1062
|
+
}],
|
|
1063
|
+
direction: null,
|
|
1064
|
+
format: "",
|
|
1065
|
+
indent: 0,
|
|
1066
|
+
type: "root",
|
|
1067
|
+
version: 1
|
|
1068
|
+
} };
|
|
1069
|
+
for (let i = prev; i < cols; i++) writable.__cellStates.push(emptyState);
|
|
1070
|
+
}
|
|
1071
|
+
}
|
|
1072
|
+
getGap() {
|
|
1073
|
+
return this.getLatest().__gap;
|
|
1074
|
+
}
|
|
1075
|
+
setGap(gap) {
|
|
1076
|
+
const writable = this.getWritable();
|
|
1077
|
+
writable.__gap = gap;
|
|
1078
|
+
}
|
|
1079
|
+
getCellStates() {
|
|
1080
|
+
return this.getLatest().__cellStates;
|
|
1081
|
+
}
|
|
1082
|
+
addCells(count) {
|
|
1083
|
+
const writable = this.getWritable();
|
|
1084
|
+
const emptyState = { root: {
|
|
1085
|
+
children: [{
|
|
1086
|
+
type: "paragraph",
|
|
1087
|
+
children: [],
|
|
1088
|
+
direction: null,
|
|
1089
|
+
format: "",
|
|
1090
|
+
indent: 0,
|
|
1091
|
+
textFormat: 0,
|
|
1092
|
+
textStyle: "",
|
|
1093
|
+
version: 1
|
|
1094
|
+
}],
|
|
1095
|
+
direction: null,
|
|
1096
|
+
format: "",
|
|
1097
|
+
indent: 0,
|
|
1098
|
+
type: "root",
|
|
1099
|
+
version: 1
|
|
1100
|
+
} };
|
|
1101
|
+
for (let i = 0; i < count; i++) writable.__cellStates.push(emptyState);
|
|
1102
|
+
}
|
|
1103
|
+
removeCells(count) {
|
|
1104
|
+
const states = this.getWritable().__cellStates;
|
|
1105
|
+
const toRemove = Math.min(count, states.length);
|
|
1106
|
+
for (let i = 0; i < toRemove; i++) {
|
|
1107
|
+
const state = states.at(-1);
|
|
1108
|
+
if (!state) break;
|
|
1109
|
+
if (!(extractTextContent(state).trim() === "")) break;
|
|
1110
|
+
states.pop();
|
|
1111
|
+
}
|
|
1112
|
+
}
|
|
1113
|
+
getTextContent() {
|
|
1114
|
+
return this.__cellStates.map((s) => extractTextContent(s)).join("\n");
|
|
205
1115
|
}
|
|
206
1116
|
static importJSON(_serializedNode) {
|
|
207
|
-
|
|
1117
|
+
const legacy = _serializedNode;
|
|
1118
|
+
const cols = legacy.cols || 2;
|
|
1119
|
+
const rawGap = legacy.gap;
|
|
1120
|
+
const gap = typeof rawGap === "number" ? `${rawGap}px` : rawGap;
|
|
1121
|
+
if (legacy.cells && legacy.cells.length > 0) return new GridContainerNode(cols, gap, legacy.cells).updateFromJSON(_serializedNode);
|
|
1122
|
+
if (legacy.children) {
|
|
1123
|
+
const cellStates = legacy.children.map((child) => {
|
|
1124
|
+
return { root: {
|
|
1125
|
+
children: [child],
|
|
1126
|
+
direction: null,
|
|
1127
|
+
format: "",
|
|
1128
|
+
indent: 0,
|
|
1129
|
+
type: "root",
|
|
1130
|
+
version: 1
|
|
1131
|
+
} };
|
|
1132
|
+
});
|
|
1133
|
+
return new GridContainerNode(cols, gap, cellStates).updateFromJSON(_serializedNode);
|
|
1134
|
+
}
|
|
1135
|
+
return new GridContainerNode(cols, gap).updateFromJSON(_serializedNode);
|
|
208
1136
|
}
|
|
209
1137
|
exportJSON() {
|
|
210
1138
|
return {
|
|
211
1139
|
...super.exportJSON(),
|
|
212
|
-
type: "
|
|
213
|
-
|
|
1140
|
+
type: "grid-container",
|
|
1141
|
+
cols: this.__cols,
|
|
1142
|
+
gap: this.__gap,
|
|
1143
|
+
cells: this.__cellStates,
|
|
214
1144
|
version: 1
|
|
215
1145
|
};
|
|
216
1146
|
}
|
|
217
|
-
getIdentifier() {
|
|
218
|
-
return this.getLatest().__identifier;
|
|
219
|
-
}
|
|
220
|
-
setIdentifier(identifier) {
|
|
221
|
-
const writable = this.getWritable();
|
|
222
|
-
writable.__identifier = identifier;
|
|
223
|
-
}
|
|
224
1147
|
decorate(_editor, _config) {
|
|
225
|
-
return
|
|
1148
|
+
return createElement(GridStaticDecorator, {
|
|
1149
|
+
cols: this.__cols,
|
|
1150
|
+
gap: this.__gap,
|
|
1151
|
+
cellStates: this.__cellStates
|
|
1152
|
+
});
|
|
226
1153
|
}
|
|
227
1154
|
};
|
|
228
|
-
function $
|
|
229
|
-
return new
|
|
1155
|
+
function $createGridContainerNode(cols = 2, gap) {
|
|
1156
|
+
return new GridContainerNode(cols, gap);
|
|
1157
|
+
}
|
|
1158
|
+
function $isGridContainerNode(node) {
|
|
1159
|
+
return node instanceof GridContainerNode;
|
|
230
1160
|
}
|
|
231
1161
|
//#endregion
|
|
232
1162
|
//#region src/utils/image-display-size.ts
|
|
@@ -455,9 +1385,6 @@ function ImageRenderer({ src, altText, width, height, caption, thumbhash, accent
|
|
|
455
1385
|
});
|
|
456
1386
|
}
|
|
457
1387
|
//#endregion
|
|
458
|
-
//#region src/plugins/image-upload-command.ts
|
|
459
|
-
var OPEN_IMAGE_UPLOAD_DIALOG_COMMAND = createCommand("OPEN_IMAGE_UPLOAD_DIALOG_COMMAND");
|
|
460
|
-
//#endregion
|
|
461
1388
|
//#region src/utils/image-insertion.ts
|
|
462
1389
|
function $getSelectionAnchorNode() {
|
|
463
1390
|
const selection = $getSelection();
|
|
@@ -962,6 +1889,135 @@ function $isKaTeXInlineNode(node) {
|
|
|
962
1889
|
return node instanceof KaTeXInlineNode;
|
|
963
1890
|
}
|
|
964
1891
|
//#endregion
|
|
1892
|
+
//#region src/nodes/LinkCardNode.ts
|
|
1893
|
+
var LinkCardNode = class LinkCardNode extends DecoratorNode {
|
|
1894
|
+
static getType() {
|
|
1895
|
+
return "link-card";
|
|
1896
|
+
}
|
|
1897
|
+
static clone(node) {
|
|
1898
|
+
return new LinkCardNode({
|
|
1899
|
+
url: node.__url,
|
|
1900
|
+
source: node.__source,
|
|
1901
|
+
id: node.__id,
|
|
1902
|
+
title: node.__title,
|
|
1903
|
+
description: node.__description,
|
|
1904
|
+
favicon: node.__favicon,
|
|
1905
|
+
image: node.__image
|
|
1906
|
+
}, node.__key);
|
|
1907
|
+
}
|
|
1908
|
+
constructor(payload, key) {
|
|
1909
|
+
super(key);
|
|
1910
|
+
_defineProperty(this, "__url", void 0);
|
|
1911
|
+
_defineProperty(this, "__source", void 0);
|
|
1912
|
+
_defineProperty(this, "__id", void 0);
|
|
1913
|
+
_defineProperty(this, "__title", void 0);
|
|
1914
|
+
_defineProperty(this, "__description", void 0);
|
|
1915
|
+
_defineProperty(this, "__favicon", void 0);
|
|
1916
|
+
_defineProperty(this, "__image", void 0);
|
|
1917
|
+
this.__url = payload.url;
|
|
1918
|
+
this.__source = payload.source;
|
|
1919
|
+
this.__id = payload.id;
|
|
1920
|
+
this.__title = payload.title;
|
|
1921
|
+
this.__description = payload.description;
|
|
1922
|
+
this.__favicon = payload.favicon;
|
|
1923
|
+
this.__image = payload.image;
|
|
1924
|
+
}
|
|
1925
|
+
createDOM(_config) {
|
|
1926
|
+
const div = document.createElement("div");
|
|
1927
|
+
div.className = "rich-link-card-wrapper";
|
|
1928
|
+
return div;
|
|
1929
|
+
}
|
|
1930
|
+
updateDOM() {
|
|
1931
|
+
return false;
|
|
1932
|
+
}
|
|
1933
|
+
isInline() {
|
|
1934
|
+
return false;
|
|
1935
|
+
}
|
|
1936
|
+
static importJSON(_serializedNode) {
|
|
1937
|
+
const serializedNode = _serializedNode;
|
|
1938
|
+
return $createLinkCardNode({
|
|
1939
|
+
url: serializedNode.url,
|
|
1940
|
+
source: serializedNode.source,
|
|
1941
|
+
id: serializedNode.id,
|
|
1942
|
+
title: serializedNode.title,
|
|
1943
|
+
description: serializedNode.description,
|
|
1944
|
+
favicon: serializedNode.favicon,
|
|
1945
|
+
image: serializedNode.image
|
|
1946
|
+
}).updateFromJSON(_serializedNode);
|
|
1947
|
+
}
|
|
1948
|
+
exportJSON() {
|
|
1949
|
+
return {
|
|
1950
|
+
...super.exportJSON(),
|
|
1951
|
+
type: "link-card",
|
|
1952
|
+
url: this.__url,
|
|
1953
|
+
source: this.__source,
|
|
1954
|
+
id: this.__id,
|
|
1955
|
+
title: this.__title,
|
|
1956
|
+
description: this.__description,
|
|
1957
|
+
favicon: this.__favicon,
|
|
1958
|
+
image: this.__image,
|
|
1959
|
+
version: 1
|
|
1960
|
+
};
|
|
1961
|
+
}
|
|
1962
|
+
getUrl() {
|
|
1963
|
+
return this.getLatest().__url;
|
|
1964
|
+
}
|
|
1965
|
+
setUrl(url) {
|
|
1966
|
+
const writable = this.getWritable();
|
|
1967
|
+
writable.__url = url;
|
|
1968
|
+
}
|
|
1969
|
+
getSource() {
|
|
1970
|
+
return this.getLatest().__source;
|
|
1971
|
+
}
|
|
1972
|
+
setSource(source) {
|
|
1973
|
+
const writable = this.getWritable();
|
|
1974
|
+
writable.__source = source;
|
|
1975
|
+
}
|
|
1976
|
+
getId() {
|
|
1977
|
+
return this.getLatest().__id;
|
|
1978
|
+
}
|
|
1979
|
+
setId(id) {
|
|
1980
|
+
const writable = this.getWritable();
|
|
1981
|
+
writable.__id = id;
|
|
1982
|
+
}
|
|
1983
|
+
decorate(_editor, _config) {
|
|
1984
|
+
return createRendererDecoration(LINK_CARD_NODE_KEY, LinkCardRenderer, {
|
|
1985
|
+
url: this.__url,
|
|
1986
|
+
source: this.__source,
|
|
1987
|
+
id: this.__id,
|
|
1988
|
+
title: this.__title,
|
|
1989
|
+
description: this.__description,
|
|
1990
|
+
favicon: this.__favicon,
|
|
1991
|
+
image: this.__image
|
|
1992
|
+
});
|
|
1993
|
+
}
|
|
1994
|
+
};
|
|
1995
|
+
_defineProperty(LinkCardNode, "commandItems", [{
|
|
1996
|
+
title: "Link Card",
|
|
1997
|
+
icon: createElement(Link, { size: 20 }),
|
|
1998
|
+
description: "Link preview card",
|
|
1999
|
+
keywords: [
|
|
2000
|
+
"link",
|
|
2001
|
+
"card",
|
|
2002
|
+
"bookmark",
|
|
2003
|
+
"embed"
|
|
2004
|
+
],
|
|
2005
|
+
section: "MEDIA",
|
|
2006
|
+
placement: ["slash", "toolbar"],
|
|
2007
|
+
group: "insert",
|
|
2008
|
+
onSelect: (editor) => {
|
|
2009
|
+
editor.update(() => {
|
|
2010
|
+
$insertNodes([$createLinkCardNode({ url: "" })]);
|
|
2011
|
+
});
|
|
2012
|
+
}
|
|
2013
|
+
}]);
|
|
2014
|
+
function $createLinkCardNode(payload) {
|
|
2015
|
+
return new LinkCardNode(payload);
|
|
2016
|
+
}
|
|
2017
|
+
function $isLinkCardNode(node) {
|
|
2018
|
+
return node instanceof LinkCardNode;
|
|
2019
|
+
}
|
|
2020
|
+
//#endregion
|
|
965
2021
|
//#region src/components/renderers/MentionRenderer.tsx
|
|
966
2022
|
function MentionRenderer({ handle, displayName }) {
|
|
967
2023
|
const normalizedHandle = handle.replace(/^@+/, "");
|
|
@@ -1235,51 +2291,85 @@ function $isRichQuoteNode(node) {
|
|
|
1235
2291
|
return node instanceof RichQuoteNode;
|
|
1236
2292
|
}
|
|
1237
2293
|
//#endregion
|
|
1238
|
-
//#region src/nodes/
|
|
1239
|
-
|
|
2294
|
+
//#region src/nodes/RubyNode.ts
|
|
2295
|
+
function readBaseTextFromRuby(element) {
|
|
2296
|
+
let base = "";
|
|
2297
|
+
for (const child of Array.from(element.childNodes)) {
|
|
2298
|
+
if (child.nodeType === Node.TEXT_NODE) {
|
|
2299
|
+
base += child.textContent ?? "";
|
|
2300
|
+
continue;
|
|
2301
|
+
}
|
|
2302
|
+
if (child.nodeType !== Node.ELEMENT_NODE) continue;
|
|
2303
|
+
const childElement = child;
|
|
2304
|
+
const tag = childElement.tagName.toLowerCase();
|
|
2305
|
+
if (tag === "rt" || tag === "rp") continue;
|
|
2306
|
+
base += childElement.textContent ?? "";
|
|
2307
|
+
}
|
|
2308
|
+
return base;
|
|
2309
|
+
}
|
|
2310
|
+
var RubyNode = class RubyNode extends ElementNode {
|
|
1240
2311
|
static getType() {
|
|
1241
|
-
return "
|
|
2312
|
+
return "ruby";
|
|
1242
2313
|
}
|
|
1243
2314
|
static clone(node) {
|
|
1244
|
-
return new
|
|
2315
|
+
return new RubyNode(node.__reading, node.__key);
|
|
1245
2316
|
}
|
|
1246
|
-
constructor(key) {
|
|
2317
|
+
constructor(reading, key) {
|
|
1247
2318
|
super(key);
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
const span = document.createElement("span");
|
|
1251
|
-
span.className = `${semanticClassNames.spoiler} ${sharedStyles.spoiler}`;
|
|
1252
|
-
span.setAttribute("role", "button");
|
|
1253
|
-
span.setAttribute("tabindex", "0");
|
|
1254
|
-
span.setAttribute("aria-label", "Spoiler (click to reveal)");
|
|
1255
|
-
const toggle = () => {
|
|
1256
|
-
if (span.isContentEditable) return;
|
|
1257
|
-
span.classList.toggle(semanticClassNames.spoilerRevealed);
|
|
1258
|
-
const revealed = span.classList.toggle(sharedStyles.spoilerRevealed);
|
|
1259
|
-
span.setAttribute("aria-label", revealed ? "Spoiler (revealed)" : "Spoiler (click to reveal)");
|
|
1260
|
-
};
|
|
1261
|
-
span.addEventListener("click", toggle);
|
|
1262
|
-
span.addEventListener("keydown", (e) => {
|
|
1263
|
-
if (e.key === "Enter" || e.key === " ") {
|
|
1264
|
-
e.preventDefault();
|
|
1265
|
-
toggle();
|
|
1266
|
-
}
|
|
1267
|
-
});
|
|
1268
|
-
return span;
|
|
1269
|
-
}
|
|
1270
|
-
updateDOM() {
|
|
1271
|
-
return false;
|
|
2319
|
+
_defineProperty(this, "__reading", void 0);
|
|
2320
|
+
this.__reading = reading;
|
|
1272
2321
|
}
|
|
1273
2322
|
static importJSON(_serializedNode) {
|
|
1274
|
-
|
|
2323
|
+
const serializedNode = _serializedNode;
|
|
2324
|
+
return $createRubyNode(serializedNode.reading ?? "").updateFromJSON(serializedNode);
|
|
1275
2325
|
}
|
|
1276
2326
|
exportJSON() {
|
|
1277
2327
|
return {
|
|
1278
2328
|
...super.exportJSON(),
|
|
1279
|
-
type: "
|
|
2329
|
+
type: "ruby",
|
|
2330
|
+
reading: this.__reading,
|
|
1280
2331
|
version: 1
|
|
1281
2332
|
};
|
|
1282
2333
|
}
|
|
2334
|
+
static importDOM() {
|
|
2335
|
+
return { ruby: () => ({
|
|
2336
|
+
conversion: (domNode) => {
|
|
2337
|
+
if (!(domNode instanceof HTMLElement)) return null;
|
|
2338
|
+
const reading = domNode.querySelector("rt")?.textContent ?? "";
|
|
2339
|
+
const baseText = readBaseTextFromRuby(domNode);
|
|
2340
|
+
const node = $createRubyNode(reading);
|
|
2341
|
+
if (baseText) node.append($createTextNode(baseText));
|
|
2342
|
+
return { node };
|
|
2343
|
+
},
|
|
2344
|
+
priority: 2
|
|
2345
|
+
}) };
|
|
2346
|
+
}
|
|
2347
|
+
exportDOM() {
|
|
2348
|
+
const ruby = document.createElement("ruby");
|
|
2349
|
+
ruby.className = `${semanticClassNames.ruby} ${sharedStyles.ruby}`;
|
|
2350
|
+
const baseText = this.getTextContent();
|
|
2351
|
+
if (baseText) ruby.append(baseText);
|
|
2352
|
+
if (this.__reading) {
|
|
2353
|
+
const rt = document.createElement("rt");
|
|
2354
|
+
rt.className = `${semanticClassNames.rubyRt} ${sharedStyles.rubyRt}`;
|
|
2355
|
+
rt.textContent = this.__reading;
|
|
2356
|
+
ruby.append(rt);
|
|
2357
|
+
}
|
|
2358
|
+
return { element: ruby };
|
|
2359
|
+
}
|
|
2360
|
+
createDOM(_config) {
|
|
2361
|
+
const span = document.createElement("span");
|
|
2362
|
+
span.className = `${semanticClassNames.ruby} ${sharedStyles.ruby}`;
|
|
2363
|
+
if (this.__reading) span.dataset.ruby = this.__reading;
|
|
2364
|
+
return span;
|
|
2365
|
+
}
|
|
2366
|
+
updateDOM(prevNode, dom) {
|
|
2367
|
+
if (prevNode.__reading !== this.__reading) {
|
|
2368
|
+
if (this.__reading) dom.dataset.ruby = this.__reading;
|
|
2369
|
+
else delete dom.dataset.ruby;
|
|
2370
|
+
}
|
|
2371
|
+
return false;
|
|
2372
|
+
}
|
|
1283
2373
|
canInsertTextBefore() {
|
|
1284
2374
|
return true;
|
|
1285
2375
|
}
|
|
@@ -1289,12 +2379,19 @@ var SpoilerNode = class SpoilerNode extends ElementNode {
|
|
|
1289
2379
|
isInline() {
|
|
1290
2380
|
return true;
|
|
1291
2381
|
}
|
|
2382
|
+
getReading() {
|
|
2383
|
+
return this.getLatest().__reading;
|
|
2384
|
+
}
|
|
2385
|
+
setReading(reading) {
|
|
2386
|
+
const writable = this.getWritable();
|
|
2387
|
+
writable.__reading = reading;
|
|
2388
|
+
}
|
|
1292
2389
|
};
|
|
1293
|
-
function $
|
|
1294
|
-
return new
|
|
2390
|
+
function $createRubyNode(reading) {
|
|
2391
|
+
return new RubyNode(reading);
|
|
1295
2392
|
}
|
|
1296
|
-
function $
|
|
1297
|
-
return node instanceof
|
|
2393
|
+
function $isRubyNode(node) {
|
|
2394
|
+
return node instanceof RubyNode;
|
|
1298
2395
|
}
|
|
1299
2396
|
//#endregion
|
|
1300
2397
|
//#region src/utils/tag-color.ts
|
|
@@ -1406,6 +2503,160 @@ function $isTagNode(node) {
|
|
|
1406
2503
|
return node instanceof TagNode;
|
|
1407
2504
|
}
|
|
1408
2505
|
//#endregion
|
|
2506
|
+
//#region src/components/renderers/VideoRenderer.tsx
|
|
2507
|
+
function VideoRenderer({ src, poster, width, height }) {
|
|
2508
|
+
return /* @__PURE__ */ jsx("figure", {
|
|
2509
|
+
className: "rich-video",
|
|
2510
|
+
children: /* @__PURE__ */ jsx("video", {
|
|
2511
|
+
controls: true,
|
|
2512
|
+
height,
|
|
2513
|
+
poster,
|
|
2514
|
+
preload: "metadata",
|
|
2515
|
+
src,
|
|
2516
|
+
style: {
|
|
2517
|
+
maxWidth: "100%",
|
|
2518
|
+
height: "auto"
|
|
2519
|
+
},
|
|
2520
|
+
width
|
|
2521
|
+
})
|
|
2522
|
+
});
|
|
2523
|
+
}
|
|
2524
|
+
//#endregion
|
|
2525
|
+
//#region src/nodes/VideoNode.ts
|
|
2526
|
+
var VideoNode = class VideoNode extends DecoratorNode {
|
|
2527
|
+
static getType() {
|
|
2528
|
+
return "video";
|
|
2529
|
+
}
|
|
2530
|
+
static clone(node) {
|
|
2531
|
+
return new VideoNode({
|
|
2532
|
+
src: node.__src,
|
|
2533
|
+
poster: node.__poster,
|
|
2534
|
+
width: node.__width,
|
|
2535
|
+
height: node.__height
|
|
2536
|
+
}, node.__key);
|
|
2537
|
+
}
|
|
2538
|
+
constructor(payload, key) {
|
|
2539
|
+
super(key);
|
|
2540
|
+
_defineProperty(this, "__src", void 0);
|
|
2541
|
+
_defineProperty(this, "__poster", void 0);
|
|
2542
|
+
_defineProperty(this, "__width", void 0);
|
|
2543
|
+
_defineProperty(this, "__height", void 0);
|
|
2544
|
+
this.__src = payload.src;
|
|
2545
|
+
this.__poster = payload.poster;
|
|
2546
|
+
this.__width = payload.width;
|
|
2547
|
+
this.__height = payload.height;
|
|
2548
|
+
}
|
|
2549
|
+
createDOM(_config) {
|
|
2550
|
+
const div = document.createElement("div");
|
|
2551
|
+
div.className = "rich-video-wrapper";
|
|
2552
|
+
return div;
|
|
2553
|
+
}
|
|
2554
|
+
updateDOM() {
|
|
2555
|
+
return false;
|
|
2556
|
+
}
|
|
2557
|
+
isInline() {
|
|
2558
|
+
return false;
|
|
2559
|
+
}
|
|
2560
|
+
static importJSON(_serializedNode) {
|
|
2561
|
+
const serializedNode = _serializedNode;
|
|
2562
|
+
return $createVideoNode({
|
|
2563
|
+
src: serializedNode.src,
|
|
2564
|
+
poster: serializedNode.poster,
|
|
2565
|
+
width: serializedNode.width,
|
|
2566
|
+
height: serializedNode.height
|
|
2567
|
+
}).updateFromJSON(_serializedNode);
|
|
2568
|
+
}
|
|
2569
|
+
exportJSON() {
|
|
2570
|
+
return {
|
|
2571
|
+
...super.exportJSON(),
|
|
2572
|
+
type: "video",
|
|
2573
|
+
src: this.__src,
|
|
2574
|
+
poster: this.__poster,
|
|
2575
|
+
width: this.__width,
|
|
2576
|
+
height: this.__height,
|
|
2577
|
+
version: 1
|
|
2578
|
+
};
|
|
2579
|
+
}
|
|
2580
|
+
getSrc() {
|
|
2581
|
+
return this.getLatest().__src;
|
|
2582
|
+
}
|
|
2583
|
+
setSrc(src) {
|
|
2584
|
+
const writable = this.getWritable();
|
|
2585
|
+
writable.__src = src;
|
|
2586
|
+
}
|
|
2587
|
+
decorate(_editor, _config) {
|
|
2588
|
+
return createRendererDecoration(VIDEO_NODE_KEY, VideoRenderer, {
|
|
2589
|
+
src: this.__src,
|
|
2590
|
+
poster: this.__poster,
|
|
2591
|
+
width: this.__width,
|
|
2592
|
+
height: this.__height
|
|
2593
|
+
});
|
|
2594
|
+
}
|
|
2595
|
+
};
|
|
2596
|
+
_defineProperty(VideoNode, "commandItems", [{
|
|
2597
|
+
title: "Video",
|
|
2598
|
+
icon: createElement(Video, { size: 20 }),
|
|
2599
|
+
description: "Embed a video",
|
|
2600
|
+
keywords: [
|
|
2601
|
+
"video",
|
|
2602
|
+
"media",
|
|
2603
|
+
"mp4"
|
|
2604
|
+
],
|
|
2605
|
+
section: "MEDIA",
|
|
2606
|
+
placement: ["slash", "toolbar"],
|
|
2607
|
+
group: "insert",
|
|
2608
|
+
onSelect: (editor) => {
|
|
2609
|
+
editor.update(() => {
|
|
2610
|
+
$insertNodes([$createVideoNode({ src: "" })]);
|
|
2611
|
+
});
|
|
2612
|
+
}
|
|
2613
|
+
}]);
|
|
2614
|
+
function $createVideoNode(payload) {
|
|
2615
|
+
return new VideoNode(payload);
|
|
2616
|
+
}
|
|
2617
|
+
//#endregion
|
|
2618
|
+
//#region src/config.ts
|
|
2619
|
+
var builtinNodes = [
|
|
2620
|
+
HeadingNode,
|
|
2621
|
+
QuoteNode,
|
|
2622
|
+
RichQuoteNode,
|
|
2623
|
+
{
|
|
2624
|
+
replace: QuoteNode,
|
|
2625
|
+
with: () => new RichQuoteNode()
|
|
2626
|
+
},
|
|
2627
|
+
ListNode,
|
|
2628
|
+
ListItemNode,
|
|
2629
|
+
LinkNode,
|
|
2630
|
+
AutoLinkNode,
|
|
2631
|
+
HorizontalRuleNode,
|
|
2632
|
+
TableNode,
|
|
2633
|
+
TableCellNode,
|
|
2634
|
+
TableRowNode,
|
|
2635
|
+
CodeNode
|
|
2636
|
+
];
|
|
2637
|
+
var customNodes = [
|
|
2638
|
+
SpoilerNode,
|
|
2639
|
+
MentionNode,
|
|
2640
|
+
KaTeXInlineNode,
|
|
2641
|
+
KaTeXBlockNode,
|
|
2642
|
+
ImageNode,
|
|
2643
|
+
AlertQuoteNode,
|
|
2644
|
+
CodeBlockNode,
|
|
2645
|
+
FootnoteNode,
|
|
2646
|
+
FootnoteSectionNode,
|
|
2647
|
+
VideoNode,
|
|
2648
|
+
FileNode,
|
|
2649
|
+
LinkCardNode,
|
|
2650
|
+
CommentNode,
|
|
2651
|
+
DetailsNode,
|
|
2652
|
+
GridContainerNode,
|
|
2653
|
+
BannerNode,
|
|
2654
|
+
MermaidNode,
|
|
2655
|
+
RubyNode,
|
|
2656
|
+
TagNode
|
|
2657
|
+
];
|
|
2658
|
+
var allNodes = [...builtinNodes, ...customNodes];
|
|
2659
|
+
//#endregion
|
|
1409
2660
|
//#region src/styles/theme.ts
|
|
1410
2661
|
var shared = (key) => `${semanticClassNames[key]} ${sharedStyles[key]}`;
|
|
1411
2662
|
var editorTheme = {
|
|
@@ -1448,4 +2699,10 @@ var editorTheme = {
|
|
|
1448
2699
|
hr: shared("hr")
|
|
1449
2700
|
};
|
|
1450
2701
|
//#endregion
|
|
1451
|
-
|
|
2702
|
+
//#region src/context/ColorSchemeContext.ts
|
|
2703
|
+
var ColorSchemeContext = createContext("light");
|
|
2704
|
+
function useColorScheme() {
|
|
2705
|
+
return use(ColorSchemeContext);
|
|
2706
|
+
}
|
|
2707
|
+
//#endregion
|
|
2708
|
+
export { $isFootnoteSectionNode as $, KaTeXInlineNode as A, INLINE_DRAG_MIME as At, convertImageDisplaySize as B, $isMentionNode as C, ALERT_TYPES as Ct, LinkCardNode as D, useNestedContentRenderer as Dt, $isLinkCardNode as E, NestedContentRendererProvider as Et, $isImageNode as F, resolveImageDisplaySize as G, imageDisplayDataAttr as H, ImageNode as I, $createGridContainerNode as J, sanitizeImageDisplayWidth as K, sanitizeImageLayout as L, $isKaTeXBlockNode as M, KaTeXBlockNode as N, $createKaTeXInlineNode as O, useOptionalNestedContentRenderer as Ot, $createImageNode as P, $createFootnoteSectionNode as Q, $withAdaptiveImageDisplayWidth as R, $createMentionNode as S, ALERT_LABELS as St, $createLinkCardNode as T, AlertRenderer as Tt, imageDisplayFieldsFromSize as U, imageDisplayCssVars as V, imageDisplaySizeAfterResize as W, GridContainerNode as X, $isGridContainerNode as Y, occurrenceKeys as Z, $isRichQuoteNode as _, BANNER_TYPES as _t, builtinNodes as a, FileNode as at, $isMermaidNode as b, BannerRenderer as bt, VideoNode as c, DetailsNode as ct, TagNode as d, $isCommentNode as dt, FootnoteSectionNode as et, getTagBgColor as f, CommentNode as ft, $createRichQuoteNode as g, BANNER_LABELS as gt, RubyNode as h, $isBannerNode as ht, allNodes as i, $isFileNode as it, $createKaTeXBlockNode as j, markInlineDraggable as jt, $isKaTeXInlineNode as k, INLINE_DRAG_ATTR as kt, $createTagNode as l, $createCommentNode as lt, $isRubyNode as m, CodeBlockNode as mt, useColorScheme as n, FootnoteNode as nt, customNodes as o, fileExtFromName as ot, $createRubyNode as p, $isCodeBlockNode as pt, sanitizeImageFixedPx as q, editorTheme as r, $createFileNode as rt, $createVideoNode as s, $createDetailsNode as st, ColorSchemeContext as t, $createFootnoteNode as tt, $isTagNode as u, $createCommentPlaceholderNode as ut, RichQuoteNode as v, BannerNode as vt, MentionNode as w, AlertQuoteNode as wt, MermaidNode as x, $isAlertQuoteNode as xt, $createMermaidNode as y, normalizeBannerType as yt, computeImageDisplayPixels as z };
|