@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,1185 @@
|
|
|
1
|
+
import { jsx as x, Fragment as je, jsxs as G } from "react/jsx-runtime";
|
|
2
|
+
import { useState as Gt, useRef as me, useEffect as Ue } from "react";
|
|
3
|
+
import { h as Be, u as ze, d as We, A as Fe, I as be, q as Ke, L as Ut, j as ge, C as _e, B as pe } from "./index-lj3VWExo.js";
|
|
4
|
+
import "./theme.js";
|
|
5
|
+
import { M as Ge, e as $e, m as $t, B as Qe, C as qe, G as Je, H as Ve, I as Ye } from "./clsx-CDyrfCnw.js";
|
|
6
|
+
import { Plugin as ee, PluginKey as ne } from "@tiptap/pm/state";
|
|
7
|
+
import { u as Xe } from "./index-4Q5IhypJ.js";
|
|
8
|
+
import { P as Ze, a as tn, b as en } from "./popover-CPr9bHYn.js";
|
|
9
|
+
const nn = "aaa1rp3bb0ott3vie4c1le2ogado5udhabi7c0ademy5centure6ountant0s9o1tor4d0s1ult4e0g1ro2tna4f0l1rica5g0akhan5ency5i0g1rbus3force5tel5kdn3l0ibaba4pay4lfinanz6state5y2sace3tom5m0azon4ericanexpress7family11x2fam3ica3sterdam8nalytics7droid5quan4z2o0l2partments8p0le4q0uarelle8r0ab1mco4chi3my2pa2t0e3s0da2ia2sociates9t0hleta5torney7u0ction5di0ble3o3spost5thor3o0s4w0s2x0a2z0ure5ba0by2idu3namex4d1k2r0celona5laycard4s5efoot5gains6seball5ketball8uhaus5yern5b0c1t1va3cg1n2d1e0ats2uty4er2rlin4st0buy5t2f1g1h0arti5i0ble3d1ke2ng0o3o1z2j1lack0friday9ockbuster8g1omberg7ue3m0s1w2n0pparibas9o0ats3ehringer8fa2m1nd2o0k0ing5sch2tik2on4t1utique6x2r0adesco6idgestone9oadway5ker3ther5ussels7s1t1uild0ers6siness6y1zz3v1w1y1z0h3ca0b1fe2l0l1vinklein9m0era3p2non3petown5ital0one8r0avan4ds2e0er0s4s2sa1e1h1ino4t0ering5holic7ba1n1re3c1d1enter4o1rn3f0a1d2g1h0anel2nel4rity4se2t2eap3intai5ristmas6ome4urch5i0priani6rcle4sco3tadel4i0c2y3k1l0aims4eaning6ick2nic1que6othing5ud3ub0med6m1n1o0ach3des3ffee4llege4ogne5m0mbank4unity6pany2re3uter5sec4ndos3struction8ulting7tact3ractors9oking4l1p2rsica5untry4pon0s4rses6pa2r0edit0card4union9icket5own3s1uise0s6u0isinella9v1w1x1y0mru3ou3z2dad1nce3ta1e1ing3sun4y2clk3ds2e0al0er2s3gree4livery5l1oitte5ta3mocrat6ntal2ist5si0gn4v2hl2iamonds6et2gital5rect0ory7scount3ver5h2y2j1k1m1np2o0cs1tor4g1mains5t1wnload7rive4tv2ubai3nlop4pont4rban5vag2r2z2earth3t2c0o2deka3u0cation8e1g1mail3erck5nergy4gineer0ing9terprises10pson4quipment8r0icsson6ni3s0q1tate5t1u0rovision8s2vents5xchange6pert3osed4ress5traspace10fage2il1rwinds6th3mily4n0s2rm0ers5shion4t3edex3edback6rrari3ero6i0delity5o2lm2nal1nce1ial7re0stone6mdale6sh0ing5t0ness6j1k1lickr3ghts4r2orist4wers5y2m1o0o0d1tball6rd1ex2sale4um3undation8x2r0ee1senius7l1ogans4ntier7tr2ujitsu5n0d2rniture7tbol5yi3ga0l0lery3o1up4me0s3p1rden4y2b0iz3d0n2e0a1nt0ing5orge5f1g0ee3h1i0ft0s3ves2ing5l0ass3e1obal2o4m0ail3bh2o1x2n1odaddy5ld0point6f2o0dyear5g0le4p1t1v2p1q1r0ainger5phics5tis4een3ipe3ocery4up4s1t1u0cci3ge2ide2tars5ru3w1y2hair2mburg5ngout5us3bo2dfc0bank7ealth0care8lp1sinki6re1mes5iphop4samitsu7tachi5v2k0t2m1n1ockey4ldings5iday5medepot5goods5s0ense7nda3rse3spital5t0ing5t0els3mail5use3w2r1sbc3t1u0ghes5yatt3undai7ibm2cbc2e1u2d1e0ee3fm2kano4l1m0amat4db2mo0bilien9n0c1dustries8finiti5o2g1k1stitute6urance4e4t0ernational10uit4vestments10o1piranga7q1r0ish4s0maili5t0anbul7t0au2v3jaguar4va3cb2e0ep2tzt3welry6io2ll2m0p2nj2o0bs1urg4t1y2p0morgan6rs3uegos4niper7kaufen5ddi3e0rryhotels6properties14fh2g1h1i0a1ds2m1ndle4tchen5wi3m1n1oeln3matsu5sher5p0mg2n2r0d1ed3uokgroup8w1y0oto4z2la0caixa5mborghini8er3nd0rover6xess5salle5t0ino3robe5w0yer5b1c1ds2ease3clerc5frak4gal2o2xus4gbt3i0dl2fe0insurance9style7ghting6ke2lly3mited4o2ncoln4k2ve1ing5k1lc1p2oan0s3cker3us3l1ndon4tte1o3ve3pl0financial11r1s1t0d0a3u0ndbeck6xe1ury5v1y2ma0drid4if1son4keup4n0agement7go3p1rket0ing3s4riott5shalls7ttel5ba2c0kinsey7d1e0d0ia3et2lbourne7me1orial6n0u2rckmsd7g1h1iami3crosoft7l1ni1t2t0subishi9k1l0b1s2m0a2n1o0bi0le4da2e1i1m1nash3ey2ster5rmon3tgage6scow4to0rcycles9v0ie4p1q1r1s0d2t0n1r2u0seum3ic4v1w1x1y1z2na0b1goya4me2vy3ba2c1e0c1t0bank4flix4work5ustar5w0s2xt0direct7us4f0l2g0o2hk2i0co2ke1on3nja3ssan1y5l1o0kia3rton4w0ruz3tv4p1r0a1w2tt2u1yc2z2obi1server7ffice5kinawa6layan0group9lo3m0ega4ne1g1l0ine5oo2pen3racle3nge4g0anic5igins6saka4tsuka4t2vh3pa0ge2nasonic7ris2s1tners4s1y3y2ccw3e0t2f0izer5g1h0armacy6d1ilips5one2to0graphy6s4ysio5ics1tet2ures6d1n0g1k2oneer5zza4k1l0ace2y0station9umbing5s3m1n0c2ohl2ker3litie5rn2st3r0axi3ess3ime3o0d0uctions8f1gressive8mo2perties3y5tection8u0dential9s1t1ub2w0c2y2qa1pon3uebec3st5racing4dio4e0ad1lestate6tor2y4cipes5d0stone5umbrella9hab3ise0n3t2liance6n0t0als5pair3ort3ublican8st0aurant8view0s5xroth6ich0ardli6oh3l1o1p2o0cks3deo3gers4om3s0vp3u0gby3hr2n2w0e2yukyu6sa0arland6fe0ty4kura4le1on3msclub4ung5ndvik0coromant12ofi4p1rl2s1ve2xo3b0i1s2c0b1haeffler7midt4olarships8ol3ule3warz5ience5ot3d1e0arch3t2cure1ity6ek2lect4ner3rvices6ven3w1x0y3fr2g1h0angrila6rp3ell3ia1ksha5oes2p0ping5uji3w3i0lk2na1gles5te3j1k0i0n2y0pe4l0ing4m0art3ile4n0cf3o0ccer3ial4ftbank4ware6hu2lar2utions7ng1y2y2pa0ce3ort2t3r0l2s1t0ada2ples4r1tebank4farm7c0group6ockholm6rage3e3ream4udio2y3yle4u0cks3pplies3y2ort5rf1gery5zuki5v1watch4iss4x1y0dney4stems6z2tab1ipei4lk2obao4rget4tamotors6r2too4x0i3c0i2d0k2eam2ch0nology8l1masek5nnis4va3f1g1h0d1eater2re6iaa2ckets5enda4ps2res2ol4j0maxx4x2k0maxx5l1m0all4n1o0day3kyo3ols3p1ray3shiba5tal3urs3wn2yota3s3r0ade1ing4ining5vel0ers0insurance16ust3v2t1ube2i1nes3shu4v0s2w1z2ua1bank3s2g1k1nicom3versity8o2ol2ps2s1y1z2va0cations7na1guard7c1e0gas3ntures6risign5mögensberater2ung14sicherung10t2g1i0ajes4deo3g1king4llas4n1p1rgin4sa1ion4va1o3laanderen9n1odka3lvo3te1ing3o2yage5u2wales2mart4ter4ng0gou5tch0es6eather0channel12bcam3er2site5d0ding5ibo2r3f1hoswho6ien2ki2lliamhill9n0dows4e1ners6me2olterskluwer11odside6rk0s2ld3w2s1tc1f3xbox3erox4ihuan4n2xx2yz3yachts4hoo3maxun5ndex5e1odobashi7ga2kohama6u0tube6t1un3za0ppos4ra3ero3ip2m1one3uerich6w2", on = "ελ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", qt = "ascii", Jt = "alpha", Q = "asciinumeric", $ = "alphanumeric", Vt = "domain", Re = "emoji", sn = "scheme", rn = "slashscheme", Bt = "whitespace";
|
|
10
|
+
function an(t, n) {
|
|
11
|
+
return t in n || (n[t] = []), n[t];
|
|
12
|
+
}
|
|
13
|
+
function U(t, n, e) {
|
|
14
|
+
n[Qt] && (n[Q] = !0, n[$] = !0), n[qt] && (n[Q] = !0, n[Jt] = !0), n[Q] && (n[$] = !0), n[Jt] && (n[$] = !0), n[$] && (n[Vt] = !0), n[Re] && (n[Vt] = !0);
|
|
15
|
+
for (const i in n) {
|
|
16
|
+
const o = an(i, e);
|
|
17
|
+
o.indexOf(t) < 0 && o.push(t);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
function ln(t, n) {
|
|
21
|
+
const e = {};
|
|
22
|
+
for (const i in n)
|
|
23
|
+
n[i].indexOf(t) >= 0 && (e[i] = !0);
|
|
24
|
+
return e;
|
|
25
|
+
}
|
|
26
|
+
function R(t = null) {
|
|
27
|
+
this.j = {}, this.jr = [], this.jd = null, this.t = t;
|
|
28
|
+
}
|
|
29
|
+
R.groups = {};
|
|
30
|
+
R.prototype = {
|
|
31
|
+
accepts() {
|
|
32
|
+
return !!this.t;
|
|
33
|
+
},
|
|
34
|
+
/**
|
|
35
|
+
* Follow an existing transition from the given input to the next state.
|
|
36
|
+
* Does not mutate.
|
|
37
|
+
* @param {string} input character or token type to transition on
|
|
38
|
+
* @returns {?State<T>} the next state, if any
|
|
39
|
+
*/
|
|
40
|
+
go(t) {
|
|
41
|
+
const n = this, e = n.j[t];
|
|
42
|
+
if (e)
|
|
43
|
+
return e;
|
|
44
|
+
for (let i = 0; i < n.jr.length; i++) {
|
|
45
|
+
const o = n.jr[i][0], s = n.jr[i][1];
|
|
46
|
+
if (s && o.test(t))
|
|
47
|
+
return s;
|
|
48
|
+
}
|
|
49
|
+
return n.jd;
|
|
50
|
+
},
|
|
51
|
+
/**
|
|
52
|
+
* Whether the state has a transition for the given input. Set the second
|
|
53
|
+
* argument to true to only look for an exact match (and not a default or
|
|
54
|
+
* regular-expression-based transition)
|
|
55
|
+
* @param {string} input
|
|
56
|
+
* @param {boolean} exactOnly
|
|
57
|
+
*/
|
|
58
|
+
has(t, n = !1) {
|
|
59
|
+
return n ? t in this.j : !!this.go(t);
|
|
60
|
+
},
|
|
61
|
+
/**
|
|
62
|
+
* Short for "transition all"; create a transition from the array of items
|
|
63
|
+
* in the given list to the same final resulting state.
|
|
64
|
+
* @param {string | string[]} inputs Group of inputs to transition on
|
|
65
|
+
* @param {Transition<T> | State<T>} [next] Transition options
|
|
66
|
+
* @param {Flags} [flags] Collections flags to add token to
|
|
67
|
+
* @param {Collections<T>} [groups] Master list of token groups
|
|
68
|
+
*/
|
|
69
|
+
ta(t, n, e, i) {
|
|
70
|
+
for (let o = 0; o < t.length; o++)
|
|
71
|
+
this.tt(t[o], n, e, i);
|
|
72
|
+
},
|
|
73
|
+
/**
|
|
74
|
+
* Short for "take regexp transition"; defines a transition for this state
|
|
75
|
+
* when it encounters a token which matches the given regular expression
|
|
76
|
+
* @param {RegExp} regexp Regular expression transition (populate first)
|
|
77
|
+
* @param {T | State<T>} [next] Transition options
|
|
78
|
+
* @param {Flags} [flags] Collections flags to add token to
|
|
79
|
+
* @param {Collections<T>} [groups] Master list of token groups
|
|
80
|
+
* @returns {State<T>} taken after the given input
|
|
81
|
+
*/
|
|
82
|
+
tr(t, n, e, i) {
|
|
83
|
+
i = i || R.groups;
|
|
84
|
+
let o;
|
|
85
|
+
return n && n.j ? o = n : (o = new R(n), e && i && U(n, e, i)), this.jr.push([t, o]), o;
|
|
86
|
+
},
|
|
87
|
+
/**
|
|
88
|
+
* Short for "take transitions", will take as many sequential transitions as
|
|
89
|
+
* the length of the given input and returns the
|
|
90
|
+
* resulting final state.
|
|
91
|
+
* @param {string | string[]} input
|
|
92
|
+
* @param {T | State<T>} [next] Transition options
|
|
93
|
+
* @param {Flags} [flags] Collections flags to add token to
|
|
94
|
+
* @param {Collections<T>} [groups] Master list of token groups
|
|
95
|
+
* @returns {State<T>} taken after the given input
|
|
96
|
+
*/
|
|
97
|
+
ts(t, n, e, i) {
|
|
98
|
+
let o = this;
|
|
99
|
+
const s = t.length;
|
|
100
|
+
if (!s)
|
|
101
|
+
return o;
|
|
102
|
+
for (let a = 0; a < s - 1; a++)
|
|
103
|
+
o = o.tt(t[a]);
|
|
104
|
+
return o.tt(t[s - 1], n, e, i);
|
|
105
|
+
},
|
|
106
|
+
/**
|
|
107
|
+
* Short for "take transition", this is a method for building/working with
|
|
108
|
+
* state machines.
|
|
109
|
+
*
|
|
110
|
+
* If a state already exists for the given input, returns it.
|
|
111
|
+
*
|
|
112
|
+
* If a token is specified, that state will emit that token when reached by
|
|
113
|
+
* the linkify engine.
|
|
114
|
+
*
|
|
115
|
+
* If no state exists, it will be initialized with some default transitions
|
|
116
|
+
* that resemble existing default transitions.
|
|
117
|
+
*
|
|
118
|
+
* If a state is given for the second argument, that state will be
|
|
119
|
+
* transitioned to on the given input regardless of what that input
|
|
120
|
+
* previously did.
|
|
121
|
+
*
|
|
122
|
+
* Specify a token group flags to define groups that this token belongs to.
|
|
123
|
+
* The token will be added to corresponding entires in the given groups
|
|
124
|
+
* object.
|
|
125
|
+
*
|
|
126
|
+
* @param {string} input character, token type to transition on
|
|
127
|
+
* @param {T | State<T>} [next] Transition options
|
|
128
|
+
* @param {Flags} [flags] Collections flags to add token to
|
|
129
|
+
* @param {Collections<T>} [groups] Master list of groups
|
|
130
|
+
* @returns {State<T>} taken after the given input
|
|
131
|
+
*/
|
|
132
|
+
tt(t, n, e, i) {
|
|
133
|
+
i = i || R.groups;
|
|
134
|
+
const o = this;
|
|
135
|
+
if (n && n.j)
|
|
136
|
+
return o.j[t] = n, n;
|
|
137
|
+
const s = n;
|
|
138
|
+
let a, l = o.go(t);
|
|
139
|
+
if (l ? (a = new R(), Object.assign(a.j, l.j), a.jr.push.apply(a.jr, l.jr), a.jd = l.jd, a.t = l.t) : a = new R(), s) {
|
|
140
|
+
if (i)
|
|
141
|
+
if (a.t && typeof a.t == "string") {
|
|
142
|
+
const d = Object.assign(ln(a.t, i), e);
|
|
143
|
+
U(s, d, i);
|
|
144
|
+
} else e && U(s, e, i);
|
|
145
|
+
a.t = s;
|
|
146
|
+
}
|
|
147
|
+
return o.j[t] = a, a;
|
|
148
|
+
}
|
|
149
|
+
};
|
|
150
|
+
const f = (t, n, e, i, o) => t.ta(n, e, i, o), L = (t, n, e, i, o) => t.tr(n, e, i, o), Ee = (t, n, e, i, o) => t.ts(n, e, i, o), r = (t, n, e, i, o) => t.tt(n, e, i, o), P = "WORD", Yt = "UWORD", ye = "ASCIINUMERICAL", Oe = "ALPHANUMERICAL", Z = "LOCALHOST", Xt = "TLD", Zt = "UTLD", rt = "SCHEME", z = "SLASH_SCHEME", ie = "NUM", te = "WS", oe = "NL", q = "OPENBRACE", J = "CLOSEBRACE", at = "OPENBRACKET", lt = "CLOSEBRACKET", ct = "OPENPAREN", ut = "CLOSEPAREN", dt = "OPENANGLEBRACKET", ht = "CLOSEANGLEBRACKET", ft = "FULLWIDTHLEFTPAREN", mt = "FULLWIDTHRIGHTPAREN", gt = "LEFTCORNERBRACKET", pt = "RIGHTCORNERBRACKET", Et = "LEFTWHITECORNERBRACKET", kt = "RIGHTWHITECORNERBRACKET", At = "FULLWIDTHLESSTHAN", Lt = "FULLWIDTHGREATERTHAN", Tt = "AMPERSAND", Ct = "APOSTROPHE", xt = "ASTERISK", M = "AT", bt = "BACKSLASH", Rt = "BACKTICK", yt = "CARET", D = "COLON", se = "COMMA", Ot = "DOLLAR", S = "DOT", St = "EQUALS", re = "EXCLAMATION", O = "HYPHEN", V = "PERCENT", Nt = "PIPE", vt = "PLUS", It = "POUND", Y = "QUERY", ae = "QUOTE", Se = "FULLWIDTHMIDDLEDOT", le = "SEMI", N = "SLASH", X = "TILDE", wt = "UNDERSCORE", Ne = "EMOJI", Pt = "SYM";
|
|
151
|
+
var ve = /* @__PURE__ */ Object.freeze({
|
|
152
|
+
__proto__: null,
|
|
153
|
+
ALPHANUMERICAL: Oe,
|
|
154
|
+
AMPERSAND: Tt,
|
|
155
|
+
APOSTROPHE: Ct,
|
|
156
|
+
ASCIINUMERICAL: ye,
|
|
157
|
+
ASTERISK: xt,
|
|
158
|
+
AT: M,
|
|
159
|
+
BACKSLASH: bt,
|
|
160
|
+
BACKTICK: Rt,
|
|
161
|
+
CARET: yt,
|
|
162
|
+
CLOSEANGLEBRACKET: ht,
|
|
163
|
+
CLOSEBRACE: J,
|
|
164
|
+
CLOSEBRACKET: lt,
|
|
165
|
+
CLOSEPAREN: ut,
|
|
166
|
+
COLON: D,
|
|
167
|
+
COMMA: se,
|
|
168
|
+
DOLLAR: Ot,
|
|
169
|
+
DOT: S,
|
|
170
|
+
EMOJI: Ne,
|
|
171
|
+
EQUALS: St,
|
|
172
|
+
EXCLAMATION: re,
|
|
173
|
+
FULLWIDTHGREATERTHAN: Lt,
|
|
174
|
+
FULLWIDTHLEFTPAREN: ft,
|
|
175
|
+
FULLWIDTHLESSTHAN: At,
|
|
176
|
+
FULLWIDTHMIDDLEDOT: Se,
|
|
177
|
+
FULLWIDTHRIGHTPAREN: mt,
|
|
178
|
+
HYPHEN: O,
|
|
179
|
+
LEFTCORNERBRACKET: gt,
|
|
180
|
+
LEFTWHITECORNERBRACKET: Et,
|
|
181
|
+
LOCALHOST: Z,
|
|
182
|
+
NL: oe,
|
|
183
|
+
NUM: ie,
|
|
184
|
+
OPENANGLEBRACKET: dt,
|
|
185
|
+
OPENBRACE: q,
|
|
186
|
+
OPENBRACKET: at,
|
|
187
|
+
OPENPAREN: ct,
|
|
188
|
+
PERCENT: V,
|
|
189
|
+
PIPE: Nt,
|
|
190
|
+
PLUS: vt,
|
|
191
|
+
POUND: It,
|
|
192
|
+
QUERY: Y,
|
|
193
|
+
QUOTE: ae,
|
|
194
|
+
RIGHTCORNERBRACKET: pt,
|
|
195
|
+
RIGHTWHITECORNERBRACKET: kt,
|
|
196
|
+
SCHEME: rt,
|
|
197
|
+
SEMI: le,
|
|
198
|
+
SLASH: N,
|
|
199
|
+
SLASH_SCHEME: z,
|
|
200
|
+
SYM: Pt,
|
|
201
|
+
TILDE: X,
|
|
202
|
+
TLD: Xt,
|
|
203
|
+
UNDERSCORE: wt,
|
|
204
|
+
UTLD: Zt,
|
|
205
|
+
UWORD: Yt,
|
|
206
|
+
WORD: P,
|
|
207
|
+
WS: te
|
|
208
|
+
});
|
|
209
|
+
const I = /[a-z]/, _ = new RegExp("\\p{L}", "u"), zt = new RegExp("\\p{Emoji}", "u"), w = /\d/, Wt = /\s/, ke = "\r", Ft = `
|
|
210
|
+
`, cn = "️", un = "", Kt = "";
|
|
211
|
+
let it = null, ot = null;
|
|
212
|
+
function dn(t = []) {
|
|
213
|
+
const n = {};
|
|
214
|
+
R.groups = n;
|
|
215
|
+
const e = new R();
|
|
216
|
+
it == null && (it = Ae(nn)), ot == null && (ot = Ae(on)), r(e, "'", Ct), r(e, "{", q), r(e, "}", J), r(e, "[", at), r(e, "]", lt), r(e, "(", ct), 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, "&", Tt), r(e, "*", xt), r(e, "@", M), r(e, "`", Rt), r(e, "^", yt), r(e, ":", D), r(e, ",", se), r(e, "$", Ot), r(e, ".", S), r(e, "=", St), r(e, "!", re), r(e, "-", O), r(e, "%", V), r(e, "|", Nt), r(e, "+", vt), r(e, "#", It), r(e, "?", Y), r(e, '"', ae), r(e, "/", N), r(e, ";", le), r(e, "~", X), r(e, "_", wt), r(e, "\\", bt), r(e, "・", Se);
|
|
217
|
+
const i = L(e, w, ie, {
|
|
218
|
+
[Qt]: !0
|
|
219
|
+
});
|
|
220
|
+
L(i, w, i);
|
|
221
|
+
const o = L(i, I, ye, {
|
|
222
|
+
[Q]: !0
|
|
223
|
+
}), s = L(i, _, Oe, {
|
|
224
|
+
[$]: !0
|
|
225
|
+
}), a = L(e, I, P, {
|
|
226
|
+
[qt]: !0
|
|
227
|
+
});
|
|
228
|
+
L(a, w, o), L(a, I, a), L(o, w, o), L(o, I, o);
|
|
229
|
+
const l = L(e, _, Yt, {
|
|
230
|
+
[Jt]: !0
|
|
231
|
+
});
|
|
232
|
+
L(l, I), L(l, w, s), L(l, _, l), L(s, w, s), L(s, I), L(s, _, s);
|
|
233
|
+
const d = r(e, Ft, oe, {
|
|
234
|
+
[Bt]: !0
|
|
235
|
+
}), h = r(e, ke, te, {
|
|
236
|
+
[Bt]: !0
|
|
237
|
+
}), c = L(e, Wt, te, {
|
|
238
|
+
[Bt]: !0
|
|
239
|
+
});
|
|
240
|
+
r(e, Kt, c), r(h, Ft, d), r(h, Kt, c), L(h, Wt, c), r(c, ke), r(c, Ft), L(c, Wt, c), r(c, Kt, c);
|
|
241
|
+
const u = L(e, zt, Ne, {
|
|
242
|
+
[Re]: !0
|
|
243
|
+
});
|
|
244
|
+
r(u, "#"), L(u, zt, u), r(u, cn, u);
|
|
245
|
+
const m = r(u, un);
|
|
246
|
+
r(m, "#"), L(m, zt, u);
|
|
247
|
+
const p = [[I, a], [w, o]], b = [[I, null], [_, l], [w, s]];
|
|
248
|
+
for (let E = 0; E < it.length; E++)
|
|
249
|
+
H(e, it[E], Xt, P, p);
|
|
250
|
+
for (let E = 0; E < ot.length; E++)
|
|
251
|
+
H(e, ot[E], Zt, Yt, b);
|
|
252
|
+
U(Xt, {
|
|
253
|
+
tld: !0,
|
|
254
|
+
ascii: !0
|
|
255
|
+
}, n), U(Zt, {
|
|
256
|
+
utld: !0,
|
|
257
|
+
alpha: !0
|
|
258
|
+
}, n), H(e, "file", rt, P, p), H(e, "mailto", rt, P, p), H(e, "http", z, P, p), H(e, "https", z, P, p), H(e, "ftp", z, P, p), H(e, "ftps", z, P, p), U(rt, {
|
|
259
|
+
scheme: !0,
|
|
260
|
+
ascii: !0
|
|
261
|
+
}, n), U(z, {
|
|
262
|
+
slashscheme: !0,
|
|
263
|
+
ascii: !0
|
|
264
|
+
}, n), t = t.sort((E, T) => E[0] > T[0] ? 1 : -1);
|
|
265
|
+
for (let E = 0; E < t.length; E++) {
|
|
266
|
+
const T = t[E][0], A = t[E][1] ? {
|
|
267
|
+
[sn]: !0
|
|
268
|
+
} : {
|
|
269
|
+
[rn]: !0
|
|
270
|
+
};
|
|
271
|
+
T.indexOf("-") >= 0 ? A[Vt] = !0 : I.test(T) ? w.test(T) ? A[Q] = !0 : A[qt] = !0 : A[Qt] = !0, Ee(e, T, T, A);
|
|
272
|
+
}
|
|
273
|
+
return Ee(e, "localhost", Z, {
|
|
274
|
+
ascii: !0
|
|
275
|
+
}), e.jd = new R(Pt), {
|
|
276
|
+
start: e,
|
|
277
|
+
tokens: Object.assign({
|
|
278
|
+
groups: n
|
|
279
|
+
}, ve)
|
|
280
|
+
};
|
|
281
|
+
}
|
|
282
|
+
function Ie(t, n) {
|
|
283
|
+
const e = hn(n.replace(/[A-Z]/g, (l) => l.toLowerCase())), i = e.length, o = [];
|
|
284
|
+
let s = 0, a = 0;
|
|
285
|
+
for (; a < i; ) {
|
|
286
|
+
let l = t, d = null, h = 0, c = null, u = -1, m = -1;
|
|
287
|
+
for (; a < i && (d = l.go(e[a])); )
|
|
288
|
+
l = d, l.accepts() ? (u = 0, m = 0, c = l) : u >= 0 && (u += e[a].length, m++), h += e[a].length, s += e[a].length, a++;
|
|
289
|
+
s -= u, a -= m, h -= u, o.push({
|
|
290
|
+
t: c.t,
|
|
291
|
+
// token type/name
|
|
292
|
+
v: n.slice(s - h, s),
|
|
293
|
+
// string value
|
|
294
|
+
s: s - h,
|
|
295
|
+
// start index
|
|
296
|
+
e: s
|
|
297
|
+
// end index (excluding)
|
|
298
|
+
});
|
|
299
|
+
}
|
|
300
|
+
return o;
|
|
301
|
+
}
|
|
302
|
+
function hn(t) {
|
|
303
|
+
const n = [], e = t.length;
|
|
304
|
+
let i = 0;
|
|
305
|
+
for (; i < e; ) {
|
|
306
|
+
let o = t.charCodeAt(i), s, a = o < 55296 || o > 56319 || i + 1 === e || (s = t.charCodeAt(i + 1)) < 56320 || s > 57343 ? t[i] : t.slice(i, i + 2);
|
|
307
|
+
n.push(a), i += a.length;
|
|
308
|
+
}
|
|
309
|
+
return n;
|
|
310
|
+
}
|
|
311
|
+
function H(t, n, e, i, o) {
|
|
312
|
+
let s;
|
|
313
|
+
const a = n.length;
|
|
314
|
+
for (let l = 0; l < a - 1; l++) {
|
|
315
|
+
const d = n[l];
|
|
316
|
+
t.j[d] ? s = t.j[d] : (s = new R(i), s.jr = o.slice(), t.j[d] = s), t = s;
|
|
317
|
+
}
|
|
318
|
+
return s = new R(e), s.jr = o.slice(), t.j[n[a - 1]] = s, s;
|
|
319
|
+
}
|
|
320
|
+
function Ae(t) {
|
|
321
|
+
const n = [], e = [];
|
|
322
|
+
let i = 0, o = "0123456789";
|
|
323
|
+
for (; i < t.length; ) {
|
|
324
|
+
let s = 0;
|
|
325
|
+
for (; o.indexOf(t[i + s]) >= 0; )
|
|
326
|
+
s++;
|
|
327
|
+
if (s > 0) {
|
|
328
|
+
n.push(e.join(""));
|
|
329
|
+
for (let a = parseInt(t.substring(i, i + s), 10); a > 0; a--)
|
|
330
|
+
e.pop();
|
|
331
|
+
i += s;
|
|
332
|
+
} else
|
|
333
|
+
e.push(t[i]), i++;
|
|
334
|
+
}
|
|
335
|
+
return n;
|
|
336
|
+
}
|
|
337
|
+
const tt = {
|
|
338
|
+
defaultProtocol: "http",
|
|
339
|
+
events: null,
|
|
340
|
+
format: Le,
|
|
341
|
+
formatHref: Le,
|
|
342
|
+
nl2br: !1,
|
|
343
|
+
tagName: "a",
|
|
344
|
+
target: null,
|
|
345
|
+
rel: null,
|
|
346
|
+
validate: !0,
|
|
347
|
+
truncate: 1 / 0,
|
|
348
|
+
className: null,
|
|
349
|
+
attributes: null,
|
|
350
|
+
ignoreTags: [],
|
|
351
|
+
render: null
|
|
352
|
+
};
|
|
353
|
+
function ce(t, n = null) {
|
|
354
|
+
let e = Object.assign({}, tt);
|
|
355
|
+
t && (e = Object.assign(e, t instanceof ce ? t.o : t));
|
|
356
|
+
const i = e.ignoreTags, o = [];
|
|
357
|
+
for (let s = 0; s < i.length; s++)
|
|
358
|
+
o.push(i[s].toUpperCase());
|
|
359
|
+
this.o = e, n && (this.defaultRender = n), this.ignoreTags = o;
|
|
360
|
+
}
|
|
361
|
+
ce.prototype = {
|
|
362
|
+
o: tt,
|
|
363
|
+
/**
|
|
364
|
+
* @type string[]
|
|
365
|
+
*/
|
|
366
|
+
ignoreTags: [],
|
|
367
|
+
/**
|
|
368
|
+
* @param {IntermediateRepresentation} ir
|
|
369
|
+
* @returns {any}
|
|
370
|
+
*/
|
|
371
|
+
defaultRender(t) {
|
|
372
|
+
return t;
|
|
373
|
+
},
|
|
374
|
+
/**
|
|
375
|
+
* Returns true or false based on whether a token should be displayed as a
|
|
376
|
+
* link based on the user options.
|
|
377
|
+
* @param {MultiToken} token
|
|
378
|
+
* @returns {boolean}
|
|
379
|
+
*/
|
|
380
|
+
check(t) {
|
|
381
|
+
return this.get("validate", t.toString(), t);
|
|
382
|
+
},
|
|
383
|
+
// Private methods
|
|
384
|
+
/**
|
|
385
|
+
* Resolve an option's value based on the value of the option and the given
|
|
386
|
+
* params. If operator and token are specified and the target option is
|
|
387
|
+
* callable, automatically calls the function with the given argument.
|
|
388
|
+
* @template {keyof Opts} K
|
|
389
|
+
* @param {K} key Name of option to use
|
|
390
|
+
* @param {string} [operator] will be passed to the target option if it's a
|
|
391
|
+
* function. If not specified, RAW function value gets returned
|
|
392
|
+
* @param {MultiToken} [token] The token from linkify.tokenize
|
|
393
|
+
* @returns {Opts[K] | any}
|
|
394
|
+
*/
|
|
395
|
+
get(t, n, e) {
|
|
396
|
+
const i = n != null;
|
|
397
|
+
let o = this.o[t];
|
|
398
|
+
return o && (typeof o == "object" ? (o = e.t in o ? o[e.t] : tt[t], typeof o == "function" && i && (o = o(n, e))) : typeof o == "function" && i && (o = o(n, e.t, e)), o);
|
|
399
|
+
},
|
|
400
|
+
/**
|
|
401
|
+
* @template {keyof Opts} L
|
|
402
|
+
* @param {L} key Name of options object to use
|
|
403
|
+
* @param {string} [operator]
|
|
404
|
+
* @param {MultiToken} [token]
|
|
405
|
+
* @returns {Opts[L] | any}
|
|
406
|
+
*/
|
|
407
|
+
getObj(t, n, e) {
|
|
408
|
+
let i = this.o[t];
|
|
409
|
+
return typeof i == "function" && n != null && (i = i(n, e.t, e)), i;
|
|
410
|
+
},
|
|
411
|
+
/**
|
|
412
|
+
* Convert the given token to a rendered element that may be added to the
|
|
413
|
+
* calling-interface's DOM
|
|
414
|
+
* @param {MultiToken} token Token to render to an HTML element
|
|
415
|
+
* @returns {any} Render result; e.g., HTML string, DOM element, React
|
|
416
|
+
* Component, etc.
|
|
417
|
+
*/
|
|
418
|
+
render(t) {
|
|
419
|
+
const n = t.render(this);
|
|
420
|
+
return (this.get("render", null, t) || this.defaultRender)(n, t.t, t);
|
|
421
|
+
}
|
|
422
|
+
};
|
|
423
|
+
function Le(t) {
|
|
424
|
+
return t;
|
|
425
|
+
}
|
|
426
|
+
function we(t, n) {
|
|
427
|
+
this.t = "token", this.v = t, this.tk = n;
|
|
428
|
+
}
|
|
429
|
+
we.prototype = {
|
|
430
|
+
isLink: !1,
|
|
431
|
+
/**
|
|
432
|
+
* Return the string this token represents.
|
|
433
|
+
* @return {string}
|
|
434
|
+
*/
|
|
435
|
+
toString() {
|
|
436
|
+
return this.v;
|
|
437
|
+
},
|
|
438
|
+
/**
|
|
439
|
+
* What should the value for this token be in the `href` HTML attribute?
|
|
440
|
+
* Returns the `.toString` value by default.
|
|
441
|
+
* @param {string} [scheme]
|
|
442
|
+
* @return {string}
|
|
443
|
+
*/
|
|
444
|
+
toHref(t) {
|
|
445
|
+
return this.toString();
|
|
446
|
+
},
|
|
447
|
+
/**
|
|
448
|
+
* @param {Options} options Formatting options
|
|
449
|
+
* @returns {string}
|
|
450
|
+
*/
|
|
451
|
+
toFormattedString(t) {
|
|
452
|
+
const n = this.toString(), e = t.get("truncate", n, this), i = t.get("format", n, this);
|
|
453
|
+
return e && i.length > e ? i.substring(0, e) + "…" : i;
|
|
454
|
+
},
|
|
455
|
+
/**
|
|
456
|
+
*
|
|
457
|
+
* @param {Options} options
|
|
458
|
+
* @returns {string}
|
|
459
|
+
*/
|
|
460
|
+
toFormattedHref(t) {
|
|
461
|
+
return t.get("formatHref", this.toHref(t.get("defaultProtocol")), this);
|
|
462
|
+
},
|
|
463
|
+
/**
|
|
464
|
+
* The start index of this token in the original input string
|
|
465
|
+
* @returns {number}
|
|
466
|
+
*/
|
|
467
|
+
startIndex() {
|
|
468
|
+
return this.tk[0].s;
|
|
469
|
+
},
|
|
470
|
+
/**
|
|
471
|
+
* The end index of this token in the original input string (up to this
|
|
472
|
+
* index but not including it)
|
|
473
|
+
* @returns {number}
|
|
474
|
+
*/
|
|
475
|
+
endIndex() {
|
|
476
|
+
return this.tk[this.tk.length - 1].e;
|
|
477
|
+
},
|
|
478
|
+
/**
|
|
479
|
+
Returns an object of relevant values for this token, which includes keys
|
|
480
|
+
* type - Kind of token ('url', 'email', etc.)
|
|
481
|
+
* value - Original text
|
|
482
|
+
* href - The value that should be added to the anchor tag's href
|
|
483
|
+
attribute
|
|
484
|
+
@method toObject
|
|
485
|
+
@param {string} [protocol] `'http'` by default
|
|
486
|
+
*/
|
|
487
|
+
toObject(t = tt.defaultProtocol) {
|
|
488
|
+
return {
|
|
489
|
+
type: this.t,
|
|
490
|
+
value: this.toString(),
|
|
491
|
+
isLink: this.isLink,
|
|
492
|
+
href: this.toHref(t),
|
|
493
|
+
start: this.startIndex(),
|
|
494
|
+
end: this.endIndex()
|
|
495
|
+
};
|
|
496
|
+
},
|
|
497
|
+
/**
|
|
498
|
+
*
|
|
499
|
+
* @param {Options} options Formatting option
|
|
500
|
+
*/
|
|
501
|
+
toFormattedObject(t) {
|
|
502
|
+
return {
|
|
503
|
+
type: this.t,
|
|
504
|
+
value: this.toFormattedString(t),
|
|
505
|
+
isLink: this.isLink,
|
|
506
|
+
href: this.toFormattedHref(t),
|
|
507
|
+
start: this.startIndex(),
|
|
508
|
+
end: this.endIndex()
|
|
509
|
+
};
|
|
510
|
+
},
|
|
511
|
+
/**
|
|
512
|
+
* Whether this token should be rendered as a link according to the given options
|
|
513
|
+
* @param {Options} options
|
|
514
|
+
* @returns {boolean}
|
|
515
|
+
*/
|
|
516
|
+
validate(t) {
|
|
517
|
+
return t.get("validate", this.toString(), this);
|
|
518
|
+
},
|
|
519
|
+
/**
|
|
520
|
+
* Return an object that represents how this link should be rendered.
|
|
521
|
+
* @param {Options} options Formattinng options
|
|
522
|
+
*/
|
|
523
|
+
render(t) {
|
|
524
|
+
const n = this, e = this.toHref(t.get("defaultProtocol")), i = t.get("formatHref", e, this), o = t.get("tagName", e, n), s = 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);
|
|
525
|
+
return a.href = i, l && (a.class = l), d && (a.target = d), h && (a.rel = h), c && Object.assign(a, c), {
|
|
526
|
+
tagName: o,
|
|
527
|
+
attributes: a,
|
|
528
|
+
content: s,
|
|
529
|
+
eventListeners: u
|
|
530
|
+
};
|
|
531
|
+
}
|
|
532
|
+
};
|
|
533
|
+
function Ht(t, n) {
|
|
534
|
+
class e extends we {
|
|
535
|
+
constructor(o, s) {
|
|
536
|
+
super(o, s), this.t = t;
|
|
537
|
+
}
|
|
538
|
+
}
|
|
539
|
+
for (const i in n)
|
|
540
|
+
e.prototype[i] = n[i];
|
|
541
|
+
return e.t = t, e;
|
|
542
|
+
}
|
|
543
|
+
const Te = Ht("email", {
|
|
544
|
+
isLink: !0,
|
|
545
|
+
toHref() {
|
|
546
|
+
return "mailto:" + this.toString();
|
|
547
|
+
}
|
|
548
|
+
}), Ce = Ht("text"), fn = Ht("nl"), st = Ht("url", {
|
|
549
|
+
isLink: !0,
|
|
550
|
+
/**
|
|
551
|
+
Lowercases relevant parts of the domain and adds the protocol if
|
|
552
|
+
required. Note that this will not escape unsafe HTML characters in the
|
|
553
|
+
URL.
|
|
554
|
+
@param {string} [scheme] default scheme (e.g., 'https')
|
|
555
|
+
@return {string} the full href
|
|
556
|
+
*/
|
|
557
|
+
toHref(t = tt.defaultProtocol) {
|
|
558
|
+
return this.hasProtocol() ? this.v : `${t}://${this.v}`;
|
|
559
|
+
},
|
|
560
|
+
/**
|
|
561
|
+
* Check whether this URL token has a protocol
|
|
562
|
+
* @return {boolean}
|
|
563
|
+
*/
|
|
564
|
+
hasProtocol() {
|
|
565
|
+
const t = this.tk;
|
|
566
|
+
return t.length >= 2 && t[0].t !== Z && t[1].t === D;
|
|
567
|
+
}
|
|
568
|
+
}), y = (t) => new R(t);
|
|
569
|
+
function mn({
|
|
570
|
+
groups: t
|
|
571
|
+
}) {
|
|
572
|
+
const n = t.domain.concat([Tt, xt, M, bt, Rt, yt, Ot, St, O, ie, V, Nt, vt, It, N, Pt, X, wt]), e = [Ct, D, se, S, re, V, Y, ae, le, dt, ht, q, J, lt, at, ct, ut, ft, mt, gt, pt, Et, kt, At, Lt], i = [Tt, Ct, xt, bt, Rt, yt, Ot, St, O, q, J, V, Nt, vt, It, Y, N, Pt, X, wt], o = y(), s = r(o, X);
|
|
573
|
+
f(s, i, s), f(s, t.domain, s);
|
|
574
|
+
const a = y(), l = y(), d = y();
|
|
575
|
+
f(o, t.domain, a), f(o, t.scheme, l), f(o, t.slashscheme, d), f(a, i, s), f(a, t.domain, a);
|
|
576
|
+
const h = r(a, M);
|
|
577
|
+
r(s, M, h), r(l, M, h), r(d, M, h);
|
|
578
|
+
const c = r(s, S);
|
|
579
|
+
f(c, i, s), f(c, t.domain, s);
|
|
580
|
+
const u = y();
|
|
581
|
+
f(h, t.domain, u), f(u, t.domain, u);
|
|
582
|
+
const m = r(u, S);
|
|
583
|
+
f(m, t.domain, u);
|
|
584
|
+
const p = y(Te);
|
|
585
|
+
f(m, t.tld, p), f(m, t.utld, p), r(h, Z, p);
|
|
586
|
+
const b = r(u, O);
|
|
587
|
+
r(b, O, b), f(b, t.domain, u), f(p, t.domain, u), r(p, S, m), r(p, O, b);
|
|
588
|
+
const E = r(p, D);
|
|
589
|
+
f(E, t.numeric, Te);
|
|
590
|
+
const T = r(a, O), g = r(a, S);
|
|
591
|
+
r(T, O, T), f(T, t.domain, a), f(g, i, s), f(g, t.domain, a);
|
|
592
|
+
const A = y(st);
|
|
593
|
+
f(g, t.tld, A), f(g, t.utld, A), f(A, t.domain, a), f(A, i, s), r(A, S, g), r(A, O, T), r(A, M, h);
|
|
594
|
+
const et = r(A, D), W = y(st);
|
|
595
|
+
f(et, t.numeric, W);
|
|
596
|
+
const C = y(st), v = y();
|
|
597
|
+
f(C, n, C), f(C, e, v), f(v, n, C), f(v, e, v), r(A, N, C), r(W, N, C);
|
|
598
|
+
const F = r(l, D), Me = r(d, D), De = r(Me, N), Mt = r(De, N);
|
|
599
|
+
f(l, t.domain, a), r(l, S, g), r(l, O, T), f(d, t.domain, a), r(d, S, g), r(d, O, T), f(F, t.domain, C), r(F, N, C), r(F, Y, C), f(Mt, t.domain, C), f(Mt, n, C), r(Mt, N, C);
|
|
600
|
+
const he = [
|
|
601
|
+
[q, J],
|
|
602
|
+
// {}
|
|
603
|
+
[at, lt],
|
|
604
|
+
// []
|
|
605
|
+
[ct, ut],
|
|
606
|
+
// ()
|
|
607
|
+
[dt, ht],
|
|
608
|
+
// <>
|
|
609
|
+
[ft, mt],
|
|
610
|
+
// ()
|
|
611
|
+
[gt, pt],
|
|
612
|
+
// 「」
|
|
613
|
+
[Et, kt],
|
|
614
|
+
// 『』
|
|
615
|
+
[At, Lt]
|
|
616
|
+
// <>
|
|
617
|
+
];
|
|
618
|
+
for (let Dt = 0; Dt < he.length; Dt++) {
|
|
619
|
+
const [fe, jt] = he[Dt], nt = r(C, fe);
|
|
620
|
+
r(v, fe, nt), r(nt, jt, C);
|
|
621
|
+
const B = y(st);
|
|
622
|
+
f(nt, n, B);
|
|
623
|
+
const K = y();
|
|
624
|
+
f(nt, e), f(B, n, B), f(B, e, K), f(K, n, B), f(K, e, K), r(B, jt, C), r(K, jt, C);
|
|
625
|
+
}
|
|
626
|
+
return r(o, Z, A), r(o, oe, fn), {
|
|
627
|
+
start: o,
|
|
628
|
+
tokens: ve
|
|
629
|
+
};
|
|
630
|
+
}
|
|
631
|
+
function gn(t, n, e) {
|
|
632
|
+
let i = e.length, o = 0, s = [], a = [];
|
|
633
|
+
for (; o < i; ) {
|
|
634
|
+
let l = t, d = null, h = null, c = 0, u = null, m = -1;
|
|
635
|
+
for (; o < i && !(d = l.go(e[o].t)); )
|
|
636
|
+
a.push(e[o++]);
|
|
637
|
+
for (; o < i && (h = d || l.go(e[o].t)); )
|
|
638
|
+
d = null, l = h, l.accepts() ? (m = 0, u = l) : m >= 0 && m++, o++, c++;
|
|
639
|
+
if (m < 0)
|
|
640
|
+
o -= c, o < i && (a.push(e[o]), o++);
|
|
641
|
+
else {
|
|
642
|
+
a.length > 0 && (s.push(_t(Ce, n, a)), a = []), o -= m, c -= m;
|
|
643
|
+
const p = u.t, b = e.slice(o - c, o);
|
|
644
|
+
s.push(_t(p, n, b));
|
|
645
|
+
}
|
|
646
|
+
}
|
|
647
|
+
return a.length > 0 && s.push(_t(Ce, n, a)), s;
|
|
648
|
+
}
|
|
649
|
+
function _t(t, n, e) {
|
|
650
|
+
const i = e[0].s, o = e[e.length - 1].e, s = n.slice(i, o);
|
|
651
|
+
return new t(s, e);
|
|
652
|
+
}
|
|
653
|
+
const pn = typeof console < "u" && console && console.warn || (() => {
|
|
654
|
+
}), En = "until manual call of linkify.init(). Register all schemes and plugins before invoking linkify the first time.", k = {
|
|
655
|
+
scanner: null,
|
|
656
|
+
parser: null,
|
|
657
|
+
tokenQueue: [],
|
|
658
|
+
pluginQueue: [],
|
|
659
|
+
customSchemes: [],
|
|
660
|
+
initialized: !1
|
|
661
|
+
};
|
|
662
|
+
function kn() {
|
|
663
|
+
return R.groups = {}, k.scanner = null, k.parser = null, k.tokenQueue = [], k.pluginQueue = [], k.customSchemes = [], k.initialized = !1, k;
|
|
664
|
+
}
|
|
665
|
+
function xe(t, n = !1) {
|
|
666
|
+
if (k.initialized && pn(`linkifyjs: already initialized - will not register custom scheme "${t}" ${En}`), !/^[0-9a-z]+(-[0-9a-z]+)*$/.test(t))
|
|
667
|
+
throw new Error(`linkifyjs: incorrect scheme format.
|
|
668
|
+
1. Must only contain digits, lowercase ASCII letters or "-"
|
|
669
|
+
2. Cannot start or end with "-"
|
|
670
|
+
3. "-" cannot repeat`);
|
|
671
|
+
k.customSchemes.push([t, n]);
|
|
672
|
+
}
|
|
673
|
+
function An() {
|
|
674
|
+
k.scanner = dn(k.customSchemes);
|
|
675
|
+
for (let t = 0; t < k.tokenQueue.length; t++)
|
|
676
|
+
k.tokenQueue[t][1]({
|
|
677
|
+
scanner: k.scanner
|
|
678
|
+
});
|
|
679
|
+
k.parser = mn(k.scanner.tokens);
|
|
680
|
+
for (let t = 0; t < k.pluginQueue.length; t++)
|
|
681
|
+
k.pluginQueue[t][1]({
|
|
682
|
+
scanner: k.scanner,
|
|
683
|
+
parser: k.parser
|
|
684
|
+
});
|
|
685
|
+
return k.initialized = !0, k;
|
|
686
|
+
}
|
|
687
|
+
function ue(t) {
|
|
688
|
+
return k.initialized || An(), gn(k.parser.start, t, Ie(k.scanner.start, t));
|
|
689
|
+
}
|
|
690
|
+
ue.scan = Ie;
|
|
691
|
+
function Pe(t, n = null, e = null) {
|
|
692
|
+
if (n && typeof n == "object") {
|
|
693
|
+
if (e)
|
|
694
|
+
throw Error(`linkifyjs: Invalid link type ${n}; must be a string`);
|
|
695
|
+
e = n, n = null;
|
|
696
|
+
}
|
|
697
|
+
const i = new ce(e), o = ue(t), s = [];
|
|
698
|
+
for (let a = 0; a < o.length; a++) {
|
|
699
|
+
const l = o[a];
|
|
700
|
+
l.isLink && (!n || l.t === n) && i.check(l) && s.push(l.toFormattedObject(i));
|
|
701
|
+
}
|
|
702
|
+
return s;
|
|
703
|
+
}
|
|
704
|
+
var de = "[\0- -\u2029 ]", Ln = new RegExp(de), Tn = new RegExp(`${de}$`), Cn = new RegExp(de, "g");
|
|
705
|
+
function xn(t) {
|
|
706
|
+
return t.length === 1 ? t[0].isLink : t.length === 3 && t[1].isLink ? ["()", "[]"].includes(t[0].value + t[2].value) : !1;
|
|
707
|
+
}
|
|
708
|
+
function bn(t) {
|
|
709
|
+
return new ee({
|
|
710
|
+
key: new ne("autolink"),
|
|
711
|
+
appendTransaction: (n, e, i) => {
|
|
712
|
+
const o = n.some((h) => h.docChanged) && !e.doc.eq(i.doc), s = n.some((h) => h.getMeta("preventAutolink"));
|
|
713
|
+
if (!o || s)
|
|
714
|
+
return;
|
|
715
|
+
const { tr: a } = i, l = Qe(e.doc, [...n]);
|
|
716
|
+
if (qe(l).forEach(({ newRange: h }) => {
|
|
717
|
+
const c = Je(i.doc, h, (p) => p.isTextblock);
|
|
718
|
+
let u, m;
|
|
719
|
+
if (c.length > 1)
|
|
720
|
+
u = c[0], m = i.doc.textBetween(
|
|
721
|
+
u.pos,
|
|
722
|
+
u.pos + u.node.nodeSize,
|
|
723
|
+
void 0,
|
|
724
|
+
" "
|
|
725
|
+
);
|
|
726
|
+
else if (c.length) {
|
|
727
|
+
const p = i.doc.textBetween(h.from, h.to, " ", " ");
|
|
728
|
+
if (!Tn.test(p))
|
|
729
|
+
return;
|
|
730
|
+
u = c[0], m = i.doc.textBetween(u.pos, h.to, void 0, " ");
|
|
731
|
+
}
|
|
732
|
+
if (u && m) {
|
|
733
|
+
const p = m.split(Ln).filter(Boolean);
|
|
734
|
+
if (p.length <= 0)
|
|
735
|
+
return !1;
|
|
736
|
+
const b = p[p.length - 1], E = u.pos + m.lastIndexOf(b);
|
|
737
|
+
if (!b)
|
|
738
|
+
return !1;
|
|
739
|
+
const T = ue(b).map((g) => g.toObject(t.defaultProtocol));
|
|
740
|
+
if (!xn(T))
|
|
741
|
+
return !1;
|
|
742
|
+
T.filter((g) => g.isLink).map((g) => ({
|
|
743
|
+
...g,
|
|
744
|
+
from: E + g.start + 1,
|
|
745
|
+
to: E + g.end + 1
|
|
746
|
+
})).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) => {
|
|
747
|
+
Ve(g.from, g.to, i.doc).some((A) => A.mark.type === t.type) || a.addMark(
|
|
748
|
+
g.from,
|
|
749
|
+
g.to,
|
|
750
|
+
t.type.create({
|
|
751
|
+
href: g.href
|
|
752
|
+
})
|
|
753
|
+
);
|
|
754
|
+
});
|
|
755
|
+
}
|
|
756
|
+
}), !!a.steps.length)
|
|
757
|
+
return a;
|
|
758
|
+
}
|
|
759
|
+
});
|
|
760
|
+
}
|
|
761
|
+
function Rn(t) {
|
|
762
|
+
return new ee({
|
|
763
|
+
key: new ne("handleClickLink"),
|
|
764
|
+
props: {
|
|
765
|
+
handleClick: (n, e, i) => {
|
|
766
|
+
var o, s;
|
|
767
|
+
if (i.button !== 0 || !n.editable)
|
|
768
|
+
return !1;
|
|
769
|
+
let a = !1;
|
|
770
|
+
if (t.enableClickSelection && (a = t.editor.commands.extendMarkRange(t.type.name)), t.openOnClick) {
|
|
771
|
+
let l = null;
|
|
772
|
+
if (i.target instanceof HTMLAnchorElement)
|
|
773
|
+
l = i.target;
|
|
774
|
+
else {
|
|
775
|
+
let u = i.target;
|
|
776
|
+
const m = [];
|
|
777
|
+
for (; u.nodeName !== "DIV"; )
|
|
778
|
+
m.push(u), u = u.parentNode;
|
|
779
|
+
l = m.find((p) => p.nodeName === "A");
|
|
780
|
+
}
|
|
781
|
+
if (!l)
|
|
782
|
+
return a;
|
|
783
|
+
const d = Ye(n.state, t.type.name), h = (o = l == null ? void 0 : l.href) != null ? o : d.href, c = (s = l == null ? void 0 : l.target) != null ? s : d.target;
|
|
784
|
+
l && h && (window.open(h, c), a = !0);
|
|
785
|
+
}
|
|
786
|
+
return a;
|
|
787
|
+
}
|
|
788
|
+
}
|
|
789
|
+
});
|
|
790
|
+
}
|
|
791
|
+
function yn(t) {
|
|
792
|
+
return new ee({
|
|
793
|
+
key: new ne("handlePasteLink"),
|
|
794
|
+
props: {
|
|
795
|
+
handlePaste: (n, e, i) => {
|
|
796
|
+
const { shouldAutoLink: o } = t, { state: s } = n, { selection: a } = s, { empty: l } = a;
|
|
797
|
+
if (l)
|
|
798
|
+
return !1;
|
|
799
|
+
let d = "";
|
|
800
|
+
i.content.forEach((c) => {
|
|
801
|
+
d += c.textContent;
|
|
802
|
+
});
|
|
803
|
+
const h = Pe(d, { defaultProtocol: t.defaultProtocol }).find(
|
|
804
|
+
(c) => c.isLink && c.value === d
|
|
805
|
+
);
|
|
806
|
+
return !d || !h || o !== void 0 && !o(h.href) ? !1 : t.editor.commands.setMark(t.type, {
|
|
807
|
+
href: h.href
|
|
808
|
+
});
|
|
809
|
+
}
|
|
810
|
+
}
|
|
811
|
+
});
|
|
812
|
+
}
|
|
813
|
+
function j(t, n) {
|
|
814
|
+
const e = ["http", "https", "ftp", "ftps", "mailto", "tel", "callto", "sms", "cid", "xmpp"];
|
|
815
|
+
return n && n.forEach((i) => {
|
|
816
|
+
const o = typeof i == "string" ? i : i.scheme;
|
|
817
|
+
o && e.push(o);
|
|
818
|
+
}), !t || t.replace(Cn, "").match(
|
|
819
|
+
new RegExp(
|
|
820
|
+
// eslint-disable-next-line no-useless-escape
|
|
821
|
+
`^(?:(?:${e.join("|")}):|[^a-z]|[a-z0-9+.-]+(?:[^a-z+.-:]|$))`,
|
|
822
|
+
"i"
|
|
823
|
+
)
|
|
824
|
+
);
|
|
825
|
+
}
|
|
826
|
+
var On = Ge.create({
|
|
827
|
+
name: "link",
|
|
828
|
+
priority: 1e3,
|
|
829
|
+
keepOnSplit: !1,
|
|
830
|
+
exitable: !0,
|
|
831
|
+
onCreate() {
|
|
832
|
+
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) => {
|
|
833
|
+
if (typeof t == "string") {
|
|
834
|
+
xe(t);
|
|
835
|
+
return;
|
|
836
|
+
}
|
|
837
|
+
xe(t.scheme, t.optionalSlashes);
|
|
838
|
+
});
|
|
839
|
+
},
|
|
840
|
+
onDestroy() {
|
|
841
|
+
kn();
|
|
842
|
+
},
|
|
843
|
+
inclusive() {
|
|
844
|
+
return this.options.autolink;
|
|
845
|
+
},
|
|
846
|
+
addOptions() {
|
|
847
|
+
return {
|
|
848
|
+
openOnClick: !0,
|
|
849
|
+
enableClickSelection: !1,
|
|
850
|
+
linkOnPaste: !0,
|
|
851
|
+
autolink: !0,
|
|
852
|
+
protocols: [],
|
|
853
|
+
defaultProtocol: "http",
|
|
854
|
+
HTMLAttributes: {
|
|
855
|
+
target: "_blank",
|
|
856
|
+
rel: "noopener noreferrer nofollow",
|
|
857
|
+
class: null
|
|
858
|
+
},
|
|
859
|
+
isAllowedUri: (t, n) => !!j(t, n.protocols),
|
|
860
|
+
validate: (t) => !!t,
|
|
861
|
+
shouldAutoLink: (t) => !!t
|
|
862
|
+
};
|
|
863
|
+
},
|
|
864
|
+
addAttributes() {
|
|
865
|
+
return {
|
|
866
|
+
href: {
|
|
867
|
+
default: null,
|
|
868
|
+
parseHTML(t) {
|
|
869
|
+
return t.getAttribute("href");
|
|
870
|
+
}
|
|
871
|
+
},
|
|
872
|
+
target: {
|
|
873
|
+
default: this.options.HTMLAttributes.target
|
|
874
|
+
},
|
|
875
|
+
rel: {
|
|
876
|
+
default: this.options.HTMLAttributes.rel
|
|
877
|
+
},
|
|
878
|
+
class: {
|
|
879
|
+
default: this.options.HTMLAttributes.class
|
|
880
|
+
}
|
|
881
|
+
};
|
|
882
|
+
},
|
|
883
|
+
parseHTML() {
|
|
884
|
+
return [
|
|
885
|
+
{
|
|
886
|
+
tag: "a[href]",
|
|
887
|
+
getAttrs: (t) => {
|
|
888
|
+
const n = t.getAttribute("href");
|
|
889
|
+
return !n || !this.options.isAllowedUri(n, {
|
|
890
|
+
defaultValidate: (e) => !!j(e, this.options.protocols),
|
|
891
|
+
protocols: this.options.protocols,
|
|
892
|
+
defaultProtocol: this.options.defaultProtocol
|
|
893
|
+
}) ? !1 : null;
|
|
894
|
+
}
|
|
895
|
+
}
|
|
896
|
+
];
|
|
897
|
+
},
|
|
898
|
+
renderHTML({ HTMLAttributes: t }) {
|
|
899
|
+
return this.options.isAllowedUri(t.href, {
|
|
900
|
+
defaultValidate: (n) => !!j(n, this.options.protocols),
|
|
901
|
+
protocols: this.options.protocols,
|
|
902
|
+
defaultProtocol: this.options.defaultProtocol
|
|
903
|
+
}) ? ["a", $t(this.options.HTMLAttributes, t), 0] : ["a", $t(this.options.HTMLAttributes, { ...t, href: "" }), 0];
|
|
904
|
+
},
|
|
905
|
+
markdownTokenName: "link",
|
|
906
|
+
parseMarkdown: (t, n) => n.applyMark("link", n.parseInline(t.tokens || []), {
|
|
907
|
+
href: t.href,
|
|
908
|
+
title: t.title || null
|
|
909
|
+
}),
|
|
910
|
+
renderMarkdown: (t, n) => {
|
|
911
|
+
var e;
|
|
912
|
+
const i = ((e = t.attrs) == null ? void 0 : e.href) || "";
|
|
913
|
+
return `[${n.renderChildren(t)}](${i})`;
|
|
914
|
+
},
|
|
915
|
+
addCommands() {
|
|
916
|
+
return {
|
|
917
|
+
setLink: (t) => ({ chain: n }) => {
|
|
918
|
+
const { href: e } = t;
|
|
919
|
+
return this.options.isAllowedUri(e, {
|
|
920
|
+
defaultValidate: (i) => !!j(i, this.options.protocols),
|
|
921
|
+
protocols: this.options.protocols,
|
|
922
|
+
defaultProtocol: this.options.defaultProtocol
|
|
923
|
+
}) ? n().setMark(this.name, t).setMeta("preventAutolink", !0).run() : !1;
|
|
924
|
+
},
|
|
925
|
+
toggleLink: (t) => ({ chain: n }) => {
|
|
926
|
+
const { href: e } = t || {};
|
|
927
|
+
return e && !this.options.isAllowedUri(e, {
|
|
928
|
+
defaultValidate: (i) => !!j(i, this.options.protocols),
|
|
929
|
+
protocols: this.options.protocols,
|
|
930
|
+
defaultProtocol: this.options.defaultProtocol
|
|
931
|
+
}) ? !1 : n().toggleMark(this.name, t, { extendEmptyMarkRange: !0 }).setMeta("preventAutolink", !0).run();
|
|
932
|
+
},
|
|
933
|
+
unsetLink: () => ({ chain: t }) => t().unsetMark(this.name, { extendEmptyMarkRange: !0 }).setMeta("preventAutolink", !0).run()
|
|
934
|
+
};
|
|
935
|
+
},
|
|
936
|
+
addPasteRules() {
|
|
937
|
+
return [
|
|
938
|
+
$e({
|
|
939
|
+
find: (t) => {
|
|
940
|
+
const n = [];
|
|
941
|
+
if (t) {
|
|
942
|
+
const { protocols: e, defaultProtocol: i } = this.options, o = Pe(t).filter(
|
|
943
|
+
(s) => s.isLink && this.options.isAllowedUri(s.value, {
|
|
944
|
+
defaultValidate: (a) => !!j(a, e),
|
|
945
|
+
protocols: e,
|
|
946
|
+
defaultProtocol: i
|
|
947
|
+
})
|
|
948
|
+
);
|
|
949
|
+
o.length && o.forEach((s) => {
|
|
950
|
+
this.options.shouldAutoLink(s.value) && n.push({
|
|
951
|
+
text: s.value,
|
|
952
|
+
data: {
|
|
953
|
+
href: s.href
|
|
954
|
+
},
|
|
955
|
+
index: s.start
|
|
956
|
+
});
|
|
957
|
+
});
|
|
958
|
+
}
|
|
959
|
+
return n;
|
|
960
|
+
},
|
|
961
|
+
type: this.type,
|
|
962
|
+
getAttributes: (t) => {
|
|
963
|
+
var n;
|
|
964
|
+
return {
|
|
965
|
+
href: (n = t.data) == null ? void 0 : n.href
|
|
966
|
+
};
|
|
967
|
+
}
|
|
968
|
+
})
|
|
969
|
+
];
|
|
970
|
+
},
|
|
971
|
+
addProseMirrorPlugins() {
|
|
972
|
+
const t = [], { protocols: n, defaultProtocol: e } = this.options;
|
|
973
|
+
return this.options.autolink && t.push(
|
|
974
|
+
bn({
|
|
975
|
+
type: this.type,
|
|
976
|
+
defaultProtocol: this.options.defaultProtocol,
|
|
977
|
+
validate: (i) => this.options.isAllowedUri(i, {
|
|
978
|
+
defaultValidate: (o) => !!j(o, n),
|
|
979
|
+
protocols: n,
|
|
980
|
+
defaultProtocol: e
|
|
981
|
+
}),
|
|
982
|
+
shouldAutoLink: this.options.shouldAutoLink
|
|
983
|
+
})
|
|
984
|
+
), t.push(
|
|
985
|
+
Rn({
|
|
986
|
+
type: this.type,
|
|
987
|
+
editor: this.editor,
|
|
988
|
+
openOnClick: this.options.openOnClick === "whenNotEditable" ? !0 : this.options.openOnClick,
|
|
989
|
+
enableClickSelection: this.options.enableClickSelection
|
|
990
|
+
})
|
|
991
|
+
), this.options.linkOnPaste && t.push(
|
|
992
|
+
yn({
|
|
993
|
+
editor: this.editor,
|
|
994
|
+
defaultProtocol: this.options.defaultProtocol,
|
|
995
|
+
type: this.type,
|
|
996
|
+
shouldAutoLink: this.options.shouldAutoLink
|
|
997
|
+
})
|
|
998
|
+
), t;
|
|
999
|
+
}
|
|
1000
|
+
});
|
|
1001
|
+
function jn() {
|
|
1002
|
+
const [t, n] = Gt(!1), e = Be(), i = ze(He.name), { isActive: o, icon: s, tooltip: a, target: l, action: d } = (i == null ? void 0 : i.componentProps) ?? {}, { dataState: h, editorDisabled: c, update: u } = We(o);
|
|
1003
|
+
function m(p, b, E) {
|
|
1004
|
+
c || d && (d({ link: p, text: b, openInNewTab: E }), n(!1), u());
|
|
1005
|
+
}
|
|
1006
|
+
return i ? /* @__PURE__ */ G(Ze, { modal: !0, onOpenChange: n, open: t, children: [
|
|
1007
|
+
/* @__PURE__ */ x(
|
|
1008
|
+
tn,
|
|
1009
|
+
{
|
|
1010
|
+
asChild: !0,
|
|
1011
|
+
"data-state": h ? "on" : "off",
|
|
1012
|
+
disabled: c,
|
|
1013
|
+
children: /* @__PURE__ */ x(Fe, { dataState: h, disabled: c, tooltip: a, children: /* @__PURE__ */ x(be, { name: s }) })
|
|
1014
|
+
}
|
|
1015
|
+
),
|
|
1016
|
+
/* @__PURE__ */ x(en, { align: "start", className: "richtext-w-full", hideWhenDetached: !0, side: "bottom", children: /* @__PURE__ */ x(Sn, { editor: e, onSetLink: m, open: t, target: l }) })
|
|
1017
|
+
] }) : /* @__PURE__ */ x(je, {});
|
|
1018
|
+
}
|
|
1019
|
+
const He = /* @__PURE__ */ On.extend({
|
|
1020
|
+
inclusive: !1,
|
|
1021
|
+
parseHTML() {
|
|
1022
|
+
return [
|
|
1023
|
+
{
|
|
1024
|
+
tag: 'a[href]:not([data-type="button"]):not([href *= "javascript:" i])'
|
|
1025
|
+
}
|
|
1026
|
+
];
|
|
1027
|
+
},
|
|
1028
|
+
renderHTML({ HTMLAttributes: t }) {
|
|
1029
|
+
return [
|
|
1030
|
+
"a",
|
|
1031
|
+
$t(this.options.HTMLAttributes, t, {
|
|
1032
|
+
class: "link"
|
|
1033
|
+
}),
|
|
1034
|
+
0
|
|
1035
|
+
];
|
|
1036
|
+
},
|
|
1037
|
+
//@ts-expect-error
|
|
1038
|
+
addOptions() {
|
|
1039
|
+
var e, i;
|
|
1040
|
+
const t = ((e = this.parent) == null ? void 0 : e.call(this)) || {}, n = (i = t.HTMLAttributes) == null ? void 0 : i.target;
|
|
1041
|
+
return {
|
|
1042
|
+
...t,
|
|
1043
|
+
openOnClick: !1,
|
|
1044
|
+
button: ({ editor: o, t: s }) => ({
|
|
1045
|
+
componentProps: {
|
|
1046
|
+
action: (a) => {
|
|
1047
|
+
const { link: l, text: d, openInNewTab: h } = a;
|
|
1048
|
+
if (!l) {
|
|
1049
|
+
o.chain().extendMarkRange("link").unsetLink().run();
|
|
1050
|
+
return;
|
|
1051
|
+
}
|
|
1052
|
+
o.isActive("link") && o.chain().extendMarkRange("link").run();
|
|
1053
|
+
const { from: c } = o.state.selection, u = d.length;
|
|
1054
|
+
o.chain().insertContent({
|
|
1055
|
+
type: "text",
|
|
1056
|
+
text: d,
|
|
1057
|
+
marks: [
|
|
1058
|
+
{
|
|
1059
|
+
type: "link",
|
|
1060
|
+
attrs: {
|
|
1061
|
+
href: /^https?:\/\//i.test(l) ? l : `http://${l}`,
|
|
1062
|
+
target: n ?? (h ? "_blank" : "")
|
|
1063
|
+
}
|
|
1064
|
+
}
|
|
1065
|
+
]
|
|
1066
|
+
}).setLink({ href: l }).setTextSelection({ from: c, to: c + u }).focus().run();
|
|
1067
|
+
},
|
|
1068
|
+
isActive: () => o.isActive("link"),
|
|
1069
|
+
disabled: !o.can().setLink({ href: "" }),
|
|
1070
|
+
icon: "Link",
|
|
1071
|
+
tooltip: s("editor.link.tooltip"),
|
|
1072
|
+
target: n
|
|
1073
|
+
}
|
|
1074
|
+
})
|
|
1075
|
+
};
|
|
1076
|
+
}
|
|
1077
|
+
// addProseMirrorPlugins() {
|
|
1078
|
+
// return [
|
|
1079
|
+
// new Plugin({
|
|
1080
|
+
// key: new PluginKey(`richtextCustomPlugin${this.name}`),
|
|
1081
|
+
// props: {
|
|
1082
|
+
// handleClick: (view: EditorView, pos: number) => {
|
|
1083
|
+
// const { schema, doc, tr } = view.state;
|
|
1084
|
+
// const range = getMarkRange(doc.resolve(pos), schema.marks.link);
|
|
1085
|
+
// if (!range) {
|
|
1086
|
+
// return false;
|
|
1087
|
+
// }
|
|
1088
|
+
// // honor openOnClick setting
|
|
1089
|
+
// let mark: any = null;
|
|
1090
|
+
// doc.nodesBetween(range.from, range.to, (node) => {
|
|
1091
|
+
// mark = node.marks.find((m) => m.type === schema.marks.link);
|
|
1092
|
+
// return !mark;
|
|
1093
|
+
// });
|
|
1094
|
+
// if (this.options.openOnClick && mark?.attrs.href && pos !== range.to) {
|
|
1095
|
+
// window.open(mark.attrs.href, mark.attrs.target || '_self');
|
|
1096
|
+
// return true;
|
|
1097
|
+
// }
|
|
1098
|
+
// const $start = doc.resolve(range.from);
|
|
1099
|
+
// const $end = doc.resolve(range.to);
|
|
1100
|
+
// const transaction = tr.setSelection(
|
|
1101
|
+
// new TextSelection($start, $end)
|
|
1102
|
+
// );
|
|
1103
|
+
// view.dispatch(transaction);
|
|
1104
|
+
// },
|
|
1105
|
+
// },
|
|
1106
|
+
// }),
|
|
1107
|
+
// ];
|
|
1108
|
+
// },
|
|
1109
|
+
});
|
|
1110
|
+
function Sn(t) {
|
|
1111
|
+
const { t: n } = Xe(), [e, i] = Gt({
|
|
1112
|
+
text: "",
|
|
1113
|
+
link: ""
|
|
1114
|
+
}), [o, s] = Gt(!1), a = me(null), l = me(null), d = Ke(He.name);
|
|
1115
|
+
Ue(() => {
|
|
1116
|
+
const c = () => {
|
|
1117
|
+
var et, W, C;
|
|
1118
|
+
const { from: u, to: m, empty: p } = t.editor.state.selection, b = d == null ? void 0 : d.options;
|
|
1119
|
+
let E = "", T = "", g = (et = b == null ? void 0 : b.HTMLAttributes) == null ? void 0 : et.target;
|
|
1120
|
+
const A = t.editor.state.doc.nodeAt(u);
|
|
1121
|
+
if (A) {
|
|
1122
|
+
const v = A.marks.find((F) => F.type.name === "link");
|
|
1123
|
+
v ? (T = v.attrs.href || "", g = v.attrs.target, p ? E = A.text || "" : E = t.editor.state.doc.textBetween(u, m, " ")) : E = t.editor.state.doc.textBetween(u, m, " ");
|
|
1124
|
+
}
|
|
1125
|
+
A || (E = t.editor.state.doc.textBetween(u, m, " ")), i({ link: T, text: E }), s(t.target ? t.target === "_blank" : g === "_blank"), t.open && (E === "" ? (W = a.current) == null || W.focus() : (C = l.current) == null || C.focus());
|
|
1126
|
+
};
|
|
1127
|
+
return c(), t.editor.on("selectionUpdate", c), () => {
|
|
1128
|
+
t.editor.off("selectionUpdate", c);
|
|
1129
|
+
};
|
|
1130
|
+
}, [t.editor, d, t.open]);
|
|
1131
|
+
function h(c) {
|
|
1132
|
+
c.preventDefault(), c.stopPropagation(), t == null || t.onSetLink(e.link, e.text, o), i({ text: "", link: "" });
|
|
1133
|
+
}
|
|
1134
|
+
return /* @__PURE__ */ G("div", { className: "richtext-flex richtext-flex-col richtext-gap-2", children: [
|
|
1135
|
+
/* @__PURE__ */ x(Ut, { className: "mb-[6px]", children: n("editor.link.dialog.text") }),
|
|
1136
|
+
/* @__PURE__ */ x("div", { className: "richtext-mb-[10px] richtext-flex richtext-w-full richtext-max-w-sm richtext-items-center richtext-gap-1.5", children: /* @__PURE__ */ x("div", { className: "richtext-relative richtext-w-full richtext-max-w-sm richtext-items-center", children: /* @__PURE__ */ x(
|
|
1137
|
+
ge,
|
|
1138
|
+
{
|
|
1139
|
+
className: "richtext-w-80",
|
|
1140
|
+
onChange: (c) => i({ ...e, text: c.target.value }),
|
|
1141
|
+
placeholder: "Text",
|
|
1142
|
+
ref: a,
|
|
1143
|
+
required: !0,
|
|
1144
|
+
type: "text",
|
|
1145
|
+
value: e.text
|
|
1146
|
+
}
|
|
1147
|
+
) }) }),
|
|
1148
|
+
/* @__PURE__ */ x(Ut, { className: "mb-[6px]", children: n("editor.link.dialog.link") }),
|
|
1149
|
+
/* @__PURE__ */ x("div", { className: "richtext-flex richtext-w-full richtext-max-w-sm richtext-items-center richtext-gap-1.5", children: /* @__PURE__ */ G("div", { className: "richtext-relative richtext-w-full richtext-max-w-sm richtext-items-center", children: [
|
|
1150
|
+
/* @__PURE__ */ x(
|
|
1151
|
+
ge,
|
|
1152
|
+
{
|
|
1153
|
+
className: "richtext-pl-10",
|
|
1154
|
+
onChange: (c) => i({ ...e, link: c.target.value }),
|
|
1155
|
+
ref: l,
|
|
1156
|
+
required: !0,
|
|
1157
|
+
type: "url",
|
|
1158
|
+
value: e.link
|
|
1159
|
+
}
|
|
1160
|
+
),
|
|
1161
|
+
/* @__PURE__ */ x("span", { className: "richtext-absolute richtext-inset-y-0 richtext-start-0 richtext-flex richtext-items-center richtext-justify-center richtext-px-2", children: /* @__PURE__ */ x(be, { className: "richtext-size-5 richtext-text-muted-foreground", name: "Link" }) })
|
|
1162
|
+
] }) }),
|
|
1163
|
+
!t.target && /* @__PURE__ */ G("div", { className: "richtext-flex richtext-items-center richtext-gap-1", children: [
|
|
1164
|
+
/* @__PURE__ */ x(
|
|
1165
|
+
_e,
|
|
1166
|
+
{
|
|
1167
|
+
checked: o,
|
|
1168
|
+
onCheckedChange: (c) => {
|
|
1169
|
+
s(c);
|
|
1170
|
+
}
|
|
1171
|
+
}
|
|
1172
|
+
),
|
|
1173
|
+
/* @__PURE__ */ x(Ut, { children: n("editor.link.dialog.openInNewTab") })
|
|
1174
|
+
] }),
|
|
1175
|
+
/* @__PURE__ */ G("div", { className: "richtext-mt-2 richtext-flex richtext-items-center richtext-justify-end richtext-gap-2", children: [
|
|
1176
|
+
(t == null ? void 0 : t.onClose) && /* @__PURE__ */ x(pe, { onClick: t == null ? void 0 : t.onClose, type: "button", children: n("editor.link.dialog.button.cancel") }),
|
|
1177
|
+
/* @__PURE__ */ x(pe, { onClick: h, type: "button", children: n("editor.link.dialog.button.apply") })
|
|
1178
|
+
] })
|
|
1179
|
+
] });
|
|
1180
|
+
}
|
|
1181
|
+
export {
|
|
1182
|
+
He as L,
|
|
1183
|
+
jn as R,
|
|
1184
|
+
Sn as a
|
|
1185
|
+
};
|