reactjs-tiptap-editor 0.3.30 → 0.3.31

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 (224) hide show
  1. package/lib/{ActionMenuButton-wiDnIxE2.cjs → ActionMenuButton-BCgqJsST.cjs} +1 -1
  2. package/lib/{ActionMenuButton-B6fitGKu.js → ActionMenuButton-D97K0UWT.js} +5 -5
  3. package/lib/Attachment.cjs +1 -1
  4. package/lib/Attachment.d.cts +15 -15
  5. package/lib/Attachment.d.ts +15 -15
  6. package/lib/Attachment.js +1 -1
  7. package/lib/Blockquote.cjs +1 -1
  8. package/lib/Blockquote.d.cts +15 -15
  9. package/lib/Blockquote.d.ts +15 -15
  10. package/lib/Blockquote.js +1 -1
  11. package/lib/Bold.cjs +1 -1
  12. package/lib/Bold.d.cts +15 -15
  13. package/lib/Bold.d.ts +15 -15
  14. package/lib/Bold.js +1 -1
  15. package/lib/BulletList.cjs +1 -1
  16. package/lib/BulletList.d.cts +15 -15
  17. package/lib/BulletList.d.ts +15 -15
  18. package/lib/BulletList.js +1 -1
  19. package/lib/Clear.cjs +1 -1
  20. package/lib/Clear.d.cts +15 -15
  21. package/lib/Clear.d.ts +15 -15
  22. package/lib/Clear.js +1 -1
  23. package/lib/Code.cjs +1 -1
  24. package/lib/Code.d.cts +15 -15
  25. package/lib/Code.d.ts +15 -15
  26. package/lib/Code.js +1 -1
  27. package/lib/CodeBlock.cjs +1 -1
  28. package/lib/CodeBlock.d.cts +15 -15
  29. package/lib/CodeBlock.d.ts +15 -15
  30. package/lib/CodeBlock.js +3 -2
  31. package/lib/CodeView.cjs +1 -1
  32. package/lib/CodeView.d.cts +15 -15
  33. package/lib/CodeView.d.ts +15 -15
  34. package/lib/CodeView.js +1 -1
  35. package/lib/Color.cjs +1 -1
  36. package/lib/Color.d.cts +15 -15
  37. package/lib/Color.d.ts +15 -15
  38. package/lib/Color.js +2 -2
  39. package/lib/Document.d.cts +15 -15
  40. package/lib/Document.d.ts +15 -15
  41. package/lib/Drawer-5Q_-WRhc.cjs +1 -0
  42. package/lib/{Drawer-BKTU9CpU.js → Drawer-BHkje8ys.js} +250 -249
  43. package/lib/Drawer.cjs +1 -1
  44. package/lib/Drawer.d.cts +15 -15
  45. package/lib/Drawer.d.ts +15 -15
  46. package/lib/Drawer.js +2 -2
  47. package/lib/Emoji.cjs +1 -1
  48. package/lib/Emoji.d.cts +15 -15
  49. package/lib/Emoji.d.ts +15 -15
  50. package/lib/Emoji.js +22 -21
  51. package/lib/Excalidraw-CG498239.js +290 -0
  52. package/lib/Excalidraw-GUVW-IqC.cjs +1 -0
  53. package/lib/Excalidraw.cjs +1 -1
  54. package/lib/Excalidraw.d.cts +15 -15
  55. package/lib/Excalidraw.d.ts +15 -15
  56. package/lib/Excalidraw.js +1 -1
  57. package/lib/ExportPdf.cjs +1 -1
  58. package/lib/ExportPdf.d.cts +15 -15
  59. package/lib/ExportPdf.d.ts +15 -15
  60. package/lib/ExportPdf.js +1 -1
  61. package/lib/ExportWord.cjs +1 -1
  62. package/lib/ExportWord.d.cts +15 -15
  63. package/lib/ExportWord.d.ts +15 -15
  64. package/lib/ExportWord.js +1 -1
  65. package/lib/FontFamily.cjs +1 -1
  66. package/lib/FontFamily.d.cts +15 -15
  67. package/lib/FontFamily.d.ts +15 -15
  68. package/lib/FontFamily.js +11 -10
  69. package/lib/FontSize.cjs +1 -1
  70. package/lib/FontSize.d.cts +15 -15
  71. package/lib/FontSize.d.ts +15 -15
  72. package/lib/FontSize.js +6 -5
  73. package/lib/FormatPainter.cjs +1 -1
  74. package/lib/FormatPainter.d.cts +15 -15
  75. package/lib/FormatPainter.d.ts +15 -15
  76. package/lib/FormatPainter.js +1 -1
  77. package/lib/Heading.cjs +1 -1
  78. package/lib/Heading.d.cts +15 -15
  79. package/lib/Heading.d.ts +15 -15
  80. package/lib/Heading.js +32 -31
  81. package/lib/Highlight.cjs +1 -1
  82. package/lib/Highlight.d.cts +15 -15
  83. package/lib/Highlight.d.ts +15 -15
  84. package/lib/Highlight.js +1 -1
  85. package/lib/History.cjs +1 -1
  86. package/lib/History.d.cts +15 -15
  87. package/lib/History.d.ts +15 -15
  88. package/lib/History.js +1 -1
  89. package/lib/HorizontalRule.cjs +1 -1
  90. package/lib/HorizontalRule.d.cts +15 -15
  91. package/lib/HorizontalRule.d.ts +15 -15
  92. package/lib/HorizontalRule.js +1 -1
  93. package/lib/Iframe.cjs +1 -1
  94. package/lib/Iframe.d.cts +15 -15
  95. package/lib/Iframe.d.ts +15 -15
  96. package/lib/Iframe.js +1 -1
  97. package/lib/Image.cjs +1 -1
  98. package/lib/Image.d.cts +15 -15
  99. package/lib/Image.d.ts +15 -15
  100. package/lib/Image.js +1 -1
  101. package/lib/ImageGif.cjs +1 -1
  102. package/lib/ImageGif.d.cts +15 -15
  103. package/lib/ImageGif.d.ts +15 -15
  104. package/lib/ImageGif.js +1 -1
  105. package/lib/ImportWord.cjs +2 -2
  106. package/lib/ImportWord.d.cts +15 -15
  107. package/lib/ImportWord.d.ts +15 -15
  108. package/lib/ImportWord.js +3 -2
  109. package/lib/Indent.cjs +1 -1
  110. package/lib/Indent.d.cts +15 -15
  111. package/lib/Indent.d.ts +15 -15
  112. package/lib/Indent.js +1 -1
  113. package/lib/Italic.cjs +1 -1
  114. package/lib/Italic.d.cts +15 -15
  115. package/lib/Italic.d.ts +15 -15
  116. package/lib/Italic.js +1 -1
  117. package/lib/Katex.cjs +1 -1
  118. package/lib/Katex.d.cts +15 -15
  119. package/lib/Katex.d.ts +15 -15
  120. package/lib/Katex.js +41 -40
  121. package/lib/LineHeight.cjs +1 -1
  122. package/lib/LineHeight.d.cts +15 -15
  123. package/lib/LineHeight.d.ts +15 -15
  124. package/lib/LineHeight.js +17 -16
  125. package/lib/Link.cjs +1 -1
  126. package/lib/Link.d.cts +15 -15
  127. package/lib/Link.d.ts +15 -15
  128. package/lib/Link.js +1 -1
  129. package/lib/ListItem.d.cts +15 -15
  130. package/lib/ListItem.d.ts +15 -15
  131. package/lib/Mention.d.cts +15 -15
  132. package/lib/Mention.d.ts +15 -15
  133. package/lib/Mermaid.cjs +2 -2
  134. package/lib/Mermaid.d.cts +15 -15
  135. package/lib/Mermaid.d.ts +15 -15
  136. package/lib/Mermaid.js +138 -137
  137. package/lib/MoreMark.cjs +1 -1
  138. package/lib/MoreMark.d.cts +15 -15
  139. package/lib/MoreMark.d.ts +15 -15
  140. package/lib/MoreMark.js +1 -1
  141. package/lib/MultiColumn.cjs +1 -1
  142. package/lib/MultiColumn.d.cts +15 -15
  143. package/lib/MultiColumn.d.ts +15 -15
  144. package/lib/MultiColumn.js +1 -1
  145. package/lib/OrderedList.cjs +1 -1
  146. package/lib/OrderedList.d.cts +15 -15
  147. package/lib/OrderedList.d.ts +15 -15
  148. package/lib/OrderedList.js +1 -1
  149. package/lib/{RichTextEditor-C8Sm1E6J.cjs → RichTextEditor-DWlLqTl9.cjs} +4 -4
  150. package/lib/{RichTextEditor-BQN2eLD_.js → RichTextEditor-KP2Rgcqe.js} +15 -39
  151. package/lib/SearchAndReplace.cjs +1 -1
  152. package/lib/SearchAndReplace.d.cts +15 -15
  153. package/lib/SearchAndReplace.d.ts +15 -15
  154. package/lib/SearchAndReplace.js +68 -67
  155. package/lib/Selection.d.cts +15 -15
  156. package/lib/Selection.d.ts +15 -15
  157. package/lib/SlashCommand.cjs +1 -1
  158. package/lib/SlashCommand.d.cts +15 -15
  159. package/lib/SlashCommand.d.ts +15 -15
  160. package/lib/SlashCommand.js +1 -1
  161. package/lib/Strike.cjs +1 -1
  162. package/lib/Strike.d.cts +15 -15
  163. package/lib/Strike.d.ts +15 -15
  164. package/lib/Strike.js +1 -1
  165. package/lib/SubAndSuperScript.cjs +1 -1
  166. package/lib/SubAndSuperScript.d.cts +15 -15
  167. package/lib/SubAndSuperScript.d.ts +15 -15
  168. package/lib/SubAndSuperScript.js +1 -1
  169. package/lib/Table.cjs +1 -1
  170. package/lib/Table.d.cts +15 -15
  171. package/lib/Table.d.ts +15 -15
  172. package/lib/Table.js +2 -1
  173. package/lib/TableOfContent.cjs +1 -1
  174. package/lib/TableOfContent.d.cts +15 -15
  175. package/lib/TableOfContent.d.ts +15 -15
  176. package/lib/TableOfContent.js +50 -49
  177. package/lib/TaskList.cjs +1 -1
  178. package/lib/TaskList.d.cts +15 -15
  179. package/lib/TaskList.d.ts +15 -15
  180. package/lib/TaskList.js +1 -1
  181. package/lib/TextAlign.cjs +1 -1
  182. package/lib/TextAlign.d.cts +15 -15
  183. package/lib/TextAlign.d.ts +15 -15
  184. package/lib/TextAlign.js +8 -7
  185. package/lib/TextBubble.cjs +1 -1
  186. package/lib/TextBubble.d.cts +15 -15
  187. package/lib/TextBubble.d.ts +15 -15
  188. package/lib/TextBubble.js +1 -1
  189. package/lib/TextDirection.cjs +1 -1
  190. package/lib/TextDirection.d.cts +15 -15
  191. package/lib/TextDirection.d.ts +15 -15
  192. package/lib/TextDirection.js +14 -13
  193. package/lib/TextUnderline.cjs +1 -1
  194. package/lib/TextUnderline.d.cts +15 -15
  195. package/lib/TextUnderline.d.ts +15 -15
  196. package/lib/TextUnderline.js +1 -1
  197. package/lib/TrailingNode.d.cts +15 -15
  198. package/lib/TrailingNode.d.ts +15 -15
  199. package/lib/{Twitter-Dg6WWauX.js → Twitter-99ivY5qv.js} +62 -61
  200. package/lib/{Twitter-CL2pu4QM.cjs → Twitter-BvfvUtNT.cjs} +2 -2
  201. package/lib/Twitter.cjs +1 -1
  202. package/lib/Twitter.d.cts +15 -15
  203. package/lib/Twitter.d.ts +15 -15
  204. package/lib/Twitter.js +1 -1
  205. package/lib/Video.cjs +1 -1
  206. package/lib/Video.d.cts +15 -15
  207. package/lib/Video.d.ts +15 -15
  208. package/lib/Video.js +1 -1
  209. package/lib/bubble-extra.cjs +1 -1
  210. package/lib/bubble-extra.d.cts +15 -15
  211. package/lib/bubble-extra.d.ts +15 -15
  212. package/lib/bubble-extra.js +5 -5
  213. package/lib/index.cjs +1 -1
  214. package/lib/index.d.cts +16 -15
  215. package/lib/index.d.ts +16 -15
  216. package/lib/index.js +2 -2
  217. package/lib/locale-bundle.d.cts +15 -15
  218. package/lib/locale-bundle.d.ts +15 -15
  219. package/lib/{textarea-BglwYF6b.js → textarea-CktfkXNe.js} +1 -1
  220. package/lib/{textarea-D5WVZMgt.cjs → textarea-DdH64g04.cjs} +1 -1
  221. package/package.json +1 -1
  222. package/lib/Drawer-CmoEF-Zg.cjs +0 -1
  223. package/lib/Excalidraw-CM74U5tG.js +0 -289
  224. package/lib/Excalidraw-DAPP9qgY.cjs +0 -1
