@remarkablejames/editor 0.0.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/LICENSE +21 -0
- package/README.md +62 -0
- package/lib/ActionMenuButton-B0EHT9CC.js +35 -0
- package/lib/ActionMenuButton-J1el_e6Z.cjs +1 -0
- package/lib/Attachment.cjs +19 -0
- package/lib/Attachment.js +273 -0
- package/lib/Blockquote.cjs +5 -0
- package/lib/Blockquote.js +107 -0
- package/lib/Bold.cjs +1 -0
- package/lib/Bold.js +123 -0
- package/lib/BulletList.cjs +1 -0
- package/lib/BulletList.js +53 -0
- package/lib/Callout.cjs +1 -0
- package/lib/Callout.js +225 -0
- package/lib/Clear.cjs +1 -0
- package/lib/Clear.js +49 -0
- package/lib/Code.cjs +1 -0
- package/lib/Code.js +100 -0
- package/lib/CodeBlock.cjs +44 -0
- package/lib/CodeBlock.js +4065 -0
- package/lib/CodeView.cjs +1 -0
- package/lib/CodeView.js +81 -0
- package/lib/Color.cjs +1 -0
- package/lib/Color.js +134 -0
- package/lib/Column.cjs +1 -0
- package/lib/Column.js +230 -0
- package/lib/Drawer-BCWVN-4l.js +1125 -0
- package/lib/Drawer-BTouEroZ.cjs +2 -0
- package/lib/Drawer.cjs +1 -0
- package/lib/Drawer.js +7 -0
- package/lib/Emoji.cjs +1 -0
- package/lib/Emoji.js +19888 -0
- package/lib/Excalidraw.cjs +1 -0
- package/lib/Excalidraw.js +276 -0
- package/lib/ExportPdf.cjs +39 -0
- package/lib/ExportPdf.js +142 -0
- package/lib/ExportWord.cjs +1 -0
- package/lib/ExportWord.js +107 -0
- package/lib/FontFamily.cjs +1 -0
- package/lib/FontFamily.js +84 -0
- package/lib/FontSize.cjs +1 -0
- package/lib/FontSize.js +106 -0
- package/lib/Heading.cjs +1 -0
- package/lib/Heading.js +167 -0
- package/lib/Highlight.cjs +1 -0
- package/lib/Highlight.js +203 -0
- package/lib/History.cjs +1 -0
- package/lib/History.js +990 -0
- package/lib/HorizontalRule.cjs +1 -0
- package/lib/HorizontalRule.js +118 -0
- package/lib/Iframe-BdgiWGml.js +416 -0
- package/lib/Iframe-BfBLILDA.cjs +1 -0
- package/lib/Iframe.cjs +1 -0
- package/lib/Iframe.js +7 -0
- package/lib/Image.cjs +1 -0
- package/lib/Image.js +6 -0
- package/lib/ImageGif.cjs +1 -0
- package/lib/ImageGif.js +400 -0
- package/lib/ImportWord.cjs +1 -0
- package/lib/ImportWord.js +145 -0
- package/lib/Indent-BpMcZKok.js +148 -0
- package/lib/Indent-Dvqz_WEn.cjs +1 -0
- package/lib/Indent.cjs +1 -0
- package/lib/Indent.js +6 -0
- package/lib/Italic.cjs +1 -0
- package/lib/Italic.js +123 -0
- package/lib/Katex-B8_uprkO.js +2753 -0
- package/lib/Katex-BQyeCeQ0.cjs +4 -0
- package/lib/Katex.cjs +1 -0
- package/lib/Katex.js +6 -0
- package/lib/LineHeight.cjs +1 -0
- package/lib/LineHeight.js +89 -0
- package/lib/Link.cjs +1 -0
- package/lib/Link.js +6 -0
- package/lib/LinkEditBlock-BX0fXXpF.js +1185 -0
- package/lib/LinkEditBlock-CIshn_8F.cjs +5 -0
- package/lib/Mention.cjs +1 -0
- package/lib/Mention.js +265 -0
- package/lib/Mermaid-0GiGVxn0.cjs +2 -0
- package/lib/Mermaid-D8bbIgAl.js +381 -0
- package/lib/Mermaid.cjs +1 -0
- package/lib/Mermaid.js +7 -0
- package/lib/MoreMark.cjs +1 -0
- package/lib/MoreMark.js +157 -0
- package/lib/OrderedList.cjs +1 -0
- package/lib/OrderedList.js +52 -0
- package/lib/SearchAndReplace.cjs +1 -0
- package/lib/SearchAndReplace.js +305 -0
- package/lib/SlashCommand.cjs +1 -0
- package/lib/SlashCommand.js +90 -0
- package/lib/SlashCommandNodeView-BcmtKbEE.js +249 -0
- package/lib/SlashCommandNodeView-rDJ7OjRd.cjs +1 -0
- package/lib/Strike.cjs +1 -0
- package/lib/Strike.js +112 -0
- package/lib/Table-BEhNBeuA.cjs +5 -0
- package/lib/Table-DbxuP5xh.js +1939 -0
- package/lib/Table.cjs +1 -0
- package/lib/Table.js +5 -0
- package/lib/TaskList.cjs +1 -0
- package/lib/TaskList.js +63 -0
- package/lib/TextAlign.cjs +1 -0
- package/lib/TextAlign.js +165 -0
- package/lib/TextDirection.cjs +1 -0
- package/lib/TextDirection.js +110 -0
- package/lib/TextUnderline.cjs +1 -0
- package/lib/TextUnderline.js +115 -0
- package/lib/Twitter-9I6BLNmg.js +1666 -0
- package/lib/Twitter-BuEBgpi9.cjs +1 -0
- package/lib/Twitter.cjs +1 -0
- package/lib/Twitter.js +6 -0
- package/lib/Video.cjs +1 -0
- package/lib/Video.js +7 -0
- package/lib/bubble.cjs +3 -0
- package/lib/bubble.d.ts +1 -0
- package/lib/bubble.js +9533 -0
- package/lib/clsx-CDyrfCnw.js +7391 -0
- package/lib/clsx-CXbNJWDD.cjs +54 -0
- package/lib/components/ActionButton.d.ts +23 -0
- package/lib/components/ActionMenuButton.d.ts +28 -0
- package/lib/components/Bubble/RichTextBubbleCallout.d.ts +1 -0
- package/lib/components/Bubble/RichTextBubbleColumns.d.ts +1 -0
- package/lib/components/Bubble/RichTextBubbleDrawer.d.ts +1 -0
- package/lib/components/Bubble/RichTextBubbleExcalidraw.d.ts +1 -0
- package/lib/components/Bubble/RichTextBubbleIframe.d.ts +1 -0
- package/lib/components/Bubble/RichTextBubbleKatex.d.ts +1 -0
- package/lib/components/Bubble/RichTextBubbleLink.d.ts +6 -0
- package/lib/components/Bubble/RichTextBubbleMedia.d.ts +4 -0
- package/lib/components/Bubble/RichTextBubbleMenuDragHandle.d.ts +1 -0
- package/lib/components/Bubble/RichTextBubbleMermaid.d.ts +1 -0
- package/lib/components/Bubble/RichTextBubbleTable.d.ts +5 -0
- package/lib/components/Bubble/RichTextBubbleText.d.ts +5 -0
- package/lib/components/Bubble/RichTextBubbleTwitter.d.ts +1 -0
- package/lib/components/Bubble/formatBubble.d.ts +55 -0
- package/lib/components/Bubble/index.d.ts +13 -0
- package/lib/components/ColorPicker.d.ts +11 -0
- package/lib/components/ReactBus.d.ts +11 -0
- package/lib/components/RichTextProvider.d.ts +8 -0
- package/lib/components/SizeSetter/SizeSetter.d.ts +13 -0
- package/lib/components/SlashDialogTrigger/RenderDialogUploadImage.d.ts +1 -0
- package/lib/components/SlashDialogTrigger/RenderDialogUploadVideo.d.ts +1 -0
- package/lib/components/SlashDialogTrigger/SlashDialogTrigger.d.ts +5 -0
- package/lib/components/icons/Activity.d.ts +2 -0
- package/lib/components/icons/Animas.d.ts +2 -0
- package/lib/components/icons/AspectRatio.d.ts +2 -0
- package/lib/components/icons/Blockquote.d.ts +2 -0
- package/lib/components/icons/CodeView.d.ts +1 -0
- package/lib/components/icons/ColumnAddLeft.d.ts +1 -0
- package/lib/components/icons/ColumnAddRight.d.ts +1 -0
- package/lib/components/icons/DeleteColumn.d.ts +2 -0
- package/lib/components/icons/DeleteRow.d.ts +2 -0
- package/lib/components/icons/Direction.d.ts +1 -0
- package/lib/components/icons/Excalidraw.d.ts +1 -0
- package/lib/components/icons/ExportPdf.d.ts +1 -0
- package/lib/components/icons/ExportWord.d.ts +2 -0
- package/lib/components/icons/FileWordOutline.d.ts +2 -0
- package/lib/components/icons/Flag.d.ts +2 -0
- package/lib/components/icons/Food.d.ts +2 -0
- package/lib/components/icons/GIfIcon.d.ts +1 -0
- package/lib/components/icons/Html.d.ts +1 -0
- package/lib/components/icons/Icon.d.ts +8 -0
- package/lib/components/icons/IconColorFill.d.ts +5 -0
- package/lib/components/icons/IconHighlightFill.d.ts +3 -0
- package/lib/components/icons/ImportWord.d.ts +2 -0
- package/lib/components/icons/LeftToRight.d.ts +1 -0
- package/lib/components/icons/LineHeight.d.ts +2 -0
- package/lib/components/icons/MenuDown.d.ts +2 -0
- package/lib/components/icons/Mermaid.d.ts +1 -0
- package/lib/components/icons/NoFill.d.ts +1 -0
- package/lib/components/icons/Object.d.ts +2 -0
- package/lib/components/icons/RightToLeft.d.ts +1 -0
- package/lib/components/icons/SizeL.d.ts +2 -0
- package/lib/components/icons/SizeM.d.ts +2 -0
- package/lib/components/icons/SizeS.d.ts +2 -0
- package/lib/components/icons/Symbol.d.ts +2 -0
- package/lib/components/icons/Travel.d.ts +2 -0
- package/lib/components/icons/Twitter.d.ts +1 -0
- package/lib/components/icons/icons.d.ts +1 -0
- package/lib/components/icons/index.d.ts +12 -0
- package/lib/components/index.d.ts +6 -0
- package/lib/components/ui/button.d.ts +11 -0
- package/lib/components/ui/checkbox.d.ts +4 -0
- package/lib/components/ui/dialog.d.ts +19 -0
- package/lib/components/ui/dropdown-menu.d.ts +27 -0
- package/lib/components/ui/emoji-picker.d.ts +7 -0
- package/lib/components/ui/index.d.ts +15 -0
- package/lib/components/ui/input.d.ts +5 -0
- package/lib/components/ui/label.d.ts +5 -0
- package/lib/components/ui/popover.d.ts +6 -0
- package/lib/components/ui/select.d.ts +13 -0
- package/lib/components/ui/separator.d.ts +4 -0
- package/lib/components/ui/switch.d.ts +4 -0
- package/lib/components/ui/tabs.d.ts +7 -0
- package/lib/components/ui/textarea.d.ts +5 -0
- package/lib/components/ui/toast.d.ts +15 -0
- package/lib/components/ui/toaster.d.ts +1 -0
- package/lib/components/ui/toggle.d.ts +12 -0
- package/lib/components/ui/tooltip.d.ts +7 -0
- package/lib/components/ui/use-toast.d.ts +44 -0
- package/lib/constants/index.d.ts +47 -0
- package/lib/constants/resetCSS.d.ts +1 -0
- package/lib/delete-node-CosiBes5.cjs +1 -0
- package/lib/delete-node-eQHsyyhR.js +24 -0
- package/lib/dom-dataset-BqoJhJXt.cjs +1 -0
- package/lib/dom-dataset-CIEeltF6.js +47 -0
- package/lib/dropdown-menu-Bs69ZBbO.js +143 -0
- package/lib/dropdown-menu-DjWlG2-J.cjs +1 -0
- package/lib/extensions/Attachment/Attachment.d.ts +15 -0
- package/lib/extensions/Attachment/components/NodeViewAttachment/FileIcon.d.ts +1 -0
- package/lib/extensions/Attachment/components/NodeViewAttachment/FileIconString.d.ts +1 -0
- package/lib/extensions/Attachment/components/NodeViewAttachment/NodeViewAttachment.d.ts +1 -0
- package/lib/extensions/Attachment/components/RichTextAttachment.d.ts +1 -0
- package/lib/extensions/Attachment/index.d.ts +1 -0
- package/lib/extensions/Blockquote/Blockquote.d.ts +6 -0
- package/lib/extensions/Blockquote/components/RichTextBlockquote.d.ts +1 -0
- package/lib/extensions/Blockquote/index.d.ts +1 -0
- package/lib/extensions/Bold/Bold.d.ts +6 -0
- package/lib/extensions/Bold/components/RichTextBold.d.ts +1 -0
- package/lib/extensions/Bold/index.d.ts +1 -0
- package/lib/extensions/BulletList/BulletList.d.ts +6 -0
- package/lib/extensions/BulletList/components/RichTextBulletList.d.ts +1 -0
- package/lib/extensions/BulletList/index.d.ts +1 -0
- package/lib/extensions/Callout/Callout.d.ts +18 -0
- package/lib/extensions/Callout/components/NodeViewCallout/NodeViewCallout.d.ts +1 -0
- package/lib/extensions/Callout/components/RichTextCallout.d.ts +1 -0
- package/lib/extensions/Callout/index.d.ts +1 -0
- package/lib/extensions/Clear/Clear.d.ts +6 -0
- package/lib/extensions/Clear/components/RichTextClear.d.ts +1 -0
- package/lib/extensions/Clear/index.d.ts +1 -0
- package/lib/extensions/Code/Code.d.ts +6 -0
- package/lib/extensions/Code/components/RichTextCode.d.ts +1 -0
- package/lib/extensions/Code/index.d.ts +1 -0
- package/lib/extensions/CodeBlock/CodeBlock.d.ts +21 -0
- package/lib/extensions/CodeBlock/components/NodeViewCodeBlock/NodeViewCodeBlock.d.ts +1 -0
- package/lib/extensions/CodeBlock/components/RichTextCodeBlock.d.ts +1 -0
- package/lib/extensions/CodeBlock/index.d.ts +1 -0
- package/lib/extensions/CodeView/CodeView.d.ts +17 -0
- package/lib/extensions/CodeView/components/RichTextCodeView.d.ts +1 -0
- package/lib/extensions/CodeView/index.d.ts +1 -0
- package/lib/extensions/Color/Color.d.ts +22 -0
- package/lib/extensions/Color/components/RichTextColor.d.ts +1 -0
- package/lib/extensions/Color/index.d.ts +1 -0
- package/lib/extensions/Column/Column.d.ts +17 -0
- package/lib/extensions/Column/components/RichTextColumn.d.ts +1 -0
- package/lib/extensions/Column/index.d.ts +1 -0
- package/lib/extensions/Drawer/Drawer.d.ts +15 -0
- package/lib/extensions/Drawer/components/ControlDrawer/ControlDrawer.d.ts +2 -0
- package/lib/extensions/Drawer/components/ControlDrawer/icon.d.ts +28 -0
- package/lib/extensions/Drawer/components/EditDrawerBlock.d.ts +1 -0
- package/lib/extensions/Drawer/components/NodeViewDrawer/NodeViewDrawer.d.ts +1 -0
- package/lib/extensions/Drawer/components/RichTextDrawer.d.ts +1 -0
- package/lib/extensions/Drawer/index.d.ts +1 -0
- package/lib/extensions/Emoji/Emoji.d.ts +5 -0
- package/lib/extensions/Emoji/components/EmojiList/EmojiNodeView.d.ts +11 -0
- package/lib/extensions/Emoji/components/RichTextEmoji.d.ts +1 -0
- package/lib/extensions/Emoji/index.d.ts +1 -0
- package/lib/extensions/Excalidraw/Excalidraw.d.ts +17 -0
- package/lib/extensions/Excalidraw/components/NodeViewExcalidraw/NodeViewExcalidraw.d.ts +2 -0
- package/lib/extensions/Excalidraw/components/RichTextExcalidraw.d.ts +1 -0
- package/lib/extensions/Excalidraw/index.d.ts +1 -0
- package/lib/extensions/ExportPdf/ExportPdf.d.ts +21 -0
- package/lib/extensions/ExportPdf/components/RichTextExportPdf.d.ts +1 -0
- package/lib/extensions/ExportPdf/index.d.ts +1 -0
- package/lib/extensions/ExportWord/ExportWord.d.ts +13 -0
- package/lib/extensions/ExportWord/components/RichTextExportWord.d.ts +1 -0
- package/lib/extensions/ExportWord/index.d.ts +1 -0
- package/lib/extensions/FontFamily/FontFamily.d.ts +10 -0
- package/lib/extensions/FontFamily/components/RichTextFontFamily.d.ts +15 -0
- package/lib/extensions/FontFamily/index.d.ts +1 -0
- package/lib/extensions/FontSize/FontSize.d.ts +32 -0
- package/lib/extensions/FontSize/components/RichTextFontSize.d.ts +12 -0
- package/lib/extensions/FontSize/index.d.ts +1 -0
- package/lib/extensions/Heading/Heading.d.ts +6 -0
- package/lib/extensions/Heading/components/RichTextHeading.d.ts +15 -0
- package/lib/extensions/Heading/index.d.ts +1 -0
- package/lib/extensions/Highlight/Highlight.d.ts +18 -0
- package/lib/extensions/Highlight/components/RichTextHighlight.d.ts +1 -0
- package/lib/extensions/Highlight/index.d.ts +1 -0
- package/lib/extensions/History/History.d.ts +6 -0
- package/lib/extensions/History/components/RichTextHistory.d.ts +2 -0
- package/lib/extensions/History/index.d.ts +1 -0
- package/lib/extensions/HorizontalRule/HorizontalRule.d.ts +6 -0
- package/lib/extensions/HorizontalRule/components/RichTextHorizontalRule.d.ts +1 -0
- package/lib/extensions/HorizontalRule/index.d.ts +1 -0
- package/lib/extensions/Iframe/Iframe.d.ts +16 -0
- package/lib/extensions/Iframe/components/IframeNodeView.d.ts +2 -0
- package/lib/extensions/Iframe/components/RichTextIframe.d.ts +1 -0
- package/lib/extensions/Iframe/index.d.ts +1 -0
- package/lib/extensions/Iframe/utils.d.ts +9 -0
- package/lib/extensions/Image/Image.d.ts +64 -0
- package/lib/extensions/Image/components/ImageCropper.d.ts +1 -0
- package/lib/extensions/Image/components/ImageView.d.ts +2 -0
- package/lib/extensions/Image/components/RichTextImage.d.ts +1 -0
- package/lib/extensions/Image/index.d.ts +1 -0
- package/lib/extensions/ImageGif/ImageGif.d.ts +39 -0
- package/lib/extensions/ImageGif/components/ImageGifView.d.ts +2 -0
- package/lib/extensions/ImageGif/components/RichTextImageGif.d.ts +1 -0
- package/lib/extensions/ImageGif/components/services.d.ts +458 -0
- package/lib/extensions/ImageGif/index.d.ts +1 -0
- package/lib/extensions/ImportWord/ImportWord.d.ts +18 -0
- package/lib/extensions/ImportWord/components/RichTextImportWord.d.ts +1 -0
- package/lib/extensions/ImportWord/index.d.ts +1 -0
- package/lib/extensions/Indent/Indent.d.ts +23 -0
- package/lib/extensions/Indent/components/RichTextIndent.d.ts +1 -0
- package/lib/extensions/Indent/index.d.ts +1 -0
- package/lib/extensions/Italic/Italic.d.ts +6 -0
- package/lib/extensions/Italic/components/RichTextItalic.d.ts +1 -0
- package/lib/extensions/Italic/index.d.ts +1 -0
- package/lib/extensions/Katex/Katex.d.ts +17 -0
- package/lib/extensions/Katex/components/KatexWrapper.d.ts +1 -0
- package/lib/extensions/Katex/components/RichTextKatex.d.ts +1 -0
- package/lib/extensions/Katex/index.d.ts +1 -0
- package/lib/extensions/LineHeight/LineHeight.d.ts +7 -0
- package/lib/extensions/LineHeight/components/RichTextLightHeight.d.ts +1 -0
- package/lib/extensions/LineHeight/index.d.ts +1 -0
- package/lib/extensions/Link/Link.d.ts +6 -0
- package/lib/extensions/Link/components/LinkEditBlock.d.ts +9 -0
- package/lib/extensions/Link/components/LinkViewBlock.d.ts +8 -0
- package/lib/extensions/Link/components/RichTextLink.d.ts +1 -0
- package/lib/extensions/Link/index.d.ts +1 -0
- package/lib/extensions/Mention/Mention.d.ts +3 -0
- package/lib/extensions/Mention/components/NodeViewMentionList.d.ts +16 -0
- package/lib/extensions/Mention/index.d.ts +1 -0
- package/lib/extensions/Mermaid/Mermaid.d.ts +27 -0
- package/lib/extensions/Mermaid/components/EditMermaidBlock.d.ts +9 -0
- package/lib/extensions/Mermaid/components/NodeViewMermaid/NodeViewMermaid.d.ts +9 -0
- package/lib/extensions/Mermaid/components/RichTextMermaid.d.ts +1 -0
- package/lib/extensions/Mermaid/index.d.ts +1 -0
- package/lib/extensions/MoreMark/MoreMark.d.ts +20 -0
- package/lib/extensions/MoreMark/components/RichTextMoreMark.d.ts +14 -0
- package/lib/extensions/MoreMark/index.d.ts +1 -0
- package/lib/extensions/OrderedList/OrderedList.d.ts +6 -0
- package/lib/extensions/OrderedList/components/RichTextOrderedList.d.ts +1 -0
- package/lib/extensions/OrderedList/index.d.ts +1 -0
- package/lib/extensions/SearchAndReplace/SearchAndReplace.d.ts +36 -0
- package/lib/extensions/SearchAndReplace/components/RichTextSearchAndReplace.d.ts +1 -0
- package/lib/extensions/SearchAndReplace/index.d.ts +1 -0
- package/lib/extensions/SlashCommand/SlashCommand.d.ts +4 -0
- package/lib/extensions/SlashCommand/components/SlashCommandList.d.ts +6 -0
- package/lib/extensions/SlashCommand/components/SlashCommandNodeView.d.ts +3 -0
- package/lib/extensions/SlashCommand/index.d.ts +1 -0
- package/lib/extensions/SlashCommand/renderCommandListDefault.d.ts +7 -0
- package/lib/extensions/SlashCommand/types.d.ts +20 -0
- package/lib/extensions/Strike/Strike.d.ts +6 -0
- package/lib/extensions/Strike/components/RichTextStrike.d.ts +1 -0
- package/lib/extensions/Strike/index.d.ts +1 -0
- package/lib/extensions/Table/Table.d.ts +21 -0
- package/lib/extensions/Table/TableCellBackground.d.ts +14 -0
- package/lib/extensions/Table/components/CreateTablePopover.d.ts +7 -0
- package/lib/extensions/Table/components/RichTextTable.d.ts +1 -0
- package/lib/extensions/Table/index.d.ts +1 -0
- package/lib/extensions/TaskList/TaskList.d.ts +11 -0
- package/lib/extensions/TaskList/components/RichTextTaskList.d.ts +1 -0
- package/lib/extensions/TaskList/index.d.ts +1 -0
- package/lib/extensions/TextAlign/TextAlign.d.ts +17 -0
- package/lib/extensions/TextAlign/components/RichTextAlign.d.ts +14 -0
- package/lib/extensions/TextAlign/index.d.ts +1 -0
- package/lib/extensions/TextDirection/TextDirection.d.ts +5 -0
- package/lib/extensions/TextDirection/components/RichTextTextDirection.d.ts +15 -0
- package/lib/extensions/TextDirection/index.d.ts +1 -0
- package/lib/extensions/TextUnderline/TextUnderline.d.ts +6 -0
- package/lib/extensions/TextUnderline/components/RichTextUnderline.d.ts +1 -0
- package/lib/extensions/TextUnderline/index.d.ts +1 -0
- package/lib/extensions/Twitter/Twitter.d.ts +46 -0
- package/lib/extensions/Twitter/components/FormEditLinkTwitter.d.ts +6 -0
- package/lib/extensions/Twitter/components/NodeViewTweet.d.ts +8 -0
- package/lib/extensions/Twitter/components/RichTextTwitter.d.ts +1 -0
- package/lib/extensions/Twitter/index.d.ts +1 -0
- package/lib/extensions/Video/Video.d.ts +66 -0
- package/lib/extensions/Video/components/RichTextVideo.d.ts +1 -0
- package/lib/extensions/Video/index.d.ts +1 -0
- package/lib/hooks/useActive.d.ts +21 -0
- package/lib/hooks/useAttributes.d.ts +2 -0
- package/lib/hooks/useButtonProps.d.ts +1 -0
- package/lib/hooks/useCopy.d.ts +5 -0
- package/lib/hooks/useExtension.d.ts +1 -0
- package/lib/hooks/useLocalStorage.d.ts +13 -0
- package/lib/index-4Q5IhypJ.js +1349 -0
- package/lib/index-BCzvbrf5.cjs +12 -0
- package/lib/index-BG0kQamI.js +285 -0
- package/lib/index-C-tDsIKJ.js +1631 -0
- package/lib/index-C1WCZhyA.js +237 -0
- package/lib/index-CjhjjJsN.cjs +1 -0
- package/lib/index-Cs6cp0Y6.cjs +1 -0
- package/lib/index-CsSfYR30.js +1351 -0
- package/lib/index-D9oM__YW.cjs +1 -0
- package/lib/index-DjDf4BK8.js +707 -0
- package/lib/index-NsYff_Ni.cjs +1 -0
- package/lib/index-bVGIXhRg.cjs +1 -0
- package/lib/index-lj3VWExo.js +4883 -0
- package/lib/index-neeeY2o7.cjs +4 -0
- package/lib/index.cjs +115 -0
- package/lib/index.d.ts +2 -0
- package/lib/index.js +338 -0
- package/lib/jsx-runtime-CT7Pcg-t.js +13 -0
- package/lib/jsx-runtime-C_NLcKys.cjs +1 -0
- package/lib/lib/utils.d.ts +2 -0
- package/lib/locale-bundle.cjs +1 -0
- package/lib/locale-bundle.d.ts +1 -0
- package/lib/locale-bundle.js +11 -0
- package/lib/locales/en.d.ts +196 -0
- package/lib/locales/fi.d.ts +196 -0
- package/lib/locales/hu.d.ts +196 -0
- package/lib/locales/index.d.ts +1198 -0
- package/lib/locales/pt-br.d.ts +196 -0
- package/lib/locales/vi.d.ts +196 -0
- package/lib/locales/zh-cn.d.ts +196 -0
- package/lib/plugins/image-upload.d.ts +13 -0
- package/lib/popover-CPr9bHYn.js +24 -0
- package/lib/popover-D-hUKDYu.cjs +1 -0
- package/lib/renderNodeView-BJSrgyGj.js +28 -0
- package/lib/renderNodeView-DfLmGrgA.cjs +1 -0
- package/lib/select-C2KF4RNg.cjs +1 -0
- package/lib/select-CuE_HaQJ.js +120 -0
- package/lib/separator-CHzYNMVt.js +293 -0
- package/lib/separator-_gvUNba_.cjs +1 -0
- package/lib/store/EditorEditableReactive.d.ts +1 -0
- package/lib/store/ThemeColorReactive.d.ts +1 -0
- package/lib/store/commandList.d.ts +2 -0
- package/lib/store/editor.d.ts +21 -0
- package/lib/store/store.d.ts +3 -0
- package/lib/style.css +1 -0
- package/lib/textarea-DZj6EY-N.cjs +1 -0
- package/lib/textarea-gEoNp9CA.js +20 -0
- package/lib/theme/theme.d.ts +369 -0
- package/lib/theme.cjs +1 -0
- package/lib/theme.js +395 -0
- package/lib/types.d.ts +230 -0
- package/lib/updatePosition-Cjuj2E26.cjs +1 -0
- package/lib/updatePosition-e90ZrFWW.js +16 -0
- package/lib/utils/base64.d.ts +2 -0
- package/lib/utils/checkIsVideoUrl.d.ts +1 -0
- package/lib/utils/color.d.ts +7 -0
- package/lib/utils/columns.d.ts +14 -0
- package/lib/utils/customEvents/events.constant.d.ts +6 -0
- package/lib/utils/delete-node.d.ts +2 -0
- package/lib/utils/dom-dataset.d.ts +28 -0
- package/lib/utils/download.d.ts +1 -0
- package/lib/utils/dynamicCSS.d.ts +25 -0
- package/lib/utils/editor-container-size.d.ts +4 -0
- package/lib/utils/file.d.ts +30 -0
- package/lib/utils/getRenderContainer.d.ts +3 -0
- package/lib/utils/indent.d.ts +14 -0
- package/lib/utils/is-mobile.d.ts +19 -0
- package/lib/utils/json.d.ts +2 -0
- package/lib/utils/lru-cache.d.ts +31 -0
- package/lib/utils/mitt.d.ts +24 -0
- package/lib/utils/node.d.ts +15 -0
- package/lib/utils/pdf.d.ts +3 -0
- package/lib/utils/plateform.d.ts +11 -0
- package/lib/utils/renderNodeView.d.ts +6 -0
- package/lib/utils/shortId.d.ts +1 -0
- package/lib/utils/storage.d.ts +2 -0
- package/lib/utils/updatePosition.d.ts +1 -0
- package/lib/utils/utils.d.ts +20 -0
- package/lib/utils/validateFile.d.ts +16 -0
- package/package.json +845 -0
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
"use strict";const k=require("react/jsx-runtime"),F=require("react"),R=require("./index-D9oM__YW.cjs");require("./theme.cjs");const I=require("./clsx-CXbNJWDD.cjs"),_=require("@tiptap/pm/state"),we=require("./index-bVGIXhRg.cjs"),Wt=require("./popover-D-hUKDYu.cjs"),He="aaa1rp3bb0ott3vie4c1le2ogado5udhabi7c0ademy5centure6ountant0s9o1tor4d0s1ult4e0g1ro2tna4f0l1rica5g0akhan5ency5i0g1rbus3force5tel5kdn3l0ibaba4pay4lfinanz6state5y2sace3tom5m0azon4ericanexpress7family11x2fam3ica3sterdam8nalytics7droid5quan4z2o0l2partments8p0le4q0uarelle8r0ab1mco4chi3my2pa2t0e3s0da2ia2sociates9t0hleta5torney7u0ction5di0ble3o3spost5thor3o0s4w0s2x0a2z0ure5ba0by2idu3namex4d1k2r0celona5laycard4s5efoot5gains6seball5ketball8uhaus5yern5b0c1t1va3cg1n2d1e0ats2uty4er2rlin4st0buy5t2f1g1h0arti5i0ble3d1ke2ng0o3o1z2j1lack0friday9ockbuster8g1omberg7ue3m0s1w2n0pparibas9o0ats3ehringer8fa2m1nd2o0k0ing5sch2tik2on4t1utique6x2r0adesco6idgestone9oadway5ker3ther5ussels7s1t1uild0ers6siness6y1zz3v1w1y1z0h3ca0b1fe2l0l1vinklein9m0era3p2non3petown5ital0one8r0avan4ds2e0er0s4s2sa1e1h1ino4t0ering5holic7ba1n1re3c1d1enter4o1rn3f0a1d2g1h0anel2nel4rity4se2t2eap3intai5ristmas6ome4urch5i0priani6rcle4sco3tadel4i0c2y3k1l0aims4eaning6ick2nic1que6othing5ud3ub0med6m1n1o0ach3des3ffee4llege4ogne5m0mbank4unity6pany2re3uter5sec4ndos3struction8ulting7tact3ractors9oking4l1p2rsica5untry4pon0s4rses6pa2r0edit0card4union9icket5own3s1uise0s6u0isinella9v1w1x1y0mru3ou3z2dad1nce3ta1e1ing3sun4y2clk3ds2e0al0er2s3gree4livery5l1oitte5ta3mocrat6ntal2ist5si0gn4v2hl2iamonds6et2gital5rect0ory7scount3ver5h2y2j1k1m1np2o0cs1tor4g1mains5t1wnload7rive4tv2ubai3nlop4pont4rban5vag2r2z2earth3t2c0o2deka3u0cation8e1g1mail3erck5nergy4gineer0ing9terprises10pson4quipment8r0icsson6ni3s0q1tate5t1u0rovision8s2vents5xchange6pert3osed4ress5traspace10fage2il1rwinds6th3mily4n0s2rm0ers5shion4t3edex3edback6rrari3ero6i0delity5o2lm2nal1nce1ial7re0stone6mdale6sh0ing5t0ness6j1k1lickr3ghts4r2orist4wers5y2m1o0o0d1tball6rd1ex2sale4um3undation8x2r0ee1senius7l1ogans4ntier7tr2ujitsu5n0d2rniture7tbol5yi3ga0l0lery3o1up4me0s3p1rden4y2b0iz3d0n2e0a1nt0ing5orge5f1g0ee3h1i0ft0s3ves2ing5l0ass3e1obal2o4m0ail3bh2o1x2n1odaddy5ld0point6f2o0dyear5g0le4p1t1v2p1q1r0ainger5phics5tis4een3ipe3ocery4up4s1t1u0cci3ge2ide2tars5ru3w1y2hair2mburg5ngout5us3bo2dfc0bank7ealth0care8lp1sinki6re1mes5iphop4samitsu7tachi5v2k0t2m1n1ockey4ldings5iday5medepot5goods5s0ense7nda3rse3spital5t0ing5t0els3mail5use3w2r1sbc3t1u0ghes5yatt3undai7ibm2cbc2e1u2d1e0ee3fm2kano4l1m0amat4db2mo0bilien9n0c1dustries8finiti5o2g1k1stitute6urance4e4t0ernational10uit4vestments10o1piranga7q1r0ish4s0maili5t0anbul7t0au2v3jaguar4va3cb2e0ep2tzt3welry6io2ll2m0p2nj2o0bs1urg4t1y2p0morgan6rs3uegos4niper7kaufen5ddi3e0rryhotels6properties14fh2g1h1i0a1ds2m1ndle4tchen5wi3m1n1oeln3matsu5sher5p0mg2n2r0d1ed3uokgroup8w1y0oto4z2la0caixa5mborghini8er3nd0rover6xess5salle5t0ino3robe5w0yer5b1c1ds2ease3clerc5frak4gal2o2xus4gbt3i0dl2fe0insurance9style7ghting6ke2lly3mited4o2ncoln4k2ve1ing5k1lc1p2oan0s3cker3us3l1ndon4tte1o3ve3pl0financial11r1s1t0d0a3u0ndbeck6xe1ury5v1y2ma0drid4if1son4keup4n0agement7go3p1rket0ing3s4riott5shalls7ttel5ba2c0kinsey7d1e0d0ia3et2lbourne7me1orial6n0u2rckmsd7g1h1iami3crosoft7l1ni1t2t0subishi9k1l0b1s2m0a2n1o0bi0le4da2e1i1m1nash3ey2ster5rmon3tgage6scow4to0rcycles9v0ie4p1q1r1s0d2t0n1r2u0seum3ic4v1w1x1y1z2na0b1goya4me2vy3ba2c1e0c1t0bank4flix4work5ustar5w0s2xt0direct7us4f0l2g0o2hk2i0co2ke1on3nja3ssan1y5l1o0kia3rton4w0ruz3tv4p1r0a1w2tt2u1yc2z2obi1server7ffice5kinawa6layan0group9lo3m0ega4ne1g1l0ine5oo2pen3racle3nge4g0anic5igins6saka4tsuka4t2vh3pa0ge2nasonic7ris2s1tners4s1y3y2ccw3e0t2f0izer5g1h0armacy6d1ilips5one2to0graphy6s4ysio5ics1tet2ures6d1n0g1k2oneer5zza4k1l0ace2y0station9umbing5s3m1n0c2ohl2ker3litie5rn2st3r0axi3ess3ime3o0d0uctions8f1gressive8mo2perties3y5tection8u0dential9s1t1ub2w0c2y2qa1pon3uebec3st5racing4dio4e0ad1lestate6tor2y4cipes5d0stone5umbrella9hab3ise0n3t2liance6n0t0als5pair3ort3ublican8st0aurant8view0s5xroth6ich0ardli6oh3l1o1p2o0cks3deo3gers4om3s0vp3u0gby3hr2n2w0e2yukyu6sa0arland6fe0ty4kura4le1on3msclub4ung5ndvik0coromant12ofi4p1rl2s1ve2xo3b0i1s2c0b1haeffler7midt4olarships8ol3ule3warz5ience5ot3d1e0arch3t2cure1ity6ek2lect4ner3rvices6ven3w1x0y3fr2g1h0angrila6rp3ell3ia1ksha5oes2p0ping5uji3w3i0lk2na1gles5te3j1k0i0n2y0pe4l0ing4m0art3ile4n0cf3o0ccer3ial4ftbank4ware6hu2lar2utions7ng1y2y2pa0ce3ort2t3r0l2s1t0ada2ples4r1tebank4farm7c0group6ockholm6rage3e3ream4udio2y3yle4u0cks3pplies3y2ort5rf1gery5zuki5v1watch4iss4x1y0dney4stems6z2tab1ipei4lk2obao4rget4tamotors6r2too4x0i3c0i2d0k2eam2ch0nology8l1masek5nnis4va3f1g1h0d1eater2re6iaa2ckets5enda4ps2res2ol4j0maxx4x2k0maxx5l1m0all4n1o0day3kyo3ols3p1ray3shiba5tal3urs3wn2yota3s3r0ade1ing4ining5vel0ers0insurance16ust3v2t1ube2i1nes3shu4v0s2w1z2ua1bank3s2g1k1nicom3versity8o2ol2ps2s1y1z2va0cations7na1guard7c1e0gas3ntures6risign5mögensberater2ung14sicherung10t2g1i0ajes4deo3g1king4llas4n1p1rgin4sa1ion4va1o3laanderen9n1odka3lvo3te1ing3o2yage5u2wales2mart4ter4ng0gou5tch0es6eather0channel12bcam3er2site5d0ding5ibo2r3f1hoswho6ien2ki2lliamhill9n0dows4e1ners6me2olterskluwer11odside6rk0s2ld3w2s1tc1f3xbox3erox4ihuan4n2xx2yz3yachts4hoo3maxun5ndex5e1odobashi7ga2kohama6u0tube6t1un3za0ppos4ra3ero3ip2m1one3uerich6w2",je="ελ1υ2бг1ел3дети4ею2католик6ом3мкд2он1сква6онлайн5рг3рус2ф2сайт3рб3укр3қаз3հայ3ישראל5קום3ابوظبي5رامكو5لاردن4بحرين5جزائر5سعودية6عليان5مغرب5مارات5یران5بارت2زار4يتك3ھارت5تونس4سودان3رية5شبكة4عراق2ب2مان4فلسطين6قطر3كاثوليك6وم3مصر2ليسيا5وريتانيا7قع4همراه5پاکستان7ڀارت4कॉम3नेट3भारत0म्3ोत5संगठन5বাংলা5ভারত2ৰত4ਭਾਰਤ4ભારત4ଭାରତ4இந்தியா6லங்கை6சிங்கப்பூர்11భారత్5ಭಾರತ4ഭാരതം5ලංකා4คอม3ไทย3ລາວ3გე2みんな3アマゾン4クラウド4グーグル4コム2ストア3セール3ファッション6ポイント4世界2中信1国1國1文网3亚马逊3企业2佛山2信息2健康2八卦2公司1益2台湾1灣2商城1店1标2嘉里0大酒店5在线2大拿2天主教3娱乐2家電2广东2微博2慈善2我爱你3手机2招聘2政务1府2新加坡2闻2时尚2書籍2机构2淡马锡3游戏2澳門2点看2移动2组织机构4网址1店1站1络2联通2谷歌2购物2通販2集团2電訊盈科4飞利浦3食品2餐厅2香格里拉3港2닷넷1컴2삼성2한국2",Qt="numeric",Jt="ascii",Vt="alpha",V="asciinumeric",J="alphanumeric",Yt="domain",xe="emoji",Me="scheme",De="slashscheme",Ft="whitespace";function Ue(t,n){return t in n||(n[t]=[]),n[t]}function z(t,n,e){n[Qt]&&(n[V]=!0,n[J]=!0),n[Jt]&&(n[V]=!0,n[Vt]=!0),n[V]&&(n[J]=!0),n[Vt]&&(n[J]=!0),n[J]&&(n[Yt]=!0),n[xe]&&(n[Yt]=!0);for(const i in n){const s=Ue(i,e);s.indexOf(t)<0&&s.push(t)}}function Be(t,n){const e={};for(const i in n)n[i].indexOf(t)>=0&&(e[i]=!0);return e}function y(t=null){this.j={},this.jr=[],this.jd=null,this.t=t}y.groups={};y.prototype={accepts(){return!!this.t},go(t){const n=this,e=n.j[t];if(e)return e;for(let i=0;i<n.jr.length;i++){const s=n.jr[i][0],o=n.jr[i][1];if(o&&s.test(t))return o}return n.jd},has(t,n=!1){return n?t in this.j:!!this.go(t)},ta(t,n,e,i){for(let s=0;s<t.length;s++)this.tt(t[s],n,e,i)},tr(t,n,e,i){i=i||y.groups;let s;return n&&n.j?s=n:(s=new y(n),e&&i&&z(n,e,i)),this.jr.push([t,s]),s},ts(t,n,e,i){let s=this;const o=t.length;if(!o)return s;for(let a=0;a<o-1;a++)s=s.tt(t[a]);return s.tt(t[o-1],n,e,i)},tt(t,n,e,i){i=i||y.groups;const s=this;if(n&&n.j)return s.j[t]=n,n;const o=n;let a,l=s.go(t);if(l?(a=new y,Object.assign(a.j,l.j),a.jr.push.apply(a.jr,l.jr),a.jd=l.jd,a.t=l.t):a=new y,o){if(i)if(a.t&&typeof a.t=="string"){const d=Object.assign(Be(a.t,i),e);z(o,d,i)}else e&&z(o,e,i);a.t=o}return s.j[t]=a,a}};const f=(t,n,e,i,s)=>t.ta(n,e,i,s),x=(t,n,e,i,s)=>t.tr(n,e,i,s),me=(t,n,e,i,s)=>t.ts(n,e,i,s),r=(t,n,e,i,s)=>t.tt(n,e,i,s),j="WORD",Xt="UWORD",Te="ASCIINUMERICAL",Ce="ALPHANUMERICAL",nt="LOCALHOST",Zt="TLD",te="UTLD",ct="SCHEME",K="SLASH_SCHEME",ne="NUM",ee="WS",ie="NL",Y="OPENBRACE",X="CLOSEBRACE",ut="OPENBRACKET",dt="CLOSEBRACKET",ht="OPENPAREN",ft="CLOSEPAREN",mt="OPENANGLEBRACKET",gt="CLOSEANGLEBRACKET",pt="FULLWIDTHLEFTPAREN",Et="FULLWIDTHRIGHTPAREN",kt="LEFTCORNERBRACKET",At="RIGHTCORNERBRACKET",Lt="LEFTWHITECORNERBRACKET",xt="RIGHTWHITECORNERBRACKET",Tt="FULLWIDTHLESSTHAN",Ct="FULLWIDTHGREATERTHAN",bt="AMPERSAND",Rt="APOSTROPHE",yt="ASTERISK",D="AT",Ot="BACKSLASH",St="BACKTICK",Nt="CARET",U="COLON",se="COMMA",vt="DOLLAR",N="DOT",It="EQUALS",oe="EXCLAMATION",S="HYPHEN",Z="PERCENT",Pt="PIPE",wt="PLUS",Ht="POUND",tt="QUERY",re="QUOTE",be="FULLWIDTHMIDDLEDOT",ae="SEMI",v="SLASH",et="TILDE",jt="UNDERSCORE",Re="EMOJI",Mt="SYM";var ye=Object.freeze({__proto__:null,ALPHANUMERICAL:Ce,AMPERSAND:bt,APOSTROPHE:Rt,ASCIINUMERICAL:Te,ASTERISK:yt,AT:D,BACKSLASH:Ot,BACKTICK:St,CARET:Nt,CLOSEANGLEBRACKET:gt,CLOSEBRACE:X,CLOSEBRACKET:dt,CLOSEPAREN:ft,COLON:U,COMMA:se,DOLLAR:vt,DOT:N,EMOJI:Re,EQUALS:It,EXCLAMATION:oe,FULLWIDTHGREATERTHAN:Ct,FULLWIDTHLEFTPAREN:pt,FULLWIDTHLESSTHAN:Tt,FULLWIDTHMIDDLEDOT:be,FULLWIDTHRIGHTPAREN:Et,HYPHEN:S,LEFTCORNERBRACKET:kt,LEFTWHITECORNERBRACKET:Lt,LOCALHOST:nt,NL:ie,NUM:ne,OPENANGLEBRACKET:mt,OPENBRACE:Y,OPENBRACKET:ut,OPENPAREN:ht,PERCENT:Z,PIPE:Pt,PLUS:wt,POUND:Ht,QUERY:tt,QUOTE:re,RIGHTCORNERBRACKET:At,RIGHTWHITECORNERBRACKET:xt,SCHEME:ct,SEMI:ae,SLASH:v,SLASH_SCHEME:K,SYM:Mt,TILDE:et,TLD:Zt,UNDERSCORE:jt,UTLD:te,UWORD:Xt,WORD:j,WS:ee});const w=/[a-z]/,Q=new RegExp("\\p{L}","u"),Kt=new RegExp("\\p{Emoji}","u"),H=/\d/,_t=/\s/,ge="\r",Gt=`
|
|
2
|
+
`,ze="️",We="",qt="";let rt=null,at=null;function Fe(t=[]){const n={};y.groups=n;const e=new y;rt==null&&(rt=pe(He)),at==null&&(at=pe(je)),r(e,"'",Rt),r(e,"{",Y),r(e,"}",X),r(e,"[",ut),r(e,"]",dt),r(e,"(",ht),r(e,")",ft),r(e,"<",mt),r(e,">",gt),r(e,"(",pt),r(e,")",Et),r(e,"「",kt),r(e,"」",At),r(e,"『",Lt),r(e,"』",xt),r(e,"<",Tt),r(e,">",Ct),r(e,"&",bt),r(e,"*",yt),r(e,"@",D),r(e,"`",St),r(e,"^",Nt),r(e,":",U),r(e,",",se),r(e,"$",vt),r(e,".",N),r(e,"=",It),r(e,"!",oe),r(e,"-",S),r(e,"%",Z),r(e,"|",Pt),r(e,"+",wt),r(e,"#",Ht),r(e,"?",tt),r(e,'"',re),r(e,"/",v),r(e,";",ae),r(e,"~",et),r(e,"_",jt),r(e,"\\",Ot),r(e,"・",be);const i=x(e,H,ne,{[Qt]:!0});x(i,H,i);const s=x(i,w,Te,{[V]:!0}),o=x(i,Q,Ce,{[J]:!0}),a=x(e,w,j,{[Jt]:!0});x(a,H,s),x(a,w,a),x(s,H,s),x(s,w,s);const l=x(e,Q,Xt,{[Vt]:!0});x(l,w),x(l,H,o),x(l,Q,l),x(o,H,o),x(o,w),x(o,Q,o);const d=r(e,Gt,ie,{[Ft]:!0}),h=r(e,ge,ee,{[Ft]:!0}),c=x(e,_t,ee,{[Ft]:!0});r(e,qt,c),r(h,Gt,d),r(h,qt,c),x(h,_t,c),r(c,ge),r(c,Gt),x(c,_t,c),r(c,qt,c);const u=x(e,Kt,Re,{[xe]:!0});r(u,"#"),x(u,Kt,u),r(u,ze,u);const m=r(u,We);r(m,"#"),x(m,Kt,u);const p=[[w,a],[H,s]],b=[[w,null],[Q,l],[H,o]];for(let E=0;E<rt.length;E++)M(e,rt[E],Zt,j,p);for(let E=0;E<at.length;E++)M(e,at[E],te,Xt,b);z(Zt,{tld:!0,ascii:!0},n),z(te,{utld:!0,alpha:!0},n),M(e,"file",ct,j,p),M(e,"mailto",ct,j,p),M(e,"http",K,j,p),M(e,"https",K,j,p),M(e,"ftp",K,j,p),M(e,"ftps",K,j,p),z(ct,{scheme:!0,ascii:!0},n),z(K,{slashscheme:!0,ascii:!0},n),t=t.sort((E,T)=>E[0]>T[0]?1:-1);for(let E=0;E<t.length;E++){const T=t[E][0],L=t[E][1]?{[Me]:!0}:{[De]:!0};T.indexOf("-")>=0?L[Yt]=!0:w.test(T)?H.test(T)?L[V]=!0:L[Jt]=!0:L[Qt]=!0,me(e,T,T,L)}return me(e,"localhost",nt,{ascii:!0}),e.jd=new y(Mt),{start:e,tokens:Object.assign({groups:n},ye)}}function Oe(t,n){const e=Ke(n.replace(/[A-Z]/g,l=>l.toLowerCase())),i=e.length,s=[];let o=0,a=0;for(;a<i;){let l=t,d=null,h=0,c=null,u=-1,m=-1;for(;a<i&&(d=l.go(e[a]));)l=d,l.accepts()?(u=0,m=0,c=l):u>=0&&(u+=e[a].length,m++),h+=e[a].length,o+=e[a].length,a++;o-=u,a-=m,h-=u,s.push({t:c.t,v:n.slice(o-h,o),s:o-h,e:o})}return s}function Ke(t){const n=[],e=t.length;let i=0;for(;i<e;){let s=t.charCodeAt(i),o,a=s<55296||s>56319||i+1===e||(o=t.charCodeAt(i+1))<56320||o>57343?t[i]:t.slice(i,i+2);n.push(a),i+=a.length}return n}function M(t,n,e,i,s){let o;const a=n.length;for(let l=0;l<a-1;l++){const d=n[l];t.j[d]?o=t.j[d]:(o=new y(i),o.jr=s.slice(),t.j[d]=o),t=o}return o=new y(e),o.jr=s.slice(),t.j[n[a-1]]=o,o}function pe(t){const n=[],e=[];let i=0,s="0123456789";for(;i<t.length;){let o=0;for(;s.indexOf(t[i+o])>=0;)o++;if(o>0){n.push(e.join(""));for(let a=parseInt(t.substring(i,i+o),10);a>0;a--)e.pop();i+=o}else e.push(t[i]),i++}return n}const it={defaultProtocol:"http",events:null,format:Ee,formatHref:Ee,nl2br:!1,tagName:"a",target:null,rel:null,validate:!0,truncate:1/0,className:null,attributes:null,ignoreTags:[],render:null};function le(t,n=null){let e=Object.assign({},it);t&&(e=Object.assign(e,t instanceof le?t.o:t));const i=e.ignoreTags,s=[];for(let o=0;o<i.length;o++)s.push(i[o].toUpperCase());this.o=e,n&&(this.defaultRender=n),this.ignoreTags=s}le.prototype={o:it,ignoreTags:[],defaultRender(t){return t},check(t){return this.get("validate",t.toString(),t)},get(t,n,e){const i=n!=null;let s=this.o[t];return s&&(typeof s=="object"?(s=e.t in s?s[e.t]:it[t],typeof s=="function"&&i&&(s=s(n,e))):typeof s=="function"&&i&&(s=s(n,e.t,e)),s)},getObj(t,n,e){let i=this.o[t];return typeof i=="function"&&n!=null&&(i=i(n,e.t,e)),i},render(t){const n=t.render(this);return(this.get("render",null,t)||this.defaultRender)(n,t.t,t)}};function Ee(t){return t}function Se(t,n){this.t="token",this.v=t,this.tk=n}Se.prototype={isLink:!1,toString(){return this.v},toHref(t){return this.toString()},toFormattedString(t){const n=this.toString(),e=t.get("truncate",n,this),i=t.get("format",n,this);return e&&i.length>e?i.substring(0,e)+"…":i},toFormattedHref(t){return t.get("formatHref",this.toHref(t.get("defaultProtocol")),this)},startIndex(){return this.tk[0].s},endIndex(){return this.tk[this.tk.length-1].e},toObject(t=it.defaultProtocol){return{type:this.t,value:this.toString(),isLink:this.isLink,href:this.toHref(t),start:this.startIndex(),end:this.endIndex()}},toFormattedObject(t){return{type:this.t,value:this.toFormattedString(t),isLink:this.isLink,href:this.toFormattedHref(t),start:this.startIndex(),end:this.endIndex()}},validate(t){return t.get("validate",this.toString(),this)},render(t){const n=this,e=this.toHref(t.get("defaultProtocol")),i=t.get("formatHref",e,this),s=t.get("tagName",e,n),o=this.toFormattedString(t),a={},l=t.get("className",e,n),d=t.get("target",e,n),h=t.get("rel",e,n),c=t.getObj("attributes",e,n),u=t.getObj("events",e,n);return a.href=i,l&&(a.class=l),d&&(a.target=d),h&&(a.rel=h),c&&Object.assign(a,c),{tagName:s,attributes:a,content:o,eventListeners:u}}};function Dt(t,n){class e extends Se{constructor(s,o){super(s,o),this.t=t}}for(const i in n)e.prototype[i]=n[i];return e.t=t,e}const ke=Dt("email",{isLink:!0,toHref(){return"mailto:"+this.toString()}}),Ae=Dt("text"),_e=Dt("nl"),lt=Dt("url",{isLink:!0,toHref(t=it.defaultProtocol){return this.hasProtocol()?this.v:`${t}://${this.v}`},hasProtocol(){const t=this.tk;return t.length>=2&&t[0].t!==nt&&t[1].t===U}}),O=t=>new y(t);function Ge({groups:t}){const n=t.domain.concat([bt,yt,D,Ot,St,Nt,vt,It,S,ne,Z,Pt,wt,Ht,v,Mt,et,jt]),e=[Rt,U,se,N,oe,Z,tt,re,ae,mt,gt,Y,X,dt,ut,ht,ft,pt,Et,kt,At,Lt,xt,Tt,Ct],i=[bt,Rt,yt,Ot,St,Nt,vt,It,S,Y,X,Z,Pt,wt,Ht,tt,v,Mt,et,jt],s=O(),o=r(s,et);f(o,i,o),f(o,t.domain,o);const a=O(),l=O(),d=O();f(s,t.domain,a),f(s,t.scheme,l),f(s,t.slashscheme,d),f(a,i,o),f(a,t.domain,a);const h=r(a,D);r(o,D,h),r(l,D,h),r(d,D,h);const c=r(o,N);f(c,i,o),f(c,t.domain,o);const u=O();f(h,t.domain,u),f(u,t.domain,u);const m=r(u,N);f(m,t.domain,u);const p=O(ke);f(m,t.tld,p),f(m,t.utld,p),r(h,nt,p);const b=r(u,S);r(b,S,b),f(b,t.domain,u),f(p,t.domain,u),r(p,N,m),r(p,S,b);const E=r(p,U);f(E,t.numeric,ke);const T=r(a,S),g=r(a,N);r(T,S,T),f(T,t.domain,a),f(g,i,o),f(g,t.domain,a);const L=O(lt);f(g,t.tld,L),f(g,t.utld,L),f(L,t.domain,a),f(L,i,o),r(L,N,g),r(L,S,T),r(L,D,h);const st=r(L,U),G=O(lt);f(st,t.numeric,G);const C=O(lt),P=O();f(C,n,C),f(C,e,P),f(P,n,C),f(P,e,P),r(L,v,C),r(G,v,C);const q=r(l,U),Ie=r(d,U),Pe=r(Ie,v),Ut=r(Pe,v);f(l,t.domain,a),r(l,N,g),r(l,S,T),f(d,t.domain,a),r(d,N,g),r(d,S,T),f(q,t.domain,C),r(q,v,C),r(q,tt,C),f(Ut,t.domain,C),f(Ut,n,C),r(Ut,v,C);const he=[[Y,X],[ut,dt],[ht,ft],[mt,gt],[pt,Et],[kt,At],[Lt,xt],[Tt,Ct]];for(let Bt=0;Bt<he.length;Bt++){const[fe,zt]=he[Bt],ot=r(C,fe);r(P,fe,ot),r(ot,zt,C);const W=O(lt);f(ot,n,W);const $=O();f(ot,e),f(W,n,W),f(W,e,$),f($,n,W),f($,e,$),r(W,zt,C),r($,zt,C)}return r(s,nt,L),r(s,ie,_e),{start:s,tokens:ye}}function qe(t,n,e){let i=e.length,s=0,o=[],a=[];for(;s<i;){let l=t,d=null,h=null,c=0,u=null,m=-1;for(;s<i&&!(d=l.go(e[s].t));)a.push(e[s++]);for(;s<i&&(h=d||l.go(e[s].t));)d=null,l=h,l.accepts()?(m=0,u=l):m>=0&&m++,s++,c++;if(m<0)s-=c,s<i&&(a.push(e[s]),s++);else{a.length>0&&(o.push($t(Ae,n,a)),a=[]),s-=m,c-=m;const p=u.t,b=e.slice(s-c,s);o.push($t(p,n,b))}}return a.length>0&&o.push($t(Ae,n,a)),o}function $t(t,n,e){const i=e[0].s,s=e[e.length-1].e,o=n.slice(i,s);return new t(o,e)}const $e=typeof console<"u"&&console&&console.warn||(()=>{}),Qe="until manual call of linkify.init(). Register all schemes and plugins before invoking linkify the first time.",A={scanner:null,parser:null,tokenQueue:[],pluginQueue:[],customSchemes:[],initialized:!1};function Je(){return y.groups={},A.scanner=null,A.parser=null,A.tokenQueue=[],A.pluginQueue=[],A.customSchemes=[],A.initialized=!1,A}function Le(t,n=!1){if(A.initialized&&$e(`linkifyjs: already initialized - will not register custom scheme "${t}" ${Qe}`),!/^[0-9a-z]+(-[0-9a-z]+)*$/.test(t))throw new Error(`linkifyjs: incorrect scheme format.
|
|
3
|
+
1. Must only contain digits, lowercase ASCII letters or "-"
|
|
4
|
+
2. Cannot start or end with "-"
|
|
5
|
+
3. "-" cannot repeat`);A.customSchemes.push([t,n])}function Ve(){A.scanner=Fe(A.customSchemes);for(let t=0;t<A.tokenQueue.length;t++)A.tokenQueue[t][1]({scanner:A.scanner});A.parser=Ge(A.scanner.tokens);for(let t=0;t<A.pluginQueue.length;t++)A.pluginQueue[t][1]({scanner:A.scanner,parser:A.parser});return A.initialized=!0,A}function ce(t){return A.initialized||Ve(),qe(A.parser.start,t,Oe(A.scanner.start,t))}ce.scan=Oe;function Ne(t,n=null,e=null){if(n&&typeof n=="object"){if(e)throw Error(`linkifyjs: Invalid link type ${n}; must be a string`);e=n,n=null}const i=new le(e),s=ce(t),o=[];for(let a=0;a<s.length;a++){const l=s[a];l.isLink&&(!n||l.t===n)&&i.check(l)&&o.push(l.toFormattedObject(i))}return o}var ue="[\0- -\u2029 ]",Ye=new RegExp(ue),Xe=new RegExp(`${ue}$`),Ze=new RegExp(ue,"g");function tn(t){return t.length===1?t[0].isLink:t.length===3&&t[1].isLink?["()","[]"].includes(t[0].value+t[2].value):!1}function en(t){return new _.Plugin({key:new _.PluginKey("autolink"),appendTransaction:(n,e,i)=>{const s=n.some(h=>h.docChanged)&&!e.doc.eq(i.doc),o=n.some(h=>h.getMeta("preventAutolink"));if(!s||o)return;const{tr:a}=i,l=I.combineTransactionSteps(e.doc,[...n]);if(I.getChangedRanges(l).forEach(({newRange:h})=>{const c=I.findChildrenInRange(i.doc,h,p=>p.isTextblock);let u,m;if(c.length>1)u=c[0],m=i.doc.textBetween(u.pos,u.pos+u.node.nodeSize,void 0," ");else if(c.length){const p=i.doc.textBetween(h.from,h.to," "," ");if(!Xe.test(p))return;u=c[0],m=i.doc.textBetween(u.pos,h.to,void 0," ")}if(u&&m){const p=m.split(Ye).filter(Boolean);if(p.length<=0)return!1;const b=p[p.length-1],E=u.pos+m.lastIndexOf(b);if(!b)return!1;const T=ce(b).map(g=>g.toObject(t.defaultProtocol));if(!tn(T))return!1;T.filter(g=>g.isLink).map(g=>({...g,from:E+g.start+1,to:E+g.end+1})).filter(g=>i.schema.marks.code?!i.doc.rangeHasMark(g.from,g.to,i.schema.marks.code):!0).filter(g=>t.validate(g.value)).filter(g=>t.shouldAutoLink(g.value)).forEach(g=>{I.getMarksBetween(g.from,g.to,i.doc).some(L=>L.mark.type===t.type)||a.addMark(g.from,g.to,t.type.create({href:g.href}))})}}),!!a.steps.length)return a}})}function nn(t){return new _.Plugin({key:new _.PluginKey("handleClickLink"),props:{handleClick:(n,e,i)=>{var s,o;if(i.button!==0||!n.editable)return!1;let a=!1;if(t.enableClickSelection&&(a=t.editor.commands.extendMarkRange(t.type.name)),t.openOnClick){let l=null;if(i.target instanceof HTMLAnchorElement)l=i.target;else{let u=i.target;const m=[];for(;u.nodeName!=="DIV";)m.push(u),u=u.parentNode;l=m.find(p=>p.nodeName==="A")}if(!l)return a;const d=I.getAttributes(n.state,t.type.name),h=(s=l==null?void 0:l.href)!=null?s:d.href,c=(o=l==null?void 0:l.target)!=null?o:d.target;l&&h&&(window.open(h,c),a=!0)}return a}}})}function sn(t){return new _.Plugin({key:new _.PluginKey("handlePasteLink"),props:{handlePaste:(n,e,i)=>{const{shouldAutoLink:s}=t,{state:o}=n,{selection:a}=o,{empty:l}=a;if(l)return!1;let d="";i.content.forEach(c=>{d+=c.textContent});const h=Ne(d,{defaultProtocol:t.defaultProtocol}).find(c=>c.isLink&&c.value===d);return!d||!h||s!==void 0&&!s(h.href)?!1:t.editor.commands.setMark(t.type,{href:h.href})}}})}function B(t,n){const e=["http","https","ftp","ftps","mailto","tel","callto","sms","cid","xmpp"];return n&&n.forEach(i=>{const s=typeof i=="string"?i:i.scheme;s&&e.push(s)}),!t||t.replace(Ze,"").match(new RegExp(`^(?:(?:${e.join("|")}):|[^a-z]|[a-z0-9+.-]+(?:[^a-z+.-:]|$))`,"i"))}var on=I.Mark.create({name:"link",priority:1e3,keepOnSplit:!1,exitable:!0,onCreate(){this.options.validate&&!this.options.shouldAutoLink&&(this.options.shouldAutoLink=this.options.validate,console.warn("The `validate` option is deprecated. Rename to the `shouldAutoLink` option instead.")),this.options.protocols.forEach(t=>{if(typeof t=="string"){Le(t);return}Le(t.scheme,t.optionalSlashes)})},onDestroy(){Je()},inclusive(){return this.options.autolink},addOptions(){return{openOnClick:!0,enableClickSelection:!1,linkOnPaste:!0,autolink:!0,protocols:[],defaultProtocol:"http",HTMLAttributes:{target:"_blank",rel:"noopener noreferrer nofollow",class:null},isAllowedUri:(t,n)=>!!B(t,n.protocols),validate:t=>!!t,shouldAutoLink:t=>!!t}},addAttributes(){return{href:{default:null,parseHTML(t){return t.getAttribute("href")}},target:{default:this.options.HTMLAttributes.target},rel:{default:this.options.HTMLAttributes.rel},class:{default:this.options.HTMLAttributes.class}}},parseHTML(){return[{tag:"a[href]",getAttrs:t=>{const n=t.getAttribute("href");return!n||!this.options.isAllowedUri(n,{defaultValidate:e=>!!B(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?!1:null}}]},renderHTML({HTMLAttributes:t}){return this.options.isAllowedUri(t.href,{defaultValidate:n=>!!B(n,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?["a",I.mergeAttributes(this.options.HTMLAttributes,t),0]:["a",I.mergeAttributes(this.options.HTMLAttributes,{...t,href:""}),0]},markdownTokenName:"link",parseMarkdown:(t,n)=>n.applyMark("link",n.parseInline(t.tokens||[]),{href:t.href,title:t.title||null}),renderMarkdown:(t,n)=>{var e;const i=((e=t.attrs)==null?void 0:e.href)||"";return`[${n.renderChildren(t)}](${i})`},addCommands(){return{setLink:t=>({chain:n})=>{const{href:e}=t;return this.options.isAllowedUri(e,{defaultValidate:i=>!!B(i,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?n().setMark(this.name,t).setMeta("preventAutolink",!0).run():!1},toggleLink:t=>({chain:n})=>{const{href:e}=t||{};return e&&!this.options.isAllowedUri(e,{defaultValidate:i=>!!B(i,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?!1:n().toggleMark(this.name,t,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run()},unsetLink:()=>({chain:t})=>t().unsetMark(this.name,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run()}},addPasteRules(){return[I.markPasteRule({find:t=>{const n=[];if(t){const{protocols:e,defaultProtocol:i}=this.options,s=Ne(t).filter(o=>o.isLink&&this.options.isAllowedUri(o.value,{defaultValidate:a=>!!B(a,e),protocols:e,defaultProtocol:i}));s.length&&s.forEach(o=>{this.options.shouldAutoLink(o.value)&&n.push({text:o.value,data:{href:o.href},index:o.start})})}return n},type:this.type,getAttributes:t=>{var n;return{href:(n=t.data)==null?void 0:n.href}}})]},addProseMirrorPlugins(){const t=[],{protocols:n,defaultProtocol:e}=this.options;return this.options.autolink&&t.push(en({type:this.type,defaultProtocol:this.options.defaultProtocol,validate:i=>this.options.isAllowedUri(i,{defaultValidate:s=>!!B(s,n),protocols:n,defaultProtocol:e}),shouldAutoLink:this.options.shouldAutoLink})),t.push(nn({type:this.type,editor:this.editor,openOnClick:this.options.openOnClick==="whenNotEditable"?!0:this.options.openOnClick,enableClickSelection:this.options.enableClickSelection})),this.options.linkOnPaste&&t.push(sn({editor:this.editor,defaultProtocol:this.options.defaultProtocol,type:this.type,shouldAutoLink:this.options.shouldAutoLink})),t}});function rn(){const[t,n]=F.useState(!1),e=R.useEditorInstance(),i=R.useButtonProps(de.name),{isActive:s,icon:o,tooltip:a,target:l,action:d}=(i==null?void 0:i.componentProps)??{},{dataState:h,editorDisabled:c,update:u}=R.useToggleActive(s);function m(p,b,E){c||d&&(d({link:p,text:b,openInNewTab:E}),n(!1),u())}return i?k.jsxs(Wt.Popover,{modal:!0,onOpenChange:n,open:t,children:[k.jsx(Wt.PopoverTrigger,{asChild:!0,"data-state":h?"on":"off",disabled:c,children:k.jsx(R.ActionButton,{dataState:h,disabled:c,tooltip:a,children:k.jsx(R.IconComponent,{name:o})})}),k.jsx(Wt.PopoverContent,{align:"start",className:"richtext-w-full",hideWhenDetached:!0,side:"bottom",children:k.jsx(ve,{editor:e,onSetLink:m,open:t,target:l})})]}):k.jsx(k.Fragment,{})}const de=on.extend({inclusive:!1,parseHTML(){return[{tag:'a[href]:not([data-type="button"]):not([href *= "javascript:" i])'}]},renderHTML({HTMLAttributes:t}){return["a",I.mergeAttributes(this.options.HTMLAttributes,t,{class:"link"}),0]},addOptions(){var e,i;const t=((e=this.parent)==null?void 0:e.call(this))||{},n=(i=t.HTMLAttributes)==null?void 0:i.target;return{...t,openOnClick:!1,button:({editor:s,t:o})=>({componentProps:{action:a=>{const{link:l,text:d,openInNewTab:h}=a;if(!l){s.chain().extendMarkRange("link").unsetLink().run();return}s.isActive("link")&&s.chain().extendMarkRange("link").run();const{from:c}=s.state.selection,u=d.length;s.chain().insertContent({type:"text",text:d,marks:[{type:"link",attrs:{href:/^https?:\/\//i.test(l)?l:`http://${l}`,target:n??(h?"_blank":"")}}]}).setLink({href:l}).setTextSelection({from:c,to:c+u}).focus().run()},isActive:()=>s.isActive("link"),disabled:!s.can().setLink({href:""}),icon:"Link",tooltip:o("editor.link.tooltip"),target:n}})}}});function ve(t){const{t:n}=we.useLocale(),[e,i]=F.useState({text:"",link:""}),[s,o]=F.useState(!1),a=F.useRef(null),l=F.useRef(null),d=R.useExtension(de.name);F.useEffect(()=>{const c=()=>{var st,G,C;const{from:u,to:m,empty:p}=t.editor.state.selection,b=d==null?void 0:d.options;let E="",T="",g=(st=b==null?void 0:b.HTMLAttributes)==null?void 0:st.target;const L=t.editor.state.doc.nodeAt(u);if(L){const P=L.marks.find(q=>q.type.name==="link");P?(T=P.attrs.href||"",g=P.attrs.target,p?E=L.text||"":E=t.editor.state.doc.textBetween(u,m," ")):E=t.editor.state.doc.textBetween(u,m," ")}L||(E=t.editor.state.doc.textBetween(u,m," ")),i({link:T,text:E}),o(t.target?t.target==="_blank":g==="_blank"),t.open&&(E===""?(G=a.current)==null||G.focus():(C=l.current)==null||C.focus())};return c(),t.editor.on("selectionUpdate",c),()=>{t.editor.off("selectionUpdate",c)}},[t.editor,d,t.open]);function h(c){c.preventDefault(),c.stopPropagation(),t==null||t.onSetLink(e.link,e.text,s),i({text:"",link:""})}return k.jsxs("div",{className:"richtext-flex richtext-flex-col richtext-gap-2",children:[k.jsx(R.Label,{className:"mb-[6px]",children:n("editor.link.dialog.text")}),k.jsx("div",{className:"richtext-mb-[10px] richtext-flex richtext-w-full richtext-max-w-sm richtext-items-center richtext-gap-1.5",children:k.jsx("div",{className:"richtext-relative richtext-w-full richtext-max-w-sm richtext-items-center",children:k.jsx(R.Input,{className:"richtext-w-80",onChange:c=>i({...e,text:c.target.value}),placeholder:"Text",ref:a,required:!0,type:"text",value:e.text})})}),k.jsx(R.Label,{className:"mb-[6px]",children:n("editor.link.dialog.link")}),k.jsx("div",{className:"richtext-flex richtext-w-full richtext-max-w-sm richtext-items-center richtext-gap-1.5",children:k.jsxs("div",{className:"richtext-relative richtext-w-full richtext-max-w-sm richtext-items-center",children:[k.jsx(R.Input,{className:"richtext-pl-10",onChange:c=>i({...e,link:c.target.value}),ref:l,required:!0,type:"url",value:e.link}),k.jsx("span",{className:"richtext-absolute richtext-inset-y-0 richtext-start-0 richtext-flex richtext-items-center richtext-justify-center richtext-px-2",children:k.jsx(R.IconComponent,{className:"richtext-size-5 richtext-text-muted-foreground",name:"Link"})})]})}),!t.target&&k.jsxs("div",{className:"richtext-flex richtext-items-center richtext-gap-1",children:[k.jsx(R.Checkbox,{checked:s,onCheckedChange:c=>{o(c)}}),k.jsx(R.Label,{children:n("editor.link.dialog.openInNewTab")})]}),k.jsxs("div",{className:"richtext-mt-2 richtext-flex richtext-items-center richtext-justify-end richtext-gap-2",children:[(t==null?void 0:t.onClose)&&k.jsx(R.Button,{onClick:t==null?void 0:t.onClose,type:"button",children:n("editor.link.dialog.button.cancel")}),k.jsx(R.Button,{onClick:h,type:"button",children:n("editor.link.dialog.button.apply")})]})]})}exports.Link=de;exports.LinkEditBlock=ve;exports.RichTextLink=rn;
|
package/lib/Mention.cjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("./clsx-CXbNJWDD.cjs"),w=require("@tiptap/pm/model"),y=require("./index-Cs6cp0Y6.cjs"),T=require("@tiptap/pm/state"),m=require("react/jsx-runtime"),h=require("react"),M=require("scroll-into-view-if-needed"),x=require("./renderNodeView-DfLmGrgA.cjs");function L({editor:e,overrideSuggestionOptions:t,extensionName:n,char:r="@"}){const s=new T.PluginKey;return{editor:e,char:r,pluginKey:s,command:({editor:o,range:a,props:l})=>{var u,i,d;const g=o.view.state.selection.$to.nodeAfter;((u=g==null?void 0:g.text)==null?void 0:u.startsWith(" "))&&(a.to+=1),o.chain().focus().insertContentAt(a,[{type:n,attrs:{...l,mentionSuggestionChar:r}},{type:"text",text:" "}]).run(),(d=(i=o.view.dom.ownerDocument.defaultView)==null?void 0:i.getSelection())==null||d.collapseToEnd()},allow:({state:o,range:a})=>{const l=o.doc.resolve(a.from),u=o.schema.nodes[n];return!!l.parent.type.contentMatch.matchType(u)},...t}}function v(e){return(e.options.suggestions.length?e.options.suggestions:[e.options.suggestion]).map(t=>L({editor:e.editor,overrideSuggestionOptions:t,extensionName:e.name,char:t.char}))}function f(e,t){const n=v(e),r=n.find(s=>s.char===t);return r||(n.length?n[0]:null)}var S=c.Node3.create({name:"mention",priority:101,addOptions(){return{HTMLAttributes:{},renderText({node:e,suggestion:t}){var n,r;return`${(n=t==null?void 0:t.char)!=null?n:"@"}${(r=e.attrs.label)!=null?r:e.attrs.id}`},deleteTriggerWithBackspace:!1,renderHTML({options:e,node:t,suggestion:n}){var r,s;return["span",c.mergeAttributes(this.HTMLAttributes,e.HTMLAttributes),`${(r=n==null?void 0:n.char)!=null?r:"@"}${(s=t.attrs.label)!=null?s:t.attrs.id}`]},suggestions:[],suggestion:{}}},group:"inline",inline:!0,selectable:!1,atom:!0,addAttributes(){return{id:{default:null,parseHTML:e=>e.getAttribute("data-id"),renderHTML:e=>e.id?{"data-id":e.id}:{}},label:{default:null,parseHTML:e=>e.getAttribute("data-label"),renderHTML:e=>e.label?{"data-label":e.label}:{}},mentionSuggestionChar:{default:"@",parseHTML:e=>e.getAttribute("data-mention-suggestion-char"),renderHTML:e=>({"data-mention-suggestion-char":e.mentionSuggestionChar})}}},parseHTML(){return[{tag:`span[data-type="${this.name}"]`}]},renderHTML({node:e,HTMLAttributes:t}){const n=f(this,e.attrs.mentionSuggestionChar);if(this.options.renderLabel!==void 0)return console.warn("renderLabel is deprecated use renderText and renderHTML instead"),["span",c.mergeAttributes({"data-type":this.name},this.options.HTMLAttributes,t),this.options.renderLabel({options:this.options,node:e,suggestion:n})];const r={...this.options};r.HTMLAttributes=c.mergeAttributes({"data-type":this.name},this.options.HTMLAttributes,t);const s=this.options.renderHTML({options:r,node:e,suggestion:n});return typeof s=="string"?["span",c.mergeAttributes({"data-type":this.name},this.options.HTMLAttributes,t),s]:s},...c.createInlineMarkdownSpec({nodeName:"mention",name:"@",selfClosing:!0,allowedAttributes:["id","label",{name:"mentionSuggestionChar",skipIfDefault:"@"}],parseAttributes:e=>{const t={},n=/(\w+)=(?:"([^"]*)"|'([^']*)')/g;let r=n.exec(e);for(;r!==null;){const[,s,o,a]=r,l=o??a;t[s==="char"?"mentionSuggestionChar":s]=l,r=n.exec(e)}return t},serializeAttributes:e=>Object.entries(e).filter(([,t])=>t!=null).map(([t,n])=>`${t==="mentionSuggestionChar"?"char":t}="${n}"`).join(" ")}),renderText({node:e}){const t={options:this.options,node:e,suggestion:f(this,e.attrs.mentionSuggestionChar)};return this.options.renderLabel!==void 0?(console.warn("renderLabel is deprecated use renderText and renderHTML instead"),this.options.renderLabel(t)):this.options.renderText(t)},addKeyboardShortcuts(){return{Backspace:()=>this.editor.commands.command(({tr:e,state:t})=>{let n=!1;const{selection:r}=t,{empty:s,anchor:o}=r;if(!s)return!1;let a=new w.Node,l=0;return t.doc.nodesBetween(o-1,o,(u,i)=>{if(u.type.name===this.name)return n=!0,a=u,l=i,!1}),n&&e.insertText(this.options.deleteTriggerWithBackspace?"":a.attrs.mentionSuggestionChar,l,l+a.nodeSize),n})}},addProseMirrorPlugins(){return v(this).map(y.Suggestion)}}),A=S;const b=h.forwardRef((e,t)=>{const n=h.useRef(null),[r,s]=h.useState(0),o=i=>{const d=e.items[i];d&&e.command(d)},a=()=>{s((r+e.items.length-1)%e.items.length)},l=()=>{s((r+1)%e.items.length)},u=()=>{o(r)};return h.useEffect(()=>s(0),[e.items]),h.useEffect(()=>{if(Number.isNaN(r+1))return;const i=n.current.querySelector(`span:nth-of-type(${r+1})`);i&&M(i,{behavior:"smooth",scrollMode:"if-needed"})},[r]),h.useImperativeHandle(t,()=>({onKeyDown:({event:i})=>i.key==="ArrowUp"?(a(),!0):i.key==="ArrowDown"?(l(),!0):i.key==="Enter"?(u(),!0):!1})),m.jsx("div",{className:"!richtext-max-h-[320px] !richtext-w-[160px] richtext-overflow-y-auto richtext-overflow-x-hidden richtext-rounded-md !richtext-border !richtext-border-solid !richtext-border-border richtext-bg-popover richtext-p-1 richtext-text-popover-foreground richtext-shadow-md richtext-outline-none","data-richtext-portal":!0,ref:n,children:m.jsx("div",{children:e.items.length>0?e.items.map((i,d)=>{var g;return m.jsxs("span",{className:c.clsx("richtext-flex richtext-w-full richtext-items-center richtext-gap-3 richtext-rounded-sm !richtext-border-none !richtext-bg-transparent richtext-px-2 richtext-py-1.5 richtext-text-left richtext-text-sm richtext-text-foreground !richtext-outline-none richtext-transition-colors hover:!richtext-bg-accent",{"bg-item-active":d===r}),onClick:p=>{p.preventDefault(),o(d)},children:[((g=i==null?void 0:i.avatar)==null?void 0:g.src)&&m.jsx("img",{alt:i.label,className:"richtext-size-5 richtext-rounded-full",src:i.avatar.src}),i==null?void 0:i.label]},`mention-item-${i.id}`)}):m.jsx("div",{className:c.clsx("itemUserEmpty, richtext-text-foreground"),children:"Empty"})})})}),H=c.Extension.create({name:"richTextMentionWrapper",addExtensions(){var t,n,r,s;const e={...this.options};return(t=this.options)!=null&&t.suggestion&&(e.suggestion={render:x.renderNodeViewClosure(b),...this.options.suggestion}),(r=(n=this.options)==null?void 0:n.suggestions)!=null&&r.length&&(e.suggestions=(s=this.options.suggestions)==null?void 0:s.map(o=>({render:x.renderNodeViewClosure(b),...o}))),[A.configure({HTMLAttributes:{class:"mention"},...e})]}});exports.Mention=H;
|
package/lib/Mention.js
ADDED
|
@@ -0,0 +1,265 @@
|
|
|
1
|
+
import { N as T, z as y, m as h, j as p, E as M } from "./clsx-CDyrfCnw.js";
|
|
2
|
+
import { Node as L } from "@tiptap/pm/model";
|
|
3
|
+
import { S } from "./index-CsSfYR30.js";
|
|
4
|
+
import { PluginKey as H } from "@tiptap/pm/state";
|
|
5
|
+
import { jsx as g, jsxs as A } from "react/jsx-runtime";
|
|
6
|
+
import { forwardRef as N, useRef as C, useState as $, useEffect as f, useImperativeHandle as k } from "react";
|
|
7
|
+
import E from "scroll-into-view-if-needed";
|
|
8
|
+
import { r as x } from "./renderNodeView-BJSrgyGj.js";
|
|
9
|
+
function _({
|
|
10
|
+
editor: e,
|
|
11
|
+
overrideSuggestionOptions: t,
|
|
12
|
+
extensionName: n,
|
|
13
|
+
char: r = "@"
|
|
14
|
+
}) {
|
|
15
|
+
const o = new H();
|
|
16
|
+
return {
|
|
17
|
+
editor: e,
|
|
18
|
+
char: r,
|
|
19
|
+
pluginKey: o,
|
|
20
|
+
command: ({ editor: s, range: a, props: l }) => {
|
|
21
|
+
var u, i, c;
|
|
22
|
+
const d = s.view.state.selection.$to.nodeAfter;
|
|
23
|
+
((u = d == null ? void 0 : d.text) == null ? void 0 : u.startsWith(" ")) && (a.to += 1), s.chain().focus().insertContentAt(a, [
|
|
24
|
+
{
|
|
25
|
+
type: n,
|
|
26
|
+
attrs: { ...l, mentionSuggestionChar: r }
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
type: "text",
|
|
30
|
+
text: " "
|
|
31
|
+
}
|
|
32
|
+
]).run(), (c = (i = s.view.dom.ownerDocument.defaultView) == null ? void 0 : i.getSelection()) == null || c.collapseToEnd();
|
|
33
|
+
},
|
|
34
|
+
allow: ({ state: s, range: a }) => {
|
|
35
|
+
const l = s.doc.resolve(a.from), u = s.schema.nodes[n];
|
|
36
|
+
return !!l.parent.type.contentMatch.matchType(u);
|
|
37
|
+
},
|
|
38
|
+
...t
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
function w(e) {
|
|
42
|
+
return (e.options.suggestions.length ? e.options.suggestions : [e.options.suggestion]).map(
|
|
43
|
+
(t) => _({
|
|
44
|
+
// @ts-ignore `editor` can be `undefined` when converting the document to HTML with the HTML utility
|
|
45
|
+
editor: e.editor,
|
|
46
|
+
overrideSuggestionOptions: t,
|
|
47
|
+
extensionName: e.name,
|
|
48
|
+
char: t.char
|
|
49
|
+
})
|
|
50
|
+
);
|
|
51
|
+
}
|
|
52
|
+
function b(e, t) {
|
|
53
|
+
const n = w(e), r = n.find((o) => o.char === t);
|
|
54
|
+
return r || (n.length ? n[0] : null);
|
|
55
|
+
}
|
|
56
|
+
var I = T.create({
|
|
57
|
+
name: "mention",
|
|
58
|
+
priority: 101,
|
|
59
|
+
addOptions() {
|
|
60
|
+
return {
|
|
61
|
+
HTMLAttributes: {},
|
|
62
|
+
renderText({ node: e, suggestion: t }) {
|
|
63
|
+
var n, r;
|
|
64
|
+
return `${(n = t == null ? void 0 : t.char) != null ? n : "@"}${(r = e.attrs.label) != null ? r : e.attrs.id}`;
|
|
65
|
+
},
|
|
66
|
+
deleteTriggerWithBackspace: !1,
|
|
67
|
+
renderHTML({ options: e, node: t, suggestion: n }) {
|
|
68
|
+
var r, o;
|
|
69
|
+
return [
|
|
70
|
+
"span",
|
|
71
|
+
h(this.HTMLAttributes, e.HTMLAttributes),
|
|
72
|
+
`${(r = n == null ? void 0 : n.char) != null ? r : "@"}${(o = t.attrs.label) != null ? o : t.attrs.id}`
|
|
73
|
+
];
|
|
74
|
+
},
|
|
75
|
+
suggestions: [],
|
|
76
|
+
suggestion: {}
|
|
77
|
+
};
|
|
78
|
+
},
|
|
79
|
+
group: "inline",
|
|
80
|
+
inline: !0,
|
|
81
|
+
selectable: !1,
|
|
82
|
+
atom: !0,
|
|
83
|
+
addAttributes() {
|
|
84
|
+
return {
|
|
85
|
+
id: {
|
|
86
|
+
default: null,
|
|
87
|
+
parseHTML: (e) => e.getAttribute("data-id"),
|
|
88
|
+
renderHTML: (e) => e.id ? {
|
|
89
|
+
"data-id": e.id
|
|
90
|
+
} : {}
|
|
91
|
+
},
|
|
92
|
+
label: {
|
|
93
|
+
default: null,
|
|
94
|
+
parseHTML: (e) => e.getAttribute("data-label"),
|
|
95
|
+
renderHTML: (e) => e.label ? {
|
|
96
|
+
"data-label": e.label
|
|
97
|
+
} : {}
|
|
98
|
+
},
|
|
99
|
+
// When there are multiple types of mentions, this attribute helps distinguish them
|
|
100
|
+
mentionSuggestionChar: {
|
|
101
|
+
default: "@",
|
|
102
|
+
parseHTML: (e) => e.getAttribute("data-mention-suggestion-char"),
|
|
103
|
+
renderHTML: (e) => ({
|
|
104
|
+
"data-mention-suggestion-char": e.mentionSuggestionChar
|
|
105
|
+
})
|
|
106
|
+
}
|
|
107
|
+
};
|
|
108
|
+
},
|
|
109
|
+
parseHTML() {
|
|
110
|
+
return [
|
|
111
|
+
{
|
|
112
|
+
tag: `span[data-type="${this.name}"]`
|
|
113
|
+
}
|
|
114
|
+
];
|
|
115
|
+
},
|
|
116
|
+
renderHTML({ node: e, HTMLAttributes: t }) {
|
|
117
|
+
const n = b(this, e.attrs.mentionSuggestionChar);
|
|
118
|
+
if (this.options.renderLabel !== void 0)
|
|
119
|
+
return console.warn("renderLabel is deprecated use renderText and renderHTML instead"), [
|
|
120
|
+
"span",
|
|
121
|
+
h({ "data-type": this.name }, this.options.HTMLAttributes, t),
|
|
122
|
+
this.options.renderLabel({
|
|
123
|
+
options: this.options,
|
|
124
|
+
node: e,
|
|
125
|
+
suggestion: n
|
|
126
|
+
})
|
|
127
|
+
];
|
|
128
|
+
const r = { ...this.options };
|
|
129
|
+
r.HTMLAttributes = h(
|
|
130
|
+
{ "data-type": this.name },
|
|
131
|
+
this.options.HTMLAttributes,
|
|
132
|
+
t
|
|
133
|
+
);
|
|
134
|
+
const o = this.options.renderHTML({
|
|
135
|
+
options: r,
|
|
136
|
+
node: e,
|
|
137
|
+
suggestion: n
|
|
138
|
+
});
|
|
139
|
+
return typeof o == "string" ? ["span", h({ "data-type": this.name }, this.options.HTMLAttributes, t), o] : o;
|
|
140
|
+
},
|
|
141
|
+
...y({
|
|
142
|
+
nodeName: "mention",
|
|
143
|
+
name: "@",
|
|
144
|
+
selfClosing: !0,
|
|
145
|
+
allowedAttributes: ["id", "label", { name: "mentionSuggestionChar", skipIfDefault: "@" }],
|
|
146
|
+
parseAttributes: (e) => {
|
|
147
|
+
const t = {}, n = /(\w+)=(?:"([^"]*)"|'([^']*)')/g;
|
|
148
|
+
let r = n.exec(e);
|
|
149
|
+
for (; r !== null; ) {
|
|
150
|
+
const [, o, s, a] = r, l = s ?? a;
|
|
151
|
+
t[o === "char" ? "mentionSuggestionChar" : o] = l, r = n.exec(e);
|
|
152
|
+
}
|
|
153
|
+
return t;
|
|
154
|
+
},
|
|
155
|
+
serializeAttributes: (e) => Object.entries(e).filter(([, t]) => t != null).map(([t, n]) => `${t === "mentionSuggestionChar" ? "char" : t}="${n}"`).join(" ")
|
|
156
|
+
}),
|
|
157
|
+
renderText({ node: e }) {
|
|
158
|
+
const t = {
|
|
159
|
+
options: this.options,
|
|
160
|
+
node: e,
|
|
161
|
+
suggestion: b(this, e.attrs.mentionSuggestionChar)
|
|
162
|
+
};
|
|
163
|
+
return this.options.renderLabel !== void 0 ? (console.warn("renderLabel is deprecated use renderText and renderHTML instead"), this.options.renderLabel(t)) : this.options.renderText(t);
|
|
164
|
+
},
|
|
165
|
+
addKeyboardShortcuts() {
|
|
166
|
+
return {
|
|
167
|
+
Backspace: () => this.editor.commands.command(({ tr: e, state: t }) => {
|
|
168
|
+
let n = !1;
|
|
169
|
+
const { selection: r } = t, { empty: o, anchor: s } = r;
|
|
170
|
+
if (!o)
|
|
171
|
+
return !1;
|
|
172
|
+
let a = new L(), l = 0;
|
|
173
|
+
return t.doc.nodesBetween(s - 1, s, (u, i) => {
|
|
174
|
+
if (u.type.name === this.name)
|
|
175
|
+
return n = !0, a = u, l = i, !1;
|
|
176
|
+
}), n && e.insertText(
|
|
177
|
+
this.options.deleteTriggerWithBackspace ? "" : a.attrs.mentionSuggestionChar,
|
|
178
|
+
l,
|
|
179
|
+
l + a.nodeSize
|
|
180
|
+
), n;
|
|
181
|
+
})
|
|
182
|
+
};
|
|
183
|
+
},
|
|
184
|
+
addProseMirrorPlugins() {
|
|
185
|
+
return w(this).map(S);
|
|
186
|
+
}
|
|
187
|
+
}), z = I;
|
|
188
|
+
const v = N((e, t) => {
|
|
189
|
+
const n = C(null), [r, o] = $(0), s = (i) => {
|
|
190
|
+
const c = e.items[i];
|
|
191
|
+
c && e.command(c);
|
|
192
|
+
}, a = () => {
|
|
193
|
+
o((r + e.items.length - 1) % e.items.length);
|
|
194
|
+
}, l = () => {
|
|
195
|
+
o((r + 1) % e.items.length);
|
|
196
|
+
}, u = () => {
|
|
197
|
+
s(r);
|
|
198
|
+
};
|
|
199
|
+
return f(() => o(0), [e.items]), f(() => {
|
|
200
|
+
if (Number.isNaN(r + 1)) return;
|
|
201
|
+
const i = n.current.querySelector(`span:nth-of-type(${r + 1})`);
|
|
202
|
+
i && E(i, { behavior: "smooth", scrollMode: "if-needed" });
|
|
203
|
+
}, [r]), k(t, () => ({
|
|
204
|
+
onKeyDown: ({ event: i }) => i.key === "ArrowUp" ? (a(), !0) : i.key === "ArrowDown" ? (l(), !0) : i.key === "Enter" ? (u(), !0) : !1
|
|
205
|
+
})), /* @__PURE__ */ g(
|
|
206
|
+
"div",
|
|
207
|
+
{
|
|
208
|
+
className: "!richtext-max-h-[320px] !richtext-w-[160px] richtext-overflow-y-auto richtext-overflow-x-hidden richtext-rounded-md !richtext-border !richtext-border-solid !richtext-border-border richtext-bg-popover richtext-p-1 richtext-text-popover-foreground richtext-shadow-md richtext-outline-none",
|
|
209
|
+
"data-richtext-portal": !0,
|
|
210
|
+
ref: n,
|
|
211
|
+
children: /* @__PURE__ */ g("div", { children: e.items.length > 0 ? e.items.map((i, c) => {
|
|
212
|
+
var d;
|
|
213
|
+
return /* @__PURE__ */ A(
|
|
214
|
+
"span",
|
|
215
|
+
{
|
|
216
|
+
className: p(
|
|
217
|
+
"richtext-flex richtext-w-full richtext-items-center richtext-gap-3 richtext-rounded-sm !richtext-border-none !richtext-bg-transparent richtext-px-2 richtext-py-1.5 richtext-text-left richtext-text-sm richtext-text-foreground !richtext-outline-none richtext-transition-colors hover:!richtext-bg-accent",
|
|
218
|
+
{ "bg-item-active": c === r }
|
|
219
|
+
),
|
|
220
|
+
onClick: (m) => {
|
|
221
|
+
m.preventDefault(), s(c);
|
|
222
|
+
},
|
|
223
|
+
children: [
|
|
224
|
+
((d = i == null ? void 0 : i.avatar) == null ? void 0 : d.src) && /* @__PURE__ */ g(
|
|
225
|
+
"img",
|
|
226
|
+
{
|
|
227
|
+
alt: i.label,
|
|
228
|
+
className: "richtext-size-5 richtext-rounded-full",
|
|
229
|
+
src: i.avatar.src
|
|
230
|
+
}
|
|
231
|
+
),
|
|
232
|
+
i == null ? void 0 : i.label
|
|
233
|
+
]
|
|
234
|
+
},
|
|
235
|
+
`mention-item-${i.id}`
|
|
236
|
+
);
|
|
237
|
+
}) : /* @__PURE__ */ g("div", { className: p("itemUserEmpty, richtext-text-foreground"), children: "Empty" }) })
|
|
238
|
+
}
|
|
239
|
+
);
|
|
240
|
+
}), Q = /* @__PURE__ */ M.create({
|
|
241
|
+
name: "richTextMentionWrapper",
|
|
242
|
+
addExtensions() {
|
|
243
|
+
var t, n, r, o;
|
|
244
|
+
const e = {
|
|
245
|
+
...this.options
|
|
246
|
+
};
|
|
247
|
+
return (t = this.options) != null && t.suggestion && (e.suggestion = {
|
|
248
|
+
render: x(v),
|
|
249
|
+
...this.options.suggestion
|
|
250
|
+
}), (r = (n = this.options) == null ? void 0 : n.suggestions) != null && r.length && (e.suggestions = (o = this.options.suggestions) == null ? void 0 : o.map((s) => ({
|
|
251
|
+
render: x(v),
|
|
252
|
+
...s
|
|
253
|
+
}))), [
|
|
254
|
+
z.configure({
|
|
255
|
+
HTMLAttributes: {
|
|
256
|
+
class: "mention"
|
|
257
|
+
},
|
|
258
|
+
...e
|
|
259
|
+
})
|
|
260
|
+
];
|
|
261
|
+
}
|
|
262
|
+
});
|
|
263
|
+
export {
|
|
264
|
+
Q as Mention
|
|
265
|
+
};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";var O=Object.create;var A=Object.defineProperty;var _=Object.getOwnPropertyDescriptor;var $=Object.getOwnPropertyNames;var B=Object.getPrototypeOf,z=Object.prototype.hasOwnProperty;var q=(e,i,s,o)=>{if(i&&typeof i=="object"||typeof i=="function")for(let l of $(i))!z.call(e,l)&&l!==s&&A(e,l,{get:()=>i[l],enumerable:!(o=_(i,l))||o.enumerable});return e};var T=(e,i,s)=>(s=e!=null?O(B(e)):{},q(i||!e||!e.__esModule?A(s,"default",{value:e,enumerable:!0}):s,e));const N=require("./clsx-CXbNJWDD.cjs"),t=require("react/jsx-runtime"),r=require("react"),d=require("./index-D9oM__YW.cjs"),L=require("./textarea-DZj6EY-N.cjs"),R=({editor:e,node:i,updateAttributes:s})=>{var n,c;const o=((n=i==null?void 0:i.attrs)==null?void 0:n.code)??v,l=((c=i==null?void 0:i.attrs)==null?void 0:c.align)??"center",[a,M]=r.useState(o),[b,m]=r.useState(""),[y,u]=r.useState(""),[g,f]=r.useState(!1),[h,w]=r.useState(null),[p,S]=r.useState(!0),I=r.useRef(`mermaid-edit-${Math.random().toString(36).slice(2,9)}`),C=r.useCallback(x=>{f(x),x&&M(o)},[o]);r.useEffect(()=>{import("mermaid").then(x=>{const j=x.default;j.initialize({startOnLoad:!1,darkMode:!1,fontSize:12,theme:"base"}),w(j)}).finally(()=>S(!1))},[]),r.useEffect(()=>{if(!h||!g)return;(async()=>{const j=a.trim();if(!j){m(""),u("");return}try{const E=`${I.current}-${Date.now()}`,{svg:H}=await h.render(E,j);m(H),u("")}catch(E){m(""),u((E==null?void 0:E.message)??"Invalid Mermaid syntax")}})()},[a,h,g]);const D=r.useCallback(()=>{a.trim()&&(s?s({code:a}):e==null||e.chain().focus().setMermaid({code:a,align:l}).run(),f(!1))},[e,a,l,s]);return t.jsxs(d.Dialog,{onOpenChange:C,open:g,children:[t.jsx(d.DialogTrigger,{asChild:!0,children:t.jsx(d.ActionButton,{action:()=>f(!0),icon:"Pencil",tooltip:"Edit Mermaid"})}),t.jsxs(d.DialogContent,{className:"richtext-z-[99999] !richtext-max-w-[1300px]",children:[t.jsx(d.DialogTitle,{children:"Edit Mermaid Diagram"}),t.jsx("div",{style:{height:"100%",border:"1px solid hsl(var(--border))"},children:p?t.jsx("div",{className:"richtext-flex richtext-items-center richtext-justify-center richtext-p-10 richtext-text-sm richtext-text-gray-400",children:"Loading Mermaid…"}):t.jsxs("div",{className:"richtext-flex richtext-gap-[10px] richtext-rounded-[10px] richtext-p-[10px]",children:[t.jsx(L.Textarea,{autoFocus:!0,className:"richtext-flex-1 richtext-font-mono richtext-text-sm",onChange:x=>M(x.target.value),placeholder:v,required:!0,rows:18,value:a,style:{color:"hsl(var(--foreground))"}}),t.jsx("div",{className:"richtext-flex richtext-flex-1 richtext-items-center richtext-justify-center richtext-overflow-auto richtext-rounded-[10px] richtext-p-[10px]",style:{minHeight:400,border:"1px solid hsl(var(--border))",background:"#fff"},children:y?t.jsxs("p",{className:"richtext-max-w-xs richtext-break-words richtext-text-sm richtext-text-red-500",children:["⚠ ",y]}):b?t.jsx("div",{dangerouslySetInnerHTML:{__html:b}}):t.jsx("p",{className:"richtext-text-sm richtext-text-gray-400",children:"Start typing to preview…"})})]})}),t.jsx(d.DialogFooter,{children:t.jsx(d.Button,{disabled:p||!h||!a.trim(),onClick:D,type:"button",children:"Save changes"})})]})]})};function F({editor:e,node:i,updateAttributes:s,selected:o,extension:l}){const[a,M]=r.useState(()=>(e==null?void 0:e.isEditable)??!1);r.useEffect(()=>{const n=()=>M((e==null?void 0:e.isEditable)??!1);return n(),e==null||e.on("editableUpdate",n),e==null||e.on("update",n),()=>{e==null||e.off("editableUpdate",n),e==null||e.off("update",n)}},[e]);const{code:b,align:m,width:y}=i.attrs,u=r.useRef(null),[g,f]=r.useState(""),[h,w]=r.useState(""),[p,S]=r.useState(null),I=r.useRef(`mermaid-view-${Math.random().toString(36).slice(2,9)}`);r.useEffect(()=>{import("mermaid").then(n=>{const c=n.default;c.initialize({startOnLoad:!1,darkMode:!1,fontSize:12,theme:"base"}),S(c)})},[]);const C=r.useCallback(async n=>{if(!(!p||!(n!=null&&n.trim())))try{const c=`${I.current}-${Date.now()}`,{svg:x}=await p.render(c,n);f(x),w("")}catch(c){f(""),w((c==null?void 0:c.message)??"Invalid Mermaid syntax")}},[p]);r.useEffect(()=>{C(b)},[b,C]);const D={textAlign:m??"center",width:y??"100%"};return t.jsx(N.NodeViewWrapper,{className:"mermaid-node-view richtext-relative richtext-my-4",style:D,children:t.jsxs("div",{"data-drag-handle":!0,draggable:a?"true":"false",ref:u,className:["richtext-relative richtext-inline-block richtext-rounded-lg richtext-border richtext-bg-white richtext-p-4 richtext-transition-all",a?o?"richtext-border-gray-300":"richtext-border-transparent":"richtext-pointer-events-none richtext-select-none richtext-border-transparent"].join(" "),style:{maxWidth:"100%"},children:[h?t.jsx("div",{className:"richtext-flex richtext-min-h-[120px] richtext-min-w-[200px] richtext-items-center richtext-justify-center richtext-rounded richtext-bg-red-50 richtext-p-4 richtext-text-sm richtext-text-red-500",children:t.jsxs("span",{children:["⚠ ",h]})}):g?t.jsx("div",{className:"mermaid-svg-container",dangerouslySetInnerHTML:{__html:g}}):t.jsx("div",{className:"richtext-flex richtext-min-h-[120px] richtext-min-w-[200px] richtext-items-center richtext-justify-center richtext-rounded richtext-bg-gray-50 richtext-text-sm richtext-text-gray-400",children:"Rendering…"}),a&&t.jsx("div",{className:"richtext-absolute richtext-right-2 richtext-top-2 richtext-opacity-0 richtext-transition-opacity [.mermaid-node-view:hover_&]:richtext-opacity-100",children:t.jsx(R,{editor:e,node:i,updateAttributes:s,extension:l})})]})})}function U(){const e=d.useEditorInstance(),i=d.useButtonProps(k.name),{tooltipOptions:s={},isActive:o=void 0}=(i==null?void 0:i.componentProps)??{},{editorDisabled:l}=d.useToggleActive(o),[a,M]=r.useState(v),[b,m]=r.useState(""),[y,u]=r.useState(""),[g,f]=r.useState(!1),[h,w]=r.useState(null),[p,S]=r.useState(!0),I=r.useRef(`mermaid-toolbar-${Math.random().toString(36).slice(2,9)}`);r.useEffect(()=>{import("mermaid").then(n=>{const c=n.default;c.initialize({startOnLoad:!1,darkMode:!1,fontSize:12,theme:"base"}),w(c)}).finally(()=>S(!1))},[]),r.useEffect(()=>{if(!h||!g)return;(async()=>{const c=a.trim();if(!c){m(""),u("");return}try{const x=`${I.current}-${Date.now()}`,{svg:j}=await h.render(x,c);m(j),u("")}catch(x){m(""),u((x==null?void 0:x.message)??"Invalid Mermaid syntax")}})()},[a,h,g]);const C=r.useCallback(n=>{f(n),n&&(M(v),m(""),u(""))},[]),D=r.useCallback(()=>{a.trim()&&(e==null||e.chain().focus().setMermaid({code:a,align:"center",width:"100%"}).run(),f(!1))},[e,a]);return t.jsxs(d.Dialog,{onOpenChange:C,open:g,children:[t.jsx(d.DialogTrigger,{asChild:!0,children:t.jsx(d.ActionButton,{disabled:l,icon:"Mermaid",tooltip:"Mermaid",tooltipOptions:s,action:()=>{l||f(!0)}})}),t.jsxs(d.DialogContent,{className:"richtext-z-[99999] !richtext-max-w-[1300px]",children:[t.jsx(d.DialogTitle,{children:"Insert Mermaid Diagram"}),t.jsx("div",{style:{height:"100%",border:"1px solid hsl(var(--border))"},children:p?t.jsx("div",{className:"richtext-flex richtext-items-center richtext-justify-center richtext-p-10 richtext-text-sm richtext-text-gray-400",children:"Loading Mermaid…"}):t.jsxs("div",{className:"richtext-flex richtext-gap-[10px] richtext-rounded-[10px] richtext-p-[10px]",children:[t.jsx(L.Textarea,{autoFocus:!0,className:"richtext-flex-1 richtext-font-mono richtext-text-sm",onChange:n=>M(n.target.value),placeholder:v,required:!0,rows:18,value:a,style:{color:"hsl(var(--foreground))"}}),t.jsx("div",{className:"richtext-flex richtext-flex-1 richtext-items-center richtext-justify-center richtext-overflow-auto richtext-rounded-[10px] richtext-p-[10px]",style:{minHeight:400,border:"1px solid hsl(var(--border))",background:"#fff"},children:y?t.jsxs("p",{className:"richtext-max-w-xs richtext-break-words richtext-text-sm richtext-text-red-500",children:["⚠ ",y]}):b?t.jsx("div",{dangerouslySetInnerHTML:{__html:b}}):t.jsx("p",{className:"richtext-text-sm richtext-text-gray-400",children:"Start typing to preview…"})})]})}),t.jsx(d.DialogFooter,{children:t.jsx(d.Button,{disabled:p||!h||!a.trim(),onClick:D,type:"button",children:"Insert diagram"})})]})]})}const v=`graph TB
|
|
2
|
+
A --> B`,k=N.Node3.create({name:"mermaid",group:"block",selectable:!0,atom:!0,draggable:!0,inline:!1,addOptions(){return{divider:!1,spacer:!1,HTMLAttributes:{class:"mermaid-node"},button:({editor:e,t:i,extension:s})=>({componentProps:{action:()=>!0,isActive:()=>e.isActive("mermaid"),disabled:!1,editor:e,icon:"Mermaid",tooltip:i("editor.mermaid.tooltip")}})}},addAttributes(){return{code:{default:v,parseHTML:e=>e.getAttribute("data-code")?decodeURIComponent(e.getAttribute("data-code")):v,renderHTML:e=>({"data-code":encodeURIComponent(e.code??"")})},align:{default:"center",parseHTML:e=>e.getAttribute("data-align")??"center",renderHTML:e=>({"data-align":e.align})},width:{default:"100%",parseHTML:e=>e.getAttribute("data-width")??"100%",renderHTML:e=>({"data-width":e.width})}}},parseHTML(){return[{tag:"div[class=mermaid-node]"}]},renderHTML({HTMLAttributes:e,node:i}){const{align:s}=i.attrs,o=s?`text-align: ${s};`:"";return["div",N.mergeAttributes({class:"mermaid-node"},e,{style:o})]},addCommands(){return{setMermaid:e=>({tr:i,commands:s})=>{var o,l,a;return e={code:v,align:"center",width:"100%",...e},((a=(l=(o=i.selection)==null?void 0:o.node)==null?void 0:l.type)==null?void 0:a.name)===this.name?s.updateAttributes(this.name,e):s.insertContent({type:this.name,attrs:e})},setMermaidAlign:e=>({commands:i})=>i.updateAttributes(this.name,{align:e})}},addNodeView(){return N.ReactNodeViewRenderer(F)}});exports.DEFAULT_MERMAID_CODE=v;exports.EditMermaidBlock=R;exports.Mermaid=k;exports.RichTextMermaid=U;
|