reactjs-tiptap-editor 0.3.27 → 0.3.29
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-fkh63F_R.cjs → ActionMenuButton-5Y8QcYxD.cjs} +1 -1
- package/lib/{ActionMenuButton-D3nLtawn.js → ActionMenuButton-Cs9DM_16.js} +1 -1
- package/lib/Attachment.cjs +1 -1
- package/lib/Attachment.d.cts +6 -4
- package/lib/Attachment.d.ts +6 -4
- package/lib/Attachment.js +1 -1
- package/lib/Blockquote.cjs +1 -1
- package/lib/Blockquote.d.cts +6 -4
- package/lib/Blockquote.d.ts +6 -4
- package/lib/Blockquote.js +10 -10
- package/lib/Bold.cjs +1 -1
- package/lib/Bold.d.cts +6 -4
- package/lib/Bold.d.ts +6 -4
- package/lib/Bold.js +10 -10
- package/lib/BulletList.cjs +1 -1
- package/lib/BulletList.d.cts +6 -4
- package/lib/BulletList.d.ts +6 -4
- package/lib/BulletList.js +10 -10
- package/lib/Clear.cjs +1 -1
- package/lib/Clear.d.cts +6 -4
- package/lib/Clear.d.ts +6 -4
- package/lib/Clear.js +1 -1
- package/lib/Code.cjs +1 -1
- package/lib/Code.d.cts +6 -4
- package/lib/Code.d.ts +6 -4
- package/lib/Code.js +21 -21
- package/lib/CodeBlock.cjs +1 -1
- package/lib/CodeBlock.d.cts +6 -4
- package/lib/CodeBlock.d.ts +6 -4
- package/lib/CodeBlock.js +1 -1
- package/lib/CodeView.cjs +1 -1
- package/lib/CodeView.d.cts +6 -4
- package/lib/CodeView.d.ts +6 -4
- package/lib/CodeView.js +1 -1
- package/lib/Color.cjs +1 -1
- package/lib/Color.d.cts +6 -4
- package/lib/Color.d.ts +6 -4
- package/lib/Color.js +1 -1
- package/lib/Document.d.cts +4 -4
- package/lib/Document.d.ts +4 -4
- package/lib/{Drawer-BBVUujX4.js → Drawer-BCmNLh31.js} +1 -1
- package/lib/{Drawer-DetzmUvQ.cjs → Drawer-DCAp7eZF.cjs} +1 -1
- package/lib/Drawer.cjs +1 -1
- package/lib/Drawer.d.cts +6 -4
- package/lib/Drawer.d.ts +6 -4
- package/lib/Drawer.js +2 -2
- package/lib/Emoji.cjs +1 -1
- package/lib/Emoji.d.cts +4 -4
- package/lib/Emoji.d.ts +4 -4
- package/lib/Emoji.js +1 -1
- package/lib/{Excalidraw-DVnwdz-w.cjs → Excalidraw-BI50RQL-.cjs} +1 -1
- package/lib/{Excalidraw-BVdio4hk.js → Excalidraw-CYPcjYZB.js} +1 -1
- package/lib/Excalidraw.cjs +1 -1
- package/lib/Excalidraw.d.cts +4 -4
- package/lib/Excalidraw.d.ts +4 -4
- package/lib/Excalidraw.js +1 -1
- package/lib/ExportPdf.cjs +1 -1
- package/lib/ExportPdf.d.cts +6 -4
- package/lib/ExportPdf.d.ts +6 -4
- package/lib/ExportPdf.js +1 -1
- package/lib/ExportWord.cjs +1 -1
- package/lib/ExportWord.d.cts +6 -4
- package/lib/ExportWord.d.ts +6 -4
- package/lib/ExportWord.js +1 -1
- package/lib/FontFamily.cjs +1 -1
- package/lib/FontFamily.d.cts +6 -4
- package/lib/FontFamily.d.ts +6 -4
- package/lib/FontFamily.js +2 -2
- package/lib/FontSize.cjs +1 -1
- package/lib/FontSize.d.cts +6 -4
- package/lib/FontSize.d.ts +6 -4
- package/lib/FontSize.js +2 -2
- package/lib/FormatPainter.cjs +1 -1
- package/lib/FormatPainter.d.cts +6 -4
- package/lib/FormatPainter.d.ts +6 -4
- package/lib/FormatPainter.js +1 -1
- package/lib/Heading.cjs +1 -1
- package/lib/Heading.d.cts +6 -4
- package/lib/Heading.d.ts +6 -4
- package/lib/Heading.js +71 -68
- package/lib/Highlight.cjs +1 -1
- package/lib/Highlight.d.cts +10 -4
- package/lib/Highlight.d.ts +10 -4
- package/lib/Highlight.js +14 -13
- package/lib/History.cjs +1 -1
- package/lib/History.d.cts +6 -4
- package/lib/History.d.ts +6 -4
- package/lib/History.js +163 -160
- package/lib/HorizontalRule.cjs +1 -1
- package/lib/HorizontalRule.d.cts +6 -4
- package/lib/HorizontalRule.d.ts +6 -4
- package/lib/HorizontalRule.js +14 -14
- package/lib/Iframe.cjs +1 -1
- package/lib/Iframe.d.cts +4 -4
- package/lib/Iframe.d.ts +4 -4
- package/lib/Iframe.js +1 -1
- package/lib/Image.cjs +1 -1
- package/lib/Image.d.cts +6 -4
- package/lib/Image.d.ts +6 -4
- package/lib/Image.js +1 -1
- package/lib/ImageGif.cjs +1 -1
- package/lib/ImageGif.d.cts +7 -6
- package/lib/ImageGif.d.ts +7 -6
- package/lib/ImageGif.js +1 -1
- package/lib/ImportWord.cjs +2 -2
- package/lib/ImportWord.d.cts +6 -4
- package/lib/ImportWord.d.ts +6 -4
- package/lib/ImportWord.js +2 -2
- package/lib/Indent.cjs +1 -1
- package/lib/Indent.d.cts +6 -4
- package/lib/Indent.d.ts +6 -4
- package/lib/Indent.js +12 -11
- package/lib/Italic.cjs +1 -1
- package/lib/Italic.d.cts +6 -4
- package/lib/Italic.d.ts +6 -4
- package/lib/Italic.js +13 -13
- package/lib/Katex.cjs +1 -1
- package/lib/Katex.d.cts +4 -4
- package/lib/Katex.d.ts +4 -4
- package/lib/Katex.js +2 -2
- package/lib/LineHeight.cjs +1 -1
- package/lib/LineHeight.d.cts +6 -4
- package/lib/LineHeight.d.ts +6 -4
- package/lib/LineHeight.js +1 -1
- package/lib/Link.cjs +1 -1
- package/lib/Link.d.cts +6 -4
- package/lib/Link.d.ts +6 -4
- package/lib/Link.js +1 -1
- package/lib/ListItem.d.cts +4 -4
- package/lib/ListItem.d.ts +4 -4
- package/lib/Mention.d.cts +4 -4
- package/lib/Mention.d.ts +4 -4
- package/lib/Mermaid.cjs +1 -1
- package/lib/Mermaid.d.cts +6 -4
- package/lib/Mermaid.d.ts +6 -4
- package/lib/Mermaid.js +2 -2
- package/lib/MoreMark.cjs +1 -1
- package/lib/MoreMark.d.cts +6 -4
- package/lib/MoreMark.d.ts +6 -4
- package/lib/MoreMark.js +46 -45
- package/lib/MultiColumn.cjs +1 -1
- package/lib/MultiColumn.d.cts +4 -4
- package/lib/MultiColumn.d.ts +4 -4
- package/lib/MultiColumn.js +1 -1
- package/lib/OrderedList.cjs +1 -1
- package/lib/OrderedList.d.cts +6 -4
- package/lib/OrderedList.d.ts +6 -4
- package/lib/OrderedList.js +9 -9
- package/lib/{RichTextEditor-DoMu_nCj.cjs → RichTextEditor-DsUcQSbm.cjs} +7 -7
- package/lib/{RichTextEditor-BJWhWz4z.js → RichTextEditor-e6q30rbV.js} +1691 -1672
- package/lib/SearchAndReplace.cjs +1 -1
- package/lib/SearchAndReplace.d.cts +6 -4
- package/lib/SearchAndReplace.d.ts +6 -4
- package/lib/SearchAndReplace.js +1 -1
- package/lib/Selection.d.cts +4 -4
- package/lib/Selection.d.ts +4 -4
- package/lib/SlashCommand.cjs +1 -1
- package/lib/SlashCommand.d.cts +4 -4
- package/lib/SlashCommand.d.ts +4 -4
- package/lib/SlashCommand.js +1 -1
- package/lib/Strike.cjs +1 -1
- package/lib/Strike.d.cts +6 -4
- package/lib/Strike.d.ts +6 -4
- package/lib/Strike.js +13 -13
- package/lib/SubAndSuperScript.cjs +1 -1
- package/lib/SubAndSuperScript.d.cts +6 -4
- package/lib/SubAndSuperScript.d.ts +6 -4
- package/lib/SubAndSuperScript.js +1 -1
- package/lib/Table.cjs +1 -1
- package/lib/Table.d.cts +6 -4
- package/lib/Table.d.ts +6 -4
- package/lib/Table.js +1 -1
- package/lib/TableOfContent.cjs +1 -1
- package/lib/TableOfContent.d.cts +4 -4
- package/lib/TableOfContent.d.ts +4 -4
- package/lib/TableOfContent.js +1 -1
- package/lib/TaskList.cjs +1 -1
- package/lib/TaskList.d.cts +6 -4
- package/lib/TaskList.d.ts +6 -4
- package/lib/TaskList.js +15 -15
- package/lib/TextAlign.cjs +1 -1
- package/lib/TextAlign.d.cts +6 -4
- package/lib/TextAlign.d.ts +6 -4
- package/lib/TextAlign.js +41 -41
- package/lib/TextBubble.cjs +1 -1
- package/lib/TextBubble.d.cts +6 -4
- package/lib/TextBubble.d.ts +6 -4
- package/lib/TextBubble.js +1 -1
- package/lib/TextDirection.cjs +1 -1
- package/lib/TextDirection.d.cts +4 -4
- package/lib/TextDirection.d.ts +4 -4
- package/lib/TextDirection.js +1 -1
- package/lib/TextUnderline.cjs +1 -1
- package/lib/TextUnderline.d.cts +6 -4
- package/lib/TextUnderline.d.ts +6 -4
- package/lib/TextUnderline.js +8 -8
- package/lib/TrailingNode.d.cts +4 -4
- package/lib/TrailingNode.d.ts +4 -4
- package/lib/{Twitter--OkCPska.cjs → Twitter-D2Osj8qP.cjs} +1 -1
- package/lib/{Twitter-CXwmqolk.js → Twitter-Wb7cD3M-.js} +1 -1
- package/lib/Twitter.cjs +1 -1
- package/lib/Twitter.d.cts +4 -4
- package/lib/Twitter.d.ts +4 -4
- package/lib/Twitter.js +1 -1
- package/lib/Video.cjs +1 -1
- package/lib/Video.d.cts +6 -4
- package/lib/Video.d.ts +6 -4
- package/lib/Video.js +1 -1
- package/lib/bubble-extra.cjs +1 -1
- package/lib/bubble-extra.d.cts +4 -4
- package/lib/bubble-extra.d.ts +4 -4
- package/lib/bubble-extra.js +5 -5
- package/lib/index.cjs +1 -1
- package/lib/index.d.cts +23 -17
- package/lib/index.d.ts +23 -17
- package/lib/index.js +2 -2
- package/lib/locale-bundle.d.cts +4 -4
- package/lib/locale-bundle.d.ts +4 -4
- package/lib/{textarea-DkVc2MIQ.cjs → textarea-BVbzd9-k.cjs} +1 -1
- package/lib/{textarea-HW9QlrCS.js → textarea-Csmx5x-_.js} +1 -1
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";const je=require("./index-ByRfqzMr.cjs"),M=require("./dom-dataset-Byuf1YmW.cjs"),n=require("react/jsx-runtime"),x=require("react"),H=require("./RichTextEditor-DoMu_nCj.cjs"),qt=require("./index-D_A0TBRA.cjs"),Dt="_verified_lvyh0_1",We={verified:Dt},$t=()=>n.jsx("svg",{viewBox:"0 0 24 24","aria-label":"Verified account",role:"img",className:We.verified,children:n.jsx("g",{children:n.jsx("path",{d:"M22.25 12c0-1.43-.88-2.67-2.19-3.34.46-1.39.2-2.9-.81-3.91s-2.52-1.27-3.91-.81c-.66-1.31-1.91-2.19-3.34-2.19s-2.67.88-3.33 2.19c-1.4-.46-2.91-.2-3.92.81s-1.26 2.52-.8 3.91c-1.31.67-2.2 1.91-2.2 3.34s.89 2.67 2.2 3.34c-.46 1.39-.21 2.9.8 3.91s2.52 1.26 3.91.81c.67 1.31 1.91 2.19 3.34 2.19s2.68-.88 3.34-2.19c1.39.45 2.9.2 3.91-.81s1.27-2.52.81-3.91c1.31-.67 2.19-1.91 2.19-3.34zm-11.71 4.2L6.8 12.46l1.41-1.42 2.26 2.26 4.8-5.23 1.47 1.36-6.2 6.77z"})})}),At=()=>n.jsx("svg",{viewBox:"0 0 22 22","aria-label":"Verified account",role:"img",className:We.verified,children:n.jsxs("g",{children:[n.jsxs("linearGradient",{gradientUnits:"userSpaceOnUse",id:"0-a",x1:"4.411",x2:"18.083",y1:"2.495",y2:"21.508",children:[n.jsx("stop",{offset:"0",stopColor:"#f4e72a"}),n.jsx("stop",{offset:".539",stopColor:"#cd8105"}),n.jsx("stop",{offset:".68",stopColor:"#cb7b00"}),n.jsx("stop",{offset:"1",stopColor:"#f4ec26"}),n.jsx("stop",{offset:"1",stopColor:"#f4e72a"})]}),n.jsxs("linearGradient",{gradientUnits:"userSpaceOnUse",id:"0-b",x1:"5.355",x2:"16.361",y1:"3.395",y2:"19.133",children:[n.jsx("stop",{offset:"0",stopColor:"#f9e87f"}),n.jsx("stop",{offset:".406",stopColor:"#e2b719"}),n.jsx("stop",{offset:".989",stopColor:"#e2b719"})]}),n.jsxs("g",{clipRule:"evenodd",fillRule:"evenodd",children:[n.jsx("path",{d:"M13.324 3.848L11 1.6 8.676 3.848l-3.201-.453-.559 3.184L2.06 8.095 3.48 11l-1.42 2.904 2.856 1.516.559 3.184 3.201-.452L11 20.4l2.324-2.248 3.201.452.559-3.184 2.856-1.516L18.52 11l1.42-2.905-2.856-1.516-.559-3.184zm-7.09 7.575l3.428 3.428 5.683-6.206-1.347-1.247-4.4 4.795-2.072-2.072z",fill:"url(#0-a)"}),n.jsx("path",{d:"M13.101 4.533L11 2.5 8.899 4.533l-2.895-.41-.505 2.88-2.583 1.37L4.2 11l-1.284 2.627 2.583 1.37.505 2.88 2.895-.41L11 19.5l2.101-2.033 2.895.41.505-2.88 2.583-1.37L17.8 11l1.284-2.627-2.583-1.37-.505-2.88zm-6.868 6.89l3.429 3.428 5.683-6.206-1.347-1.247-4.4 4.795-2.072-2.072z",fill:"url(#0-b)"}),n.jsx("path",{d:"M6.233 11.423l3.429 3.428 5.65-6.17.038-.033-.005 1.398-5.683 6.206-3.429-3.429-.003-1.405.005.003z",fill:"#d18800"})]})]})}),Vt=()=>n.jsx("svg",{viewBox:"0 0 22 22","aria-label":"Verified account",role:"img",className:We.verified,children:n.jsx("g",{children:n.jsx("path",{clipRule:"evenodd",d:"M12.05 2.056c-.568-.608-1.532-.608-2.1 0l-1.393 1.49c-.284.303-.685.47-1.1.455L5.42 3.932c-.832-.028-1.514.654-1.486 1.486l.069 2.039c.014.415-.152.816-.456 1.1l-1.49 1.392c-.608.568-.608 1.533 0 2.101l1.49 1.393c.304.284.47.684.456 1.1l-.07 2.038c-.027.832.655 1.514 1.487 1.486l2.038-.069c.415-.014.816.152 1.1.455l1.392 1.49c.569.609 1.533.609 2.102 0l1.393-1.49c.283-.303.684-.47 1.099-.455l2.038.069c.832.028 1.515-.654 1.486-1.486L18 14.542c-.015-.415.152-.815.455-1.099l1.49-1.393c.608-.568.608-1.533 0-2.101l-1.49-1.393c-.303-.283-.47-.684-.455-1.1l.068-2.038c.029-.832-.654-1.514-1.486-1.486l-2.038.07c-.415.013-.816-.153-1.1-.456zm-5.817 9.367l3.429 3.428 5.683-6.206-1.347-1.247-4.4 4.795-2.072-2.072z",fillRule:"evenodd"})})}),Mt="_root_98iqw_1",Bt="_article_98iqw_21",et={root:Mt,article:Bt},Fe=({className:e,children:t})=>n.jsx("div",{className:M.clsx("react-tweet-theme",et.root,e),children:n.jsx("article",{className:et.article,children:t})}),mt=e=>n.jsx("img",{...e}),Wt="_header_nqq4j_1",Ft="_avatar_nqq4j_11",Pt="_avatarOverflow_nqq4j_16",Ut="_avatarSquare_nqq4j_23",Ht="_avatarShadow_nqq4j_26",zt="_author_nqq4j_37",Gt="_authorLink_nqq4j_44",Kt="_authorVerified_nqq4j_53",Xt="_authorLinkText_nqq4j_56",Qt="_authorMeta_nqq4j_63",Jt="_authorFollow_nqq4j_66",Yt="_username_nqq4j_69",Zt="_follow_nqq4j_74",en="_separator_nqq4j_82",tn="_brand_nqq4j_86",nn="_twitterIcon_nqq4j_90",b={header:Wt,avatar:Ft,avatarOverflow:Pt,avatarSquare:Ut,avatarShadow:Ht,author:zt,authorLink:Gt,authorVerified:Kt,authorLinkText:Xt,authorMeta:Qt,authorFollow:Jt,username:Yt,follow:Zt,separator:en,brand:tn,twitterIcon:nn},rn="_verifiedOld_lcna5_1",sn="_verifiedBlue_lcna5_4",on="_verifiedGovernment_lcna5_7",we={verifiedOld:rn,verifiedBlue:sn,verifiedGovernment:on},pt=({user:e,className:t})=>{const r=e.verified||e.is_blue_verified||e.verified_type;let s=n.jsx($t,{}),o=we.verifiedBlue;if(r)switch(e.is_blue_verified||(o=we.verifiedOld),e.verified_type){case"Government":s=n.jsx(Vt,{}),o=we.verifiedGovernment;break;case"Business":s=n.jsx(At,{}),o=null;break}return r?n.jsx("div",{className:M.clsx(t,o),children:s}):null},an=({tweet:e,components:t})=>{var r;const s=(r=t==null?void 0:t.AvatarImg)!=null?r:mt,{user:o}=e;return n.jsxs("div",{className:b.header,children:[n.jsxs("a",{href:e.url,className:b.avatar,target:"_blank",rel:"noopener noreferrer",children:[n.jsx("div",{className:M.clsx(b.avatarOverflow,o.profile_image_shape==="Square"&&b.avatarSquare),children:n.jsx(s,{src:o.profile_image_url_https,alt:o.name,width:48,height:48})}),n.jsx("div",{className:b.avatarOverflow,children:n.jsx("div",{className:b.avatarShadow})})]}),n.jsxs("div",{className:b.author,children:[n.jsxs("a",{href:e.url,className:b.authorLink,target:"_blank",rel:"noopener noreferrer",children:[n.jsx("div",{className:b.authorLinkText,children:n.jsx("span",{title:o.name,children:o.name})}),n.jsx(pt,{user:o,className:b.authorVerified})]}),n.jsxs("div",{className:b.authorMeta,children:[n.jsx("a",{href:e.url,className:b.username,target:"_blank",rel:"noopener noreferrer",children:n.jsxs("span",{title:`@${o.screen_name}`,children:["@",o.screen_name]})}),n.jsxs("div",{className:b.authorFollow,children:[n.jsx("span",{className:b.separator,children:"·"}),n.jsx("a",{href:o.follow_url,className:b.follow,target:"_blank",rel:"noopener noreferrer",children:"Follow"})]})]})]}),n.jsx("a",{href:e.url,className:b.brand,target:"_blank",rel:"noopener noreferrer","aria-label":"View on Twitter",children:n.jsx("svg",{viewBox:"0 0 24 24","aria-hidden":"true",className:b.twitterIcon,children:n.jsx("g",{children:n.jsx("path",{d:"M18.244 2.25h3.308l-7.227 8.26 8.502 11.24H16.17l-5.214-6.817L4.99 21.75H1.68l7.73-8.835L1.254 2.25H8.08l4.713 6.231zm-1.161 17.52h1.833L7.084 4.126H5.117z"})})})})]})},cn="_root_1ec15_1",ln={root:cn},un=({tweet:e})=>n.jsxs("a",{href:e.in_reply_to_url,className:ln.root,target:"_blank",rel:"noopener noreferrer",children:["Replying to @",e.in_reply_to_screen_name]}),dn="_root_eihfa_1",fn={root:dn},_n=({href:e,children:t})=>n.jsx("a",{href:e,className:fn.root,target:"_blank",rel:"noopener noreferrer nofollow",children:t}),hn="_root_1xq52_1",mn={root:hn},pn=({tweet:e})=>n.jsx("p",{className:mn.root,lang:e.lang,dir:"auto",children:e.entities.map((t,r)=>{switch(t.type){case"hashtag":case"mention":case"url":case"symbol":return n.jsx(_n,{href:t.href,children:t.text},r);case"media":return;default:return n.jsx("span",{dangerouslySetInnerHTML:{__html:t.text}},r)}})}),tt=e=>`https://x.com/${e.user.screen_name}/status/${e.id_str}`,xt=e=>`https://x.com/${typeof e=="string"?e:e.user.screen_name}`,xn=e=>`https://x.com/intent/like?tweet_id=${e.id_str}`,vn=e=>`https://x.com/intent/tweet?in_reply_to=${e.id_str}`,gn=e=>`https://x.com/intent/follow?screen_name=${e.user.screen_name}`,jn=e=>`https://x.com/hashtag/${e.text}`,wn=e=>`https://x.com/search?q=%24${e.text}`,yn=e=>`https://x.com/${e.in_reply_to_screen_name}/status/${e.in_reply_to_status_id_str}`,vt=(e,t)=>{const r=new URL(e.media_url_https),s=r.pathname.split(".").pop();return s?(r.pathname=r.pathname.replace(`.${s}`,""),r.searchParams.set("format",s),r.searchParams.set("name",t),r.toString()):e.media_url_https},Sn=e=>{const{variants:t}=e.video_info;return t.filter(s=>s.content_type==="video/mp4").sort((s,o)=>{var i,a;return((i=o.bitrate)!=null?i:0)-((a=s.bitrate)!=null?a:0)})},Tn=e=>{const t=Sn(e);return t.length>1?t[1]:t[0]},Ie=e=>e>999999?`${(e/1e6).toFixed(1)}M`:e>999?`${(e/1e3).toFixed(1)}K`:e.toString();function nt(e){const t=Array.from(e.text),r=[{indices:e.display_text_range,type:"text"}];return ae(r,"hashtag",e.entities.hashtags),ae(r,"mention",e.entities.user_mentions),ae(r,"url",e.entities.urls),ae(r,"symbol",e.entities.symbols),e.entities.media&&ae(r,"media",e.entities.media),bn(e,r),r.map(s=>{const o=t.slice(s.indices[0],s.indices[1]).join("");switch(s.type){case"hashtag":return Object.assign(s,{href:jn(s),text:o});case"mention":return Object.assign(s,{href:xt(s.screen_name),text:o});case"url":case"media":return Object.assign(s,{href:s.expanded_url,text:s.display_url});case"symbol":return Object.assign(s,{href:wn(s),text:o});default:return Object.assign(s,{text:o})}})}function ae(e,t,r){for(const s of r)for(const[o,i]of e.entries()){if(i.indices[0]>s.indices[0]||i.indices[1]<s.indices[1])continue;const a=[{...s,type:t}];i.indices[0]<s.indices[0]&&a.unshift({indices:[i.indices[0],s.indices[0]],type:"text"}),i.indices[1]>s.indices[1]&&a.push({indices:[s.indices[1],i.indices[1]],type:"text"}),e.splice(o,1,...a);break}}function bn(e,t){e.entities.media&&e.entities.media[0].indices[0]<e.display_text_range[1]&&(e.display_text_range[1]=e.entities.media[0].indices[0]);const r=t.at(-1);r&&r.indices[1]>e.display_text_range[1]&&(r.indices[1]=e.display_text_range[1])}const En=e=>({...e,url:tt(e),user:{...e.user,url:xt(e),follow_url:gn(e)},like_url:xn(e),reply_url:vn(e),in_reply_to_url:e.in_reply_to_screen_name?yn(e):void 0,entities:nt(e),quoted_tweet:e.quoted_tweet?{...e.quoted_tweet,url:tt(e.quoted_tweet),entities:nt(e.quoted_tweet)}:void 0}),Rn="_root_g9tkv_1",On="_rounded_g9tkv_6",Nn="_mediaWrapper_g9tkv_10",Ln="_grid2Columns_g9tkv_17",kn="_grid3_g9tkv_20",In="_grid2x2_g9tkv_23",Cn="_mediaContainer_g9tkv_26",qn="_mediaLink_g9tkv_34",Dn="_skeleton_g9tkv_38",$n="_image_g9tkv_43",C={root:Rn,rounded:On,mediaWrapper:Nn,grid2Columns:Ln,grid3:kn,grid2x2:In,mediaContainer:Cn,mediaLink:qn,skeleton:Dn,image:$n},An="_anchor_fp31d_1",Vn="_videoButton_fp31d_17",Mn="_videoButtonIcon_fp31d_35",Bn="_watchOnTwitter_fp31d_44",Wn="_viewReplies_fp31d_60",se={anchor:An,videoButton:Vn,videoButtonIcon:Mn,watchOnTwitter:Bn,viewReplies:Wn},Fn=({tweet:e,media:t})=>{const[r,s]=x.useState(!0),[o,i]=x.useState(!1),[a,d]=x.useState(!1),p=Tn(t);let _=0;return n.jsxs(n.Fragment,{children:[n.jsx("video",{className:C.image,poster:vt(t,"small"),controls:!r,playsInline:!0,preload:"none",tabIndex:r?-1:0,onPlay:()=>{_&&window.clearTimeout(_),o||i(!0),a&&d(!1)},onPause:()=>{_&&window.clearTimeout(_),_=window.setTimeout(()=>{o&&i(!1),_=0},100)},onEnded:()=>{d(!0)},children:n.jsx("source",{src:p.url,type:p.content_type})}),r&&n.jsx("button",{type:"button",className:se.videoButton,"aria-label":"View video on X",onClick:w=>{const u=w.currentTarget.previousSibling;w.preventDefault(),s(!1),u.load(),u.play().then(()=>{i(!0),u.focus()}).catch(h=>{console.error("Error playing video:",h),s(!0),i(!1)})},children:n.jsx("svg",{viewBox:"0 0 24 24",className:se.videoButtonIcon,"aria-hidden":"true",children:n.jsx("g",{children:n.jsx("path",{d:"M21 12L4 2v20l17-10z"})})})}),!o&&!a&&n.jsx("div",{className:se.watchOnTwitter,children:n.jsx("a",{href:e.url,className:se.anchor,target:"_blank",rel:"noopener noreferrer",children:r?"Watch on X":"Continue watching on X"})}),a&&n.jsx("a",{href:e.url,className:M.clsx(se.anchor,se.viewReplies),target:"_blank",rel:"noopener noreferrer",children:"View replies"})]})},Pn=e=>n.jsx("img",{...e}),rt=(e,t)=>{let r=56.25;return t===1&&(r=100/e.original_info.width*e.original_info.height),t===2&&(r=r*2),{width:e.type==="photo"?void 0:"unset",paddingBottom:`${r}%`}},gt=({tweet:e,components:t,quoted:r})=>{var s,o,i;const a=(i=(s=e.mediaDetails)==null?void 0:s.length)!=null?i:0;var d;const p=(d=t==null?void 0:t.MediaImg)!=null?d:Pn;return n.jsx("div",{className:M.clsx(C.root,!r&&C.rounded),children:n.jsx("div",{className:M.clsx(C.mediaWrapper,a>1&&C.grid2Columns,a===3&&C.grid3,a>4&&C.grid2x2),children:(o=e.mediaDetails)==null?void 0:o.map(_=>n.jsx(x.Fragment,{children:_.type==="photo"?n.jsxs("a",{href:e.url,className:M.clsx(C.mediaContainer,C.mediaLink),target:"_blank",rel:"noopener noreferrer",children:[n.jsx("div",{className:C.skeleton,style:rt(_,a)}),n.jsx(p,{src:vt(_,"small"),alt:_.ext_alt_text||"Image",className:C.image,draggable:!0})]},_.media_url_https):n.jsxs("div",{className:C.mediaContainer,children:[n.jsx("div",{className:C.skeleton,style:rt(_,a)}),n.jsx(Fn,{tweet:e,media:_})]},_.media_url_https)},_.media_url_https))})})},Un={hour:"numeric",minute:"2-digit",hour12:!0,weekday:"short",month:"short",day:"numeric",year:"numeric"},Hn=new Intl.DateTimeFormat("en-US",Un),zn=e=>{const t={};for(const r of e)t[r.type]=r.value;return t},Gn=e=>{const t=zn(Hn.formatToParts(e)),r=`${t.hour}:${t.minute} ${t.dayPeriod}`,s=`${t.month} ${t.day}, ${t.year}`;return`${r} · ${s}`},Kn="_root_i24yn_1",Xn={root:Kn},Qn=({tweet:e})=>{const t=new Date(e.created_at),r=Gn(t);return n.jsx("a",{className:Xn.root,href:e.url,target:"_blank",rel:"noopener noreferrer","aria-label":r,children:n.jsx("time",{dateTime:t.toISOString(),children:r})})},Jn="_info_19qcj_1",Yn="_infoLink_19qcj_10",Zn="_infoIcon_19qcj_30",ye={info:Jn,infoLink:Yn,infoIcon:Zn},er=({tweet:e})=>n.jsxs("div",{className:ye.info,children:[n.jsx(Qn,{tweet:e}),n.jsx("a",{className:ye.infoLink,href:"https://help.x.com/en/x-for-websites-ads-info-and-privacy",target:"_blank",rel:"noopener noreferrer","aria-label":"Twitter for Websites, Ads Information and Privacy",children:n.jsx("svg",{viewBox:"0 0 24 24","aria-hidden":"true",className:ye.infoIcon,children:n.jsx("g",{children:n.jsx("path",{d:"M13.5 8.5c0 .83-.67 1.5-1.5 1.5s-1.5-.67-1.5-1.5S11.17 7 12 7s1.5.67 1.5 1.5zM13 17v-5h-2v5h2zm-1 5.25c5.66 0 10.25-4.59 10.25-10.25S17.66 1.75 12 1.75 1.75 6.34 1.75 12 6.34 22.25 12 22.25zM20.25 12c0 4.56-3.69 8.25-8.25 8.25S3.75 16.56 3.75 12 7.44 3.75 12 3.75s8.25 3.69 8.25 8.25z"})})})})]}),tr="_actions_n2anf_1",nr="_like_n2anf_13",rr="_reply_n2anf_14",sr="_copy_n2anf_15",or="_likeIconWrapper_n2anf_27",ir="_likeCount_n2anf_30",ar="_replyIconWrapper_n2anf_35",cr="_copyIconWrapper_n2anf_36",lr="_likeIcon_n2anf_27",ur="_replyIcon_n2anf_35",dr="_copyIcon_n2anf_36",fr="_replyText_n2anf_56",_r="_copyText_n2anf_57",L={actions:tr,like:nr,reply:rr,copy:sr,likeIconWrapper:or,likeCount:ir,replyIconWrapper:ar,copyIconWrapper:cr,likeIcon:lr,replyIcon:ur,copyIcon:dr,replyText:fr,copyText:_r},hr=({tweet:e})=>{const[t,r]=x.useState(!1),s=()=>{navigator.clipboard.writeText(e.url),r(!0)};return x.useEffect(()=>{if(t){const o=setTimeout(()=>{r(!1)},6e3);return()=>clearTimeout(o)}},[t]),n.jsxs("button",{type:"button",className:L.copy,"aria-label":"Copy link",onClick:s,children:[n.jsx("div",{className:L.copyIconWrapper,children:t?n.jsx("svg",{viewBox:"0 0 24 24",className:L.copyIcon,"aria-hidden":"true",children:n.jsx("g",{children:n.jsx("path",{d:"M9.64 18.952l-5.55-4.861 1.317-1.504 3.951 3.459 8.459-10.948L19.4 6.32 9.64 18.952z"})})}):n.jsx("svg",{viewBox:"0 0 24 24",className:L.copyIcon,"aria-hidden":"true",children:n.jsx("g",{children:n.jsx("path",{d:"M18.36 5.64c-1.95-1.96-5.11-1.96-7.07 0L9.88 7.05 8.46 5.64l1.42-1.42c2.73-2.73 7.16-2.73 9.9 0 2.73 2.74 2.73 7.17 0 9.9l-1.42 1.42-1.41-1.42 1.41-1.41c1.96-1.96 1.96-5.12 0-7.07zm-2.12 3.53l-7.07 7.07-1.41-1.41 7.07-7.07 1.41 1.41zm-12.02.71l1.42-1.42 1.41 1.42-1.41 1.41c-1.96 1.96-1.96 5.12 0 7.07 1.95 1.96 5.11 1.96 7.07 0l1.41-1.41 1.42 1.41-1.42 1.42c-2.73 2.73-7.16 2.73-9.9 0-2.73-2.74-2.73-7.17 0-9.9z"})})})}),n.jsx("span",{className:L.copyText,children:t?"Copied!":"Copy link"})]})},mr=({tweet:e})=>{const t=Ie(e.favorite_count);return n.jsxs("div",{className:L.actions,children:[n.jsxs("a",{className:L.like,href:e.like_url,target:"_blank",rel:"noopener noreferrer","aria-label":`Like. This Tweet has ${t} likes`,children:[n.jsx("div",{className:L.likeIconWrapper,children:n.jsx("svg",{viewBox:"0 0 24 24",className:L.likeIcon,"aria-hidden":"true",children:n.jsx("g",{children:n.jsx("path",{d:"M20.884 13.19c-1.351 2.48-4.001 5.12-8.379 7.67l-.503.3-.504-.3c-4.379-2.55-7.029-5.19-8.382-7.67-1.36-2.5-1.41-4.86-.514-6.67.887-1.79 2.647-2.91 4.601-3.01 1.651-.09 3.368.56 4.798 2.01 1.429-1.45 3.146-2.1 4.796-2.01 1.954.1 3.714 1.22 4.601 3.01.896 1.81.846 4.17-.514 6.67z"})})})}),n.jsx("span",{className:L.likeCount,children:t})]}),n.jsxs("a",{className:L.reply,href:e.reply_url,target:"_blank",rel:"noopener noreferrer","aria-label":"Reply to this Tweet on Twitter",children:[n.jsx("div",{className:L.replyIconWrapper,children:n.jsx("svg",{viewBox:"0 0 24 24",className:L.replyIcon,"aria-hidden":"true",children:n.jsx("g",{children:n.jsx("path",{d:"M1.751 10c0-4.42 3.584-8 8.005-8h4.366c4.49 0 8.129 3.64 8.129 8.13 0 2.96-1.607 5.68-4.196 7.11l-8.054 4.46v-3.69h-.067c-4.49.1-8.183-3.51-8.183-8.01z"})})})}),n.jsx("span",{className:L.replyText,children:"Reply"})]}),n.jsx(hr,{tweet:e})]})},pr="_replies_1cutb_1",xr="_link_1cutb_4",vr="_text_1cutb_23",Se={replies:pr,link:xr,text:vr},gr=({tweet:e})=>n.jsx("div",{className:Se.replies,children:n.jsx("a",{className:Se.link,href:e.url,target:"_blank",rel:"noopener noreferrer",children:n.jsx("span",{className:Se.text,children:e.conversation_count===0?"Read more on X":e.conversation_count===1?`Read ${Ie(e.conversation_count)} reply`:`Read ${Ie(e.conversation_count)} replies`})})}),jr="_root_q5799_1",wr="_article_q5799_16",st={root:jr,article:wr},yr=({tweet:e,children:t})=>n.jsx("div",{className:st.root,onClick:r=>{r.preventDefault(),window.open(e.url,"_blank")},children:n.jsx("article",{className:st.article,children:t})}),Sr="_header_r31i5_1",Tr="_avatar_r31i5_11",br="_avatarSquare_r31i5_17",Er="_author_r31i5_21",Rr="_authorText_r31i5_26",Or="_username_r31i5_33",Q={header:Sr,avatar:Tr,avatarSquare:br,author:Er,authorText:Rr,username:Or},Nr=({tweet:e})=>{const{user:t}=e;return n.jsxs("div",{className:Q.header,children:[n.jsx("a",{href:e.url,className:Q.avatar,target:"_blank",rel:"noopener noreferrer",children:n.jsx("div",{className:M.clsx(Q.avatarOverflow,t.profile_image_shape==="Square"&&Q.avatarSquare),children:n.jsx(mt,{src:t.profile_image_url_https,alt:t.name,width:20,height:20})})}),n.jsxs("div",{className:Q.author,children:[n.jsx("div",{className:Q.authorText,children:n.jsx("span",{title:t.name,children:t.name})}),n.jsx(pt,{user:t}),n.jsx("div",{className:Q.username,children:n.jsxs("span",{title:`@${t.screen_name}`,children:["@",t.screen_name]})})]})]})},Lr="_root_175ot_1",kr={root:Lr},Ir=({tweet:e})=>n.jsx("p",{className:kr.root,lang:e.lang,dir:"auto",children:e.entities.map((t,r)=>n.jsx("span",{dangerouslySetInnerHTML:{__html:t.text}},r))}),Cr=({tweet:e})=>{var t;return n.jsxs(yr,{tweet:e,children:[n.jsx(Nr,{tweet:e}),n.jsx(Ir,{tweet:e}),(t=e.mediaDetails)!=null&&t.length?n.jsx(gt,{quoted:!0,tweet:e}):null]})},qr=({tweet:e,components:t})=>{var r;const s=x.useMemo(()=>En(e),[e]);return n.jsxs(Fe,{children:[n.jsx(an,{tweet:s,components:t}),s.in_reply_to_status_id_str&&n.jsx(un,{tweet:s}),n.jsx(pn,{tweet:s}),(r=s.mediaDetails)!=null&&r.length?n.jsx(gt,{tweet:s,components:t}):null,s.quoted_tweet&&n.jsx(Cr,{tweet:s.quoted_tweet}),n.jsx(er,{tweet:s}),n.jsx(mr,{tweet:s}),n.jsx(gr,{tweet:s})]})},Dr="_root_16yxa_1",$r={root:Dr},Ar=e=>n.jsx(Fe,{children:n.jsxs("div",{className:$r.root,children:[n.jsx("h3",{children:"Tweet not found"}),n.jsx("p",{children:"The embedded tweet could not be found…"})]})}),Vr="_skeleton_oi7hr_1",Mr={skeleton:Vr},_e=({style:e})=>n.jsx("span",{className:Mr.skeleton,style:e}),Br="_root_17qqv_1",Wr={root:Br},Fr=()=>n.jsxs(Fe,{className:Wr.root,children:[n.jsx(_e,{style:{height:"3rem",marginBottom:"0.75rem"}}),n.jsx(_e,{style:{height:"6rem",margin:"0.5rem 0"}}),n.jsx("div",{style:{borderTop:"var(--tweet-border)",margin:"0.5rem 0"}}),n.jsx(_e,{style:{height:"2rem"}}),n.jsx(_e,{style:{height:"2rem",borderRadius:"9999px",marginTop:"0.5rem"}})]});var he={exports:{}},Te={};/**
|
|
1
|
+
"use strict";const je=require("./index-ByRfqzMr.cjs"),M=require("./dom-dataset-Byuf1YmW.cjs"),n=require("react/jsx-runtime"),x=require("react"),H=require("./RichTextEditor-DsUcQSbm.cjs"),qt=require("./index-D_A0TBRA.cjs"),Dt="_verified_lvyh0_1",We={verified:Dt},$t=()=>n.jsx("svg",{viewBox:"0 0 24 24","aria-label":"Verified account",role:"img",className:We.verified,children:n.jsx("g",{children:n.jsx("path",{d:"M22.25 12c0-1.43-.88-2.67-2.19-3.34.46-1.39.2-2.9-.81-3.91s-2.52-1.27-3.91-.81c-.66-1.31-1.91-2.19-3.34-2.19s-2.67.88-3.33 2.19c-1.4-.46-2.91-.2-3.92.81s-1.26 2.52-.8 3.91c-1.31.67-2.2 1.91-2.2 3.34s.89 2.67 2.2 3.34c-.46 1.39-.21 2.9.8 3.91s2.52 1.26 3.91.81c.67 1.31 1.91 2.19 3.34 2.19s2.68-.88 3.34-2.19c1.39.45 2.9.2 3.91-.81s1.27-2.52.81-3.91c1.31-.67 2.19-1.91 2.19-3.34zm-11.71 4.2L6.8 12.46l1.41-1.42 2.26 2.26 4.8-5.23 1.47 1.36-6.2 6.77z"})})}),At=()=>n.jsx("svg",{viewBox:"0 0 22 22","aria-label":"Verified account",role:"img",className:We.verified,children:n.jsxs("g",{children:[n.jsxs("linearGradient",{gradientUnits:"userSpaceOnUse",id:"0-a",x1:"4.411",x2:"18.083",y1:"2.495",y2:"21.508",children:[n.jsx("stop",{offset:"0",stopColor:"#f4e72a"}),n.jsx("stop",{offset:".539",stopColor:"#cd8105"}),n.jsx("stop",{offset:".68",stopColor:"#cb7b00"}),n.jsx("stop",{offset:"1",stopColor:"#f4ec26"}),n.jsx("stop",{offset:"1",stopColor:"#f4e72a"})]}),n.jsxs("linearGradient",{gradientUnits:"userSpaceOnUse",id:"0-b",x1:"5.355",x2:"16.361",y1:"3.395",y2:"19.133",children:[n.jsx("stop",{offset:"0",stopColor:"#f9e87f"}),n.jsx("stop",{offset:".406",stopColor:"#e2b719"}),n.jsx("stop",{offset:".989",stopColor:"#e2b719"})]}),n.jsxs("g",{clipRule:"evenodd",fillRule:"evenodd",children:[n.jsx("path",{d:"M13.324 3.848L11 1.6 8.676 3.848l-3.201-.453-.559 3.184L2.06 8.095 3.48 11l-1.42 2.904 2.856 1.516.559 3.184 3.201-.452L11 20.4l2.324-2.248 3.201.452.559-3.184 2.856-1.516L18.52 11l1.42-2.905-2.856-1.516-.559-3.184zm-7.09 7.575l3.428 3.428 5.683-6.206-1.347-1.247-4.4 4.795-2.072-2.072z",fill:"url(#0-a)"}),n.jsx("path",{d:"M13.101 4.533L11 2.5 8.899 4.533l-2.895-.41-.505 2.88-2.583 1.37L4.2 11l-1.284 2.627 2.583 1.37.505 2.88 2.895-.41L11 19.5l2.101-2.033 2.895.41.505-2.88 2.583-1.37L17.8 11l1.284-2.627-2.583-1.37-.505-2.88zm-6.868 6.89l3.429 3.428 5.683-6.206-1.347-1.247-4.4 4.795-2.072-2.072z",fill:"url(#0-b)"}),n.jsx("path",{d:"M6.233 11.423l3.429 3.428 5.65-6.17.038-.033-.005 1.398-5.683 6.206-3.429-3.429-.003-1.405.005.003z",fill:"#d18800"})]})]})}),Vt=()=>n.jsx("svg",{viewBox:"0 0 22 22","aria-label":"Verified account",role:"img",className:We.verified,children:n.jsx("g",{children:n.jsx("path",{clipRule:"evenodd",d:"M12.05 2.056c-.568-.608-1.532-.608-2.1 0l-1.393 1.49c-.284.303-.685.47-1.1.455L5.42 3.932c-.832-.028-1.514.654-1.486 1.486l.069 2.039c.014.415-.152.816-.456 1.1l-1.49 1.392c-.608.568-.608 1.533 0 2.101l1.49 1.393c.304.284.47.684.456 1.1l-.07 2.038c-.027.832.655 1.514 1.487 1.486l2.038-.069c.415-.014.816.152 1.1.455l1.392 1.49c.569.609 1.533.609 2.102 0l1.393-1.49c.283-.303.684-.47 1.099-.455l2.038.069c.832.028 1.515-.654 1.486-1.486L18 14.542c-.015-.415.152-.815.455-1.099l1.49-1.393c.608-.568.608-1.533 0-2.101l-1.49-1.393c-.303-.283-.47-.684-.455-1.1l.068-2.038c.029-.832-.654-1.514-1.486-1.486l-2.038.07c-.415.013-.816-.153-1.1-.456zm-5.817 9.367l3.429 3.428 5.683-6.206-1.347-1.247-4.4 4.795-2.072-2.072z",fillRule:"evenodd"})})}),Mt="_root_98iqw_1",Bt="_article_98iqw_21",et={root:Mt,article:Bt},Fe=({className:e,children:t})=>n.jsx("div",{className:M.clsx("react-tweet-theme",et.root,e),children:n.jsx("article",{className:et.article,children:t})}),mt=e=>n.jsx("img",{...e}),Wt="_header_nqq4j_1",Ft="_avatar_nqq4j_11",Pt="_avatarOverflow_nqq4j_16",Ut="_avatarSquare_nqq4j_23",Ht="_avatarShadow_nqq4j_26",zt="_author_nqq4j_37",Gt="_authorLink_nqq4j_44",Kt="_authorVerified_nqq4j_53",Xt="_authorLinkText_nqq4j_56",Qt="_authorMeta_nqq4j_63",Jt="_authorFollow_nqq4j_66",Yt="_username_nqq4j_69",Zt="_follow_nqq4j_74",en="_separator_nqq4j_82",tn="_brand_nqq4j_86",nn="_twitterIcon_nqq4j_90",b={header:Wt,avatar:Ft,avatarOverflow:Pt,avatarSquare:Ut,avatarShadow:Ht,author:zt,authorLink:Gt,authorVerified:Kt,authorLinkText:Xt,authorMeta:Qt,authorFollow:Jt,username:Yt,follow:Zt,separator:en,brand:tn,twitterIcon:nn},rn="_verifiedOld_lcna5_1",sn="_verifiedBlue_lcna5_4",on="_verifiedGovernment_lcna5_7",we={verifiedOld:rn,verifiedBlue:sn,verifiedGovernment:on},pt=({user:e,className:t})=>{const r=e.verified||e.is_blue_verified||e.verified_type;let s=n.jsx($t,{}),o=we.verifiedBlue;if(r)switch(e.is_blue_verified||(o=we.verifiedOld),e.verified_type){case"Government":s=n.jsx(Vt,{}),o=we.verifiedGovernment;break;case"Business":s=n.jsx(At,{}),o=null;break}return r?n.jsx("div",{className:M.clsx(t,o),children:s}):null},an=({tweet:e,components:t})=>{var r;const s=(r=t==null?void 0:t.AvatarImg)!=null?r:mt,{user:o}=e;return n.jsxs("div",{className:b.header,children:[n.jsxs("a",{href:e.url,className:b.avatar,target:"_blank",rel:"noopener noreferrer",children:[n.jsx("div",{className:M.clsx(b.avatarOverflow,o.profile_image_shape==="Square"&&b.avatarSquare),children:n.jsx(s,{src:o.profile_image_url_https,alt:o.name,width:48,height:48})}),n.jsx("div",{className:b.avatarOverflow,children:n.jsx("div",{className:b.avatarShadow})})]}),n.jsxs("div",{className:b.author,children:[n.jsxs("a",{href:e.url,className:b.authorLink,target:"_blank",rel:"noopener noreferrer",children:[n.jsx("div",{className:b.authorLinkText,children:n.jsx("span",{title:o.name,children:o.name})}),n.jsx(pt,{user:o,className:b.authorVerified})]}),n.jsxs("div",{className:b.authorMeta,children:[n.jsx("a",{href:e.url,className:b.username,target:"_blank",rel:"noopener noreferrer",children:n.jsxs("span",{title:`@${o.screen_name}`,children:["@",o.screen_name]})}),n.jsxs("div",{className:b.authorFollow,children:[n.jsx("span",{className:b.separator,children:"·"}),n.jsx("a",{href:o.follow_url,className:b.follow,target:"_blank",rel:"noopener noreferrer",children:"Follow"})]})]})]}),n.jsx("a",{href:e.url,className:b.brand,target:"_blank",rel:"noopener noreferrer","aria-label":"View on Twitter",children:n.jsx("svg",{viewBox:"0 0 24 24","aria-hidden":"true",className:b.twitterIcon,children:n.jsx("g",{children:n.jsx("path",{d:"M18.244 2.25h3.308l-7.227 8.26 8.502 11.24H16.17l-5.214-6.817L4.99 21.75H1.68l7.73-8.835L1.254 2.25H8.08l4.713 6.231zm-1.161 17.52h1.833L7.084 4.126H5.117z"})})})})]})},cn="_root_1ec15_1",ln={root:cn},un=({tweet:e})=>n.jsxs("a",{href:e.in_reply_to_url,className:ln.root,target:"_blank",rel:"noopener noreferrer",children:["Replying to @",e.in_reply_to_screen_name]}),dn="_root_eihfa_1",fn={root:dn},_n=({href:e,children:t})=>n.jsx("a",{href:e,className:fn.root,target:"_blank",rel:"noopener noreferrer nofollow",children:t}),hn="_root_1xq52_1",mn={root:hn},pn=({tweet:e})=>n.jsx("p",{className:mn.root,lang:e.lang,dir:"auto",children:e.entities.map((t,r)=>{switch(t.type){case"hashtag":case"mention":case"url":case"symbol":return n.jsx(_n,{href:t.href,children:t.text},r);case"media":return;default:return n.jsx("span",{dangerouslySetInnerHTML:{__html:t.text}},r)}})}),tt=e=>`https://x.com/${e.user.screen_name}/status/${e.id_str}`,xt=e=>`https://x.com/${typeof e=="string"?e:e.user.screen_name}`,xn=e=>`https://x.com/intent/like?tweet_id=${e.id_str}`,vn=e=>`https://x.com/intent/tweet?in_reply_to=${e.id_str}`,gn=e=>`https://x.com/intent/follow?screen_name=${e.user.screen_name}`,jn=e=>`https://x.com/hashtag/${e.text}`,wn=e=>`https://x.com/search?q=%24${e.text}`,yn=e=>`https://x.com/${e.in_reply_to_screen_name}/status/${e.in_reply_to_status_id_str}`,vt=(e,t)=>{const r=new URL(e.media_url_https),s=r.pathname.split(".").pop();return s?(r.pathname=r.pathname.replace(`.${s}`,""),r.searchParams.set("format",s),r.searchParams.set("name",t),r.toString()):e.media_url_https},Sn=e=>{const{variants:t}=e.video_info;return t.filter(s=>s.content_type==="video/mp4").sort((s,o)=>{var i,a;return((i=o.bitrate)!=null?i:0)-((a=s.bitrate)!=null?a:0)})},Tn=e=>{const t=Sn(e);return t.length>1?t[1]:t[0]},Ie=e=>e>999999?`${(e/1e6).toFixed(1)}M`:e>999?`${(e/1e3).toFixed(1)}K`:e.toString();function nt(e){const t=Array.from(e.text),r=[{indices:e.display_text_range,type:"text"}];return ae(r,"hashtag",e.entities.hashtags),ae(r,"mention",e.entities.user_mentions),ae(r,"url",e.entities.urls),ae(r,"symbol",e.entities.symbols),e.entities.media&&ae(r,"media",e.entities.media),bn(e,r),r.map(s=>{const o=t.slice(s.indices[0],s.indices[1]).join("");switch(s.type){case"hashtag":return Object.assign(s,{href:jn(s),text:o});case"mention":return Object.assign(s,{href:xt(s.screen_name),text:o});case"url":case"media":return Object.assign(s,{href:s.expanded_url,text:s.display_url});case"symbol":return Object.assign(s,{href:wn(s),text:o});default:return Object.assign(s,{text:o})}})}function ae(e,t,r){for(const s of r)for(const[o,i]of e.entries()){if(i.indices[0]>s.indices[0]||i.indices[1]<s.indices[1])continue;const a=[{...s,type:t}];i.indices[0]<s.indices[0]&&a.unshift({indices:[i.indices[0],s.indices[0]],type:"text"}),i.indices[1]>s.indices[1]&&a.push({indices:[s.indices[1],i.indices[1]],type:"text"}),e.splice(o,1,...a);break}}function bn(e,t){e.entities.media&&e.entities.media[0].indices[0]<e.display_text_range[1]&&(e.display_text_range[1]=e.entities.media[0].indices[0]);const r=t.at(-1);r&&r.indices[1]>e.display_text_range[1]&&(r.indices[1]=e.display_text_range[1])}const En=e=>({...e,url:tt(e),user:{...e.user,url:xt(e),follow_url:gn(e)},like_url:xn(e),reply_url:vn(e),in_reply_to_url:e.in_reply_to_screen_name?yn(e):void 0,entities:nt(e),quoted_tweet:e.quoted_tweet?{...e.quoted_tweet,url:tt(e.quoted_tweet),entities:nt(e.quoted_tweet)}:void 0}),Rn="_root_g9tkv_1",On="_rounded_g9tkv_6",Nn="_mediaWrapper_g9tkv_10",Ln="_grid2Columns_g9tkv_17",kn="_grid3_g9tkv_20",In="_grid2x2_g9tkv_23",Cn="_mediaContainer_g9tkv_26",qn="_mediaLink_g9tkv_34",Dn="_skeleton_g9tkv_38",$n="_image_g9tkv_43",C={root:Rn,rounded:On,mediaWrapper:Nn,grid2Columns:Ln,grid3:kn,grid2x2:In,mediaContainer:Cn,mediaLink:qn,skeleton:Dn,image:$n},An="_anchor_fp31d_1",Vn="_videoButton_fp31d_17",Mn="_videoButtonIcon_fp31d_35",Bn="_watchOnTwitter_fp31d_44",Wn="_viewReplies_fp31d_60",se={anchor:An,videoButton:Vn,videoButtonIcon:Mn,watchOnTwitter:Bn,viewReplies:Wn},Fn=({tweet:e,media:t})=>{const[r,s]=x.useState(!0),[o,i]=x.useState(!1),[a,d]=x.useState(!1),p=Tn(t);let _=0;return n.jsxs(n.Fragment,{children:[n.jsx("video",{className:C.image,poster:vt(t,"small"),controls:!r,playsInline:!0,preload:"none",tabIndex:r?-1:0,onPlay:()=>{_&&window.clearTimeout(_),o||i(!0),a&&d(!1)},onPause:()=>{_&&window.clearTimeout(_),_=window.setTimeout(()=>{o&&i(!1),_=0},100)},onEnded:()=>{d(!0)},children:n.jsx("source",{src:p.url,type:p.content_type})}),r&&n.jsx("button",{type:"button",className:se.videoButton,"aria-label":"View video on X",onClick:w=>{const u=w.currentTarget.previousSibling;w.preventDefault(),s(!1),u.load(),u.play().then(()=>{i(!0),u.focus()}).catch(h=>{console.error("Error playing video:",h),s(!0),i(!1)})},children:n.jsx("svg",{viewBox:"0 0 24 24",className:se.videoButtonIcon,"aria-hidden":"true",children:n.jsx("g",{children:n.jsx("path",{d:"M21 12L4 2v20l17-10z"})})})}),!o&&!a&&n.jsx("div",{className:se.watchOnTwitter,children:n.jsx("a",{href:e.url,className:se.anchor,target:"_blank",rel:"noopener noreferrer",children:r?"Watch on X":"Continue watching on X"})}),a&&n.jsx("a",{href:e.url,className:M.clsx(se.anchor,se.viewReplies),target:"_blank",rel:"noopener noreferrer",children:"View replies"})]})},Pn=e=>n.jsx("img",{...e}),rt=(e,t)=>{let r=56.25;return t===1&&(r=100/e.original_info.width*e.original_info.height),t===2&&(r=r*2),{width:e.type==="photo"?void 0:"unset",paddingBottom:`${r}%`}},gt=({tweet:e,components:t,quoted:r})=>{var s,o,i;const a=(i=(s=e.mediaDetails)==null?void 0:s.length)!=null?i:0;var d;const p=(d=t==null?void 0:t.MediaImg)!=null?d:Pn;return n.jsx("div",{className:M.clsx(C.root,!r&&C.rounded),children:n.jsx("div",{className:M.clsx(C.mediaWrapper,a>1&&C.grid2Columns,a===3&&C.grid3,a>4&&C.grid2x2),children:(o=e.mediaDetails)==null?void 0:o.map(_=>n.jsx(x.Fragment,{children:_.type==="photo"?n.jsxs("a",{href:e.url,className:M.clsx(C.mediaContainer,C.mediaLink),target:"_blank",rel:"noopener noreferrer",children:[n.jsx("div",{className:C.skeleton,style:rt(_,a)}),n.jsx(p,{src:vt(_,"small"),alt:_.ext_alt_text||"Image",className:C.image,draggable:!0})]},_.media_url_https):n.jsxs("div",{className:C.mediaContainer,children:[n.jsx("div",{className:C.skeleton,style:rt(_,a)}),n.jsx(Fn,{tweet:e,media:_})]},_.media_url_https)},_.media_url_https))})})},Un={hour:"numeric",minute:"2-digit",hour12:!0,weekday:"short",month:"short",day:"numeric",year:"numeric"},Hn=new Intl.DateTimeFormat("en-US",Un),zn=e=>{const t={};for(const r of e)t[r.type]=r.value;return t},Gn=e=>{const t=zn(Hn.formatToParts(e)),r=`${t.hour}:${t.minute} ${t.dayPeriod}`,s=`${t.month} ${t.day}, ${t.year}`;return`${r} · ${s}`},Kn="_root_i24yn_1",Xn={root:Kn},Qn=({tweet:e})=>{const t=new Date(e.created_at),r=Gn(t);return n.jsx("a",{className:Xn.root,href:e.url,target:"_blank",rel:"noopener noreferrer","aria-label":r,children:n.jsx("time",{dateTime:t.toISOString(),children:r})})},Jn="_info_19qcj_1",Yn="_infoLink_19qcj_10",Zn="_infoIcon_19qcj_30",ye={info:Jn,infoLink:Yn,infoIcon:Zn},er=({tweet:e})=>n.jsxs("div",{className:ye.info,children:[n.jsx(Qn,{tweet:e}),n.jsx("a",{className:ye.infoLink,href:"https://help.x.com/en/x-for-websites-ads-info-and-privacy",target:"_blank",rel:"noopener noreferrer","aria-label":"Twitter for Websites, Ads Information and Privacy",children:n.jsx("svg",{viewBox:"0 0 24 24","aria-hidden":"true",className:ye.infoIcon,children:n.jsx("g",{children:n.jsx("path",{d:"M13.5 8.5c0 .83-.67 1.5-1.5 1.5s-1.5-.67-1.5-1.5S11.17 7 12 7s1.5.67 1.5 1.5zM13 17v-5h-2v5h2zm-1 5.25c5.66 0 10.25-4.59 10.25-10.25S17.66 1.75 12 1.75 1.75 6.34 1.75 12 6.34 22.25 12 22.25zM20.25 12c0 4.56-3.69 8.25-8.25 8.25S3.75 16.56 3.75 12 7.44 3.75 12 3.75s8.25 3.69 8.25 8.25z"})})})})]}),tr="_actions_n2anf_1",nr="_like_n2anf_13",rr="_reply_n2anf_14",sr="_copy_n2anf_15",or="_likeIconWrapper_n2anf_27",ir="_likeCount_n2anf_30",ar="_replyIconWrapper_n2anf_35",cr="_copyIconWrapper_n2anf_36",lr="_likeIcon_n2anf_27",ur="_replyIcon_n2anf_35",dr="_copyIcon_n2anf_36",fr="_replyText_n2anf_56",_r="_copyText_n2anf_57",L={actions:tr,like:nr,reply:rr,copy:sr,likeIconWrapper:or,likeCount:ir,replyIconWrapper:ar,copyIconWrapper:cr,likeIcon:lr,replyIcon:ur,copyIcon:dr,replyText:fr,copyText:_r},hr=({tweet:e})=>{const[t,r]=x.useState(!1),s=()=>{navigator.clipboard.writeText(e.url),r(!0)};return x.useEffect(()=>{if(t){const o=setTimeout(()=>{r(!1)},6e3);return()=>clearTimeout(o)}},[t]),n.jsxs("button",{type:"button",className:L.copy,"aria-label":"Copy link",onClick:s,children:[n.jsx("div",{className:L.copyIconWrapper,children:t?n.jsx("svg",{viewBox:"0 0 24 24",className:L.copyIcon,"aria-hidden":"true",children:n.jsx("g",{children:n.jsx("path",{d:"M9.64 18.952l-5.55-4.861 1.317-1.504 3.951 3.459 8.459-10.948L19.4 6.32 9.64 18.952z"})})}):n.jsx("svg",{viewBox:"0 0 24 24",className:L.copyIcon,"aria-hidden":"true",children:n.jsx("g",{children:n.jsx("path",{d:"M18.36 5.64c-1.95-1.96-5.11-1.96-7.07 0L9.88 7.05 8.46 5.64l1.42-1.42c2.73-2.73 7.16-2.73 9.9 0 2.73 2.74 2.73 7.17 0 9.9l-1.42 1.42-1.41-1.42 1.41-1.41c1.96-1.96 1.96-5.12 0-7.07zm-2.12 3.53l-7.07 7.07-1.41-1.41 7.07-7.07 1.41 1.41zm-12.02.71l1.42-1.42 1.41 1.42-1.41 1.41c-1.96 1.96-1.96 5.12 0 7.07 1.95 1.96 5.11 1.96 7.07 0l1.41-1.41 1.42 1.41-1.42 1.42c-2.73 2.73-7.16 2.73-9.9 0-2.73-2.74-2.73-7.17 0-9.9z"})})})}),n.jsx("span",{className:L.copyText,children:t?"Copied!":"Copy link"})]})},mr=({tweet:e})=>{const t=Ie(e.favorite_count);return n.jsxs("div",{className:L.actions,children:[n.jsxs("a",{className:L.like,href:e.like_url,target:"_blank",rel:"noopener noreferrer","aria-label":`Like. This Tweet has ${t} likes`,children:[n.jsx("div",{className:L.likeIconWrapper,children:n.jsx("svg",{viewBox:"0 0 24 24",className:L.likeIcon,"aria-hidden":"true",children:n.jsx("g",{children:n.jsx("path",{d:"M20.884 13.19c-1.351 2.48-4.001 5.12-8.379 7.67l-.503.3-.504-.3c-4.379-2.55-7.029-5.19-8.382-7.67-1.36-2.5-1.41-4.86-.514-6.67.887-1.79 2.647-2.91 4.601-3.01 1.651-.09 3.368.56 4.798 2.01 1.429-1.45 3.146-2.1 4.796-2.01 1.954.1 3.714 1.22 4.601 3.01.896 1.81.846 4.17-.514 6.67z"})})})}),n.jsx("span",{className:L.likeCount,children:t})]}),n.jsxs("a",{className:L.reply,href:e.reply_url,target:"_blank",rel:"noopener noreferrer","aria-label":"Reply to this Tweet on Twitter",children:[n.jsx("div",{className:L.replyIconWrapper,children:n.jsx("svg",{viewBox:"0 0 24 24",className:L.replyIcon,"aria-hidden":"true",children:n.jsx("g",{children:n.jsx("path",{d:"M1.751 10c0-4.42 3.584-8 8.005-8h4.366c4.49 0 8.129 3.64 8.129 8.13 0 2.96-1.607 5.68-4.196 7.11l-8.054 4.46v-3.69h-.067c-4.49.1-8.183-3.51-8.183-8.01z"})})})}),n.jsx("span",{className:L.replyText,children:"Reply"})]}),n.jsx(hr,{tweet:e})]})},pr="_replies_1cutb_1",xr="_link_1cutb_4",vr="_text_1cutb_23",Se={replies:pr,link:xr,text:vr},gr=({tweet:e})=>n.jsx("div",{className:Se.replies,children:n.jsx("a",{className:Se.link,href:e.url,target:"_blank",rel:"noopener noreferrer",children:n.jsx("span",{className:Se.text,children:e.conversation_count===0?"Read more on X":e.conversation_count===1?`Read ${Ie(e.conversation_count)} reply`:`Read ${Ie(e.conversation_count)} replies`})})}),jr="_root_q5799_1",wr="_article_q5799_16",st={root:jr,article:wr},yr=({tweet:e,children:t})=>n.jsx("div",{className:st.root,onClick:r=>{r.preventDefault(),window.open(e.url,"_blank")},children:n.jsx("article",{className:st.article,children:t})}),Sr="_header_r31i5_1",Tr="_avatar_r31i5_11",br="_avatarSquare_r31i5_17",Er="_author_r31i5_21",Rr="_authorText_r31i5_26",Or="_username_r31i5_33",Q={header:Sr,avatar:Tr,avatarSquare:br,author:Er,authorText:Rr,username:Or},Nr=({tweet:e})=>{const{user:t}=e;return n.jsxs("div",{className:Q.header,children:[n.jsx("a",{href:e.url,className:Q.avatar,target:"_blank",rel:"noopener noreferrer",children:n.jsx("div",{className:M.clsx(Q.avatarOverflow,t.profile_image_shape==="Square"&&Q.avatarSquare),children:n.jsx(mt,{src:t.profile_image_url_https,alt:t.name,width:20,height:20})})}),n.jsxs("div",{className:Q.author,children:[n.jsx("div",{className:Q.authorText,children:n.jsx("span",{title:t.name,children:t.name})}),n.jsx(pt,{user:t}),n.jsx("div",{className:Q.username,children:n.jsxs("span",{title:`@${t.screen_name}`,children:["@",t.screen_name]})})]})]})},Lr="_root_175ot_1",kr={root:Lr},Ir=({tweet:e})=>n.jsx("p",{className:kr.root,lang:e.lang,dir:"auto",children:e.entities.map((t,r)=>n.jsx("span",{dangerouslySetInnerHTML:{__html:t.text}},r))}),Cr=({tweet:e})=>{var t;return n.jsxs(yr,{tweet:e,children:[n.jsx(Nr,{tweet:e}),n.jsx(Ir,{tweet:e}),(t=e.mediaDetails)!=null&&t.length?n.jsx(gt,{quoted:!0,tweet:e}):null]})},qr=({tweet:e,components:t})=>{var r;const s=x.useMemo(()=>En(e),[e]);return n.jsxs(Fe,{children:[n.jsx(an,{tweet:s,components:t}),s.in_reply_to_status_id_str&&n.jsx(un,{tweet:s}),n.jsx(pn,{tweet:s}),(r=s.mediaDetails)!=null&&r.length?n.jsx(gt,{tweet:s,components:t}):null,s.quoted_tweet&&n.jsx(Cr,{tweet:s.quoted_tweet}),n.jsx(er,{tweet:s}),n.jsx(mr,{tweet:s}),n.jsx(gr,{tweet:s})]})},Dr="_root_16yxa_1",$r={root:Dr},Ar=e=>n.jsx(Fe,{children:n.jsxs("div",{className:$r.root,children:[n.jsx("h3",{children:"Tweet not found"}),n.jsx("p",{children:"The embedded tweet could not be found…"})]})}),Vr="_skeleton_oi7hr_1",Mr={skeleton:Vr},_e=({style:e})=>n.jsx("span",{className:Mr.skeleton,style:e}),Br="_root_17qqv_1",Wr={root:Br},Fr=()=>n.jsxs(Fe,{className:Wr.root,children:[n.jsx(_e,{style:{height:"3rem",marginBottom:"0.75rem"}}),n.jsx(_e,{style:{height:"6rem",margin:"0.5rem 0"}}),n.jsx("div",{style:{borderTop:"var(--tweet-border)",margin:"0.5rem 0"}}),n.jsx(_e,{style:{height:"2rem"}}),n.jsx(_e,{style:{height:"2rem",borderRadius:"9999px",marginTop:"0.5rem"}})]});var he={exports:{}},Te={};/**
|
|
2
2
|
* @license React
|
|
3
3
|
* use-sync-external-store-shim.production.js
|
|
4
4
|
*
|
|
@@ -2,7 +2,7 @@ import { N as $t, m as Vt, H as Mt } from "./index-DI9T3iLd.js";
|
|
|
2
2
|
import { c as H, N as jt, R as Bt } from "./dom-dataset-Di3tIRrR.js";
|
|
3
3
|
import { jsx as r, jsxs as g, Fragment as Wt } from "react/jsx-runtime";
|
|
4
4
|
import de, { useState as ce, Fragment as Ft, useEffect as Pe, useMemo as gt, createContext as Pt, useLayoutEffect as Ut, useContext as Ht, useRef as X, useCallback as Te, useDebugValue as zt } from "react";
|
|
5
|
-
import { L as Gt, o as Kt, B as Xt, P as Qt, m as Jt, A as Yt, k as Zt, n as en } from "./RichTextEditor-
|
|
5
|
+
import { L as Gt, o as Kt, B as Xt, P as Qt, m as Jt, A as Yt, k as Zt, n as en } from "./RichTextEditor-e6q30rbV.js";
|
|
6
6
|
import { u as tn } from "./index-CsK90iVd.js";
|
|
7
7
|
const nn = "_verified_lvyh0_1", Ue = {
|
|
8
8
|
verified: nn
|
package/lib/Twitter.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("./index-ByRfqzMr.cjs");require("./dom-dataset-Byuf1YmW.cjs");const e=require("./Twitter
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("./index-ByRfqzMr.cjs");require("./dom-dataset-Byuf1YmW.cjs");const e=require("./Twitter-D2Osj8qP.cjs");exports.Twitter=e.Twitter;
|
package/lib/Twitter.d.cts
CHANGED
|
@@ -84,8 +84,8 @@ declare module '@tiptap/core' {
|
|
|
84
84
|
|
|
85
85
|
declare module '@tiptap/core' {
|
|
86
86
|
interface Commands<ReturnType> {
|
|
87
|
-
|
|
88
|
-
|
|
87
|
+
exportPdf: {
|
|
88
|
+
exportToPdf: () => ReturnType;
|
|
89
89
|
};
|
|
90
90
|
}
|
|
91
91
|
}
|
|
@@ -93,8 +93,8 @@ declare module '@tiptap/core' {
|
|
|
93
93
|
|
|
94
94
|
declare module '@tiptap/core' {
|
|
95
95
|
interface Commands<ReturnType> {
|
|
96
|
-
|
|
97
|
-
|
|
96
|
+
excalidraw: {
|
|
97
|
+
setExcalidraw: (attrs?: IExcalidrawAttrs) => ReturnType;
|
|
98
98
|
};
|
|
99
99
|
}
|
|
100
100
|
}
|
package/lib/Twitter.d.ts
CHANGED
|
@@ -84,8 +84,8 @@ declare module '@tiptap/core' {
|
|
|
84
84
|
|
|
85
85
|
declare module '@tiptap/core' {
|
|
86
86
|
interface Commands<ReturnType> {
|
|
87
|
-
|
|
88
|
-
|
|
87
|
+
exportPdf: {
|
|
88
|
+
exportToPdf: () => ReturnType;
|
|
89
89
|
};
|
|
90
90
|
}
|
|
91
91
|
}
|
|
@@ -93,8 +93,8 @@ declare module '@tiptap/core' {
|
|
|
93
93
|
|
|
94
94
|
declare module '@tiptap/core' {
|
|
95
95
|
interface Commands<ReturnType> {
|
|
96
|
-
|
|
97
|
-
|
|
96
|
+
excalidraw: {
|
|
97
|
+
setExcalidraw: (attrs?: IExcalidrawAttrs) => ReturnType;
|
|
98
98
|
};
|
|
99
99
|
}
|
|
100
100
|
}
|
package/lib/Twitter.js
CHANGED
package/lib/Video.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("./index-ByRfqzMr.cjs");require("./index-D_A0TBRA.cjs");const e=require("./RichTextEditor-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("./index-ByRfqzMr.cjs");require("./index-D_A0TBRA.cjs");const e=require("./RichTextEditor-DsUcQSbm.cjs");exports.Video=e.Video;
|
package/lib/Video.d.cts
CHANGED
|
@@ -67,6 +67,8 @@ declare interface GeneralOptions<T> {
|
|
|
67
67
|
button: ButtonView<T>;
|
|
68
68
|
/** Show on Toolbar */
|
|
69
69
|
toolbar?: boolean;
|
|
70
|
+
/** Shortcut keys override */
|
|
71
|
+
shortcutKeys?: string[] | string[][];
|
|
70
72
|
}
|
|
71
73
|
|
|
72
74
|
export declare const Video: Node_2<VideoOptions, any>;
|
|
@@ -167,8 +169,8 @@ declare module '@tiptap/core' {
|
|
|
167
169
|
|
|
168
170
|
declare module '@tiptap/core' {
|
|
169
171
|
interface Commands<ReturnType> {
|
|
170
|
-
|
|
171
|
-
|
|
172
|
+
exportPdf: {
|
|
173
|
+
exportToPdf: () => ReturnType;
|
|
172
174
|
};
|
|
173
175
|
}
|
|
174
176
|
}
|
|
@@ -176,8 +178,8 @@ declare module '@tiptap/core' {
|
|
|
176
178
|
|
|
177
179
|
declare module '@tiptap/core' {
|
|
178
180
|
interface Commands<ReturnType> {
|
|
179
|
-
|
|
180
|
-
|
|
181
|
+
excalidraw: {
|
|
182
|
+
setExcalidraw: (attrs?: IExcalidrawAttrs) => ReturnType;
|
|
181
183
|
};
|
|
182
184
|
}
|
|
183
185
|
}
|
package/lib/Video.d.ts
CHANGED
|
@@ -67,6 +67,8 @@ declare interface GeneralOptions<T> {
|
|
|
67
67
|
button: ButtonView<T>;
|
|
68
68
|
/** Show on Toolbar */
|
|
69
69
|
toolbar?: boolean;
|
|
70
|
+
/** Shortcut keys override */
|
|
71
|
+
shortcutKeys?: string[] | string[][];
|
|
70
72
|
}
|
|
71
73
|
|
|
72
74
|
export declare const Video: Node_2<VideoOptions, any>;
|
|
@@ -167,8 +169,8 @@ declare module '@tiptap/core' {
|
|
|
167
169
|
|
|
168
170
|
declare module '@tiptap/core' {
|
|
169
171
|
interface Commands<ReturnType> {
|
|
170
|
-
|
|
171
|
-
|
|
172
|
+
exportPdf: {
|
|
173
|
+
exportToPdf: () => ReturnType;
|
|
172
174
|
};
|
|
173
175
|
}
|
|
174
176
|
}
|
|
@@ -176,8 +178,8 @@ declare module '@tiptap/core' {
|
|
|
176
178
|
|
|
177
179
|
declare module '@tiptap/core' {
|
|
178
180
|
interface Commands<ReturnType> {
|
|
179
|
-
|
|
180
|
-
|
|
181
|
+
excalidraw: {
|
|
182
|
+
setExcalidraw: (attrs?: IExcalidrawAttrs) => ReturnType;
|
|
181
183
|
};
|
|
182
184
|
}
|
|
183
185
|
}
|
package/lib/Video.js
CHANGED
package/lib/bubble-extra.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var V=Object.create;var q=Object.defineProperty;var _=Object.getOwnPropertyDescriptor;var G=Object.getOwnPropertyNames;var Z=Object.getPrototypeOf,J=Object.prototype.hasOwnProperty;var Q=(e,n,s,c)=>{if(n&&typeof n=="object"||typeof n=="function")for(let i of G(n))!J.call(e,i)&&i!==s&&q(e,i,{get:()=>n[i],enumerable:!(c=_(n,i))||c.enumerable});return e};var X=(e,n,s)=>(s=e!=null?V(Z(e)):{},Q(n||!e||!e.__esModule?q(s,"default",{value:e,enumerable:!0}):s,e));Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react/jsx-runtime"),a=require("react"),k=require("./dom-dataset-Byuf1YmW.cjs"),o=require("./RichTextEditor-
|
|
1
|
+
"use strict";var V=Object.create;var q=Object.defineProperty;var _=Object.getOwnPropertyDescriptor;var G=Object.getOwnPropertyNames;var Z=Object.getPrototypeOf,J=Object.prototype.hasOwnProperty;var Q=(e,n,s,c)=>{if(n&&typeof n=="object"||typeof n=="function")for(let i of G(n))!J.call(e,i)&&i!==s&&q(e,i,{get:()=>n[i],enumerable:!(c=_(n,i))||c.enumerable});return e};var X=(e,n,s)=>(s=e!=null?V(Z(e)):{},Q(n||!e||!e.__esModule?q(s,"default",{value:e,enumerable:!0}):s,e));Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react/jsx-runtime"),a=require("react"),k=require("./dom-dataset-Byuf1YmW.cjs"),o=require("./RichTextEditor-DsUcQSbm.cjs"),L=require("./Mermaid.cjs"),E=require("./shortId-Bfj8TyNr.cjs"),H=require("./textarea-BVbzd9-k.cjs"),D=require("./index-D_A0TBRA.cjs"),M=require("./Excalidraw-BI50RQL-.cjs"),W=require("./Twitter-D2Osj8qP.cjs"),Y=require("katex"),F=require("lucide-react"),B=require("./Katex.cjs"),O=require("./Drawer-DCAp7eZF.cjs"),R=require("easydrawer"),$=`graph TB
|
|
2
2
|
a-->b`,ee=({editor:e,attrs:n,extension:s})=>{const{alt:c,align:i}=n,[r,l]=a.useState(decodeURIComponent(c??$)),[u,x]=a.useState(""),[f,b]=a.useState(!1),p=a.useRef(null),[g,y]=a.useState(null),S=s==null?void 0:s.options.upload,I=a.useCallback(w=>{w&&import("mermaid").then(j=>{y(j.default)})},[]),T=async w=>{try{const{svg:j}=await g.render("mermaid-svg",w);x(j)}catch{x("")}},N=()=>{g.initialize({darkMode:!1,startOnLoad:!1,fontSize:12,theme:"base"}),T(r)};a.useEffect(()=>{g&&f&&N()},[g,f]),a.useEffect(()=>{g&&f&&T(r)},[g,r]);const A=async()=>{if(r!==""){if(r){const w=p.current.querySelector("svg"),{width:j,height:z}=w.getBoundingClientRect(),m=`mermaid-${E.shortId()}.svg`;let d=E.i(w.outerHTML);if(S){const h=o.dataURLtoFile(d,m);d=await S(h)}e==null||e.chain().focus().setMermaid({type:"mermaid",src:d,alt:encodeURIComponent(r),width:j,height:z},!!r).run(),e==null||e.commands.setAlignImageMermaid(i)}b(!1)}};return t.jsxs(o.Dialog,{onOpenChange:b,open:f,children:[t.jsx(o.DialogTrigger,{asChild:!0,children:t.jsx(o.ActionButton,{action:()=>b(!0),icon:"Pencil",tooltip:"Edit Mermaid"})}),t.jsxs(o.DialogContent,{className:"richtext-z-[99999] !richtext-max-w-[1300px]",children:[t.jsx(o.DialogTitle,{children:"Edit Mermaid"}),t.jsx("div",{ref:I,style:{height:"100%",border:"1px solid hsl(var(--border))"},children:t.jsxs("div",{className:"richtext-flex richtext-gap-[10px] richtext-rounded-[10px] richtext-p-[10px]",children:[t.jsx(H.Textarea,{autoFocus:!0,className:"richtext-flex-1",defaultValue:$,onChange:w=>l(w.target.value),placeholder:"Text",required:!0,rows:10,value:r,style:{color:"hsl(var(--richtext-foreground))"}}),t.jsx("div",{className:"richtext-flex richtext-flex-1 richtext-items-center richtext-justify-center richtext-rounded-[10px] richtext-p-[10px]",dangerouslySetInnerHTML:{__html:u},ref:p,style:{height:"100%",border:"1px solid hsl(var(--border))",minHeight:500,background:"#fff"}})]})}),t.jsx(o.DialogFooter,{children:t.jsx(o.Button,{onClick:A,type:"button",children:"Save changes"})})]})]})};function K(e,n){const[s,c]=a.useState(void 0);return a.useEffect(()=>{const i=()=>{const r=e.extensionManager.extensions.find(l=>l.name===n);r&&c(r)};return e.on("selectionUpdate",i),e.on("transaction",i),()=>{e.off("selectionUpdate",i),e.off("transaction",i)}},[e,n]),s}const te={maxWidth:"auto",zIndex:20,appendTo:"parent",moveTransition:"transform 0.1s ease-out"};function re({item:e,disabled:n,editor:s}){var i;const c=e.component;return c?t.jsx(a.Fragment,{children:e.type==="divider"?t.jsx(o.Separator,{className:"!richtext-mx-1 !richtext-my-2 !richtext-h-[16px]",orientation:"vertical"}):t.jsx(c,{...e.componentProps,disabled:n||((i=e==null?void 0:e.componentProps)==null?void 0:i.disabled),editor:s})}):t.jsx(t.Fragment,{})}function ne(e){return e.type.name==="mermaid"}function ie(e){const{lang:n}=D.useLocale(),s=o.useAttributes(e.editor,L.Mermaid.name),c=K(e.editor,L.Mermaid.name),i=({editor:l})=>{const{selection:u}=l.view.state,{$from:x,to:f}=u;let b=!1;return l.view.state.doc.nodesBetween(x.pos,f,p=>{if(ne(p))return b=!0,!1}),b},r=a.useMemo(()=>e.disabled?[]:o.getBubbleMermaid(e.editor),[e.disabled,e.editor,n]);return t.jsx(t.Fragment,{children:t.jsx(k.BubbleMenu,{editor:e==null?void 0:e.editor,shouldShow:i,tippyOptions:te,children:r!=null&&r.length?t.jsx("div",{className:"richtext-pointer-events-auto richtext-w-auto richtext-select-none richtext-rounded-sm !richtext-border richtext-border-neutral-200 richtext-bg-background richtext-px-3 richtext-py-2 richtext-shadow-sm richtext-transition-all dark:richtext-border-neutral-800",children:t.jsx("div",{className:"richtext-relative richtext-flex richtext-h-[26px] richtext-flex-nowrap richtext-items-center richtext-justify-start richtext-whitespace-nowrap",children:r==null?void 0:r.map((l,u)=>l.type==="edit"&&(s!=null&&s.src)?t.jsx(ee,{attrs:s,editor:e.editor,extension:c},`bubbleMenu-mermaid-${u}`):t.jsx(re,{disabled:e.disabled,editor:e.editor,item:l},`bubbleMenu-mermaid-${u}`))})}):t.jsx(t.Fragment,{})})})}const v=new Map;function se(e){const n=e.options.element;v.has("width")||v.set("width",n.clientWidth),v.has("width")&&v.get("width")<=0&&v.set("width",n.clientWidth);const s={attributes:!0,childList:!0,subtree:!0},c=function(){v.set("width",n.clientWidth)},i=new MutationObserver(c);return i.observe(n,s),e.on("destroy",()=>{i.disconnect()}),{width:v.get("width")}}function oe({editor:e}){const{t:n}=D.useLocale(),{width:s}=se(e),c=o.useAttributes(e,M.Excalidraw.name,{defaultShowPicker:!1,createUser:"",width:0,height:0}),{defaultShowPicker:i,createUser:r,width:l,height:u}=c,x=a.useCallback(g=>{e.chain().updateAttributes(M.Excalidraw.name,g).setNodeSelection(e.state.selection.from).focus().run()},[e]),f=a.useCallback(()=>{M.triggerOpenExcalidrawSettingModal({...c,editor:e})},[e,c]),b=a.useCallback(()=>e.isActive(M.Excalidraw.name),[e]),p=a.useCallback(()=>o.deleteNode(M.Excalidraw.name,e),[e]);return a.useEffect(()=>{i&&(f(),e.chain().updateAttributes(M.Excalidraw.name,{defaultShowPicker:!1}).focus().run())},[r,i,e,f]),t.jsx(k.BubbleMenu,{className:"bubble-menu",editor:e,pluginKey:"excalidraw-bubble-menu",shouldShow:b,tippyOptions:{popperOptions:{modifiers:[{name:"flip",enabled:!1}]},placement:"bottom-start",offset:[-2,16],zIndex:9999},children:t.jsxs("div",{className:"richtext-w-auto richtext-px-3 richtext-py-2 richtext-transition-all !richtext-border richtext-rounded-sm richtext-shadow-sm richtext-pointer-events-auto richtext-select-none richtext-border-neutral-200 dark:richtext-border-neutral-800 richtext-bg-background",children:[t.jsx(o.ActionButton,{icon:"Pencil",action:f,tooltip:n("editor.edit")}),t.jsx(o.SizeSetter,{width:l,maxWidth:s,height:u,onOk:x,children:t.jsx(o.ActionButton,{icon:"Settings",tooltip:n("editor.settings")})}),t.jsx(o.ActionButton,{icon:"Trash2",action:p,tooltip:n("editor.delete")})]})})}function ae({editor:e,disabled:n}){const[s,c]=a.useState(!1),{t:i}=D.useLocale(),r=a.useCallback(({editor:x})=>x.isActive(W.Twitter.name),[]),l=x=>{e.commands.updateTweet({src:x}),c(!1)},u=a.useCallback(()=>o.deleteNode(W.Twitter.name,e),[e]);return t.jsx(t.Fragment,{children:t.jsx(k.BubbleMenu,{editor:e,shouldShow:r,tippyOptions:{popperOptions:{modifiers:[{name:"flip",enabled:!1}]},placement:"bottom-start",offset:[-2,16],zIndex:9999,onHidden:()=>{c(!1)}},children:n?t.jsx(t.Fragment,{}):t.jsx(t.Fragment,{children:s?t.jsx(W.FormEditLinkTwitter,{editor:e,onSetLink:l}):t.jsx("div",{className:"richtext-flex richtext-items-center richtext-gap-2 richtext-rounded-lg !richtext-border richtext-border-neutral-200 richtext-bg-white richtext-p-2 richtext-shadow-sm dark:richtext-border-neutral-800 dark:richtext-bg-black",children:t.jsxs("div",{className:"richtext-flex richtext-flex-nowrap",children:[t.jsx(o.ActionButton,{icon:"Pencil",tooltip:i("editor.link.edit.tooltip"),tooltipOptions:{sideOffset:15},action:()=>{c(!0)}}),t.jsx(o.ActionButton,{action:u,icon:"Trash",tooltip:i("editor.delete"),tooltipOptions:{sideOffset:15}})]})})})})})}function ce({editor:e,...n}){const s=o.useAttributes(e,B.Katex.name,{text:"",defaultShowPicker:!1}),{text:c,defaultShowPicker:i}=s,[r,l]=a.useState(""),[u,x]=a.useState(!1),f=a.useCallback(()=>e.isActive(B.Katex.name),[e]),b=a.useCallback(()=>o.deleteNode(B.Katex.name,e),[e]),p=a.useCallback(()=>{e.chain().focus().setKatex({text:r}).run(),x(!1)},[e,r]);a.useEffect(()=>{i&&(x(!0),e.chain().updateAttributes(B.Katex.name,{defaultShowPicker:!1}).focus().run())},[e,i,x]),a.useEffect(()=>{u&&l(c||"")},[u]);const g=a.useMemo(()=>{try{return Y.renderToString(`${r}`)}catch{return r}},[r]),y=a.useMemo(()=>`${r}`.trim()?t.jsx("span",{contentEditable:!1,dangerouslySetInnerHTML:{__html:g||""}}):null,[r,g]);return t.jsx(k.BubbleMenu,{editor:e,pluginKey:"Katex-bubble-menu",shouldShow:f,tippyOptions:{popperOptions:{modifiers:[{name:"flip",enabled:!1}]},placement:"bottom-start",offset:[-2,16],zIndex:9999,onHidden:()=>{x(!1)}},children:n!=null&&n.disabled?t.jsx(t.Fragment,{}):t.jsx("div",{className:"richtext-rounded-lg !richtext-border richtext-border-neutral-200 richtext-bg-white richtext-p-2 richtext-shadow-sm dark:richtext-border-neutral-800 dark:richtext-bg-black",children:u?t.jsxs(t.Fragment,{children:[t.jsx(H.Textarea,{autoFocus:!0,defaultValue:c,onChange:S=>l(S.target.value),placeholder:"Formula text",rows:3,style:{marginBottom:8},value:r}),y&&t.jsx("div",{className:"richtext-my-[10px] richtext-overflow-auto richtext-whitespace-nowrap richtext-rounded-[6px] !richtext-border richtext-p-[10px]",children:y}),t.jsxs("div",{className:"richtext-flex richtext-items-center richtext-justify-between richtext-gap-[6px]",children:[t.jsx(o.Button,{className:"richtext-flex-1",onClick:p,children:"Submit"}),t.jsx("a",{href:"https://katex.org/docs/supported",rel:"noreferrer noopener",target:"_blank",children:t.jsx(F.HelpCircle,{size:16})})]})]}):t.jsxs("div",{className:"richtext-flex richtext-items-center richtext-justify-center richtext-gap-[6px]",children:[t.jsx(o.ActionButton,{action:()=>x(!u),tooltip:"Edit",children:t.jsx(F.Pencil,{size:16})}),t.jsx(o.ActionButton,{action:b,tooltip:"Delete",children:t.jsx(F.Trash2,{size:16})})]})})})}let C=!1;function le({editor:e,attrs:n,extension:s}){const[c,i]=a.useState(!1),r=a.useRef(null),l=a.useRef(null),{alt:u,align:x}=n,f=s==null?void 0:s.options.upload,b=()=>{(async()=>{const d=document.querySelector("#easydrawer");d&&(r.current=new R.Editor(d,{wheelEventsEnabled:!1,disableZoom:!0}),l.current=R.makeDropdownToolbar(r.current),l.current.addDefaultToolWidgets(),r.current.loadFromSVG(decodeURIComponent(u)))})()};a.useEffect(()=>{c&&setTimeout(()=>{b()},200)},[c]);const p=async()=>{if(r.current){const m=r.current.toSVG(),d=m.outerHTML,h=`drawer-${E.shortId()}.svg`;let P=E.i(m.outerHTML);if(f){const U=o.dataURLtoFile(P,h);P=await f(U)}e==null||e.chain().focus().setDrawer({type:"drawer",src:P,alt:encodeURIComponent(d),width:426,height:212},!!d).run(),e==null||e.commands.setAlignImageDrawer(x)}i(!1)},g=m=>{const d=r.current.toolController.getPrimaryTools()[2],h=l.current.getWidgetById("pen-1");d&&h&&(d.setColor(m),h.serializeState())},y=m=>{const d=r.current.toolController.getPrimaryTools()[2],h=l.current.getWidgetById("pen-1");d&&h&&(d.setThickness(m),h.serializeState())},S=m=>{const d=r.current.toolController.getPrimaryTools()[3],h=l.current.getWidgetById("pen-2");d&&h&&(d.setColor(m),h.serializeState())},I=m=>{const d=l.current.getWidgetById("shape");d&&d.setShapeType(m)},T=m=>{const d=r.current.toolController.getPrimaryTools()[5],h=l.current.getWidgetById("shape");d&&h&&(d.setColor(m),h.serializeState())},N=m=>{const d=r.current.toolController.getPrimaryTools()[5],h=l.current.getWidgetById("shape");d&&h&&(d.setThickness(m),h.serializeState())},A=m=>{const d=r.current.toolController.getPrimaryTools()[5],h=l.current.getWidgetById("shape");d&&h&&(d.setBorderColor(m),h.serializeState())},w=()=>{if(C){for(;r.current.history.redoStackSize>0;)r.current.history.redo();C=!1;return}r.current.history.undo()},j=()=>{C||r.current.history.redo()},z=()=>{if(!C){for(;r.current.history.undoStackSize>0;)w();C=!0}};return t.jsxs(o.Dialog,{onOpenChange:i,open:c,children:[t.jsx(o.DialogTrigger,{asChild:!0,children:t.jsx(o.ActionButton,{action:()=>i(!0),icon:"Pencil",tooltip:"Edit Drawer"})}),t.jsxs(o.DialogContent,{className:"richtext-z-[99999] !richtext-max-w-[1300px]",children:[t.jsx(o.DialogTitle,{children:"Edit Drawer"}),t.jsxs("div",{style:{height:"100%",borderWidth:1,background:"white",position:"relative"},children:[t.jsx("div",{className:"richtext-size-full",id:"easydrawer"}),t.jsx(O.ControlDrawer,{changeBorderColorShape:A,changeColorShape:T,changeShape:I,onClear:z,onRedo:j,onThicknessChange:N,onUndo:w,refEditor:r,setColorHighlight:S,setColorPen:g,setThicknessPen:y})]}),t.jsx(o.DialogFooter,{children:t.jsx(o.Button,{onClick:p,type:"button",children:"Save changes"})})]})]})}const de={maxWidth:"auto",zIndex:20,appendTo:"parent",moveTransition:"transform 0.1s ease-out"};function ue({item:e,disabled:n,editor:s}){var i;const c=e.component;return c?t.jsx(a.Fragment,{children:e.type==="divider"?t.jsx(o.Separator,{className:"!richtext-mx-1 !richtext-my-2 !richtext-h-[16px]",orientation:"vertical"}):t.jsx(c,{...e.componentProps,disabled:n||((i=e==null?void 0:e.componentProps)==null?void 0:i.disabled),editor:s})}):t.jsx(t.Fragment,{})}function he(e){return e.type.name==="drawer"}function xe(e){const{lang:n}=D.useLocale(),s=o.useAttributes(e.editor,O.Drawer.name),c=K(e.editor,O.Drawer.name),i=({editor:l})=>{const{selection:u}=l.view.state,{$from:x,to:f}=u;let b=!1;return l.view.state.doc.nodesBetween(x.pos,f,p=>{if(he(p))return b=!0,!1}),b},r=a.useMemo(()=>e.disabled?[]:o.getBubbleDrawer(e.editor),[e.disabled,e.editor,n]);return t.jsx(k.BubbleMenu,{editor:e==null?void 0:e.editor,shouldShow:i,tippyOptions:de,children:r!=null&&r.length?t.jsx("div",{className:"richtext-pointer-events-auto richtext-w-auto richtext-select-none richtext-rounded-sm !richtext-border richtext-border-neutral-200 richtext-bg-background richtext-px-3 richtext-py-2 richtext-shadow-sm richtext-transition-all dark:richtext-border-neutral-800",children:t.jsx("div",{className:"richtext-relative richtext-flex richtext-h-[26px] richtext-flex-nowrap richtext-items-center richtext-justify-start richtext-whitespace-nowrap",children:r==null?void 0:r.map((l,u)=>l.type==="edit"&&(s!=null&&s.src)?t.jsx(le,{attrs:s,editor:e.editor,extension:c},`bubbleMenu-drawer-${u}`):t.jsx(ue,{disabled:e.disabled,editor:e.editor,item:l},`bubbleMenu-drawer-${u}`))})}):t.jsx(t.Fragment,{})})}exports.BubbleMenuDrawer=xe;exports.BubbleMenuExcalidraw=oe;exports.BubbleMenuKatex=ce;exports.BubbleMenuMermaid=ie;exports.BubbleMenuTwitter=ae;
|
package/lib/bubble-extra.d.cts
CHANGED
|
@@ -83,8 +83,8 @@ declare module '@tiptap/core' {
|
|
|
83
83
|
|
|
84
84
|
declare module '@tiptap/core' {
|
|
85
85
|
interface Commands<ReturnType> {
|
|
86
|
-
|
|
87
|
-
|
|
86
|
+
exportPdf: {
|
|
87
|
+
exportToPdf: () => ReturnType;
|
|
88
88
|
};
|
|
89
89
|
}
|
|
90
90
|
}
|
|
@@ -92,8 +92,8 @@ declare module '@tiptap/core' {
|
|
|
92
92
|
|
|
93
93
|
declare module '@tiptap/core' {
|
|
94
94
|
interface Commands<ReturnType> {
|
|
95
|
-
|
|
96
|
-
|
|
95
|
+
excalidraw: {
|
|
96
|
+
setExcalidraw: (attrs?: IExcalidrawAttrs) => ReturnType;
|
|
97
97
|
};
|
|
98
98
|
}
|
|
99
99
|
}
|
package/lib/bubble-extra.d.ts
CHANGED
|
@@ -83,8 +83,8 @@ declare module '@tiptap/core' {
|
|
|
83
83
|
|
|
84
84
|
declare module '@tiptap/core' {
|
|
85
85
|
interface Commands<ReturnType> {
|
|
86
|
-
|
|
87
|
-
|
|
86
|
+
exportPdf: {
|
|
87
|
+
exportToPdf: () => ReturnType;
|
|
88
88
|
};
|
|
89
89
|
}
|
|
90
90
|
}
|
|
@@ -92,8 +92,8 @@ declare module '@tiptap/core' {
|
|
|
92
92
|
|
|
93
93
|
declare module '@tiptap/core' {
|
|
94
94
|
interface Commands<ReturnType> {
|
|
95
|
-
|
|
96
|
-
|
|
95
|
+
excalidraw: {
|
|
96
|
+
setExcalidraw: (attrs?: IExcalidrawAttrs) => ReturnType;
|
|
97
97
|
};
|
|
98
98
|
}
|
|
99
99
|
}
|
package/lib/bubble-extra.js
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import { jsxs as b, jsx as t, Fragment as v } from "react/jsx-runtime";
|
|
2
2
|
import { useState as y, useRef as L, useCallback as w, useEffect as T, useMemo as W, Fragment as G } from "react";
|
|
3
3
|
import { B as z } from "./dom-dataset-Di3tIRrR.js";
|
|
4
|
-
import { w as Z, x as J, A as S, y as Q, z as X, F as Y, B as H, G as ee, O as D, a1 as ce, a2 as te, a3 as R, a4 as se, a5 as le } from "./RichTextEditor-
|
|
4
|
+
import { w as Z, x as J, A as S, y as Q, z as X, F as Y, B as H, G as ee, O as D, a1 as ce, a2 as te, a3 as R, a4 as se, a5 as le } from "./RichTextEditor-e6q30rbV.js";
|
|
5
5
|
import { Mermaid as j } from "./Mermaid.js";
|
|
6
6
|
import { s as re, i as ne } from "./shortId-WJVkrvml.js";
|
|
7
|
-
import { T as ie } from "./textarea-
|
|
7
|
+
import { T as ie } from "./textarea-Csmx5x-_.js";
|
|
8
8
|
import { u as O } from "./index-CsK90iVd.js";
|
|
9
|
-
import { E as I, t as de } from "./Excalidraw-
|
|
10
|
-
import { T as K, F as he } from "./Twitter-
|
|
9
|
+
import { E as I, t as de } from "./Excalidraw-CYPcjYZB.js";
|
|
10
|
+
import { T as K, F as he } from "./Twitter-Wb7cD3M-.js";
|
|
11
11
|
import ue from "katex";
|
|
12
12
|
import { HelpCircle as me, Pencil as xe, Trash2 as fe } from "lucide-react";
|
|
13
13
|
import { Katex as P } from "./Katex.js";
|
|
14
|
-
import { C as pe, D as _ } from "./Drawer-
|
|
14
|
+
import { C as pe, D as _ } from "./Drawer-BCmNLh31.js";
|
|
15
15
|
import { Editor as ge, makeDropdownToolbar as be } from "easydrawer";
|
|
16
16
|
const q = `graph TB
|
|
17
17
|
a-->b`, we = ({ editor: e, attrs: s, extension: o }) => {
|
package/lib/index.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const p=require("react"),C=require("./RichTextEditor-DoMu_nCj.cjs"),x=require("./dom-dataset-Byuf1YmW.cjs"),a=require("./index-ByRfqzMr.cjs"),b=require("./ListItem.cjs"),S=require("./index-DclQSrIx.cjs"),v=require("./Document.cjs"),k=require("./Selection.cjs"),P=require("./TextBubble.cjs"),M=require("./TrailingNode.cjs"),m=require("./index-D_A0TBRA.cjs");function T(){var l;const t=p.useRef({editor:null}),[e,i]=p.useState(!1),[o,r]=p.useState(null);return p.useEffect(()=>{var s;(s=t.current)!=null&&s.editor&&(i(!0),r(t.current.editor))},[t,(l=t.current)==null?void 0:l.editor]),{isReady:e,editor:o,editorRef:t}}const E=a.Extension.create({name:"characterCount",addOptions(){return{limit:null,mode:"textSize",textCounter:t=>t.length,wordCounter:t=>t.split(" ").filter(e=>e!=="").length}},addStorage(){return{characters:()=>0,words:()=>0}},onBeforeCreate(){this.storage.characters=t=>{const e=(t==null?void 0:t.node)||this.editor.state.doc;if(((t==null?void 0:t.mode)||this.options.mode)==="textSize"){const o=e.textBetween(0,e.content.size,void 0," ");return this.options.textCounter(o)}return e.nodeSize},this.storage.words=t=>{const e=(t==null?void 0:t.node)||this.editor.state.doc,i=e.textBetween(0,e.content.size," "," ");return this.options.wordCounter(i)}},addProseMirrorPlugins(){let t=!1;return[new a.Plugin({key:new a.PluginKey("characterCount"),appendTransaction:(e,i,o)=>{if(t)return;const r=this.options.limit;if(r==null||r===0){t=!0;return}const l=this.storage.characters({node:o.doc});if(l>r){const s=l-r,n=0,c=s;console.warn(`[CharacterCount] Initial content exceeded limit of ${r} characters. Content was automatically trimmed.`);const u=o.tr.deleteRange(n,c);return t=!0,u}t=!0},filterTransaction:(e,i)=>{const o=this.options.limit;if(!e.docChanged||o===0||o===null||o===void 0)return!0;const r=this.storage.characters({node:i.doc}),l=this.storage.characters({node:e.doc});if(l<=o||r>o&&l>o&&l<=r)return!0;if(r>o&&l>o&&l>r||!e.getMeta("paste"))return!1;const n=e.selection.$head.pos,c=l-o,u=n-c,h=n;return e.deleteRange(u,h),!(this.storage.characters({node:e.doc})>o)}})]}});function A(t={}){return new a.Plugin({view(e){return new O(e,t)}})}class O{constructor(e,i){var o;this.editorView=e,this.cursorPos=null,this.element=null,this.timeout=-1,this.width=(o=i.width)!==null&&o!==void 0?o:1,this.color=i.color===!1?void 0:i.color||"black",this.class=i.class,this.handlers=["dragover","dragend","drop","dragleave"].map(r=>{let l=s=>{this[r](s)};return e.dom.addEventListener(r,l),{name:r,handler:l}})}destroy(){this.handlers.forEach(({name:e,handler:i})=>this.editorView.dom.removeEventListener(e,i))}update(e,i){this.cursorPos!=null&&i.doc!=e.state.doc&&(this.cursorPos>e.state.doc.content.size?this.setCursor(null):this.updateOverlay())}setCursor(e){e!=this.cursorPos&&(this.cursorPos=e,e==null?(this.element.parentNode.removeChild(this.element),this.element=null):this.updateOverlay())}updateOverlay(){let e=this.editorView.state.doc.resolve(this.cursorPos),i=!e.parent.inlineContent,o;if(i){let n=e.nodeBefore,c=e.nodeAfter;if(n||c){let u=this.editorView.nodeDOM(this.cursorPos-(n?n.nodeSize:0));if(u){let h=u.getBoundingClientRect(),f=n?h.bottom:h.top;n&&c&&(f=(f+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2),o={left:h.left,right:h.right,top:f-this.width/2,bottom:f+this.width/2}}}}if(!o){let n=this.editorView.coordsAtPos(this.cursorPos);o={left:n.left-this.width/2,right:n.left+this.width/2,top:n.top,bottom:n.bottom}}let r=this.editorView.dom.offsetParent;this.element||(this.element=r.appendChild(document.createElement("div")),this.class&&(this.element.className=this.class),this.element.style.cssText="position: absolute; z-index: 50; pointer-events: none;",this.color&&(this.element.style.backgroundColor=this.color)),this.element.classList.toggle("prosemirror-dropcursor-block",i),this.element.classList.toggle("prosemirror-dropcursor-inline",!i);let l,s;if(!r||r==document.body&&getComputedStyle(r).position=="static")l=-pageXOffset,s=-pageYOffset;else{let n=r.getBoundingClientRect();l=n.left-r.scrollLeft,s=n.top-r.scrollTop}this.element.style.left=o.left-l+"px",this.element.style.top=o.top-s+"px",this.element.style.width=o.right-o.left+"px",this.element.style.height=o.bottom-o.top+"px"}scheduleRemoval(e){clearTimeout(this.timeout),this.timeout=setTimeout(()=>this.setCursor(null),e)}dragover(e){if(!this.editorView.editable)return;let i=this.editorView.posAtCoords({left:e.clientX,top:e.clientY}),o=i&&i.inside>=0&&this.editorView.state.doc.nodeAt(i.inside),r=o&&o.type.spec.disableDropCursor,l=typeof r=="function"?r(this.editorView,i,e):r;if(i&&!l){let s=i.pos;if(this.editorView.dragging&&this.editorView.dragging.slice){let n=a.dropPoint(this.editorView.state.doc,s,this.editorView.dragging.slice);n!=null&&(s=n)}this.setCursor(s),this.scheduleRemoval(5e3)}}dragend(){this.scheduleRemoval(20)}drop(){this.scheduleRemoval(20)}dragleave(e){(e.target==this.editorView.dom||!this.editorView.dom.contains(e.relatedTarget))&&this.setCursor(null)}}const B=a.Extension.create({name:"dropCursor",addOptions(){return{color:"currentColor",width:1,class:void 0}},addProseMirrorPlugins(){return[A(this.options)]}}),N=a.Extension.create({name:"focus",addOptions(){return{className:"has-focus",mode:"all"}},addProseMirrorPlugins(){return[new a.Plugin({key:new a.PluginKey("focus"),props:{decorations:({doc:t,selection:e})=>{const{isEditable:i,isFocused:o}=this.editor,{anchor:r}=e,l=[];if(!i||!o)return a.DecorationSet.create(t,[]);let s=0;this.options.mode==="deepest"&&t.descendants((c,u)=>{if(c.isText)return;if(!(r>=u&&r<=u+c.nodeSize-1))return!1;s+=1});let n=0;return t.descendants((c,u)=>{if(c.isText||!(r>=u&&r<=u+c.nodeSize-1))return!1;if(n+=1,this.options.mode==="deepest"&&s-n>0||this.options.mode==="shallowest"&&n>1)return this.options.mode==="deepest";l.push(a.Decoration.node(u,u+c.nodeSize,{class:this.options.className}))}),a.DecorationSet.create(t,l)}}})]}});class d extends a.Selection{constructor(e){super(e,e)}map(e,i){let o=e.resolve(i.map(this.head));return d.valid(o)?new d(o):a.Selection.near(o)}content(){return a.Slice.empty}eq(e){return e instanceof d&&e.head==this.head}toJSON(){return{type:"gapcursor",pos:this.head}}static fromJSON(e,i){if(typeof i.pos!="number")throw new RangeError("Invalid input for GapCursor.fromJSON");return new d(e.resolve(i.pos))}getBookmark(){return new y(this.anchor)}static valid(e){let i=e.parent;if(i.isTextblock||!z(e)||!D(e))return!1;let o=i.type.spec.allowGapCursor;if(o!=null)return o;let r=i.contentMatchAt(e.index()).defaultType;return r&&r.isTextblock}static findGapCursorFrom(e,i,o=!1){e:for(;;){if(!o&&d.valid(e))return e;let r=e.pos,l=null;for(let s=e.depth;;s--){let n=e.node(s);if(i>0?e.indexAfter(s)<n.childCount:e.index(s)>0){l=n.child(i>0?e.indexAfter(s):e.index(s)-1);break}else if(s==0)return null;r+=i;let c=e.doc.resolve(r);if(d.valid(c))return c}for(;;){let s=i>0?l.firstChild:l.lastChild;if(!s){if(l.isAtom&&!l.isText&&!a.NodeSelection.isSelectable(l)){e=e.doc.resolve(r+l.nodeSize*i),o=!1;continue e}break}l=s,r+=i;let n=e.doc.resolve(r);if(d.valid(n))return n}return null}}}d.prototype.visible=!1;d.findFrom=d.findGapCursorFrom;a.Selection.jsonID("gapcursor",d);class y{constructor(e){this.pos=e}map(e){return new y(e.map(this.pos))}resolve(e){let i=e.resolve(this.pos);return d.valid(i)?new d(i):a.Selection.near(i)}}function z(t){for(let e=t.depth;e>=0;e--){let i=t.index(e),o=t.node(e);if(i==0){if(o.type.spec.isolating)return!0;continue}for(let r=o.child(i-1);;r=r.lastChild){if(r.childCount==0&&!r.inlineContent||r.isAtom||r.type.spec.isolating)return!0;if(r.inlineContent)return!1}}return!0}function D(t){for(let e=t.depth;e>=0;e--){let i=t.indexAfter(e),o=t.node(e);if(i==o.childCount){if(o.type.spec.isolating)return!0;continue}for(let r=o.child(i);;r=r.firstChild){if(r.childCount==0&&!r.inlineContent||r.isAtom||r.type.spec.isolating)return!0;if(r.inlineContent)return!1}}return!0}function L(){return new a.Plugin({props:{decorations:q,createSelectionBetween(t,e,i){return e.pos==i.pos&&d.valid(i)?new d(i):null},handleClick:V,handleKeyDown:R,handleDOMEvents:{beforeinput:H}}})}const R=a.keydownHandler({ArrowLeft:g("horiz",-1),ArrowRight:g("horiz",1),ArrowUp:g("vert",-1),ArrowDown:g("vert",1)});function g(t,e){const i=t=="vert"?e>0?"down":"up":e>0?"right":"left";return function(o,r,l){let s=o.selection,n=e>0?s.$to:s.$from,c=s.empty;if(s instanceof a.TextSelection){if(!l.endOfTextblock(i)||n.depth==0)return!1;c=!1,n=o.doc.resolve(e>0?n.after():n.before())}let u=d.findGapCursorFrom(n,e,c);return u?(r&&r(o.tr.setSelection(new d(u))),!0):!1}}function V(t,e,i){if(!t||!t.editable)return!1;let o=t.state.doc.resolve(e);if(!d.valid(o))return!1;let r=t.posAtCoords({left:i.clientX,top:i.clientY});return r&&r.inside>-1&&a.NodeSelection.isSelectable(t.state.doc.nodeAt(r.inside))?!1:(t.dispatch(t.state.tr.setSelection(new d(o))),!0)}function H(t,e){if(e.inputType!="insertCompositionText"||!(t.state.selection instanceof d))return!1;let{$from:i}=t.state.selection,o=i.parent.contentMatchAt(i.index()).findWrapping(t.state.schema.nodes.text);if(!o)return!1;let r=a.Fragment.empty;for(let s=o.length-1;s>=0;s--)r=a.Fragment.from(o[s].createAndFill(null,r));let l=t.state.tr.replace(i.pos,i.pos,new a.Slice(r,0,0));return l.setSelection(a.TextSelection.near(l.doc.resolve(i.pos+1))),t.dispatch(l),!1}function q(t){if(!(t.selection instanceof d))return null;let e=document.createElement("div");return e.className="ProseMirror-gapcursor",a.DecorationSet.create(t.doc,[a.Decoration.widget(t.selection.head,e,{key:"gapcursor"})])}const F=a.Extension.create({name:"gapCursor",addProseMirrorPlugins(){return[L()]},extendNodeSchema(t){var e;const i={name:t.name,options:t.options,storage:t.storage};return{allowGapCursor:(e=a.callOrReturn(a.getExtensionField(t,"allowGapCursor",i)))!==null&&e!==void 0?e:null}}}),I=a.Node.create({name:"hardBreak",addOptions(){return{keepMarks:!0,HTMLAttributes:{}}},inline:!0,group:"inline",selectable:!1,linebreakReplacement:!0,parseHTML(){return[{tag:"br"}]},renderHTML({HTMLAttributes:t}){return["br",a.mergeAttributes(this.options.HTMLAttributes,t)]},renderText(){return`
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const p=require("react"),C=require("./RichTextEditor-DsUcQSbm.cjs"),x=require("./dom-dataset-Byuf1YmW.cjs"),a=require("./index-ByRfqzMr.cjs"),b=require("./ListItem.cjs"),S=require("./index-DclQSrIx.cjs"),v=require("./Document.cjs"),k=require("./Selection.cjs"),P=require("./TextBubble.cjs"),M=require("./TrailingNode.cjs"),m=require("./index-D_A0TBRA.cjs");function T(){var l;const t=p.useRef({editor:null}),[e,i]=p.useState(!1),[o,r]=p.useState(null);return p.useEffect(()=>{var s;(s=t.current)!=null&&s.editor&&(i(!0),r(t.current.editor))},[t,(l=t.current)==null?void 0:l.editor]),{isReady:e,editor:o,editorRef:t}}const E=a.Extension.create({name:"characterCount",addOptions(){return{limit:null,mode:"textSize",textCounter:t=>t.length,wordCounter:t=>t.split(" ").filter(e=>e!=="").length}},addStorage(){return{characters:()=>0,words:()=>0}},onBeforeCreate(){this.storage.characters=t=>{const e=(t==null?void 0:t.node)||this.editor.state.doc;if(((t==null?void 0:t.mode)||this.options.mode)==="textSize"){const o=e.textBetween(0,e.content.size,void 0," ");return this.options.textCounter(o)}return e.nodeSize},this.storage.words=t=>{const e=(t==null?void 0:t.node)||this.editor.state.doc,i=e.textBetween(0,e.content.size," "," ");return this.options.wordCounter(i)}},addProseMirrorPlugins(){let t=!1;return[new a.Plugin({key:new a.PluginKey("characterCount"),appendTransaction:(e,i,o)=>{if(t)return;const r=this.options.limit;if(r==null||r===0){t=!0;return}const l=this.storage.characters({node:o.doc});if(l>r){const s=l-r,n=0,c=s;console.warn(`[CharacterCount] Initial content exceeded limit of ${r} characters. Content was automatically trimmed.`);const u=o.tr.deleteRange(n,c);return t=!0,u}t=!0},filterTransaction:(e,i)=>{const o=this.options.limit;if(!e.docChanged||o===0||o===null||o===void 0)return!0;const r=this.storage.characters({node:i.doc}),l=this.storage.characters({node:e.doc});if(l<=o||r>o&&l>o&&l<=r)return!0;if(r>o&&l>o&&l>r||!e.getMeta("paste"))return!1;const n=e.selection.$head.pos,c=l-o,u=n-c,h=n;return e.deleteRange(u,h),!(this.storage.characters({node:e.doc})>o)}})]}});function A(t={}){return new a.Plugin({view(e){return new O(e,t)}})}class O{constructor(e,i){var o;this.editorView=e,this.cursorPos=null,this.element=null,this.timeout=-1,this.width=(o=i.width)!==null&&o!==void 0?o:1,this.color=i.color===!1?void 0:i.color||"black",this.class=i.class,this.handlers=["dragover","dragend","drop","dragleave"].map(r=>{let l=s=>{this[r](s)};return e.dom.addEventListener(r,l),{name:r,handler:l}})}destroy(){this.handlers.forEach(({name:e,handler:i})=>this.editorView.dom.removeEventListener(e,i))}update(e,i){this.cursorPos!=null&&i.doc!=e.state.doc&&(this.cursorPos>e.state.doc.content.size?this.setCursor(null):this.updateOverlay())}setCursor(e){e!=this.cursorPos&&(this.cursorPos=e,e==null?(this.element.parentNode.removeChild(this.element),this.element=null):this.updateOverlay())}updateOverlay(){let e=this.editorView.state.doc.resolve(this.cursorPos),i=!e.parent.inlineContent,o;if(i){let n=e.nodeBefore,c=e.nodeAfter;if(n||c){let u=this.editorView.nodeDOM(this.cursorPos-(n?n.nodeSize:0));if(u){let h=u.getBoundingClientRect(),f=n?h.bottom:h.top;n&&c&&(f=(f+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2),o={left:h.left,right:h.right,top:f-this.width/2,bottom:f+this.width/2}}}}if(!o){let n=this.editorView.coordsAtPos(this.cursorPos);o={left:n.left-this.width/2,right:n.left+this.width/2,top:n.top,bottom:n.bottom}}let r=this.editorView.dom.offsetParent;this.element||(this.element=r.appendChild(document.createElement("div")),this.class&&(this.element.className=this.class),this.element.style.cssText="position: absolute; z-index: 50; pointer-events: none;",this.color&&(this.element.style.backgroundColor=this.color)),this.element.classList.toggle("prosemirror-dropcursor-block",i),this.element.classList.toggle("prosemirror-dropcursor-inline",!i);let l,s;if(!r||r==document.body&&getComputedStyle(r).position=="static")l=-pageXOffset,s=-pageYOffset;else{let n=r.getBoundingClientRect();l=n.left-r.scrollLeft,s=n.top-r.scrollTop}this.element.style.left=o.left-l+"px",this.element.style.top=o.top-s+"px",this.element.style.width=o.right-o.left+"px",this.element.style.height=o.bottom-o.top+"px"}scheduleRemoval(e){clearTimeout(this.timeout),this.timeout=setTimeout(()=>this.setCursor(null),e)}dragover(e){if(!this.editorView.editable)return;let i=this.editorView.posAtCoords({left:e.clientX,top:e.clientY}),o=i&&i.inside>=0&&this.editorView.state.doc.nodeAt(i.inside),r=o&&o.type.spec.disableDropCursor,l=typeof r=="function"?r(this.editorView,i,e):r;if(i&&!l){let s=i.pos;if(this.editorView.dragging&&this.editorView.dragging.slice){let n=a.dropPoint(this.editorView.state.doc,s,this.editorView.dragging.slice);n!=null&&(s=n)}this.setCursor(s),this.scheduleRemoval(5e3)}}dragend(){this.scheduleRemoval(20)}drop(){this.scheduleRemoval(20)}dragleave(e){(e.target==this.editorView.dom||!this.editorView.dom.contains(e.relatedTarget))&&this.setCursor(null)}}const B=a.Extension.create({name:"dropCursor",addOptions(){return{color:"currentColor",width:1,class:void 0}},addProseMirrorPlugins(){return[A(this.options)]}}),N=a.Extension.create({name:"focus",addOptions(){return{className:"has-focus",mode:"all"}},addProseMirrorPlugins(){return[new a.Plugin({key:new a.PluginKey("focus"),props:{decorations:({doc:t,selection:e})=>{const{isEditable:i,isFocused:o}=this.editor,{anchor:r}=e,l=[];if(!i||!o)return a.DecorationSet.create(t,[]);let s=0;this.options.mode==="deepest"&&t.descendants((c,u)=>{if(c.isText)return;if(!(r>=u&&r<=u+c.nodeSize-1))return!1;s+=1});let n=0;return t.descendants((c,u)=>{if(c.isText||!(r>=u&&r<=u+c.nodeSize-1))return!1;if(n+=1,this.options.mode==="deepest"&&s-n>0||this.options.mode==="shallowest"&&n>1)return this.options.mode==="deepest";l.push(a.Decoration.node(u,u+c.nodeSize,{class:this.options.className}))}),a.DecorationSet.create(t,l)}}})]}});class d extends a.Selection{constructor(e){super(e,e)}map(e,i){let o=e.resolve(i.map(this.head));return d.valid(o)?new d(o):a.Selection.near(o)}content(){return a.Slice.empty}eq(e){return e instanceof d&&e.head==this.head}toJSON(){return{type:"gapcursor",pos:this.head}}static fromJSON(e,i){if(typeof i.pos!="number")throw new RangeError("Invalid input for GapCursor.fromJSON");return new d(e.resolve(i.pos))}getBookmark(){return new y(this.anchor)}static valid(e){let i=e.parent;if(i.isTextblock||!z(e)||!D(e))return!1;let o=i.type.spec.allowGapCursor;if(o!=null)return o;let r=i.contentMatchAt(e.index()).defaultType;return r&&r.isTextblock}static findGapCursorFrom(e,i,o=!1){e:for(;;){if(!o&&d.valid(e))return e;let r=e.pos,l=null;for(let s=e.depth;;s--){let n=e.node(s);if(i>0?e.indexAfter(s)<n.childCount:e.index(s)>0){l=n.child(i>0?e.indexAfter(s):e.index(s)-1);break}else if(s==0)return null;r+=i;let c=e.doc.resolve(r);if(d.valid(c))return c}for(;;){let s=i>0?l.firstChild:l.lastChild;if(!s){if(l.isAtom&&!l.isText&&!a.NodeSelection.isSelectable(l)){e=e.doc.resolve(r+l.nodeSize*i),o=!1;continue e}break}l=s,r+=i;let n=e.doc.resolve(r);if(d.valid(n))return n}return null}}}d.prototype.visible=!1;d.findFrom=d.findGapCursorFrom;a.Selection.jsonID("gapcursor",d);class y{constructor(e){this.pos=e}map(e){return new y(e.map(this.pos))}resolve(e){let i=e.resolve(this.pos);return d.valid(i)?new d(i):a.Selection.near(i)}}function z(t){for(let e=t.depth;e>=0;e--){let i=t.index(e),o=t.node(e);if(i==0){if(o.type.spec.isolating)return!0;continue}for(let r=o.child(i-1);;r=r.lastChild){if(r.childCount==0&&!r.inlineContent||r.isAtom||r.type.spec.isolating)return!0;if(r.inlineContent)return!1}}return!0}function D(t){for(let e=t.depth;e>=0;e--){let i=t.indexAfter(e),o=t.node(e);if(i==o.childCount){if(o.type.spec.isolating)return!0;continue}for(let r=o.child(i);;r=r.firstChild){if(r.childCount==0&&!r.inlineContent||r.isAtom||r.type.spec.isolating)return!0;if(r.inlineContent)return!1}}return!0}function L(){return new a.Plugin({props:{decorations:q,createSelectionBetween(t,e,i){return e.pos==i.pos&&d.valid(i)?new d(i):null},handleClick:V,handleKeyDown:R,handleDOMEvents:{beforeinput:H}}})}const R=a.keydownHandler({ArrowLeft:g("horiz",-1),ArrowRight:g("horiz",1),ArrowUp:g("vert",-1),ArrowDown:g("vert",1)});function g(t,e){const i=t=="vert"?e>0?"down":"up":e>0?"right":"left";return function(o,r,l){let s=o.selection,n=e>0?s.$to:s.$from,c=s.empty;if(s instanceof a.TextSelection){if(!l.endOfTextblock(i)||n.depth==0)return!1;c=!1,n=o.doc.resolve(e>0?n.after():n.before())}let u=d.findGapCursorFrom(n,e,c);return u?(r&&r(o.tr.setSelection(new d(u))),!0):!1}}function V(t,e,i){if(!t||!t.editable)return!1;let o=t.state.doc.resolve(e);if(!d.valid(o))return!1;let r=t.posAtCoords({left:i.clientX,top:i.clientY});return r&&r.inside>-1&&a.NodeSelection.isSelectable(t.state.doc.nodeAt(r.inside))?!1:(t.dispatch(t.state.tr.setSelection(new d(o))),!0)}function H(t,e){if(e.inputType!="insertCompositionText"||!(t.state.selection instanceof d))return!1;let{$from:i}=t.state.selection,o=i.parent.contentMatchAt(i.index()).findWrapping(t.state.schema.nodes.text);if(!o)return!1;let r=a.Fragment.empty;for(let s=o.length-1;s>=0;s--)r=a.Fragment.from(o[s].createAndFill(null,r));let l=t.state.tr.replace(i.pos,i.pos,new a.Slice(r,0,0));return l.setSelection(a.TextSelection.near(l.doc.resolve(i.pos+1))),t.dispatch(l),!1}function q(t){if(!(t.selection instanceof d))return null;let e=document.createElement("div");return e.className="ProseMirror-gapcursor",a.DecorationSet.create(t.doc,[a.Decoration.widget(t.selection.head,e,{key:"gapcursor"})])}const F=a.Extension.create({name:"gapCursor",addProseMirrorPlugins(){return[L()]},extendNodeSchema(t){var e;const i={name:t.name,options:t.options,storage:t.storage};return{allowGapCursor:(e=a.callOrReturn(a.getExtensionField(t,"allowGapCursor",i)))!==null&&e!==void 0?e:null}}}),I=a.Node.create({name:"hardBreak",addOptions(){return{keepMarks:!0,HTMLAttributes:{}}},inline:!0,group:"inline",selectable:!1,linebreakReplacement:!0,parseHTML(){return[{tag:"br"}]},renderHTML({HTMLAttributes:t}){return["br",a.mergeAttributes(this.options.HTMLAttributes,t)]},renderText(){return`
|
|
2
2
|
`},addCommands(){return{setHardBreak:()=>({commands:t,chain:e,state:i,editor:o})=>t.first([()=>t.exitCode(),()=>t.command(()=>{const{selection:r,storedMarks:l}=i;if(r.$from.parent.type.spec.isolating)return!1;const{keepMarks:s}=this.options,{splittableMarks:n}=o.extensionManager,c=l||r.$to.parentOffset&&r.$from.marks();return e().insertContent({type:this.name}).command(({tr:u,dispatch:h})=>{if(h&&c&&s){const f=c.filter(w=>n.includes(w.type.name));u.ensureMarks(f)}return!0}).run()})])}},addKeyboardShortcuts(){return{"Mod-Enter":()=>this.editor.commands.setHardBreak(),"Shift-Enter":()=>this.editor.commands.setHardBreak()}}}),K=a.Node.create({name:"paragraph",priority:1e3,addOptions(){return{HTMLAttributes:{}}},group:"block",content:"inline*",parseHTML(){return[{tag:"p"}]},renderHTML({HTMLAttributes:t}){return["p",a.mergeAttributes(this.options.HTMLAttributes,t),0]},addCommands(){return{setParagraph:()=>({commands:t})=>t.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}}),W=a.Extension.create({name:"placeholder",addOptions(){return{emptyEditorClass:"is-editor-empty",emptyNodeClass:"is-empty",placeholder:"Write something …",showOnlyWhenEditable:!0,showOnlyCurrent:!0,includeChildren:!1}},addProseMirrorPlugins(){return[new a.Plugin({key:new a.PluginKey("placeholder"),props:{decorations:({doc:t,selection:e})=>{const i=this.editor.isEditable||!this.options.showOnlyWhenEditable,{anchor:o}=e,r=[];if(!i)return null;const l=this.editor.isEmpty;return t.descendants((s,n)=>{const c=o>=n&&o<=n+s.nodeSize,u=!s.isLeaf&&a.isNodeEmpty(s);if((c||!this.options.showOnlyCurrent)&&u){const h=[this.options.emptyNodeClass];l&&h.push(this.options.emptyEditorClass);const f=a.Decoration.node(n,n+s.nodeSize,{class:h.join(" "),"data-placeholder":typeof this.options.placeholder=="function"?this.options.placeholder({editor:this.editor,node:s,pos:n,hasAnchor:c}):this.options.placeholder});r.push(f)}return this.options.includeChildren}),a.DecorationSet.create(t,r)}}})]}}),G=a.Node.create({name:"text",group:"inline"}),J=a.Extension.create({name:"base-kit",addExtensions(){const t=[];return this.options.document!==!1&&t.push(v.Document.configure()),this.options.placeholder!==!1&&t.push(W.configure({placeholder:({node:e,pos:i,editor:o})=>{var r,l,s,n,c;return((r=e==null?void 0:e.type)==null?void 0:r.name)==="columns"||((l=e==null?void 0:e.content)==null?void 0:l.size)!==0?"":((s=e==null?void 0:e.type)==null?void 0:s.name)==="heading"?`${m.localeActions.t(`editor.heading.h${e.attrs.level}.tooltip`)}`:((n=e==null?void 0:e.type)==null?void 0:n.name)==="codeBlock"||((c=e==null?void 0:e.type)==null?void 0:c.name)==="table"?"":o.extensionManager.extensions.some(u=>u.name==="slashCommand")?m.localeActions.t("editor.slash"):m.localeActions.t("editor.content")},...this.options.placeholder})),this.options.focus!==!1&&t.push(N.configure({className:"focus",...this.options.focus})),this.options.text!==!1&&t.push(G.configure()),this.options.textBubble!==!1&&t.push(P.TextBubble.configure()),this.options.gapcursor!==!1&&t.push(F.configure()),this.options.dropcursor!==!1&&t.push(B.configure({...this.options.dropcursor,width:2,class:"ProseMirror-dropcursor border-black"})),this.options.characterCount!==!1&&t.push(E.configure(this.options.characterCount)),this.options.paragraph!==!1&&t.push(K.configure(this.options.paragraph)),this.options.hardBreak!==!1&&t.push(I.configure(this.options.hardBreak)),this.options.listItem!==!1&&t.push(b.ListItem.configure(this.options.listItem)),this.options.textStyle!==!1&&t.push(S.TextStyle.configure(this.options.textStyle)),this.options.trailingNode!==!1&&t.push(M.TrailingNode.configure(this.options.trailingNode)),this.options.selection!==!1&&t.push(k.Selection),this.options.multiColumn!==!1&&t.push(C.Column,C.MultiColumn),t}});exports.default=C.RichTextEditor;exports.BubbleMenu=x.BubbleMenu;exports.BaseKit=J;exports.useEditorState=T;
|
package/lib/index.d.cts
CHANGED
|
@@ -144,18 +144,6 @@ export declare interface BaseKitOptions {
|
|
|
144
144
|
|
|
145
145
|
export { BubbleMenu }
|
|
146
146
|
|
|
147
|
-
declare interface BubbleMenuConfig {
|
|
148
|
-
/**
|
|
149
|
-
* @description Column menu hidden
|
|
150
|
-
* @default false
|
|
151
|
-
*/
|
|
152
|
-
hidden?: boolean;
|
|
153
|
-
/**
|
|
154
|
-
* custom menu actions
|
|
155
|
-
*/
|
|
156
|
-
actions?: ActionButtonProps[];
|
|
157
|
-
}
|
|
158
|
-
|
|
159
147
|
/**
|
|
160
148
|
* Represents the BubbleMenuProps.
|
|
161
149
|
*/
|
|
@@ -167,7 +155,7 @@ declare interface BubbleMenuProps {
|
|
|
167
155
|
*/
|
|
168
156
|
hidden?: boolean;
|
|
169
157
|
};
|
|
170
|
-
tableConfig?:
|
|
158
|
+
tableConfig?: TableMenuConfig;
|
|
171
159
|
floatingMenuConfig?: {
|
|
172
160
|
/**
|
|
173
161
|
* @description Floating menu hidden
|
|
@@ -337,6 +325,8 @@ declare interface GeneralOptions<T> {
|
|
|
337
325
|
button: ButtonView<T>;
|
|
338
326
|
/** Show on Toolbar */
|
|
339
327
|
toolbar?: boolean;
|
|
328
|
+
/** Shortcut keys override */
|
|
329
|
+
shortcutKeys?: string[] | string[][];
|
|
340
330
|
}
|
|
341
331
|
|
|
342
332
|
/**
|
|
@@ -389,6 +379,22 @@ declare interface RichTextEditorProps {
|
|
|
389
379
|
immediatelyRender?: boolean;
|
|
390
380
|
}
|
|
391
381
|
|
|
382
|
+
declare interface TableMenuConfig {
|
|
383
|
+
/**
|
|
384
|
+
* @description Column menu hidden
|
|
385
|
+
* @default false
|
|
386
|
+
*/
|
|
387
|
+
hidden?: boolean;
|
|
388
|
+
/**
|
|
389
|
+
* custom menu actions
|
|
390
|
+
*/
|
|
391
|
+
actions?: ActionButtonProps[];
|
|
392
|
+
/**
|
|
393
|
+
* hidden default actions, if any
|
|
394
|
+
*/
|
|
395
|
+
hiddenActions?: string[];
|
|
396
|
+
}
|
|
397
|
+
|
|
392
398
|
declare interface TextBubbleOptions extends GeneralOptions<TextBubbleOptions> {
|
|
393
399
|
}
|
|
394
400
|
|
|
@@ -494,8 +500,8 @@ declare module '@tiptap/core' {
|
|
|
494
500
|
|
|
495
501
|
declare module '@tiptap/core' {
|
|
496
502
|
interface Commands<ReturnType> {
|
|
497
|
-
|
|
498
|
-
|
|
503
|
+
exportPdf: {
|
|
504
|
+
exportToPdf: () => ReturnType;
|
|
499
505
|
};
|
|
500
506
|
}
|
|
501
507
|
}
|
|
@@ -503,8 +509,8 @@ declare module '@tiptap/core' {
|
|
|
503
509
|
|
|
504
510
|
declare module '@tiptap/core' {
|
|
505
511
|
interface Commands<ReturnType> {
|
|
506
|
-
|
|
507
|
-
|
|
512
|
+
excalidraw: {
|
|
513
|
+
setExcalidraw: (attrs?: IExcalidrawAttrs) => ReturnType;
|
|
508
514
|
};
|
|
509
515
|
}
|
|
510
516
|
}
|
package/lib/index.d.ts
CHANGED
|
@@ -144,18 +144,6 @@ export declare interface BaseKitOptions {
|
|
|
144
144
|
|
|
145
145
|
export { BubbleMenu }
|
|
146
146
|
|
|
147
|
-
declare interface BubbleMenuConfig {
|
|
148
|
-
/**
|
|
149
|
-
* @description Column menu hidden
|
|
150
|
-
* @default false
|
|
151
|
-
*/
|
|
152
|
-
hidden?: boolean;
|
|
153
|
-
/**
|
|
154
|
-
* custom menu actions
|
|
155
|
-
*/
|
|
156
|
-
actions?: ActionButtonProps[];
|
|
157
|
-
}
|
|
158
|
-
|
|
159
147
|
/**
|
|
160
148
|
* Represents the BubbleMenuProps.
|
|
161
149
|
*/
|
|
@@ -167,7 +155,7 @@ declare interface BubbleMenuProps {
|
|
|
167
155
|
*/
|
|
168
156
|
hidden?: boolean;
|
|
169
157
|
};
|
|
170
|
-
tableConfig?:
|
|
158
|
+
tableConfig?: TableMenuConfig;
|
|
171
159
|
floatingMenuConfig?: {
|
|
172
160
|
/**
|
|
173
161
|
* @description Floating menu hidden
|
|
@@ -337,6 +325,8 @@ declare interface GeneralOptions<T> {
|
|
|
337
325
|
button: ButtonView<T>;
|
|
338
326
|
/** Show on Toolbar */
|
|
339
327
|
toolbar?: boolean;
|
|
328
|
+
/** Shortcut keys override */
|
|
329
|
+
shortcutKeys?: string[] | string[][];
|
|
340
330
|
}
|
|
341
331
|
|
|
342
332
|
/**
|
|
@@ -389,6 +379,22 @@ declare interface RichTextEditorProps {
|
|
|
389
379
|
immediatelyRender?: boolean;
|
|
390
380
|
}
|
|
391
381
|
|
|
382
|
+
declare interface TableMenuConfig {
|
|
383
|
+
/**
|
|
384
|
+
* @description Column menu hidden
|
|
385
|
+
* @default false
|
|
386
|
+
*/
|
|
387
|
+
hidden?: boolean;
|
|
388
|
+
/**
|
|
389
|
+
* custom menu actions
|
|
390
|
+
*/
|
|
391
|
+
actions?: ActionButtonProps[];
|
|
392
|
+
/**
|
|
393
|
+
* hidden default actions, if any
|
|
394
|
+
*/
|
|
395
|
+
hiddenActions?: string[];
|
|
396
|
+
}
|
|
397
|
+
|
|
392
398
|
declare interface TextBubbleOptions extends GeneralOptions<TextBubbleOptions> {
|
|
393
399
|
}
|
|
394
400
|
|
|
@@ -494,8 +500,8 @@ declare module '@tiptap/core' {
|
|
|
494
500
|
|
|
495
501
|
declare module '@tiptap/core' {
|
|
496
502
|
interface Commands<ReturnType> {
|
|
497
|
-
|
|
498
|
-
|
|
503
|
+
exportPdf: {
|
|
504
|
+
exportToPdf: () => ReturnType;
|
|
499
505
|
};
|
|
500
506
|
}
|
|
501
507
|
}
|
|
@@ -503,8 +509,8 @@ declare module '@tiptap/core' {
|
|
|
503
509
|
|
|
504
510
|
declare module '@tiptap/core' {
|
|
505
511
|
interface Commands<ReturnType> {
|
|
506
|
-
|
|
507
|
-
|
|
512
|
+
excalidraw: {
|
|
513
|
+
setExcalidraw: (attrs?: IExcalidrawAttrs) => ReturnType;
|
|
508
514
|
};
|
|
509
515
|
}
|
|
510
516
|
}
|
package/lib/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useRef as O, useState as S, useEffect as B } from "react";
|
|
2
|
-
import { a6 as z, a7 as N } from "./RichTextEditor-
|
|
3
|
-
import { a8 as ve } from "./RichTextEditor-
|
|
2
|
+
import { a6 as z, a7 as N } from "./RichTextEditor-e6q30rbV.js";
|
|
3
|
+
import { a8 as ve } from "./RichTextEditor-e6q30rbV.js";
|
|
4
4
|
import { B as ke } from "./dom-dataset-Di3tIRrR.js";
|
|
5
5
|
import { E as f, P as p, a as w, s as L, D as C, b, u as R, F as k, S as P, T as M, g as T, v as y, x as D, y as V, N as x, m as A, z as H } from "./index-DI9T3iLd.js";
|
|
6
6
|
import { ListItem as F } from "./ListItem.js";
|
package/lib/locale-bundle.d.cts
CHANGED
|
@@ -1146,8 +1146,8 @@ declare module '@tiptap/core' {
|
|
|
1146
1146
|
|
|
1147
1147
|
declare module '@tiptap/core' {
|
|
1148
1148
|
interface Commands<ReturnType> {
|
|
1149
|
-
|
|
1150
|
-
|
|
1149
|
+
exportPdf: {
|
|
1150
|
+
exportToPdf: () => ReturnType;
|
|
1151
1151
|
};
|
|
1152
1152
|
}
|
|
1153
1153
|
}
|
|
@@ -1155,8 +1155,8 @@ declare module '@tiptap/core' {
|
|
|
1155
1155
|
|
|
1156
1156
|
declare module '@tiptap/core' {
|
|
1157
1157
|
interface Commands<ReturnType> {
|
|
1158
|
-
|
|
1159
|
-
|
|
1158
|
+
excalidraw: {
|
|
1159
|
+
setExcalidraw: (attrs?: IExcalidrawAttrs) => ReturnType;
|
|
1160
1160
|
};
|
|
1161
1161
|
}
|
|
1162
1162
|
}
|