package/lib/Twitter.d.ts CHANGED
@@ -136,6 +136,21 @@ declare module '@tiptap/core' {
136
136
  }
137
137
 
138
138
 
139
+ declare module '@tiptap/core' {
140
+ interface Commands<ReturnType> {
141
+ iframe: {
142
+ /**
143
+ * Add an iframe
144
+ */
145
+ setIframe: (options: {
146
+ src: string;
147
+ service: string;
148
+ }) => ReturnType;
149
+ };
150
+ }
151
+ }
152
+
153
+
139
154
  declare module '@tiptap/core' {
140
155
  interface Commands<ReturnType> {
141
156
  imageUpload: {
@@ -156,21 +171,6 @@ declare module '@tiptap/core' {
156
171
  }
157
172
 
158
173
 
159
- declare module '@tiptap/core' {
160
- interface Commands<ReturnType> {
161
- iframe: {
162
- /**
163
- * Add an iframe
164
- */
165
- setIframe: (options: {
166
- src: string;
167
- service: string;
168
- }) => ReturnType;
169
- };
170
- }
171
- }
172
-
173
-
174
174
  declare module '@tiptap/core' {
175
175
  interface Commands<ReturnType> {
176
176
  imageGifUpload: {
package/lib/Twitter.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import "./index-DI9T3iLd.js";
2
2
  import "./dom-dataset-Di3tIRrR.js";
3
- import { T as m } from "./Twitter-Dg6WWauX.js";
3
+ import { T as m } from "./Twitter-99ivY5qv.js";
4
4
  export {
5
5
  m as Twitter
6
6
  };
package/lib/Video.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("./index-ByRfqzMr.cjs");require("./index-D_A0TBRA.cjs");const e=require("./RichTextEditor-C8Sm1E6J.cjs");exports.Video=e.Video;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("./index-ByRfqzMr.cjs");require("./index-D_A0TBRA.cjs");const e=require("./RichTextEditor-DWlLqTl9.cjs");exports.Video=e.Video;
package/lib/Video.d.cts CHANGED
@@ -221,6 +221,21 @@ declare module '@tiptap/core' {
221
221
  }
222
222
 
223
223
 
224
+ declare module '@tiptap/core' {
225
+ interface Commands<ReturnType> {
226
+ iframe: {
227
+ /**
228
+ * Add an iframe
229
+ */
230
+ setIframe: (options: {
231
+ src: string;
232
+ service: string;
233
+ }) => ReturnType;
234
+ };
235
+ }
236
+ }
237
+
238
+
224
239
  declare module '@tiptap/core' {
225
240
  interface Commands<ReturnType> {
226
241
  imageUpload: {
@@ -241,21 +256,6 @@ declare module '@tiptap/core' {
241
256
  }
242
257
 
243
258
 
244
- declare module '@tiptap/core' {
245
- interface Commands<ReturnType> {
246
- iframe: {
247
- /**
248
- * Add an iframe
249
- */
250
- setIframe: (options: {
251
- src: string;
252
- service: string;
253
- }) => ReturnType;
254
- };
255
- }
256
- }
257
-
258
-
259
259
  declare module '@tiptap/core' {
260
260
  interface Commands<ReturnType> {
261
261
  imageGifUpload: {
package/lib/Video.d.ts CHANGED
@@ -221,6 +221,21 @@ declare module '@tiptap/core' {
221
221
  }
222
222
 
223
223
 
224
+ declare module '@tiptap/core' {
225
+ interface Commands<ReturnType> {
226
+ iframe: {
227
+ /**
228
+ * Add an iframe
229
+ */
230
+ setIframe: (options: {
231
+ src: string;
232
+ service: string;
233
+ }) => ReturnType;
234
+ };
235
+ }
236
+ }
237
+
238
+
224
239
  declare module '@tiptap/core' {
225
240
  interface Commands<ReturnType> {
226
241
  imageUpload: {
@@ -241,21 +256,6 @@ declare module '@tiptap/core' {
241
256
  }
242
257
 
243
258
 
244
- declare module '@tiptap/core' {
245
- interface Commands<ReturnType> {
246
- iframe: {
247
- /**
248
- * Add an iframe
249
- */
250
- setIframe: (options: {
251
- src: string;
252
- service: string;
253
- }) => ReturnType;
254
- };
255
- }
256
- }
257
-
258
-
259
259
  declare module '@tiptap/core' {
260
260
  interface Commands<ReturnType> {
261
261
  imageGifUpload: {
package/lib/Video.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import "./index-DI9T3iLd.js";
2
2
  import "./index-CsK90iVd.js";
3
- import { V as p } from "./RichTextEditor-BQN2eLD_.js";
3
+ import { V as p } from "./RichTextEditor-KP2Rgcqe.js";
4
4
  export {
5
5
  p as Video
6
6
  };
@@ -1,2 +1,2 @@
1
- "use strict";var V=Object.create;var q=Object.defineProperty;var _=Object.getOwnPropertyDescriptor;var G=Object.getOwnPropertyNames;var Z=Object.getPrototypeOf,J=Object.prototype.hasOwnProperty;var Q=(e,n,s,c)=>{if(n&&typeof n=="object"||typeof n=="function")for(let i of G(n))!J.call(e,i)&&i!==s&&q(e,i,{get:()=>n[i],enumerable:!(c=_(n,i))||c.enumerable});return e};var X=(e,n,s)=>(s=e!=null?V(Z(e)):{},Q(n||!e||!e.__esModule?q(s,"default",{value:e,enumerable:!0}):s,e));Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react/jsx-runtime"),a=require("react"),k=require("./dom-dataset-Byuf1YmW.cjs"),o=require("./RichTextEditor-C8Sm1E6J.cjs"),L=require("./Mermaid.cjs"),E=require("./shortId-Bfj8TyNr.cjs"),H=require("./textarea-D5WVZMgt.cjs"),D=require("./index-D_A0TBRA.cjs"),M=require("./Excalidraw-DAPP9qgY.cjs"),W=require("./Twitter-CL2pu4QM.cjs"),Y=require("katex"),F=require("lucide-react"),B=require("./Katex.cjs"),O=require("./Drawer-CmoEF-Zg.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-Byuf1YmW.cjs"),o=require("./RichTextEditor-DWlLqTl9.cjs"),L=require("./Mermaid.cjs"),E=require("./shortId-Bfj8TyNr.cjs"),H=require("./textarea-DdH64g04.cjs"),D=require("./index-D_A0TBRA.cjs"),M=require("./Excalidraw-GUVW-IqC.cjs"),W=require("./Twitter-BvfvUtNT.cjs"),Y=require("katex"),F=require("lucide-react"),B=require("./Katex.cjs"),O=require("./Drawer-5Q_-WRhc.cjs"),R=require("easydrawer"),$=`graph TB
2
2
  a-->b`,ee=({editor:e,attrs:n,extension:s})=>{const{alt:c,align:i}=n,[r,l]=a.useState(decodeURIComponent(c??$)),[u,x]=a.useState(""),[f,b]=a.useState(!1),p=a.useRef(null),[g,y]=a.useState(null),S=s==null?void 0:s.options.upload,I=a.useCallback(w=>{w&&import("mermaid").then(j=>{y(j.default)})},[]),T=async w=>{try{const{svg:j}=await g.render("mermaid-svg",w);x(j)}catch{x("")}},N=()=>{g.initialize({darkMode:!1,startOnLoad:!1,fontSize:12,theme:"base"}),T(r)};a.useEffect(()=>{g&&f&&N()},[g,f]),a.useEffect(()=>{g&&f&&T(r)},[g,r]);const A=async()=>{if(r!==""){if(r){const w=p.current.querySelector("svg"),{width:j,height:z}=w.getBoundingClientRect(),m=`mermaid-${E.shortId()}.svg`;let d=E.i(w.outerHTML);if(S){const h=o.dataURLtoFile(d,m);d=await S(h)}e==null||e.chain().focus().setMermaid({type:"mermaid",src:d,alt:encodeURIComponent(r),width:j,height:z},!!r).run(),e==null||e.commands.setAlignImageMermaid(i)}b(!1)}};return t.jsxs(o.Dialog,{onOpenChange:b,open:f,children:[t.jsx(o.DialogTrigger,{asChild:!0,children:t.jsx(o.ActionButton,{action:()=>b(!0),icon:"Pencil",tooltip:"Edit Mermaid"})}),t.jsxs(o.DialogContent,{className:"richtext-z-[99999] !richtext-max-w-[1300px]",children:[t.jsx(o.DialogTitle,{children:"Edit Mermaid"}),t.jsx("div",{ref:I,style:{height:"100%",border:"1px solid hsl(var(--border))"},children:t.jsxs("div",{className:"richtext-flex richtext-gap-[10px] richtext-rounded-[10px] richtext-p-[10px]",children:[t.jsx(H.Textarea,{autoFocus:!0,className:"richtext-flex-1",defaultValue:$,onChange:w=>l(w.target.value),placeholder:"Text",required:!0,rows:10,value:r,style:{color:"hsl(var(--richtext-foreground))"}}),t.jsx("div",{className:"richtext-flex richtext-flex-1 richtext-items-center richtext-justify-center richtext-rounded-[10px] richtext-p-[10px]",dangerouslySetInnerHTML:{__html:u},ref:p,style:{height:"100%",border:"1px solid hsl(var(--border))",minHeight:500,background:"#fff"}})]})}),t.jsx(o.DialogFooter,{children:t.jsx(o.Button,{onClick:A,type:"button",children:"Save changes"})})]})]})};function K(e,n){const[s,c]=a.useState(void 0);return a.useEffect(()=>{const i=()=>{const r=e.extensionManager.extensions.find(l=>l.name===n);r&&c(r)};return e.on("selectionUpdate",i),e.on("transaction",i),()=>{e.off("selectionUpdate",i),e.off("transaction",i)}},[e,n]),s}const te={maxWidth:"auto",zIndex:20,appendTo:"parent",moveTransition:"transform 0.1s ease-out"};function re({item:e,disabled:n,editor:s}){var i;const c=e.component;return c?t.jsx(a.Fragment,{children:e.type==="divider"?t.jsx(o.Separator,{className:"!richtext-mx-1 !richtext-my-2 !richtext-h-[16px]",orientation:"vertical"}):t.jsx(c,{...e.componentProps,disabled:n||((i=e==null?void 0:e.componentProps)==null?void 0:i.disabled),editor:s})}):t.jsx(t.Fragment,{})}function ne(e){return e.type.name==="mermaid"}function ie(e){const{lang:n}=D.useLocale(),s=o.useAttributes(e.editor,L.Mermaid.name),c=K(e.editor,L.Mermaid.name),i=({editor:l})=>{const{selection:u}=l.view.state,{$from:x,to:f}=u;let b=!1;return l.view.state.doc.nodesBetween(x.pos,f,p=>{if(ne(p))return b=!0,!1}),b},r=a.useMemo(()=>e.disabled?[]:o.getBubbleMermaid(e.editor),[e.disabled,e.editor,n]);return t.jsx(t.Fragment,{children:t.jsx(k.BubbleMenu,{editor:e==null?void 0:e.editor,shouldShow:i,tippyOptions:te,children:r!=null&&r.length?t.jsx("div",{className:"richtext-pointer-events-auto richtext-w-auto richtext-select-none richtext-rounded-sm !richtext-border richtext-border-neutral-200 richtext-bg-background richtext-px-3 richtext-py-2 richtext-shadow-sm richtext-transition-all dark:richtext-border-neutral-800",children:t.jsx("div",{className:"richtext-relative richtext-flex richtext-h-[26px] richtext-flex-nowrap richtext-items-center richtext-justify-start richtext-whitespace-nowrap",children:r==null?void 0:r.map((l,u)=>l.type==="edit"&&(s!=null&&s.src)?t.jsx(ee,{attrs:s,editor:e.editor,extension:c},`bubbleMenu-mermaid-${u}`):t.jsx(re,{disabled:e.disabled,editor:e.editor,item:l},`bubbleMenu-mermaid-${u}`))})}):t.jsx(t.Fragment,{})})})}const v=new Map;function se(e){const n=e.options.element;v.has("width")||v.set("width",n.clientWidth),v.has("width")&&v.get("width")<=0&&v.set("width",n.clientWidth);const s={attributes:!0,childList:!0,subtree:!0},c=function(){v.set("width",n.clientWidth)},i=new MutationObserver(c);return i.observe(n,s),e.on("destroy",()=>{i.disconnect()}),{width:v.get("width")}}function oe({editor:e}){const{t:n}=D.useLocale(),{width:s}=se(e),c=o.useAttributes(e,M.Excalidraw.name,{defaultShowPicker:!1,createUser:"",width:0,height:0}),{defaultShowPicker:i,createUser:r,width:l,height:u}=c,x=a.useCallback(g=>{e.chain().updateAttributes(M.Excalidraw.name,g).setNodeSelection(e.state.selection.from).focus().run()},[e]),f=a.useCallback(()=>{M.triggerOpenExcalidrawSettingModal({...c,editor:e})},[e,c]),b=a.useCallback(()=>e.isActive(M.Excalidraw.name),[e]),p=a.useCallback(()=>o.deleteNode(M.Excalidraw.name,e),[e]);return a.useEffect(()=>{i&&(f(),e.chain().updateAttributes(M.Excalidraw.name,{defaultShowPicker:!1}).focus().run())},[r,i,e,f]),t.jsx(k.BubbleMenu,{className:"bubble-menu",editor:e,pluginKey:"excalidraw-bubble-menu",shouldShow:b,tippyOptions:{popperOptions:{modifiers:[{name:"flip",enabled:!1}]},placement:"bottom-start",offset:[-2,16],zIndex:9999},children:t.jsxs("div",{className:"richtext-w-auto richtext-px-3 richtext-py-2 richtext-transition-all !richtext-border richtext-rounded-sm richtext-shadow-sm richtext-pointer-events-auto richtext-select-none richtext-border-neutral-200 dark:richtext-border-neutral-800 richtext-bg-background",children:[t.jsx(o.ActionButton,{icon:"Pencil",action:f,tooltip:n("editor.edit")}),t.jsx(o.SizeSetter,{width:l,maxWidth:s,height:u,onOk:x,children:t.jsx(o.ActionButton,{icon:"Settings",tooltip:n("editor.settings")})}),t.jsx(o.ActionButton,{icon:"Trash2",action:p,tooltip:n("editor.delete")})]})})}function ae({editor:e,disabled:n}){const[s,c]=a.useState(!1),{t:i}=D.useLocale(),r=a.useCallback(({editor:x})=>x.isActive(W.Twitter.name),[]),l=x=>{e.commands.updateTweet({src:x}),c(!1)},u=a.useCallback(()=>o.deleteNode(W.Twitter.name,e),[e]);return t.jsx(t.Fragment,{children:t.jsx(k.BubbleMenu,{editor:e,shouldShow:r,tippyOptions:{popperOptions:{modifiers:[{name:"flip",enabled:!1}]},placement:"bottom-start",offset:[-2,16],zIndex:9999,onHidden:()=>{c(!1)}},children:n?t.jsx(t.Fragment,{}):t.jsx(t.Fragment,{children:s?t.jsx(W.FormEditLinkTwitter,{editor:e,onSetLink:l}):t.jsx("div",{className:"richtext-flex richtext-items-center richtext-gap-2 richtext-rounded-lg !richtext-border richtext-border-neutral-200 richtext-bg-white richtext-p-2 richtext-shadow-sm dark:richtext-border-neutral-800 dark:richtext-bg-black",children:t.jsxs("div",{className:"richtext-flex richtext-flex-nowrap",children:[t.jsx(o.ActionButton,{icon:"Pencil",tooltip:i("editor.link.edit.tooltip"),tooltipOptions:{sideOffset:15},action:()=>{c(!0)}}),t.jsx(o.ActionButton,{action:u,icon:"Trash",tooltip:i("editor.delete"),tooltipOptions:{sideOffset:15}})]})})})})})}function ce({editor:e,...n}){const s=o.useAttributes(e,B.Katex.name,{text:"",defaultShowPicker:!1}),{text:c,defaultShowPicker:i}=s,[r,l]=a.useState(""),[u,x]=a.useState(!1),f=a.useCallback(()=>e.isActive(B.Katex.name),[e]),b=a.useCallback(()=>o.deleteNode(B.Katex.name,e),[e]),p=a.useCallback(()=>{e.chain().focus().setKatex({text:r}).run(),x(!1)},[e,r]);a.useEffect(()=>{i&&(x(!0),e.chain().updateAttributes(B.Katex.name,{defaultShowPicker:!1}).focus().run())},[e,i,x]),a.useEffect(()=>{u&&l(c||"")},[u]);const g=a.useMemo(()=>{try{return Y.renderToString(`${r}`)}catch{return r}},[r]),y=a.useMemo(()=>`${r}`.trim()?t.jsx("span",{contentEditable:!1,dangerouslySetInnerHTML:{__html:g||""}}):null,[r,g]);return t.jsx(k.BubbleMenu,{editor:e,pluginKey:"Katex-bubble-menu",shouldShow:f,tippyOptions:{popperOptions:{modifiers:[{name:"flip",enabled:!1}]},placement:"bottom-start",offset:[-2,16],zIndex:9999,onHidden:()=>{x(!1)}},children:n!=null&&n.disabled?t.jsx(t.Fragment,{}):t.jsx("div",{className:"richtext-rounded-lg !richtext-border richtext-border-neutral-200 richtext-bg-white richtext-p-2 richtext-shadow-sm dark:richtext-border-neutral-800 dark:richtext-bg-black",children:u?t.jsxs(t.Fragment,{children:[t.jsx(H.Textarea,{autoFocus:!0,defaultValue:c,onChange:S=>l(S.target.value),placeholder:"Formula text",rows:3,style:{marginBottom:8},value:r}),y&&t.jsx("div",{className:"richtext-my-[10px] richtext-overflow-auto richtext-whitespace-nowrap richtext-rounded-[6px] !richtext-border richtext-p-[10px]",children:y}),t.jsxs("div",{className:"richtext-flex richtext-items-center richtext-justify-between richtext-gap-[6px]",children:[t.jsx(o.Button,{className:"richtext-flex-1",onClick:p,children:"Submit"}),t.jsx("a",{href:"https://katex.org/docs/supported",rel:"noreferrer noopener",target:"_blank",children:t.jsx(F.HelpCircle,{size:16})})]})]}):t.jsxs("div",{className:"richtext-flex richtext-items-center richtext-justify-center richtext-gap-[6px]",children:[t.jsx(o.ActionButton,{action:()=>x(!u),tooltip:"Edit",children:t.jsx(F.Pencil,{size:16})}),t.jsx(o.ActionButton,{action:b,tooltip:"Delete",children:t.jsx(F.Trash2,{size:16})})]})})})}let C=!1;function le({editor:e,attrs:n,extension:s}){const[c,i]=a.useState(!1),r=a.useRef(null),l=a.useRef(null),{alt:u,align:x}=n,f=s==null?void 0:s.options.upload,b=()=>{(async()=>{const d=document.querySelector("#easydrawer");d&&(r.current=new R.Editor(d,{wheelEventsEnabled:!1,disableZoom:!0}),l.current=R.makeDropdownToolbar(r.current),l.current.addDefaultToolWidgets(),r.current.loadFromSVG(decodeURIComponent(u)))})()};a.useEffect(()=>{c&&setTimeout(()=>{b()},200)},[c]);const p=async()=>{if(r.current){const m=r.current.toSVG(),d=m.outerHTML,h=`drawer-${E.shortId()}.svg`;let P=E.i(m.outerHTML);if(f){const U=o.dataURLtoFile(P,h);P=await f(U)}e==null||e.chain().focus().setDrawer({type:"drawer",src:P,alt:encodeURIComponent(d),width:426,height:212},!!d).run(),e==null||e.commands.setAlignImageDrawer(x)}i(!1)},g=m=>{const d=r.current.toolController.getPrimaryTools()[2],h=l.current.getWidgetById("pen-1");d&&h&&(d.setColor(m),h.serializeState())},y=m=>{const d=r.current.toolController.getPrimaryTools()[2],h=l.current.getWidgetById("pen-1");d&&h&&(d.setThickness(m),h.serializeState())},S=m=>{const d=r.current.toolController.getPrimaryTools()[3],h=l.current.getWidgetById("pen-2");d&&h&&(d.setColor(m),h.serializeState())},I=m=>{const d=l.current.getWidgetById("shape");d&&d.setShapeType(m)},T=m=>{const d=r.current.toolController.getPrimaryTools()[5],h=l.current.getWidgetById("shape");d&&h&&(d.setColor(m),h.serializeState())},N=m=>{const d=r.current.toolController.getPrimaryTools()[5],h=l.current.getWidgetById("shape");d&&h&&(d.setThickness(m),h.serializeState())},A=m=>{const d=r.current.toolController.getPrimaryTools()[5],h=l.current.getWidgetById("shape");d&&h&&(d.setBorderColor(m),h.serializeState())},w=()=>{if(C){for(;r.current.history.redoStackSize>0;)r.current.history.redo();C=!1;return}r.current.history.undo()},j=()=>{C||r.current.history.redo()},z=()=>{if(!C){for(;r.current.history.undoStackSize>0;)w();C=!0}};return t.jsxs(o.Dialog,{onOpenChange:i,open:c,children:[t.jsx(o.DialogTrigger,{asChild:!0,children:t.jsx(o.ActionButton,{action:()=>i(!0),icon:"Pencil",tooltip:"Edit Drawer"})}),t.jsxs(o.DialogContent,{className:"richtext-z-[99999] !richtext-max-w-[1300px]",children:[t.jsx(o.DialogTitle,{children:"Edit Drawer"}),t.jsxs("div",{style:{height:"100%",borderWidth:1,background:"white",position:"relative"},children:[t.jsx("div",{className:"richtext-size-full",id:"easydrawer"}),t.jsx(O.ControlDrawer,{changeBorderColorShape:A,changeColorShape:T,changeShape:I,onClear:z,onRedo:j,onThicknessChange:N,onUndo:w,refEditor:r,setColorHighlight:S,setColorPen:g,setThicknessPen:y})]}),t.jsx(o.DialogFooter,{children:t.jsx(o.Button,{onClick:p,type:"button",children:"Save changes"})})]})]})}const de={maxWidth:"auto",zIndex:20,appendTo:"parent",moveTransition:"transform 0.1s ease-out"};function ue({item:e,disabled:n,editor:s}){var i;const c=e.component;return c?t.jsx(a.Fragment,{children:e.type==="divider"?t.jsx(o.Separator,{className:"!richtext-mx-1 !richtext-my-2 !richtext-h-[16px]",orientation:"vertical"}):t.jsx(c,{...e.componentProps,disabled:n||((i=e==null?void 0:e.componentProps)==null?void 0:i.disabled),editor:s})}):t.jsx(t.Fragment,{})}function he(e){return e.type.name==="drawer"}function xe(e){const{lang:n}=D.useLocale(),s=o.useAttributes(e.editor,O.Drawer.name),c=K(e.editor,O.Drawer.name),i=({editor:l})=>{const{selection:u}=l.view.state,{$from:x,to:f}=u;let b=!1;return l.view.state.doc.nodesBetween(x.pos,f,p=>{if(he(p))return b=!0,!1}),b},r=a.useMemo(()=>e.disabled?[]:o.getBubbleDrawer(e.editor),[e.disabled,e.editor,n]);return t.jsx(k.BubbleMenu,{editor:e==null?void 0:e.editor,shouldShow:i,tippyOptions:de,children:r!=null&&r.length?t.jsx("div",{className:"richtext-pointer-events-auto richtext-w-auto richtext-select-none richtext-rounded-sm !richtext-border richtext-border-neutral-200 richtext-bg-background richtext-px-3 richtext-py-2 richtext-shadow-sm richtext-transition-all dark:richtext-border-neutral-800",children:t.jsx("div",{className:"richtext-relative richtext-flex richtext-h-[26px] richtext-flex-nowrap richtext-items-center richtext-justify-start richtext-whitespace-nowrap",children:r==null?void 0:r.map((l,u)=>l.type==="edit"&&(s!=null&&s.src)?t.jsx(le,{attrs:s,editor:e.editor,extension:c},`bubbleMenu-drawer-${u}`):t.jsx(ue,{disabled:e.disabled,editor:e.editor,item:l},`bubbleMenu-drawer-${u}`))})}):t.jsx(t.Fragment,{})})}exports.BubbleMenuDrawer=xe;exports.BubbleMenuExcalidraw=oe;exports.BubbleMenuKatex=ce;exports.BubbleMenuMermaid=ie;exports.BubbleMenuTwitter=ae;
@@ -135,6 +135,21 @@ declare module '@tiptap/core' {
135
135
  }
136
136
 
137
137
 
138
+ declare module '@tiptap/core' {
139
+ interface Commands<ReturnType> {
140
+ iframe: {
141
+ /**
142
+ * Add an iframe
143
+ */
144
+ setIframe: (options: {
145
+ src: string;
146
+ service: string;
147
+ }) => ReturnType;
148
+ };
149
+ }
150
+ }
151
+
152
+
138
153
  declare module '@tiptap/core' {
139
154
  interface Commands<ReturnType> {
140
155
  imageUpload: {
@@ -155,21 +170,6 @@ declare module '@tiptap/core' {
155
170
  }
156
171
 
157
172
 
158
- declare module '@tiptap/core' {
159
- interface Commands<ReturnType> {
160
- iframe: {
161
- /**
162
- * Add an iframe
163
- */
164
- setIframe: (options: {
165
- src: string;
166
- service: string;
167
- }) => ReturnType;
168
- };
169
- }
170
- }
171
-
172
-
173
173
  declare module '@tiptap/core' {
174
174
  interface Commands<ReturnType> {
175
175
  imageGifUpload: {
@@ -135,6 +135,21 @@ declare module '@tiptap/core' {
135
135
  }
136
136
 
137
137
 
138
+ declare module '@tiptap/core' {
139
+ interface Commands<ReturnType> {
140
+ iframe: {
141
+ /**
142
+ * Add an iframe
143
+ */
144
+ setIframe: (options: {
145
+ src: string;
146
+ service: string;
147
+ }) => ReturnType;
148
+ };
149
+ }
150
+ }
151
+
152
+
138
153
  declare module '@tiptap/core' {
139
154
  interface Commands<ReturnType> {
140
155
  imageUpload: {
@@ -155,21 +170,6 @@ declare module '@tiptap/core' {
155
170
  }
156
171
 
157
172
 
158
- declare module '@tiptap/core' {
159
- interface Commands<ReturnType> {
160
- iframe: {
161
- /**
162
- * Add an iframe
163
- */
164
- setIframe: (options: {
165
- src: string;
166
- service: string;
167
- }) => ReturnType;
168
- };
169
- }
170
- }
171
-
172
-
173
173
  declare module '@tiptap/core' {
174
174
  interface Commands<ReturnType> {
175
175
  imageGifUpload: {
@@ -1,17 +1,17 @@
1
1
  import { jsxs as b, jsx as t, Fragment as v } from "react/jsx-runtime";
2
2
  import { useState as y, useRef as L, useCallback as w, useEffect as T, useMemo as W, Fragment as G } from "react";
3
3
  import { B as z } from "./dom-dataset-Di3tIRrR.js";
4
- import { w as Z, x as J, A as S, y as Q, z as X, F as Y, B as H, G as ee, O as D, a1 as ce, a2 as te, a3 as R, a4 as se, a5 as le } from "./RichTextEditor-BQN2eLD_.js";
4
+ import { w as Z, x as J, A as S, y as Q, z as X, F as Y, B as H, G as ee, O as D, a1 as ce, a2 as te, a3 as R, a4 as se, a5 as le } from "./RichTextEditor-KP2Rgcqe.js";
5
5
  import { Mermaid as j } from "./Mermaid.js";
6
6
  import { s as re, i as ne } from "./shortId-WJVkrvml.js";
7
- import { T as ie } from "./textarea-BglwYF6b.js";
7
+ import { T as ie } from "./textarea-CktfkXNe.js";
8
8
  import { u as O } from "./index-CsK90iVd.js";
9
- import { E as I, t as de } from "./Excalidraw-CM74U5tG.js";
10
- import { T as K, F as he } from "./Twitter-Dg6WWauX.js";
9
+ import { E as I, t as de } from "./Excalidraw-CG498239.js";
10
+ import { T as K, F as he } from "./Twitter-99ivY5qv.js";
11
11
  import ue from "katex";
12
12
  import { HelpCircle as me, Pencil as xe, Trash2 as fe } from "lucide-react";
13
13
  import { Katex as P } from "./Katex.js";
14
- import { C as pe, D as _ } from "./Drawer-BKTU9CpU.js";
14
+ import { C as pe, D as _ } from "./Drawer-BHkje8ys.js";
15
15
  import { Editor as ge, makeDropdownToolbar as be } from "easydrawer";
16
16
  const q = `graph TB
17
17
  a-->b`, we = ({ editor: e, attrs: s, extension: o }) => {
package/lib/index.cjs CHANGED
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const p=require("react"),C=require("./RichTextEditor-C8Sm1E6J.cjs"),x=require("./dom-dataset-Byuf1YmW.cjs"),a=require("./index-ByRfqzMr.cjs"),b=require("./ListItem.cjs"),S=require("./index-DclQSrIx.cjs"),v=require("./Document.cjs"),k=require("./Selection.cjs"),P=require("./TextBubble.cjs"),M=require("./TrailingNode.cjs"),m=require("./index-D_A0TBRA.cjs");function T(){var l;const t=p.useRef({editor:null}),[e,i]=p.useState(!1),[o,r]=p.useState(null);return p.useEffect(()=>{var s;(s=t.current)!=null&&s.editor&&(i(!0),r(t.current.editor))},[t,(l=t.current)==null?void 0:l.editor]),{isReady:e,editor:o,editorRef:t}}const E=a.Extension.create({name:"characterCount",addOptions(){return{limit:null,mode:"textSize",textCounter:t=>t.length,wordCounter:t=>t.split(" ").filter(e=>e!=="").length}},addStorage(){return{characters:()=>0,words:()=>0}},onBeforeCreate(){this.storage.characters=t=>{const e=(t==null?void 0:t.node)||this.editor.state.doc;if(((t==null?void 0:t.mode)||this.options.mode)==="textSize"){const o=e.textBetween(0,e.content.size,void 0," ");return this.options.textCounter(o)}return e.nodeSize},this.storage.words=t=>{const e=(t==null?void 0:t.node)||this.editor.state.doc,i=e.textBetween(0,e.content.size," "," ");return this.options.wordCounter(i)}},addProseMirrorPlugins(){let t=!1;return[new a.Plugin({key:new a.PluginKey("characterCount"),appendTransaction:(e,i,o)=>{if(t)return;const r=this.options.limit;if(r==null||r===0){t=!0;return}const l=this.storage.characters({node:o.doc});if(l>r){const s=l-r,n=0,c=s;console.warn(`[CharacterCount] Initial content exceeded limit of ${r} characters. Content was automatically trimmed.`);const u=o.tr.deleteRange(n,c);return t=!0,u}t=!0},filterTransaction:(e,i)=>{const o=this.options.limit;if(!e.docChanged||o===0||o===null||o===void 0)return!0;const r=this.storage.characters({node:i.doc}),l=this.storage.characters({node:e.doc});if(l<=o||r>o&&l>o&&l<=r)return!0;if(r>o&&l>o&&l>r||!e.getMeta("paste"))return!1;const n=e.selection.$head.pos,c=l-o,u=n-c,h=n;return e.deleteRange(u,h),!(this.storage.characters({node:e.doc})>o)}})]}});function A(t={}){return new a.Plugin({view(e){return new O(e,t)}})}class O{constructor(e,i){var o;this.editorView=e,this.cursorPos=null,this.element=null,this.timeout=-1,this.width=(o=i.width)!==null&&o!==void 0?o:1,this.color=i.color===!1?void 0:i.color||"black",this.class=i.class,this.handlers=["dragover","dragend","drop","dragleave"].map(r=>{let l=s=>{this[r](s)};return e.dom.addEventListener(r,l),{name:r,handler:l}})}destroy(){this.handlers.forEach(({name:e,handler:i})=>this.editorView.dom.removeEventListener(e,i))}update(e,i){this.cursorPos!=null&&i.doc!=e.state.doc&&(this.cursorPos>e.state.doc.content.size?this.setCursor(null):this.updateOverlay())}setCursor(e){e!=this.cursorPos&&(this.cursorPos=e,e==null?(this.element.parentNode.removeChild(this.element),this.element=null):this.updateOverlay())}updateOverlay(){let e=this.editorView.state.doc.resolve(this.cursorPos),i=!e.parent.inlineContent,o;if(i){let n=e.nodeBefore,c=e.nodeAfter;if(n||c){let u=this.editorView.nodeDOM(this.cursorPos-(n?n.nodeSize:0));if(u){let h=u.getBoundingClientRect(),f=n?h.bottom:h.top;n&&c&&(f=(f+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2),o={left:h.left,right:h.right,top:f-this.width/2,bottom:f+this.width/2}}}}if(!o){let n=this.editorView.coordsAtPos(this.cursorPos);o={left:n.left-this.width/2,right:n.left+this.width/2,top:n.top,bottom:n.bottom}}let r=this.editorView.dom.offsetParent;this.element||(this.element=r.appendChild(document.createElement("div")),this.class&&(this.element.className=this.class),this.element.style.cssText="position: absolute; z-index: 50; pointer-events: none;",this.color&&(this.element.style.backgroundColor=this.color)),this.element.classList.toggle("prosemirror-dropcursor-block",i),this.element.classList.toggle("prosemirror-dropcursor-inline",!i);let l,s;if(!r||r==document.body&&getComputedStyle(r).position=="static")l=-pageXOffset,s=-pageYOffset;else{let n=r.getBoundingClientRect();l=n.left-r.scrollLeft,s=n.top-r.scrollTop}this.element.style.left=o.left-l+"px",this.element.style.top=o.top-s+"px",this.element.style.width=o.right-o.left+"px",this.element.style.height=o.bottom-o.top+"px"}scheduleRemoval(e){clearTimeout(this.timeout),this.timeout=setTimeout(()=>this.setCursor(null),e)}dragover(e){if(!this.editorView.editable)return;let i=this.editorView.posAtCoords({left:e.clientX,top:e.clientY}),o=i&&i.inside>=0&&this.editorView.state.doc.nodeAt(i.inside),r=o&&o.type.spec.disableDropCursor,l=typeof r=="function"?r(this.editorView,i,e):r;if(i&&!l){let s=i.pos;if(this.editorView.dragging&&this.editorView.dragging.slice){let n=a.dropPoint(this.editorView.state.doc,s,this.editorView.dragging.slice);n!=null&&(s=n)}this.setCursor(s),this.scheduleRemoval(5e3)}}dragend(){this.scheduleRemoval(20)}drop(){this.scheduleRemoval(20)}dragleave(e){(e.target==this.editorView.dom||!this.editorView.dom.contains(e.relatedTarget))&&this.setCursor(null)}}const B=a.Extension.create({name:"dropCursor",addOptions(){return{color:"currentColor",width:1,class:void 0}},addProseMirrorPlugins(){return[A(this.options)]}}),N=a.Extension.create({name:"focus",addOptions(){return{className:"has-focus",mode:"all"}},addProseMirrorPlugins(){return[new a.Plugin({key:new a.PluginKey("focus"),props:{decorations:({doc:t,selection:e})=>{const{isEditable:i,isFocused:o}=this.editor,{anchor:r}=e,l=[];if(!i||!o)return a.DecorationSet.create(t,[]);let s=0;this.options.mode==="deepest"&&t.descendants((c,u)=>{if(c.isText)return;if(!(r>=u&&r<=u+c.nodeSize-1))return!1;s+=1});let n=0;return t.descendants((c,u)=>{if(c.isText||!(r>=u&&r<=u+c.nodeSize-1))return!1;if(n+=1,this.options.mode==="deepest"&&s-n>0||this.options.mode==="shallowest"&&n>1)return this.options.mode==="deepest";l.push(a.Decoration.node(u,u+c.nodeSize,{class:this.options.className}))}),a.DecorationSet.create(t,l)}}})]}});class d extends a.Selection{constructor(e){super(e,e)}map(e,i){let o=e.resolve(i.map(this.head));return d.valid(o)?new d(o):a.Selection.near(o)}content(){return a.Slice.empty}eq(e){return e instanceof d&&e.head==this.head}toJSON(){return{type:"gapcursor",pos:this.head}}static fromJSON(e,i){if(typeof i.pos!="number")throw new RangeError("Invalid input for GapCursor.fromJSON");return new d(e.resolve(i.pos))}getBookmark(){return new y(this.anchor)}static valid(e){let i=e.parent;if(i.isTextblock||!z(e)||!D(e))return!1;let o=i.type.spec.allowGapCursor;if(o!=null)return o;let r=i.contentMatchAt(e.index()).defaultType;return r&&r.isTextblock}static findGapCursorFrom(e,i,o=!1){e:for(;;){if(!o&&d.valid(e))return e;let r=e.pos,l=null;for(let s=e.depth;;s--){let n=e.node(s);if(i>0?e.indexAfter(s)<n.childCount:e.index(s)>0){l=n.child(i>0?e.indexAfter(s):e.index(s)-1);break}else if(s==0)return null;r+=i;let c=e.doc.resolve(r);if(d.valid(c))return c}for(;;){let s=i>0?l.firstChild:l.lastChild;if(!s){if(l.isAtom&&!l.isText&&!a.NodeSelection.isSelectable(l)){e=e.doc.resolve(r+l.nodeSize*i),o=!1;continue e}break}l=s,r+=i;let n=e.doc.resolve(r);if(d.valid(n))return n}return null}}}d.prototype.visible=!1;d.findFrom=d.findGapCursorFrom;a.Selection.jsonID("gapcursor",d);class y{constructor(e){this.pos=e}map(e){return new y(e.map(this.pos))}resolve(e){let i=e.resolve(this.pos);return d.valid(i)?new d(i):a.Selection.near(i)}}function z(t){for(let e=t.depth;e>=0;e--){let i=t.index(e),o=t.node(e);if(i==0){if(o.type.spec.isolating)return!0;continue}for(let r=o.child(i-1);;r=r.lastChild){if(r.childCount==0&&!r.inlineContent||r.isAtom||r.type.spec.isolating)return!0;if(r.inlineContent)return!1}}return!0}function D(t){for(let e=t.depth;e>=0;e--){let i=t.indexAfter(e),o=t.node(e);if(i==o.childCount){if(o.type.spec.isolating)return!0;continue}for(let r=o.child(i);;r=r.firstChild){if(r.childCount==0&&!r.inlineContent||r.isAtom||r.type.spec.isolating)return!0;if(r.inlineContent)return!1}}return!0}function L(){return new a.Plugin({props:{decorations:q,createSelectionBetween(t,e,i){return e.pos==i.pos&&d.valid(i)?new d(i):null},handleClick:V,handleKeyDown:R,handleDOMEvents:{beforeinput:H}}})}const R=a.keydownHandler({ArrowLeft:g("horiz",-1),ArrowRight:g("horiz",1),ArrowUp:g("vert",-1),ArrowDown:g("vert",1)});function g(t,e){const i=t=="vert"?e>0?"down":"up":e>0?"right":"left";return function(o,r,l){let s=o.selection,n=e>0?s.$to:s.$from,c=s.empty;if(s instanceof a.TextSelection){if(!l.endOfTextblock(i)||n.depth==0)return!1;c=!1,n=o.doc.resolve(e>0?n.after():n.before())}let u=d.findGapCursorFrom(n,e,c);return u?(r&&r(o.tr.setSelection(new d(u))),!0):!1}}function V(t,e,i){if(!t||!t.editable)return!1;let o=t.state.doc.resolve(e);if(!d.valid(o))return!1;let r=t.posAtCoords({left:i.clientX,top:i.clientY});return r&&r.inside>-1&&a.NodeSelection.isSelectable(t.state.doc.nodeAt(r.inside))?!1:(t.dispatch(t.state.tr.setSelection(new d(o))),!0)}function H(t,e){if(e.inputType!="insertCompositionText"||!(t.state.selection instanceof d))return!1;let{$from:i}=t.state.selection,o=i.parent.contentMatchAt(i.index()).findWrapping(t.state.schema.nodes.text);if(!o)return!1;let r=a.Fragment.empty;for(let s=o.length-1;s>=0;s--)r=a.Fragment.from(o[s].createAndFill(null,r));let l=t.state.tr.replace(i.pos,i.pos,new a.Slice(r,0,0));return l.setSelection(a.TextSelection.near(l.doc.resolve(i.pos+1))),t.dispatch(l),!1}function q(t){if(!(t.selection instanceof d))return null;let e=document.createElement("div");return e.className="ProseMirror-gapcursor",a.DecorationSet.create(t.doc,[a.Decoration.widget(t.selection.head,e,{key:"gapcursor"})])}const F=a.Extension.create({name:"gapCursor",addProseMirrorPlugins(){return[L()]},extendNodeSchema(t){var e;const i={name:t.name,options:t.options,storage:t.storage};return{allowGapCursor:(e=a.callOrReturn(a.getExtensionField(t,"allowGapCursor",i)))!==null&&e!==void 0?e:null}}}),I=a.Node.create({name:"hardBreak",addOptions(){return{keepMarks:!0,HTMLAttributes:{}}},inline:!0,group:"inline",selectable:!1,linebreakReplacement:!0,parseHTML(){return[{tag:"br"}]},renderHTML({HTMLAttributes:t}){return["br",a.mergeAttributes(this.options.HTMLAttributes,t)]},renderText(){return`
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const p=require("react"),C=require("./RichTextEditor-DWlLqTl9.cjs"),x=require("./dom-dataset-Byuf1YmW.cjs"),a=require("./index-ByRfqzMr.cjs"),b=require("./ListItem.cjs"),S=require("./index-DclQSrIx.cjs"),v=require("./Document.cjs"),k=require("./Selection.cjs"),P=require("./TextBubble.cjs"),M=require("./TrailingNode.cjs"),m=require("./index-D_A0TBRA.cjs");function T(){var l;const t=p.useRef({editor:null}),[e,i]=p.useState(!1),[o,r]=p.useState(null);return p.useEffect(()=>{var s;(s=t.current)!=null&&s.editor&&(i(!0),r(t.current.editor))},[t,(l=t.current)==null?void 0:l.editor]),{isReady:e,editor:o,editorRef:t}}const E=a.Extension.create({name:"characterCount",addOptions(){return{limit:null,mode:"textSize",textCounter:t=>t.length,wordCounter:t=>t.split(" ").filter(e=>e!=="").length}},addStorage(){return{characters:()=>0,words:()=>0}},onBeforeCreate(){this.storage.characters=t=>{const e=(t==null?void 0:t.node)||this.editor.state.doc;if(((t==null?void 0:t.mode)||this.options.mode)==="textSize"){const o=e.textBetween(0,e.content.size,void 0," ");return this.options.textCounter(o)}return e.nodeSize},this.storage.words=t=>{const e=(t==null?void 0:t.node)||this.editor.state.doc,i=e.textBetween(0,e.content.size," "," ");return this.options.wordCounter(i)}},addProseMirrorPlugins(){let t=!1;return[new a.Plugin({key:new a.PluginKey("characterCount"),appendTransaction:(e,i,o)=>{if(t)return;const r=this.options.limit;if(r==null||r===0){t=!0;return}const l=this.storage.characters({node:o.doc});if(l>r){const s=l-r,n=0,c=s;console.warn(`[CharacterCount] Initial content exceeded limit of ${r} characters. Content was automatically trimmed.`);const u=o.tr.deleteRange(n,c);return t=!0,u}t=!0},filterTransaction:(e,i)=>{const o=this.options.limit;if(!e.docChanged||o===0||o===null||o===void 0)return!0;const r=this.storage.characters({node:i.doc}),l=this.storage.characters({node:e.doc});if(l<=o||r>o&&l>o&&l<=r)return!0;if(r>o&&l>o&&l>r||!e.getMeta("paste"))return!1;const n=e.selection.$head.pos,c=l-o,u=n-c,h=n;return e.deleteRange(u,h),!(this.storage.characters({node:e.doc})>o)}})]}});function A(t={}){return new a.Plugin({view(e){return new O(e,t)}})}class O{constructor(e,i){var o;this.editorView=e,this.cursorPos=null,this.element=null,this.timeout=-1,this.width=(o=i.width)!==null&&o!==void 0?o:1,this.color=i.color===!1?void 0:i.color||"black",this.class=i.class,this.handlers=["dragover","dragend","drop","dragleave"].map(r=>{let l=s=>{this[r](s)};return e.dom.addEventListener(r,l),{name:r,handler:l}})}destroy(){this.handlers.forEach(({name:e,handler:i})=>this.editorView.dom.removeEventListener(e,i))}update(e,i){this.cursorPos!=null&&i.doc!=e.state.doc&&(this.cursorPos>e.state.doc.content.size?this.setCursor(null):this.updateOverlay())}setCursor(e){e!=this.cursorPos&&(this.cursorPos=e,e==null?(this.element.parentNode.removeChild(this.element),this.element=null):this.updateOverlay())}updateOverlay(){let e=this.editorView.state.doc.resolve(this.cursorPos),i=!e.parent.inlineContent,o;if(i){let n=e.nodeBefore,c=e.nodeAfter;if(n||c){let u=this.editorView.nodeDOM(this.cursorPos-(n?n.nodeSize:0));if(u){let h=u.getBoundingClientRect(),f=n?h.bottom:h.top;n&&c&&(f=(f+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2),o={left:h.left,right:h.right,top:f-this.width/2,bottom:f+this.width/2}}}}if(!o){let n=this.editorView.coordsAtPos(this.cursorPos);o={left:n.left-this.width/2,right:n.left+this.width/2,top:n.top,bottom:n.bottom}}let r=this.editorView.dom.offsetParent;this.element||(this.element=r.appendChild(document.createElement("div")),this.class&&(this.element.className=this.class),this.element.style.cssText="position: absolute; z-index: 50; pointer-events: none;",this.color&&(this.element.style.backgroundColor=this.color)),this.element.classList.toggle("prosemirror-dropcursor-block",i),this.element.classList.toggle("prosemirror-dropcursor-inline",!i);let l,s;if(!r||r==document.body&&getComputedStyle(r).position=="static")l=-pageXOffset,s=-pageYOffset;else{let n=r.getBoundingClientRect();l=n.left-r.scrollLeft,s=n.top-r.scrollTop}this.element.style.left=o.left-l+"px",this.element.style.top=o.top-s+"px",this.element.style.width=o.right-o.left+"px",this.element.style.height=o.bottom-o.top+"px"}scheduleRemoval(e){clearTimeout(this.timeout),this.timeout=setTimeout(()=>this.setCursor(null),e)}dragover(e){if(!this.editorView.editable)return;let i=this.editorView.posAtCoords({left:e.clientX,top:e.clientY}),o=i&&i.inside>=0&&this.editorView.state.doc.nodeAt(i.inside),r=o&&o.type.spec.disableDropCursor,l=typeof r=="function"?r(this.editorView,i,e):r;if(i&&!l){let s=i.pos;if(this.editorView.dragging&&this.editorView.dragging.slice){let n=a.dropPoint(this.editorView.state.doc,s,this.editorView.dragging.slice);n!=null&&(s=n)}this.setCursor(s),this.scheduleRemoval(5e3)}}dragend(){this.scheduleRemoval(20)}drop(){this.scheduleRemoval(20)}dragleave(e){(e.target==this.editorView.dom||!this.editorView.dom.contains(e.relatedTarget))&&this.setCursor(null)}}const B=a.Extension.create({name:"dropCursor",addOptions(){return{color:"currentColor",width:1,class:void 0}},addProseMirrorPlugins(){return[A(this.options)]}}),N=a.Extension.create({name:"focus",addOptions(){return{className:"has-focus",mode:"all"}},addProseMirrorPlugins(){return[new a.Plugin({key:new a.PluginKey("focus"),props:{decorations:({doc:t,selection:e})=>{const{isEditable:i,isFocused:o}=this.editor,{anchor:r}=e,l=[];if(!i||!o)return a.DecorationSet.create(t,[]);let s=0;this.options.mode==="deepest"&&t.descendants((c,u)=>{if(c.isText)return;if(!(r>=u&&r<=u+c.nodeSize-1))return!1;s+=1});let n=0;return t.descendants((c,u)=>{if(c.isText||!(r>=u&&r<=u+c.nodeSize-1))return!1;if(n+=1,this.options.mode==="deepest"&&s-n>0||this.options.mode==="shallowest"&&n>1)return this.options.mode==="deepest";l.push(a.Decoration.node(u,u+c.nodeSize,{class:this.options.className}))}),a.DecorationSet.create(t,l)}}})]}});class d extends a.Selection{constructor(e){super(e,e)}map(e,i){let o=e.resolve(i.map(this.head));return d.valid(o)?new d(o):a.Selection.near(o)}content(){return a.Slice.empty}eq(e){return e instanceof d&&e.head==this.head}toJSON(){return{type:"gapcursor",pos:this.head}}static fromJSON(e,i){if(typeof i.pos!="number")throw new RangeError("Invalid input for GapCursor.fromJSON");return new d(e.resolve(i.pos))}getBookmark(){return new y(this.anchor)}static valid(e){let i=e.parent;if(i.isTextblock||!z(e)||!D(e))return!1;let o=i.type.spec.allowGapCursor;if(o!=null)return o;let r=i.contentMatchAt(e.index()).defaultType;return r&&r.isTextblock}static findGapCursorFrom(e,i,o=!1){e:for(;;){if(!o&&d.valid(e))return e;let r=e.pos,l=null;for(let s=e.depth;;s--){let n=e.node(s);if(i>0?e.indexAfter(s)<n.childCount:e.index(s)>0){l=n.child(i>0?e.indexAfter(s):e.index(s)-1);break}else if(s==0)return null;r+=i;let c=e.doc.resolve(r);if(d.valid(c))return c}for(;;){let s=i>0?l.firstChild:l.lastChild;if(!s){if(l.isAtom&&!l.isText&&!a.NodeSelection.isSelectable(l)){e=e.doc.resolve(r+l.nodeSize*i),o=!1;continue e}break}l=s,r+=i;let n=e.doc.resolve(r);if(d.valid(n))return n}return null}}}d.prototype.visible=!1;d.findFrom=d.findGapCursorFrom;a.Selection.jsonID("gapcursor",d);class y{constructor(e){this.pos=e}map(e){return new y(e.map(this.pos))}resolve(e){let i=e.resolve(this.pos);return d.valid(i)?new d(i):a.Selection.near(i)}}function z(t){for(let e=t.depth;e>=0;e--){let i=t.index(e),o=t.node(e);if(i==0){if(o.type.spec.isolating)return!0;continue}for(let r=o.child(i-1);;r=r.lastChild){if(r.childCount==0&&!r.inlineContent||r.isAtom||r.type.spec.isolating)return!0;if(r.inlineContent)return!1}}return!0}function D(t){for(let e=t.depth;e>=0;e--){let i=t.indexAfter(e),o=t.node(e);if(i==o.childCount){if(o.type.spec.isolating)return!0;continue}for(let r=o.child(i);;r=r.firstChild){if(r.childCount==0&&!r.inlineContent||r.isAtom||r.type.spec.isolating)return!0;if(r.inlineContent)return!1}}return!0}function L(){return new a.Plugin({props:{decorations:q,createSelectionBetween(t,e,i){return e.pos==i.pos&&d.valid(i)?new d(i):null},handleClick:V,handleKeyDown:R,handleDOMEvents:{beforeinput:H}}})}const R=a.keydownHandler({ArrowLeft:g("horiz",-1),ArrowRight:g("horiz",1),ArrowUp:g("vert",-1),ArrowDown:g("vert",1)});function g(t,e){const i=t=="vert"?e>0?"down":"up":e>0?"right":"left";return function(o,r,l){let s=o.selection,n=e>0?s.$to:s.$from,c=s.empty;if(s instanceof a.TextSelection){if(!l.endOfTextblock(i)||n.depth==0)return!1;c=!1,n=o.doc.resolve(e>0?n.after():n.before())}let u=d.findGapCursorFrom(n,e,c);return u?(r&&r(o.tr.setSelection(new d(u))),!0):!1}}function V(t,e,i){if(!t||!t.editable)return!1;let o=t.state.doc.resolve(e);if(!d.valid(o))return!1;let r=t.posAtCoords({left:i.clientX,top:i.clientY});return r&&r.inside>-1&&a.NodeSelection.isSelectable(t.state.doc.nodeAt(r.inside))?!1:(t.dispatch(t.state.tr.setSelection(new d(o))),!0)}function H(t,e){if(e.inputType!="insertCompositionText"||!(t.state.selection instanceof d))return!1;let{$from:i}=t.state.selection,o=i.parent.contentMatchAt(i.index()).findWrapping(t.state.schema.nodes.text);if(!o)return!1;let r=a.Fragment.empty;for(let s=o.length-1;s>=0;s--)r=a.Fragment.from(o[s].createAndFill(null,r));let l=t.state.tr.replace(i.pos,i.pos,new a.Slice(r,0,0));return l.setSelection(a.TextSelection.near(l.doc.resolve(i.pos+1))),t.dispatch(l),!1}function q(t){if(!(t.selection instanceof d))return null;let e=document.createElement("div");return e.className="ProseMirror-gapcursor",a.DecorationSet.create(t.doc,[a.Decoration.widget(t.selection.head,e,{key:"gapcursor"})])}const F=a.Extension.create({name:"gapCursor",addProseMirrorPlugins(){return[L()]},extendNodeSchema(t){var e;const i={name:t.name,options:t.options,storage:t.storage};return{allowGapCursor:(e=a.callOrReturn(a.getExtensionField(t,"allowGapCursor",i)))!==null&&e!==void 0?e:null}}}),I=a.Node.create({name:"hardBreak",addOptions(){return{keepMarks:!0,HTMLAttributes:{}}},inline:!0,group:"inline",selectable:!1,linebreakReplacement:!0,parseHTML(){return[{tag:"br"}]},renderHTML({HTMLAttributes:t}){return["br",a.mergeAttributes(this.options.HTMLAttributes,t)]},renderText(){return`
2
2
  `},addCommands(){return{setHardBreak:()=>({commands:t,chain:e,state:i,editor:o})=>t.first([()=>t.exitCode(),()=>t.command(()=>{const{selection:r,storedMarks:l}=i;if(r.$from.parent.type.spec.isolating)return!1;const{keepMarks:s}=this.options,{splittableMarks:n}=o.extensionManager,c=l||r.$to.parentOffset&&r.$from.marks();return e().insertContent({type:this.name}).command(({tr:u,dispatch:h})=>{if(h&&c&&s){const f=c.filter(w=>n.includes(w.type.name));u.ensureMarks(f)}return!0}).run()})])}},addKeyboardShortcuts(){return{"Mod-Enter":()=>this.editor.commands.setHardBreak(),"Shift-Enter":()=>this.editor.commands.setHardBreak()}}}),K=a.Node.create({name:"paragraph",priority:1e3,addOptions(){return{HTMLAttributes:{}}},group:"block",content:"inline*",parseHTML(){return[{tag:"p"}]},renderHTML({HTMLAttributes:t}){return["p",a.mergeAttributes(this.options.HTMLAttributes,t),0]},addCommands(){return{setParagraph:()=>({commands:t})=>t.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}}),W=a.Extension.create({name:"placeholder",addOptions(){return{emptyEditorClass:"is-editor-empty",emptyNodeClass:"is-empty",placeholder:"Write something …",showOnlyWhenEditable:!0,showOnlyCurrent:!0,includeChildren:!1}},addProseMirrorPlugins(){return[new a.Plugin({key:new a.PluginKey("placeholder"),props:{decorations:({doc:t,selection:e})=>{const i=this.editor.isEditable||!this.options.showOnlyWhenEditable,{anchor:o}=e,r=[];if(!i)return null;const l=this.editor.isEmpty;return t.descendants((s,n)=>{const c=o>=n&&o<=n+s.nodeSize,u=!s.isLeaf&&a.isNodeEmpty(s);if((c||!this.options.showOnlyCurrent)&&u){const h=[this.options.emptyNodeClass];l&&h.push(this.options.emptyEditorClass);const f=a.Decoration.node(n,n+s.nodeSize,{class:h.join(" "),"data-placeholder":typeof this.options.placeholder=="function"?this.options.placeholder({editor:this.editor,node:s,pos:n,hasAnchor:c}):this.options.placeholder});r.push(f)}return this.options.includeChildren}),a.DecorationSet.create(t,r)}}})]}}),G=a.Node.create({name:"text",group:"inline"}),J=a.Extension.create({name:"base-kit",addExtensions(){const t=[];return this.options.document!==!1&&t.push(v.Document.configure()),this.options.placeholder!==!1&&t.push(W.configure({placeholder:({node:e,pos:i,editor:o})=>{var r,l,s,n,c;return((r=e==null?void 0:e.type)==null?void 0:r.name)==="columns"||((l=e==null?void 0:e.content)==null?void 0:l.size)!==0?"":((s=e==null?void 0:e.type)==null?void 0:s.name)==="heading"?`${m.localeActions.t(`editor.heading.h${e.attrs.level}.tooltip`)}`:((n=e==null?void 0:e.type)==null?void 0:n.name)==="codeBlock"||((c=e==null?void 0:e.type)==null?void 0:c.name)==="table"?"":o.extensionManager.extensions.some(u=>u.name==="slashCommand")?m.localeActions.t("editor.slash"):m.localeActions.t("editor.content")},...this.options.placeholder})),this.options.focus!==!1&&t.push(N.configure({className:"focus",...this.options.focus})),this.options.text!==!1&&t.push(G.configure()),this.options.textBubble!==!1&&t.push(P.TextBubble.configure()),this.options.gapcursor!==!1&&t.push(F.configure()),this.options.dropcursor!==!1&&t.push(B.configure({...this.options.dropcursor,width:2,class:"ProseMirror-dropcursor border-black"})),this.options.characterCount!==!1&&t.push(E.configure(this.options.characterCount)),this.options.paragraph!==!1&&t.push(K.configure(this.options.paragraph)),this.options.hardBreak!==!1&&t.push(I.configure(this.options.hardBreak)),this.options.listItem!==!1&&t.push(b.ListItem.configure(this.options.listItem)),this.options.textStyle!==!1&&t.push(S.TextStyle.configure(this.options.textStyle)),this.options.trailingNode!==!1&&t.push(M.TrailingNode.configure(this.options.trailingNode)),this.options.selection!==!1&&t.push(k.Selection),this.options.multiColumn!==!1&&t.push(C.Column,C.MultiColumn),t}});exports.default=C.RichTextEditor;exports.BubbleMenu=x.BubbleMenu;exports.BaseKit=J;exports.useEditorState=T;
package/lib/index.d.cts CHANGED
@@ -414,6 +414,7 @@ declare interface ToolbarItemProps {
414
414
 
415
415
  declare interface ToolbarProps {
416
416
  render?: (props: ToolbarRenderProps, toolbarItems: ToolbarItemProps[], dom: any[], containerDom: (innerContent: React.ReactNode) => React.ReactNode) => React.ReactNode;
417
+ tooltipSide?: 'top' | 'bottom';
417
418
  }
418
419
 
419
420
  declare interface ToolbarRenderProps {
@@ -552,6 +553,21 @@ declare module '@tiptap/core' {
552
553
  }
553
554
 
554
555
 
556
+ declare module '@tiptap/core' {
557
+ interface Commands<ReturnType> {
558
+ iframe: {
559
+ /**
560
+ * Add an iframe
561
+ */
562
+ setIframe: (options: {
563
+ src: string;
564
+ service: string;
565
+ }) => ReturnType;
566
+ };
567
+ }
568
+ }
569
+
570
+
555
571
  declare module '@tiptap/core' {
556
572
  interface Commands<ReturnType> {
557
573
  imageUpload: {
@@ -572,21 +588,6 @@ declare module '@tiptap/core' {
572
588
  }
573
589
 
574
590
 
575
- declare module '@tiptap/core' {
576
- interface Commands<ReturnType> {
577
- iframe: {
578
- /**
579
- * Add an iframe
580
- */
581
- setIframe: (options: {
582
- src: string;
583
- service: string;
584
- }) => ReturnType;
585
- };
586
- }
587
- }
588
-
589
-
590
591
  declare module '@tiptap/core' {
591
592
  interface Commands<ReturnType> {
592
593
  imageGifUpload: {
package/lib/index.d.ts CHANGED
@@ -414,6 +414,7 @@ declare interface ToolbarItemProps {
414
414
 
415
415
  declare interface ToolbarProps {
416
416
  render?: (props: ToolbarRenderProps, toolbarItems: ToolbarItemProps[], dom: any[], containerDom: (innerContent: React.ReactNode) => React.ReactNode) => React.ReactNode;
417
+ tooltipSide?: 'top' | 'bottom';
417
418
  }
418
419
 
419
420
  declare interface ToolbarRenderProps {
@@ -552,6 +553,21 @@ declare module '@tiptap/core' {
552
553
  }
553
554
 
554
555
 
556
+ declare module '@tiptap/core' {
557
+ interface Commands<ReturnType> {
558
+ iframe: {
559
+ /**
560
+ * Add an iframe
561
+ */
562
+ setIframe: (options: {
563
+ src: string;
564
+ service: string;
565
+ }) => ReturnType;
566
+ };
567
+ }
568
+ }
569
+
570
+
555
571
  declare module '@tiptap/core' {
556
572
  interface Commands<ReturnType> {
557
573
  imageUpload: {
@@ -572,21 +588,6 @@ declare module '@tiptap/core' {
572
588
  }
573
589
 
574
590
 
575
- declare module '@tiptap/core' {
576
- interface Commands<ReturnType> {
577
- iframe: {
578
- /**
579
- * Add an iframe
580
- */
581
- setIframe: (options: {
582
- src: string;
583
- service: string;
584
- }) => ReturnType;
585
- };
586
- }
587
- }
588
-
589
-
590
591
  declare module '@tiptap/core' {
591
592
  interface Commands<ReturnType> {
592
593
  imageGifUpload: {
package/lib/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { useRef as O, useState as S, useEffect as B } from "react";
2
- import { a6 as z, a7 as N } from "./RichTextEditor-BQN2eLD_.js";
3
- import { a8 as ve } from "./RichTextEditor-BQN2eLD_.js";
2
+ import { a6 as z, a7 as N } from "./RichTextEditor-KP2Rgcqe.js";
3
+ import { a8 as ve } from "./RichTextEditor-KP2Rgcqe.js";
4
4
  import { B as ke } from "./dom-dataset-Di3tIRrR.js";
5
5
  import { E as f, P as p, a as w, s as L, D as C, b, u as R, F as k, S as P, T as M, g as T, v as y, x as D, y as V, N as x, m as A, z as H } from "./index-DI9T3iLd.js";
6
6
  import { ListItem as F } from "./ListItem.js";
@@ -1198,6 +1198,21 @@ declare module '@tiptap/core' {
1198
1198
  }
1199
1199
 
1200
1200
 
1201
+ declare module '@tiptap/core' {
1202
+ interface Commands<ReturnType> {
1203
+ iframe: {
1204
+ /**
1205
+ * Add an iframe
1206
+ */
1207
+ setIframe: (options: {
1208
+ src: string;
1209
+ service: string;
1210
+ }) => ReturnType;
1211
+ };
1212
+ }
1213
+ }
1214
+
1215
+
1201
1216
  declare module '@tiptap/core' {
1202
1217
  interface Commands<ReturnType> {
1203
1218
  imageUpload: {
@@ -1218,21 +1233,6 @@ declare module '@tiptap/core' {
1218
1233
  }
1219
1234
 
1220
1235
 
1221
- declare module '@tiptap/core' {
1222
- interface Commands<ReturnType> {
1223
- iframe: {
1224
- /**
1225
- * Add an iframe
1226
- */
1227
- setIframe: (options: {
1228
- src: string;
1229
- service: string;
1230
- }) => ReturnType;
1231
- };
1232
- }
1233
- }
1234
-
1235
-
1236
1236
  declare module '@tiptap/core' {
1237
1237
  interface Commands<ReturnType> {
1238
1238
  imageGifUpload: {
@@ -1198,6 +1198,21 @@ declare module '@tiptap/core' {
1198
1198
  }
1199
1199
 
1200
1200
 
1201
+ declare module '@tiptap/core' {
1202
+ interface Commands<ReturnType> {
1203
+ iframe: {
1204
+ /**
1205
+ * Add an iframe
1206
+ */
1207
+ setIframe: (options: {
1208
+ src: string;
1209
+ service: string;
1210
+ }) => ReturnType;
1211
+ };
1212
+ }
1213
+ }
1214
+
1215
+
1201
1216
  declare module '@tiptap/core' {
1202
1217
  interface Commands<ReturnType> {
1203
1218
  imageUpload: {
@@ -1218,21 +1233,6 @@ declare module '@tiptap/core' {
1218
1233
  }
1219
1234
 
1220
1235
 
1221
- declare module '@tiptap/core' {
1222
- interface Commands<ReturnType> {
1223
- iframe: {
1224
- /**
1225
- * Add an iframe
1226
- */
1227
- setIframe: (options: {
1228
- src: string;
1229
- service: string;
1230
- }) => ReturnType;
1231
- };
1232
- }
1233
- }
1234
-
1235
-
1236
1236
  declare module '@tiptap/core' {
1237
1237
  interface Commands<ReturnType> {
1238
1238
  imageGifUpload: {
@@ -1,6 +1,6 @@
1
1
  import { jsx as i } from "react/jsx-runtime";
2
2
  import * as c from "react";
3
- import { d as o } from "./RichTextEditor-BQN2eLD_.js";
3
+ import { d as o } from "./RichTextEditor-KP2Rgcqe.js";
4
4
  const x = c.forwardRef(
5
5
  ({ className: t, ...e }, r) => /* @__PURE__ */ i(
6
6
  "textarea",
@@ -1 +1 @@
1
- "use strict";const n=require("react/jsx-runtime"),o=require("react"),a=require("./RichTextEditor-C8Sm1E6J.cjs");function s(e){const r=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const t in e)if(t!=="default"){const i=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(r,t,i.get?i:{enumerable:!0,get:()=>e[t]})}}return r.default=e,Object.freeze(r)}const u=s(o),c=u.forwardRef(({className:e,...r},t)=>n.jsx("textarea",{className:a.cn("richtext-flex richtext-min-h-[80px] richtext-w-full richtext-rounded-md !richtext-border richtext-border-input richtext-bg-background richtext-px-3 richtext-py-2 richtext-text-sm richtext-ring-offset-background placeholder:richtext-text-muted-foreground focus-visible:richtext-outline-none focus-visible:richtext-ring-2 focus-visible:richtext-ring-ring focus-visible:richtext-ring-offset-2 disabled:richtext-cursor-not-allowed disabled:richtext-opacity-50",e),ref:t,...r}));c.displayName="Textarea";exports.Textarea=c;
1
+ "use strict";const n=require("react/jsx-runtime"),o=require("react"),a=require("./RichTextEditor-DWlLqTl9.cjs");function s(e){const r=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const t in e)if(t!=="default"){const i=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(r,t,i.get?i:{enumerable:!0,get:()=>e[t]})}}return r.default=e,Object.freeze(r)}const u=s(o),c=u.forwardRef(({className:e,...r},t)=>n.jsx("textarea",{className:a.cn("richtext-flex richtext-min-h-[80px] richtext-w-full richtext-rounded-md !richtext-border richtext-border-input richtext-bg-background richtext-px-3 richtext-py-2 richtext-text-sm richtext-ring-offset-background placeholder:richtext-text-muted-foreground focus-visible:richtext-outline-none focus-visible:richtext-ring-2 focus-visible:richtext-ring-ring focus-visible:richtext-ring-offset-2 disabled:richtext-cursor-not-allowed disabled:richtext-opacity-50",e),ref:t,...r}));c.displayName="Textarea";exports.Textarea=c;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "reactjs-tiptap-editor",
3
3
  "type": "module",
4
- "version": "0.3.30",
4
+ "version": "0.3.31",
5
5
  "packageManager": "pnpm@8.15.9",
6
6
  "description": "A modern WYSIWYG rich text editor based on tiptap and shadcn ui for React",
7
7
  "license": "MIT",