reactjs-tiptap-editor 1.0.24 → 1.0.26
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/lib/{ActionMenuButton-HYlhmRvw.js → ActionMenuButton-B4KDkZ0z.js} +1 -1
- package/lib/{ActionMenuButton-B8NhVw5m.cjs → ActionMenuButton-C3Cfeza9.cjs} +1 -1
- package/lib/Attachment.cjs +1 -1
- package/lib/Attachment.js +25 -25
- package/lib/Blockquote.cjs +5 -5
- package/lib/Blockquote.js +1490 -53
- package/lib/Bold.cjs +1 -1
- package/lib/Bold.js +3 -3
- package/lib/BulletList.cjs +1 -1
- package/lib/BulletList.js +2 -2
- package/lib/Callout.cjs +1 -1
- package/lib/Callout.js +222 -8
- package/lib/Clear.cjs +1 -1
- package/lib/Clear.js +2 -2
- package/lib/Code.cjs +1 -1
- package/lib/Code.js +56 -39
- package/lib/CodeBlock.cjs +1 -1
- package/lib/CodeBlock.js +8 -4
- package/lib/CodeView.cjs +1 -1
- package/lib/CodeView.js +2 -2
- package/lib/Color.cjs +1 -1
- package/lib/Color.js +3 -3
- package/lib/Column.cjs +1 -1
- package/lib/Column.js +2 -2
- package/lib/{Drawer-Was4hxYH.cjs → Drawer-D7E9kTca.cjs} +1 -1
- package/lib/{Drawer-CaXVhxo4.js → Drawer-DA0FLHs9.js} +20 -20
- package/lib/Drawer.cjs +1 -1
- package/lib/Drawer.js +4 -4
- package/lib/Emoji.cjs +1 -1
- package/lib/Emoji.js +1644 -148
- package/lib/Excalidraw.cjs +1 -1
- package/lib/Excalidraw.js +10 -10
- package/lib/ExportPdf.cjs +1 -1
- package/lib/ExportPdf.js +2 -2
- package/lib/ExportWord.cjs +1 -1
- package/lib/ExportWord.js +2 -2
- package/lib/FontFamily.cjs +1 -1
- package/lib/FontFamily.js +5 -5
- package/lib/FontSize.cjs +1 -1
- package/lib/FontSize.js +5 -5
- package/lib/FormatPainter.cjs +1 -0
- package/lib/FormatPainter.js +133 -0
- package/lib/Heading.cjs +1 -1
- package/lib/Heading.js +15 -11
- package/lib/Highlight.cjs +1 -1
- package/lib/Highlight.js +38 -32
- package/lib/History.cjs +7 -1
- package/lib/History.js +519 -478
- package/lib/HorizontalRule.cjs +1 -1
- package/lib/HorizontalRule.js +2 -2
- package/lib/{Iframe-Bp986fj0.js → Iframe-DZ3r3QzK.js} +7 -7
- package/lib/{Iframe-BI0sq6pd.cjs → Iframe-OMVd0xa_.cjs} +1 -1
- package/lib/Iframe.cjs +1 -1
- package/lib/Iframe.js +3 -3
- package/lib/Image.cjs +1 -1
- package/lib/Image.js +6 -6
- package/lib/ImageGif.cjs +1 -1
- package/lib/ImageGif.js +35 -35
- package/lib/ImportWord.cjs +1 -1
- package/lib/ImportWord.js +15 -15
- package/lib/{Indent-FvM52kjA.cjs → Indent-QgCoonRk.cjs} +1 -1
- package/lib/{Indent-E6B8DkyN.js → Indent-kI4G-clX.js} +2 -2
- package/lib/Indent.cjs +1 -1
- package/lib/Indent.js +2 -2
- package/lib/Italic.cjs +1 -1
- package/lib/Italic.js +2 -2
- package/lib/{Katex-pzwyyiFJ.js → Katex-BPbXjcZQ.js} +6 -7
- package/lib/Katex-CUofhjB5.cjs +4 -0
- package/lib/Katex.cjs +1 -1
- package/lib/Katex.js +3 -3
- package/lib/LineHeight.cjs +1 -1
- package/lib/LineHeight.js +4 -4
- package/lib/Link.cjs +1 -1
- package/lib/Link.js +2 -2
- package/lib/{LinkEditBlock-OjN4F2rM.js → LinkEditBlock-BYWwH2_x.js} +59 -32
- package/lib/{LinkEditBlock-Cmkmp2fW.cjs → LinkEditBlock-Z7RRurvx.cjs} +2 -2
- package/lib/MarkdownPaste.cjs +1 -1
- package/lib/MarkdownPaste.js +1 -1
- package/lib/Mention.cjs +1 -1
- package/lib/Mention.js +9 -5
- package/lib/Mermaid.cjs +2 -2
- package/lib/Mermaid.js +61 -62
- package/lib/MoreMark.cjs +1 -1
- package/lib/MoreMark.js +5 -5
- package/lib/OrderedList.cjs +1 -1
- package/lib/OrderedList.js +2 -2
- package/lib/SearchAndReplace.cjs +1 -1
- package/lib/SearchAndReplace.js +14 -14
- package/lib/SlashCommand.cjs +1 -1
- package/lib/SlashCommand.js +7 -7
- package/lib/{SlashCommandNodeView-o323V8li.js → SlashCommandNodeView-C0l3Fb_3.js} +10 -10
- package/lib/{SlashCommandNodeView-DarAytvt.cjs → SlashCommandNodeView-DPPmYEjC.cjs} +1 -1
- package/lib/Strike.cjs +1 -1
- package/lib/Strike.js +2 -2
- package/lib/{Table-Clnz-i4l.cjs → Table-D5G3rfwb.cjs} +5 -5
- package/lib/{Table-CC9uNHPL.js → Table-DwseaFSD.js} +115 -97
- package/lib/Table.cjs +1 -1
- package/lib/Table.js +1 -1
- package/lib/TaskList.cjs +1 -1
- package/lib/TaskList.js +2 -2
- package/lib/TextAlign.cjs +1 -1
- package/lib/TextAlign.js +11 -11
- package/lib/TextDirection.cjs +1 -1
- package/lib/TextDirection.js +3 -3
- package/lib/TextUnderline.cjs +1 -1
- package/lib/TextUnderline.js +2 -2
- package/lib/{Twitter-BVnXL8we.js → Twitter-DP26Lkn8.js} +195 -195
- package/lib/Twitter-q4ZGZL0i.cjs +1 -0
- package/lib/Twitter.cjs +1 -1
- package/lib/Twitter.js +3 -3
- package/lib/Video.cjs +1 -1
- package/lib/Video.js +5 -5
- package/lib/bubble.cjs +6 -6
- package/lib/bubble.js +2783 -2137
- package/lib/{clsx-D6gYQn3o.cjs → clsx-DRbkQ4T7.cjs} +1 -1
- package/lib/{clsx-0OU6n9va.js → clsx-_bq4MQQ7.js} +14 -4
- package/lib/components/Bubble/RichTextBubbleCallout.d.ts +1 -1
- package/lib/components/Bubble/RichTextBubbleCodeBlock.d.ts +1 -1
- package/lib/components/Bubble/RichTextBubbleColumns.d.ts +1 -1
- package/lib/components/Bubble/RichTextBubbleDrawer.d.ts +1 -1
- package/lib/components/Bubble/RichTextBubbleExcalidraw.d.ts +1 -1
- package/lib/components/Bubble/RichTextBubbleIframe.d.ts +1 -1
- package/lib/components/Bubble/RichTextBubbleKatex.d.ts +2 -1
- package/lib/components/Bubble/RichTextBubbleLink.d.ts +1 -1
- package/lib/components/Bubble/RichTextBubbleMedia.d.ts +3 -3
- package/lib/components/Bubble/RichTextBubbleMenuDragHandle.d.ts +2 -1
- package/lib/components/Bubble/RichTextBubbleMermaid.d.ts +1 -1
- package/lib/components/Bubble/RichTextBubbleTable.d.ts +1 -1
- package/lib/components/Bubble/RichTextBubbleText.d.ts +1 -1
- package/lib/components/Bubble/RichTextBubbleTwitter.d.ts +1 -1
- package/lib/components/ColorPicker.d.ts +1 -1
- package/lib/components/ReactBus.d.ts +1 -1
- package/lib/components/RichTextProvider.d.ts +1 -1
- package/lib/components/SlashDialogTrigger/RenderDialogUploadImage.d.ts +1 -1
- package/lib/components/SlashDialogTrigger/RenderDialogUploadVideo.d.ts +1 -1
- package/lib/components/SlashDialogTrigger/SlashDialogTrigger.d.ts +2 -1
- package/lib/components/icons/Activity.d.ts +2 -1
- package/lib/components/icons/Animas.d.ts +2 -1
- package/lib/components/icons/AspectRatio.d.ts +1 -1
- package/lib/components/icons/Blockquote.d.ts +1 -1
- package/lib/components/icons/CodeView.d.ts +1 -1
- package/lib/components/icons/ColumnAddLeft.d.ts +1 -1
- package/lib/components/icons/ColumnAddRight.d.ts +1 -1
- package/lib/components/icons/DeleteColumn.d.ts +1 -1
- package/lib/components/icons/DeleteRow.d.ts +1 -1
- package/lib/components/icons/Direction.d.ts +1 -1
- package/lib/components/icons/Excalidraw.d.ts +1 -1
- package/lib/components/icons/ExportPdf.d.ts +1 -1
- package/lib/components/icons/ExportWord.d.ts +2 -1
- package/lib/components/icons/FileWordOutline.d.ts +1 -1
- package/lib/components/icons/Flag.d.ts +2 -1
- package/lib/components/icons/Food.d.ts +2 -1
- package/lib/components/icons/GIfIcon.d.ts +1 -1
- package/lib/components/icons/Html.d.ts +1 -1
- package/lib/components/icons/Icon.d.ts +1 -1
- package/lib/components/icons/IconColorFill.d.ts +1 -1
- package/lib/components/icons/IconHighlightFill.d.ts +1 -1
- package/lib/components/icons/ImportWord.d.ts +2 -1
- package/lib/components/icons/LeftToRight.d.ts +1 -1
- package/lib/components/icons/LineHeight.d.ts +1 -1
- package/lib/components/icons/MenuDown.d.ts +1 -1
- package/lib/components/icons/Mermaid.d.ts +1 -1
- package/lib/components/icons/NoFill.d.ts +1 -1
- package/lib/components/icons/Object.d.ts +2 -1
- package/lib/components/icons/RightToLeft.d.ts +1 -1
- package/lib/components/icons/SizeL.d.ts +1 -1
- package/lib/components/icons/SizeM.d.ts +1 -1
- package/lib/components/icons/SizeS.d.ts +1 -1
- package/lib/components/icons/Symbol.d.ts +2 -1
- package/lib/components/icons/Travel.d.ts +2 -1
- package/lib/components/icons/Twitter.d.ts +1 -1
- package/lib/components/ui/dialog.d.ts +2 -2
- package/lib/components/ui/dropdown-menu.d.ts +1 -1
- package/lib/components/ui/emoji-picker.d.ts +4 -4
- package/lib/components/ui/toaster.d.ts +1 -1
- package/lib/{dropdown-menu-BW2M6saA.js → dropdown-menu-BKSX4gvT.js} +1 -1
- package/lib/{dropdown-menu-BIGvxqiu.cjs → dropdown-menu-CURWpB9o.cjs} +1 -1
- package/lib/extensions/Attachment/components/NodeViewAttachment/FileIcon.d.ts +1 -1
- package/lib/extensions/Attachment/components/NodeViewAttachment/NodeViewAttachment.d.ts +1 -1
- package/lib/extensions/Attachment/components/RichTextAttachment.d.ts +1 -1
- package/lib/extensions/Blockquote/components/RichTextBlockquote.d.ts +1 -1
- package/lib/extensions/Bold/components/RichTextBold.d.ts +1 -1
- package/lib/extensions/BulletList/components/RichTextBulletList.d.ts +1 -1
- package/lib/extensions/Callout/components/NodeViewCallout/NodeViewCallout.d.ts +1 -1
- package/lib/extensions/Callout/components/RichTextCallout.d.ts +1 -1
- package/lib/extensions/Clear/components/RichTextClear.d.ts +1 -1
- package/lib/extensions/Code/components/RichTextCode.d.ts +1 -1
- package/lib/extensions/CodeBlock/components/RichTextCodeBlock.d.ts +2 -1
- package/lib/extensions/CodeView/components/RichTextCodeView.d.ts +1 -1
- package/lib/extensions/Color/components/RichTextColor.d.ts +1 -1
- package/lib/extensions/Column/components/RichTextColumn.d.ts +1 -1
- package/lib/extensions/Drawer/components/ControlDrawer/ControlDrawer.d.ts +2 -1
- package/lib/extensions/Drawer/components/ControlDrawer/icon.d.ts +27 -27
- package/lib/extensions/Drawer/components/EditDrawerBlock.d.ts +1 -1
- package/lib/extensions/Drawer/components/NodeViewDrawer/NodeViewDrawer.d.ts +2 -1
- package/lib/extensions/Drawer/components/RichTextDrawer.d.ts +1 -1
- package/lib/extensions/Emoji/components/RichTextEmoji.d.ts +2 -1
- package/lib/extensions/Excalidraw/components/NodeViewExcalidraw/NodeViewExcalidraw.d.ts +2 -1
- package/lib/extensions/Excalidraw/components/RichTextExcalidraw.d.ts +1 -1
- package/lib/extensions/ExportPdf/components/RichTextExportPdf.d.ts +1 -1
- package/lib/extensions/ExportWord/components/RichTextExportWord.d.ts +1 -1
- package/lib/extensions/FontFamily/components/RichTextFontFamily.d.ts +1 -1
- package/lib/extensions/FontSize/components/RichTextFontSize.d.ts +1 -1
- package/lib/extensions/FormatPainter/FormatPainter.d.ts +17 -0
- package/lib/extensions/FormatPainter/components/RichTextFormatPainter.d.ts +1 -0
- package/lib/extensions/FormatPainter/index.d.ts +1 -0
- package/lib/extensions/Heading/components/RichTextHeading.d.ts +1 -1
- package/lib/extensions/Highlight/components/RichTextHighlight.d.ts +2 -1
- package/lib/extensions/History/components/RichTextHistory.d.ts +3 -2
- package/lib/extensions/HorizontalRule/components/RichTextHorizontalRule.d.ts +1 -1
- package/lib/extensions/Iframe/components/IframeNodeView.d.ts +1 -1
- package/lib/extensions/Iframe/components/RichTextIframe.d.ts +1 -1
- package/lib/extensions/Image/components/ImageCropper.d.ts +2 -1
- package/lib/extensions/Image/components/ImageView.d.ts +2 -1
- package/lib/extensions/Image/components/RichTextImage.d.ts +1 -1
- package/lib/extensions/ImageGif/components/ImageGifView.d.ts +2 -1
- package/lib/extensions/ImageGif/components/RichTextImageGif.d.ts +2 -1
- package/lib/extensions/ImportWord/components/RichTextImportWord.d.ts +1 -1
- package/lib/extensions/Indent/components/RichTextIndent.d.ts +1 -1
- package/lib/extensions/Italic/components/RichTextItalic.d.ts +1 -1
- package/lib/extensions/Katex/components/KatexWrapper.d.ts +1 -1
- package/lib/extensions/Katex/components/RichTextKatex.d.ts +1 -1
- package/lib/extensions/LineHeight/components/RichTextLightHeight.d.ts +1 -1
- package/lib/extensions/Link/components/LinkEditBlock.d.ts +1 -1
- package/lib/extensions/Link/components/LinkViewBlock.d.ts +2 -1
- package/lib/extensions/Link/components/RichTextLink.d.ts +1 -1
- package/lib/extensions/Mermaid/components/NodeViewMermaid/NodeViewMermaid.d.ts +2 -1
- package/lib/extensions/Mermaid/components/RichTextMermaid.d.ts +1 -1
- package/lib/extensions/MoreMark/components/RichTextMoreMark.d.ts +1 -1
- package/lib/extensions/OrderedList/components/RichTextOrderedList.d.ts +1 -1
- package/lib/extensions/SearchAndReplace/components/RichTextSearchAndReplace.d.ts +1 -1
- package/lib/extensions/SlashCommand/components/SlashCommandList.d.ts +1 -1
- package/lib/extensions/Strike/components/RichTextStrike.d.ts +1 -1
- package/lib/extensions/Table/components/CreateTablePopover.d.ts +2 -1
- package/lib/extensions/Table/components/RichTextTable.d.ts +2 -1
- package/lib/extensions/TaskList/components/RichTextTaskList.d.ts +1 -1
- package/lib/extensions/TextAlign/components/RichTextAlign.d.ts +1 -1
- package/lib/extensions/TextDirection/components/RichTextTextDirection.d.ts +1 -1
- package/lib/extensions/TextUnderline/components/RichTextUnderline.d.ts +1 -1
- package/lib/extensions/Twitter/components/FormEditLinkTwitter.d.ts +1 -1
- package/lib/extensions/Twitter/components/NodeViewTweet.d.ts +1 -1
- package/lib/extensions/Twitter/components/RichTextTwitter.d.ts +1 -1
- package/lib/extensions/Video/components/RichTextVideo.d.ts +1 -1
- package/lib/index-BGfIcDCQ.cjs +26 -0
- package/lib/index-BaR0Brts.js +1115 -0
- package/lib/index-BgNKVyMW.cjs +2 -0
- package/lib/index-BpLw6ebr.cjs +1 -0
- package/lib/{index-BrsJsbds.js → index-C52cuQ_Y.js} +1503 -1352
- package/lib/index-CDw4Eszh.cjs +12 -0
- package/lib/{index-CUvjYuRp.cjs → index-CHVV5iY-.cjs} +1 -1
- package/lib/{index-zw-Kd38i.js → index-CJMI7Fjf.js} +1 -1
- package/lib/{index-D-Ouz0vF.js → index-DQy9iBzV.js} +1 -1
- package/lib/index-Dbm_Mans.js +1756 -0
- package/lib/{index-oj858lQO.js → index-DtyAGMbq.js} +208 -208
- package/lib/{index-BblvcbTH.js → index-Dx-Dh7KS.js} +1464 -1348
- package/lib/{index-BAb_UADw.cjs → index-SEMQrdk2.cjs} +1 -1
- package/lib/index-aujjnfSJ.cjs +1 -0
- package/lib/index.cjs +1 -1
- package/lib/index.js +12 -12
- package/lib/{jsx-runtime-CT7Pcg-t.js → jsx-runtime-DE8oVoME.js} +3 -1
- package/lib/locale-bundle.cjs +1 -1
- package/lib/locale-bundle.js +1 -1
- package/lib/locales/index.d.ts +1 -1
- package/lib/{popover-BIVHT1W9.js → popover-BB-ZDnqk.js} +1 -1
- package/lib/{popover-DoSfJsFS.cjs → popover-CrywEkBR.cjs} +1 -1
- package/lib/{renderNodeView-D--fDFov.cjs → renderNodeView-5h3-p80E.cjs} +1 -1
- package/lib/{renderNodeView-CfWJK4rG.js → renderNodeView-DoKZ4GYy.js} +2 -2
- package/lib/{separator-SRbPfmGa.cjs → separator-BGO9AZp4.cjs} +1 -1
- package/lib/{separator-b-qOPJmp.js → separator-DuuOJRQd.js} +21 -21
- package/lib/store/EditorEditableReactive.d.ts +1 -1
- package/lib/store/ThemeColorReactive.d.ts +1 -1
- package/lib/style.css +1 -1
- package/lib/types.d.ts +2 -2
- package/lib/{updatePosition-DGPtRfWN.cjs → updatePosition-B1oRJE1x.cjs} +1 -1
- package/lib/{updatePosition-BwzAsiY0.js → updatePosition-CFTYKYNJ.js} +2 -2
- package/package.json +79 -66
- package/lib/Callout-B-S2f0Qo.cjs +0 -1
- package/lib/Callout-CF7Y9yJ7.js +0 -340
- package/lib/Katex-DP6EjdKz.cjs +0 -4
- package/lib/Twitter-0kmrijjL.cjs +0 -1
- package/lib/index-BF3EVCB1.cjs +0 -2
- package/lib/index-Bcj8cyOO.cjs +0 -24
- package/lib/index-CGjT-a9h.js +0 -1377
- package/lib/index-CPTpXLfX.cjs +0 -11
- package/lib/index-CWw4s87s.cjs +0 -1
- package/lib/index-Cal5SPfB.js +0 -779
- package/lib/index-deubsx3z.cjs +0 -1
- package/lib/textarea-CpxXPky_.js +0 -20
- package/lib/textarea-DbGw9oCU.cjs +0 -1
package/lib/Excalidraw.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var z=Object.create;var M=Object.defineProperty;var P=Object.getOwnPropertyDescriptor;var V=Object.getOwnPropertyNames;var B=Object.getPrototypeOf,$=Object.prototype.hasOwnProperty;var U=(e,s,i,d)=>{if(s&&typeof s=="object"||typeof s=="function")for(let o of V(s))!$.call(e,o)&&o!==i&&M(e,o,{get:()=>s[o],enumerable:!(d=P(s,o))||d.enumerable});return e};var R=(e,s,i)=>(i=e!=null?z(B(e)):{},U(s||!e||!e.__esModule?M(i,"default",{value:e,enumerable:!0}):i,e));Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const N=require("./index-
|
|
1
|
+
"use strict";var z=Object.create;var M=Object.defineProperty;var P=Object.getOwnPropertyDescriptor;var V=Object.getOwnPropertyNames;var B=Object.getPrototypeOf,$=Object.prototype.hasOwnProperty;var U=(e,s,i,d)=>{if(s&&typeof s=="object"||typeof s=="function")for(let o of V(s))!$.call(e,o)&&o!==i&&M(e,o,{get:()=>s[o],enumerable:!(d=P(s,o))||d.enumerable});return e};var R=(e,s,i)=>(i=e!=null?z(B(e)):{},U(s||!e||!e.__esModule?M(i,"default",{value:e,enumerable:!0}):i,e));Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const N=require("./index-BGfIcDCQ.cjs"),y=require("./clsx-DRbkQ4T7.cjs"),t=require("react/jsx-runtime"),F=require("re-resizable"),r=require("react"),a=require("./index-aujjnfSJ.cjs"),v=require("./dom-dataset-BqoJhJXt.cjs"),X="_wrap_dra8y_1",Y="_renderWrap_dra8y_7",G="_handlerWrap_dra8y_30",J="_disabled_dra8y_40",T={wrap:X,renderWrap:Y,handlerWrap:G,disabled:J},K=10,Q=200,O=15,W={width:"100%",height:"100%",maxWidth:"100%"};function ee({editor:e,node:s,updateAttributes:i}){const d=r.useRef(null),o=a.useEditableEditor(),x=e.isActive(_.name),{data:p,width:c,height:A}=s.attrs,[m,I]=r.useState(null),[b,D]=r.useState(!0),[u,g]=r.useState(null),[E,S]=r.useState(100),f=r.useCallback(n=>()=>{S(h=>a.clamp(n==="minus"?h-O:h+O,K,Q))},[]);r.useEffect(()=>{let n=!1;return import("@excalidraw/excalidraw").then(h=>{n||(d.current=h.exportToSvg)}).catch(h=>!n&&g(h)).finally(()=>!n&&D(!1)),()=>{n=!0}},[p]),r.useEffect(()=>{let n=!1;return(async()=>{if(!d.current||n||b||u||!p)return;const w=await d.current(p);n||(w.setAttribute("width","100%"),w.setAttribute("height","100%"),w.setAttribute("display","block"),I(w))})(),()=>{n=!0}},[p,b,u]);const L=n=>{i({width:n.width,height:n.height})};return t.jsx(y.NodeViewWrapper,{className:y.clsx(T.wrap,{[T.active]:x,[T.disabled]:!o}),children:t.jsx(F.Resizable,{size:{width:Number.parseInt(c),height:Number.parseInt(A)},onResizeStop:(n,h,w,j)=>{L({width:Number.parseInt(c)+j.width,height:Number.parseInt(A)+j.height})},children:t.jsxs("div",{className:y.clsx(T.renderWrap,"render-wrapper"),style:{...W,overflow:"hidden"},children:[u&&t.jsx("div",{style:W,children:t.jsx("p",{children:u.message||u})}),b&&t.jsx("p",{children:"Loading..."}),!b&&!u&&m&&t.jsx("div",{dangerouslySetInnerHTML:{__html:(m==null?void 0:m.outerHTML)??""},style:{height:"100%",maxHeight:"100%",padding:24,overflow:"hidden",display:"flex",justifyContent:"center",alignItems:"center",transform:`scale(${E/100})`,transition:"all ease-in-out .3s"}}),t.jsxs("div",{className:T.handlerWrap,children:[t.jsx(a.ActionButton,{action:f("minus"),disabled:!o,icon:"ZoomOut",tooltip:"Zoom Out"}),t.jsx(a.ActionButton,{action:f("plus"),disabled:!o,icon:"ZoomIn",tooltip:"Zoom In"})]})]})})})}function te(){const e=a.useEditorInstance(),s=a.useButtonProps(_.name),i=a.useExtension(_.name),{tooltipOptions:d={},isActive:o=void 0}=(s==null?void 0:s.componentProps)??{},{editorDisabled:x}=a.useToggleActive(o),p=r.useMemo(()=>(i==null?void 0:i.options)||{},[i]),[c,A]=r.useState(null),[m,I]=r.useState({}),[b,D]=r.useState({elements:[],appState:{isLoading:!1},files:null}),[u,g]=r.useState(!1),[E,S]=r.useState(!0),[f,L]=r.useState(null),n=r.useCallback(l=>{l&&import("@excalidraw/excalidraw").then(C=>{A(C.Excalidraw)}).catch(L).finally(()=>S(!1))},[S]),h=r.useCallback(l=>{setTimeout(()=>{l.refresh()})},[]),w=r.useCallback((l,C,q)=>{I({elements:l,appState:{isLoading:!1},files:q})},[]),j=r.useCallback(()=>{if(!c){g(!1);return}e.chain().focus().setExcalidraw({data:m}).run(),g(!1)},[c,e,m,g]),k=l=>{g(!0),l!=null&&l.data&&D(l==null?void 0:l.data)},Z=a.EVENTS.EXCALIDRAW(e.id);return a.useListener(k,[Z]),r.useEffect(()=>{!E&&c&&u&&setTimeout(()=>{window.dispatchEvent(new Event("resize"))},400)},[E,c,u]),t.jsxs(a.Dialog,{onOpenChange:g,open:u,children:[t.jsx(a.DialogTrigger,{asChild:!0,children:t.jsx(a.ActionButton,{disabled:x,icon:"Excalidraw",tooltip:"Excalidraw",tooltipOptions:d,action:()=>{x||g(!0)}})}),t.jsxs(a.DialogContent,{className:"richtext-z-[99999] !richtext-max-w-[1300px]",children:[t.jsx(a.DialogTitle,{children:"Excalidraw"}),t.jsxs("div",{style:{height:"100%",borderWidth:1},children:[E&&t.jsx("p",{children:"Loading..."}),f&&t.jsx("p",{children:f&&f.message||"Error"}),t.jsx("div",{ref:n,style:{width:"100%",height:600},children:!E&&!f&&c?t.jsx(c,{initialData:b,langCode:"en",onChange:w,ref:h,...p.excalidrawProps}):null})]}),t.jsx(a.DialogFooter,{children:t.jsx(a.Button,{disabled:!c,onClick:j,type:"button",children:"Save changes"})})]})]})}const H={elements:[]},_=N.Node3.create({name:"excalidraw",group:"block",selectable:!0,atom:!0,draggable:!0,inline:!1,addAttributes(){return{defaultShowPicker:{default:!1},createUser:{default:null},width:{default:"100%",parseHTML:v.getDatasetAttribute("width")},height:{default:240,parseHTML:v.getDatasetAttribute("height")},data:{default:H,parseHTML:v.getDatasetAttribute("data",!0)}}},addOptions(){var e;return{...(e=this.parent)==null?void 0:e.call(this),HTMLAttributes:{class:"excalidraw"},excalidrawProps:{},button:()=>({componentProps:{}})}},parseHTML(){return[{tag:"div[class=excalidraw]"}]},renderHTML({HTMLAttributes:e,node:s}){return["div",N.mergeAttributes(this.options.HTMLAttributes,e,v.nodeAttrsToDataset(s))]},addCommands(){return{setExcalidraw:e=>({tr:s,commands:i,chain:d})=>{var o,x,p;return e=e||{},e.data=e.data||H,((p=(x=(o=s.selection)==null?void 0:o.node)==null?void 0:x.type)==null?void 0:p.name)==this.name?i.updateAttributes(this.name,e):d().insertContent({type:this.name,attrs:e}).run()}}},addNodeView(){return y.ReactNodeViewRenderer(ee)},addInputRules(){return[N.nodeInputRule({find:/^\$excalidraw\$$/,type:this.type,getAttributes:()=>({width:"100%"})})]}});exports.Excalidraw=_;exports.RichTextExcalidraw=te;
|
package/lib/Excalidraw.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { N as k, n as $, m as
|
|
2
|
-
import { N as
|
|
1
|
+
import { N as k, n as $, m as j } from "./index-Dx-Dh7KS.js";
|
|
2
|
+
import { N as B, c as R, a as U } from "./clsx-_bq4MQQ7.js";
|
|
3
3
|
import { jsx as t, jsxs as T } from "react/jsx-runtime";
|
|
4
4
|
import { Resizable as F } from "re-resizable";
|
|
5
|
-
import { useRef as X, useState as o, useCallback as v, useEffect as M, useMemo as
|
|
6
|
-
import {
|
|
5
|
+
import { useRef as X, useState as o, useCallback as v, useEffect as M, useMemo as K } from "react";
|
|
6
|
+
import { j as Y, F as q, A as S, h as G, u as J, w as Q, d as ee, K as te, N as re, D as ae, n as ne, o as ie, p as se, v as oe, B as le } from "./index-C52cuQ_Y.js";
|
|
7
7
|
import { n as de, g as D } from "./dom-dataset-CIEeltF6.js";
|
|
8
8
|
const ce = "_wrap_dra8y_1", ue = "_renderWrap_dra8y_7", he = "_handlerWrap_dra8y_30", pe = "_disabled_dra8y_40", x = {
|
|
9
9
|
wrap: ce,
|
|
@@ -12,9 +12,9 @@ const ce = "_wrap_dra8y_1", ue = "_renderWrap_dra8y_7", he = "_handlerWrap_dra8y
|
|
|
12
12
|
disabled: pe
|
|
13
13
|
}, me = 10, ge = 200, W = 15, H = { width: "100%", height: "100%", maxWidth: "100%" };
|
|
14
14
|
function fe({ editor: e, node: l, updateAttributes: c }) {
|
|
15
|
-
const p = X(null), u =
|
|
15
|
+
const p = X(null), u = Y(), m = e.isActive(C.name), { data: d, width: n, height: A } = l.attrs, [g, N] = o(null), [b, I] = o(!0), [i, h] = o(null), [E, y] = o(100), f = v((r) => () => {
|
|
16
16
|
y(
|
|
17
|
-
(s) =>
|
|
17
|
+
(s) => q(
|
|
18
18
|
r === "minus" ? s - W : s + W,
|
|
19
19
|
me,
|
|
20
20
|
ge
|
|
@@ -42,7 +42,7 @@ function fe({ editor: e, node: l, updateAttributes: c }) {
|
|
|
42
42
|
c({ width: r.width, height: r.height });
|
|
43
43
|
};
|
|
44
44
|
return /* @__PURE__ */ t(
|
|
45
|
-
|
|
45
|
+
B,
|
|
46
46
|
{
|
|
47
47
|
className: R(x.wrap, {
|
|
48
48
|
[x.active]: m,
|
|
@@ -115,7 +115,7 @@ function fe({ editor: e, node: l, updateAttributes: c }) {
|
|
|
115
115
|
);
|
|
116
116
|
}
|
|
117
117
|
function ye() {
|
|
118
|
-
const e =
|
|
118
|
+
const e = G(), l = J(C.name), c = Q(C.name), { tooltipOptions: p = {}, isActive: u = void 0 } = (l == null ? void 0 : l.componentProps) ?? {}, { editorDisabled: m } = ee(u), d = K(() => (c == null ? void 0 : c.options) || {}, [c]), [n, A] = o(null), [g, N] = o({}), [b, I] = o({
|
|
119
119
|
elements: [],
|
|
120
120
|
appState: { isLoading: !1 },
|
|
121
121
|
files: null
|
|
@@ -234,7 +234,7 @@ const Z = { elements: [] }, C = /* @__PURE__ */ k.create({
|
|
|
234
234
|
renderHTML({ HTMLAttributes: e, node: l }) {
|
|
235
235
|
return [
|
|
236
236
|
"div",
|
|
237
|
-
|
|
237
|
+
j(this.options.HTMLAttributes, e, de(l))
|
|
238
238
|
];
|
|
239
239
|
},
|
|
240
240
|
addCommands() {
|
|
@@ -249,7 +249,7 @@ const Z = { elements: [] }, C = /* @__PURE__ */ k.create({
|
|
|
249
249
|
};
|
|
250
250
|
},
|
|
251
251
|
addNodeView() {
|
|
252
|
-
return
|
|
252
|
+
return U(fe);
|
|
253
253
|
},
|
|
254
254
|
addInputRules() {
|
|
255
255
|
return [
|
package/lib/ExportPdf.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const v=require("./index-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const v=require("./index-BGfIcDCQ.cjs"),l=require("react/jsx-runtime"),m=require("./index-aujjnfSJ.cjs");require("react");require("./theme.cjs");function y(e,n){var u;const t=document.createElement("iframe");t.setAttribute("style","position: absolute; width: 0; height: 0; top: 0; left: 0;"),document.body.appendChild(t);const o=t.contentDocument||((u=t.contentWindow)==null?void 0:u.document);if(!o)return;const{paperSize:d,title:i="React Tiptap Editor",margins:{top:s,right:a,bottom:r,left:c}}=n,p=`
|
|
2
2
|
<!DOCTYPE html>
|
|
3
3
|
<html lang="en">
|
|
4
4
|
<head>
|
package/lib/ExportPdf.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { E as b } from "./index-
|
|
1
|
+
import { E as b } from "./index-Dx-Dh7KS.js";
|
|
2
2
|
import { jsx as f, Fragment as v } from "react/jsx-runtime";
|
|
3
|
-
import { u as y, d as x, A as E } from "./index-
|
|
3
|
+
import { u as y, d as x, A as E } from "./index-C52cuQ_Y.js";
|
|
4
4
|
import "react";
|
|
5
5
|
import "./theme.js";
|
|
6
6
|
function P(o, i) {
|
package/lib/ExportWord.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const h=require("./index-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const h=require("./index-BGfIcDCQ.cjs"),u=require("docx"),n=require("prosemirror-docx"),i=require("react/jsx-runtime"),y=require("react"),a=require("./index-aujjnfSJ.cjs");require("./theme.cjs");const g=typeof window<"u";function v(o,e){if(g){const r=window.URL.createObjectURL(o),t=document.createElement("a");return t.href=r,t.download=e,t.click(),window.URL.revokeObjectURL(r),Promise.resolve()}return console.error("Download is not supported in Node.js"),Promise.resolve()}function B(){const o=a.useButtonProps(p.name),[e,r]=y.useState(!1),{icon:t=void 0,tooltip:c=void 0,shortcutKeys:s=void 0,tooltipOptions:f={},action:d=void 0,isActive:m=void 0}=(o==null?void 0:o.componentProps)??{},{dataState:x,disabled:l,update:w}=a.useToggleActive(m),b=async()=>{l||e||d&&(r(!0),await d(),w(),r(!1))};return o?i.jsx(a.ActionButton,{action:b,dataState:x,disabled:l||e,icon:e?"Loader":t,shortcutKeys:s,tooltip:c,tooltipOptions:f}):i.jsx(i.Fragment,{})}const E={...n.defaultNodes,hardBreak:n.defaultNodes.hard_break,codeBlock:n.defaultNodes.code_block,orderedList:n.defaultNodes.ordered_list,listItem:n.defaultNodes.list_item,bulletList:n.defaultNodes.bullet_list,horizontalRule:n.defaultNodes.horizontal_rule,image(o,e){o.renderInline(e),o.closeBlock(e)},table(o,e){o.table(e,{tableOptions:{width:{size:100,type:u.WidthType.PERCENTAGE}}})}},W=new n.DocxSerializer(E,n.defaultMarks),p=h.Extension.create({name:"exportWord",addOptions(){var o;return{...(o=this.parent)==null?void 0:o.call(this),button:({editor:e,t:r})=>({componentProps:{icon:"ExportWord",action:()=>{var t;return e==null?void 0:e.commands.exportToWord((t=e==null?void 0:e.state)==null?void 0:t.doc)},tooltip:r("editor.exportWord.tooltip"),isActive:()=>!1,disabled:!1}})}},addCommands(){return{exportToWord:o=>async()=>{try{const e={getImageBuffer:async t=>{const s=await(await fetch(t)).arrayBuffer();return new Uint8Array(s)}},r=W.serialize(o,e);return u.Packer.toBlob(r).then(t=>v(new Blob([t]),"richtext-export-document.docx")),!0}catch(e){return console.error("Error exporting to Word:",e),!1}}}}});exports.ExportWord=p;exports.RichTextExportWord=B;
|
package/lib/ExportWord.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { E as w } from "./index-
|
|
1
|
+
import { E as w } from "./index-Dx-Dh7KS.js";
|
|
2
2
|
import { Packer as x, WidthType as b } from "docx";
|
|
3
3
|
import { defaultNodes as n, DocxSerializer as h, defaultMarks as B } from "prosemirror-docx";
|
|
4
4
|
import { jsx as d, Fragment as v } from "react/jsx-runtime";
|
|
5
5
|
import { useState as y } from "react";
|
|
6
|
-
import { u as E, d as g, A as k } from "./index-
|
|
6
|
+
import { u as E, d as g, A as k } from "./index-C52cuQ_Y.js";
|
|
7
7
|
import "./theme.js";
|
|
8
8
|
const W = typeof window < "u";
|
|
9
9
|
function A(e, o) {
|
package/lib/FontFamily.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const v=require("./index-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const v=require("./index-SEMQrdk2.cjs"),F=require("./index-BpLw6ebr.cjs"),f=require("./index-aujjnfSJ.cjs"),e=require("react/jsx-runtime"),m=require("react"),x=require("./ActionMenuButton-C3Cfeza9.cjs");require("./theme.cjs");const d=require("./dropdown-menu-CURWpB9o.cjs");function M(){const{t:l}=F.useLocale(),o=f.useButtonProps(p.name),{icon:a=void 0,tooltip:u=void 0,items:r=[],isActive:s=void 0}=(o==null?void 0:o.componentProps)??{},{disabled:c,dataState:t}=f.useActive(s),n=m.useMemo(()=>(t==null?void 0:t.font)||l("editor.fontFamily.default.tooltip"),[t]);return o?e.jsxs(d.DropdownMenu,{children:[e.jsx(d.DropdownMenuTrigger,{asChild:!0,disabled:c,children:e.jsx(x.ActionMenuButton,{disabled:c,icon:a,title:(n==null?void 0:n.length)>12?`${n==null?void 0:n.slice(0,12)}...`:n,tooltip:u})}),e.jsx(d.DropdownMenuContent,{className:"richtext-w-full",children:r==null?void 0:r.map((i,y)=>{const h=i.font===l("editor.fontFamily.default.tooltip")?{}:{fontFamily:i.font};return e.jsxs(m.Fragment,{children:[e.jsx(d.DropdownMenuCheckboxItem,{checked:n===i.font,onClick:i.action,children:e.jsx("div",{className:"richtext-ml-1 richtext-h-full",style:h,children:i.font})}),i.font===l("editor.fontFamily.default.tooltip")&&e.jsx(d.DropdownMenuSeparator,{})]},`font-family-${y}`)})})]}):e.jsx(e.Fragment,{})}const p=v.FontFamily.extend({addOptions(){var l;return{...(l=this.parent)==null?void 0:l.call(this),fontFamilyList:F.DEFAULT_FONT_FAMILY_LIST,button({editor:o,extension:a,t:u}){var c;const r=f.ensureNameValueOptions(((c=a==null?void 0:a.options)==null?void 0:c.fontFamilyList)||[]),s=r.map(t=>({action:()=>{if(t.value==="Default"){o.chain().focus().unsetFontFamily().run();return}o.chain().focus().setFontFamily(t.value).run()},isActive:()=>o.isActive("textStyle",{fontFamily:t.value})||!1,title:t.name,font:t.value,default:t.value==="Default"}));return{componentProps:{tooltip:u("editor.fontFamily.tooltip"),disabled:!1,items:s,isActive:()=>{const t=s==null?void 0:s.find(i=>i.isActive());return t&&!t.default?t:{title:u("editor.fontFamily.default.tooltip"),font:u("editor.fontFamily.default.tooltip"),isActive:()=>!1,disabled:!1}},icon:"MenuDown",fontFamilyList:r}}}}}});exports.FontFamily=p;exports.RichTextFontFamily=M;
|
package/lib/FontFamily.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { F as p } from "./index-
|
|
2
|
-
import { u as F, D as y } from "./index-
|
|
3
|
-
import { u as h, e as v, f as A } from "./index-
|
|
1
|
+
import { F as p } from "./index-CJMI7Fjf.js";
|
|
2
|
+
import { u as F, D as y } from "./index-DtyAGMbq.js";
|
|
3
|
+
import { u as h, e as v, f as A } from "./index-C52cuQ_Y.js";
|
|
4
4
|
import { jsx as i, Fragment as D, jsxs as f } from "react/jsx-runtime";
|
|
5
5
|
import { useMemo as M, Fragment as w } from "react";
|
|
6
|
-
import { A as L } from "./ActionMenuButton-
|
|
6
|
+
import { A as L } from "./ActionMenuButton-B4KDkZ0z.js";
|
|
7
7
|
import "./theme.js";
|
|
8
|
-
import { D as g, a as x, b, c as T, d as C } from "./dropdown-menu-
|
|
8
|
+
import { D as g, a as x, b, c as T, d as C } from "./dropdown-menu-BKSX4gvT.js";
|
|
9
9
|
function S() {
|
|
10
10
|
const { t: a } = F(), n = h(N.name), {
|
|
11
11
|
icon: s = void 0,
|
package/lib/FontSize.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const m=require("./index-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const m=require("./index-BGfIcDCQ.cjs"),x=require("./index-BpLw6ebr.cjs"),S=require("./index-aujjnfSJ.cjs"),o=require("react/jsx-runtime"),p=require("react"),h=require("./ActionMenuButton-C3Cfeza9.cjs");require("./theme.cjs");const l=require("./dropdown-menu-CURWpB9o.cjs");function v(){const{t}=x.useLocale(),n=S.useButtonProps(z.name),{icon:d=void 0,tooltip:s=void 0,items:c=[],isActive:a=void 0}=(n==null?void 0:n.componentProps)??{},{disabled:u,dataState:e}=S.useActive(a),r=p.useMemo(()=>(e==null?void 0:e.title)||t("editor.fontSize.default.tooltip"),[e]);return n?o.jsxs(l.DropdownMenu,{children:[o.jsx(l.DropdownMenuTrigger,{asChild:!0,disabled:u,children:o.jsx(h.ActionMenuButton,{disabled:u,icon:d,title:r,tooltip:s})}),o.jsx(l.DropdownMenuContent,{className:"richtext-max-h-96 richtext-w-32 richtext-overflow-y-auto",children:c==null?void 0:c.map((i,f)=>o.jsxs(p.Fragment,{children:[o.jsx(l.DropdownMenuCheckboxItem,{checked:r===i.title,onClick:i.action,children:o.jsx("div",{className:"richtext-ml-1 richtext-h-full",children:i.title})}),i.title===t("editor.fontSize.default.tooltip")&&o.jsx(l.DropdownMenuSeparator,{})]},`font-size-${f}`))})]}):o.jsx(o.Fragment,{})}const z=m.Extension.create({name:"fontSize",addOptions(){var t;return{...(t=this.parent)==null?void 0:t.call(this),types:["textStyle"],fontSizes:x.DEFAULT_FONT_SIZE_LIST,button({editor:n,extension:d,t:s}){var u;const a=S.ensureNameValueOptions((u=d.options)==null?void 0:u.fontSizes).map(e=>({title:e.value==="Default"?s("editor.fontSize.default.tooltip"):String(e.name),isActive:()=>{const{fontSize:r}=n.getAttributes("textStyle"),i=e.value==="Default",f=r==null||r==="";return i&&f?!0:n.isActive({fontSize:String(e.value)})||!1},action:()=>{if(e.value==="Default"){n.commands.unsetFontSize();return}n.commands.setFontSize(String(e.value))},default:e.value==="Default"||!1}));return{componentProps:{editor:n,tooltip:s("editor.fontSize.tooltip"),disabled:!1,items:a,maxHeight:280,icon:"MenuDown",isActive:()=>{const e=(a||[]).find(i=>i.isActive());return e&&!e.default?e:{title:s("editor.fontSize.default.tooltip"),isActive:()=>!1}}}}}}},addGlobalAttributes(){return[{types:this.options.types,attributes:{fontSize:{default:null,parseHTML:t=>t.style.fontSize.replaceAll(/["']+/g,""),renderHTML:t=>t.fontSize?{style:`font-size: ${t.fontSize}`}:{}}}}]},addCommands(){return{setFontSize:t=>({chain:n})=>n().setMark("textStyle",{fontSize:t}).run(),unsetFontSize:()=>({chain:t})=>t().setMark("textStyle",{fontSize:null}).removeEmptyTextStyle().run()}}});exports.FontSize=z;exports.RichTextFontSize=v;
|
package/lib/FontSize.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { E as m } from "./index-
|
|
2
|
-
import { u as p, h as S } from "./index-
|
|
3
|
-
import { u as z, e as h, f as v } from "./index-
|
|
1
|
+
import { E as m } from "./index-Dx-Dh7KS.js";
|
|
2
|
+
import { u as p, h as S } from "./index-DtyAGMbq.js";
|
|
3
|
+
import { u as z, e as h, f as v } from "./index-C52cuQ_Y.js";
|
|
4
4
|
import { jsx as r, Fragment as x, jsxs as d } from "react/jsx-runtime";
|
|
5
5
|
import { useMemo as A, Fragment as D } from "react";
|
|
6
|
-
import { A as y } from "./ActionMenuButton-
|
|
6
|
+
import { A as y } from "./ActionMenuButton-B4KDkZ0z.js";
|
|
7
7
|
import "./theme.js";
|
|
8
|
-
import { D as F, a as M, b as g, c as w, d as T } from "./dropdown-menu-
|
|
8
|
+
import { D as F, a as M, b as g, c as w, d as T } from "./dropdown-menu-BKSX4gvT.js";
|
|
9
9
|
function $() {
|
|
10
10
|
const { t: e } = p(), n = z(b.name), {
|
|
11
11
|
icon: f = void 0,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const S=require("./index-BGfIcDCQ.cjs"),y=require("@tiptap/pm/state"),c=require("./index-aujjnfSJ.cjs"),l=require("react/jsx-runtime"),P=require("react");require("./theme.cjs");function v(){const t=c.useEditorInstance(),e=c.useEditableEditor(),n=c.useButtonProps(g.name),{icon:r=void 0,tooltip:s=void 0,shortcutKeys:o=void 0,tooltipOptions:M={},action:f=void 0,isActive:u=void 0}=(n==null?void 0:n.componentProps)??{},[E,k]=P.useState(()=>!!(u!=null&&u()));P.useEffect(()=>{if(!t||!u)return;const i=()=>{k(!!u())};return i(),t.on("selectionUpdate",i),t.on("transaction",i),()=>{t.off("selectionUpdate",i),t.off("transaction",i)}},[t,u]);const p=!e||!t,h=()=>{p||f==null||f()};return n?l.jsx(c.ActionButton,{action:h,dataState:E,disabled:p,icon:r,shortcutKeys:o,tooltip:s,tooltipOptions:M}):l.jsx(l.Fragment,{})}const d=new Set(["link"]),a=new y.PluginKey("format-painter");function m(t){return a.getState(t)??[]}function x(t){const{selection:e,storedMarks:n}=t,r=[];return n!=null&&n.length||e.empty?((n??e.$from.marks()).forEach(o=>{d.has(o.type.name)||r.push(o)}),r):(t.doc.nodesBetween(e.from,e.to,s=>!s.isText||r.length>0?!0:(s.marks.forEach(o=>{d.has(o.type.name)||r.push(o)}),!1)),r)}function b(t,e,n){const{from:r,to:s}=e.selection;return Object.values(e.schema.marks).forEach(o=>{d.has(o.name)||(t=t.removeMark(r,s,o))}),n.forEach(o=>{t=t.addMark(r,s,o)}),t}const g=S.Extension.create({name:"painter",addOptions(){var t;return{...(t=this.parent)==null?void 0:t.call(this),button:({editor:e,t:n})=>({component:c.ActionButton,componentProps:{action:()=>{if(m(e.state).length>0){e.commands.unsetPainter();return}e.commands.setPainter()},isActive:()=>m(e.state).length>0,icon:"PaintRoller",tooltip:n("editor.format")}})}},addCommands(){return{setPainter:()=>({dispatch:t,state:e})=>{const n=x(e);return n.length?(t==null||t(e.tr.setMeta(a,{type:"start",marks:n})),!0):(t==null||t(e.tr.setMeta(a,{type:"end"})),!1)},unsetPainter:()=>({dispatch:t,state:e})=>(t==null||t(e.tr.setMeta(a,{type:"end"})),!0)}},addProseMirrorPlugins(){return[new y.Plugin({key:a,state:{init:()=>[],apply:(t,e)=>{const n=t.getMeta(a);return(n==null?void 0:n.type)==="start"?n.marks:(n==null?void 0:n.type)==="end"?[]:e}},props:{handleDOMEvents:{keydown:(t,e)=>e.key!=="Escape"||m(t.state).length===0?!1:(t.dispatch(t.state.tr.setMeta(a,{type:"end"})),!0),mousedown:t=>{const e=m(t.state);if(!e.length)return!1;const n=()=>{document.removeEventListener("mouseup",n);const{state:r}=t,{selection:s}=r,o=s.empty?r.tr:b(r.tr,r,e);t.dispatch(o.setMeta(a,{type:"end"}))};return document.addEventListener("mouseup",n),!1}}}})]}});exports.FormatPainter=g;exports.RichTextFormatPainter=v;exports.formatPainterPluginKey=a;
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
import { E as M } from "./index-Dx-Dh7KS.js";
|
|
2
|
+
import { PluginKey as k, Plugin as h } from "@tiptap/pm/state";
|
|
3
|
+
import { h as S, j as v, u as x, A as d } from "./index-C52cuQ_Y.js";
|
|
4
|
+
import { jsx as p, Fragment as A } from "react/jsx-runtime";
|
|
5
|
+
import { useState as K, useEffect as b } from "react";
|
|
6
|
+
import "./theme.js";
|
|
7
|
+
function T() {
|
|
8
|
+
const t = S(), e = v(), n = x(j.name), {
|
|
9
|
+
icon: r = void 0,
|
|
10
|
+
tooltip: s = void 0,
|
|
11
|
+
shortcutKeys: o = void 0,
|
|
12
|
+
tooltipOptions: y = {},
|
|
13
|
+
action: c = void 0,
|
|
14
|
+
isActive: u = void 0
|
|
15
|
+
} = (n == null ? void 0 : n.componentProps) ?? {}, [P, g] = K(() => !!(u != null && u()));
|
|
16
|
+
b(() => {
|
|
17
|
+
if (!t || !u) return;
|
|
18
|
+
const i = () => {
|
|
19
|
+
g(!!u());
|
|
20
|
+
};
|
|
21
|
+
return i(), t.on("selectionUpdate", i), t.on("transaction", i), () => {
|
|
22
|
+
t.off("selectionUpdate", i), t.off("transaction", i);
|
|
23
|
+
};
|
|
24
|
+
}, [t, u]);
|
|
25
|
+
const l = !e || !t, E = () => {
|
|
26
|
+
l || c == null || c();
|
|
27
|
+
};
|
|
28
|
+
return n ? /* @__PURE__ */ p(
|
|
29
|
+
d,
|
|
30
|
+
{
|
|
31
|
+
action: E,
|
|
32
|
+
dataState: P,
|
|
33
|
+
disabled: l,
|
|
34
|
+
icon: r,
|
|
35
|
+
shortcutKeys: o,
|
|
36
|
+
tooltip: s,
|
|
37
|
+
tooltipOptions: y
|
|
38
|
+
}
|
|
39
|
+
) : /* @__PURE__ */ p(A, {});
|
|
40
|
+
}
|
|
41
|
+
const f = /* @__PURE__ */ new Set(["link"]), a = new k("format-painter");
|
|
42
|
+
function m(t) {
|
|
43
|
+
return a.getState(t) ?? [];
|
|
44
|
+
}
|
|
45
|
+
function F(t) {
|
|
46
|
+
const { selection: e, storedMarks: n } = t, r = [];
|
|
47
|
+
return n != null && n.length || e.empty ? ((n ?? e.$from.marks()).forEach((o) => {
|
|
48
|
+
f.has(o.type.name) || r.push(o);
|
|
49
|
+
}), r) : (t.doc.nodesBetween(e.from, e.to, (s) => !s.isText || r.length > 0 ? !0 : (s.marks.forEach((o) => {
|
|
50
|
+
f.has(o.type.name) || r.push(o);
|
|
51
|
+
}), !1)), r);
|
|
52
|
+
}
|
|
53
|
+
function O(t, e, n) {
|
|
54
|
+
const { from: r, to: s } = e.selection;
|
|
55
|
+
return Object.values(e.schema.marks).forEach((o) => {
|
|
56
|
+
f.has(o.name) || (t = t.removeMark(r, s, o));
|
|
57
|
+
}), n.forEach((o) => {
|
|
58
|
+
t = t.addMark(r, s, o);
|
|
59
|
+
}), t;
|
|
60
|
+
}
|
|
61
|
+
const j = /* @__PURE__ */ M.create({
|
|
62
|
+
name: "painter",
|
|
63
|
+
//@ts-expect-error
|
|
64
|
+
addOptions() {
|
|
65
|
+
var t;
|
|
66
|
+
return {
|
|
67
|
+
...(t = this.parent) == null ? void 0 : t.call(this),
|
|
68
|
+
button: ({ editor: e, t: n }) => ({
|
|
69
|
+
component: d,
|
|
70
|
+
componentProps: {
|
|
71
|
+
action: () => {
|
|
72
|
+
if (m(e.state).length > 0) {
|
|
73
|
+
e.commands.unsetPainter();
|
|
74
|
+
return;
|
|
75
|
+
}
|
|
76
|
+
e.commands.setPainter();
|
|
77
|
+
},
|
|
78
|
+
isActive: () => m(e.state).length > 0,
|
|
79
|
+
icon: "PaintRoller",
|
|
80
|
+
tooltip: n("editor.format")
|
|
81
|
+
}
|
|
82
|
+
})
|
|
83
|
+
};
|
|
84
|
+
},
|
|
85
|
+
addCommands() {
|
|
86
|
+
return {
|
|
87
|
+
setPainter: () => ({ dispatch: t, state: e }) => {
|
|
88
|
+
const n = F(e);
|
|
89
|
+
return n.length ? (t == null || t(
|
|
90
|
+
e.tr.setMeta(a, {
|
|
91
|
+
type: "start",
|
|
92
|
+
marks: n
|
|
93
|
+
})
|
|
94
|
+
), !0) : (t == null || t(e.tr.setMeta(a, { type: "end" })), !1);
|
|
95
|
+
},
|
|
96
|
+
unsetPainter: () => ({ dispatch: t, state: e }) => (t == null || t(e.tr.setMeta(a, { type: "end" })), !0)
|
|
97
|
+
};
|
|
98
|
+
},
|
|
99
|
+
addProseMirrorPlugins() {
|
|
100
|
+
return [
|
|
101
|
+
new h({
|
|
102
|
+
key: a,
|
|
103
|
+
state: {
|
|
104
|
+
init: () => [],
|
|
105
|
+
apply: (t, e) => {
|
|
106
|
+
const n = t.getMeta(a);
|
|
107
|
+
return (n == null ? void 0 : n.type) === "start" ? n.marks : (n == null ? void 0 : n.type) === "end" ? [] : e;
|
|
108
|
+
}
|
|
109
|
+
},
|
|
110
|
+
props: {
|
|
111
|
+
handleDOMEvents: {
|
|
112
|
+
keydown: (t, e) => e.key !== "Escape" || m(t.state).length === 0 ? !1 : (t.dispatch(t.state.tr.setMeta(a, { type: "end" })), !0),
|
|
113
|
+
mousedown: (t) => {
|
|
114
|
+
const e = m(t.state);
|
|
115
|
+
if (!e.length) return !1;
|
|
116
|
+
const n = () => {
|
|
117
|
+
document.removeEventListener("mouseup", n);
|
|
118
|
+
const { state: r } = t, { selection: s } = r, o = s.empty ? r.tr : O(r.tr, r, e);
|
|
119
|
+
t.dispatch(o.setMeta(a, { type: "end" }));
|
|
120
|
+
};
|
|
121
|
+
return document.addEventListener("mouseup", n), !1;
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
})
|
|
126
|
+
];
|
|
127
|
+
}
|
|
128
|
+
});
|
|
129
|
+
export {
|
|
130
|
+
j as FormatPainter,
|
|
131
|
+
T as RichTextFormatPainter,
|
|
132
|
+
a as formatPainterPluginKey
|
|
133
|
+
};
|
package/lib/Heading.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const f=require("./index-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const f=require("./index-BGfIcDCQ.cjs"),M=require("./index-BpLw6ebr.cjs"),s=require("react/jsx-runtime"),x=require("react"),v=require("./index-aujjnfSJ.cjs"),b=require("./ActionMenuButton-C3Cfeza9.cjs");require("./theme.cjs");const h=require("./dropdown-menu-CURWpB9o.cjs");var j=f.Node3.create({name:"heading",addOptions(){return{levels:[1,2,3,4,5,6],HTMLAttributes:{}}},content:"inline*",group:"block",defining:!0,addAttributes(){return{level:{default:1,rendered:!1}}},parseHTML(){return this.options.levels.map(e=>({tag:`h${e}`,attrs:{level:e}}))},renderHTML({node:e,HTMLAttributes:t}){return[`h${this.options.levels.includes(e.attrs.level)?e.attrs.level:this.options.levels[0]}`,f.mergeAttributes(this.options.HTMLAttributes,t),0]},parseMarkdown:(e,t)=>t.createNode("heading",{level:e.depth||1},t.parseInline(e.tokens||[])),renderMarkdown:(e,t)=>{var l;const i=(l=e.attrs)!=null&&l.level?parseInt(e.attrs.level,10):1,a="#".repeat(i);return e.content?`${a} ${t.renderChildren(e.content)}`:""},addCommands(){return{setHeading:e=>({commands:t})=>this.options.levels.includes(e.level)?t.setNode(this.name,e):!1,toggleHeading:e=>({commands:t})=>this.options.levels.includes(e.level)?t.toggleNode(this.name,"paragraph",e):!1}},addKeyboardShortcuts(){return this.options.levels.reduce((e,t)=>({...e,[`Mod-Alt-${t}`]:()=>this.editor.commands.toggleHeading({level:t})}),{})},addInputRules(){return this.options.levels.map(e=>f.textblockTypeInputRule({find:new RegExp(`^(#{${Math.min(...this.options.levels)},${e}})\\s$`),type:this.type,getAttributes:{level:e}}))}});function m(){const{t:e}=M.useLocale(),t=v.useButtonProps(A.name),{icon:l=void 0,tooltip:i=void 0,isActive:a=void 0,items:o=[]}=(t==null?void 0:t.componentProps)??{},{disabled:p,dataState:d}=v.useActive(a),r=x.useMemo(()=>(d==null?void 0:d.title)||e("editor.paragraph.tooltip"),[d]);return t?s.jsxs(h.DropdownMenu,{children:[s.jsx(h.DropdownMenuTrigger,{asChild:!0,disabled:p,children:s.jsx(b.ActionMenuButton,{disabled:p,icon:l,title:r,tooltip:i})}),s.jsx(h.DropdownMenuContent,{className:"richtext-w-full",children:o==null?void 0:o.map((n,c)=>{var u,g;return s.jsxs(x.Fragment,{children:[s.jsxs(h.DropdownMenuCheckboxItem,{checked:r===n.title,onClick:n.action,children:[s.jsx("div",{className:v.cn("richtext-ml-1 richtext-h-full",{"":n.level==="Paragraph","heading-1":n.level===1,"heading-2":n.level===2,"heading-3":n.level===3,"heading-4":n.level===4,"heading-5":n.level===5,"heading-6":n.level===6}),children:n.title}),!!((u=n==null?void 0:n.shortcutKeys)!=null&&u.length)&&s.jsx(h.DropdownMenuShortcut,{className:"richtext-pl-4",children:(g=n==null?void 0:n.shortcutKeys)==null?void 0:g.map(H=>v.getShortcutKey(H)).join(" ")})]}),n.level==="Paragraph"&&s.jsx(h.DropdownMenuSeparator,{})]},`heading-k-${c}`)})})]}):s.jsx(s.Fragment,{})}const A=j.extend({addOptions(){var e;return{...(e=this.parent)==null?void 0:e.call(this),levels:M.HEADINGS,button({editor:t,extension:l,t:i}){var d;const a=((d=l.options)==null?void 0:d.levels)||[],o=a.map(r=>{var c;const n=r==="Paragraph";return{action:()=>{if(n){const u=a.find(g=>t.isActive("heading",{level:g}));u&&u!=="Paragraph"&&t.commands.toggleHeading({level:u});return}t.commands.toggleHeading({level:r})},isActive:()=>n?!1:t.isActive("heading",{level:r})||!1,disabled:!t.can().toggleHeading({level:r}),title:i(n?"editor.paragraph.tooltip":`editor.heading.h${r}.tooltip`),level:r,shortcutKeys:((c=l.options.shortcutKeys)==null?void 0:c[r])??["alt","mod",`${r}`],default:n}}),p=o.filter(r=>r.disabled).length===o.length;return{componentProps:{tooltip:i("editor.heading.tooltip"),disabled:p,items:o,icon:"MenuDown",isActive:()=>{const r=o==null?void 0:o.find(c=>c.isActive());return r&&!r.default?r:{title:i("editor.paragraph.tooltip"),level:0,isActive:()=>!1}},levels:a}}}}}});exports.Heading=A;exports.RichTextHeading=m;
|
package/lib/Heading.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { N as f, t as m, m as A } from "./index-
|
|
2
|
-
import { u as M, H } from "./index-
|
|
1
|
+
import { N as f, t as m, m as A } from "./index-Dx-Dh7KS.js";
|
|
2
|
+
import { u as M, H } from "./index-DtyAGMbq.js";
|
|
3
3
|
import { jsx as d, Fragment as $, jsxs as g } from "react/jsx-runtime";
|
|
4
4
|
import { useMemo as b, Fragment as w } from "react";
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
5
|
+
import { u as x, e as D, c as y, m as N } from "./index-C52cuQ_Y.js";
|
|
6
|
+
import { A as k } from "./ActionMenuButton-B4KDkZ0z.js";
|
|
7
7
|
import "./theme.js";
|
|
8
|
-
import { D as L, a as C, b as T, c as I, e as K, d as P } from "./dropdown-menu-
|
|
8
|
+
import { D as L, a as C, b as T, c as I, e as K, d as P } from "./dropdown-menu-BKSX4gvT.js";
|
|
9
9
|
var R = f.create({
|
|
10
10
|
name: "heading",
|
|
11
11
|
addOptions() {
|
|
@@ -34,7 +34,11 @@ var R = f.create({
|
|
|
34
34
|
renderHTML({ node: e, HTMLAttributes: t }) {
|
|
35
35
|
return [`h${this.options.levels.includes(e.attrs.level) ? e.attrs.level : this.options.levels[0]}`, A(this.options.HTMLAttributes, t), 0];
|
|
36
36
|
},
|
|
37
|
-
parseMarkdown: (e, t) => t.createNode(
|
|
37
|
+
parseMarkdown: (e, t) => t.createNode(
|
|
38
|
+
"heading",
|
|
39
|
+
{ level: e.depth || 1 },
|
|
40
|
+
t.parseInline(e.tokens || [])
|
|
41
|
+
),
|
|
38
42
|
renderMarkdown: (e, t) => {
|
|
39
43
|
var a;
|
|
40
44
|
const o = (a = e.attrs) != null && a.level ? parseInt(e.attrs.level, 10) : 1, i = "#".repeat(o);
|
|
@@ -66,15 +70,15 @@ var R = f.create({
|
|
|
66
70
|
}
|
|
67
71
|
});
|
|
68
72
|
function z() {
|
|
69
|
-
const { t: e } = M(), t =
|
|
73
|
+
const { t: e } = M(), t = x(S.name), {
|
|
70
74
|
icon: a = void 0,
|
|
71
75
|
tooltip: o = void 0,
|
|
72
76
|
isActive: i = void 0,
|
|
73
77
|
items: s = []
|
|
74
|
-
} = (t == null ? void 0 : t.componentProps) ?? {}, { disabled: p, dataState: l } =
|
|
78
|
+
} = (t == null ? void 0 : t.componentProps) ?? {}, { disabled: p, dataState: l } = D(i), r = b(() => (l == null ? void 0 : l.title) || e("editor.paragraph.tooltip"), [l]);
|
|
75
79
|
return t ? /* @__PURE__ */ g(L, { children: [
|
|
76
80
|
/* @__PURE__ */ d(C, { asChild: !0, disabled: p, children: /* @__PURE__ */ d(
|
|
77
|
-
|
|
81
|
+
k,
|
|
78
82
|
{
|
|
79
83
|
disabled: p,
|
|
80
84
|
icon: a,
|
|
@@ -89,7 +93,7 @@ function z() {
|
|
|
89
93
|
/* @__PURE__ */ d(
|
|
90
94
|
"div",
|
|
91
95
|
{
|
|
92
|
-
className:
|
|
96
|
+
className: y("richtext-ml-1 richtext-h-full", {
|
|
93
97
|
"": n.level === "Paragraph",
|
|
94
98
|
"heading-1": n.level === 1,
|
|
95
99
|
"heading-2": n.level === 2,
|
|
@@ -101,7 +105,7 @@ function z() {
|
|
|
101
105
|
children: n.title
|
|
102
106
|
}
|
|
103
107
|
),
|
|
104
|
-
!!((u = n == null ? void 0 : n.shortcutKeys) != null && u.length) && /* @__PURE__ */ d(K, { className: "richtext-pl-4", children: (h = n == null ? void 0 : n.shortcutKeys) == null ? void 0 : h.map((v) =>
|
|
108
|
+
!!((u = n == null ? void 0 : n.shortcutKeys) != null && u.length) && /* @__PURE__ */ d(K, { className: "richtext-pl-4", children: (h = n == null ? void 0 : n.shortcutKeys) == null ? void 0 : h.map((v) => N(v)).join(" ") })
|
|
105
109
|
] }),
|
|
106
110
|
n.level === "Paragraph" && /* @__PURE__ */ d(P, {})
|
|
107
111
|
] }, `heading-k-${c}`);
|
package/lib/Highlight.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("./index-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("./index-BGfIcDCQ.cjs"),r=require("react/jsx-runtime"),p=require("react"),h=require("./index-aujjnfSJ.cjs"),m=require("./separator-BGO9AZp4.cjs");require("./theme.cjs");var L=/(?:^|\s)(==(?!\s+==)((?:[^=]+))==(?!\s+==))$/,k=/(?:^|\s)(==(?!\s+==)((?:[^=]+))==(?!\s+==))/g,H=l.Mark.create({name:"highlight",addOptions(){return{multicolor:!1,HTMLAttributes:{}}},addAttributes(){return this.options.multicolor?{color:{default:null,parseHTML:t=>t.getAttribute("data-color")||l.getStyleProperty(t,"background-color")||t.style.backgroundColor,renderHTML:t=>t.color?{"data-color":t.color,style:`background-color: ${t.color}; color: inherit`}:{}}}:{}},parseHTML(){return[{tag:"mark"}]},renderHTML({HTMLAttributes:t}){return["mark",l.mergeAttributes(this.options.HTMLAttributes,t),0]},renderMarkdown:(t,e)=>`==${e.renderChildren(t)}==`,parseMarkdown:(t,e)=>e.applyMark("highlight",e.parseInline(t.tokens||[])),markdownTokenizer:{name:"highlight",level:"inline",start:t=>t.indexOf("=="),tokenize(t,e,s){const i=/^(==)([^=]+)(==)/.exec(t);if(i){const n=i[2].trim(),u=s.inlineTokens(n);return{type:"highlight",raw:i[0],text:n,tokens:u}}}},addCommands(){return{setHighlight:t=>({commands:e})=>e.setMark(this.name,t),toggleHighlight:t=>({commands:e})=>e.toggleMark(this.name,t),unsetHighlight:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-h":()=>this.editor.commands.toggleHighlight()}},addInputRules(){return[l.markInputRule({find:L,type:this.type})]},addPasteRules(){return[l.markPasteRule({find:k,type:this.type})]}});function M({fill:t}){return r.jsx("svg",{height:"18px",version:"1.1",viewBox:"0 0 256 256",width:"18px",xmlns:"http://www.w3.org/2000/svg",children:r.jsx("g",{fill:"none",fillRule:"evenodd",stroke:"none",strokeWidth:1,children:r.jsxs("g",{id:"icon/背景颜色",children:[r.jsx("g",{fill:"currentColor",children:r.jsxs("g",{transform:"translate(119.502295, 137.878331) rotate(-135.000000) translate(-119.502295, -137.878331) translate(48.002295, 31.757731)",children:[r.jsx("path",{d:"M100.946943,60.8084699 L43.7469427,60.8084699 C37.2852111,60.8084699 32.0469427,66.0467383 32.0469427,72.5084699 L32.0469427,118.70847 C32.0469427,125.170201 37.2852111,130.40847 43.7469427,130.40847 L100.946943,130.40847 C107.408674,130.40847 112.646943,125.170201 112.646943,118.70847 L112.646943,72.5084699 C112.646943,66.0467383 107.408674,60.8084699 100.946943,60.8084699 Z M93.646,79.808 L93.646,111.408 L51.046,111.408 L51.046,79.808 L93.646,79.808 Z",fillRule:"nonzero"}),r.jsx("path",{d:"M87.9366521,16.90916 L87.9194966,68.2000001 C87.9183543,69.4147389 86.9334998,70.399264 85.7187607,70.4 L56.9423078,70.4 C55.7272813,70.4 54.7423078,69.4150264 54.7423078,68.2 L54.7423078,39.4621057 C54.7423078,37.2523513 55.5736632,35.1234748 57.0711706,33.4985176 L76.4832996,12.4342613 C78.9534987,9.75382857 83.1289108,9.5834005 85.8093436,12.0535996 C87.1658473,13.303709 87.9372691,15.0644715 87.9366521,16.90916 Z",fillRule:"evenodd"}),r.jsx("path",{d:"M131.3,111.241199 L11.7,111.241199 C5.23826843,111.241199 0,116.479467 0,122.941199 L0,200.541199 C0,207.002931 5.23826843,212.241199 11.7,212.241199 L131.3,212.241199 C137.761732,212.241199 143,207.002931 143,200.541199 L143,122.941199 C143,116.479467 137.761732,111.241199 131.3,111.241199 Z M124,130.241 L124,193.241 L19,193.241 L19,130.241 L124,130.241 Z",fillRule:"nonzero"})]})}),r.jsx("path",{d:"M51,218 L205,218 C211.075132,218 216,222.924868 216,229 C216,235.075132 211.075132,240 205,240 L51,240 C44.9248678,240 40,235.075132 40,229 C40,222.924868 44.9248678,218 51,218 Z",fill:typeof t=="string"?t:"none",id:"矩形"})]})})})}function v(){const t=h.useButtonProps(f.name),{tooltip:e=void 0,isActive:s=void 0,defaultColor:o=void 0,colors:i,action:n,shortcutKeys:u}=(t==null?void 0:t.componentProps)??{},{disabled:c,dataState:a}=h.useActive(s),[x,g]=p.useState(o);p.useEffect(()=>{g(a)},[a]);function C(d){c||n&&(n==null||n(d),g(d))}return t?r.jsx(m.ColorPicker,{colors:i,disabled:c,highlight:!0,onChange:C,value:x,children:r.jsx(h.ActionButton,{disabled:c,tooltip:e,shortcutKeys:u,children:r.jsxs("span",{className:"richtext-flex richtext-items-center richtext-justify-center richtext-gap-[4px] richtext-text-sm",children:[r.jsx(M,{fill:a}),r.jsx(h.IconComponent,{className:"!richtext-h-3 !richtext-w-3 richtext-text-zinc-500",name:"MenuDown"})]})})}):r.jsx(r.Fragment,{})}const f=H.extend({addStorage(){return{currentColor:this.options.defaultColor||void 0}},addOptions(){var t;return{...(t=this.parent)==null?void 0:t.call(this),multicolor:!0,button:({editor:e,t:s,extension:o})=>({componentProps:{action:i=>{if(typeof i=="string"){e.storage.highlight.currentColor=i,e.chain().focus().setHighlight({color:i}).run();return}e.chain().focus().unsetHighlight().run()},isActive:()=>{const{color:i}=e.getAttributes("highlight");return i},disabled:!1,shortcutKeys:o.options.shortcutKeys??["⇧","mod","H"],tooltip:s("editor.highlight.tooltip"),defaultColor:o.options.defaultColor}})}},addKeyboardShortcuts(){var t;return{...(t=this.parent)==null?void 0:t.call(this),"Mod-Shift-h":()=>{const e=this.storage.currentColor||this.options.defaultColor;if(!e){const{color:o}=this.editor.getAttributes("highlight");return o?this.editor.chain().focus().unsetHighlight().run():!1}return this.editor.isActive("highlight",{color:e})?this.editor.chain().focus().unsetHighlight().run():this.editor.chain().focus().setHighlight({color:e}).run()}}}});exports.Highlight=f;exports.RichTextHighlight=v;
|
package/lib/Highlight.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { M as
|
|
2
|
-
import { jsx as r, jsxs as
|
|
3
|
-
import { useState as
|
|
4
|
-
import { u as
|
|
5
|
-
import { C as
|
|
1
|
+
import { M as f, h as m, j as C, m as L, g as x } from "./index-Dx-Dh7KS.js";
|
|
2
|
+
import { jsx as r, jsxs as u, Fragment as k } from "react/jsx-runtime";
|
|
3
|
+
import { useState as M, useEffect as v } from "react";
|
|
4
|
+
import { u as H, e as y, A, I as b } from "./index-C52cuQ_Y.js";
|
|
5
|
+
import { C as w } from "./separator-DuuOJRQd.js";
|
|
6
6
|
import "./theme.js";
|
|
7
|
-
var
|
|
7
|
+
var R = /(?:^|\s)(==(?!\s+==)((?:[^=]+))==(?!\s+==))$/, T = /(?:^|\s)(==(?!\s+==)((?:[^=]+))==(?!\s+==))/g, S = f.create({
|
|
8
8
|
name: "highlight",
|
|
9
9
|
addOptions() {
|
|
10
10
|
return {
|
|
@@ -20,7 +20,7 @@ var b = /(?:^|\s)(==(?!\s+==)((?:[^=]+))==(?!\s+==))$/, w = /(?:^|\s)(==(?!\s+==
|
|
|
20
20
|
// round-trips. Otherwise parse the raw inline `style` attribute so
|
|
21
21
|
// the original color format (e.g. `#rrggbb`) is preserved instead of
|
|
22
22
|
// the canonicalized `rgb(...)` value from `element.style.backgroundColor`.
|
|
23
|
-
parseHTML: (t) => t.getAttribute("data-color") ||
|
|
23
|
+
parseHTML: (t) => t.getAttribute("data-color") || x(t, "background-color") || t.style.backgroundColor,
|
|
24
24
|
renderHTML: (t) => t.color ? {
|
|
25
25
|
"data-color": t.color,
|
|
26
26
|
style: `background-color: ${t.color}; color: inherit`
|
|
@@ -36,7 +36,7 @@ var b = /(?:^|\s)(==(?!\s+==)((?:[^=]+))==(?!\s+==))$/, w = /(?:^|\s)(==(?!\s+==
|
|
|
36
36
|
];
|
|
37
37
|
},
|
|
38
38
|
renderHTML({ HTMLAttributes: t }) {
|
|
39
|
-
return ["mark",
|
|
39
|
+
return ["mark", L(this.options.HTMLAttributes, t), 0];
|
|
40
40
|
},
|
|
41
41
|
renderMarkdown: (t, e) => `==${e.renderChildren(t)}==`,
|
|
42
42
|
parseMarkdown: (t, e) => e.applyMark("highlight", e.parseInline(t.tokens || [])),
|
|
@@ -71,22 +71,22 @@ var b = /(?:^|\s)(==(?!\s+==)((?:[^=]+))==(?!\s+==))$/, w = /(?:^|\s)(==(?!\s+==
|
|
|
71
71
|
},
|
|
72
72
|
addInputRules() {
|
|
73
73
|
return [
|
|
74
|
-
|
|
75
|
-
find:
|
|
74
|
+
C({
|
|
75
|
+
find: R,
|
|
76
76
|
type: this.type
|
|
77
77
|
})
|
|
78
78
|
];
|
|
79
79
|
},
|
|
80
80
|
addPasteRules() {
|
|
81
81
|
return [
|
|
82
|
-
|
|
83
|
-
find:
|
|
82
|
+
m({
|
|
83
|
+
find: T,
|
|
84
84
|
type: this.type
|
|
85
85
|
})
|
|
86
86
|
];
|
|
87
87
|
}
|
|
88
88
|
});
|
|
89
|
-
function
|
|
89
|
+
function I({ fill: t }) {
|
|
90
90
|
return /* @__PURE__ */ r(
|
|
91
91
|
"svg",
|
|
92
92
|
{
|
|
@@ -95,8 +95,8 @@ function T({ fill: t }) {
|
|
|
95
95
|
viewBox: "0 0 256 256",
|
|
96
96
|
width: "18px",
|
|
97
97
|
xmlns: "http://www.w3.org/2000/svg",
|
|
98
|
-
children: /* @__PURE__ */ r("g", { fill: "none", fillRule: "evenodd", stroke: "none", strokeWidth: 1, children: /* @__PURE__ */
|
|
99
|
-
/* @__PURE__ */ r("g", { fill: "currentColor", children: /* @__PURE__ */
|
|
98
|
+
children: /* @__PURE__ */ r("g", { fill: "none", fillRule: "evenodd", stroke: "none", strokeWidth: 1, children: /* @__PURE__ */ u("g", { id: "icon/背景颜色", children: [
|
|
99
|
+
/* @__PURE__ */ r("g", { fill: "currentColor", children: /* @__PURE__ */ u("g", { transform: "translate(119.502295, 137.878331) rotate(-135.000000) translate(-119.502295, -137.878331) translate(48.002295, 31.757731)", children: [
|
|
100
100
|
/* @__PURE__ */ r(
|
|
101
101
|
"path",
|
|
102
102
|
{
|
|
@@ -131,36 +131,39 @@ function T({ fill: t }) {
|
|
|
131
131
|
}
|
|
132
132
|
);
|
|
133
133
|
}
|
|
134
|
-
function
|
|
135
|
-
const t =
|
|
134
|
+
function E() {
|
|
135
|
+
const t = H(P.name), {
|
|
136
136
|
tooltip: e = void 0,
|
|
137
137
|
isActive: s = void 0,
|
|
138
138
|
defaultColor: o = void 0,
|
|
139
139
|
colors: i,
|
|
140
140
|
action: n,
|
|
141
141
|
shortcutKeys: l
|
|
142
|
-
} = (t == null ? void 0 : t.componentProps) ?? {}, {
|
|
143
|
-
|
|
144
|
-
|
|
142
|
+
} = (t == null ? void 0 : t.componentProps) ?? {}, { disabled: h, dataState: a } = y(s), [g, c] = M(o);
|
|
143
|
+
v(() => {
|
|
144
|
+
c(a);
|
|
145
|
+
}, [a]);
|
|
146
|
+
function p(d) {
|
|
147
|
+
h || n && (n == null || n(d), c(d));
|
|
145
148
|
}
|
|
146
149
|
return t ? /* @__PURE__ */ r(
|
|
147
|
-
|
|
150
|
+
w,
|
|
148
151
|
{
|
|
149
152
|
colors: i,
|
|
150
153
|
disabled: h,
|
|
151
154
|
highlight: !0,
|
|
152
|
-
onChange:
|
|
153
|
-
value:
|
|
155
|
+
onChange: p,
|
|
156
|
+
value: g,
|
|
154
157
|
children: /* @__PURE__ */ r(
|
|
155
|
-
|
|
158
|
+
A,
|
|
156
159
|
{
|
|
157
160
|
disabled: h,
|
|
158
161
|
tooltip: e,
|
|
159
162
|
shortcutKeys: l,
|
|
160
|
-
children: /* @__PURE__ */
|
|
161
|
-
/* @__PURE__ */ r(
|
|
163
|
+
children: /* @__PURE__ */ u("span", { className: "richtext-flex richtext-items-center richtext-justify-center richtext-gap-[4px] richtext-text-sm", children: [
|
|
164
|
+
/* @__PURE__ */ r(I, { fill: a }),
|
|
162
165
|
/* @__PURE__ */ r(
|
|
163
|
-
|
|
166
|
+
b,
|
|
164
167
|
{
|
|
165
168
|
className: "!richtext-h-3 !richtext-w-3 richtext-text-zinc-500",
|
|
166
169
|
name: "MenuDown"
|
|
@@ -170,9 +173,9 @@ function $() {
|
|
|
170
173
|
}
|
|
171
174
|
)
|
|
172
175
|
}
|
|
173
|
-
) : /* @__PURE__ */ r(
|
|
176
|
+
) : /* @__PURE__ */ r(k, {});
|
|
174
177
|
}
|
|
175
|
-
const
|
|
178
|
+
const P = /* @__PURE__ */ S.extend({
|
|
176
179
|
addStorage() {
|
|
177
180
|
return {
|
|
178
181
|
// Stores the currently selected highlight color; undefined indicates "No Fill".
|
|
@@ -194,7 +197,10 @@ const S = /* @__PURE__ */ R.extend({
|
|
|
194
197
|
}
|
|
195
198
|
e.chain().focus().unsetHighlight().run();
|
|
196
199
|
},
|
|
197
|
-
isActive: () =>
|
|
200
|
+
isActive: () => {
|
|
201
|
+
const { color: i } = e.getAttributes("highlight");
|
|
202
|
+
return i;
|
|
203
|
+
},
|
|
198
204
|
disabled: !1,
|
|
199
205
|
shortcutKeys: o.options.shortcutKeys ?? ["⇧", "mod", "H"],
|
|
200
206
|
tooltip: s("editor.highlight.tooltip"),
|
|
@@ -221,6 +227,6 @@ const S = /* @__PURE__ */ R.extend({
|
|
|
221
227
|
}
|
|
222
228
|
});
|
|
223
229
|
export {
|
|
224
|
-
|
|
225
|
-
|
|
230
|
+
P as Highlight,
|
|
231
|
+
E as RichTextHighlight
|
|
226
232
|
};
|