reactjs-tiptap-editor 0.4.2 → 1.0.0
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-BKOg7hkq.js +38 -0
- package/lib/ActionMenuButton-DLQyd_gx.cjs +1 -0
- package/lib/Attachment.cjs +2 -2
- package/lib/Attachment.d.cts +32 -44
- package/lib/Attachment.d.ts +32 -44
- package/lib/Attachment.js +129 -99
- package/lib/Blockquote.cjs +3 -3
- package/lib/Blockquote.d.cts +32 -44
- package/lib/Blockquote.d.ts +32 -44
- package/lib/Blockquote.js +50 -22
- package/lib/Bold.cjs +1 -1
- package/lib/Bold.d.cts +32 -44
- package/lib/Bold.d.ts +32 -44
- package/lib/Bold.js +48 -20
- package/lib/BulletList.cjs +1 -1
- package/lib/BulletList.d.cts +32 -44
- package/lib/BulletList.d.ts +32 -44
- package/lib/BulletList.js +38 -9
- package/lib/Clear.cjs +1 -1
- package/lib/Clear.d.cts +32 -44
- package/lib/Clear.d.ts +32 -44
- package/lib/Clear.js +32 -6
- package/lib/Code.cjs +1 -1
- package/lib/Code.d.cts +32 -44
- package/lib/Code.d.ts +32 -44
- package/lib/Code.js +53 -25
- package/lib/CodeBlock.cjs +35 -35
- package/lib/CodeBlock.d.cts +32 -44
- package/lib/CodeBlock.d.ts +32 -44
- package/lib/CodeBlock.js +605 -590
- package/lib/CodeView.cjs +1 -1
- package/lib/CodeView.d.cts +33 -45
- package/lib/CodeView.d.ts +33 -45
- package/lib/CodeView.js +49 -21
- package/lib/Color.cjs +1 -1
- package/lib/Color.d.cts +36 -44
- package/lib/Color.d.ts +36 -44
- package/lib/Color.js +123 -79
- package/lib/Column.cjs +1 -0
- package/lib/{Document.d.cts → Column.d.cts} +38 -47
- package/lib/{Document.d.ts → Column.d.ts} +38 -47
- package/lib/Column.js +217 -0
- package/lib/{Drawer-CaAfmqNo.js → Drawer-DZ5jvmrX.js} +404 -394
- package/lib/Drawer-SRhwOc6T.cjs +1 -0
- package/lib/Drawer.cjs +1 -1
- package/lib/Drawer.d.cts +32 -44
- package/lib/Drawer.d.ts +32 -44
- package/lib/Drawer.js +6 -5
- package/lib/Emoji.cjs +1 -1
- package/lib/Emoji.d.cts +32 -49
- package/lib/Emoji.d.ts +32 -49
- package/lib/Emoji.js +377 -392
- package/lib/Excalidraw-DwBRXEtC.js +345 -0
- package/lib/Excalidraw-ZN3DQvDC.cjs +1 -0
- package/lib/Excalidraw.cjs +1 -1
- package/lib/Excalidraw.d.cts +32 -44
- package/lib/Excalidraw.d.ts +32 -44
- package/lib/Excalidraw.js +6 -4
- package/lib/ExportPdf.cjs +5 -5
- package/lib/ExportPdf.d.cts +32 -44
- package/lib/ExportPdf.d.ts +32 -44
- package/lib/ExportPdf.js +60 -32
- package/lib/ExportWord.cjs +1 -1
- package/lib/ExportWord.d.cts +33 -45
- package/lib/ExportWord.d.ts +33 -45
- package/lib/ExportWord.js +84 -21
- package/lib/FontFamily.cjs +1 -1
- package/lib/FontFamily.d.cts +46 -47
- package/lib/FontFamily.d.ts +46 -47
- package/lib/FontFamily.js +72 -74
- package/lib/FontSize.cjs +1 -1
- package/lib/FontSize.d.cts +43 -47
- package/lib/FontSize.d.ts +43 -47
- package/lib/FontSize.js +72 -64
- package/lib/Heading.cjs +1 -1
- package/lib/Heading.d.cts +46 -44
- package/lib/Heading.d.ts +46 -44
- package/lib/Heading.js +91 -73
- package/lib/Highlight.cjs +1 -1
- package/lib/Highlight.d.cts +36 -44
- package/lib/Highlight.d.ts +36 -44
- package/lib/Highlight.js +152 -21
- package/lib/History.cjs +1 -1
- package/lib/History.d.cts +34 -44
- package/lib/History.d.ts +34 -44
- package/lib/History.js +976 -53
- package/lib/HorizontalRule.cjs +1 -1
- package/lib/HorizontalRule.d.cts +32 -44
- package/lib/HorizontalRule.d.ts +32 -44
- package/lib/HorizontalRule.js +97 -17
- package/lib/Icon-DUpv2cI6.cjs +1 -0
- package/lib/Icon-jKs8Hr6p.js +11 -0
- package/lib/Iframe-CmXkEqOd.js +431 -0
- package/lib/Iframe-Cvca2G7X.cjs +1 -0
- package/lib/Iframe.cjs +1 -1
- package/lib/Iframe.d.cts +31 -50
- package/lib/Iframe.d.ts +31 -50
- package/lib/Iframe.js +6 -4
- package/lib/Image.cjs +1 -1
- package/lib/Image.d.cts +32 -45
- package/lib/Image.d.ts +32 -45
- package/lib/Image.js +848 -5
- package/lib/ImageGif.cjs +1 -1
- package/lib/ImageGif.d.cts +33 -47
- package/lib/ImageGif.d.ts +33 -47
- package/lib/ImageGif.js +424 -5
- package/lib/ImportWord.cjs +48 -48
- package/lib/ImportWord.d.cts +33 -45
- package/lib/ImportWord.d.ts +33 -45
- package/lib/ImportWord.js +2596 -2588
- package/lib/Indent.cjs +1 -1
- package/lib/Indent.d.cts +32 -44
- package/lib/Indent.d.ts +32 -44
- package/lib/Indent.js +97 -27
- package/lib/Italic.cjs +1 -1
- package/lib/Italic.d.cts +32 -44
- package/lib/Italic.d.ts +32 -44
- package/lib/Italic.js +47 -19
- package/lib/Katex-DsYXsjSS.js +2740 -0
- package/lib/Katex-XfrNne6U.cjs +4 -0
- package/lib/Katex.cjs +1 -1
- package/lib/Katex.d.cts +32 -44
- package/lib/Katex.d.ts +32 -44
- package/lib/Katex.js +5 -196
- package/lib/LineHeight.cjs +1 -1
- package/lib/LineHeight.d.cts +34 -50
- package/lib/LineHeight.d.ts +34 -50
- package/lib/LineHeight.js +71 -112
- package/lib/Link.cjs +1 -1
- package/lib/Link.d.cts +33 -47
- package/lib/Link.d.ts +33 -47
- package/lib/Link.js +3 -3
- package/lib/LinkEditBlock-BZenZq-Z.cjs +5 -0
- package/lib/LinkEditBlock-CB8yIffE.js +1241 -0
- package/lib/Mention.cjs +1 -1
- package/lib/Mention.d.cts +29 -44
- package/lib/Mention.d.ts +29 -44
- package/lib/Mention.js +112 -124
- package/lib/Mermaid.cjs +2 -2
- package/lib/Mermaid.d.cts +32 -44
- package/lib/Mermaid.d.ts +32 -44
- package/lib/Mermaid.js +177 -165
- package/lib/MoreMark.cjs +1 -1
- package/lib/MoreMark.d.cts +47 -46
- package/lib/MoreMark.d.ts +47 -46
- package/lib/MoreMark.js +125 -55
- package/lib/OrderedList.cjs +1 -1
- package/lib/OrderedList.d.cts +32 -44
- package/lib/OrderedList.d.ts +32 -44
- package/lib/OrderedList.js +37 -9
- package/lib/SearchAndReplace.cjs +1 -1
- package/lib/SearchAndReplace.d.cts +32 -47
- package/lib/SearchAndReplace.d.ts +32 -47
- package/lib/SearchAndReplace.js +221 -197
- package/lib/SlashCommand.cjs +1 -1
- package/lib/SlashCommand.d.cts +44 -51
- package/lib/SlashCommand.d.ts +44 -51
- package/lib/SlashCommand.js +235 -249
- package/lib/Strike.cjs +1 -1
- package/lib/Strike.d.cts +32 -44
- package/lib/Strike.d.ts +32 -44
- package/lib/Strike.js +39 -11
- package/lib/Table-B1j1Ebmh.cjs +9 -0
- package/lib/Table-Db8TcQX8.js +1984 -0
- package/lib/Table.cjs +1 -9
- package/lib/Table.d.cts +33 -47
- package/lib/Table.d.ts +33 -47
- package/lib/Table.js +3 -558
- package/lib/TaskList.cjs +1 -1
- package/lib/TaskList.d.cts +32 -44
- package/lib/TaskList.d.ts +32 -44
- package/lib/TaskList.js +38 -10
- package/lib/TextAlign.cjs +1 -1
- package/lib/TextAlign.d.cts +45 -44
- package/lib/TextAlign.d.ts +45 -44
- package/lib/TextAlign.js +108 -101
- package/lib/TextDirection.cjs +1 -1
- package/lib/TextDirection.d.cts +61 -44
- package/lib/TextDirection.d.ts +61 -44
- package/lib/TextDirection.js +105 -112
- package/lib/TextUnderline.cjs +1 -1
- package/lib/TextUnderline.d.cts +32 -44
- package/lib/TextUnderline.d.ts +32 -44
- package/lib/TextUnderline.js +46 -18
- package/lib/{Twitter-BFULyqdR.js → Twitter-CXmmjz9R.js} +536 -498
- package/lib/Twitter-CtVTIWJW.cjs +1 -0
- package/lib/Twitter.cjs +1 -1
- package/lib/Twitter.d.cts +32 -44
- package/lib/Twitter.d.ts +32 -44
- package/lib/Twitter.js +5 -4
- package/lib/Video.cjs +1 -1
- package/lib/Video.d.cts +32 -44
- package/lib/Video.d.ts +32 -44
- package/lib/Video.js +261 -4
- package/lib/_commonjsHelpers-BItOPCY9.js +28 -0
- package/lib/_commonjsHelpers-BTDuMlIz.cjs +1 -0
- package/lib/bubble.cjs +2 -0
- package/lib/{bubble-extra.d.cts → bubble.d.cts} +58 -59
- package/lib/{bubble-extra.d.ts → bubble.d.ts} +58 -59
- package/lib/bubble.js +1925 -0
- package/lib/button-B12K7BJ4.cjs +1 -0
- package/lib/button-DXMsXUEn.js +43 -0
- package/lib/clsx-C11secjj.cjs +1 -0
- package/lib/clsx-OuTLNxxd.js +16 -0
- package/lib/delete-node-CosiBes5.cjs +1 -0
- package/lib/delete-node-IyVmiRbI.js +22 -0
- package/lib/dialog-CaCS-W5S.cjs +1 -0
- package/lib/dialog-PtQivpHS.js +100 -0
- package/lib/dom-dataset-BqoJhJXt.cjs +1 -0
- package/lib/dom-dataset-CIEeltF6.js +47 -0
- package/lib/dropdown-menu-BPp2Z_U-.js +136 -0
- package/lib/dropdown-menu-CdSm4emp.cjs +1 -0
- package/lib/file-BLas99n7.js +43 -0
- package/lib/file-i7e4nQY2.cjs +1 -0
- package/lib/floating-ui.dom-U1vPFQ5f.js +1151 -0
- package/lib/floating-ui.dom-VCrc58uF.cjs +1 -0
- package/lib/icons-Cllpys39.js +362 -0
- package/lib/icons-CqHjeW5T.cjs +1 -0
- package/lib/index-BH4bc3jN.cjs +33 -0
- package/lib/index-BPfVXs5_.js +2380 -0
- package/lib/index-Bnmd0WvY.js +1631 -0
- package/lib/{index-Ch6dBBad.js → index-CBce_TWY.js} +40 -42
- package/lib/{index-5iBZLua9.cjs → index-D-5U8dY8.cjs} +8 -8
- package/lib/{index-ByurDDMv.js → index-D2TUfKkC.js} +2 -2
- package/lib/index-DV5kbgRU.cjs +1 -0
- package/lib/{index-LmrOdnen.js → index-DYkucCoF.js} +396 -495
- package/lib/index-Dfmm6FTT.cjs +1 -0
- package/lib/index-DnWWK9F_.js +6374 -0
- package/lib/index-DzcKxutn.js +632 -0
- package/lib/index-DzvuNTxo.cjs +4 -0
- package/lib/{index-BeCTd5v2.cjs → index-N--9MohJ.cjs} +1 -1
- package/lib/index-RfTlOzIr.cjs +22 -0
- package/lib/index.cjs +132 -1
- package/lib/index.d.cts +34 -285
- package/lib/index.d.ts +34 -285
- package/lib/index.js +243 -2
- package/lib/input-_ECRfn3Y.cjs +1 -0
- package/lib/input-wJ9PDEzZ.js +21 -0
- package/lib/isNumber-ClPupm7P.cjs +1 -0
- package/lib/isNumber-fpLGS0AZ.js +15 -0
- package/lib/label-BkgAe7IY.cjs +1 -0
- package/lib/label-CGdLYWv7.js +19 -0
- package/lib/locale-bundle.cjs +1 -1
- package/lib/locale-bundle.d.cts +5410 -62
- package/lib/locale-bundle.d.ts +5410 -62
- package/lib/locale-bundle.js +9 -7
- package/lib/popover-BgmUNMHj.cjs +1 -0
- package/lib/popover-CAuEW0Mr.js +23 -0
- package/lib/separator-CuBW_w98.js +328 -0
- package/lib/separator-DRIrVZ2N.cjs +1 -0
- package/lib/store-DX599H5W.js +10 -0
- package/lib/store-WStcMOiW.cjs +1 -0
- package/lib/style.css +1 -1
- package/lib/switch-CnLJ7Y-b.cjs +1 -0
- package/lib/switch-Coix_FA1.js +27 -0
- package/lib/tabs-B5mVSN1I.js +46 -0
- package/lib/tabs-BoLCMcCI.cjs +1 -0
- package/lib/textarea-B-6zTKQz.cjs +1 -0
- package/lib/{textarea-aPtytkDx.js → textarea-DUUM1jZd.js} +1 -1
- package/lib/theme-B7aAsK_T.js +15 -0
- package/lib/theme-D8_cxGqB.cjs +1 -0
- package/lib/throttle-CdwDrFpn.js +249 -0
- package/lib/throttle-qX7Yjtsg.cjs +1 -0
- package/lib/toggle-Cdp4IT2U.js +85 -0
- package/lib/toggle-D41PzQLJ.cjs +1 -0
- package/lib/tooltip-BuEiE96N.cjs +1 -0
- package/lib/tooltip-CopwsU8q.js +23 -0
- package/lib/updatePosition-8Sdem5jb.cjs +1 -0
- package/lib/updatePosition-BPmcE0YD.js +215 -0
- package/lib/use-toast-Bz3QCOtE.cjs +1 -0
- package/lib/use-toast-Crf7-q5H.js +98 -0
- package/lib/useButtonProps-BsEd4zYM.js +141 -0
- package/lib/useButtonProps-C6Vpn190.cjs +1 -0
- package/package.json +22 -105
- package/lib/ActionMenuButton-CYdM1xx5.cjs +0 -1
- package/lib/ActionMenuButton-DKRF6oa0.js +0 -33
- package/lib/BaseKit.cjs +0 -3
- package/lib/BaseKit.d.cts +0 -481
- package/lib/BaseKit.d.ts +0 -481
- package/lib/BaseKit.js +0 -132
- package/lib/Document.cjs +0 -1
- package/lib/Document.js +0 -9
- package/lib/Drawer-CdvCMSzN.cjs +0 -1
- package/lib/Excalidraw-BbMQhNvs.cjs +0 -1
- package/lib/Excalidraw-CVWz2Vyn.js +0 -290
- package/lib/FormatPainter.cjs +0 -1
- package/lib/FormatPainter.d.cts +0 -372
- package/lib/FormatPainter.d.ts +0 -372
- package/lib/FormatPainter.js +0 -76
- package/lib/ListItem.cjs +0 -1
- package/lib/ListItem.d.cts +0 -290
- package/lib/ListItem.d.ts +0 -290
- package/lib/ListItem.js +0 -7
- package/lib/MultiColumn.cjs +0 -1
- package/lib/MultiColumn.d.cts +0 -294
- package/lib/MultiColumn.d.ts +0 -294
- package/lib/MultiColumn.js +0 -8
- package/lib/RichTextEditor-CxvwGvQG.cjs +0 -142
- package/lib/RichTextEditor-DGcKEUGr.js +0 -22166
- package/lib/Selection.cjs +0 -1
- package/lib/Selection.d.cts +0 -289
- package/lib/Selection.d.ts +0 -289
- package/lib/Selection.js +0 -25
- package/lib/SubAndSuperScript.cjs +0 -1
- package/lib/SubAndSuperScript.d.cts +0 -377
- package/lib/SubAndSuperScript.d.ts +0 -377
- package/lib/SubAndSuperScript.js +0 -43
- package/lib/TableOfContent.cjs +0 -1
- package/lib/TableOfContent.d.cts +0 -291
- package/lib/TableOfContent.d.ts +0 -291
- package/lib/TableOfContent.js +0 -185
- package/lib/TextBubble.cjs +0 -1
- package/lib/TextBubble.d.cts +0 -362
- package/lib/TextBubble.d.ts +0 -362
- package/lib/TextBubble.js +0 -133
- package/lib/TrailingNode.cjs +0 -1
- package/lib/TrailingNode.d.cts +0 -297
- package/lib/TrailingNode.d.ts +0 -297
- package/lib/TrailingNode.js +0 -41
- package/lib/Twitter-Cutpkh3h.cjs +0 -1
- package/lib/bubble-extra.cjs +0 -2
- package/lib/bubble-extra.js +0 -631
- package/lib/dom-dataset-_6-diIRQ.cjs +0 -33
- package/lib/dom-dataset-lYeH6gfI.js +0 -2361
- package/lib/index-6D1J-A-o.cjs +0 -1
- package/lib/index-B96Cclrj.cjs +0 -3
- package/lib/index-BBz7Nmv9.js +0 -55
- package/lib/index-CUogRI7j.cjs +0 -1
- package/lib/index-DF2Lp4HZ.cjs +0 -100
- package/lib/index-D_L6n8O8.js +0 -76
- package/lib/index-Dbvi-Bvh.cjs +0 -1
- package/lib/index-DpCrt7xs.cjs +0 -1
- package/lib/index-DsAX1Vq8.cjs +0 -1
- package/lib/index-Dy4DlW9o.js +0 -12
- package/lib/index-J3jHHZ4d.js +0 -200
- package/lib/index-VvXaaKe3.js +0 -898
- package/lib/index-kbO3iWqL.js +0 -13432
- package/lib/textarea-DFo_aXnj.cjs +0 -1
package/lib/Mermaid.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var
|
|
2
|
-
a-->b
|
|
1
|
+
"use strict";var U=Object.create;var G=Object.defineProperty;var Z=Object.getOwnPropertyDescriptor;var Y=Object.getOwnPropertyNames;var J=Object.getPrototypeOf,K=Object.prototype.hasOwnProperty;var Q=(t,e,r,a)=>{if(e&&typeof e=="object"||typeof e=="function")for(let c of Y(e))!K.call(t,c)&&c!==r&&G(t,c,{get:()=>e[c],enumerable:!(a=Z(e,c))||a.enumerable});return t};var ee=(t,e,r)=>(r=t!=null?U(J(t)):{},Q(e||!t||!t.__esModule?G(r,"default",{value:t,enumerable:!0}):r,t));Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const $=require("./index-RfTlOzIr.cjs"),D=require("./throttle-qX7Yjtsg.cjs"),W=require("./index-BH4bc3jN.cjs"),o=require("react/jsx-runtime"),s=require("react"),F=require("./shortId-Bfj8TyNr.cjs"),te=require("./toggle-D41PzQLJ.cjs"),E=require("./dialog-CaCS-W5S.cjs"),re=require("./textarea-B-6zTKQz.cjs"),L=require("./index-Dfmm6FTT.cjs"),P=require("./useButtonProps-C6Vpn190.cjs"),ie=require("./index-DV5kbgRU.cjs"),se=require("./file-i7e4nQY2.cjs"),ae=require("./button-B12K7BJ4.cjs"),ne=`graph TB
|
|
2
|
+
a-->b`;function oe(){const t=ie.useEditorInstance(),e=P.useButtonProps(V.name),{tooltipOptions:r={},isActive:a=void 0,upload:c}=(e==null?void 0:e.componentProps)??{},{editorDisabled:T}=P.useToggleActive(a),[d,N]=s.useState(ne),[q,y]=s.useState(""),[l,_]=s.useState(!1),S=s.useRef(null),[h,H]=s.useState(null),[f,C]=s.useState(!0),z=s.useCallback(u=>{u&&import("mermaid").then(g=>{H(g.default)}).finally(()=>C(!1))},[]),I=async u=>{try{const{svg:g}=await h.render("mermaid-svg",u);y(g)}catch{y("")}},O=()=>{h.initialize({darkMode:!1,startOnLoad:!1,fontSize:12,theme:"base"}),I(d)};s.useEffect(()=>{!f&&h&&l&&O()},[h,l]),s.useEffect(()=>{!f&&h&&l&&I(d)},[h&&d]);const k=async()=>{if(d!==""){if(d){const u=S.current.querySelector("svg"),{width:g,height:R}=u.getBoundingClientRect(),A=`mermaid-${F.shortId()}.svg`;let b=F.i(u.outerHTML);if(c){const i=se.dataURLtoFile(b,A);b=await c(i)}t==null||t.chain().focus().setMermaid({type:"mermaid",src:b,alt:encodeURIComponent(d),width:g,height:R},!!d).run()}_(!1)}};return o.jsxs(E.Dialog,{onOpenChange:_,open:l,children:[o.jsx(E.DialogTrigger,{asChild:!0,children:o.jsx(te.ActionButton,{disabled:T,icon:"Mermaid",tooltip:"Mermaid",tooltipOptions:r,action:()=>{T||_(!0)}})}),o.jsxs(E.DialogContent,{className:"richtext-z-[99999] !richtext-max-w-[1300px]",children:[o.jsx(E.DialogTitle,{children:"Mermaid"}),o.jsx("div",{ref:z,style:{height:"100%",border:"1px solid hsl(var(--border))"},children:f?o.jsx("p",{children:"Loading..."}):o.jsx(o.Fragment,{children:o.jsxs("div",{className:"richtext-flex richtext-gap-[10px] richtext-rounded-[10px] richtext-p-[10px]",children:[o.jsx(re.Textarea,{autoFocus:!0,className:"richtext-flex-1",onChange:u=>N(u.target.value),placeholder:"Text",required:!0,rows:10,value:d,style:{color:"hsl(var(--richtext-foreground))"}}),o.jsx("div",{className:"richtext-flex richtext-flex-1 richtext-items-center richtext-justify-center richtext-rounded-[10px] richtext-p-[10px]",dangerouslySetInnerHTML:{__html:q},ref:S,style:{height:"100%",borderWidth:1,minHeight:500,background:"#fff"}})]})})}),o.jsx(E.DialogFooter,{children:o.jsx(ae.Button,{disabled:!h,onClick:k,type:"button",children:"Save changes"})})]})]})}const j={TOP_LEFT:"tl",TOP_RIGHT:"tr",BOTTOM_LEFT:"bl",BOTTOM_RIGHT:"br"};function ce({editor:t,node:e,updateAttributes:r,getPos:a,selected:c}){const[T,d]=s.useState({width:L.IMAGE_MAX_SIZE,height:L.IMAGE_MAX_SIZE}),[N,q]=s.useState({width:0,height:0}),[y]=s.useState([j.TOP_LEFT,j.TOP_RIGHT,j.BOTTOM_LEFT,j.BOTTOM_RIGHT]),[l,_]=s.useState(!1),[S,h]=s.useState({x:0,y:0,w:0,h:0,dir:""}),{align:H}=e==null?void 0:e.attrs,f=s.useMemo(()=>{const{src:i,alt:p,width:x,height:v}=e==null?void 0:e.attrs,w=$.isNumber(x)?`${x}px`:x,n=$.isNumber(v)?`${v}px`:v;return{src:i||void 0,alt:p||void 0,style:{width:w||void 0,height:n||void 0}}},[e==null?void 0:e.attrs]),C=s.useMemo(()=>{const{style:{width:i}}=f;return{width:i==="100%"?i:void 0}},[f]);function z(i){q({width:i.target.width,height:i.target.height})}function I(){t.commands.setNodeSelection(a())}const O=s.useCallback(D.throttle(()=>{const{width:i}=getComputedStyle(t.view.dom);d(p=>({...p,width:Number.parseInt(i,10)}))},L.IMAGE_THROTTLE_WAIT_TIME),[t]);function k(i,p){i.preventDefault(),i.stopPropagation();const x=N.width,v=N.height,w=x/v;let n=Number(e.attrs.width),M=Number(e.attrs.height);const m=T.width;n&&!M?(n=n>m?m:n,M=Math.round(n/w)):M&&!n?(n=Math.round(M*w),n=n>m?m:n):!n&&!M?(n=x>m?m:x,M=Math.round(n/w)):n=n>m?m:n,_(!0),h({x:i.clientX,y:i.clientY,w:n,h:M,dir:p})}const u=s.useCallback(D.throttle(i=>{if(i.preventDefault(),i.stopPropagation(),!l)return;const{x:p,w:x,dir:v}=S,w=(i.clientX-p)*(/l/.test(v)?-1:1),{width:n,height:M}=e==null?void 0:e.attrs,m=n/M,B=P.clamp(x+w,L.IMAGE_MIN_SIZE,T.width),X=Math.round(B/m);r({width:B,height:X})},L.IMAGE_THROTTLE_WAIT_TIME),[l,S,T,r,e==null?void 0:e.attrs]),g=s.useCallback(i=>{i.preventDefault(),i.stopPropagation(),l&&(h({x:0,y:0,w:0,h:0,dir:""}),_(!1),I())},[l,I]),R=s.useCallback(()=>{document==null||document.addEventListener("mousemove",u,!0),document==null||document.addEventListener("mouseup",g,!0)},[u,g]),A=s.useCallback(()=>{document==null||document.removeEventListener("mousemove",u,!0),document==null||document.removeEventListener("mouseup",g,!0)},[u,g]);s.useEffect(()=>(l?R():A(),()=>{A()}),[l,R,A]);const b=s.useMemo(()=>new ResizeObserver(()=>O()),[O]);return s.useEffect(()=>(b.observe(t.view.dom),()=>{b.disconnect()}),[t.view.dom,b]),o.jsx(W.NodeViewWrapper,{className:"image-view",style:{...C,width:"100%",textAlign:H},children:o.jsxs("div",{"data-drag-handle":!0,draggable:"true",style:{...C,background:"#fff"},className:`image-view__body ${c?"image-view__body--focused":""} ${l?"image-view__body--resizing":""}`,children:[o.jsx("img",{alt:f.alt,className:"image-view__body__image block",height:"auto",onClick:I,onLoad:z,src:f.src,style:f.style}),t.view.editable&&(c||l)&&o.jsx("div",{className:"image-resizer",children:y==null?void 0:y.map(i=>o.jsx("span",{className:`image-resizer__handler image-resizer__handler--${i}`,onMouseDown:p=>k(p,i)},`image-dir-${i}`))})]})})}const V=D.index_default.extend({name:"mermaid",addOptions(){var t;return{...(t=this.parent)==null?void 0:t.call(this),inline:!1,content:"",marks:"",group:"block",draggable:!1,selectable:!0,atom:!0,HTMLAttributes:{class:"mermaid"},button:({editor:e,t:r,extension:a})=>{var c;return{componentProps:{action:()=>!0,isActive:()=>!1,disabled:!1,editor:e,icon:"Mermaid",tooltip:r("editor.mermaid.tooltip"),upload:(c=a==null?void 0:a.options)==null?void 0:c.upload}}}}},addAttributes(){var t;return{...(t=this.parent)==null?void 0:t.call(this),width:{default:null,parseHTML:e=>{const r=e.querySelector("img"),a=r==null?void 0:r.getAttribute("width");return a?Number.parseInt(a,10):320},renderHTML:e=>({width:e.width})},height:{default:null,parseHTML:e=>{const r=e.querySelector("img"),a=r==null?void 0:r.getAttribute("height");return a?Number.parseInt(a,10):212},renderHTML:e=>({height:e.height})},align:{default:"center",parseHTML:e=>e.getAttribute("align"),renderHTML:e=>({align:e.align})}}},addNodeView(){return W.ReactNodeViewRenderer(ce)},addCommands(){return{setMermaid:(t,e)=>({commands:r,editor:a})=>e?r.insertContent({type:this.name,attrs:t}):r.insertContentAt(a.state.selection.anchor,{type:this.name,attrs:t}),setAlignImageMermaid:t=>({commands:e})=>e.updateAttributes(this.name,{align:t})}},renderHTML({HTMLAttributes:t}){const{align:e}=t;return["div",{style:e?`text-align: ${e};`:"",class:"imageMermaid"},["img",$.mergeAttributes(this.options.HTMLAttributes,t)]]},parseHTML(){return[{tag:"div[class=imageMermaid]",getAttrs:t=>{const e=t.querySelector("img"),r=e==null?void 0:e.getAttribute("width"),a=e==null?void 0:e.getAttribute("height");return{src:e==null?void 0:e.getAttribute("src"),alt:e==null?void 0:e.getAttribute("alt"),width:r?Number.parseInt(r,10):null,height:a?Number.parseInt(a,10):null,align:(e==null?void 0:e.getAttribute("align"))||t.style.textAlign||null}}}]}});exports.Mermaid=V;exports.RichTextMermaid=oe;
|
package/lib/Mermaid.d.cts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Editor } from '@tiptap/react';
|
|
2
2
|
import { Extension } from '@tiptap/core';
|
|
3
|
+
import { JSX } from 'react/jsx-runtime';
|
|
3
4
|
import { Node as Node_2 } from '@tiptap/core';
|
|
4
5
|
|
|
5
6
|
/**
|
|
@@ -78,6 +79,8 @@ export declare interface MermaidOptions extends GeneralOptions<MermaidOptions> {
|
|
|
78
79
|
upload?: (file: File) => Promise<string>;
|
|
79
80
|
}
|
|
80
81
|
|
|
82
|
+
export declare function RichTextMermaid(): JSX.Element;
|
|
83
|
+
|
|
81
84
|
export { }
|
|
82
85
|
|
|
83
86
|
|
|
@@ -111,11 +114,22 @@ declare module '@tiptap/core' {
|
|
|
111
114
|
}
|
|
112
115
|
|
|
113
116
|
|
|
117
|
+
declare module '@tiptap/core' {
|
|
118
|
+
interface Storage {
|
|
119
|
+
color: ColorStorage;
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
|
|
114
124
|
declare module '@tiptap/core' {
|
|
115
125
|
interface Commands<ReturnType> {
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
126
|
+
columns: {
|
|
127
|
+
insertColumns: (attrs?: {
|
|
128
|
+
cols: number;
|
|
129
|
+
}) => ReturnType;
|
|
130
|
+
addColBefore: () => ReturnType;
|
|
131
|
+
addColAfter: () => ReturnType;
|
|
132
|
+
deleteCol: () => ReturnType;
|
|
119
133
|
};
|
|
120
134
|
}
|
|
121
135
|
}
|
|
@@ -123,8 +137,9 @@ declare module '@tiptap/core' {
|
|
|
123
137
|
|
|
124
138
|
declare module '@tiptap/core' {
|
|
125
139
|
interface Commands<ReturnType> {
|
|
126
|
-
|
|
127
|
-
|
|
140
|
+
drawer: {
|
|
141
|
+
setDrawer: (options: any, replace?: any) => ReturnType;
|
|
142
|
+
setAlignImageDrawer: (align: 'left' | 'center' | 'right') => ReturnType;
|
|
128
143
|
};
|
|
129
144
|
}
|
|
130
145
|
}
|
|
@@ -142,7 +157,16 @@ declare module '@tiptap/core' {
|
|
|
142
157
|
declare module '@tiptap/core' {
|
|
143
158
|
interface Commands<ReturnType> {
|
|
144
159
|
exportWord: {
|
|
145
|
-
exportToWord: () => ReturnType;
|
|
160
|
+
exportToWord: (docState: any) => ReturnType;
|
|
161
|
+
};
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
|
|
166
|
+
declare module '@tiptap/core' {
|
|
167
|
+
interface Commands<ReturnType> {
|
|
168
|
+
excalidraw: {
|
|
169
|
+
setExcalidraw: (attrs?: IExcalidrawAttrs) => ReturnType;
|
|
146
170
|
};
|
|
147
171
|
}
|
|
148
172
|
}
|
|
@@ -167,10 +191,8 @@ declare module '@tiptap/core' {
|
|
|
167
191
|
|
|
168
192
|
|
|
169
193
|
declare module '@tiptap/core' {
|
|
170
|
-
interface
|
|
171
|
-
|
|
172
|
-
setPainter: (marks: Mark[]) => ReturnType;
|
|
173
|
-
};
|
|
194
|
+
interface Storage {
|
|
195
|
+
highlight: HighlightStorage;
|
|
174
196
|
}
|
|
175
197
|
}
|
|
176
198
|
|
|
@@ -255,16 +277,6 @@ declare module '@tiptap/core' {
|
|
|
255
277
|
}
|
|
256
278
|
|
|
257
279
|
|
|
258
|
-
declare module '@tiptap/core' {
|
|
259
|
-
interface Commands<ReturnType> {
|
|
260
|
-
lineHeight: {
|
|
261
|
-
setLineHeight: (lineHeight: string) => ReturnType;
|
|
262
|
-
unsetLineHeight: () => ReturnType;
|
|
263
|
-
};
|
|
264
|
-
}
|
|
265
|
-
}
|
|
266
|
-
|
|
267
|
-
|
|
268
280
|
declare module '@tiptap/core' {
|
|
269
281
|
interface Commands<ReturnType> {
|
|
270
282
|
mermaid: {
|
|
@@ -275,20 +287,6 @@ declare module '@tiptap/core' {
|
|
|
275
287
|
}
|
|
276
288
|
|
|
277
289
|
|
|
278
|
-
declare module '@tiptap/core' {
|
|
279
|
-
interface Commands<ReturnType> {
|
|
280
|
-
columns: {
|
|
281
|
-
insertColumns: (attrs?: {
|
|
282
|
-
cols: number;
|
|
283
|
-
}) => ReturnType;
|
|
284
|
-
addColBefore: () => ReturnType;
|
|
285
|
-
addColAfter: () => ReturnType;
|
|
286
|
-
deleteCol: () => ReturnType;
|
|
287
|
-
};
|
|
288
|
-
}
|
|
289
|
-
}
|
|
290
|
-
|
|
291
|
-
|
|
292
290
|
declare module '@tiptap/core' {
|
|
293
291
|
interface Commands<ReturnType> {
|
|
294
292
|
search: {
|
|
@@ -312,16 +310,6 @@ declare module '@tiptap/core' {
|
|
|
312
310
|
}
|
|
313
311
|
|
|
314
312
|
|
|
315
|
-
declare module '@tiptap/core' {
|
|
316
|
-
interface Commands<ReturnType> {
|
|
317
|
-
tableOfContents: {
|
|
318
|
-
setTableOfContents: () => ReturnType;
|
|
319
|
-
removeTableOfContents: () => ReturnType;
|
|
320
|
-
};
|
|
321
|
-
}
|
|
322
|
-
}
|
|
323
|
-
|
|
324
|
-
|
|
325
313
|
declare module '@tiptap/core' {
|
|
326
314
|
interface Commands<ReturnType> {
|
|
327
315
|
twitter: {
|
package/lib/Mermaid.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Editor } from '@tiptap/react';
|
|
2
2
|
import { Extension } from '@tiptap/core';
|
|
3
|
+
import { JSX } from 'react/jsx-runtime';
|
|
3
4
|
import { Node as Node_2 } from '@tiptap/core';
|
|
4
5
|
|
|
5
6
|
/**
|
|
@@ -78,6 +79,8 @@ export declare interface MermaidOptions extends GeneralOptions<MermaidOptions> {
|
|
|
78
79
|
upload?: (file: File) => Promise<string>;
|
|
79
80
|
}
|
|
80
81
|
|
|
82
|
+
export declare function RichTextMermaid(): JSX.Element;
|
|
83
|
+
|
|
81
84
|
export { }
|
|
82
85
|
|
|
83
86
|
|
|
@@ -111,11 +114,22 @@ declare module '@tiptap/core' {
|
|
|
111
114
|
}
|
|
112
115
|
|
|
113
116
|
|
|
117
|
+
declare module '@tiptap/core' {
|
|
118
|
+
interface Storage {
|
|
119
|
+
color: ColorStorage;
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
|
|
114
124
|
declare module '@tiptap/core' {
|
|
115
125
|
interface Commands<ReturnType> {
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
126
|
+
columns: {
|
|
127
|
+
insertColumns: (attrs?: {
|
|
128
|
+
cols: number;
|
|
129
|
+
}) => ReturnType;
|
|
130
|
+
addColBefore: () => ReturnType;
|
|
131
|
+
addColAfter: () => ReturnType;
|
|
132
|
+
deleteCol: () => ReturnType;
|
|
119
133
|
};
|
|
120
134
|
}
|
|
121
135
|
}
|
|
@@ -123,8 +137,9 @@ declare module '@tiptap/core' {
|
|
|
123
137
|
|
|
124
138
|
declare module '@tiptap/core' {
|
|
125
139
|
interface Commands<ReturnType> {
|
|
126
|
-
|
|
127
|
-
|
|
140
|
+
drawer: {
|
|
141
|
+
setDrawer: (options: any, replace?: any) => ReturnType;
|
|
142
|
+
setAlignImageDrawer: (align: 'left' | 'center' | 'right') => ReturnType;
|
|
128
143
|
};
|
|
129
144
|
}
|
|
130
145
|
}
|
|
@@ -142,7 +157,16 @@ declare module '@tiptap/core' {
|
|
|
142
157
|
declare module '@tiptap/core' {
|
|
143
158
|
interface Commands<ReturnType> {
|
|
144
159
|
exportWord: {
|
|
145
|
-
exportToWord: () => ReturnType;
|
|
160
|
+
exportToWord: (docState: any) => ReturnType;
|
|
161
|
+
};
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
|
|
166
|
+
declare module '@tiptap/core' {
|
|
167
|
+
interface Commands<ReturnType> {
|
|
168
|
+
excalidraw: {
|
|
169
|
+
setExcalidraw: (attrs?: IExcalidrawAttrs) => ReturnType;
|
|
146
170
|
};
|
|
147
171
|
}
|
|
148
172
|
}
|
|
@@ -167,10 +191,8 @@ declare module '@tiptap/core' {
|
|
|
167
191
|
|
|
168
192
|
|
|
169
193
|
declare module '@tiptap/core' {
|
|
170
|
-
interface
|
|
171
|
-
|
|
172
|
-
setPainter: (marks: Mark[]) => ReturnType;
|
|
173
|
-
};
|
|
194
|
+
interface Storage {
|
|
195
|
+
highlight: HighlightStorage;
|
|
174
196
|
}
|
|
175
197
|
}
|
|
176
198
|
|
|
@@ -255,16 +277,6 @@ declare module '@tiptap/core' {
|
|
|
255
277
|
}
|
|
256
278
|
|
|
257
279
|
|
|
258
|
-
declare module '@tiptap/core' {
|
|
259
|
-
interface Commands<ReturnType> {
|
|
260
|
-
lineHeight: {
|
|
261
|
-
setLineHeight: (lineHeight: string) => ReturnType;
|
|
262
|
-
unsetLineHeight: () => ReturnType;
|
|
263
|
-
};
|
|
264
|
-
}
|
|
265
|
-
}
|
|
266
|
-
|
|
267
|
-
|
|
268
280
|
declare module '@tiptap/core' {
|
|
269
281
|
interface Commands<ReturnType> {
|
|
270
282
|
mermaid: {
|
|
@@ -275,20 +287,6 @@ declare module '@tiptap/core' {
|
|
|
275
287
|
}
|
|
276
288
|
|
|
277
289
|
|
|
278
|
-
declare module '@tiptap/core' {
|
|
279
|
-
interface Commands<ReturnType> {
|
|
280
|
-
columns: {
|
|
281
|
-
insertColumns: (attrs?: {
|
|
282
|
-
cols: number;
|
|
283
|
-
}) => ReturnType;
|
|
284
|
-
addColBefore: () => ReturnType;
|
|
285
|
-
addColAfter: () => ReturnType;
|
|
286
|
-
deleteCol: () => ReturnType;
|
|
287
|
-
};
|
|
288
|
-
}
|
|
289
|
-
}
|
|
290
|
-
|
|
291
|
-
|
|
292
290
|
declare module '@tiptap/core' {
|
|
293
291
|
interface Commands<ReturnType> {
|
|
294
292
|
search: {
|
|
@@ -312,16 +310,6 @@ declare module '@tiptap/core' {
|
|
|
312
310
|
}
|
|
313
311
|
|
|
314
312
|
|
|
315
|
-
declare module '@tiptap/core' {
|
|
316
|
-
interface Commands<ReturnType> {
|
|
317
|
-
tableOfContents: {
|
|
318
|
-
setTableOfContents: () => ReturnType;
|
|
319
|
-
removeTableOfContents: () => ReturnType;
|
|
320
|
-
};
|
|
321
|
-
}
|
|
322
|
-
}
|
|
323
|
-
|
|
324
|
-
|
|
325
313
|
declare module '@tiptap/core' {
|
|
326
314
|
interface Commands<ReturnType> {
|
|
327
315
|
twitter: {
|