reactjs-tiptap-editor 1.0.26 → 1.0.28

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.
Files changed (160) hide show
  1. package/lib/{ActionMenuButton-B4KDkZ0z.js → ActionMenuButton-BhiGvRJ7.js} +1 -1
  2. package/lib/{ActionMenuButton-C3Cfeza9.cjs → ActionMenuButton-qUxkZlQg.cjs} +1 -1
  3. package/lib/Attachment.cjs +1 -1
  4. package/lib/Attachment.js +27 -27
  5. package/lib/Blockquote.cjs +3 -3
  6. package/lib/Blockquote.js +251 -244
  7. package/lib/Bold.cjs +1 -1
  8. package/lib/Bold.js +2 -2
  9. package/lib/BulletList.cjs +1 -1
  10. package/lib/BulletList.js +2 -2
  11. package/lib/Callout-B9uXfbP3.js +340 -0
  12. package/lib/Callout-C_TXsss3.cjs +1 -0
  13. package/lib/Callout.cjs +1 -1
  14. package/lib/Callout.js +8 -222
  15. package/lib/Clear.cjs +1 -1
  16. package/lib/Clear.js +2 -2
  17. package/lib/Code.cjs +1 -1
  18. package/lib/Code.js +2 -2
  19. package/lib/CodeBlock.cjs +1 -1
  20. package/lib/CodeBlock.js +2 -2
  21. package/lib/CodeView.cjs +1 -1
  22. package/lib/CodeView.js +2 -2
  23. package/lib/Color.cjs +1 -1
  24. package/lib/Color.js +3 -3
  25. package/lib/Column.cjs +1 -1
  26. package/lib/Column.js +2 -2
  27. package/lib/{Drawer-D7E9kTca.cjs → Drawer-D3B4lQJF.cjs} +1 -1
  28. package/lib/{Drawer-DA0FLHs9.js → Drawer-h401Yy6Y.js} +20 -20
  29. package/lib/Drawer.cjs +1 -1
  30. package/lib/Drawer.js +4 -4
  31. package/lib/Emoji.cjs +1 -1
  32. package/lib/Emoji.js +168 -135
  33. package/lib/Excalidraw.cjs +1 -1
  34. package/lib/Excalidraw.js +5 -5
  35. package/lib/ExportPdf.cjs +1 -1
  36. package/lib/ExportPdf.js +2 -2
  37. package/lib/ExportWord.cjs +1 -1
  38. package/lib/ExportWord.js +2 -2
  39. package/lib/FontFamily.cjs +1 -1
  40. package/lib/FontFamily.js +5 -5
  41. package/lib/FontSize.cjs +1 -1
  42. package/lib/FontSize.js +5 -5
  43. package/lib/FormatPainter.cjs +1 -1
  44. package/lib/FormatPainter.js +2 -2
  45. package/lib/Heading.cjs +1 -1
  46. package/lib/Heading.js +10 -10
  47. package/lib/Highlight.cjs +1 -1
  48. package/lib/Highlight.js +3 -3
  49. package/lib/History.cjs +2 -2
  50. package/lib/History.js +584 -531
  51. package/lib/HorizontalRule.cjs +1 -1
  52. package/lib/HorizontalRule.js +2 -2
  53. package/lib/{Iframe-DZ3r3QzK.js → Iframe-Dhn40BXx.js} +3 -3
  54. package/lib/{Iframe-OMVd0xa_.cjs → Iframe-bvGuzYwC.cjs} +1 -1
  55. package/lib/Iframe.cjs +1 -1
  56. package/lib/Iframe.js +3 -3
  57. package/lib/Image.cjs +1 -1
  58. package/lib/Image.js +9 -6
  59. package/lib/ImageGif.cjs +1 -1
  60. package/lib/ImageGif.js +19 -19
  61. package/lib/ImportWord.cjs +1 -1
  62. package/lib/ImportWord.js +15 -15
  63. package/lib/{Indent-kI4G-clX.js → Indent-BK9DvCL7.js} +2 -2
  64. package/lib/{Indent-QgCoonRk.cjs → Indent-IOByomps.cjs} +1 -1
  65. package/lib/Indent.cjs +1 -1
  66. package/lib/Indent.js +2 -2
  67. package/lib/Italic.cjs +1 -1
  68. package/lib/Italic.js +2 -2
  69. package/lib/{Katex-BPbXjcZQ.js → Katex-C_Ah9G9w.js} +7 -6
  70. package/lib/Katex-oLGrtLTf.cjs +4 -0
  71. package/lib/Katex.cjs +1 -1
  72. package/lib/Katex.js +3 -3
  73. package/lib/LineHeight.cjs +1 -1
  74. package/lib/LineHeight.js +4 -4
  75. package/lib/Link.cjs +1 -1
  76. package/lib/Link.js +2 -2
  77. package/lib/{LinkEditBlock-Z7RRurvx.cjs → LinkEditBlock-BojxdGTm.cjs} +2 -2
  78. package/lib/{LinkEditBlock-BYWwH2_x.js → LinkEditBlock-DRdKXffy.js} +39 -35
  79. package/lib/MarkdownPaste.cjs +1 -1
  80. package/lib/MarkdownPaste.js +1 -1
  81. package/lib/Mention.cjs +1 -1
  82. package/lib/Mention.js +4 -4
  83. package/lib/Mermaid.cjs +2 -2
  84. package/lib/Mermaid.js +62 -61
  85. package/lib/MoreMark.cjs +1 -1
  86. package/lib/MoreMark.js +5 -5
  87. package/lib/OrderedList.cjs +1 -1
  88. package/lib/OrderedList.js +2 -2
  89. package/lib/SearchAndReplace.cjs +1 -1
  90. package/lib/SearchAndReplace.js +8 -8
  91. package/lib/SlashCommand.cjs +1 -1
  92. package/lib/SlashCommand.js +7 -7
  93. package/lib/{SlashCommandNodeView-DPPmYEjC.cjs → SlashCommandNodeView-Dai-O3aD.cjs} +1 -1
  94. package/lib/{SlashCommandNodeView-C0l3Fb_3.js → SlashCommandNodeView-qwW9cuYt.js} +6 -6
  95. package/lib/Strike.cjs +1 -1
  96. package/lib/Strike.js +2 -2
  97. package/lib/{Table-DwseaFSD.js → Table-BKM8SvVj.js} +20 -20
  98. package/lib/{Table-D5G3rfwb.cjs → Table-CWI7tKme.cjs} +1 -1
  99. package/lib/Table.cjs +1 -1
  100. package/lib/Table.js +1 -1
  101. package/lib/TaskList.cjs +1 -1
  102. package/lib/TaskList.js +2 -2
  103. package/lib/TextAlign.cjs +1 -1
  104. package/lib/TextAlign.js +3 -3
  105. package/lib/TextDirection.cjs +1 -1
  106. package/lib/TextDirection.js +3 -3
  107. package/lib/TextUnderline.cjs +1 -1
  108. package/lib/TextUnderline.js +2 -2
  109. package/lib/{Twitter-q4ZGZL0i.cjs → Twitter-BfsPzA8_.cjs} +1 -1
  110. package/lib/{Twitter-DP26Lkn8.js → Twitter-CofLQ-zj.js} +9 -9
  111. package/lib/Twitter.cjs +1 -1
  112. package/lib/Twitter.js +3 -3
  113. package/lib/Video.cjs +1 -1
  114. package/lib/Video.js +5 -5
  115. package/lib/bubble.cjs +6 -6
  116. package/lib/bubble.js +2258 -2552
  117. package/lib/{clsx-DRbkQ4T7.cjs → clsx-DJURdKPs.cjs} +2 -2
  118. package/lib/{clsx-_bq4MQQ7.js → clsx-b_2OwHLk.js} +19 -19
  119. package/lib/{dropdown-menu-CURWpB9o.cjs → dropdown-menu-CEMxzgnU.cjs} +1 -1
  120. package/lib/{dropdown-menu-BKSX4gvT.js → dropdown-menu-CKAKsyqu.js} +1 -1
  121. package/lib/extensions/Column/Column.d.ts +10 -2
  122. package/lib/extensions/Image/Image.d.ts +13 -1
  123. package/lib/index-BJQ1G8B1.js +311 -0
  124. package/lib/index-BO82_0q8.cjs +1 -0
  125. package/lib/{index-DQy9iBzV.js → index-Bn_WPziX.js} +1 -1
  126. package/lib/{index-BpLw6ebr.cjs → index-CwbGrQFa.cjs} +1 -1
  127. package/lib/{index-DtyAGMbq.js → index-DKruDABV.js} +1 -1
  128. package/lib/{index-SEMQrdk2.cjs → index-DN-IR-K0.cjs} +1 -1
  129. package/lib/{index-C52cuQ_Y.js → index-DRcwHivm.js} +1415 -1350
  130. package/lib/index-DUeBQoIA.cjs +1 -0
  131. package/lib/{index-Dbm_Mans.js → index-DeoYYWEA.js} +1 -1
  132. package/lib/{index-CHVV5iY-.cjs → index-Dgs2thVL.cjs} +1 -1
  133. package/lib/{index-BaR0Brts.js → index-DjB2kNdz.js} +171 -166
  134. package/lib/{index-CJMI7Fjf.js → index-DuWMq-Qs.js} +1 -1
  135. package/lib/{index-BGfIcDCQ.cjs → index-EoGU7W4e.cjs} +1 -1
  136. package/lib/{index-CDw4Eszh.cjs → index-MDz4NZcT.cjs} +9 -9
  137. package/lib/{index-Dx-Dh7KS.js → index-n4kM0Ll-.js} +110 -105
  138. package/lib/{index-BgNKVyMW.cjs → index-qZURFC5Q.cjs} +1 -1
  139. package/lib/index.cjs +1 -1
  140. package/lib/index.js +12 -12
  141. package/lib/locale-bundle.cjs +1 -1
  142. package/lib/locale-bundle.js +1 -1
  143. package/lib/{popover-BB-ZDnqk.js → popover-Beieacfy.js} +1 -1
  144. package/lib/{popover-CrywEkBR.cjs → popover-Bl1kxRJX.cjs} +1 -1
  145. package/lib/{renderNodeView-5h3-p80E.cjs → renderNodeView-BIgT6Ghg.cjs} +1 -1
  146. package/lib/{renderNodeView-DoKZ4GYy.js → renderNodeView-Bi58v3DZ.js} +2 -2
  147. package/lib/{separator-BGO9AZp4.cjs → separator-DMLtkcoo.cjs} +1 -1
  148. package/lib/{separator-DuuOJRQd.js → separator-DfvK668q.js} +14 -14
  149. package/lib/style.css +1 -1
  150. package/lib/textarea-DV9Fw3y1.cjs +1 -0
  151. package/lib/textarea-GXaWJbm9.js +20 -0
  152. package/lib/theme.cjs +1 -1
  153. package/lib/theme.js +1 -1
  154. package/lib/{updatePosition-CFTYKYNJ.js → updatePosition-DY1jI7qb.js} +2 -2
  155. package/lib/{updatePosition-B1oRJE1x.cjs → updatePosition-D_D-TbEu.cjs} +1 -1
  156. package/package.json +62 -61
  157. package/lib/Katex-CUofhjB5.cjs +0 -4
  158. package/lib/index-BG0kQamI.js +0 -285
  159. package/lib/index-NsYff_Ni.cjs +0 -1
  160. package/lib/index-aujjnfSJ.cjs +0 -1
@@ -1 +1 @@
1
- "use strict";var z=Object.create;var M=Object.defineProperty;var P=Object.getOwnPropertyDescriptor;var V=Object.getOwnPropertyNames;var B=Object.getPrototypeOf,$=Object.prototype.hasOwnProperty;var U=(e,s,i,d)=>{if(s&&typeof s=="object"||typeof s=="function")for(let o of V(s))!$.call(e,o)&&o!==i&&M(e,o,{get:()=>s[o],enumerable:!(d=P(s,o))||d.enumerable});return e};var R=(e,s,i)=>(i=e!=null?z(B(e)):{},U(s||!e||!e.__esModule?M(i,"default",{value:e,enumerable:!0}):i,e));Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const N=require("./index-BGfIcDCQ.cjs"),y=require("./clsx-DRbkQ4T7.cjs"),t=require("react/jsx-runtime"),F=require("re-resizable"),r=require("react"),a=require("./index-aujjnfSJ.cjs"),v=require("./dom-dataset-BqoJhJXt.cjs"),X="_wrap_dra8y_1",Y="_renderWrap_dra8y_7",G="_handlerWrap_dra8y_30",J="_disabled_dra8y_40",T={wrap:X,renderWrap:Y,handlerWrap:G,disabled:J},K=10,Q=200,O=15,W={width:"100%",height:"100%",maxWidth:"100%"};function ee({editor:e,node:s,updateAttributes:i}){const d=r.useRef(null),o=a.useEditableEditor(),x=e.isActive(_.name),{data:p,width:c,height:A}=s.attrs,[m,I]=r.useState(null),[b,D]=r.useState(!0),[u,g]=r.useState(null),[E,S]=r.useState(100),f=r.useCallback(n=>()=>{S(h=>a.clamp(n==="minus"?h-O:h+O,K,Q))},[]);r.useEffect(()=>{let n=!1;return import("@excalidraw/excalidraw").then(h=>{n||(d.current=h.exportToSvg)}).catch(h=>!n&&g(h)).finally(()=>!n&&D(!1)),()=>{n=!0}},[p]),r.useEffect(()=>{let n=!1;return(async()=>{if(!d.current||n||b||u||!p)return;const w=await d.current(p);n||(w.setAttribute("width","100%"),w.setAttribute("height","100%"),w.setAttribute("display","block"),I(w))})(),()=>{n=!0}},[p,b,u]);const L=n=>{i({width:n.width,height:n.height})};return t.jsx(y.NodeViewWrapper,{className:y.clsx(T.wrap,{[T.active]:x,[T.disabled]:!o}),children:t.jsx(F.Resizable,{size:{width:Number.parseInt(c),height:Number.parseInt(A)},onResizeStop:(n,h,w,j)=>{L({width:Number.parseInt(c)+j.width,height:Number.parseInt(A)+j.height})},children:t.jsxs("div",{className:y.clsx(T.renderWrap,"render-wrapper"),style:{...W,overflow:"hidden"},children:[u&&t.jsx("div",{style:W,children:t.jsx("p",{children:u.message||u})}),b&&t.jsx("p",{children:"Loading..."}),!b&&!u&&m&&t.jsx("div",{dangerouslySetInnerHTML:{__html:(m==null?void 0:m.outerHTML)??""},style:{height:"100%",maxHeight:"100%",padding:24,overflow:"hidden",display:"flex",justifyContent:"center",alignItems:"center",transform:`scale(${E/100})`,transition:"all ease-in-out .3s"}}),t.jsxs("div",{className:T.handlerWrap,children:[t.jsx(a.ActionButton,{action:f("minus"),disabled:!o,icon:"ZoomOut",tooltip:"Zoom Out"}),t.jsx(a.ActionButton,{action:f("plus"),disabled:!o,icon:"ZoomIn",tooltip:"Zoom In"})]})]})})})}function te(){const e=a.useEditorInstance(),s=a.useButtonProps(_.name),i=a.useExtension(_.name),{tooltipOptions:d={},isActive:o=void 0}=(s==null?void 0:s.componentProps)??{},{editorDisabled:x}=a.useToggleActive(o),p=r.useMemo(()=>(i==null?void 0:i.options)||{},[i]),[c,A]=r.useState(null),[m,I]=r.useState({}),[b,D]=r.useState({elements:[],appState:{isLoading:!1},files:null}),[u,g]=r.useState(!1),[E,S]=r.useState(!0),[f,L]=r.useState(null),n=r.useCallback(l=>{l&&import("@excalidraw/excalidraw").then(C=>{A(C.Excalidraw)}).catch(L).finally(()=>S(!1))},[S]),h=r.useCallback(l=>{setTimeout(()=>{l.refresh()})},[]),w=r.useCallback((l,C,q)=>{I({elements:l,appState:{isLoading:!1},files:q})},[]),j=r.useCallback(()=>{if(!c){g(!1);return}e.chain().focus().setExcalidraw({data:m}).run(),g(!1)},[c,e,m,g]),k=l=>{g(!0),l!=null&&l.data&&D(l==null?void 0:l.data)},Z=a.EVENTS.EXCALIDRAW(e.id);return a.useListener(k,[Z]),r.useEffect(()=>{!E&&c&&u&&setTimeout(()=>{window.dispatchEvent(new Event("resize"))},400)},[E,c,u]),t.jsxs(a.Dialog,{onOpenChange:g,open:u,children:[t.jsx(a.DialogTrigger,{asChild:!0,children:t.jsx(a.ActionButton,{disabled:x,icon:"Excalidraw",tooltip:"Excalidraw",tooltipOptions:d,action:()=>{x||g(!0)}})}),t.jsxs(a.DialogContent,{className:"richtext-z-[99999] !richtext-max-w-[1300px]",children:[t.jsx(a.DialogTitle,{children:"Excalidraw"}),t.jsxs("div",{style:{height:"100%",borderWidth:1},children:[E&&t.jsx("p",{children:"Loading..."}),f&&t.jsx("p",{children:f&&f.message||"Error"}),t.jsx("div",{ref:n,style:{width:"100%",height:600},children:!E&&!f&&c?t.jsx(c,{initialData:b,langCode:"en",onChange:w,ref:h,...p.excalidrawProps}):null})]}),t.jsx(a.DialogFooter,{children:t.jsx(a.Button,{disabled:!c,onClick:j,type:"button",children:"Save changes"})})]})]})}const H={elements:[]},_=N.Node3.create({name:"excalidraw",group:"block",selectable:!0,atom:!0,draggable:!0,inline:!1,addAttributes(){return{defaultShowPicker:{default:!1},createUser:{default:null},width:{default:"100%",parseHTML:v.getDatasetAttribute("width")},height:{default:240,parseHTML:v.getDatasetAttribute("height")},data:{default:H,parseHTML:v.getDatasetAttribute("data",!0)}}},addOptions(){var e;return{...(e=this.parent)==null?void 0:e.call(this),HTMLAttributes:{class:"excalidraw"},excalidrawProps:{},button:()=>({componentProps:{}})}},parseHTML(){return[{tag:"div[class=excalidraw]"}]},renderHTML({HTMLAttributes:e,node:s}){return["div",N.mergeAttributes(this.options.HTMLAttributes,e,v.nodeAttrsToDataset(s))]},addCommands(){return{setExcalidraw:e=>({tr:s,commands:i,chain:d})=>{var o,x,p;return e=e||{},e.data=e.data||H,((p=(x=(o=s.selection)==null?void 0:o.node)==null?void 0:x.type)==null?void 0:p.name)==this.name?i.updateAttributes(this.name,e):d().insertContent({type:this.name,attrs:e}).run()}}},addNodeView(){return y.ReactNodeViewRenderer(ee)},addInputRules(){return[N.nodeInputRule({find:/^\$excalidraw\$$/,type:this.type,getAttributes:()=>({width:"100%"})})]}});exports.Excalidraw=_;exports.RichTextExcalidraw=te;
1
+ "use strict";var z=Object.create;var M=Object.defineProperty;var P=Object.getOwnPropertyDescriptor;var V=Object.getOwnPropertyNames;var B=Object.getPrototypeOf,$=Object.prototype.hasOwnProperty;var U=(e,s,i,d)=>{if(s&&typeof s=="object"||typeof s=="function")for(let o of V(s))!$.call(e,o)&&o!==i&&M(e,o,{get:()=>s[o],enumerable:!(d=P(s,o))||d.enumerable});return e};var R=(e,s,i)=>(i=e!=null?z(B(e)):{},U(s||!e||!e.__esModule?M(i,"default",{value:e,enumerable:!0}):i,e));Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const N=require("./index-EoGU7W4e.cjs"),y=require("./clsx-DJURdKPs.cjs"),t=require("react/jsx-runtime"),F=require("re-resizable"),r=require("react"),a=require("./index-BO82_0q8.cjs"),v=require("./dom-dataset-BqoJhJXt.cjs"),X="_wrap_dra8y_1",Y="_renderWrap_dra8y_7",G="_handlerWrap_dra8y_30",J="_disabled_dra8y_40",T={wrap:X,renderWrap:Y,handlerWrap:G,disabled:J},K=10,Q=200,O=15,W={width:"100%",height:"100%",maxWidth:"100%"};function ee({editor:e,node:s,updateAttributes:i}){const d=r.useRef(null),o=a.useEditableEditor(),x=e.isActive(_.name),{data:p,width:c,height:A}=s.attrs,[m,I]=r.useState(null),[b,D]=r.useState(!0),[u,g]=r.useState(null),[E,S]=r.useState(100),f=r.useCallback(n=>()=>{S(h=>a.clamp(n==="minus"?h-O:h+O,K,Q))},[]);r.useEffect(()=>{let n=!1;return import("@excalidraw/excalidraw").then(h=>{n||(d.current=h.exportToSvg)}).catch(h=>!n&&g(h)).finally(()=>!n&&D(!1)),()=>{n=!0}},[p]),r.useEffect(()=>{let n=!1;return(async()=>{if(!d.current||n||b||u||!p)return;const w=await d.current(p);n||(w.setAttribute("width","100%"),w.setAttribute("height","100%"),w.setAttribute("display","block"),I(w))})(),()=>{n=!0}},[p,b,u]);const L=n=>{i({width:n.width,height:n.height})};return t.jsx(y.NodeViewWrapper,{className:y.clsx(T.wrap,{[T.active]:x,[T.disabled]:!o}),children:t.jsx(F.Resizable,{size:{width:Number.parseInt(c),height:Number.parseInt(A)},onResizeStop:(n,h,w,j)=>{L({width:Number.parseInt(c)+j.width,height:Number.parseInt(A)+j.height})},children:t.jsxs("div",{className:y.clsx(T.renderWrap,"render-wrapper"),style:{...W,overflow:"hidden"},children:[u&&t.jsx("div",{style:W,children:t.jsx("p",{children:u.message||u})}),b&&t.jsx("p",{children:"Loading..."}),!b&&!u&&m&&t.jsx("div",{dangerouslySetInnerHTML:{__html:(m==null?void 0:m.outerHTML)??""},style:{height:"100%",maxHeight:"100%",padding:24,overflow:"hidden",display:"flex",justifyContent:"center",alignItems:"center",transform:`scale(${E/100})`,transition:"all ease-in-out .3s"}}),t.jsxs("div",{className:T.handlerWrap,children:[t.jsx(a.ActionButton,{action:f("minus"),disabled:!o,icon:"ZoomOut",tooltip:"Zoom Out"}),t.jsx(a.ActionButton,{action:f("plus"),disabled:!o,icon:"ZoomIn",tooltip:"Zoom In"})]})]})})})}function te(){const e=a.useEditorInstance(),s=a.useButtonProps(_.name),i=a.useExtension(_.name),{tooltipOptions:d={},isActive:o=void 0}=(s==null?void 0:s.componentProps)??{},{editorDisabled:x}=a.useToggleActive(o),p=r.useMemo(()=>(i==null?void 0:i.options)||{},[i]),[c,A]=r.useState(null),[m,I]=r.useState({}),[b,D]=r.useState({elements:[],appState:{isLoading:!1},files:null}),[u,g]=r.useState(!1),[E,S]=r.useState(!0),[f,L]=r.useState(null),n=r.useCallback(l=>{l&&import("@excalidraw/excalidraw").then(C=>{A(C.Excalidraw)}).catch(L).finally(()=>S(!1))},[S]),h=r.useCallback(l=>{setTimeout(()=>{l.refresh()})},[]),w=r.useCallback((l,C,q)=>{I({elements:l,appState:{isLoading:!1},files:q})},[]),j=r.useCallback(()=>{if(!c){g(!1);return}e.chain().focus().setExcalidraw({data:m}).run(),g(!1)},[c,e,m,g]),k=l=>{g(!0),l!=null&&l.data&&D(l==null?void 0:l.data)},Z=a.EVENTS.EXCALIDRAW(e.id);return a.useListener(k,[Z]),r.useEffect(()=>{!E&&c&&u&&setTimeout(()=>{window.dispatchEvent(new Event("resize"))},400)},[E,c,u]),t.jsxs(a.Dialog,{onOpenChange:g,open:u,children:[t.jsx(a.DialogTrigger,{asChild:!0,children:t.jsx(a.ActionButton,{disabled:x,icon:"Excalidraw",tooltip:"Excalidraw",tooltipOptions:d,action:()=>{x||g(!0)}})}),t.jsxs(a.DialogContent,{className:"richtext-z-[99999] !richtext-max-w-[1300px]",children:[t.jsx(a.DialogTitle,{children:"Excalidraw"}),t.jsxs("div",{style:{height:"100%",borderWidth:1},children:[E&&t.jsx("p",{children:"Loading..."}),f&&t.jsx("p",{children:f&&f.message||"Error"}),t.jsx("div",{ref:n,style:{width:"100%",height:600},children:!E&&!f&&c?t.jsx(c,{initialData:b,langCode:"en",onChange:w,ref:h,...p.excalidrawProps}):null})]}),t.jsx(a.DialogFooter,{children:t.jsx(a.Button,{disabled:!c,onClick:j,type:"button",children:"Save changes"})})]})]})}const H={elements:[]},_=N.Node3.create({name:"excalidraw",group:"block",selectable:!0,atom:!0,draggable:!0,inline:!1,addAttributes(){return{defaultShowPicker:{default:!1},createUser:{default:null},width:{default:"100%",parseHTML:v.getDatasetAttribute("width")},height:{default:240,parseHTML:v.getDatasetAttribute("height")},data:{default:H,parseHTML:v.getDatasetAttribute("data",!0)}}},addOptions(){var e;return{...(e=this.parent)==null?void 0:e.call(this),HTMLAttributes:{class:"excalidraw"},excalidrawProps:{},button:()=>({componentProps:{}})}},parseHTML(){return[{tag:"div[class=excalidraw]"}]},renderHTML({HTMLAttributes:e,node:s}){return["div",N.mergeAttributes(this.options.HTMLAttributes,e,v.nodeAttrsToDataset(s))]},addCommands(){return{setExcalidraw:e=>({tr:s,commands:i,chain:d})=>{var o,x,p;return e=e||{},e.data=e.data||H,((p=(x=(o=s.selection)==null?void 0:o.node)==null?void 0:x.type)==null?void 0:p.name)==this.name?i.updateAttributes(this.name,e):d().insertContent({type:this.name,attrs:e}).run()}}},addNodeView(){return y.ReactNodeViewRenderer(ee)},addInputRules(){return[N.nodeInputRule({find:/^\$excalidraw\$$/,type:this.type,getAttributes:()=>({width:"100%"})})]}});exports.Excalidraw=_;exports.RichTextExcalidraw=te;
package/lib/Excalidraw.js CHANGED
@@ -1,9 +1,9 @@
1
- import { N as k, n as $, m as j } from "./index-Dx-Dh7KS.js";
2
- import { N as B, c as R, a as U } from "./clsx-_bq4MQQ7.js";
1
+ import { N as k, n as $, m as j } from "./index-n4kM0Ll-.js";
2
+ import { N as B, c as R, a as U } from "./clsx-b_2OwHLk.js";
3
3
  import { jsx as t, jsxs as T } from "react/jsx-runtime";
