@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,305 @@
|
|
|
1
|
+
import { E as Q } from "./clsx-CDyrfCnw.js";
|
|
2
|
+
import { Plugin as X, PluginKey as Y } from "@tiptap/pm/state";
|
|
3
|
+
import { DecorationSet as $, Decoration as Z } from "@tiptap/pm/view";
|
|
4
|
+
import { jsx as u, Fragment as _, jsxs as T } from "react/jsx-runtime";
|
|
5
|
+
import { useState as b, useEffect as k } from "react";
|
|
6
|
+
import { h as ee, u as te, e as se, A as re, L as B, j as V, B as N, I as q, C as ne } from "./index-lj3VWExo.js";
|
|
7
|
+
import "./theme.js";
|
|
8
|
+
import { u as ce } from "./index-4Q5IhypJ.js";
|
|
9
|
+
import { P as ae, a as le, b as oe } from "./popover-CPr9bHYn.js";
|
|
10
|
+
function Ce() {
|
|
11
|
+
const { t } = ce(), e = ee(), s = te(xe.name), {
|
|
12
|
+
icon: n = void 0,
|
|
13
|
+
tooltip: i = void 0,
|
|
14
|
+
shortcutKeys: l = void 0,
|
|
15
|
+
tooltipOptions: c = {},
|
|
16
|
+
action: h = void 0,
|
|
17
|
+
isActive: m = void 0
|
|
18
|
+
} = (s == null ? void 0 : s.componentProps) ?? {}, { disabled: o } = se(m), [f, d] = b(!1), [x, A] = b(""), [S, w] = b(""), [I, M] = b(!1), [W, j] = b(""), y = () => {
|
|
19
|
+
var r, a, g, p;
|
|
20
|
+
j(
|
|
21
|
+
`${((a = (r = e == null ? void 0 : e.storage) == null ? void 0 : r.searchAndReplace) == null ? void 0 : a.resultIndex) + 1}/${(p = (g = e == null ? void 0 : e.storage) == null ? void 0 : g.searchAndReplace) == null ? void 0 : p.results.length}`
|
|
22
|
+
);
|
|
23
|
+
};
|
|
24
|
+
k(() => {
|
|
25
|
+
e && y();
|
|
26
|
+
}, [e]);
|
|
27
|
+
const H = () => {
|
|
28
|
+
o || h && h();
|
|
29
|
+
}, L = (r = !1) => {
|
|
30
|
+
var a, g, p, R, v, F, P, O;
|
|
31
|
+
e && (r && ((g = (a = e == null ? void 0 : e.commands) == null ? void 0 : a.resetIndex) == null || g.call(a)), (R = (p = e == null ? void 0 : e.commands) == null ? void 0 : p.setSearchTerm) == null || R.call(p, x), (F = (v = e == null ? void 0 : e.commands) == null ? void 0 : v.setReplaceTerm) == null || F.call(v, S), (O = (P = e == null ? void 0 : e.commands) == null ? void 0 : P.setCaseSensitive) == null || O.call(P, I), y());
|
|
32
|
+
}, E = () => {
|
|
33
|
+
var R, v;
|
|
34
|
+
if (!e) return;
|
|
35
|
+
const { results: r, resultIndex: a } = e.storage.searchAndReplace, g = r[a];
|
|
36
|
+
if (!g) return;
|
|
37
|
+
(v = (R = e == null ? void 0 : e.commands) == null ? void 0 : R.setTextSelection) == null || v.call(R, g);
|
|
38
|
+
const { node: p } = e.view.domAtPos(e.state.selection.anchor);
|
|
39
|
+
p instanceof HTMLElement && p.scrollIntoView({ behavior: "smooth", block: "center" }), y();
|
|
40
|
+
};
|
|
41
|
+
k(() => {
|
|
42
|
+
x.trim() || D(), x.trim() && L(!0);
|
|
43
|
+
}, [x]), k(() => {
|
|
44
|
+
S.trim() && L();
|
|
45
|
+
}, [S]), k(() => {
|
|
46
|
+
L(!0);
|
|
47
|
+
}, [I]);
|
|
48
|
+
const U = () => {
|
|
49
|
+
var r, a;
|
|
50
|
+
(a = (r = e == null ? void 0 : e.commands) == null ? void 0 : r.replace) == null || a.call(r), E();
|
|
51
|
+
}, z = () => {
|
|
52
|
+
var r, a;
|
|
53
|
+
(a = (r = e == null ? void 0 : e.commands) == null ? void 0 : r.nextSearchResult) == null || a.call(r), E();
|
|
54
|
+
}, G = () => {
|
|
55
|
+
var r, a;
|
|
56
|
+
(a = (r = e == null ? void 0 : e.commands) == null ? void 0 : r.previousSearchResult) == null || a.call(r), E();
|
|
57
|
+
}, D = () => {
|
|
58
|
+
var r, a;
|
|
59
|
+
A(""), w(""), (a = (r = e == null ? void 0 : e.commands) == null ? void 0 : r.resetIndex) == null || a.call(r), y();
|
|
60
|
+
}, J = () => {
|
|
61
|
+
var r, a;
|
|
62
|
+
(a = (r = e == null ? void 0 : e.commands) == null ? void 0 : r.replaceAll) == null || a.call(r), j("0/0");
|
|
63
|
+
};
|
|
64
|
+
return s ? /* @__PURE__ */ T(ae, { onOpenChange: d, open: f, children: [
|
|
65
|
+
/* @__PURE__ */ u(le, { asChild: !0, disabled: o, children: /* @__PURE__ */ u(
|
|
66
|
+
re,
|
|
67
|
+
{
|
|
68
|
+
action: H,
|
|
69
|
+
disabled: o,
|
|
70
|
+
icon: n,
|
|
71
|
+
shortcutKeys: l,
|
|
72
|
+
tooltip: i,
|
|
73
|
+
tooltipOptions: c
|
|
74
|
+
}
|
|
75
|
+
) }),
|
|
76
|
+
/* @__PURE__ */ T(oe, { align: "start", className: "richtext-w-full", hideWhenDetached: !0, side: "bottom", children: [
|
|
77
|
+
/* @__PURE__ */ T("div", { className: "richtext-mb-[6px] richtext-flex richtext-items-center richtext-justify-between", children: [
|
|
78
|
+
/* @__PURE__ */ u(B, { children: t("editor.search.dialog.text") }),
|
|
79
|
+
/* @__PURE__ */ u("span", { className: "richtext-font-semibold", children: W })
|
|
80
|
+
] }),
|
|
81
|
+
/* @__PURE__ */ T("div", { className: "richtext-mb-[10px] richtext-flex richtext-w-full richtext-max-w-sm richtext-items-center richtext-gap-1.5", children: [
|
|
82
|
+
/* @__PURE__ */ u(
|
|
83
|
+
V,
|
|
84
|
+
{
|
|
85
|
+
autoFocus: !0,
|
|
86
|
+
className: "richtext-w-full",
|
|
87
|
+
onChange: (r) => A(r.target.value),
|
|
88
|
+
placeholder: "Text",
|
|
89
|
+
required: !0,
|
|
90
|
+
type: "text",
|
|
91
|
+
value: x
|
|
92
|
+
}
|
|
93
|
+
),
|
|
94
|
+
/* @__PURE__ */ u(N, { className: "richtext-flex-1", onClick: G, children: /* @__PURE__ */ u(q, { name: "ChevronUp" }) }),
|
|
95
|
+
/* @__PURE__ */ u(N, { className: "richtext-flex-1", onClick: z, children: /* @__PURE__ */ u(q, { name: "ChevronDown" }) }),
|
|
96
|
+
/* @__PURE__ */ u(N, { className: "richtext-flex-1", onClick: D, children: "Clear" })
|
|
97
|
+
] }),
|
|
98
|
+
/* @__PURE__ */ u(B, { className: "richtext-mb-[6px]", children: t("editor.replace.dialog.text") }),
|
|
99
|
+
/* @__PURE__ */ u("div", { className: "richtext-mb-[5px] richtext-flex richtext-w-full richtext-max-w-sm richtext-items-center richtext-gap-1.5", children: /* @__PURE__ */ u("div", { className: "richtext-relative richtext-w-full richtext-max-w-sm richtext-items-center", children: /* @__PURE__ */ u(
|
|
100
|
+
V,
|
|
101
|
+
{
|
|
102
|
+
className: "richtext-w-80",
|
|
103
|
+
onChange: (r) => w(r.target.value),
|
|
104
|
+
placeholder: "Text",
|
|
105
|
+
required: !0,
|
|
106
|
+
type: "text",
|
|
107
|
+
value: S
|
|
108
|
+
}
|
|
109
|
+
) }) }),
|
|
110
|
+
/* @__PURE__ */ T("div", { className: "richtext-my-[10px] richtext-flex richtext-items-center richtext-gap-1", children: [
|
|
111
|
+
/* @__PURE__ */ u(
|
|
112
|
+
ne,
|
|
113
|
+
{
|
|
114
|
+
checked: I,
|
|
115
|
+
onCheckedChange: (r) => {
|
|
116
|
+
M(r), e.commands.setCaseSensitive(r);
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
),
|
|
120
|
+
/* @__PURE__ */ u(B, { children: t("editor.replace.caseSensitive") })
|
|
121
|
+
] }),
|
|
122
|
+
/* @__PURE__ */ T("div", { className: "richtext-flex richtext-items-center richtext-gap-[10px]", children: [
|
|
123
|
+
/* @__PURE__ */ u(N, { className: "richtext-flex-1", onClick: U, children: t("editor.replace.dialog.text") }),
|
|
124
|
+
/* @__PURE__ */ u(N, { className: "richtext-flex-1", onClick: J, children: t("editor.replaceAll.dialog.text") })
|
|
125
|
+
] })
|
|
126
|
+
] })
|
|
127
|
+
] }) : /* @__PURE__ */ u(_, {});
|
|
128
|
+
}
|
|
129
|
+
const C = (t, e) => e(t.tr);
|
|
130
|
+
function ie(t, e, s) {
|
|
131
|
+
return RegExp(
|
|
132
|
+
e ? t.replace(/[$()*+.?[\\\]^{|}]/g, String.raw`\$&`) : t,
|
|
133
|
+
s ? "gu" : "gui"
|
|
134
|
+
);
|
|
135
|
+
}
|
|
136
|
+
function ue(t, e, s, n) {
|
|
137
|
+
const i = [], l = [];
|
|
138
|
+
let c = [], h = 0;
|
|
139
|
+
if (!e)
|
|
140
|
+
return {
|
|
141
|
+
decorationsToReturn: $.empty,
|
|
142
|
+
results: []
|
|
143
|
+
};
|
|
144
|
+
t == null || t.descendants((m, o) => {
|
|
145
|
+
m.isText ? c[h] ? c[h] = {
|
|
146
|
+
text: c[h].text + m.text,
|
|
147
|
+
pos: c[h].pos
|
|
148
|
+
} : c[h] = {
|
|
149
|
+
text: `${m.text}`,
|
|
150
|
+
pos: o
|
|
151
|
+
} : h += 1;
|
|
152
|
+
}), c = c.filter(Boolean);
|
|
153
|
+
for (const m of c) {
|
|
154
|
+
const { text: o, pos: f } = m, d = Array.from(o.matchAll(e)).filter(([x]) => x.trim());
|
|
155
|
+
for (const x of d) {
|
|
156
|
+
if (x[0] === "") break;
|
|
157
|
+
x.index !== void 0 && l.push({
|
|
158
|
+
from: f + x.index,
|
|
159
|
+
to: f + x.index + x[0].length
|
|
160
|
+
});
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
for (const [m, o] of l.entries()) {
|
|
164
|
+
const f = m === n ? `${s} ${s}-current` : s, d = Z.inline(o.from, o.to, {
|
|
165
|
+
class: f
|
|
166
|
+
});
|
|
167
|
+
i.push(d);
|
|
168
|
+
}
|
|
169
|
+
return {
|
|
170
|
+
decorationsToReturn: $.create(t, i),
|
|
171
|
+
results: l
|
|
172
|
+
};
|
|
173
|
+
}
|
|
174
|
+
function K(t, e, { state: s, dispatch: n }) {
|
|
175
|
+
if (!e[0]) return;
|
|
176
|
+
const { from: l, to: c } = e[0];
|
|
177
|
+
n && n(s.tr.insertText(t, l, c));
|
|
178
|
+
}
|
|
179
|
+
function he(t, e, s, n) {
|
|
180
|
+
const i = e + 1;
|
|
181
|
+
if (!n[i]) return null;
|
|
182
|
+
const { from: l, to: c } = n[e], h = c - l - t.length + s, { from: m, to: o } = n[i];
|
|
183
|
+
return n[i] = {
|
|
184
|
+
to: o - h,
|
|
185
|
+
from: m - h
|
|
186
|
+
}, [h, n];
|
|
187
|
+
}
|
|
188
|
+
function me(t, e, { tr: s, dispatch: n }) {
|
|
189
|
+
let i = 0, l = e.slice();
|
|
190
|
+
if (l.length !== 0) {
|
|
191
|
+
for (let c = 0; c < l.length; c += 1) {
|
|
192
|
+
const { from: h, to: m } = l[c];
|
|
193
|
+
s.insertText(t, h, m);
|
|
194
|
+
const o = he(t, c, i, l);
|
|
195
|
+
o && (i = o[0], l = o[1]);
|
|
196
|
+
}
|
|
197
|
+
n(s);
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
const xe = Q.create({
|
|
201
|
+
name: "searchAndReplace",
|
|
202
|
+
addOptions() {
|
|
203
|
+
var t;
|
|
204
|
+
return {
|
|
205
|
+
...(t = this.parent) == null ? void 0 : t.call(this),
|
|
206
|
+
searchTerm: "",
|
|
207
|
+
replaceTerm: "",
|
|
208
|
+
results: [],
|
|
209
|
+
searchResultClass: "search-result",
|
|
210
|
+
searchResultCurrentClass: "search-result-current",
|
|
211
|
+
caseSensitive: !1,
|
|
212
|
+
disableRegex: !0,
|
|
213
|
+
onChange: () => {
|
|
214
|
+
},
|
|
215
|
+
button: ({ editor: e, t: s }) => ({
|
|
216
|
+
// component: RichTextSearchAndReplace,
|
|
217
|
+
componentProps: {
|
|
218
|
+
action: () => {
|
|
219
|
+
},
|
|
220
|
+
icon: "SearchAndReplace",
|
|
221
|
+
tooltip: s("editor.searchAndReplace.tooltip"),
|
|
222
|
+
isActive: () => !0,
|
|
223
|
+
editor: e
|
|
224
|
+
}
|
|
225
|
+
})
|
|
226
|
+
};
|
|
227
|
+
},
|
|
228
|
+
addStorage() {
|
|
229
|
+
return {
|
|
230
|
+
searchTerm: "",
|
|
231
|
+
replaceTerm: "",
|
|
232
|
+
results: [],
|
|
233
|
+
lastSearchTerm: "",
|
|
234
|
+
caseSensitive: !1,
|
|
235
|
+
lastCaseSensitive: !1,
|
|
236
|
+
resultIndex: 0,
|
|
237
|
+
lastResultIndex: 0
|
|
238
|
+
};
|
|
239
|
+
},
|
|
240
|
+
addCommands() {
|
|
241
|
+
return {
|
|
242
|
+
setSearchTerm: (t) => ({ editor: e, state: s, dispatch: n }) => (e.storage.searchAndReplace.searchTerm = t, C(s, n), !1),
|
|
243
|
+
setReplaceTerm: (t) => ({ editor: e, state: s, dispatch: n }) => (e.storage.searchAndReplace.replaceTerm = t, C(s, n), !1),
|
|
244
|
+
setCaseSensitive: (t) => ({ editor: e, state: s, dispatch: n }) => (e.storage.searchAndReplace.caseSensitive = t, C(s, n), !1),
|
|
245
|
+
resetIndex: () => ({ editor: t, state: e, dispatch: s }) => (t.storage.searchAndReplace.resultIndex = 0, C(e, s), !1),
|
|
246
|
+
nextSearchResult: () => ({ editor: t }) => {
|
|
247
|
+
const { results: e, resultIndex: s } = t.storage.searchAndReplace, n = s + 1;
|
|
248
|
+
return e[n] ? t.storage.searchAndReplace.resultIndex = n : t.storage.searchAndReplace.resultIndex = 0, !1;
|
|
249
|
+
},
|
|
250
|
+
previousSearchResult: () => ({ editor: t }) => {
|
|
251
|
+
const { results: e, resultIndex: s } = t.storage.searchAndReplace, n = s - 1;
|
|
252
|
+
return e[n] ? t.storage.searchAndReplace.resultIndex = n : t.storage.searchAndReplace.resultIndex = e.length - 1, !1;
|
|
253
|
+
},
|
|
254
|
+
replace: () => ({ editor: t, state: e, dispatch: s }) => {
|
|
255
|
+
const { replaceTerm: n, results: i, resultIndex: l } = t.storage.searchAndReplace, c = i[l];
|
|
256
|
+
return c ? (K(n, [c], { state: e, dispatch: s }), t.storage.searchAndReplace.results.splice(l, 1)) : (K(n, i, { state: e, dispatch: s }), t.storage.searchAndReplace.results.shift()), C(e, s), !1;
|
|
257
|
+
},
|
|
258
|
+
replaceAll: () => ({ editor: t, tr: e, state: s, dispatch: n }) => {
|
|
259
|
+
const { replaceTerm: i, results: l } = t.storage.searchAndReplace;
|
|
260
|
+
return me(i, l, { tr: e, dispatch: n }), t.storage.searchAndReplace.resultIndex = 0, t.storage.searchAndReplace.results = [], C(s, n), !1;
|
|
261
|
+
}
|
|
262
|
+
};
|
|
263
|
+
},
|
|
264
|
+
addProseMirrorPlugins() {
|
|
265
|
+
const t = this.editor, { searchResultClass: e, disableRegex: s } = this.options, n = (c) => t.storage.searchAndReplace.lastSearchTerm = c, i = (c) => t.storage.searchAndReplace.lastCaseSensitive = c, l = (c) => t.storage.searchAndReplace.lastResultIndex = c;
|
|
266
|
+
return [
|
|
267
|
+
new X({
|
|
268
|
+
key: new Y(`richtextCustomPlugin${this.name}`),
|
|
269
|
+
state: {
|
|
270
|
+
init: () => $.empty,
|
|
271
|
+
apply({ doc: c, docChanged: h }, m) {
|
|
272
|
+
const {
|
|
273
|
+
searchTerm: o,
|
|
274
|
+
lastSearchTerm: f,
|
|
275
|
+
caseSensitive: d,
|
|
276
|
+
lastCaseSensitive: x,
|
|
277
|
+
resultIndex: A,
|
|
278
|
+
lastResultIndex: S
|
|
279
|
+
} = t.storage.searchAndReplace;
|
|
280
|
+
if (!h && f === o && x === d && S === A)
|
|
281
|
+
return m;
|
|
282
|
+
if (n(o), i(d), l(A), !o)
|
|
283
|
+
return t.storage.searchAndReplace.results = [], $.empty;
|
|
284
|
+
const { decorationsToReturn: w, results: I } = ue(
|
|
285
|
+
c,
|
|
286
|
+
ie(o, s, d),
|
|
287
|
+
e,
|
|
288
|
+
A
|
|
289
|
+
);
|
|
290
|
+
return t.storage.searchAndReplace.results = I, w;
|
|
291
|
+
}
|
|
292
|
+
},
|
|
293
|
+
props: {
|
|
294
|
+
decorations(c) {
|
|
295
|
+
return this.getState(c);
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
})
|
|
299
|
+
];
|
|
300
|
+
}
|
|
301
|
+
});
|
|
302
|
+
export {
|
|
303
|
+
Ce as RichTextSearchAndReplace,
|
|
304
|
+
xe as SearchAndReplace
|
|
305
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("./clsx-CXbNJWDD.cjs"),u=require("@tiptap/pm/state"),d=require("./index-Cs6cp0Y6.cjs"),r=require("./SlashCommandNodeView-rDJ7OjRd.cjs"),a=require("./updatePosition-Cjuj2E26.cjs"),s=require("react/jsx-runtime"),l=require("react"),m=require("./index-bVGIXhRg.cjs");function c({commandList:e}){const[,t]=r.useSignalCommandList(),{t:n}=m.useLocale();return l.useEffect(()=>{if(!(e!=null&&e.length)){const o=r.renderCommandListDefault({t:n});t(o);return}t(e)},[n,e]),s.jsx(s.Fragment,{})}const C=i.Extension.create({name:"richtextSlashCommand",priority:200,addProseMirrorPlugins(){return[d.Suggestion({pluginKey:new u.PluginKey("richtextSlashCommandPlugin"),editor:this.editor,char:"/",command:({editor:e,range:t,props:n})=>{const{view:o}=e;n.action({editor:e,range:t}),o.focus()},render:()=>{let e;return{onStart:t=>{t.clientRect&&(e=new i.ReactRenderer(r.SlashCommandNodeView,{props:t,editor:t.editor}),e.element.style.position="absolute",document.body.appendChild(e.element),a.updatePosition(t.editor,e.element))},onUpdate(t){e.updateProps(t),t.clientRect&&a.updatePosition(t.editor,e.element)},onKeyDown(t){var n;return t.event.key==="Escape"?(e.destroy(),e.element.remove(),!0):(n=e.ref)==null?void 0:n.onKeyDown(t)},onExit(){e&&(e.destroy(),e.element.remove())}}}})]}});exports.renderCommandListDefault=r.renderCommandListDefault;exports.useFilterCommandList=r.useFilterCommandList;exports.SlashCommand=C;exports.SlashCommandList=c;
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { E as i, R as a } from "./clsx-CDyrfCnw.js";
|
|
2
|
+
import { PluginKey as m } from "@tiptap/pm/state";
|
|
3
|
+
import { S as s } from "./index-CsSfYR30.js";
|
|
4
|
+
import { u, r as l, S as d } from "./SlashCommandNodeView-BcmtKbEE.js";
|
|
5
|
+
import { a as b } from "./SlashCommandNodeView-BcmtKbEE.js";
|
|
6
|
+
import { u as o } from "./updatePosition-e90ZrFWW.js";
|
|
7
|
+
import { jsx as f, Fragment as c } from "react/jsx-runtime";
|
|
8
|
+
import { useEffect as h } from "react";
|
|
9
|
+
import { u as C } from "./index-4Q5IhypJ.js";
|
|
10
|
+
function E({ commandList: e }) {
|
|
11
|
+
const [, t] = u(), { t: r } = C();
|
|
12
|
+
return h(() => {
|
|
13
|
+
if (!(e != null && e.length)) {
|
|
14
|
+
const n = l({ t: r });
|
|
15
|
+
t(n);
|
|
16
|
+
return;
|
|
17
|
+
}
|
|
18
|
+
t(e);
|
|
19
|
+
}, [r, e]), /* @__PURE__ */ f(c, {});
|
|
20
|
+
}
|
|
21
|
+
const v = /* @__PURE__ */ i.create({
|
|
22
|
+
name: "richtextSlashCommand",
|
|
23
|
+
priority: 200,
|
|
24
|
+
// addOptions() {
|
|
25
|
+
// return {
|
|
26
|
+
// suggestion: {
|
|
27
|
+
// char: '/',
|
|
28
|
+
// },
|
|
29
|
+
// };
|
|
30
|
+
// },
|
|
31
|
+
addProseMirrorPlugins() {
|
|
32
|
+
return [
|
|
33
|
+
s({
|
|
34
|
+
pluginKey: new m("richtextSlashCommandPlugin"),
|
|
35
|
+
editor: this.editor,
|
|
36
|
+
char: "/",
|
|
37
|
+
// allowSpaces: true,
|
|
38
|
+
// startOfLine: true,
|
|
39
|
+
// pluginKey: new PluginKey(`richtextCustomPlugin${this.name}`),
|
|
40
|
+
// allow: ({ state, range }) => {
|
|
41
|
+
// const $from = state.doc.resolve(range.from);
|
|
42
|
+
// const isRootDepth = $from.depth === 1;
|
|
43
|
+
// const isParagraph = $from.parent.type.name === 'paragraph';
|
|
44
|
+
// const isStartOfNode = $from.parent.textContent?.charAt(0) === '/';
|
|
45
|
+
// const isInColumn = this.editor.isActive('column');
|
|
46
|
+
// const afterContent = $from.parent.textContent?.slice(
|
|
47
|
+
// Math.max(0, $from.parent.textContent?.indexOf('/')),
|
|
48
|
+
// );
|
|
49
|
+
// const isValidAfterContent = !afterContent?.endsWith(' ');
|
|
50
|
+
// return (
|
|
51
|
+
// ((isRootDepth && isParagraph && isStartOfNode)
|
|
52
|
+
// || (isInColumn && isParagraph && isStartOfNode))
|
|
53
|
+
// && isValidAfterContent
|
|
54
|
+
// );
|
|
55
|
+
// },
|
|
56
|
+
command: ({ editor: e, range: t, props: r }) => {
|
|
57
|
+
const { view: n } = e;
|
|
58
|
+
r.action({ editor: e, range: t }), n.focus();
|
|
59
|
+
},
|
|
60
|
+
render: () => {
|
|
61
|
+
let e;
|
|
62
|
+
return {
|
|
63
|
+
onStart: (t) => {
|
|
64
|
+
t.clientRect && (e = new a(d, {
|
|
65
|
+
props: t,
|
|
66
|
+
editor: t.editor
|
|
67
|
+
}), e.element.style.position = "absolute", document.body.appendChild(e.element), o(t.editor, e.element));
|
|
68
|
+
},
|
|
69
|
+
onUpdate(t) {
|
|
70
|
+
e.updateProps(t), t.clientRect && o(t.editor, e.element);
|
|
71
|
+
},
|
|
72
|
+
onKeyDown(t) {
|
|
73
|
+
var r;
|
|
74
|
+
return t.event.key === "Escape" ? (e.destroy(), e.element.remove(), !0) : (r = e.ref) == null ? void 0 : r.onKeyDown(t);
|
|
75
|
+
},
|
|
76
|
+
onExit() {
|
|
77
|
+
e && (e.destroy(), e.element.remove());
|
|
78
|
+
}
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
})
|
|
82
|
+
];
|
|
83
|
+
}
|
|
84
|
+
});
|
|
85
|
+
export {
|
|
86
|
+
v as SlashCommand,
|
|
87
|
+
E as SlashCommandList,
|
|
88
|
+
l as renderCommandListDefault,
|
|
89
|
+
b as useFilterCommandList
|
|
90
|
+
};
|
|
@@ -0,0 +1,249 @@
|
|
|
1
|
+
import { jsx as m, jsxs as g } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as y, useState as b, useRef as v, useImperativeHandle as S, useEffect as B, Fragment as D } from "react";
|
|
3
|
+
import { E as w, v as N, L as T, c as V, I as $ } from "./index-lj3VWExo.js";
|
|
4
|
+
import "./theme.js";
|
|
5
|
+
import { H as L, u as z } from "./index-4Q5IhypJ.js";
|
|
6
|
+
import { y as q, V as G } from "./index-BG0kQamI.js";
|
|
7
|
+
function X({ t: i }) {
|
|
8
|
+
const a = [
|
|
9
|
+
{
|
|
10
|
+
name: "format",
|
|
11
|
+
title: i("editor.slash.format"),
|
|
12
|
+
commands: []
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
name: "insert",
|
|
16
|
+
title: i("editor.slash.insert"),
|
|
17
|
+
commands: []
|
|
18
|
+
}
|
|
19
|
+
];
|
|
20
|
+
return L.forEach((e) => {
|
|
21
|
+
a[0].commands.push({
|
|
22
|
+
name: `heading${e}`,
|
|
23
|
+
label: i(e === "Paragraph" ? "editor.paragraph.tooltip" : `editor.heading.h${e}.tooltip`),
|
|
24
|
+
aliases: [`h${e}`, "bt", `bt${e}`],
|
|
25
|
+
iconName: `Heading${e}`,
|
|
26
|
+
isActive: (t) => e === "Paragraph" ? !1 : t.isActive("heading", { level: e }) || !1,
|
|
27
|
+
action: ({ editor: t, range: l }) => {
|
|
28
|
+
const s = L.find(
|
|
29
|
+
(d) => t.isActive("heading", { level: d })
|
|
30
|
+
);
|
|
31
|
+
if (e === "Paragraph") {
|
|
32
|
+
s !== void 0 && s !== "Paragraph" && t.commands.toggleHeading({ level: s }), t.chain().focus().deleteRange(l).run();
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
35
|
+
if (e) {
|
|
36
|
+
t.chain().focus().deleteRange(l).setHeading({ level: e }).run();
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
t.chain().focus().deleteRange(l).run();
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
}), a[0].commands.push({
|
|
43
|
+
name: "bulletList",
|
|
44
|
+
label: i("editor.bulletlist.tooltip"),
|
|
45
|
+
aliases: ["ul", "yxlb"],
|
|
46
|
+
iconName: "List",
|
|
47
|
+
isActive: (e) => e.isActive("bulletList"),
|
|
48
|
+
action: ({ editor: e, range: t }) => {
|
|
49
|
+
e.chain().focus().deleteRange(t).toggleBulletList().run();
|
|
50
|
+
}
|
|
51
|
+
}), a[0].commands.push({
|
|
52
|
+
name: "orderedlist",
|
|
53
|
+
label: i("editor.orderedlist.tooltip"),
|
|
54
|
+
aliases: ["ol", "yxlb"],
|
|
55
|
+
iconName: "ListOrdered",
|
|
56
|
+
isActive: (e) => e.isActive("orderedList"),
|
|
57
|
+
action: ({ editor: e, range: t }) => {
|
|
58
|
+
e.chain().focus().deleteRange(t).toggleOrderedList().run();
|
|
59
|
+
}
|
|
60
|
+
}), a[0].commands.push({
|
|
61
|
+
name: "taskList",
|
|
62
|
+
label: i("editor.tasklist.tooltip"),
|
|
63
|
+
iconName: "ListTodo",
|
|
64
|
+
description: "Task list with todo items",
|
|
65
|
+
aliases: ["todo"],
|
|
66
|
+
isActive: (e) => e.isActive("taskList"),
|
|
67
|
+
action: ({ editor: e, range: t }) => {
|
|
68
|
+
e.chain().focus().deleteRange(t).toggleTaskList().run();
|
|
69
|
+
}
|
|
70
|
+
}), a[0].commands.push({
|
|
71
|
+
name: "blockquote",
|
|
72
|
+
label: i("editor.blockquote.tooltip"),
|
|
73
|
+
description: "插入引入格式",
|
|
74
|
+
aliases: ["yr"],
|
|
75
|
+
iconName: "TextQuote",
|
|
76
|
+
isActive: (e) => e.isActive("blockquote"),
|
|
77
|
+
action: ({ editor: e, range: t }) => {
|
|
78
|
+
e.chain().focus().deleteRange(t).setBlockquote().run();
|
|
79
|
+
}
|
|
80
|
+
}), a[0].commands.push({
|
|
81
|
+
name: "codeBlock",
|
|
82
|
+
label: i("editor.codeblock.tooltip"),
|
|
83
|
+
iconName: "Code2",
|
|
84
|
+
description: "Code block with syntax highlighting",
|
|
85
|
+
shouldBeHidden: (e) => e.isActive("columns"),
|
|
86
|
+
isActive: (e) => e.isActive("codeBlock"),
|
|
87
|
+
action: ({ editor: e, range: t }) => {
|
|
88
|
+
e.chain().focus().deleteRange(t).setCodeBlock().run();
|
|
89
|
+
}
|
|
90
|
+
}), a[1].commands.push({
|
|
91
|
+
name: "image",
|
|
92
|
+
label: i("editor.image.tooltip"),
|
|
93
|
+
iconName: "ImageUp",
|
|
94
|
+
description: "Insert a image",
|
|
95
|
+
aliases: ["image", "tp", "tupian"],
|
|
96
|
+
shouldBeHidden: (e) => e.isActive("columns"),
|
|
97
|
+
action: ({ editor: e, range: t }) => {
|
|
98
|
+
e.chain().focus().deleteRange(t).run();
|
|
99
|
+
const l = w.UPLOAD_IMAGE(e.id);
|
|
100
|
+
N(l, !0);
|
|
101
|
+
}
|
|
102
|
+
}), a[1].commands.push({
|
|
103
|
+
name: "video",
|
|
104
|
+
label: i("editor.video.tooltip"),
|
|
105
|
+
iconName: "Video",
|
|
106
|
+
description: "Insert a video",
|
|
107
|
+
aliases: ["video", "sp", "shipin"],
|
|
108
|
+
shouldBeHidden: (e) => e.isActive("columns"),
|
|
109
|
+
action: ({ editor: e, range: t }) => {
|
|
110
|
+
e.chain().focus().deleteRange(t).run();
|
|
111
|
+
const l = w.UPLOAD_VIDEO(e.id);
|
|
112
|
+
N(l, !0);
|
|
113
|
+
}
|
|
114
|
+
}), a[1].commands.push({
|
|
115
|
+
name: "table",
|
|
116
|
+
label: i("editor.table.tooltip"),
|
|
117
|
+
iconName: "Table",
|
|
118
|
+
description: "Insert a table",
|
|
119
|
+
aliases: ["table", "bg", "biaoge", "biao"],
|
|
120
|
+
shouldBeHidden: (e) => e.isActive("columns"),
|
|
121
|
+
action: ({ editor: e, range: t }) => {
|
|
122
|
+
e.chain().focus().deleteRange(t).insertTable({ rows: 3, cols: 3, withHeaderRow: !1 }).run();
|
|
123
|
+
}
|
|
124
|
+
}), a[1].commands.push({
|
|
125
|
+
name: "horizontalRule",
|
|
126
|
+
label: i("editor.horizontalrule.tooltip"),
|
|
127
|
+
iconName: "Minus",
|
|
128
|
+
description: "Insert a horizontal divider",
|
|
129
|
+
aliases: ["hr", "fgx", "fg"],
|
|
130
|
+
action: ({ editor: e, range: t }) => {
|
|
131
|
+
e.chain().focus().deleteRange(t).setHorizontalRule().run();
|
|
132
|
+
}
|
|
133
|
+
}), a[1].commands.push({
|
|
134
|
+
name: "columns",
|
|
135
|
+
label: i("editor.columns.tooltip"),
|
|
136
|
+
iconName: "Columns2",
|
|
137
|
+
description: "Add two column content",
|
|
138
|
+
action: ({ editor: e }) => {
|
|
139
|
+
e.chain().focus().insertColumns({ cols: 2 }).run();
|
|
140
|
+
}
|
|
141
|
+
}), a;
|
|
142
|
+
}
|
|
143
|
+
function P(i, a) {
|
|
144
|
+
return i.map((t) => ({
|
|
145
|
+
...t,
|
|
146
|
+
commands: t.commands.filter((l) => {
|
|
147
|
+
const s = l.label.toLowerCase().trim(), d = a.toLowerCase().trim();
|
|
148
|
+
if (l.aliases) {
|
|
149
|
+
const u = l.aliases.map((h) => h.toLowerCase().trim()), x = s.match(d), r = u.some((h) => h.match(d));
|
|
150
|
+
return x || r;
|
|
151
|
+
}
|
|
152
|
+
return s.match(d);
|
|
153
|
+
})
|
|
154
|
+
})).filter((t) => t.commands.length > 0);
|
|
155
|
+
}
|
|
156
|
+
const U = q([]);
|
|
157
|
+
function O() {
|
|
158
|
+
const [i, a] = G(U);
|
|
159
|
+
return [i, a];
|
|
160
|
+
}
|
|
161
|
+
function F(i, a) {
|
|
162
|
+
const [e] = O(), [t, l] = b(0), [s, d] = b(0), u = v(null), { t: x } = z(), r = P(e, i.query), h = v([]);
|
|
163
|
+
S(a, () => ({
|
|
164
|
+
onKeyDown: A
|
|
165
|
+
})), B(() => {
|
|
166
|
+
if (!u.current)
|
|
167
|
+
return;
|
|
168
|
+
const o = s * 1e3 + t, n = h.current[o];
|
|
169
|
+
n && n.scrollIntoView({
|
|
170
|
+
behavior: "smooth",
|
|
171
|
+
block: "nearest"
|
|
172
|
+
});
|
|
173
|
+
}, [t, s]);
|
|
174
|
+
function A({ event: o }) {
|
|
175
|
+
return o.key === "ArrowUp" ? (C(), !0) : o.key === "ArrowDown" ? (I(), !0) : o.key === "Enter" ? (k(), !0) : !1;
|
|
176
|
+
}
|
|
177
|
+
function C() {
|
|
178
|
+
var c;
|
|
179
|
+
if (r.length === 0)
|
|
180
|
+
return !1;
|
|
181
|
+
let o = t - 1, n = s;
|
|
182
|
+
o < 0 && (n = s - 1, o = ((c = r[n]) == null ? void 0 : c.commands.length) - 1 || 0), n < 0 && (n = r.length - 1, o = r[n].commands.length - 1), l(o), d(n);
|
|
183
|
+
}
|
|
184
|
+
function I() {
|
|
185
|
+
if (r.length === 0)
|
|
186
|
+
return !1;
|
|
187
|
+
const o = r[s].commands;
|
|
188
|
+
let n = t + 1, c = s;
|
|
189
|
+
o.length - 1 < n && (n = 0, c = s + 1), r.length - 1 < c && (c = 0), l(n), d(c);
|
|
190
|
+
}
|
|
191
|
+
function k() {
|
|
192
|
+
if (r.length === 0 || s === -1 || t === -1)
|
|
193
|
+
return !1;
|
|
194
|
+
p(s, t);
|
|
195
|
+
}
|
|
196
|
+
function p(o, n) {
|
|
197
|
+
const c = r[o].commands[n];
|
|
198
|
+
i == null || i.command(c);
|
|
199
|
+
}
|
|
200
|
+
function R(o, n) {
|
|
201
|
+
p(o, n);
|
|
202
|
+
}
|
|
203
|
+
function H(o, n, c) {
|
|
204
|
+
h.current[o * 1e3 + n] = c;
|
|
205
|
+
}
|
|
206
|
+
return /* @__PURE__ */ m(
|
|
207
|
+
"div",
|
|
208
|
+
{
|
|
209
|
+
className: "richtext-max-h-[min(80vh,24rem)] richtext-flex-wrap 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",
|
|
210
|
+
"data-richtext-portal": !0,
|
|
211
|
+
ref: u,
|
|
212
|
+
children: r != null && r.length ? /* @__PURE__ */ m("div", { className: "richtext-grid richtext-min-w-48 richtext-grid-cols-1 richtext-gap-0.5", children: r == null ? void 0 : r.map((o, n) => /* @__PURE__ */ g(D, { children: [
|
|
213
|
+
/* @__PURE__ */ m(T, { className: "richtext-mx-[4px] richtext-mb-[4px] richtext-mt-[8px] !richtext-text-[0.65rem] richtext-uppercase", children: o.title }),
|
|
214
|
+
o.commands.map((c, f) => /* @__PURE__ */ g(
|
|
215
|
+
"button",
|
|
216
|
+
{
|
|
217
|
+
onClick: () => R(n, f),
|
|
218
|
+
ref: (E) => H(n, f, E),
|
|
219
|
+
className: V(
|
|
220
|
+
"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",
|
|
221
|
+
{
|
|
222
|
+
"bg-item-active": s === n && t === f
|
|
223
|
+
}
|
|
224
|
+
),
|
|
225
|
+
children: [
|
|
226
|
+
c.iconUrl && /* @__PURE__ */ m("img", { alt: "", className: "richtext-size-6", src: c.iconUrl }),
|
|
227
|
+
c.iconName && /* @__PURE__ */ m(
|
|
228
|
+
$,
|
|
229
|
+
{
|
|
230
|
+
className: "!richtext-mr-1 !richtext-text-lg",
|
|
231
|
+
name: c.iconName
|
|
232
|
+
}
|
|
233
|
+
),
|
|
234
|
+
c.label
|
|
235
|
+
]
|
|
236
|
+
},
|
|
237
|
+
`command-${f}`
|
|
238
|
+
))
|
|
239
|
+
] }, `slash-${o.title}`)) }) : /* @__PURE__ */ m("div", { className: "richtext-p-3", children: /* @__PURE__ */ m("span", { className: "richtext-text-xs richtext-text-foreground", children: x("editor.slash.empty") }) })
|
|
240
|
+
}
|
|
241
|
+
);
|
|
242
|
+
}
|
|
243
|
+
const Y = y(F);
|
|
244
|
+
export {
|
|
245
|
+
Y as S,
|
|
246
|
+
P as a,
|
|
247
|
+
X as r,
|
|
248
|
+
O as u
|
|
249
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const d=require("react/jsx-runtime"),u=require("react"),h=require("./index-D9oM__YW.cjs");require("./theme.cjs");const b=require("./index-bVGIXhRg.cjs"),v=require("./index-NsYff_Ni.cjs");function S({t:i}){const a=[{name:"format",title:i("editor.slash.format"),commands:[]},{name:"insert",title:i("editor.slash.insert"),commands:[]}];return b.HEADINGS.forEach(e=>{a[0].commands.push({name:`heading${e}`,label:i(e==="Paragraph"?"editor.paragraph.tooltip":`editor.heading.h${e}.tooltip`),aliases:[`h${e}`,"bt",`bt${e}`],iconName:`Heading${e}`,isActive:t=>e==="Paragraph"?!1:t.isActive("heading",{level:e})||!1,action:({editor:t,range:l})=>{const s=b.HEADINGS.find(m=>t.isActive("heading",{level:m}));if(e==="Paragraph"){s!==void 0&&s!=="Paragraph"&&t.commands.toggleHeading({level:s}),t.chain().focus().deleteRange(l).run();return}if(e){t.chain().focus().deleteRange(l).setHeading({level:e}).run();return}t.chain().focus().deleteRange(l).run()}})}),a[0].commands.push({name:"bulletList",label:i("editor.bulletlist.tooltip"),aliases:["ul","yxlb"],iconName:"List",isActive:e=>e.isActive("bulletList"),action:({editor:e,range:t})=>{e.chain().focus().deleteRange(t).toggleBulletList().run()}}),a[0].commands.push({name:"orderedlist",label:i("editor.orderedlist.tooltip"),aliases:["ol","yxlb"],iconName:"ListOrdered",isActive:e=>e.isActive("orderedList"),action:({editor:e,range:t})=>{e.chain().focus().deleteRange(t).toggleOrderedList().run()}}),a[0].commands.push({name:"taskList",label:i("editor.tasklist.tooltip"),iconName:"ListTodo",description:"Task list with todo items",aliases:["todo"],isActive:e=>e.isActive("taskList"),action:({editor:e,range:t})=>{e.chain().focus().deleteRange(t).toggleTaskList().run()}}),a[0].commands.push({name:"blockquote",label:i("editor.blockquote.tooltip"),description:"插入引入格式",aliases:["yr"],iconName:"TextQuote",isActive:e=>e.isActive("blockquote"),action:({editor:e,range:t})=>{e.chain().focus().deleteRange(t).setBlockquote().run()}}),a[0].commands.push({name:"codeBlock",label:i("editor.codeblock.tooltip"),iconName:"Code2",description:"Code block with syntax highlighting",shouldBeHidden:e=>e.isActive("columns"),isActive:e=>e.isActive("codeBlock"),action:({editor:e,range:t})=>{e.chain().focus().deleteRange(t).setCodeBlock().run()}}),a[1].commands.push({name:"image",label:i("editor.image.tooltip"),iconName:"ImageUp",description:"Insert a image",aliases:["image","tp","tupian"],shouldBeHidden:e=>e.isActive("columns"),action:({editor:e,range:t})=>{e.chain().focus().deleteRange(t).run();const l=h.EVENTS.UPLOAD_IMAGE(e.id);h.emit(l,!0)}}),a[1].commands.push({name:"video",label:i("editor.video.tooltip"),iconName:"Video",description:"Insert a video",aliases:["video","sp","shipin"],shouldBeHidden:e=>e.isActive("columns"),action:({editor:e,range:t})=>{e.chain().focus().deleteRange(t).run();const l=h.EVENTS.UPLOAD_VIDEO(e.id);h.emit(l,!0)}}),a[1].commands.push({name:"table",label:i("editor.table.tooltip"),iconName:"Table",description:"Insert a table",aliases:["table","bg","biaoge","biao"],shouldBeHidden:e=>e.isActive("columns"),action:({editor:e,range:t})=>{e.chain().focus().deleteRange(t).insertTable({rows:3,cols:3,withHeaderRow:!1}).run()}}),a[1].commands.push({name:"horizontalRule",label:i("editor.horizontalrule.tooltip"),iconName:"Minus",description:"Insert a horizontal divider",aliases:["hr","fgx","fg"],action:({editor:e,range:t})=>{e.chain().focus().deleteRange(t).setHorizontalRule().run()}}),a[1].commands.push({name:"columns",label:i("editor.columns.tooltip"),iconName:"Columns2",description:"Add two column content",action:({editor:e})=>{e.chain().focus().insertColumns({cols:2}).run()}}),a}function w(i,a){return i.map(t=>({...t,commands:t.commands.filter(l=>{const s=l.label.toLowerCase().trim(),m=a.toLowerCase().trim();if(l.aliases){const f=l.aliases.map(x=>x.toLowerCase().trim()),p=s.match(m),r=f.some(x=>x.match(m));return p||r}return s.match(m)})})).filter(t=>t.commands.length>0)}const q=v.y([]);function C(){const[i,a]=v.V(q);return[i,a]}function y(i,a){const[e]=C(),[t,l]=u.useState(0),[s,m]=u.useState(0),f=u.useRef(null),{t:p}=b.useLocale(),r=w(e,i.query),x=u.useRef([]);u.useImperativeHandle(a,()=>({onKeyDown:L})),u.useEffect(()=>{if(!f.current)return;const o=s*1e3+t,n=x.current[o];n&&n.scrollIntoView({behavior:"smooth",block:"nearest"})},[t,s]);function L({event:o}){return o.key==="ArrowUp"?(A(),!0):o.key==="ArrowDown"?(I(),!0):o.key==="Enter"?(R(),!0):!1}function A(){var c;if(r.length===0)return!1;let o=t-1,n=s;o<0&&(n=s-1,o=((c=r[n])==null?void 0:c.commands.length)-1||0),n<0&&(n=r.length-1,o=r[n].commands.length-1),l(o),m(n)}function I(){if(r.length===0)return!1;const o=r[s].commands;let n=t+1,c=s;o.length-1<n&&(n=0,c=s+1),r.length-1<c&&(c=0),l(n),m(c)}function R(){if(r.length===0||s===-1||t===-1)return!1;N(s,t)}function N(o,n){const c=r[o].commands[n];i==null||i.command(c)}function k(o,n){N(o,n)}function H(o,n,c){x.current[o*1e3+n]=c}return d.jsx("div",{className:"richtext-max-h-[min(80vh,24rem)] richtext-flex-wrap 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:f,children:r!=null&&r.length?d.jsx("div",{className:"richtext-grid richtext-min-w-48 richtext-grid-cols-1 richtext-gap-0.5",children:r==null?void 0:r.map((o,n)=>d.jsxs(u.Fragment,{children:[d.jsx(h.Label,{className:"richtext-mx-[4px] richtext-mb-[4px] richtext-mt-[8px] !richtext-text-[0.65rem] richtext-uppercase",children:o.title}),o.commands.map((c,g)=>d.jsxs("button",{onClick:()=>k(n,g),ref:E=>H(n,g,E),className:h.cn("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":s===n&&t===g}),children:[c.iconUrl&&d.jsx("img",{alt:"",className:"richtext-size-6",src:c.iconUrl}),c.iconName&&d.jsx(h.IconComponent,{className:"!richtext-mr-1 !richtext-text-lg",name:c.iconName}),c.label]},`command-${g}`))]},`slash-${o.title}`))}):d.jsx("div",{className:"richtext-p-3",children:d.jsx("span",{className:"richtext-text-xs richtext-text-foreground",children:p("editor.slash.empty")})})})}const D=u.forwardRef(y);exports.SlashCommandNodeView=D;exports.renderCommandListDefault=S;exports.useFilterCommandList=w;exports.useSignalCommandList=C;
|
package/lib/Strike.cjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("./clsx-CXbNJWDD.cjs"),n=require("react/jsx-runtime"),o=require("./index-D9oM__YW.cjs");require("react");require("./theme.cjs");var m=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,h=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,S=r.Mark.create({name:"strike",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"s"},{tag:"del"},{tag:"strike"},{style:"text-decoration",consuming:!1,getAttrs:t=>t.includes("line-through")?{}:!1}]},renderHTML({HTMLAttributes:t}){return["s",r.mergeAttributes(this.options.HTMLAttributes,t),0]},markdownTokenName:"del",parseMarkdown:(t,e)=>e.applyMark("strike",e.parseInline(t.tokens||[])),renderMarkdown:(t,e)=>`~~${e.renderChildren(t)}~~`,addCommands(){return{setStrike:()=>({commands:t})=>t.setMark(this.name),toggleStrike:()=>({commands:t})=>t.toggleMark(this.name),unsetStrike:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-s":()=>this.editor.commands.toggleStrike()}},addInputRules(){return[r.markInputRule({find:m,type:this.type})]},addPasteRules(){return[r.markPasteRule({find:h,type:this.type})]}});function f(){const t=o.useButtonProps(d.name),{icon:e=void 0,tooltip:i=void 0,shortcutKeys:s=void 0,tooltipOptions:c={},action:a=void 0,isActive:l=void 0}=(t==null?void 0:t.componentProps)??{},{dataState:k,disabled:u,update:p}=o.useToggleActive(l),g=()=>{u||a&&(a(),p())};return t?n.jsx(o.ActionButton,{action:g,dataState:k,disabled:u,icon:e,shortcutKeys:s,tooltip:i,tooltipOptions:c}):n.jsx(n.Fragment,{})}const d=S.extend({addOptions(){var t;return{...(t=this.parent)==null?void 0:t.call(this),button:({editor:e,t:i,extension:s})=>({componentProps:{action:()=>e.commands.toggleStrike(),isActive:()=>e.isActive("strike")||!1,disabled:!1,icon:"Strikethrough",shortcutKeys:s.options.shortcutKeys??["shift","mod","S"],tooltip:i("editor.strike.tooltip")}})}}});exports.RichTextStrike=f;exports.Strike=d;
|