reactjs-tiptap-editor 0.3.9 → 0.3.10

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 (118) hide show
  1. package/lib/Attachment.d.cts +20 -20
  2. package/lib/Attachment.d.ts +20 -20
  3. package/lib/Blockquote.d.cts +20 -20
  4. package/lib/Blockquote.d.ts +20 -20
  5. package/lib/Bold.d.cts +20 -20
  6. package/lib/Bold.d.ts +20 -20
  7. package/lib/BulletList.d.cts +20 -20
  8. package/lib/BulletList.d.ts +20 -20
  9. package/lib/Clear.d.cts +20 -20
  10. package/lib/Clear.d.ts +20 -20
  11. package/lib/Code.d.cts +20 -20
  12. package/lib/Code.d.ts +20 -20
  13. package/lib/CodeBlock.d.cts +20 -20
  14. package/lib/CodeBlock.d.ts +20 -20
  15. package/lib/CodeView.d.cts +20 -20
  16. package/lib/CodeView.d.ts +20 -20
  17. package/lib/Color.d.cts +20 -20
  18. package/lib/Color.d.ts +20 -20
  19. package/lib/Document.d.cts +20 -20
  20. package/lib/Document.d.ts +20 -20
  21. package/lib/Drawer.d.cts +20 -20
  22. package/lib/Drawer.d.ts +20 -20
  23. package/lib/Emoji.d.cts +20 -20
  24. package/lib/Emoji.d.ts +20 -20
  25. package/lib/Excalidraw-Bj3dtbC4.cjs +1 -0
  26. package/lib/{Excalidraw-C3YArGc8.js → Excalidraw-DuV1h_du.js} +40 -36
  27. package/lib/Excalidraw.cjs +1 -1
  28. package/lib/Excalidraw.d.cts +20 -20
  29. package/lib/Excalidraw.d.ts +20 -20
  30. package/lib/Excalidraw.js +1 -1
  31. package/lib/ExportPdf.d.cts +20 -20
  32. package/lib/ExportPdf.d.ts +20 -20
  33. package/lib/ExportWord.d.cts +20 -20
  34. package/lib/ExportWord.d.ts +20 -20
  35. package/lib/FontFamily.d.cts +20 -20
  36. package/lib/FontFamily.d.ts +20 -20
  37. package/lib/FontSize.d.cts +20 -20
  38. package/lib/FontSize.d.ts +20 -20
  39. package/lib/FormatPainter.d.cts +20 -20
  40. package/lib/FormatPainter.d.ts +20 -20
  41. package/lib/Heading.d.cts +20 -20
  42. package/lib/Heading.d.ts +20 -20
  43. package/lib/Highlight.d.cts +20 -20
  44. package/lib/Highlight.d.ts +20 -20
  45. package/lib/History.d.cts +20 -20
  46. package/lib/History.d.ts +20 -20
  47. package/lib/HorizontalRule.d.cts +20 -20
  48. package/lib/HorizontalRule.d.ts +20 -20
  49. package/lib/Iframe.d.cts +20 -20
  50. package/lib/Iframe.d.ts +20 -20
  51. package/lib/Image.d.cts +20 -20
  52. package/lib/Image.d.ts +20 -20
  53. package/lib/ImageGif.d.cts +20 -20
  54. package/lib/ImageGif.d.ts +20 -20
  55. package/lib/ImportWord.d.cts +20 -20
  56. package/lib/ImportWord.d.ts +20 -20
  57. package/lib/Indent.d.cts +20 -20
  58. package/lib/Indent.d.ts +20 -20
  59. package/lib/Italic.d.cts +20 -20
  60. package/lib/Italic.d.ts +20 -20
  61. package/lib/Katex.d.cts +20 -20
  62. package/lib/Katex.d.ts +20 -20
  63. package/lib/LineHeight.d.cts +20 -20
  64. package/lib/LineHeight.d.ts +20 -20
  65. package/lib/Link.d.cts +20 -20
  66. package/lib/Link.d.ts +20 -20
  67. package/lib/ListItem.d.cts +20 -20
  68. package/lib/ListItem.d.ts +20 -20
  69. package/lib/Mention.d.cts +20 -20
  70. package/lib/Mention.d.ts +20 -20
  71. package/lib/Mermaid.d.cts +20 -20
  72. package/lib/Mermaid.d.ts +20 -20
  73. package/lib/MoreMark.d.cts +20 -20
  74. package/lib/MoreMark.d.ts +20 -20
  75. package/lib/MultiColumn.d.cts +20 -20
  76. package/lib/MultiColumn.d.ts +20 -20
  77. package/lib/OrderedList.d.cts +20 -20
  78. package/lib/OrderedList.d.ts +20 -20
  79. package/lib/SearchAndReplace.d.cts +20 -20
  80. package/lib/SearchAndReplace.d.ts +20 -20
  81. package/lib/Selection.d.cts +20 -20
  82. package/lib/Selection.d.ts +20 -20
  83. package/lib/SlashCommand.d.cts +20 -20
  84. package/lib/SlashCommand.d.ts +20 -20
  85. package/lib/Strike.d.cts +20 -20
  86. package/lib/Strike.d.ts +20 -20
  87. package/lib/SubAndSuperScript.d.cts +20 -20
  88. package/lib/SubAndSuperScript.d.ts +20 -20
  89. package/lib/Table.d.cts +20 -20
  90. package/lib/Table.d.ts +20 -20
  91. package/lib/TableOfContent.d.cts +20 -20
  92. package/lib/TableOfContent.d.ts +20 -20
  93. package/lib/TaskList.d.cts +20 -20
  94. package/lib/TaskList.d.ts +20 -20
  95. package/lib/TextAlign.d.cts +20 -20
  96. package/lib/TextAlign.d.ts +20 -20
  97. package/lib/TextBubble.d.cts +20 -20
  98. package/lib/TextBubble.d.ts +20 -20
  99. package/lib/TextDirection.d.cts +20 -20
  100. package/lib/TextDirection.d.ts +20 -20
  101. package/lib/TextUnderline.d.cts +20 -20
  102. package/lib/TextUnderline.d.ts +20 -20
  103. package/lib/TrailingNode.d.cts +20 -20
  104. package/lib/TrailingNode.d.ts +20 -20
  105. package/lib/Twitter.d.cts +20 -20
  106. package/lib/Twitter.d.ts +20 -20
  107. package/lib/Video.d.cts +20 -20
  108. package/lib/Video.d.ts +20 -20
  109. package/lib/bubble-extra.cjs +1 -1
  110. package/lib/bubble-extra.d.cts +20 -20
  111. package/lib/bubble-extra.d.ts +20 -20
  112. package/lib/bubble-extra.js +1 -1
  113. package/lib/index.d.cts +20 -20
  114. package/lib/index.d.ts +20 -20
  115. package/lib/locale-bundle.d.cts +20 -20
  116. package/lib/locale-bundle.d.ts +20 -20
  117. package/package.json +1 -1
  118. package/lib/Excalidraw-DkpPLrTk.cjs +0 -1