4
4
  import { Resizable as F } from "re-resizable";
5
- import { useRef as X, useState as o, useCallback as v, useEffect as M, useMemo as K } from "react";
6
- import { j as Y, F as q, A as S, h as G, u as J, w as Q, d as ee, K as te, N as re, D as ae, n as ne, o as ie, p as se, v as oe, B as le } from "./index-C52cuQ_Y.js";
5
+ import { useRef as X, useState as o, useCallback as v, useEffect as M, useMemo as G } from "react";
6
+ import { j as Y, r as q, A as S, h as J, u as K, n as Q, d as ee, E as te, G as re, D as ae, s as ne, v as ie, w as se, x as oe, B as le } from "./index-DRcwHivm.js";
7
7
  import { n as de, g as D } from "./dom-dataset-CIEeltF6.js";
8
8
  const ce = "_wrap_dra8y_1", ue = "_renderWrap_dra8y_7", he = "_handlerWrap_dra8y_30", pe = "_disabled_dra8y_40", x = {
9
9
  wrap: ce,
@@ -115,7 +115,7 @@ function fe({ editor: e, node: l, updateAttributes: c }) {
115
115
  );
116
116
  }
117
117
  function ye() {
118
- const e = G(), l = J(C.name), c = Q(C.name), { tooltipOptions: p = {}, isActive: u = void 0 } = (l == null ? void 0 : l.componentProps) ?? {}, { editorDisabled: m } = ee(u), d = K(() => (c == null ? void 0 : c.options) || {}, [c]), [n, A] = o(null), [g, N] = o({}), [b, I] = o({
118
+ const e = J(), l = K(C.name), c = Q(C.name), { tooltipOptions: p = {}, isActive: u = void 0 } = (l == null ? void 0 : l.componentProps) ?? {}, { editorDisabled: m } = ee(u), d = G(() => (c == null ? void 0 : c.options) || {}, [c]), [n, A] = o(null), [g, N] = o({}), [b, I] = o({
119
119
  elements: [],
120
120
  appState: { isLoading: !1 },
121
121
  files: null
package/lib/ExportPdf.cjs CHANGED
@@ -1,4 +1,4 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const v=require("./index-BGfIcDCQ.cjs"),l=require("react/jsx-runtime"),m=require("./index-aujjnfSJ.cjs");require("react");require("./theme.cjs");function y(e,n){var u;const t=document.createElement("iframe");t.setAttribute("style","position: absolute; width: 0; height: 0; top: 0; left: 0;"),document.body.appendChild(t);const o=t.contentDocument||((u=t.contentWindow)==null?void 0:u.document);if(!o)return;const{paperSize:d,title:i="React Tiptap Editor",margins:{top:s,right:a,bottom:r,left:c}}=n,p=`
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const v=require("./index-EoGU7W4e.cjs"),l=require("react/jsx-runtime"),m=require("./index-BO82_0q8.cjs");require("react");require("./theme.cjs");function y(e,n){var u;const t=document.createElement("iframe");t.setAttribute("style","position: absolute; width: 0; height: 0; top: 0; left: 0;"),document.body.appendChild(t);const o=t.contentDocument||((u=t.contentWindow)==null?void 0:u.document);if(!o)return;const{paperSize:d,title:i="React Tiptap Editor",margins:{top:s,right:a,bottom:r,left:c}}=n,p=`
2
2
  <!DOCTYPE html>
3
3
  <html lang="en">
4
4
  <head>
package/lib/ExportPdf.js CHANGED
@@ -1,6 +1,6 @@
1
- import { E as b } from "./index-Dx-Dh7KS.js";
1
+ import { E as b } from "./index-n4kM0Ll-.js";
2
2
  import { jsx as f, Fragment as v } from "react/jsx-runtime";
3
- import { u as y, d as x, A as E } from "./index-C52cuQ_Y.js";
3
+ import { u as y, d as x, A as E } from "./index-DRcwHivm.js";
4
4
  import "react";
5
5
  import "./theme.js";
6
6
  function P(o, i) {
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const h=require("./index-BGfIcDCQ.cjs"),u=require("docx"),n=require("prosemirror-docx"),i=require("react/jsx-runtime"),y=require("react"),a=require("./index-aujjnfSJ.cjs");require("./theme.cjs");const g=typeof window<"u";function v(o,e){if(g){const r=window.URL.createObjectURL(o),t=document.createElement("a");return t.href=r,t.download=e,t.click(),window.URL.revokeObjectURL(r),Promise.resolve()}return console.error("Download is not supported in Node.js"),Promise.resolve()}function B(){const o=a.useButtonProps(p.name),[e,r]=y.useState(!1),{icon:t=void 0,tooltip:c=void 0,shortcutKeys:s=void 0,tooltipOptions:f={},action:d=void 0,isActive:m=void 0}=(o==null?void 0:o.componentProps)??{},{dataState:x,disabled:l,update:w}=a.useToggleActive(m),b=async()=>{l||e||d&&(r(!0),await d(),w(),r(!1))};return o?i.jsx(a.ActionButton,{action:b,dataState:x,disabled:l||e,icon:e?"Loader":t,shortcutKeys:s,tooltip:c,tooltipOptions:f}):i.jsx(i.Fragment,{})}const E={...n.defaultNodes,hardBreak:n.defaultNodes.hard_break,codeBlock:n.defaultNodes.code_block,orderedList:n.defaultNodes.ordered_list,listItem:n.defaultNodes.list_item,bulletList:n.defaultNodes.bullet_list,horizontalRule:n.defaultNodes.horizontal_rule,image(o,e){o.renderInline(e),o.closeBlock(e)},table(o,e){o.table(e,{tableOptions:{width:{size:100,type:u.WidthType.PERCENTAGE}}})}},W=new n.DocxSerializer(E,n.defaultMarks),p=h.Extension.create({name:"exportWord",addOptions(){var o;return{...(o=this.parent)==null?void 0:o.call(this),button:({editor:e,t:r})=>({componentProps:{icon:"ExportWord",action:()=>{var t;return e==null?void 0:e.commands.exportToWord((t=e==null?void 0:e.state)==null?void 0:t.doc)},tooltip:r("editor.exportWord.tooltip"),isActive:()=>!1,disabled:!1}})}},addCommands(){return{exportToWord:o=>async()=>{try{const e={getImageBuffer:async t=>{const s=await(await fetch(t)).arrayBuffer();return new Uint8Array(s)}},r=W.serialize(o,e);return u.Packer.toBlob(r).then(t=>v(new Blob([t]),"richtext-export-document.docx")),!0}catch(e){return console.error("Error exporting to Word:",e),!1}}}}});exports.ExportWord=p;exports.RichTextExportWord=B;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const h=require("./index-EoGU7W4e.cjs"),u=require("docx"),n=require("prosemirror-docx"),i=require("react/jsx-runtime"),y=require("react"),a=require("./index-BO82_0q8.cjs");require("./theme.cjs");const g=typeof window<"u";function v(o,e){if(g){const r=window.URL.createObjectURL(o),t=document.createElement("a");return t.href=r,t.download=e,t.click(),window.URL.revokeObjectURL(r),Promise.resolve()}return console.error("Download is not supported in Node.js"),Promise.resolve()}function B(){const o=a.useButtonProps(p.name),[e,r]=y.useState(!1),{icon:t=void 0,tooltip:c=void 0,shortcutKeys:s=void 0,tooltipOptions:f={},action:d=void 0,isActive:m=void 0}=(o==null?void 0:o.componentProps)??{},{dataState:x,disabled:l,update:w}=a.useToggleActive(m),b=async()=>{l||e||d&&(r(!0),await d(),w(),r(!1))};return o?i.jsx(a.ActionButton,{action:b,dataState:x,disabled:l||e,icon:e?"Loader":t,shortcutKeys:s,tooltip:c,tooltipOptions:f}):i.jsx(i.Fragment,{})}const E={...n.defaultNodes,hardBreak:n.defaultNodes.hard_break,codeBlock:n.defaultNodes.code_block,orderedList:n.defaultNodes.ordered_list,listItem:n.defaultNodes.list_item,bulletList:n.defaultNodes.bullet_list,horizontalRule:n.defaultNodes.horizontal_rule,image(o,e){o.renderInline(e),o.closeBlock(e)},table(o,e){o.table(e,{tableOptions:{width:{size:100,type:u.WidthType.PERCENTAGE}}})}},W=new n.DocxSerializer(E,n.defaultMarks),p=h.Extension.create({name:"exportWord",addOptions(){var o;return{...(o=this.parent)==null?void 0:o.call(this),button:({editor:e,t:r})=>({componentProps:{icon:"ExportWord",action:()=>{var t;return e==null?void 0:e.commands.exportToWord((t=e==null?void 0:e.state)==null?void 0:t.doc)},tooltip:r("editor.exportWord.tooltip"),isActive:()=>!1,disabled:!1}})}},addCommands(){return{exportToWord:o=>async()=>{try{const e={getImageBuffer:async t=>{const s=await(await fetch(t)).arrayBuffer();return new Uint8Array(s)}},r=W.serialize(o,e);return u.Packer.toBlob(r).then(t=>v(new Blob([t]),"richtext-export-document.docx")),!0}catch(e){return console.error("Error exporting to Word:",e),!1}}}}});exports.ExportWord=p;exports.RichTextExportWord=B;
package/lib/ExportWord.js CHANGED
@@ -1,9 +1,9 @@
1
- import { E as w } from "./index-Dx-Dh7KS.js";
1
+ import { E as w } from "./index-n4kM0Ll-.js";
2
2
  import { Packer as x, WidthType as b } from "docx";
3
3
  import { defaultNodes as n, DocxSerializer as h, defaultMarks as B } from "prosemirror-docx";
4
4
  import { jsx as d, Fragment as v } from "react/jsx-runtime";
5
5
  import { useState as y } from "react";
6
- import { u as E, d as g, A as k } from "./index-C52cuQ_Y.js";
6
+ import { u as E, d as g, A as k } from "./index-DRcwHivm.js";
7
7
  import "./theme.js";
8
8
  const W = typeof window < "u";
9
9
  function A(e, o) {
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const v=require("./index-SEMQrdk2.cjs"),F=require("./index-BpLw6ebr.cjs"),f=require("./index-aujjnfSJ.cjs"),e=require("react/jsx-runtime"),m=require("react"),x=require("./ActionMenuButton-C3Cfeza9.cjs");require("./theme.cjs");const d=require("./dropdown-menu-CURWpB9o.cjs");function M(){const{t:l}=F.useLocale(),o=f.useButtonProps(p.name),{icon:a=void 0,tooltip:u=void 0,items:r=[],isActive:s=void 0}=(o==null?void 0:o.componentProps)??{},{disabled:c,dataState:t}=f.useActive(s),n=m.useMemo(()=>(t==null?void 0:t.font)||l("editor.fontFamily.default.tooltip"),[t]);return o?e.jsxs(d.DropdownMenu,{children:[e.jsx(d.DropdownMenuTrigger,{asChild:!0,disabled:c,children:e.jsx(x.ActionMenuButton,{disabled:c,icon:a,title:(n==null?void 0:n.length)>12?`${n==null?void 0:n.slice(0,12)}...`:n,tooltip:u})}),e.jsx(d.DropdownMenuContent,{className:"richtext-w-full",children:r==null?void 0:r.map((i,y)=>{const h=i.font===l("editor.fontFamily.default.tooltip")?{}:{fontFamily:i.font};return e.jsxs(m.Fragment,{children:[e.jsx(d.DropdownMenuCheckboxItem,{checked:n===i.font,onClick:i.action,children:e.jsx("div",{className:"richtext-ml-1 richtext-h-full",style:h,children:i.font})}),i.font===l("editor.fontFamily.default.tooltip")&&e.jsx(d.DropdownMenuSeparator,{})]},`font-family-${y}`)})})]}):e.jsx(e.Fragment,{})}const p=v.FontFamily.extend({addOptions(){var l;return{...(l=this.parent)==null?void 0:l.call(this),fontFamilyList:F.DEFAULT_FONT_FAMILY_LIST,button({editor:o,extension:a,t:u}){var c;const r=f.ensureNameValueOptions(((c=a==null?void 0:a.options)==null?void 0:c.fontFamilyList)||[]),s=r.map(t=>({action:()=>{if(t.value==="Default"){o.chain().focus().unsetFontFamily().run();return}o.chain().focus().setFontFamily(t.value).run()},isActive:()=>o.isActive("textStyle",{fontFamily:t.value})||!1,title:t.name,font:t.value,default:t.value==="Default"}));return{componentProps:{tooltip:u("editor.fontFamily.tooltip"),disabled:!1,items:s,isActive:()=>{const t=s==null?void 0:s.find(i=>i.isActive());return t&&!t.default?t:{title:u("editor.fontFamily.default.tooltip"),font:u("editor.fontFamily.default.tooltip"),isActive:()=>!1,disabled:!1}},icon:"MenuDown",fontFamilyList:r}}}}}});exports.FontFamily=p;exports.RichTextFontFamily=M;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const v=require("./index-DN-IR-K0.cjs"),F=require("./index-CwbGrQFa.cjs"),f=require("./index-BO82_0q8.cjs"),e=require("react/jsx-runtime"),m=require("react"),x=require("./ActionMenuButton-qUxkZlQg.cjs");require("./theme.cjs");const d=require("./dropdown-menu-CEMxzgnU.cjs");function M(){const{t:l}=F.useLocale(),o=f.useButtonProps(p.name),{icon:a=void 0,tooltip:u=void 0,items:r=[],isActive:s=void 0}=(o==null?void 0:o.componentProps)??{},{disabled:c,dataState:t}=f.useActive(s),n=m.useMemo(()=>(t==null?void 0:t.font)||l("editor.fontFamily.default.tooltip"),[t]);return o?e.jsxs(d.DropdownMenu,{children:[e.jsx(d.DropdownMenuTrigger,{asChild:!0,disabled:c,children:e.jsx(x.ActionMenuButton,{disabled:c,icon:a,title:(n==null?void 0:n.length)>12?`${n==null?void 0:n.slice(0,12)}...`:n,tooltip:u})}),e.jsx(d.DropdownMenuContent,{className:"richtext-w-full",children:r==null?void 0:r.map((i,y)=>{const h=i.font===l("editor.fontFamily.default.tooltip")?{}:{fontFamily:i.font};return e.jsxs(m.Fragment,{children:[e.jsx(d.DropdownMenuCheckboxItem,{checked:n===i.font,onClick:i.action,children:e.jsx("div",{className:"richtext-ml-1 richtext-h-full",style:h,children:i.font})}),i.font===l("editor.fontFamily.default.tooltip")&&e.jsx(d.DropdownMenuSeparator,{})]},`font-family-${y}`)})})]}):e.jsx(e.Fragment,{})}const p=v.FontFamily.extend({addOptions(){var l;return{...(l=this.parent)==null?void 0:l.call(this),fontFamilyList:F.DEFAULT_FONT_FAMILY_LIST,button({editor:o,extension:a,t:u}){var c;const r=f.ensureNameValueOptions(((c=a==null?void 0:a.options)==null?void 0:c.fontFamilyList)||[]),s=r.map(t=>({action:()=>{if(t.value==="Default"){o.chain().focus().unsetFontFamily().run();return}o.chain().focus().setFontFamily(t.value).run()},isActive:()=>o.isActive("textStyle",{fontFamily:t.value})||!1,title:t.name,font:t.value,default:t.value==="Default"}));return{componentProps:{tooltip:u("editor.fontFamily.tooltip"),disabled:!1,items:s,isActive:()=>{const t=s==null?void 0:s.find(i=>i.isActive());return t&&!t.default?t:{title:u("editor.fontFamily.default.tooltip"),font:u("editor.fontFamily.default.tooltip"),isActive:()=>!1,disabled:!1}},icon:"MenuDown",fontFamilyList:r}}}}}});exports.FontFamily=p;exports.RichTextFontFamily=M;
package/lib/FontFamily.js CHANGED
@@ -1,11 +1,11 @@
1
- import { F as p } from "./index-CJMI7Fjf.js";
2
- import { u as F, D as y } from "./index-DtyAGMbq.js";
3
- import { u as h, e as v, f as A } from "./index-C52cuQ_Y.js";
1
+ import { F as p } from "./index-DuWMq-Qs.js";
2
+ import { u as F, D as y } from "./index-DKruDABV.js";
3
+ import { u as h, e as v, f as A } from "./index-DRcwHivm.js";
4
4
  import { jsx as i, Fragment as D, jsxs as f } from "react/jsx-runtime";
5
5
  import { useMemo as M, Fragment as w } from "react";
6
- import { A as L } from "./ActionMenuButton-B4KDkZ0z.js";
6
+ import { A as L } from "./ActionMenuButton-BhiGvRJ7.js";
7
7
  import "./theme.js";
8
- import { D as g, a as x, b, c as T, d as C } from "./dropdown-menu-BKSX4gvT.js";
8
+ import { D as g, a as x, b, c as T, d as C } from "./dropdown-menu-CKAKsyqu.js";
9
9
  function S() {
10
10
  const { t: a } = F(), n = h(N.name), {
11
11
  icon: s = void 0,
package/lib/FontSize.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const m=require("./index-BGfIcDCQ.cjs"),x=require("./index-BpLw6ebr.cjs"),S=require("./index-aujjnfSJ.cjs"),o=require("react/jsx-runtime"),p=require("react"),h=require("./ActionMenuButton-C3Cfeza9.cjs");require("./theme.cjs");const l=require("./dropdown-menu-CURWpB9o.cjs");function v(){const{t}=x.useLocale(),n=S.useButtonProps(z.name),{icon:d=void 0,tooltip:s=void 0,items:c=[],isActive:a=void 0}=(n==null?void 0:n.componentProps)??{},{disabled:u,dataState:e}=S.useActive(a),r=p.useMemo(()=>(e==null?void 0:e.title)||t("editor.fontSize.default.tooltip"),[e]);return n?o.jsxs(l.DropdownMenu,{children:[o.jsx(l.DropdownMenuTrigger,{asChild:!0,disabled:u,children:o.jsx(h.ActionMenuButton,{disabled:u,icon:d,title:r,tooltip:s})}),o.jsx(l.DropdownMenuContent,{className:"richtext-max-h-96 richtext-w-32 richtext-overflow-y-auto",children:c==null?void 0:c.map((i,f)=>o.jsxs(p.Fragment,{children:[o.jsx(l.DropdownMenuCheckboxItem,{checked:r===i.title,onClick:i.action,children:o.jsx("div",{className:"richtext-ml-1 richtext-h-full",children:i.title})}),i.title===t("editor.fontSize.default.tooltip")&&o.jsx(l.DropdownMenuSeparator,{})]},`font-size-${f}`))})]}):o.jsx(o.Fragment,{})}const z=m.Extension.create({name:"fontSize",addOptions(){var t;return{...(t=this.parent)==null?void 0:t.call(this),types:["textStyle"],fontSizes:x.DEFAULT_FONT_SIZE_LIST,button({editor:n,extension:d,t:s}){var u;const a=S.ensureNameValueOptions((u=d.options)==null?void 0:u.fontSizes).map(e=>({title:e.value==="Default"?s("editor.fontSize.default.tooltip"):String(e.name),isActive:()=>{const{fontSize:r}=n.getAttributes("textStyle"),i=e.value==="Default",f=r==null||r==="";return i&&f?!0:n.isActive({fontSize:String(e.value)})||!1},action:()=>{if(e.value==="Default"){n.commands.unsetFontSize();return}n.commands.setFontSize(String(e.value))},default:e.value==="Default"||!1}));return{componentProps:{editor:n,tooltip:s("editor.fontSize.tooltip"),disabled:!1,items:a,maxHeight:280,icon:"MenuDown",isActive:()=>{const e=(a||[]).find(i=>i.isActive());return e&&!e.default?e:{title:s("editor.fontSize.default.tooltip"),isActive:()=>!1}}}}}}},addGlobalAttributes(){return[{types:this.options.types,attributes:{fontSize:{default:null,parseHTML:t=>t.style.fontSize.replaceAll(/["']+/g,""),renderHTML:t=>t.fontSize?{style:`font-size: ${t.fontSize}`}:{}}}}]},addCommands(){return{setFontSize:t=>({chain:n})=>n().setMark("textStyle",{fontSize:t}).run(),unsetFontSize:()=>({chain:t})=>t().setMark("textStyle",{fontSize:null}).removeEmptyTextStyle().run()}}});exports.FontSize=z;exports.RichTextFontSize=v;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const m=require("./index-EoGU7W4e.cjs"),x=require("./index-CwbGrQFa.cjs"),S=require("./index-BO82_0q8.cjs"),o=require("react/jsx-runtime"),p=require("react"),h=require("./ActionMenuButton-qUxkZlQg.cjs");require("./theme.cjs");const l=require("./dropdown-menu-CEMxzgnU.cjs");function v(){const{t}=x.useLocale(),n=S.useButtonProps(z.name),{icon:d=void 0,tooltip:s=void 0,items:c=[],isActive:a=void 0}=(n==null?void 0:n.componentProps)??{},{disabled:u,dataState:e}=S.useActive(a),r=p.useMemo(()=>(e==null?void 0:e.title)||t("editor.fontSize.default.tooltip"),[e]);return n?o.jsxs(l.DropdownMenu,{children:[o.jsx(l.DropdownMenuTrigger,{asChild:!0,disabled:u,children:o.jsx(h.ActionMenuButton,{disabled:u,icon:d,title:r,tooltip:s})}),o.jsx(l.DropdownMenuContent,{className:"richtext-max-h-96 richtext-w-32 richtext-overflow-y-auto",children:c==null?void 0:c.map((i,f)=>o.jsxs(p.Fragment,{children:[o.jsx(l.DropdownMenuCheckboxItem,{checked:r===i.title,onClick:i.action,children:o.jsx("div",{className:"richtext-ml-1 richtext-h-full",children:i.title})}),i.title===t("editor.fontSize.default.tooltip")&&o.jsx(l.DropdownMenuSeparator,{})]},`font-size-${f}`))})]}):o.jsx(o.Fragment,{})}const z=m.Extension.create({name:"fontSize",addOptions(){var t;return{...(t=this.parent)==null?void 0:t.call(this),types:["textStyle"],fontSizes:x.DEFAULT_FONT_SIZE_LIST,button({editor:n,extension:d,t:s}){var u;const a=S.ensureNameValueOptions((u=d.options)==null?void 0:u.fontSizes).map(e=>({title:e.value==="Default"?s("editor.fontSize.default.tooltip"):String(e.name),isActive:()=>{const{fontSize:r}=n.getAttributes("textStyle"),i=e.value==="Default",f=r==null||r==="";return i&&f?!0:n.isActive({fontSize:String(e.value)})||!1},action:()=>{if(e.value==="Default"){n.commands.unsetFontSize();return}n.commands.setFontSize(String(e.value))},default:e.value==="Default"||!1}));return{componentProps:{editor:n,tooltip:s("editor.fontSize.tooltip"),disabled:!1,items:a,maxHeight:280,icon:"MenuDown",isActive:()=>{const e=(a||[]).find(i=>i.isActive());return e&&!e.default?e:{title:s("editor.fontSize.default.tooltip"),isActive:()=>!1}}}}}}},addGlobalAttributes(){return[{types:this.options.types,attributes:{fontSize:{default:null,parseHTML:t=>t.style.fontSize.replaceAll(/["']+/g,""),renderHTML:t=>t.fontSize?{style:`font-size: ${t.fontSize}`}:{}}}}]},addCommands(){return{setFontSize:t=>({chain:n})=>n().setMark("textStyle",{fontSize:t}).run(),unsetFontSize:()=>({chain:t})=>t().setMark("textStyle",{fontSize:null}).removeEmptyTextStyle().run()}}});exports.FontSize=z;exports.RichTextFontSize=v;
package/lib/FontSize.js CHANGED
@@ -1,11 +1,11 @@
1
- import { E as m } from "./index-Dx-Dh7KS.js";
2
- import { u as p, h as S } from "./index-DtyAGMbq.js";
3
- import { u as z, e as h, f as v } from "./index-C52cuQ_Y.js";
1
+ import { E as m } from "./index-n4kM0Ll-.js";
2
+ import { u as p, h as S } from "./index-DKruDABV.js";
3
+ import { u as z, e as h, f as v } from "./index-DRcwHivm.js";
4
4
  import { jsx as r, Fragment as x, jsxs as d } from "react/jsx-runtime";
5
5
  import { useMemo as A, Fragment as D } from "react";
6
- import { A as y } from "./ActionMenuButton-B4KDkZ0z.js";
6
+ import { A as y } from "./ActionMenuButton-BhiGvRJ7.js";
7
7
  import "./theme.js";
8
- import { D as F, a as M, b as g, c as w, d as T } from "./dropdown-menu-BKSX4gvT.js";
8
+ import { D as F, a as M, b as g, c as w, d as T } from "./dropdown-menu-CKAKsyqu.js";
9
9
  function $() {
10
10
  const { t: e } = p(), n = z(b.name), {
11
11
  icon: f = void 0,
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const S=require("./index-BGfIcDCQ.cjs"),y=require("@tiptap/pm/state"),c=require("./index-aujjnfSJ.cjs"),l=require("react/jsx-runtime"),P=require("react");require("./theme.cjs");function v(){const t=c.useEditorInstance(),e=c.useEditableEditor(),n=c.useButtonProps(g.name),{icon:r=void 0,tooltip:s=void 0,shortcutKeys:o=void 0,tooltipOptions:M={},action:f=void 0,isActive:u=void 0}=(n==null?void 0:n.componentProps)??{},[E,k]=P.useState(()=>!!(u!=null&&u()));P.useEffect(()=>{if(!t||!u)return;const i=()=>{k(!!u())};return i(),t.on("selectionUpdate",i),t.on("transaction",i),()=>{t.off("selectionUpdate",i),t.off("transaction",i)}},[t,u]);const p=!e||!t,h=()=>{p||f==null||f()};return n?l.jsx(c.ActionButton,{action:h,dataState:E,disabled:p,icon:r,shortcutKeys:o,tooltip:s,tooltipOptions:M}):l.jsx(l.Fragment,{})}const d=new Set(["link"]),a=new y.PluginKey("format-painter");function m(t){return a.getState(t)??[]}function x(t){const{selection:e,storedMarks:n}=t,r=[];return n!=null&&n.length||e.empty?((n??e.$from.marks()).forEach(o=>{d.has(o.type.name)||r.push(o)}),r):(t.doc.nodesBetween(e.from,e.to,s=>!s.isText||r.length>0?!0:(s.marks.forEach(o=>{d.has(o.type.name)||r.push(o)}),!1)),r)}function b(t,e,n){const{from:r,to:s}=e.selection;return Object.values(e.schema.marks).forEach(o=>{d.has(o.name)||(t=t.removeMark(r,s,o))}),n.forEach(o=>{t=t.addMark(r,s,o)}),t}const g=S.Extension.create({name:"painter",addOptions(){var t;return{...(t=this.parent)==null?void 0:t.call(this),button:({editor:e,t:n})=>({component:c.ActionButton,componentProps:{action:()=>{if(m(e.state).length>0){e.commands.unsetPainter();return}e.commands.setPainter()},isActive:()=>m(e.state).length>0,icon:"PaintRoller",tooltip:n("editor.format")}})}},addCommands(){return{setPainter:()=>({dispatch:t,state:e})=>{const n=x(e);return n.length?(t==null||t(e.tr.setMeta(a,{type:"start",marks:n})),!0):(t==null||t(e.tr.setMeta(a,{type:"end"})),!1)},unsetPainter:()=>({dispatch:t,state:e})=>(t==null||t(e.tr.setMeta(a,{type:"end"})),!0)}},addProseMirrorPlugins(){return[new y.Plugin({key:a,state:{init:()=>[],apply:(t,e)=>{const n=t.getMeta(a);return(n==null?void 0:n.type)==="start"?n.marks:(n==null?void 0:n.type)==="end"?[]:e}},props:{handleDOMEvents:{keydown:(t,e)=>e.key!=="Escape"||m(t.state).length===0?!1:(t.dispatch(t.state.tr.setMeta(a,{type:"end"})),!0),mousedown:t=>{const e=m(t.state);if(!e.length)return!1;const n=()=>{document.removeEventListener("mouseup",n);const{state:r}=t,{selection:s}=r,o=s.empty?r.tr:b(r.tr,r,e);t.dispatch(o.setMeta(a,{type:"end"}))};return document.addEventListener("mouseup",n),!1}}}})]}});exports.FormatPainter=g;exports.RichTextFormatPainter=v;exports.formatPainterPluginKey=a;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const S=require("./index-EoGU7W4e.cjs"),y=require("@tiptap/pm/state"),c=require("./index-BO82_0q8.cjs"),l=require("react/jsx-runtime"),P=require("react");require("./theme.cjs");function v(){const t=c.useEditorInstance(),e=c.useEditableEditor(),n=c.useButtonProps(g.name),{icon:r=void 0,tooltip:s=void 0,shortcutKeys:o=void 0,tooltipOptions:M={},action:f=void 0,isActive:u=void 0}=(n==null?void 0:n.componentProps)??{},[E,k]=P.useState(()=>!!(u!=null&&u()));P.useEffect(()=>{if(!t||!u)return;const i=()=>{k(!!u())};return i(),t.on("selectionUpdate",i),t.on("transaction",i),()=>{t.off("selectionUpdate",i),t.off("transaction",i)}},[t,u]);const p=!e||!t,h=()=>{p||f==null||f()};return n?l.jsx(c.ActionButton,{action:h,dataState:E,disabled:p,icon:r,shortcutKeys:o,tooltip:s,tooltipOptions:M}):l.jsx(l.Fragment,{})}const d=new Set(["link"]),a=new y.PluginKey("format-painter");function m(t){return a.getState(t)??[]}function x(t){const{selection:e,storedMarks:n}=t,r=[];return n!=null&&n.length||e.empty?((n??e.$from.marks()).forEach(o=>{d.has(o.type.name)||r.push(o)}),r):(t.doc.nodesBetween(e.from,e.to,s=>!s.isText||r.length>0?!0:(s.marks.forEach(o=>{d.has(o.type.name)||r.push(o)}),!1)),r)}function b(t,e,n){const{from:r,to:s}=e.selection;return Object.values(e.schema.marks).forEach(o=>{d.has(o.name)||(t=t.removeMark(r,s,o))}),n.forEach(o=>{t=t.addMark(r,s,o)}),t}const g=S.Extension.create({name:"painter",addOptions(){var t;return{...(t=this.parent)==null?void 0:t.call(this),button:({editor:e,t:n})=>({component:c.ActionButton,componentProps:{action:()=>{if(m(e.state).length>0){e.commands.unsetPainter();return}e.commands.setPainter()},isActive:()=>m(e.state).length>0,icon:"PaintRoller",tooltip:n("editor.format")}})}},addCommands(){return{setPainter:()=>({dispatch:t,state:e})=>{const n=x(e);return n.length?(t==null||t(e.tr.setMeta(a,{type:"start",marks:n})),!0):(t==null||t(e.tr.setMeta(a,{type:"end"})),!1)},unsetPainter:()=>({dispatch:t,state:e})=>(t==null||t(e.tr.setMeta(a,{type:"end"})),!0)}},addProseMirrorPlugins(){return[new y.Plugin({key:a,state:{init:()=>[],apply:(t,e)=>{const n=t.getMeta(a);return(n==null?void 0:n.type)==="start"?n.marks:(n==null?void 0:n.type)==="end"?[]:e}},props:{handleDOMEvents:{keydown:(t,e)=>e.key!=="Escape"||m(t.state).length===0?!1:(t.dispatch(t.state.tr.setMeta(a,{type:"end"})),!0),mousedown:t=>{const e=m(t.state);if(!e.length)return!1;const n=()=>{document.removeEventListener("mouseup",n);const{state:r}=t,{selection:s}=r,o=s.empty?r.tr:b(r.tr,r,e);t.dispatch(o.setMeta(a,{type:"end"}))};return document.addEventListener("mouseup",n),!1}}}})]}});exports.FormatPainter=g;exports.RichTextFormatPainter=v;exports.formatPainterPluginKey=a;
@@ -1,6 +1,6 @@
1
- import { E as M } from "./index-Dx-Dh7KS.js";
1
+ import { E as M } from "./index-n4kM0Ll-.js";
2
2
  import { PluginKey as k, Plugin as h } from "@tiptap/pm/state";
3
- import { h as S, j as v, u as x, A as d } from "./index-C52cuQ_Y.js";
3
+ import { h as S, j as v, u as x, A as d } from "./index-DRcwHivm.js";
4
4
  import { jsx as p, Fragment as A } from "react/jsx-runtime";
5
5
  import { useState as K, useEffect as b } from "react";
6
6
  import "./theme.js";
package/lib/Heading.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const f=require("./index-BGfIcDCQ.cjs"),M=require("./index-BpLw6ebr.cjs"),s=require("react/jsx-runtime"),x=require("react"),v=require("./index-aujjnfSJ.cjs"),b=require("./ActionMenuButton-C3Cfeza9.cjs");require("./theme.cjs");const h=require("./dropdown-menu-CURWpB9o.cjs");var j=f.Node3.create({name:"heading",addOptions(){return{levels:[1,2,3,4,5,6],HTMLAttributes:{}}},content:"inline*",group:"block",defining:!0,addAttributes(){return{level:{default:1,rendered:!1}}},parseHTML(){return this.options.levels.map(e=>({tag:`h${e}`,attrs:{level:e}}))},renderHTML({node:e,HTMLAttributes:t}){return[`h${this.options.levels.includes(e.attrs.level)?e.attrs.level:this.options.levels[0]}`,f.mergeAttributes(this.options.HTMLAttributes,t),0]},parseMarkdown:(e,t)=>t.createNode("heading",{level:e.depth||1},t.parseInline(e.tokens||[])),renderMarkdown:(e,t)=>{var l;const i=(l=e.attrs)!=null&&l.level?parseInt(e.attrs.level,10):1,a="#".repeat(i);return e.content?`${a} ${t.renderChildren(e.content)}`:""},addCommands(){return{setHeading:e=>({commands:t})=>this.options.levels.includes(e.level)?t.setNode(this.name,e):!1,toggleHeading:e=>({commands:t})=>this.options.levels.includes(e.level)?t.toggleNode(this.name,"paragraph",e):!1}},addKeyboardShortcuts(){return this.options.levels.reduce((e,t)=>({...e,[`Mod-Alt-${t}`]:()=>this.editor.commands.toggleHeading({level:t})}),{})},addInputRules(){return this.options.levels.map(e=>f.textblockTypeInputRule({find:new RegExp(`^(#{${Math.min(...this.options.levels)},${e}})\\s$`),type:this.type,getAttributes:{level:e}}))}});function m(){const{t:e}=M.useLocale(),t=v.useButtonProps(A.name),{icon:l=void 0,tooltip:i=void 0,isActive:a=void 0,items:o=[]}=(t==null?void 0:t.componentProps)??{},{disabled:p,dataState:d}=v.useActive(a),r=x.useMemo(()=>(d==null?void 0:d.title)||e("editor.paragraph.tooltip"),[d]);return t?s.jsxs(h.DropdownMenu,{children:[s.jsx(h.DropdownMenuTrigger,{asChild:!0,disabled:p,children:s.jsx(b.ActionMenuButton,{disabled:p,icon:l,title:r,tooltip:i})}),s.jsx(h.DropdownMenuContent,{className:"richtext-w-full",children:o==null?void 0:o.map((n,c)=>{var u,g;return s.jsxs(x.Fragment,{children:[s.jsxs(h.DropdownMenuCheckboxItem,{checked:r===n.title,onClick:n.action,children:[s.jsx("div",{className:v.cn("richtext-ml-1 richtext-h-full",{"":n.level==="Paragraph","heading-1":n.level===1,"heading-2":n.level===2,"heading-3":n.level===3,"heading-4":n.level===4,"heading-5":n.level===5,"heading-6":n.level===6}),children:n.title}),!!((u=n==null?void 0:n.shortcutKeys)!=null&&u.length)&&s.jsx(h.DropdownMenuShortcut,{className:"richtext-pl-4",children:(g=n==null?void 0:n.shortcutKeys)==null?void 0:g.map(H=>v.getShortcutKey(H)).join(" ")})]}),n.level==="Paragraph"&&s.jsx(h.DropdownMenuSeparator,{})]},`heading-k-${c}`)})})]}):s.jsx(s.Fragment,{})}const A=j.extend({addOptions(){var e;return{...(e=this.parent)==null?void 0:e.call(this),levels:M.HEADINGS,button({editor:t,extension:l,t:i}){var d;const a=((d=l.options)==null?void 0:d.levels)||[],o=a.map(r=>{var c;const n=r==="Paragraph";return{action:()=>{if(n){const u=a.find(g=>t.isActive("heading",{level:g}));u&&u!=="Paragraph"&&t.commands.toggleHeading({level:u});return}t.commands.toggleHeading({level:r})},isActive:()=>n?!1:t.isActive("heading",{level:r})||!1,disabled:!t.can().toggleHeading({level:r}),title:i(n?"editor.paragraph.tooltip":`editor.heading.h${r}.tooltip`),level:r,shortcutKeys:((c=l.options.shortcutKeys)==null?void 0:c[r])??["alt","mod",`${r}`],default:n}}),p=o.filter(r=>r.disabled).length===o.length;return{componentProps:{tooltip:i("editor.heading.tooltip"),disabled:p,items:o,icon:"MenuDown",isActive:()=>{const r=o==null?void 0:o.find(c=>c.isActive());return r&&!r.default?r:{title:i("editor.paragraph.tooltip"),level:0,isActive:()=>!1}},levels:a}}}}}});exports.Heading=A;exports.RichTextHeading=m;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const f=require("./index-EoGU7W4e.cjs"),M=require("./index-CwbGrQFa.cjs"),s=require("react/jsx-runtime"),x=require("react"),b=require("./ActionMenuButton-qUxkZlQg.cjs"),v=require("./index-BO82_0q8.cjs");require("./theme.cjs");const h=require("./dropdown-menu-CEMxzgnU.cjs");var j=f.Node3.create({name:"heading",addOptions(){return{levels:[1,2,3,4,5,6],HTMLAttributes:{}}},content:"inline*",group:"block",defining:!0,addAttributes(){return{level:{default:1,rendered:!1}}},parseHTML(){return this.options.levels.map(e=>({tag:`h${e}`,attrs:{level:e}}))},renderHTML({node:e,HTMLAttributes:t}){return[`h${this.options.levels.includes(e.attrs.level)?e.attrs.level:this.options.levels[0]}`,f.mergeAttributes(this.options.HTMLAttributes,t),0]},parseMarkdown:(e,t)=>t.createNode("heading",{level:e.depth||1},t.parseInline(e.tokens||[])),renderMarkdown:(e,t)=>{var l;const i=(l=e.attrs)!=null&&l.level?parseInt(e.attrs.level,10):1,a="#".repeat(i);return e.content?`${a} ${t.renderChildren(e.content)}`:""},addCommands(){return{setHeading:e=>({commands:t})=>this.options.levels.includes(e.level)?t.setNode(this.name,e):!1,toggleHeading:e=>({commands:t})=>this.options.levels.includes(e.level)?t.toggleNode(this.name,"paragraph",e):!1}},addKeyboardShortcuts(){return this.options.levels.reduce((e,t)=>({...e,[`Mod-Alt-${t}`]:()=>this.editor.commands.toggleHeading({level:t})}),{})},addInputRules(){return this.options.levels.map(e=>f.textblockTypeInputRule({find:new RegExp(`^(#{${Math.min(...this.options.levels)},${e}})\\s$`),type:this.type,getAttributes:{level:e}}))}});function m(){const{t:e}=M.useLocale(),t=v.useButtonProps(A.name),{icon:l=void 0,tooltip:i=void 0,isActive:a=void 0,items:o=[]}=(t==null?void 0:t.componentProps)??{},{disabled:p,dataState:d}=v.useActive(a),r=x.useMemo(()=>(d==null?void 0:d.title)||e("editor.paragraph.tooltip"),[d]);return t?s.jsxs(h.DropdownMenu,{children:[s.jsx(h.DropdownMenuTrigger,{asChild:!0,disabled:p,children:s.jsx(b.ActionMenuButton,{disabled:p,icon:l,title:r,tooltip:i})}),s.jsx(h.DropdownMenuContent,{className:"richtext-w-full",children:o==null?void 0:o.map((n,c)=>{var u,g;return s.jsxs(x.Fragment,{children:[s.jsxs(h.DropdownMenuCheckboxItem,{checked:r===n.title,onClick:n.action,children:[s.jsx("div",{className:v.cn("richtext-ml-1 richtext-h-full",{"":n.level==="Paragraph","heading-1":n.level===1,"heading-2":n.level===2,"heading-3":n.level===3,"heading-4":n.level===4,"heading-5":n.level===5,"heading-6":n.level===6}),children:n.title}),!!((u=n==null?void 0:n.shortcutKeys)!=null&&u.length)&&s.jsx(h.DropdownMenuShortcut,{className:"richtext-pl-4",children:(g=n==null?void 0:n.shortcutKeys)==null?void 0:g.map(H=>v.getShortcutKey(H)).join(" ")})]}),n.level==="Paragraph"&&s.jsx(h.DropdownMenuSeparator,{})]},`heading-k-${c}`)})})]}):s.jsx(s.Fragment,{})}const A=j.extend({addOptions(){var e;return{...(e=this.parent)==null?void 0:e.call(this),levels:M.HEADINGS,button({editor:t,extension:l,t:i}){var d;const a=((d=l.options)==null?void 0:d.levels)||[],o=a.map(r=>{var c;const n=r==="Paragraph";return{action:()=>{if(n){const u=a.find(g=>t.isActive("heading",{level:g}));u&&u!=="Paragraph"&&t.commands.toggleHeading({level:u});return}t.commands.toggleHeading({level:r})},isActive:()=>n?!1:t.isActive("heading",{level:r})||!1,disabled:!t.can().toggleHeading({level:r}),title:i(n?"editor.paragraph.tooltip":`editor.heading.h${r}.tooltip`),level:r,shortcutKeys:((c=l.options.shortcutKeys)==null?void 0:c[r])??["alt","mod",`${r}`],default:n}}),p=o.filter(r=>r.disabled).length===o.length;return{componentProps:{tooltip:i("editor.heading.tooltip"),disabled:p,items:o,icon:"MenuDown",isActive:()=>{const r=o==null?void 0:o.find(c=>c.isActive());return r&&!r.default?r:{title:i("editor.paragraph.tooltip"),level:0,isActive:()=>!1}},levels:a}}}}}});exports.Heading=A;exports.RichTextHeading=m;
package/lib/Heading.js CHANGED
@@ -1,11 +1,11 @@
1
- import { N as f, t as m, m as A } from "./index-Dx-Dh7KS.js";
2
- import { u as M, H } from "./index-DtyAGMbq.js";
1
+ import { N as f, t as m, m as A } from "./index-n4kM0Ll-.js";
2
+ import { u as M, H } from "./index-DKruDABV.js";
3
3
  import { jsx as d, Fragment as $, jsxs as g } from "react/jsx-runtime";
4
4
  import { useMemo as b, Fragment as w } from "react";
5
- import { u as x, e as D, c as y, m as N } from "./index-C52cuQ_Y.js";
6
- import { A as k } from "./ActionMenuButton-B4KDkZ0z.js";
5
+ import { A as x } from "./ActionMenuButton-BhiGvRJ7.js";
6
+ import { u as D, e as y, c as N, m as k } from "./index-DRcwHivm.js";
7
7
  import "./theme.js";
8
- import { D as L, a as C, b as T, c as I, e as K, d as P } from "./dropdown-menu-BKSX4gvT.js";
8
+ import { D as L, a as C, b as T, c as I, e as K, d as P } from "./dropdown-menu-CKAKsyqu.js";
9
9
  var R = f.create({
10
10
  name: "heading",
11
11
  addOptions() {
@@ -70,15 +70,15 @@ var R = f.create({
70
70
  }
71
71
  });
72
72
  function z() {
73
- const { t: e } = M(), t = x(S.name), {
73
+ const { t: e } = M(), t = D(S.name), {
74
74
  icon: a = void 0,
75
75
  tooltip: o = void 0,
76
76
  isActive: i = void 0,
77
77
  items: s = []
78
- } = (t == null ? void 0 : t.componentProps) ?? {}, { disabled: p, dataState: l } = D(i), r = b(() => (l == null ? void 0 : l.title) || e("editor.paragraph.tooltip"), [l]);
78
+ } = (t == null ? void 0 : t.componentProps) ?? {}, { disabled: p, dataState: l } = y(i), r = b(() => (l == null ? void 0 : l.title) || e("editor.paragraph.tooltip"), [l]);
79
79
  return t ? /* @__PURE__ */ g(L, { children: [
80
80
  /* @__PURE__ */ d(C, { asChild: !0, disabled: p, children: /* @__PURE__ */ d(
81
- k,
81
+ x,
82
82
  {
83
83
  disabled: p,
84
84
  icon: a,
@@ -93,7 +93,7 @@ function z() {
93
93
  /* @__PURE__ */ d(
94
94
  "div",
95
95
  {
96
- className: y("richtext-ml-1 richtext-h-full", {
96
+ className: N("richtext-ml-1 richtext-h-full", {
97
97
  "": n.level === "Paragraph",
98
98
  "heading-1": n.level === 1,
99
99
  "heading-2": n.level === 2,
@@ -105,7 +105,7 @@ function z() {
105
105
  children: n.title
106
106
  }
107
107
  ),
108
- !!((u = n == null ? void 0 : n.shortcutKeys) != null && u.length) && /* @__PURE__ */ d(K, { className: "richtext-pl-4", children: (h = n == null ? void 0 : n.shortcutKeys) == null ? void 0 : h.map((v) => N(v)).join(" ") })
108
+ !!((u = n == null ? void 0 : n.shortcutKeys) != null && u.length) && /* @__PURE__ */ d(K, { className: "richtext-pl-4", children: (h = n == null ? void 0 : n.shortcutKeys) == null ? void 0 : h.map((v) => k(v)).join(" ") })
109
109
  ] }),
110
110
  n.level === "Paragraph" && /* @__PURE__ */ d(P, {})
111
111
  ] }, `heading-k-${c}`);
package/lib/Highlight.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("./index-BGfIcDCQ.cjs"),r=require("react/jsx-runtime"),p=require("react"),h=require("./index-aujjnfSJ.cjs"),m=require("./separator-BGO9AZp4.cjs");require("./theme.cjs");var L=/(?:^|\s)(==(?!\s+==)((?:[^=]+))==(?!\s+==))$/,k=/(?:^|\s)(==(?!\s+==)((?:[^=]+))==(?!\s+==))/g,H=l.Mark.create({name:"highlight",addOptions(){return{multicolor:!1,HTMLAttributes:{}}},addAttributes(){return this.options.multicolor?{color:{default:null,parseHTML:t=>t.getAttribute("data-color")||l.getStyleProperty(t,"background-color")||t.style.backgroundColor,renderHTML:t=>t.color?{"data-color":t.color,style:`background-color: ${t.color}; color: inherit`}:{}}}:{}},parseHTML(){return[{tag:"mark"}]},renderHTML({HTMLAttributes:t}){return["mark",l.mergeAttributes(this.options.HTMLAttributes,t),0]},renderMarkdown:(t,e)=>`==${e.renderChildren(t)}==`,parseMarkdown:(t,e)=>e.applyMark("highlight",e.parseInline(t.tokens||[])),markdownTokenizer:{name:"highlight",level:"inline",start:t=>t.indexOf("=="),tokenize(t,e,s){const i=/^(==)([^=]+)(==)/.exec(t);if(i){const n=i[2].trim(),u=s.inlineTokens(n);return{type:"highlight",raw:i[0],text:n,tokens:u}}}},addCommands(){return{setHighlight:t=>({commands:e})=>e.setMark(this.name,t),toggleHighlight:t=>({commands:e})=>e.toggleMark(this.name,t),unsetHighlight:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-h":()=>this.editor.commands.toggleHighlight()}},addInputRules(){return[l.markInputRule({find:L,type:this.type})]},addPasteRules(){return[l.markPasteRule({find:k,type:this.type})]}});function M({fill:t}){return r.jsx("svg",{height:"18px",version:"1.1",viewBox:"0 0 256 256",width:"18px",xmlns:"http://www.w3.org/2000/svg",children:r.jsx("g",{fill:"none",fillRule:"evenodd",stroke:"none",strokeWidth:1,children:r.jsxs("g",{id:"icon/背景颜色",children:[r.jsx("g",{fill:"currentColor",children:r.jsxs("g",{transform:"translate(119.502295, 137.878331) rotate(-135.000000) translate(-119.502295, -137.878331) translate(48.002295, 31.757731)",children:[r.jsx("path",{d:"M100.946943,60.8084699 L43.7469427,60.8084699 C37.2852111,60.8084699 32.0469427,66.0467383 32.0469427,72.5084699 L32.0469427,118.70847 C32.0469427,125.170201 37.2852111,130.40847 43.7469427,130.40847 L100.946943,130.40847 C107.408674,130.40847 112.646943,125.170201 112.646943,118.70847 L112.646943,72.5084699 C112.646943,66.0467383 107.408674,60.8084699 100.946943,60.8084699 Z M93.646,79.808 L93.646,111.408 L51.046,111.408 L51.046,79.808 L93.646,79.808 Z",fillRule:"nonzero"}),r.jsx("path",{d:"M87.9366521,16.90916 L87.9194966,68.2000001 C87.9183543,69.4147389 86.9334998,70.399264 85.7187607,70.4 L56.9423078,70.4 C55.7272813,70.4 54.7423078,69.4150264 54.7423078,68.2 L54.7423078,39.4621057 C54.7423078,37.2523513 55.5736632,35.1234748 57.0711706,33.4985176 L76.4832996,12.4342613 C78.9534987,9.75382857 83.1289108,9.5834005 85.8093436,12.0535996 C87.1658473,13.303709 87.9372691,15.0644715 87.9366521,16.90916 Z",fillRule:"evenodd"}),r.jsx("path",{d:"M131.3,111.241199 L11.7,111.241199 C5.23826843,111.241199 0,116.479467 0,122.941199 L0,200.541199 C0,207.002931 5.23826843,212.241199 11.7,212.241199 L131.3,212.241199 C137.761732,212.241199 143,207.002931 143,200.541199 L143,122.941199 C143,116.479467 137.761732,111.241199 131.3,111.241199 Z M124,130.241 L124,193.241 L19,193.241 L19,130.241 L124,130.241 Z",fillRule:"nonzero"})]})}),r.jsx("path",{d:"M51,218 L205,218 C211.075132,218 216,222.924868 216,229 C216,235.075132 211.075132,240 205,240 L51,240 C44.9248678,240 40,235.075132 40,229 C40,222.924868 44.9248678,218 51,218 Z",fill:typeof t=="string"?t:"none",id:"矩形"})]})})})}function v(){const t=h.useButtonProps(f.name),{tooltip:e=void 0,isActive:s=void 0,defaultColor:o=void 0,colors:i,action:n,shortcutKeys:u}=(t==null?void 0:t.componentProps)??{},{disabled:c,dataState:a}=h.useActive(s),[x,g]=p.useState(o);p.useEffect(()=>{g(a)},[a]);function C(d){c||n&&(n==null||n(d),g(d))}return t?r.jsx(m.ColorPicker,{colors:i,disabled:c,highlight:!0,onChange:C,value:x,children:r.jsx(h.ActionButton,{disabled:c,tooltip:e,shortcutKeys:u,children:r.jsxs("span",{className:"richtext-flex richtext-items-center richtext-justify-center richtext-gap-[4px] richtext-text-sm",children:[r.jsx(M,{fill:a}),r.jsx(h.IconComponent,{className:"!richtext-h-3 !richtext-w-3 richtext-text-zinc-500",name:"MenuDown"})]})})}):r.jsx(r.Fragment,{})}const f=H.extend({addStorage(){return{currentColor:this.options.defaultColor||void 0}},addOptions(){var t;return{...(t=this.parent)==null?void 0:t.call(this),multicolor:!0,button:({editor:e,t:s,extension:o})=>({componentProps:{action:i=>{if(typeof i=="string"){e.storage.highlight.currentColor=i,e.chain().focus().setHighlight({color:i}).run();return}e.chain().focus().unsetHighlight().run()},isActive:()=>{const{color:i}=e.getAttributes("highlight");return i},disabled:!1,shortcutKeys:o.options.shortcutKeys??["⇧","mod","H"],tooltip:s("editor.highlight.tooltip"),defaultColor:o.options.defaultColor}})}},addKeyboardShortcuts(){var t;return{...(t=this.parent)==null?void 0:t.call(this),"Mod-Shift-h":()=>{const e=this.storage.currentColor||this.options.defaultColor;if(!e){const{color:o}=this.editor.getAttributes("highlight");return o?this.editor.chain().focus().unsetHighlight().run():!1}return this.editor.isActive("highlight",{color:e})?this.editor.chain().focus().unsetHighlight().run():this.editor.chain().focus().setHighlight({color:e}).run()}}}});exports.Highlight=f;exports.RichTextHighlight=v;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("./index-EoGU7W4e.cjs"),r=require("react/jsx-runtime"),p=require("react"),h=require("./index-BO82_0q8.cjs"),m=require("./separator-DMLtkcoo.cjs");require("./theme.cjs");var L=/(?:^|\s)(==(?!\s+==)((?:[^=]+))==(?!\s+==))$/,k=/(?:^|\s)(==(?!\s+==)((?:[^=]+))==(?!\s+==))/g,H=l.Mark.create({name:"highlight",addOptions(){return{multicolor:!1,HTMLAttributes:{}}},addAttributes(){return this.options.multicolor?{color:{default:null,parseHTML:t=>t.getAttribute("data-color")||l.getStyleProperty(t,"background-color")||t.style.backgroundColor,renderHTML:t=>t.color?{"data-color":t.color,style:`background-color: ${t.color}; color: inherit`}:{}}}:{}},parseHTML(){return[{tag:"mark"}]},renderHTML({HTMLAttributes:t}){return["mark",l.mergeAttributes(this.options.HTMLAttributes,t),0]},renderMarkdown:(t,e)=>`==${e.renderChildren(t)}==`,parseMarkdown:(t,e)=>e.applyMark("highlight",e.parseInline(t.tokens||[])),markdownTokenizer:{name:"highlight",level:"inline",start:t=>t.indexOf("=="),tokenize(t,e,s){const i=/^(==)([^=]+)(==)/.exec(t);if(i){const n=i[2].trim(),u=s.inlineTokens(n);return{type:"highlight",raw:i[0],text:n,tokens:u}}}},addCommands(){return{setHighlight:t=>({commands:e})=>e.setMark(this.name,t),toggleHighlight:t=>({commands:e})=>e.toggleMark(this.name,t),unsetHighlight:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-h":()=>this.editor.commands.toggleHighlight()}},addInputRules(){return[l.markInputRule({find:L,type:this.type})]},addPasteRules(){return[l.markPasteRule({find:k,type:this.type})]}});function M({fill:t}){return r.jsx("svg",{height:"18px",version:"1.1",viewBox:"0 0 256 256",width:"18px",xmlns:"http://www.w3.org/2000/svg",children:r.jsx("g",{fill:"none",fillRule:"evenodd",stroke:"none",strokeWidth:1,children:r.jsxs("g",{id:"icon/背景颜色",children:[r.jsx("g",{fill:"currentColor",children:r.jsxs("g",{transform:"translate(119.502295, 137.878331) rotate(-135.000000) translate(-119.502295, -137.878331) translate(48.002295, 31.757731)",children:[r.jsx("path",{d:"M100.946943,60.8084699 L43.7469427,60.8084699 C37.2852111,60.8084699 32.0469427,66.0467383 32.0469427,72.5084699 L32.0469427,118.70847 C32.0469427,125.170201 37.2852111,130.40847 43.7469427,130.40847 L100.946943,130.40847 C107.408674,130.40847 112.646943,125.170201 112.646943,118.70847 L112.646943,72.5084699 C112.646943,66.0467383 107.408674,60.8084699 100.946943,60.8084699 Z M93.646,79.808 L93.646,111.408 L51.046,111.408 L51.046,79.808 L93.646,79.808 Z",fillRule:"nonzero"}),r.jsx("path",{d:"M87.9366521,16.90916 L87.9194966,68.2000001 C87.9183543,69.4147389 86.9334998,70.399264 85.7187607,70.4 L56.9423078,70.4 C55.7272813,70.4 54.7423078,69.4150264 54.7423078,68.2 L54.7423078,39.4621057 C54.7423078,37.2523513 55.5736632,35.1234748 57.0711706,33.4985176 L76.4832996,12.4342613 C78.9534987,9.75382857 83.1289108,9.5834005 85.8093436,12.0535996 C87.1658473,13.303709 87.9372691,15.0644715 87.9366521,16.90916 Z",fillRule:"evenodd"}),r.jsx("path",{d:"M131.3,111.241199 L11.7,111.241199 C5.23826843,111.241199 0,116.479467 0,122.941199 L0,200.541199 C0,207.002931 5.23826843,212.241199 11.7,212.241199 L131.3,212.241199 C137.761732,212.241199 143,207.002931 143,200.541199 L143,122.941199 C143,116.479467 137.761732,111.241199 131.3,111.241199 Z M124,130.241 L124,193.241 L19,193.241 L19,130.241 L124,130.241 Z",fillRule:"nonzero"})]})}),r.jsx("path",{d:"M51,218 L205,218 C211.075132,218 216,222.924868 216,229 C216,235.075132 211.075132,240 205,240 L51,240 C44.9248678,240 40,235.075132 40,229 C40,222.924868 44.9248678,218 51,218 Z",fill:typeof t=="string"?t:"none",id:"矩形"})]})})})}function v(){const t=h.useButtonProps(f.name),{tooltip:e=void 0,isActive:s=void 0,defaultColor:o=void 0,colors:i,action:n,shortcutKeys:u}=(t==null?void 0:t.componentProps)??{},{disabled:c,dataState:a}=h.useActive(s),[x,g]=p.useState(o);p.useEffect(()=>{g(a)},[a]);function C(d){c||n&&(n==null||n(d),g(d))}return t?r.jsx(m.ColorPicker,{colors:i,disabled:c,highlight:!0,onChange:C,value:x,children:r.jsx(h.ActionButton,{disabled:c,tooltip:e,shortcutKeys:u,children:r.jsxs("span",{className:"richtext-flex richtext-items-center richtext-justify-center richtext-gap-[4px] richtext-text-sm",children:[r.jsx(M,{fill:a}),r.jsx(h.IconComponent,{className:"!richtext-h-3 !richtext-w-3 richtext-text-zinc-500",name:"MenuDown"})]})})}):r.jsx(r.Fragment,{})}const f=H.extend({addStorage(){return{currentColor:this.options.defaultColor||void 0}},addOptions(){var t;return{...(t=this.parent)==null?void 0:t.call(this),multicolor:!0,button:({editor:e,t:s,extension:o})=>({componentProps:{action:i=>{if(typeof i=="string"){e.storage.highlight.currentColor=i,e.chain().focus().setHighlight({color:i}).run();return}e.chain().focus().unsetHighlight().run()},isActive:()=>{const{color:i}=e.getAttributes("highlight");return i},disabled:!1,shortcutKeys:o.options.shortcutKeys??["⇧","mod","H"],tooltip:s("editor.highlight.tooltip"),defaultColor:o.options.defaultColor}})}},addKeyboardShortcuts(){var t;return{...(t=this.parent)==null?void 0:t.call(this),"Mod-Shift-h":()=>{const e=this.storage.currentColor||this.options.defaultColor;if(!e){const{color:o}=this.editor.getAttributes("highlight");return o?this.editor.chain().focus().unsetHighlight().run():!1}return this.editor.isActive("highlight",{color:e})?this.editor.chain().focus().unsetHighlight().run():this.editor.chain().focus().setHighlight({color:e}).run()}}}});exports.Highlight=f;exports.RichTextHighlight=v;
package/lib/Highlight.js CHANGED
@@ -1,8 +1,8 @@
1
- import { M as f, h as m, j as C, m as L, g as x } from "./index-Dx-Dh7KS.js";
1
+ import { M as f, h as m, j as C, m as L, g as x } from "./index-n4kM0Ll-.js";
2
2
  import { jsx as r, jsxs as u, Fragment as k } from "react/jsx-runtime";
3
3
  import { useState as M, useEffect as v } from "react";
4
- import { u as H, e as y, A, I as b } from "./index-C52cuQ_Y.js";
5
- import { C as w } from "./separator-DuuOJRQd.js";
4
+ import { u as H, e as y, A, I as b } from "./index-DRcwHivm.js";
5
+ import { C as w } from "./separator-DfvK668q.js";
6
6
  import "./theme.js";
7
7
  var R = /(?:^|\s)(==(?!\s+==)((?:[^=]+))==(?!\s+==))$/, T = /(?:^|\s)(==(?!\s+==)((?:[^=]+))==(?!\s+==))/g, S = f.create({
8
8
  name: "highlight",
package/lib/History.cjs CHANGED
@@ -1,7 +1,7 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const h=require("./index-BGfIcDCQ.cjs"),b=require("@tiptap/pm/state"),x=require("@tiptap/pm/view"),k=require("./index-CHVV5iY-.cjs"),A=require("react/jsx-runtime"),S=require("./index-aujjnfSJ.cjs");require("react");require("./theme.cjs");function J(n={}){return new h.Plugin({view(e){return new Q(e,n)}})}class Q{constructor(e,t){var o;this.editorView=e,this.cursorPos=null,this.element=null,this.timeout=-1,this.width=(o=t.width)!==null&&o!==void 0?o:1,this.color=t.color===!1?void 0:t.color||"black",this.class=t.class,this.handlers=["dragover","dragend","drop","dragleave"].map(r=>{let i=s=>{this[r](s)};return e.dom.addEventListener(r,i),{name:r,handler:i}})}destroy(){this.handlers.forEach(({name:e,handler:t})=>this.editorView.dom.removeEventListener(e,t))}update(e,t){this.cursorPos!=null&&t.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),t=!e.parent.inlineContent,o,r=this.editorView.dom,i=r.getBoundingClientRect(),s=i.width/r.offsetWidth,l=i.height/r.offsetHeight;if(t){let d=e.nodeBefore,p=e.nodeAfter;if(d||p){let f=this.editorView.nodeDOM(this.cursorPos-(d?d.nodeSize:0));if(f){let m=f.getBoundingClientRect(),y=d?m.bottom:m.top;d&&p&&(y=(y+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2);let C=this.width/2*l;o={left:m.left,right:m.right,top:y-C,bottom:y+C}}}}if(!o){let d=this.editorView.coordsAtPos(this.cursorPos),p=this.width/2*s;o={left:d.left-p,right:d.left+p,top:d.top,bottom:d.bottom}}let a=this.editorView.dom.offsetParent;this.element||(this.element=a.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",t),this.element.classList.toggle("prosemirror-dropcursor-inline",!t);let c,u;if(!a||a==document.body&&getComputedStyle(a).position=="static")c=-pageXOffset,u=-pageYOffset;else{let d=a.getBoundingClientRect(),p=d.width/a.offsetWidth,f=d.height/a.offsetHeight;c=d.left-a.scrollLeft*p,u=d.top-a.scrollTop*f}this.element.style.left=(o.left-c)/s+"px",this.element.style.top=(o.top-u)/l+"px",this.element.style.width=(o.right-o.left)/s+"px",this.element.style.height=(o.bottom-o.top)/l+"px"}scheduleRemoval(e){clearTimeout(this.timeout),this.timeout=setTimeout(()=>this.setCursor(null),e)}dragover(e){if(!this.editorView.editable)return;let t=this.editorView.posAtCoords({left:e.clientX,top:e.clientY}),o=t&&t.inside>=0&&this.editorView.state.doc.nodeAt(t.inside),r=o&&o.type.spec.disableDropCursor,i=typeof r=="function"?r(this.editorView,t,e):r;if(t&&!i){let s=t.pos;if(this.editorView.dragging&&this.editorView.dragging.slice){let l=h.dropPoint(this.editorView.state.doc,s,this.editorView.dragging.slice);l!=null&&(s=l)}this.setCursor(s),this.scheduleRemoval(5e3)}}dragend(){this.scheduleRemoval(20)}drop(){this.scheduleRemoval(20)}dragleave(e){this.editorView.dom.contains(e.relatedTarget)||this.setCursor(null)}}class g extends h.Selection{constructor(e){super(e,e)}map(e,t){let o=e.resolve(t.map(this.head));return g.valid(o)?new g(o):h.Selection.near(o)}content(){return h.Slice.empty}eq(e){return e instanceof g&&e.head==this.head}toJSON(){return{type:"gapcursor",pos:this.head}}static fromJSON(e,t){if(typeof t.pos!="number")throw new RangeError("Invalid input for GapCursor.fromJSON");return new g(e.resolve(t.pos))}getBookmark(){return new L(this.anchor)}static valid(e){let t=e.parent;if(t.inlineContent||!$(e)||!ee(e))return!1;let o=t.type.spec.allowGapCursor;if(o!=null)return o;let r=t.contentMatchAt(e.index()).defaultType;return r&&r.isTextblock}static findGapCursorFrom(e,t,o=!1){e:for(;;){if(!o&&g.valid(e))return e;let r=e.pos,i=null;for(let s=e.depth;;s--){let l=e.node(s);if(t>0?e.indexAfter(s)<l.childCount:e.index(s)>0){i=l.child(t>0?e.indexAfter(s):e.index(s)-1);break}else if(s==0)return null;r+=t;let a=e.doc.resolve(r);if(g.valid(a))return a}for(;;){let s=t>0?i.firstChild:i.lastChild;if(!s){if(i.isAtom&&!i.isText&&!h.NodeSelection.isSelectable(i)){e=e.doc.resolve(r+i.nodeSize*t),o=!1;continue e}break}i=s,r+=t;let l=e.doc.resolve(r);if(g.valid(l))return l}return null}}}g.prototype.visible=!1;g.findFrom=g.findGapCursorFrom;h.Selection.jsonID("gapcursor",g);class L{constructor(e){this.pos=e}map(e){return new L(e.map(this.pos))}resolve(e){let t=e.resolve(this.pos);return g.valid(t)?new g(t):h.Selection.near(t)}}function G(n){return n.isAtom||n.spec.isolating||n.spec.createGapCursor}function $(n){for(let e=n.depth;e>=0;e--){let t=n.index(e),o=n.node(e);if(t==0){if(o.type.spec.isolating)return!0;continue}for(let r=o.child(t-1);;r=r.lastChild){if(r.childCount==0&&!r.inlineContent||G(r.type))return!0;if(r.inlineContent)return!1}}return!0}function ee(n){for(let e=n.depth;e>=0;e--){let t=n.indexAfter(e),o=n.node(e);if(t==o.childCount){if(o.type.spec.isolating)return!0;continue}for(let r=o.child(t);;r=r.firstChild){if(r.childCount==0&&!r.inlineContent||G(r.type))return!0;if(r.inlineContent)return!1}}return!0}function te(){return new h.Plugin({props:{decorations:ie,createSelectionBetween(n,e,t){return e.pos==t.pos&&g.valid(t)?new g(t):null},handleClick:oe,handleKeyDown:ne,handleDOMEvents:{beforeinput:re}}})}const ne=k.keydownHandler({ArrowLeft:I("horiz",-1),ArrowRight:I("horiz",1),ArrowUp:I("vert",-1),ArrowDown:I("vert",1)});function I(n,e){const t=n=="vert"?e>0?"down":"up":e>0?"right":"left";return function(o,r,i){let s=o.selection,l=e>0?s.$to:s.$from,a=s.empty;if(s instanceof h.TextSelection){if(!i.endOfTextblock(t)||l.depth==0)return!1;a=!1,l=o.doc.resolve(e>0?l.after():l.before())}let c=g.findGapCursorFrom(l,e,a);return c?(r&&r(o.tr.setSelection(new g(c))),!0):!1}}function oe(n,e,t){if(!n||!n.editable)return!1;let o=n.state.doc.resolve(e);if(!g.valid(o))return!1;let r=n.posAtCoords({left:t.clientX,top:t.clientY});return r&&r.inside>-1&&h.NodeSelection.isSelectable(n.state.doc.nodeAt(r.inside))?!1:(n.dispatch(n.state.tr.setSelection(new g(o))),!0)}function re(n,e){if(e.inputType!="insertCompositionText"||!(n.state.selection instanceof g))return!1;let{$from:t}=n.state.selection,o=t.parent.contentMatchAt(t.index()).findWrapping(n.state.schema.nodes.text);if(!o)return!1;let r=h.Fragment.empty;for(let s=o.length-1;s>=0;s--)r=h.Fragment.from(o[s].createAndFill(null,r));let i=n.state.tr.replace(t.pos,t.pos,new h.Slice(r,0,0));return i.setSelection(h.TextSelection.near(i.doc.resolve(t.pos+1))),n.dispatch(i),!1}function ie(n){if(!(n.selection instanceof g))return null;let e=document.createElement("div");return e.className="ProseMirror-gapcursor",k.DecorationSet.create(n.doc,[k.Decoration.widget(n.selection.head,e,{key:"gapcursor"})])}var R=200,v=function(){};v.prototype.append=function(e){return e.length?(e=v.from(e),!this.length&&e||e.length<R&&this.leafAppend(e)||this.length<R&&e.leafPrepend(this)||this.appendInner(e)):this};v.prototype.prepend=function(e){return e.length?v.from(e).append(this):this};v.prototype.appendInner=function(e){return new se(this,e)};v.prototype.slice=function(e,t){return e===void 0&&(e=0),t===void 0&&(t=this.length),e>=t?v.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,t))};v.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)};v.prototype.forEach=function(e,t,o){t===void 0&&(t=0),o===void 0&&(o=this.length),t<=o?this.forEachInner(e,t,o,0):this.forEachInvertedInner(e,t,o,0)};v.prototype.map=function(e,t,o){t===void 0&&(t=0),o===void 0&&(o=this.length);var r=[];return this.forEach(function(i,s){return r.push(e(i,s))},t,o),r};v.from=function(e){return e instanceof v?e:e&&e.length?new U(e):v.empty};var U=(function(n){function e(o){n.call(this),this.values=o}n&&(e.__proto__=n),e.prototype=Object.create(n&&n.prototype),e.prototype.constructor=e;var t={length:{configurable:!0},depth:{configurable:!0}};return e.prototype.flatten=function(){return this.values},e.prototype.sliceInner=function(r,i){return r==0&&i==this.length?this:new e(this.values.slice(r,i))},e.prototype.getInner=function(r){return this.values[r]},e.prototype.forEachInner=function(r,i,s,l){for(var a=i;a<s;a++)if(r(this.values[a],l+a)===!1)return!1},e.prototype.forEachInvertedInner=function(r,i,s,l){for(var a=i-1;a>=s;a--)if(r(this.values[a],l+a)===!1)return!1},e.prototype.leafAppend=function(r){if(this.length+r.length<=R)return new e(this.values.concat(r.flatten()))},e.prototype.leafPrepend=function(r){if(this.length+r.length<=R)return new e(r.flatten().concat(this.values))},t.length.get=function(){return this.values.length},t.depth.get=function(){return 0},Object.defineProperties(e.prototype,t),e})(v);v.empty=new U([]);var se=(function(n){function e(t,o){n.call(this),this.left=t,this.right=o,this.length=t.length+o.length,this.depth=Math.max(t.depth,o.depth)+1}return n&&(e.__proto__=n),e.prototype=Object.create(n&&n.prototype),e.prototype.constructor=e,e.prototype.flatten=function(){return this.left.flatten().concat(this.right.flatten())},e.prototype.getInner=function(o){return o<this.left.length?this.left.get(o):this.right.get(o-this.left.length)},e.prototype.forEachInner=function(o,r,i,s){var l=this.left.length;if(r<l&&this.left.forEachInner(o,r,Math.min(i,l),s)===!1||i>l&&this.right.forEachInner(o,Math.max(r-l,0),Math.min(this.length,i)-l,s+l)===!1)return!1},e.prototype.forEachInvertedInner=function(o,r,i,s){var l=this.left.length;if(r>l&&this.right.forEachInvertedInner(o,r-l,Math.max(i,l)-l,s+l)===!1||i<l&&this.left.forEachInvertedInner(o,Math.min(r,l),i,s)===!1)return!1},e.prototype.sliceInner=function(o,r){if(o==0&&r==this.length)return this;var i=this.left.length;return r<=i?this.left.slice(o,r):o>=i?this.right.slice(o-i,r-i):this.left.slice(o,i).append(this.right.slice(0,r-i))},e.prototype.leafAppend=function(o){var r=this.right.leafAppend(o);if(r)return new e(this.left,r)},e.prototype.leafPrepend=function(o){var r=this.left.leafPrepend(o);if(r)return new e(r,this.right)},e.prototype.appendInner=function(o){return this.left.depth>=Math.max(this.right.depth,o.depth)+1?new e(this.left,new e(this.right,o)):new e(this,o)},e})(v);const le=500;class w{constructor(e,t){this.items=e,this.eventCount=t}popEvent(e,t){if(this.eventCount==0)return null;let o=this.items.length;for(;;o--)if(this.items.get(o-1).selection){--o;break}let r,i;t&&(r=this.remapping(o,this.items.length),i=r.maps.length);let s=e.tr,l,a,c=[],u=[];return this.items.forEach((d,p)=>{if(!d.step){r||(r=this.remapping(o,p+1),i=r.maps.length),i--,u.push(d);return}if(r){u.push(new P(d.map));let f=d.step.map(r.slice(i)),m;f&&s.maybeStep(f).doc&&(m=s.mapping.maps[s.mapping.maps.length-1],c.push(new P(m,void 0,void 0,c.length+u.length))),i--,m&&r.appendMap(m,i)}else s.maybeStep(d.step);if(d.selection)return l=r?d.selection.map(r.slice(i)):d.selection,a=new w(this.items.slice(0,o).append(u.reverse().concat(c)),this.eventCount-1),!1},this.items.length,0),{remaining:a,transform:s,selection:l}}addTransform(e,t,o,r){let i=[],s=this.eventCount,l=this.items,a=!r&&l.length?l.get(l.length-1):null;for(let u=0;u<e.steps.length;u++){let d=e.steps[u].invert(e.docs[u]),p=new P(e.mapping.maps[u],d,t),f;(f=a&&a.merge(p))&&(p=f,u?i.pop():l=l.slice(0,l.length-1)),i.push(p),t&&(s++,t=void 0),r||(a=p)}let c=s-o.depth;return c>ce&&(l=ae(l,c),s-=c),new w(l.append(i),s)}remapping(e,t){let o=new h.Mapping;return this.items.forEach((r,i)=>{let s=r.mirrorOffset!=null&&i-r.mirrorOffset>=e?o.maps.length-r.mirrorOffset:void 0;o.appendMap(r.map,s)},e,t),o}addMaps(e){return this.eventCount==0?this:new w(this.items.append(e.map(t=>new P(t))),this.eventCount)}rebased(e,t){if(!this.eventCount)return this;let o=[],r=Math.max(0,this.items.length-t),i=e.mapping,s=e.steps.length,l=this.eventCount;this.items.forEach(p=>{p.selection&&l--},r);let a=t;this.items.forEach(p=>{let f=i.getMirror(--a);if(f==null)return;s=Math.min(s,f);let m=i.maps[f];if(p.step){let y=e.steps[f].invert(e.docs[f]),C=p.selection&&p.selection.map(i.slice(a+1,f));C&&l++,o.push(new P(m,y,C))}else o.push(new P(m))},r);let c=[];for(let p=t;p<s;p++)c.push(new P(i.maps[p]));let u=this.items.slice(0,r).append(c).append(o),d=new w(u,l);return d.emptyItemCount()>le&&(d=d.compress(this.items.length-o.length)),d}emptyItemCount(){let e=0;return this.items.forEach(t=>{t.step||e++}),e}compress(e=this.items.length){let t=this.remapping(0,e),o=t.maps.length,r=[],i=0;return this.items.forEach((s,l)=>{if(l>=e)r.push(s),s.selection&&i++;else if(s.step){let a=s.step.map(t.slice(o)),c=a&&a.getMap();if(o--,c&&t.appendMap(c,o),a){let u=s.selection&&s.selection.map(t.slice(o));u&&i++;let d=new P(c.invert(),a,u),p,f=r.length-1;(p=r.length&&r[f].merge(d))?r[f]=p:r.push(d)}}else s.map&&o--},this.items.length,0),new w(v.from(r.reverse()),i)}}w.empty=new w(v.empty,0);function ae(n,e){let t;return n.forEach((o,r)=>{if(o.selection&&e--==0)return t=r,!1}),n.slice(t)}class P{constructor(e,t,o,r){this.map=e,this.step=t,this.selection=o,this.mirrorOffset=r}merge(e){if(this.step&&e.step&&!e.selection){let t=e.step.merge(this.step);if(t)return new P(t.getMap().invert(),t,this.selection)}}}class E{constructor(e,t,o,r,i){this.done=e,this.undone=t,this.prevRanges=o,this.prevTime=r,this.prevComposition=i}}const ce=20;function ue(n,e,t,o){let r=t.getMeta(M),i;if(r)return r.historyState;t.getMeta(fe)&&(n=new E(n.done,n.undone,null,0,-1));let s=t.getMeta("appendedTransaction");if(t.steps.length==0)return n;if(s&&s.getMeta(M))return s.getMeta(M).redo?new E(n.done.addTransform(t,void 0,o,O(e)),n.undone,F(t.mapping.maps),n.prevTime,n.prevComposition):new E(n.done,n.undone.addTransform(t,void 0,o,O(e)),null,n.prevTime,n.prevComposition);if(t.getMeta("addToHistory")!==!1&&!(s&&s.getMeta("addToHistory")===!1)){let l=t.getMeta("composition"),a=n.prevTime==0||!s&&n.prevComposition!=l&&(n.prevTime<(t.time||0)-o.newGroupDelay||!de(t,n.prevRanges)),c=s?N(n.prevRanges,t.mapping):F(t.mapping.maps);return new E(n.done.addTransform(t,a?e.selection.getBookmark():void 0,o,O(e)),w.empty,c,t.time,l??n.prevComposition)}else return(i=t.getMeta("rebased"))?new E(n.done.rebased(t,i),n.undone.rebased(t,i),N(n.prevRanges,t.mapping),n.prevTime,n.prevComposition):new E(n.done.addMaps(t.mapping.maps),n.undone.addMaps(t.mapping.maps),N(n.prevRanges,t.mapping),n.prevTime,n.prevComposition)}function de(n,e){if(!e)return!1;if(!n.docChanged)return!0;let t=!1;return n.mapping.maps[0].forEach((o,r)=>{for(let i=0;i<e.length;i+=2)o<=e[i+1]&&r>=e[i]&&(t=!0)}),t}function F(n){let e=[];for(let t=n.length-1;t>=0&&e.length==0;t--)n[t].forEach((o,r,i,s)=>e.push(i,s));return e}function N(n,e){if(!n)return null;let t=[];for(let o=0;o<n.length;o+=2){let r=e.map(n[o],1),i=e.map(n[o+1],-1);r<=i&&t.push(r,i)}return t}function pe(n,e,t){let o=O(e),r=M.get(e).spec.config,i=(t?n.undone:n.done).popEvent(e,o);if(!i)return null;let s=i.selection.resolve(i.transform.doc),l=(t?n.done:n.undone).addTransform(i.transform,e.selection.getBookmark(),r,o),a=new E(t?l:i.remaining,t?i.remaining:l,null,0,-1);return i.transform.setSelection(s).setMeta(M,{redo:t,historyState:a})}let z=!1,B=null;function O(n){let e=n.plugins;if(B!=e){z=!1,B=e;for(let t=0;t<e.length;t++)if(e[t].spec.historyPreserveItems){z=!0;break}}return z}const M=new h.PluginKey("history"),fe=new h.PluginKey("closeHistory");function he(n={}){return n={depth:n.depth||100,newGroupDelay:n.newGroupDelay||500},new h.Plugin({key:M,state:{init(){return new E(w.empty,w.empty,null,0,-1)},apply(e,t,o){return ue(t,o,e,n)}},config:n,props:{handleDOMEvents:{beforeinput(e,t){let o=t.inputType,r=o=="historyUndo"?X:o=="historyRedo"?Y:null;return!r||!e.editable?!1:(t.preventDefault(),r(e.state,e.dispatch))}}}})}function W(n,e){return(t,o)=>{let r=M.getState(t);if(!r||(n?r.undone:r.done).eventCount==0)return!1;if(o){let i=pe(r,t,n);i&&o(e?i.scrollIntoView():i)}return!0}}const X=W(!1,!0),Y=W(!0,!0);h.Extension.create({name:"characterCount",addOptions(){return{limit:null,autoTrim:!0,mode:"textSize",textCounter:n=>n.length,wordCounter:n=>n.split(" ").filter(e=>e!=="").length}},addStorage(){return{characters:()=>0,words:()=>0}},onBeforeCreate(){this.storage.characters=n=>{const e=(n==null?void 0:n.node)||this.editor.state.doc;if(((n==null?void 0:n.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=n=>{const e=(n==null?void 0:n.node)||this.editor.state.doc,t=e.textBetween(0,e.content.size," "," ");return this.options.wordCounter(t)}},addProseMirrorPlugins(){let n=!1;return[new b.Plugin({key:new b.PluginKey("characterCount"),appendTransaction:(e,t,o)=>{if(n)return;const r=this.options.limit,i=this.options.autoTrim;if(r==null||r===0||i===!1){n=!0;return}const s=this.storage.characters({node:o.doc});if(s>r){const l=s-r,a=0,c=l;console.warn(`[CharacterCount] Initial content exceeded limit of ${r} characters. Content was automatically trimmed.`);const u=o.tr.deleteRange(a,c);return n=!0,u}n=!0},filterTransaction:(e,t)=>{const o=this.options.limit;if(!e.docChanged||o===0||o===null||o===void 0)return!0;const r=this.storage.characters({node:t.doc}),i=this.storage.characters({node:e.doc});if(i<=o||r>o&&i>o&&i<=r)return!0;if(r>o&&i>o&&i>r||!e.getMeta("paste"))return!1;const l=e.selection.$head.pos,a=i-o,c=l-a,u=l;return e.deleteRange(c,u),!(this.storage.characters({node:e.doc})>o)}})]}});h.Extension.create({name:"dropCursor",addOptions(){return{color:"currentColor",width:1,class:void 0}},addProseMirrorPlugins(){return[J(this.options)]}});h.Extension.create({name:"focus",addOptions(){return{className:"has-focus",mode:"all"}},addProseMirrorPlugins(){return[new b.Plugin({key:new b.PluginKey("focus"),props:{decorations:({doc:n,selection:e})=>{const{isEditable:t,isFocused:o}=this.editor,{anchor:r}=e,i=[];if(!t||!o)return x.DecorationSet.create(n,[]);let s=0;this.options.mode==="deepest"&&n.descendants((a,c)=>{if(a.isText)return;if(!(r>=c&&r<=c+a.nodeSize-1))return!1;s+=1});let l=0;return n.descendants((a,c)=>{if(a.isText||!(r>=c&&r<=c+a.nodeSize-1))return!1;if(l+=1,this.options.mode==="deepest"&&s-l>0||this.options.mode==="shallowest"&&l>1)return this.options.mode==="deepest";i.push(x.Decoration.node(c,c+a.nodeSize,{class:this.options.className}))}),x.DecorationSet.create(n,i)}}})]}});h.Extension.create({name:"gapCursor",addProseMirrorPlugins(){return[te()]},extendNodeSchema(n){var e;const t={name:n.name,options:n.options,storage:n.storage};return{allowGapCursor:(e=h.callOrReturn(h.getExtensionField(n,"allowGapCursor",t)))!=null?e:null}}});var q="placeholder",T=new b.PluginKey("tiptap__placeholder"),_=200;function K(n){const{editor:e,placeholder:t,dataAttribute:o,pos:r,node:i,isEmptyDoc:s,hasAnchor:l,classes:{emptyNode:a,emptyEditor:c}}=n,u=[a];return s&&u.push(c),x.Decoration.node(r,r+i.nodeSize,{class:u.join(" "),[o]:typeof t=="function"?t({editor:e,node:i,pos:r,hasAnchor:l}):t})}function j(n,e){return typeof n=="function"?n(e):n}function me({editor:n,options:e,dataAttribute:t,doc:o,selection:r}){var i,s;if(!(n.isEditable||!e.showOnlyWhenEditable))return null;const{anchor:a}=r,c=[],u=n.isEmpty;if(e.showOnlyCurrent&&!e.includeChildren){const p=o.resolve(a),f=p.depth>0?p.node(1):p.nodeAfter,m=p.depth>0?p.before(1):a;if(f&&f.type.isTextblock&&h.isNodeEmpty(f)){const y=a>=m&&a<=m+f.nodeSize;c.push(K({editor:n,isEmptyDoc:u,dataAttribute:t,hasAnchor:y,placeholder:e.placeholder,classes:{emptyEditor:e.emptyEditorClass,emptyNode:j(e.emptyNodeClass,{editor:n,node:f,pos:m,hasAnchor:y})},node:f,pos:m}))}}else{const p=T.getState(n.state),f=(i=p==null?void 0:p.topPos)!=null?i:0,m=(s=p==null?void 0:p.bottomPos)!=null?s:o.content.size;o.nodesBetween(f,m,(y,C)=>{const D=a>=C&&a<=C+y.nodeSize,Z=!y.isLeaf&&h.isNodeEmpty(y);return y.type.isTextblock&&(D||!e.showOnlyCurrent)&&Z&&c.push(K({editor:n,isEmptyDoc:u,dataAttribute:t,hasAnchor:D,placeholder:e.placeholder,classes:{emptyEditor:e.emptyEditorClass,emptyNode:j(e.emptyNodeClass,{editor:n,node:y,pos:C,hasAnchor:D})},node:y,pos:C})),e.includeChildren})}return x.DecorationSet.create(o,c)}function ge(n){return n.replace(/\s+/g,"-").replace(/[^a-zA-Z0-9-]/g,"").replace(/^[0-9-]+/,"").replace(/^-+/,"").toLowerCase()}function ve(n){const e=getComputedStyle(n),t=`${e.overflow} ${e.overflowY} ${e.overflowX}`;return/auto|scroll|overlay/.test(t)}function ye(n){let e=n;for(;e;){if(ve(e))return e;const t=e.parentElement;if(!t){const o=e.getRootNode();if(o instanceof ShadowRoot){e=o.host;continue}return window}e=t}return window}function we(n){return n===window?{top:0,bottom:window.innerHeight}:n.getBoundingClientRect()}function Ce({view:n,scrollContainer:e}){const t=n.dom.getBoundingClientRect();if(t.width<=0||t.height<=0)return null;const o=e?we(e):{top:0,bottom:window.innerHeight},r=Math.max(t.top,o.top)-_,i=Math.min(t.bottom,o.bottom)+_;if(r>=i)return null;const s=t.left+1,l=t.right-1;if(s>l)return null;const c=getComputedStyle(n.dom).direction==="rtl"?t.right-2:t.left+2,u=Math.min(Math.max(c,s),l),d=Math.max(r+2,t.top+1),p=Math.min(i-2,t.bottom-1);if(d>p)return null;const f=n.posAtCoords({left:u,top:d}),m=n.posAtCoords({left:u,top:p});return!f||!m?null:{top:f.pos,bottom:m.pos}}var Pe={init(){return{topPos:null,bottomPos:null}},apply(n,e){const t=n.getMeta(T);return t!=null&&t.positions?{topPos:t.positions.top,bottomPos:t.positions.bottom}:n.docChanged?{topPos:e.topPos!==null?n.mapping.map(e.topPos):null,bottomPos:e.bottomPos!==null?n.mapping.map(e.bottomPos):null}:e}};function be(n){const e=ye(n.dom),t=()=>{const c=Ce({view:n,scrollContainer:e});if(c===null)return;const u=T.getState(n.state);if((u==null?void 0:u.topPos)===c.top&&(u==null?void 0:u.bottomPos)===c.bottom)return;const d=n.state.tr.setMeta(T,{positions:c});n.dispatch(d)};let o=null,r=0;const i=150,s=()=>{o===null&&(o=requestAnimationFrame(()=>{o=null;const c=performance.now();c-r>=i?(r=c,t()):s()}))};e.addEventListener("scroll",s,{passive:!0});const l=typeof ResizeObserver<"u"?new ResizeObserver(s):null;l==null||l.observe(n.dom);const a=typeof IntersectionObserver<"u"?new IntersectionObserver(s):null;return a==null||a.observe(n.dom),n.dom.addEventListener("focus",s),t(),{update(c,u){n.state.doc.content.size!==u.doc.content.size&&s()},destroy:()=>{o!==null&&cancelAnimationFrame(o),e.removeEventListener("scroll",s),l==null||l.disconnect(),a==null||a.disconnect(),n.dom.removeEventListener("focus",s)}}}function Ee({editor:n,options:e}){const t=e.dataAttribute?`data-${ge(e.dataAttribute)}`:`data-${q}`;return new b.Plugin({key:T,state:Pe,view:be,props:{decorations:({doc:o,selection:r})=>me({editor:n,options:e,dataAttribute:t,doc:o,selection:r})}})}h.Extension.create({name:"placeholder",addOptions(){return{emptyEditorClass:"is-editor-empty",emptyNodeClass:"is-empty",dataAttribute:q,placeholder:"Write something …",showOnlyWhenEditable:!0,showOnlyCurrent:!0,includeChildren:!1}},addProseMirrorPlugins(){return[Ee({editor:this.editor,options:this.options})]}});var Se=`.ProseMirror:not(.ProseMirror-focused) *::selection {
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const f=require("./index-EoGU7W4e.cjs"),P=require("@tiptap/pm/state"),C=require("@tiptap/pm/view"),N=require("./index-Dgs2thVL.cjs"),S=require("react/jsx-runtime"),x=require("./index-BO82_0q8.cjs");require("react");require("./theme.cjs");function Q(n={}){return new f.Plugin({view(e){return new $(e,n)}})}class ${constructor(e,t){var r;this.editorView=e,this.cursorPos=null,this.element=null,this.timeout=-1,this.width=(r=t.width)!==null&&r!==void 0?r:1,this.color=t.color===!1?void 0:t.color||"black",this.class=t.class,this.handlers=["dragover","dragend","drop","dragleave"].map(o=>{let i=s=>{this[o](s)};return e.dom.addEventListener(o,i),{name:o,handler:i}})}destroy(){this.handlers.forEach(({name:e,handler:t})=>this.editorView.dom.removeEventListener(e,t))}update(e,t){this.cursorPos!=null&&t.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),t=!e.parent.inlineContent,r,o=this.editorView.dom,i=o.getBoundingClientRect(),s=i.width/o.offsetWidth,l=i.height/o.offsetHeight;if(t){let c=e.nodeBefore,p=e.nodeAfter;if(c||p){let h=this.editorView.nodeDOM(this.cursorPos-(c?c.nodeSize:0));if(h){let v=h.getBoundingClientRect(),b=c?v.bottom:v.top;c&&p&&(b=(b+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2);let T=this.width/2*l;r={left:v.left,right:v.right,top:b-T,bottom:b+T}}}}if(!r){let c=this.editorView.coordsAtPos(this.cursorPos),p=this.width/2*s;r={left:c.left-p,right:c.left+p,top:c.top,bottom:c.bottom}}let a=this.editorView.dom.offsetParent;this.element||(this.element=a.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",t),this.element.classList.toggle("prosemirror-dropcursor-inline",!t);let d,u;if(!a||a==document.body&&getComputedStyle(a).position=="static")d=-pageXOffset,u=-pageYOffset;else{let c=a.getBoundingClientRect(),p=c.width/a.offsetWidth,h=c.height/a.offsetHeight;d=c.left-a.scrollLeft*p,u=c.top-a.scrollTop*h}this.element.style.left=(r.left-d)/s+"px",this.element.style.top=(r.top-u)/l+"px",this.element.style.width=(r.right-r.left)/s+"px",this.element.style.height=(r.bottom-r.top)/l+"px"}scheduleRemoval(e){clearTimeout(this.timeout),this.timeout=setTimeout(()=>this.setCursor(null),e)}dragover(e){if(!this.editorView.editable)return;let t=this.editorView.posAtCoords({left:e.clientX,top:e.clientY}),r=t&&t.inside>=0&&this.editorView.state.doc.nodeAt(t.inside),o=r&&r.type.spec.disableDropCursor,i=typeof o=="function"?o(this.editorView,t,e):o;if(t&&!i){let s=t.pos;if(this.editorView.dragging&&this.editorView.dragging.slice){let l=f.dropPoint(this.editorView.state.doc,s,this.editorView.dragging.slice);l!=null&&(s=l)}this.setCursor(s),this.scheduleRemoval(5e3)}}dragend(){this.scheduleRemoval(20)}drop(){this.scheduleRemoval(20)}dragleave(e){this.editorView.dom.contains(e.relatedTarget)||this.setCursor(null)}}class m extends f.Selection{constructor(e){super(e,e)}map(e,t){let r=e.resolve(t.map(this.head));return m.valid(r)?new m(r):f.Selection.near(r)}content(){return f.Slice.empty}eq(e){return e instanceof m&&e.head==this.head}toJSON(){return{type:"gapcursor",pos:this.head}}static fromJSON(e,t){if(typeof t.pos!="number")throw new RangeError("Invalid input for GapCursor.fromJSON");return new m(e.resolve(t.pos))}getBookmark(){return new F(this.anchor)}static valid(e){let t=e.parent;if(t.inlineContent||!ee(e)||!te(e))return!1;let r=t.type.spec.allowGapCursor;if(r!=null)return r;let o=t.contentMatchAt(e.index()).defaultType;return o&&o.isTextblock}static findGapCursorFrom(e,t,r=!1){e:for(;;){if(!r&&m.valid(e))return e;let o=e.pos,i=null;for(let s=e.depth;;s--){let l=e.node(s);if(t>0?e.indexAfter(s)<l.childCount:e.index(s)>0){i=l.child(t>0?e.indexAfter(s):e.index(s)-1);break}else if(s==0)return null;o+=t;let a=e.doc.resolve(o);if(m.valid(a))return a}for(;;){let s=t>0?i.firstChild:i.lastChild;if(!s){if(i.isAtom&&!i.isText&&!f.NodeSelection.isSelectable(i)){e=e.doc.resolve(o+i.nodeSize*t),r=!1;continue e}break}i=s,o+=t;let l=e.doc.resolve(o);if(m.valid(l))return l}return null}}}m.prototype.visible=!1;m.findFrom=m.findGapCursorFrom;f.Selection.jsonID("gapcursor",m);class F{constructor(e){this.pos=e}map(e){return new F(e.map(this.pos))}resolve(e){let t=e.resolve(this.pos);return m.valid(t)?new m(t):f.Selection.near(t)}}function j(n){return n.isAtom||n.spec.isolating||n.spec.createGapCursor}function ee(n){for(let e=n.depth;e>=0;e--){let t=n.index(e),r=n.node(e);if(t==0){if(r.type.spec.isolating)return!0;continue}for(let o=r.child(t-1);;o=o.lastChild){if(o.childCount==0&&!o.inlineContent||j(o.type))return!0;if(o.inlineContent)return!1}}return!0}function te(n){for(let e=n.depth;e>=0;e--){let t=n.indexAfter(e),r=n.node(e);if(t==r.childCount){if(r.type.spec.isolating)return!0;continue}for(let o=r.child(t);;o=o.firstChild){if(o.childCount==0&&!o.inlineContent||j(o.type))return!0;if(o.inlineContent)return!1}}return!0}function ne(){return new f.Plugin({props:{decorations:se,createSelectionBetween(n,e,t){return e.pos==t.pos&&m.valid(t)?new m(t):null},handleClick:oe,handleKeyDown:re,handleDOMEvents:{beforeinput:ie}}})}const re=N.keydownHandler({ArrowLeft:O("horiz",-1),ArrowRight:O("horiz",1),ArrowUp:O("vert",-1),ArrowDown:O("vert",1)});function O(n,e){const t=n=="vert"?e>0?"down":"up":e>0?"right":"left";return function(r,o,i){let s=r.selection,l=e>0?s.$to:s.$from,a=s.empty;if(s instanceof f.TextSelection){if(!i.endOfTextblock(t)||l.depth==0)return!1;a=!1,l=r.doc.resolve(e>0?l.after():l.before())}let d=m.findGapCursorFrom(l,e,a);return d?(o&&o(r.tr.setSelection(new m(d))),!0):!1}}function oe(n,e,t){if(!n||!n.editable)return!1;let r=n.state.doc.resolve(e);if(!m.valid(r))return!1;let o=n.posAtCoords({left:t.clientX,top:t.clientY});return o&&o.inside>-1&&f.NodeSelection.isSelectable(n.state.doc.nodeAt(o.inside))?!1:(n.dispatch(n.state.tr.setSelection(new m(r))),!0)}function ie(n,e){if(e.inputType!="insertCompositionText"||!(n.state.selection instanceof m))return!1;let{$from:t}=n.state.selection,r=t.parent.contentMatchAt(t.index()).findWrapping(n.state.schema.nodes.text);if(!r)return!1;let o=f.Fragment.empty;for(let s=r.length-1;s>=0;s--)o=f.Fragment.from(r[s].createAndFill(null,o));let i=n.state.tr.replace(t.pos,t.pos,new f.Slice(o,0,0));return i.setSelection(f.TextSelection.near(i.doc.resolve(t.pos+1))),n.dispatch(i),!1}function se(n){if(!(n.selection instanceof m))return null;let e=document.createElement("div");return e.className="ProseMirror-gapcursor",N.DecorationSet.create(n.doc,[N.Decoration.widget(n.selection.head,e,{key:"gapcursor"})])}var R=200,g=function(){};g.prototype.append=function(e){return e.length?(e=g.from(e),!this.length&&e||e.length<R&&this.leafAppend(e)||this.length<R&&e.leafPrepend(this)||this.appendInner(e)):this};g.prototype.prepend=function(e){return e.length?g.from(e).append(this):this};g.prototype.appendInner=function(e){return new le(this,e)};g.prototype.slice=function(e,t){return e===void 0&&(e=0),t===void 0&&(t=this.length),e>=t?g.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,t))};g.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)};g.prototype.forEach=function(e,t,r){t===void 0&&(t=0),r===void 0&&(r=this.length),t<=r?this.forEachInner(e,t,r,0):this.forEachInvertedInner(e,t,r,0)};g.prototype.map=function(e,t,r){t===void 0&&(t=0),r===void 0&&(r=this.length);var o=[];return this.forEach(function(i,s){return o.push(e(i,s))},t,r),o};g.from=function(e){return e instanceof g?e:e&&e.length?new G(e):g.empty};var G=(function(n){function e(r){n.call(this),this.values=r}n&&(e.__proto__=n),e.prototype=Object.create(n&&n.prototype),e.prototype.constructor=e;var t={length:{configurable:!0},depth:{configurable:!0}};return e.prototype.flatten=function(){return this.values},e.prototype.sliceInner=function(o,i){return o==0&&i==this.length?this:new e(this.values.slice(o,i))},e.prototype.getInner=function(o){return this.values[o]},e.prototype.forEachInner=function(o,i,s,l){for(var a=i;a<s;a++)if(o(this.values[a],l+a)===!1)return!1},e.prototype.forEachInvertedInner=function(o,i,s,l){for(var a=i-1;a>=s;a--)if(o(this.values[a],l+a)===!1)return!1},e.prototype.leafAppend=function(o){if(this.length+o.length<=R)return new e(this.values.concat(o.flatten()))},e.prototype.leafPrepend=function(o){if(this.length+o.length<=R)return new e(o.flatten().concat(this.values))},t.length.get=function(){return this.values.length},t.depth.get=function(){return 0},Object.defineProperties(e.prototype,t),e})(g);g.empty=new G([]);var le=(function(n){function e(t,r){n.call(this),this.left=t,this.right=r,this.length=t.length+r.length,this.depth=Math.max(t.depth,r.depth)+1}return n&&(e.__proto__=n),e.prototype=Object.create(n&&n.prototype),e.prototype.constructor=e,e.prototype.flatten=function(){return this.left.flatten().concat(this.right.flatten())},e.prototype.getInner=function(r){return r<this.left.length?this.left.get(r):this.right.get(r-this.left.length)},e.prototype.forEachInner=function(r,o,i,s){var l=this.left.length;if(o<l&&this.left.forEachInner(r,o,Math.min(i,l),s)===!1||i>l&&this.right.forEachInner(r,Math.max(o-l,0),Math.min(this.length,i)-l,s+l)===!1)return!1},e.prototype.forEachInvertedInner=function(r,o,i,s){var l=this.left.length;if(o>l&&this.right.forEachInvertedInner(r,o-l,Math.max(i,l)-l,s+l)===!1||i<l&&this.left.forEachInvertedInner(r,Math.min(o,l),i,s)===!1)return!1},e.prototype.sliceInner=function(r,o){if(r==0&&o==this.length)return this;var i=this.left.length;return o<=i?this.left.slice(r,o):r>=i?this.right.slice(r-i,o-i):this.left.slice(r,i).append(this.right.slice(0,o-i))},e.prototype.leafAppend=function(r){var o=this.right.leafAppend(r);if(o)return new e(this.left,o)},e.prototype.leafPrepend=function(r){var o=this.left.leafPrepend(r);if(o)return new e(o,this.right)},e.prototype.appendInner=function(r){return this.left.depth>=Math.max(this.right.depth,r.depth)+1?new e(this.left,new e(this.right,r)):new e(this,r)},e})(g);const ae=500;class y{constructor(e,t){this.items=e,this.eventCount=t}popEvent(e,t){if(this.eventCount==0)return null;let r=this.items.length;for(;;r--)if(this.items.get(r-1).selection){--r;break}let o,i;t&&(o=this.remapping(r,this.items.length),i=o.maps.length);let s=e.tr,l,a,d=[],u=[];return this.items.forEach((c,p)=>{if(!c.step){o||(o=this.remapping(r,p+1),i=o.maps.length),i--,u.push(c);return}if(o){u.push(new w(c.map));let h=c.step.map(o.slice(i)),v;h&&s.maybeStep(h).doc&&(v=s.mapping.maps[s.mapping.maps.length-1],d.push(new w(v,void 0,void 0,d.length+u.length))),i--,v&&o.appendMap(v,i)}else s.maybeStep(c.step);if(c.selection)return l=o?c.selection.map(o.slice(i)):c.selection,a=new y(this.items.slice(0,r).append(u.reverse().concat(d)),this.eventCount-1),!1},this.items.length,0),{remaining:a,transform:s,selection:l}}addTransform(e,t,r,o){let i=[],s=this.eventCount,l=this.items,a=!o&&l.length?l.get(l.length-1):null;for(let u=0;u<e.steps.length;u++){let c=e.steps[u].invert(e.docs[u]),p=new w(e.mapping.maps[u],c,t),h;(h=a&&a.merge(p))&&(p=h,u?i.pop():l=l.slice(0,l.length-1)),i.push(p),t&&(s++,t=void 0),o||(a=p)}let d=s-r.depth;return d>de&&(l=ce(l,d),s-=d),new y(l.append(i),s)}remapping(e,t){let r=new f.Mapping;return this.items.forEach((o,i)=>{let s=o.mirrorOffset!=null&&i-o.mirrorOffset>=e?r.maps.length-o.mirrorOffset:void 0;r.appendMap(o.map,s)},e,t),r}addMaps(e){return this.eventCount==0?this:new y(this.items.append(e.map(t=>new w(t))),this.eventCount)}rebased(e,t){if(!this.eventCount)return this;let r=[],o=Math.max(0,this.items.length-t),i=e.mapping,s=e.steps.length,l=this.eventCount;this.items.forEach(p=>{p.selection&&l--},o);let a=t;this.items.forEach(p=>{let h=i.getMirror(--a);if(h==null)return;s=Math.min(s,h);let v=i.maps[h];if(p.step){let b=e.steps[h].invert(e.docs[h]),T=p.selection&&p.selection.map(i.slice(a+1,h));T&&l++,r.push(new w(v,b,T))}else r.push(new w(v))},o);let d=[];for(let p=t;p<s;p++)d.push(new w(i.maps[p]));let u=this.items.slice(0,o).append(d).append(r),c=new y(u,l);return c.emptyItemCount()>ae&&(c=c.compress(this.items.length-r.length)),c}emptyItemCount(){let e=0;return this.items.forEach(t=>{t.step||e++}),e}compress(e=this.items.length){let t=this.remapping(0,e),r=t.maps.length,o=[],i=0;return this.items.forEach((s,l)=>{if(l>=e)o.push(s),s.selection&&i++;else if(s.step){let a=s.step.map(t.slice(r)),d=a&&a.getMap();if(r--,d&&t.appendMap(d,r),a){let u=s.selection&&s.selection.map(t.slice(r));u&&i++;let c=new w(d.invert(),a,u),p,h=o.length-1;(p=o.length&&o[h].merge(c))?o[h]=p:o.push(c)}}else s.map&&r--},this.items.length,0),new y(g.from(o.reverse()),i)}}y.empty=new y(g.empty,0);function ce(n,e){let t;return n.forEach((r,o)=>{if(r.selection&&e--==0)return t=o,!1}),n.slice(t)}class w{constructor(e,t,r,o){this.map=e,this.step=t,this.selection=r,this.mirrorOffset=o}merge(e){if(this.step&&e.step&&!e.selection){let t=e.step.merge(this.step);if(t)return new w(t.getMap().invert(),t,this.selection)}}}class E{constructor(e,t,r,o,i){this.done=e,this.undone=t,this.prevRanges=r,this.prevTime=o,this.prevComposition=i}}const de=20;function ue(n,e,t,r){let o=t.getMeta(M),i;if(o)return o.historyState;t.getMeta(he)&&(n=new E(n.done,n.undone,null,0,-1));let s=t.getMeta("appendedTransaction");if(t.steps.length==0)return n;if(s&&s.getMeta(M))return s.getMeta(M).redo?new E(n.done.addTransform(t,void 0,r,D(e)),n.undone,B(t.mapping.maps),n.prevTime,n.prevComposition):new E(n.done,n.undone.addTransform(t,void 0,r,D(e)),null,n.prevTime,n.prevComposition);if(t.getMeta("addToHistory")!==!1&&!(s&&s.getMeta("addToHistory")===!1)){let l=t.getMeta("composition"),a=n.prevTime==0||!s&&n.prevComposition!=l&&(n.prevTime<(t.time||0)-r.newGroupDelay||!pe(t,n.prevRanges)),d=s?z(n.prevRanges,t.mapping):B(t.mapping.maps);return new E(n.done.addTransform(t,a?e.selection.getBookmark():void 0,r,D(e)),y.empty,d,t.time,l??n.prevComposition)}else return(i=t.getMeta("rebased"))?new E(n.done.rebased(t,i),n.undone.rebased(t,i),z(n.prevRanges,t.mapping),n.prevTime,n.prevComposition):new E(n.done.addMaps(t.mapping.maps),n.undone.addMaps(t.mapping.maps),z(n.prevRanges,t.mapping),n.prevTime,n.prevComposition)}function pe(n,e){if(!e)return!1;if(!n.docChanged)return!0;let t=!1;return n.mapping.maps[0].forEach((r,o)=>{for(let i=0;i<e.length;i+=2)r<=e[i+1]&&o>=e[i]&&(t=!0)}),t}function B(n){let e=[];for(let t=n.length-1;t>=0&&e.length==0;t--)n[t].forEach((r,o,i,s)=>e.push(i,s));return e}function z(n,e){if(!n)return null;let t=[];for(let r=0;r<n.length;r+=2){let o=e.map(n[r],1),i=e.map(n[r+1],-1);o<=i&&t.push(o,i)}return t}function fe(n,e,t){let r=D(e),o=M.get(e).spec.config,i=(t?n.undone:n.done).popEvent(e,r);if(!i)return null;let s=i.selection.resolve(i.transform.doc),l=(t?n.done:n.undone).addTransform(i.transform,e.selection.getBookmark(),o,r),a=new E(t?l:i.remaining,t?i.remaining:l,null,0,-1);return i.transform.setSelection(s).setMeta(M,{redo:t,historyState:a})}let k=!1,K=null;function D(n){let e=n.plugins;if(K!=e){k=!1,K=e;for(let t=0;t<e.length;t++)if(e[t].spec.historyPreserveItems){k=!0;break}}return k}const M=new f.PluginKey("history"),he=new f.PluginKey("closeHistory");function me(n={}){return n={depth:n.depth||100,newGroupDelay:n.newGroupDelay||500},new f.Plugin({key:M,state:{init(){return new E(y.empty,y.empty,null,0,-1)},apply(e,t,r){return ue(t,r,e,n)}},config:n,props:{handleDOMEvents:{beforeinput(e,t){let r=t.inputType,o=r=="historyUndo"?U:r=="historyRedo"?W:null;return!o||!e.editable?!1:(t.preventDefault(),o(e.state,e.dispatch))}}}})}function H(n,e){return(t,r)=>{let o=M.getState(t);if(!o||(n?o.undone:o.done).eventCount==0)return!1;if(r){let i=fe(o,t,n);i&&r(e?i.scrollIntoView():i)}return!0}}const U=H(!1,!0),W=H(!0,!0);f.Extension.create({name:"characterCount",addOptions(){return{limit:null,autoTrim:!0,mode:"textSize",textCounter:n=>n.length,wordCounter:n=>n.split(" ").filter(e=>e!=="").length}},addStorage(){return{characters:()=>0,words:()=>0}},onBeforeCreate(){this.storage.characters=n=>{const e=(n==null?void 0:n.node)||this.editor.state.doc;if(((n==null?void 0:n.mode)||this.options.mode)==="textSize"){const r=e.textBetween(0,e.content.size,void 0," ");return this.options.textCounter(r)}return e.nodeSize},this.storage.words=n=>{const e=(n==null?void 0:n.node)||this.editor.state.doc,t=e.textBetween(0,e.content.size," "," ");return this.options.wordCounter(t)}},addProseMirrorPlugins(){let n=!1;return[new P.Plugin({key:new P.PluginKey("characterCount"),appendTransaction:(e,t,r)=>{if(n)return;const o=this.options.limit,i=this.options.autoTrim;if(o==null||o===0||i===!1){n=!0;return}const s=this.storage.characters({node:r.doc});if(s>o){const l=s-o,a=0,d=l;console.warn(`[CharacterCount] Initial content exceeded limit of ${o} characters. Content was automatically trimmed.`);const u=r.tr.deleteRange(a,d);return n=!0,u}n=!0},filterTransaction:(e,t)=>{const r=this.options.limit;if(!e.docChanged||r===0||r===null||r===void 0)return!0;const o=this.storage.characters({node:t.doc}),i=this.storage.characters({node:e.doc});if(i<=r||o>r&&i>r&&i<=o)return!0;if(o>r&&i>r&&i>o||!e.getMeta("paste"))return!1;const l=e.selection.$head.pos,a=i-r,d=l-a,u=l;return e.deleteRange(d,u),!(this.storage.characters({node:e.doc})>r)}})]}});f.Extension.create({name:"dropCursor",addOptions(){return{color:"currentColor",width:1,class:void 0}},addProseMirrorPlugins(){return[Q(this.options)]}});f.Extension.create({name:"focus",addOptions(){return{className:"has-focus",mode:"all"}},addProseMirrorPlugins(){return[new P.Plugin({key:new P.PluginKey("focus"),props:{decorations:({doc:n,selection:e})=>{const{isEditable:t,isFocused:r}=this.editor,{anchor:o}=e,i=[];if(!t||!r)return C.DecorationSet.create(n,[]);let s=0;this.options.mode==="deepest"&&n.descendants((a,d)=>{if(a.isText)return;if(!(o>=d&&o<=d+a.nodeSize-1))return!1;s+=1});let l=0;return n.descendants((a,d)=>{if(a.isText||!(o>=d&&o<=d+a.nodeSize-1))return!1;if(l+=1,this.options.mode==="deepest"&&s-l>0||this.options.mode==="shallowest"&&l>1)return this.options.mode==="deepest";i.push(C.Decoration.node(d,d+a.nodeSize,{class:this.options.className}))}),C.DecorationSet.create(n,i)}}})]}});f.Extension.create({name:"gapCursor",addProseMirrorPlugins(){return[ne()]},extendNodeSchema(n){var e;const t={name:n.name,options:n.options,storage:n.storage};return{allowGapCursor:(e=f.callOrReturn(f.getExtensionField(n,"allowGapCursor",t)))!=null?e:null}}});var Y="placeholder",V=new P.PluginKey("tiptap__placeholder");function q(n){const{editor:e,placeholder:t,dataAttribute:r,pos:o,node:i,isEmptyDoc:s,hasAnchor:l,classes:{emptyNode:a,emptyEditor:d}}=n,u=[a];return s&&u.push(d),C.Decoration.node(o,o+i.nodeSize,{class:u.join(" "),[r]:typeof t=="function"?t({editor:e,node:i,pos:o,hasAnchor:l}):t})}function X(n,e){return typeof n=="function"?n(e):n}function Z({editor:n,options:e,dataAttribute:t,doc:r,selection:o,from:i,to:s}){const{anchor:l}=o,a=[],d=n.isEmpty;return r.nodesBetween(i,s,(u,c)=>{const p=l>=c&&l<=c+u.nodeSize,h=!u.isLeaf&&f.isNodeEmpty(u);return u.type.isTextblock&&(p||!e.showOnlyCurrent)&&h&&a.push(q({editor:n,isEmptyDoc:d,dataAttribute:t,hasAnchor:p,placeholder:e.placeholder,classes:{emptyEditor:e.emptyEditorClass,emptyNode:X(e.emptyNodeClass,{editor:n,node:u,pos:c,hasAnchor:p})},node:u,pos:c})),e.includeChildren}),a}function J({editor:n,options:e,dataAttribute:t,doc:r,selection:o}){if(!(n.isEditable||!e.showOnlyWhenEditable))return null;const{anchor:s}=o,l=[],a=n.isEmpty;if(e.showOnlyCurrent&&!e.includeChildren){const u=r.resolve(s),c=u.depth>0?u.node(1):u.nodeAfter,p=u.depth>0?u.before(1):s;if(c&&c.type.isTextblock&&f.isNodeEmpty(c)){const h=s>=p&&s<=p+c.nodeSize;l.push(q({editor:n,isEmptyDoc:a,dataAttribute:t,hasAnchor:h,placeholder:e.placeholder,classes:{emptyEditor:e.emptyEditorClass,emptyNode:X(e.emptyNodeClass,{editor:n,node:c,pos:p,hasAnchor:h})},node:c,pos:p}))}}else l.push(...Z({editor:n,options:e,dataAttribute:t,doc:r,selection:o,from:0,to:r.content.size}));return C.DecorationSet.create(r,l)}function A(n,e){var t;const r=n.resolve(e);if(r.depth===0){const s=(t=r.nodeAfter)!=null?t:r.nodeBefore;if(!s)return{from:e,to:e};const l=r.nodeAfter?e:e-s.nodeSize;return{from:l,to:l+s.nodeSize}}const o=r.before(1),i=r.node(1);return{from:o,to:o+i.nodeSize}}function I(n,e){return{from:Math.max(0,e.from-1),to:Math.min(n.content.size,e.to-1)}}function ge(n,e,t){const r=[];return n.forEach((o,i)=>{const s=i,l=s+o.nodeSize,a=s+1,d=l+1;a<t&&d>e&&r.push({from:s,to:l})}),r}function ve(n){if(n.length===0)return[];const e=[...n].sort((r,o)=>r.from-o.from),t=[{...e[0]}];for(let r=1;r<e.length;r+=1){const o=t[t.length-1],i=e[r];i.from<=o.to?o.to=Math.max(o.to,i.to):t.push({...i})}return t}function ye(n,e){const t=ge(n,e.from,e.to);return t.push(I(n,A(n,e.from))),e.to>e.from?t.push(I(n,A(n,Math.min(e.to,n.content.size+1)-1))):e.from<n.content.size+1&&t.push(I(n,A(n,Math.min(e.from+1,n.content.size)))),t}function we(n,e,t){const r=[];if(n.docChanged){const o=f.getChangedRanges(n);for(const i of o)r.push(...ye(t.doc,i.newRange))}return n.selectionSet&&(r.push(I(t.doc,A(t.doc,n.mapping.map(e.selection.anchor)))),r.push(I(t.doc,A(t.doc,t.selection.anchor)))),ve(r)}function Ce(n,e,t){const r=Math.max(0,Math.min(n,t.content.size)),o=Math.max(r,Math.min(e,t.content.size));return{from:r,to:o}}function Pe({decorations:n,ranges:e,editor:t,options:r,dataAttribute:o,doc:i,selection:s}){let l=n;for(const a of e){const{from:d,to:u}=Ce(a.from,a.to,i),c=l.find(d,u).filter(h=>h.from>=d&&h.to<=u);c.length&&(l=l.remove(c));const p=Z({editor:t,options:r,dataAttribute:o,doc:i,selection:s,from:d,to:u});p.length&&(l=l.add(i,p))}return l}function Ee({editor:n,options:e,dataAttribute:t}){return{init(r,o){const i=J({editor:n,options:e,dataAttribute:t,doc:o.doc,selection:o.selection});return i??C.DecorationSet.empty},apply(r,o,i,s){if(!r.docChanged&&!r.selectionSet)return o;const l=o.map(r.mapping,r.doc),a=we(r,i,s);return Pe({decorations:l,ranges:a,editor:n,options:e,dataAttribute:t,doc:s.doc,selection:s.selection})}}}function xe(n){return n.replace(/\s+/g,"-").replace(/[^a-zA-Z0-9-]/g,"").replace(/^[0-9-]+/,"").replace(/^-+/,"").toLowerCase()}function Me({editor:n,options:e}){const t=e.dataAttribute?`data-${xe(e.dataAttribute)}`:`data-${Y}`,r=e.showOnlyCurrent&&!e.includeChildren;return new P.Plugin({key:V,...r?{}:{state:Ee({editor:n,options:e,dataAttribute:t})},props:{decorations:r?({doc:o,selection:i})=>J({editor:n,options:e,dataAttribute:t,doc:o,selection:i}):o=>{var i;return e.showOnlyWhenEditable&&!n.isEditable?C.DecorationSet.empty:(i=V.getState(o))!=null?i:C.DecorationSet.empty}}})}f.Extension.create({name:"placeholder",addOptions(){return{emptyEditorClass:"is-editor-empty",emptyNodeClass:"is-empty",dataAttribute:Y,placeholder:"Write something …",showOnlyWhenEditable:!0,showOnlyCurrent:!0,includeChildren:!1}},addProseMirrorPlugins(){return[Me({editor:this.editor,options:this.options})]}});var be=`.ProseMirror:not(.ProseMirror-focused) *::selection {
2
2
  background: transparent;
3
3
  }
4
4
 
5
5
  .ProseMirror:not(.ProseMirror-focused) *::-moz-selection {
6
6
  background: transparent;
7
- }`;h.Extension.create({name:"selection",addOptions(){return{className:"selection"}},addProseMirrorPlugins(){const{editor:n,options:e}=this;return n.options.injectCSS&&typeof document<"u"&&h.createStyleTag(Se,n.options.injectNonce,"selection"),[new b.Plugin({key:new b.PluginKey("selection"),props:{decorations(t){return t.selection.empty||n.isFocused||!n.isEditable||h.isNodeSelection(t.selection)||n.view.dragging?null:x.DecorationSet.create(t.doc,[x.Decoration.inline(t.selection.from,t.selection.to,{class:e.className})])}}})]}});var xe="skipTrailingNode";function H({types:n,node:e}){return e&&Array.isArray(n)&&n.includes(e.type)||(e==null?void 0:e.type)===n}h.Extension.create({name:"trailingNode",addOptions(){return{node:void 0,notAfter:[]}},addProseMirrorPlugins(){var n;const e=new b.PluginKey(this.name),t=this.options.node||((n=this.editor.schema.topNodeType.contentMatch.defaultType)==null?void 0:n.name)||"paragraph",o=Object.entries(this.editor.schema.nodes).map(([,r])=>r).filter(r=>(this.options.notAfter||[]).concat(t).includes(r.name));return[new b.Plugin({key:e,appendTransaction:(r,i,s)=>{const{doc:l,tr:a,schema:c}=s,u=e.getState(s),d=l.content.size,p=c.nodes[t];if(!r.some(f=>f.getMeta(xe))&&u)return a.insert(d,p.create())},state:{init:(r,i)=>{const s=i.tr.doc.lastChild;return!H({node:s,types:o})},apply:(r,i)=>{if(!r.docChanged||r.getMeta("__uniqueIDTransaction"))return i;const s=r.doc.lastChild;return!H({node:s,types:o})}}})]}});var Me=h.Extension.create({name:"undoRedo",addOptions(){return{depth:100,newGroupDelay:500}},addCommands(){return{undo:()=>({state:n,dispatch:e})=>X(n,e),redo:()=>({state:n,dispatch:e})=>Y(n,e)}},addProseMirrorPlugins(){return[he(this.options)]},addKeyboardShortcuts(){return{"Mod-z":()=>this.editor.commands.undo(),"Shift-Mod-z":()=>this.editor.commands.redo(),"Mod-y":()=>this.editor.commands.redo(),"Mod-я":()=>this.editor.commands.undo(),"Shift-Mod-я":()=>this.editor.commands.redo()}}});function Ae(){var u;const n=S.useButtonProps(V.name),{icon:e=void 0,tooltip:t=void 0,shortcutKeys:o=void 0,tooltipOptions:r={},action:i=void 0,isActive:s=void 0}=((u=n==null?void 0:n.componentProps)==null?void 0:u.undo)??{},{disabled:l}=S.useActive(s),a=S.icons[e],c=()=>{l||i&&i()};return!n||!a?A.jsx(A.Fragment,{}):A.jsx(S.ActionButton,{action:c,disabled:l,icon:e,shortcutKeys:o,tooltip:t,tooltipOptions:r})}function Te(){var c;const n=S.useButtonProps(V.name),{icon:e=void 0,tooltip:t=void 0,shortcutKeys:o=void 0,tooltipOptions:r={},action:i=void 0,isActive:s=void 0}=((c=n==null?void 0:n.componentProps)==null?void 0:c.redo)??{},{disabled:l}=S.useActive(s),a=()=>{l||i&&i()};return n?A.jsx(S.ActionButton,{action:a,disabled:l,icon:e,shortcutKeys:o,tooltip:t,tooltipOptions:r}):A.jsx(A.Fragment,{})}const V=Me.extend({addOptions(){var n;return{...(n=this.parent)==null?void 0:n.call(this),depth:100,newGroupDelay:500,button:({editor:e,t,extension:o})=>{var r,i;return{componentProps:{undo:{action:()=>{e.chain().focus().undo().run()},shortcutKeys:((r=o.options.shortcutKeys)==null?void 0:r[0])??["mod","Z"],isActive:()=>e.can().undo(),icon:"Undo2",tooltip:t("editor.undo.tooltip")},redo:{action:()=>{e.chain().focus().redo().run()},shortcutKeys:((i=o.options.shortcutKeys)==null?void 0:i[1])??["shift","mod","Z"],isActive:()=>e.can().redo(),icon:"Redo2",tooltip:t("editor.redo.tooltip")}}}}}}});exports.History=V;exports.RichTextRedo=Te;exports.RichTextUndo=Ae;
7
+ }`;f.Extension.create({name:"selection",addOptions(){return{className:"selection"}},addProseMirrorPlugins(){const{editor:n,options:e}=this;return n.options.injectCSS&&typeof document<"u"&&f.createStyleTag(be,n.options.injectNonce,"selection"),[new P.Plugin({key:new P.PluginKey("selection"),props:{decorations(t){return t.selection.empty||n.isFocused||!n.isEditable||f.isNodeSelection(t.selection)||n.view.dragging?null:C.DecorationSet.create(t.doc,[C.Decoration.inline(t.selection.from,t.selection.to,{class:e.className})])}}})]}});var Se="skipTrailingNode";function _({types:n,node:e}){return e&&Array.isArray(n)&&n.includes(e.type)||(e==null?void 0:e.type)===n}f.Extension.create({name:"trailingNode",addOptions(){return{node:void 0,notAfter:[]}},addProseMirrorPlugins(){var n;const e=new P.PluginKey(this.name),t=this.options.node||((n=this.editor.schema.topNodeType.contentMatch.defaultType)==null?void 0:n.name)||"paragraph",r=Object.entries(this.editor.schema.nodes).map(([,o])=>o).filter(o=>(this.options.notAfter||[]).concat(t).includes(o.name));return[new P.Plugin({key:e,appendTransaction:(o,i,s)=>{const{doc:l,tr:a,schema:d}=s,u=e.getState(s),c=l.content.size,p=d.nodes[t];if(!o.some(h=>h.getMeta(Se))&&u)return a.insert(c,p.create())},state:{init:(o,i)=>{const s=i.tr.doc.lastChild;return!_({node:s,types:r})},apply:(o,i)=>{if(!o.docChanged||o.getMeta("__uniqueIDTransaction"))return i;const s=o.doc.lastChild;return!_({node:s,types:r})}}})]}});var Te=f.Extension.create({name:"undoRedo",addOptions(){return{depth:100,newGroupDelay:500}},addCommands(){return{undo:()=>({state:n,dispatch:e})=>U(n,e),redo:()=>({state:n,dispatch:e})=>W(n,e)}},addProseMirrorPlugins(){return[me(this.options)]},addKeyboardShortcuts(){return{"Mod-z":()=>this.editor.commands.undo(),"Shift-Mod-z":()=>this.editor.commands.redo(),"Mod-y":()=>this.editor.commands.redo(),"Mod-я":()=>this.editor.commands.undo(),"Shift-Mod-я":()=>this.editor.commands.redo()}}});function Ae(){var u;const n=x.useButtonProps(L.name),{icon:e=void 0,tooltip:t=void 0,shortcutKeys:r=void 0,tooltipOptions:o={},action:i=void 0,isActive:s=void 0}=((u=n==null?void 0:n.componentProps)==null?void 0:u.undo)??{},{disabled:l}=x.useActive(s),a=x.icons[e],d=()=>{l||i&&i()};return!n||!a?S.jsx(S.Fragment,{}):S.jsx(x.ActionButton,{action:d,disabled:l,icon:e,shortcutKeys:r,tooltip:t,tooltipOptions:o})}function Ie(){var d;const n=x.useButtonProps(L.name),{icon:e=void 0,tooltip:t=void 0,shortcutKeys:r=void 0,tooltipOptions:o={},action:i=void 0,isActive:s=void 0}=((d=n==null?void 0:n.componentProps)==null?void 0:d.redo)??{},{disabled:l}=x.useActive(s),a=()=>{l||i&&i()};return n?S.jsx(x.ActionButton,{action:a,disabled:l,icon:e,shortcutKeys:r,tooltip:t,tooltipOptions:o}):S.jsx(S.Fragment,{})}const L=Te.extend({addOptions(){var n;return{...(n=this.parent)==null?void 0:n.call(this),depth:100,newGroupDelay:500,button:({editor:e,t,extension:r})=>{var o,i;return{componentProps:{undo:{action:()=>{e.chain().focus().undo().run()},shortcutKeys:((o=r.options.shortcutKeys)==null?void 0:o[0])??["mod","Z"],isActive:()=>e.can().undo(),icon:"Undo2",tooltip:t("editor.undo.tooltip")},redo:{action:()=>{e.chain().focus().redo().run()},shortcutKeys:((i=r.options.shortcutKeys)==null?void 0:i[1])??["shift","mod","Z"],isActive:()=>e.can().redo(),icon:"Redo2",tooltip:t("editor.redo.tooltip")}}}}}}});exports.History=L;exports.RichTextRedo=Ie;exports.RichTextUndo=Ae;