package/lib/Video.d.cts CHANGED
@@ -227,19 +227,19 @@ declare module '@tiptap/core' {
227
227
 
228
228
  declare module '@tiptap/core' {
229
229
  interface Commands<ReturnType> {
230
- imageUpload: {
230
+ imageGifUpload: {
231
231
  /**
232
- * Add an image
232
+ * Add an image gif
233
233
  */
234
- setImageInline: (options: Partial<SetImageAttrsOptions>) => ReturnType;
234
+ setImageGif: (options: Partial<SetImageAttrsOptions>) => ReturnType;
235
235
  /**
236
- * Update an image
236
+ * Update an image gif
237
237
  */
238
- updateImage: (options: Partial<SetImageAttrsOptions>) => ReturnType;
238
+ updateImageGif: (options: Partial<SetImageAttrsOptions>) => ReturnType;
239
239
  /**
240
240
  * Set image alignment
241
241
  */
242
- setAlignImage: (align: 'left' | 'center' | 'right') => ReturnType;
242
+ setAlignImageGif: (align: 'left' | 'center' | 'right') => ReturnType;
243
243
  };
244
244
  }
245
245
  }
@@ -247,15 +247,19 @@ declare module '@tiptap/core' {
247
247
 
248
248
  declare module '@tiptap/core' {
249
249
  interface Commands<ReturnType> {
250
- indent: {
250
+ imageUpload: {
251
251
  /**
252
- * Set the indent attribute
252
+ * Add an image
253
253
  */
254
- indent: () => ReturnType;
254
+ setImageInline: (options: Partial<SetImageAttrsOptions>) => ReturnType;
255
255
  /**
256
- * Set the outdent attribute
256
+ * Update an image
257
257
  */
258
- outdent: () => ReturnType;
258
+ updateImage: (options: Partial<SetImageAttrsOptions>) => ReturnType;
259
+ /**
260
+ * Set image alignment
261
+ */
262
+ setAlignImage: (align: 'left' | 'center' | 'right') => ReturnType;
259
263
  };
260
264
  }
261
265
  }
@@ -263,19 +267,15 @@ declare module '@tiptap/core' {
263
267
 
264
268
  declare module '@tiptap/core' {
265
269
  interface Commands<ReturnType> {
266
- imageGifUpload: {
267
- /**
268
- * Add an image gif
269
- */
270
- setImageGif: (options: Partial<SetImageAttrsOptions>) => ReturnType;
270
+ indent: {
271
271
  /**
272
- * Update an image gif
272
+ * Set the indent attribute
273
273
  */
274
- updateImageGif: (options: Partial<SetImageAttrsOptions>) => ReturnType;
274
+ indent: () => ReturnType;
275
275
  /**
276
- * Set image alignment
276
+ * Set the outdent attribute
277
277
  */
278
- setAlignImageGif: (align: 'left' | 'center' | 'right') => ReturnType;
278
+ outdent: () => ReturnType;
279
279
  };
280
280
  }
281
281
  }
package/lib/Video.d.ts CHANGED
@@ -227,19 +227,19 @@ declare module '@tiptap/core' {
227
227
 
228
228
  declare module '@tiptap/core' {
229
229
  interface Commands<ReturnType> {
230
- imageUpload: {
230
+ imageGifUpload: {
231
231
  /**
232
- * Add an image
232
+ * Add an image gif
233
233
  */
234
- setImageInline: (options: Partial<SetImageAttrsOptions>) => ReturnType;
234
+ setImageGif: (options: Partial<SetImageAttrsOptions>) => ReturnType;
235
235
  /**
236
- * Update an image
236
+ * Update an image gif
237
237
  */
238
- updateImage: (options: Partial<SetImageAttrsOptions>) => ReturnType;
238
+ updateImageGif: (options: Partial<SetImageAttrsOptions>) => ReturnType;
239
239
  /**
240
240
  * Set image alignment
241
241
  */
242
- setAlignImage: (align: 'left' | 'center' | 'right') => ReturnType;
242
+ setAlignImageGif: (align: 'left' | 'center' | 'right') => ReturnType;
243
243
  };
244
244
  }
245
245
  }
@@ -247,15 +247,19 @@ declare module '@tiptap/core' {
247
247
 
248
248
  declare module '@tiptap/core' {
249
249
  interface Commands<ReturnType> {
250
- indent: {
250
+ imageUpload: {
251
251
  /**
252
- * Set the indent attribute
252
+ * Add an image
253
253
  */
254
- indent: () => ReturnType;
254
+ setImageInline: (options: Partial<SetImageAttrsOptions>) => ReturnType;
255
255
  /**
256
- * Set the outdent attribute
256
+ * Update an image
257
257
  */
258
- outdent: () => ReturnType;
258
+ updateImage: (options: Partial<SetImageAttrsOptions>) => ReturnType;
259
+ /**
260
+ * Set image alignment
261
+ */
262
+ setAlignImage: (align: 'left' | 'center' | 'right') => ReturnType;
259
263
  };
260
264
  }
261
265
  }
@@ -263,19 +267,15 @@ declare module '@tiptap/core' {
263
267
 
264
268
  declare module '@tiptap/core' {
265
269
  interface Commands<ReturnType> {
266
- imageGifUpload: {
267
- /**
268
- * Add an image gif
269
- */
270
- setImageGif: (options: Partial<SetImageAttrsOptions>) => ReturnType;
270
+ indent: {
271
271
  /**
272
- * Update an image gif
272
+ * Set the indent attribute
273
273
  */
274
- updateImageGif: (options: Partial<SetImageAttrsOptions>) => ReturnType;
274
+ indent: () => ReturnType;
275
275
  /**
276
- * Set image alignment
276
+ * Set the outdent attribute
277
277
  */
278
- setAlignImageGif: (align: 'left' | 'center' | 'right') => ReturnType;
278
+ outdent: () => ReturnType;
279
279
  };
280
280
  }
281
281
  }
@@ -1,2 +1,2 @@
1
- "use strict";var V=Object.create;var q=Object.defineProperty;var _=Object.getOwnPropertyDescriptor;var G=Object.getOwnPropertyNames;var Z=Object.getPrototypeOf,J=Object.prototype.hasOwnProperty;var Q=(e,n,s,c)=>{if(n&&typeof n=="object"||typeof n=="function")for(let i of G(n))!J.call(e,i)&&i!==s&&q(e,i,{get:()=>n[i],enumerable:!(c=_(n,i))||c.enumerable});return e};var X=(e,n,s)=>(s=e!=null?V(Z(e)):{},Q(n||!e||!e.__esModule?q(s,"default",{value:e,enumerable:!0}):s,e));Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react/jsx-runtime"),a=require("react"),k=require("./dom-dataset-Cuy-pIfj.cjs"),o=require("./RichTextEditor-ymQlnG9m.cjs"),L=require("./Mermaid.cjs"),E=require("./shortId-Bfj8TyNr.cjs"),H=require("./textarea-Ci1tHD6V.cjs"),I=require("./index-Dz3YxLE7.cjs"),M=require("./Excalidraw-DkpPLrTk.cjs"),W=require("./Twitter-CMr6GpHp.cjs"),Y=require("katex"),F=require("lucide-react"),B=require("./Katex.cjs"),O=require("./Drawer-hzhjTRvj.cjs"),R=require("easydrawer"),$=`graph TB
1
+ "use strict";var V=Object.create;var q=Object.defineProperty;var _=Object.getOwnPropertyDescriptor;var G=Object.getOwnPropertyNames;var Z=Object.getPrototypeOf,J=Object.prototype.hasOwnProperty;var Q=(e,n,s,c)=>{if(n&&typeof n=="object"||typeof n=="function")for(let i of G(n))!J.call(e,i)&&i!==s&&q(e,i,{get:()=>n[i],enumerable:!(c=_(n,i))||c.enumerable});return e};var X=(e,n,s)=>(s=e!=null?V(Z(e)):{},Q(n||!e||!e.__esModule?q(s,"default",{value:e,enumerable:!0}):s,e));Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react/jsx-runtime"),a=require("react"),k=require("./dom-dataset-Cuy-pIfj.cjs"),o=require("./RichTextEditor-ymQlnG9m.cjs"),L=require("./Mermaid.cjs"),E=require("./shortId-Bfj8TyNr.cjs"),H=require("./textarea-Ci1tHD6V.cjs"),I=require("./index-Dz3YxLE7.cjs"),M=require("./Excalidraw-Bj3dtbC4.cjs"),W=require("./Twitter-CMr6GpHp.cjs"),Y=require("katex"),F=require("lucide-react"),B=require("./Katex.cjs"),O=require("./Drawer-hzhjTRvj.cjs"),R=require("easydrawer"),$=`graph TB
2
2
  a-->b`,ee=({editor:e,attrs:n,extension:s})=>{const{alt:c,align:i}=n,[r,l]=a.useState(decodeURIComponent(c??$)),[u,x]=a.useState(""),[f,b]=a.useState(!1),p=a.useRef(null),[g,y]=a.useState(null),S=s==null?void 0:s.options.upload,D=a.useCallback(w=>{w&&import("mermaid").then(j=>{y(j.default)})},[]),T=async w=>{try{const{svg:j}=await g.render("mermaid-svg",w);x(j)}catch{x("")}},N=()=>{g.initialize({darkMode:!1,startOnLoad:!1,fontSize:12,theme:"base"}),T(r)};a.useEffect(()=>{g&&f&&N()},[g,f]),a.useEffect(()=>{g&&f&&T(r)},[g,r]);const A=async()=>{if(r!==""){if(r){const w=p.current.querySelector("svg"),{width:j,height:z}=w.getBoundingClientRect(),m=`mermaid-${E.shortId()}.svg`;let d=E.i(w.outerHTML);if(S){const h=o.dataURLtoFile(d,m);d=await S(h)}e==null||e.chain().focus().setMermaid({type:"mermaid",src:d,alt:encodeURIComponent(r),width:j,height:z},!!r).run(),e==null||e.commands.setAlignImageMermaid(i)}b(!1)}};return t.jsxs(o.Dialog,{onOpenChange:b,open:f,children:[t.jsx(o.DialogTrigger,{asChild:!0,children:t.jsx(o.ActionButton,{action:()=>b(!0),icon:"Pencil",tooltip:"Edit Mermaid"})}),t.jsxs(o.DialogContent,{className:"richtext-z-[99999] !richtext-max-w-[1300px]",children:[t.jsx(o.DialogTitle,{children:"Edit Mermaid"}),t.jsx("div",{ref:D,style:{height:"100%",border:"1px solid hsl(var(--border))"},children:t.jsxs("div",{className:"richtext-flex richtext-gap-[10px] richtext-rounded-[10px] richtext-p-[10px]",children:[t.jsx(H.Textarea,{autoFocus:!0,className:"richtext-flex-1",defaultValue:$,onChange:w=>l(w.target.value),placeholder:"Text",required:!0,rows:10,value:r,style:{color:"hsl(var(--richtext-foreground))"}}),t.jsx("div",{className:"richtext-flex richtext-flex-1 richtext-items-center richtext-justify-center richtext-rounded-[10px] richtext-p-[10px]",dangerouslySetInnerHTML:{__html:u},ref:p,style:{height:"100%",border:"1px solid hsl(var(--border))",minHeight:500,background:"#fff"}})]})}),t.jsx(o.DialogFooter,{children:t.jsx(o.Button,{onClick:A,type:"button",children:"Save changes"})})]})]})};function K(e,n){const[s,c]=a.useState(void 0);return a.useEffect(()=>{const i=()=>{const r=e.extensionManager.extensions.find(l=>l.name===n);r&&c(r)};return e.on("selectionUpdate",i),e.on("transaction",i),()=>{e.off("selectionUpdate",i),e.off("transaction",i)}},[e,n]),s}const te={maxWidth:"auto",zIndex:20,appendTo:"parent",moveTransition:"transform 0.1s ease-out"};function re({item:e,disabled:n,editor:s}){var i;const c=e.component;return c?t.jsx(a.Fragment,{children:e.type==="divider"?t.jsx(o.Separator,{className:"!richtext-mx-1 !richtext-my-2 !richtext-h-[16px]",orientation:"vertical"}):t.jsx(c,{...e.componentProps,disabled:n||((i=e==null?void 0:e.componentProps)==null?void 0:i.disabled),editor:s})}):t.jsx(t.Fragment,{})}function ne(e){return e.type.name==="mermaid"}function ie(e){const{lang:n}=I.useLocale(),s=o.useAttributes(e.editor,L.Mermaid.name),c=K(e.editor,L.Mermaid.name),i=({editor:l})=>{const{selection:u}=l.view.state,{$from:x,to:f}=u;let b=!1;return l.view.state.doc.nodesBetween(x.pos,f,p=>{if(ne(p))return b=!0,!1}),b},r=a.useMemo(()=>e.disabled?[]:o.getBubbleMermaid(e.editor),[e.disabled,e.editor,n]);return t.jsx(t.Fragment,{children:t.jsx(k.BubbleMenu,{editor:e==null?void 0:e.editor,shouldShow:i,tippyOptions:te,children:r!=null&&r.length?t.jsx("div",{className:"richtext-pointer-events-auto richtext-w-auto richtext-select-none richtext-rounded-sm !richtext-border richtext-border-neutral-200 richtext-bg-background richtext-px-3 richtext-py-2 richtext-shadow-sm richtext-transition-all dark:richtext-border-neutral-800",children:t.jsx("div",{className:"richtext-relative richtext-flex richtext-h-[26px] richtext-flex-nowrap richtext-items-center richtext-justify-start richtext-whitespace-nowrap",children:r==null?void 0:r.map((l,u)=>l.type==="edit"&&(s!=null&&s.src)?t.jsx(ee,{attrs:s,editor:e.editor,extension:c},`bubbleMenu-mermaid-${u}`):t.jsx(re,{disabled:e.disabled,editor:e.editor,item:l},`bubbleMenu-mermaid-${u}`))})}):t.jsx(t.Fragment,{})})})}const v=new Map;function se(e){const n=e.options.element;v.has("width")||v.set("width",n.clientWidth),v.has("width")&&v.get("width")<=0&&v.set("width",n.clientWidth);const s={attributes:!0,childList:!0,subtree:!0},c=function(){v.set("width",n.clientWidth)},i=new MutationObserver(c);return i.observe(n,s),e.on("destroy",()=>{i.disconnect()}),{width:v.get("width")}}function oe({editor:e}){const{t:n}=I.useLocale(),{width:s}=se(e),c=o.useAttributes(e,M.Excalidraw.name,{defaultShowPicker:!1,createUser:"",width:0,height:0}),{defaultShowPicker:i,createUser:r,width:l,height:u}=c,x=a.useCallback(g=>{e.chain().updateAttributes(M.Excalidraw.name,g).setNodeSelection(e.state.selection.from).focus().run()},[e]),f=a.useCallback(()=>{M.triggerOpenExcalidrawSettingModal({...c,editor:e})},[e,c]),b=a.useCallback(()=>e.isActive(M.Excalidraw.name),[e]),p=a.useCallback(()=>o.deleteNode(M.Excalidraw.name,e),[e]);return a.useEffect(()=>{i&&(f(),e.chain().updateAttributes(M.Excalidraw.name,{defaultShowPicker:!1}).focus().run())},[r,i,e,f]),t.jsx(k.BubbleMenu,{className:"bubble-menu",editor:e,pluginKey:"excalidraw-bubble-menu",shouldShow:b,tippyOptions:{popperOptions:{modifiers:[{name:"flip",enabled:!1}]},placement:"bottom-start",offset:[-2,16],zIndex:9999},children:t.jsxs("div",{className:"richtext-w-auto richtext-px-3 richtext-py-2 richtext-transition-all !richtext-border richtext-rounded-sm richtext-shadow-sm richtext-pointer-events-auto richtext-select-none richtext-border-neutral-200 dark:richtext-border-neutral-800 richtext-bg-background",children:[t.jsx(o.ActionButton,{icon:"Pencil",action:f,tooltip:n("editor.edit")}),t.jsx(o.SizeSetter,{width:l,maxWidth:s,height:u,onOk:x,children:t.jsx(o.ActionButton,{icon:"Settings",tooltip:n("editor.settings")})}),t.jsx(o.ActionButton,{icon:"Trash2",action:p,tooltip:n("editor.delete")})]})})}function ae({editor:e,disabled:n}){const[s,c]=a.useState(!1),{t:i}=I.useLocale(),r=a.useCallback(({editor:x})=>x.isActive(W.Twitter.name),[]),l=x=>{e.commands.updateTweet({src:x}),c(!1)},u=a.useCallback(()=>o.deleteNode(W.Twitter.name,e),[e]);return t.jsx(t.Fragment,{children:t.jsx(k.BubbleMenu,{editor:e,shouldShow:r,tippyOptions:{popperOptions:{modifiers:[{name:"flip",enabled:!1}]},placement:"bottom-start",offset:[-2,16],zIndex:9999,onHidden:()=>{c(!1)}},children:n?t.jsx(t.Fragment,{}):t.jsx(t.Fragment,{children:s?t.jsx(W.FormEditLinkTwitter,{editor:e,onSetLink:l}):t.jsx("div",{className:"richtext-flex richtext-items-center richtext-gap-2 richtext-rounded-lg !richtext-border richtext-border-neutral-200 richtext-bg-white richtext-p-2 richtext-shadow-sm dark:richtext-border-neutral-800 dark:richtext-bg-black",children:t.jsxs("div",{className:"richtext-flex richtext-flex-nowrap",children:[t.jsx(o.ActionButton,{icon:"Pencil",tooltip:i("editor.link.edit.tooltip"),tooltipOptions:{sideOffset:15},action:()=>{c(!0)}}),t.jsx(o.ActionButton,{action:u,icon:"Trash",tooltip:i("editor.delete"),tooltipOptions:{sideOffset:15}})]})})})})})}function ce({editor:e,...n}){const s=o.useAttributes(e,B.Katex.name,{text:"",defaultShowPicker:!1}),{text:c,defaultShowPicker:i}=s,[r,l]=a.useState(""),[u,x]=a.useState(!1),f=a.useCallback(()=>e.isActive(B.Katex.name),[e]),b=a.useCallback(()=>o.deleteNode(B.Katex.name,e),[e]),p=a.useCallback(()=>{e.chain().focus().setKatex({text:r}).run(),x(!1)},[e,r]);a.useEffect(()=>{i&&(x(!0),e.chain().updateAttributes(B.Katex.name,{defaultShowPicker:!1}).focus().run())},[e,i,x]),a.useEffect(()=>{u&&l(c||"")},[u]);const g=a.useMemo(()=>{try{return Y.renderToString(`${r}`)}catch{return r}},[r]),y=a.useMemo(()=>`${r}`.trim()?t.jsx("span",{contentEditable:!1,dangerouslySetInnerHTML:{__html:g||""}}):null,[r,g]);return t.jsx(k.BubbleMenu,{editor:e,pluginKey:"Katex-bubble-menu",shouldShow:f,tippyOptions:{popperOptions:{modifiers:[{name:"flip",enabled:!1}]},placement:"bottom-start",offset:[-2,16],zIndex:9999,onHidden:()=>{x(!1)}},children:n!=null&&n.disabled?t.jsx(t.Fragment,{}):t.jsx("div",{className:"richtext-rounded-lg !richtext-border richtext-border-neutral-200 richtext-bg-white richtext-p-2 richtext-shadow-sm dark:richtext-border-neutral-800 dark:richtext-bg-black",children:u?t.jsxs(t.Fragment,{children:[t.jsx(H.Textarea,{autoFocus:!0,defaultValue:c,onChange:S=>l(S.target.value),placeholder:"Formula text",rows:3,style:{marginBottom:8},value:r}),y&&t.jsx("div",{className:"richtext-my-[10px] richtext-overflow-auto richtext-whitespace-nowrap richtext-rounded-[6px] !richtext-border richtext-p-[10px]",children:y}),t.jsxs("div",{className:"richtext-flex richtext-items-center richtext-justify-between richtext-gap-[6px]",children:[t.jsx(o.Button,{className:"richtext-flex-1",onClick:p,children:"Submit"}),t.jsx("a",{href:"https://katex.org/docs/supported",rel:"noreferrer noopener",target:"_blank",children:t.jsx(F.HelpCircle,{size:16})})]})]}):t.jsxs("div",{className:"richtext-flex richtext-items-center richtext-justify-center richtext-gap-[6px]",children:[t.jsx(o.ActionButton,{action:()=>x(!u),tooltip:"Edit",children:t.jsx(F.Pencil,{size:16})}),t.jsx(o.ActionButton,{action:b,tooltip:"Delete",children:t.jsx(F.Trash2,{size:16})})]})})})}let C=!1;function le({editor:e,attrs:n,extension:s}){const[c,i]=a.useState(!1),r=a.useRef(null),l=a.useRef(null),{alt:u,align:x}=n,f=s==null?void 0:s.options.upload,b=()=>{(async()=>{const d=document.querySelector("#easydrawer");d&&(r.current=new R.Editor(d,{wheelEventsEnabled:!1,disableZoom:!0}),l.current=R.makeDropdownToolbar(r.current),l.current.addDefaultToolWidgets(),r.current.loadFromSVG(decodeURIComponent(u)))})()};a.useEffect(()=>{c&&setTimeout(()=>{b()},200)},[c]);const p=async()=>{if(r.current){const m=r.current.toSVG(),d=m.outerHTML,h=`drawer-${E.shortId()}.svg`;let P=E.i(m.outerHTML);if(f){const U=o.dataURLtoFile(P,h);P=await f(U)}e==null||e.chain().focus().setDrawer({type:"drawer",src:P,alt:encodeURIComponent(d),width:426,height:212},!!d).run(),e==null||e.commands.setAlignImageDrawer(x)}i(!1)},g=m=>{const d=r.current.toolController.getPrimaryTools()[2],h=l.current.getWidgetById("pen-1");d&&h&&(d.setColor(m),h.serializeState())},y=m=>{const d=r.current.toolController.getPrimaryTools()[2],h=l.current.getWidgetById("pen-1");d&&h&&(d.setThickness(m),h.serializeState())},S=m=>{const d=r.current.toolController.getPrimaryTools()[3],h=l.current.getWidgetById("pen-2");d&&h&&(d.setColor(m),h.serializeState())},D=m=>{const d=l.current.getWidgetById("shape");d&&d.setShapeType(m)},T=m=>{const d=r.current.toolController.getPrimaryTools()[5],h=l.current.getWidgetById("shape");d&&h&&(d.setColor(m),h.serializeState())},N=m=>{const d=r.current.toolController.getPrimaryTools()[5],h=l.current.getWidgetById("shape");d&&h&&(d.setThickness(m),h.serializeState())},A=m=>{const d=r.current.toolController.getPrimaryTools()[5],h=l.current.getWidgetById("shape");d&&h&&(d.setBorderColor(m),h.serializeState())},w=()=>{if(C){for(;r.current.history.redoStackSize>0;)r.current.history.redo();C=!1;return}r.current.history.undo()},j=()=>{C||r.current.history.redo()},z=()=>{if(!C){for(;r.current.history.undoStackSize>0;)w();C=!0}};return t.jsxs(o.Dialog,{onOpenChange:i,open:c,children:[t.jsx(o.DialogTrigger,{asChild:!0,children:t.jsx(o.ActionButton,{action:()=>i(!0),icon:"Pencil",tooltip:"Edit Drawer"})}),t.jsxs(o.DialogContent,{className:"richtext-z-[99999] !richtext-max-w-[1300px]",children:[t.jsx(o.DialogTitle,{children:"Edit Drawer"}),t.jsxs("div",{style:{height:"100%",borderWidth:1,background:"white",position:"relative"},children:[t.jsx("div",{className:"richtext-size-full",id:"easydrawer"}),t.jsx(O.ControlDrawer,{changeBorderColorShape:A,changeColorShape:T,changeShape:D,onClear:z,onRedo:j,onThicknessChange:N,onUndo:w,refEditor:r,setColorHighlight:S,setColorPen:g,setThicknessPen:y})]}),t.jsx(o.DialogFooter,{children:t.jsx(o.Button,{onClick:p,type:"button",children:"Save changes"})})]})]})}const de={maxWidth:"auto",zIndex:20,appendTo:"parent",moveTransition:"transform 0.1s ease-out"};function ue({item:e,disabled:n,editor:s}){var i;const c=e.component;return c?t.jsx(a.Fragment,{children:e.type==="divider"?t.jsx(o.Separator,{className:"!richtext-mx-1 !richtext-my-2 !richtext-h-[16px]",orientation:"vertical"}):t.jsx(c,{...e.componentProps,disabled:n||((i=e==null?void 0:e.componentProps)==null?void 0:i.disabled),editor:s})}):t.jsx(t.Fragment,{})}function he(e){return e.type.name==="drawer"}function xe(e){const{lang:n}=I.useLocale(),s=o.useAttributes(e.editor,O.Drawer.name),c=K(e.editor,O.Drawer.name),i=({editor:l})=>{const{selection:u}=l.view.state,{$from:x,to:f}=u;let b=!1;return l.view.state.doc.nodesBetween(x.pos,f,p=>{if(he(p))return b=!0,!1}),b},r=a.useMemo(()=>e.disabled?[]:o.getBubbleDrawer(e.editor),[e.disabled,e.editor,n]);return t.jsx(t.Fragment,{children:t.jsx(k.BubbleMenu,{editor:e==null?void 0:e.editor,shouldShow:i,tippyOptions:de,children:r!=null&&r.length?t.jsx("div",{className:"richtext-pointer-events-auto richtext-w-auto richtext-select-none richtext-rounded-sm !richtext-border richtext-border-neutral-200 richtext-bg-background richtext-px-3 richtext-py-2 richtext-shadow-sm richtext-transition-all dark:richtext-border-neutral-800",children:t.jsx("div",{className:"richtext-relative richtext-flex richtext-h-[26px] richtext-flex-nowrap richtext-items-center richtext-justify-start richtext-whitespace-nowrap",children:r==null?void 0:r.map((l,u)=>l.type==="edit"&&(s!=null&&s.src)?t.jsx(le,{attrs:s,editor:e.editor,extension:c},`bubbleMenu-drawer-${u}`):t.jsx(ue,{disabled:e.disabled,editor:e.editor,item:l},`bubbleMenu-drawer-${u}`))})}):t.jsx(t.Fragment,{})})})}exports.BubbleMenuDrawer=xe;exports.BubbleMenuExcalidraw=oe;exports.BubbleMenuKatex=ce;exports.BubbleMenuMermaid=ie;exports.BubbleMenuTwitter=ae;
@@ -143,19 +143,19 @@ declare module '@tiptap/core' {
143
143
 
144
144
  declare module '@tiptap/core' {
145
145
  interface Commands<ReturnType> {
146
- imageUpload: {
146
+ imageGifUpload: {
147
147
  /**
148
- * Add an image
148
+ * Add an image gif
149
149
  */
150
- setImageInline: (options: Partial<SetImageAttrsOptions>) => ReturnType;
150
+ setImageGif: (options: Partial<SetImageAttrsOptions>) => ReturnType;
151
151
  /**
152
- * Update an image
152
+ * Update an image gif
153
153
  */
154
- updateImage: (options: Partial<SetImageAttrsOptions>) => ReturnType;
154
+ updateImageGif: (options: Partial<SetImageAttrsOptions>) => ReturnType;
155
155
  /**
156
156
  * Set image alignment
157
157
  */
158
- setAlignImage: (align: 'left' | 'center' | 'right') => ReturnType;
158
+ setAlignImageGif: (align: 'left' | 'center' | 'right') => ReturnType;
159
159
  };
160
160
  }
161
161
  }
@@ -163,15 +163,19 @@ declare module '@tiptap/core' {
163
163
 
164
164
  declare module '@tiptap/core' {
165
165
  interface Commands<ReturnType> {
166
- indent: {
166
+ imageUpload: {
167
167
  /**
168
- * Set the indent attribute
168
+ * Add an image
169
169
  */
170
- indent: () => ReturnType;
170
+ setImageInline: (options: Partial<SetImageAttrsOptions>) => ReturnType;
171
171
  /**
172
- * Set the outdent attribute
172
+ * Update an image
173
173
  */
174
- outdent: () => ReturnType;
174
+ updateImage: (options: Partial<SetImageAttrsOptions>) => ReturnType;
175
+ /**
176
+ * Set image alignment
177
+ */
178
+ setAlignImage: (align: 'left' | 'center' | 'right') => ReturnType;
175
179
  };
176
180
  }
177
181
  }
@@ -179,19 +183,15 @@ declare module '@tiptap/core' {
179
183
 
180
184
  declare module '@tiptap/core' {
181
185
  interface Commands<ReturnType> {
182
- imageGifUpload: {
183
- /**
184
- * Add an image gif
185
- */
186
- setImageGif: (options: Partial<SetImageAttrsOptions>) => ReturnType;
186
+ indent: {
187
187
  /**
188
- * Update an image gif
188
+ * Set the indent attribute
189
189
  */
190
- updateImageGif: (options: Partial<SetImageAttrsOptions>) => ReturnType;
190
+ indent: () => ReturnType;
191
191
  /**
192
- * Set image alignment
192
+ * Set the outdent attribute
193
193
  */
194
- setAlignImageGif: (align: 'left' | 'center' | 'right') => ReturnType;
194
+ outdent: () => ReturnType;
195
195
  };
196
196
  }
197
197
  }
@@ -143,19 +143,19 @@ declare module '@tiptap/core' {
143
143
 
144
144
  declare module '@tiptap/core' {
145
145
  interface Commands<ReturnType> {
146
- imageUpload: {
146
+ imageGifUpload: {
147
147
  /**
148
- * Add an image
148
+ * Add an image gif
149
149
  */
150
- setImageInline: (options: Partial<SetImageAttrsOptions>) => ReturnType;
150
+ setImageGif: (options: Partial<SetImageAttrsOptions>) => ReturnType;
151
151
  /**
152
- * Update an image
152
+ * Update an image gif
153
153
  */
154
- updateImage: (options: Partial<SetImageAttrsOptions>) => ReturnType;
154
+ updateImageGif: (options: Partial<SetImageAttrsOptions>) => ReturnType;
155
155
  /**
156
156
  * Set image alignment
157
157
  */
158
- setAlignImage: (align: 'left' | 'center' | 'right') => ReturnType;
158
+ setAlignImageGif: (align: 'left' | 'center' | 'right') => ReturnType;
159
159
  };
160
160
  }
161
161
  }
@@ -163,15 +163,19 @@ declare module '@tiptap/core' {
163
163
 
164
164
  declare module '@tiptap/core' {
165
165
  interface Commands<ReturnType> {
166
- indent: {
166
+ imageUpload: {
167
167
  /**
168
- * Set the indent attribute
168
+ * Add an image
169
169
  */
170
- indent: () => ReturnType;
170
+ setImageInline: (options: Partial<SetImageAttrsOptions>) => ReturnType;
171
171
  /**
172
- * Set the outdent attribute
172
+ * Update an image
173
173
  */
174
- outdent: () => ReturnType;
174
+ updateImage: (options: Partial<SetImageAttrsOptions>) => ReturnType;
175
+ /**
176
+ * Set image alignment
177
+ */
178
+ setAlignImage: (align: 'left' | 'center' | 'right') => ReturnType;
175
179
  };
176
180
  }
177
181
  }
@@ -179,19 +183,15 @@ declare module '@tiptap/core' {
179
183
 
180
184
  declare module '@tiptap/core' {
181
185
  interface Commands<ReturnType> {
182
- imageGifUpload: {
183
- /**
184
- * Add an image gif
185
- */
186
- setImageGif: (options: Partial<SetImageAttrsOptions>) => ReturnType;
186
+ indent: {
187
187
  /**
188
- * Update an image gif
188
+ * Set the indent attribute
189
189
  */
190
- updateImageGif: (options: Partial<SetImageAttrsOptions>) => ReturnType;
190
+ indent: () => ReturnType;
191
191
  /**
192
- * Set image alignment
192
+ * Set the outdent attribute
193
193
  */
194
- setAlignImageGif: (align: 'left' | 'center' | 'right') => ReturnType;
194
+ outdent: () => ReturnType;
195
195
  };
196
196
  }
197
197
  }
@@ -6,7 +6,7 @@ import { Mermaid as j } from "./Mermaid.js";
6
6
  import { s as re, i as ne } from "./shortId-WJVkrvml.js";
7
7
  import { T as ie } from "./textarea-CtL8w6IS.js";
8
8
  import { u as O } from "./index-D-DR0FPY.js";
9
- import { E as I, t as de } from "./Excalidraw-C3YArGc8.js";
9
+ import { E as I, t as de } from "./Excalidraw-DuV1h_du.js";
10
10
  import { T as K, F as he } from "./Twitter-CjAodXzu.js";
11
11
  import ue from "katex";
12
12
  import { HelpCircle as me, Pencil as xe, Trash2 as fe } from "lucide-react";
package/lib/index.d.cts CHANGED
@@ -552,19 +552,19 @@ declare module '@tiptap/core' {
552
552
 
553
553
  declare module '@tiptap/core' {
554
554
  interface Commands<ReturnType> {
555
- imageUpload: {
555
+ imageGifUpload: {
556
556
  /**
557
- * Add an image
557
+ * Add an image gif
558
558
  */
559
- setImageInline: (options: Partial<SetImageAttrsOptions>) => ReturnType;
559
+ setImageGif: (options: Partial<SetImageAttrsOptions>) => ReturnType;
560
560
  /**
561
- * Update an image
561
+ * Update an image gif
562
562
  */
563
- updateImage: (options: Partial<SetImageAttrsOptions>) => ReturnType;
563
+ updateImageGif: (options: Partial<SetImageAttrsOptions>) => ReturnType;
564
564
  /**
565
565
  * Set image alignment
566
566
  */
567
- setAlignImage: (align: 'left' | 'center' | 'right') => ReturnType;
567
+ setAlignImageGif: (align: 'left' | 'center' | 'right') => ReturnType;
568
568
  };
569
569
  }
570
570
  }
@@ -572,15 +572,19 @@ declare module '@tiptap/core' {
572
572
 
573
573
  declare module '@tiptap/core' {
574
574
  interface Commands<ReturnType> {
575
- indent: {
575
+ imageUpload: {
576
576
  /**
577
- * Set the indent attribute
577
+ * Add an image
578
578
  */
579
- indent: () => ReturnType;
579
+ setImageInline: (options: Partial<SetImageAttrsOptions>) => ReturnType;
580
580
  /**
581
- * Set the outdent attribute
581
+ * Update an image
582
582
  */
583
- outdent: () => ReturnType;
583
+ updateImage: (options: Partial<SetImageAttrsOptions>) => ReturnType;
584
+ /**
585
+ * Set image alignment
586
+ */
587
+ setAlignImage: (align: 'left' | 'center' | 'right') => ReturnType;
584
588
  };
585
589
  }
586
590
  }
@@ -588,19 +592,15 @@ declare module '@tiptap/core' {
588
592
 
589
593
  declare module '@tiptap/core' {
590
594
  interface Commands<ReturnType> {
591
- imageGifUpload: {
592
- /**
593
- * Add an image gif
594
- */
595
- setImageGif: (options: Partial<SetImageAttrsOptions>) => ReturnType;
595
+ indent: {
596
596
  /**
597
- * Update an image gif
597
+ * Set the indent attribute
598
598
  */
599
- updateImageGif: (options: Partial<SetImageAttrsOptions>) => ReturnType;
599
+ indent: () => ReturnType;
600
600
  /**
601
- * Set image alignment
601
+ * Set the outdent attribute
602
602
  */
603
- setAlignImageGif: (align: 'left' | 'center' | 'right') => ReturnType;
603
+ outdent: () => ReturnType;
604
604
  };
605
605
  }
606
606
  }
package/lib/index.d.ts CHANGED
@@ -552,19 +552,19 @@ declare module '@tiptap/core' {
552
552
 
553
553
  declare module '@tiptap/core' {
554
554
  interface Commands<ReturnType> {
555
- imageUpload: {
555
+ imageGifUpload: {
556
556
  /**
557
- * Add an image
557
+ * Add an image gif
558
558
  */
559
- setImageInline: (options: Partial<SetImageAttrsOptions>) => ReturnType;
559
+ setImageGif: (options: Partial<SetImageAttrsOptions>) => ReturnType;
560
560
  /**
561
- * Update an image
561
+ * Update an image gif
562
562
  */
563
- updateImage: (options: Partial<SetImageAttrsOptions>) => ReturnType;
563
+ updateImageGif: (options: Partial<SetImageAttrsOptions>) => ReturnType;
564
564
  /**
565
565
  * Set image alignment
566
566
  */
567
- setAlignImage: (align: 'left' | 'center' | 'right') => ReturnType;
567
+ setAlignImageGif: (align: 'left' | 'center' | 'right') => ReturnType;
568
568
  };
569
569
  }
570
570
  }
@@ -572,15 +572,19 @@ declare module '@tiptap/core' {
572
572
 
573
573
  declare module '@tiptap/core' {
574
574
  interface Commands<ReturnType> {
575
- indent: {
575
+ imageUpload: {
576
576
  /**
577
- * Set the indent attribute
577
+ * Add an image
578
578
  */
579
- indent: () => ReturnType;
579
+ setImageInline: (options: Partial<SetImageAttrsOptions>) => ReturnType;
580
580
  /**
581
- * Set the outdent attribute
581
+ * Update an image
582
582
  */
583
- outdent: () => ReturnType;
583
+ updateImage: (options: Partial<SetImageAttrsOptions>) => ReturnType;
584
+ /**
585
+ * Set image alignment
586
+ */
587
+ setAlignImage: (align: 'left' | 'center' | 'right') => ReturnType;
584
588
  };
585
589
  }
586
590
  }
@@ -588,19 +592,15 @@ declare module '@tiptap/core' {
588
592
 
589
593
  declare module '@tiptap/core' {
590
594
  interface Commands<ReturnType> {
591
- imageGifUpload: {
592
- /**
593
- * Add an image gif
594
- */
595
- setImageGif: (options: Partial<SetImageAttrsOptions>) => ReturnType;
595
+ indent: {
596
596
  /**
597
- * Update an image gif
597
+ * Set the indent attribute
598
598
  */
599
- updateImageGif: (options: Partial<SetImageAttrsOptions>) => ReturnType;
599
+ indent: () => ReturnType;
600
600
  /**
601
- * Set image alignment
601
+ * Set the outdent attribute
602
602
  */
603
- setAlignImageGif: (align: 'left' | 'center' | 'right') => ReturnType;
603
+ outdent: () => ReturnType;
604
604
  };
605
605
  }
606
606
  }
@@ -1003,19 +1003,19 @@ declare module '@tiptap/core' {
1003
1003
 
1004
1004
  declare module '@tiptap/core' {
1005
1005
  interface Commands<ReturnType> {
1006
- imageUpload: {
1006
+ imageGifUpload: {
1007
1007
  /**
1008
- * Add an image
1008
+ * Add an image gif
1009
1009
  */
1010
- setImageInline: (options: Partial<SetImageAttrsOptions>) => ReturnType;
1010
+ setImageGif: (options: Partial<SetImageAttrsOptions>) => ReturnType;
1011
1011
  /**
1012
- * Update an image
1012
+ * Update an image gif
1013
1013
  */
1014
- updateImage: (options: Partial<SetImageAttrsOptions>) => ReturnType;
1014
+ updateImageGif: (options: Partial<SetImageAttrsOptions>) => ReturnType;
1015
1015
  /**
1016
1016
  * Set image alignment
1017
1017
  */
1018
- setAlignImage: (align: 'left' | 'center' | 'right') => ReturnType;
1018
+ setAlignImageGif: (align: 'left' | 'center' | 'right') => ReturnType;
1019
1019
  };
1020
1020
  }
1021
1021
  }
@@ -1023,15 +1023,19 @@ declare module '@tiptap/core' {
1023
1023
 
1024
1024
  declare module '@tiptap/core' {
1025
1025
  interface Commands<ReturnType> {
1026
- indent: {
1026
+ imageUpload: {
1027
1027
  /**
1028
- * Set the indent attribute
1028
+ * Add an image
1029
1029
  */
1030
- indent: () => ReturnType;
1030
+ setImageInline: (options: Partial<SetImageAttrsOptions>) => ReturnType;
1031
1031
  /**
1032
- * Set the outdent attribute
1032
+ * Update an image
1033
1033
  */
1034
- outdent: () => ReturnType;
1034
+ updateImage: (options: Partial<SetImageAttrsOptions>) => ReturnType;
1035
+ /**
1036
+ * Set image alignment
1037
+ */
1038
+ setAlignImage: (align: 'left' | 'center' | 'right') => ReturnType;
1035
1039
  };
1036
1040
  }
1037
1041
  }
@@ -1039,19 +1043,15 @@ declare module '@tiptap/core' {
1039
1043
 
1040
1044
  declare module '@tiptap/core' {
1041
1045
  interface Commands<ReturnType> {
1042
- imageGifUpload: {
1043
- /**
1044
- * Add an image gif
1045
- */
1046
- setImageGif: (options: Partial<SetImageAttrsOptions>) => ReturnType;
1046
+ indent: {
1047
1047
  /**
1048
- * Update an image gif
1048
+ * Set the indent attribute
1049
1049
  */
1050
- updateImageGif: (options: Partial<SetImageAttrsOptions>) => ReturnType;
1050
+ indent: () => ReturnType;
1051
1051
  /**
1052
- * Set image alignment
1052
+ * Set the outdent attribute
1053
1053
  */
1054
- setAlignImageGif: (align: 'left' | 'center' | 'right') => ReturnType;
1054
+ outdent: () => ReturnType;
1055
1055
  };
1056
1056
  }
1057
1057
  }