reactjs-tiptap-editor 0.3.5 → 0.3.7

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 (243) hide show
  1. package/lib/{ActionMenuButton-DocMG_Xt.cjs → ActionMenuButton-CqlhqVIW.cjs} +1 -1
  2. package/lib/{ActionMenuButton-D9WfF2ep.js → ActionMenuButton-DXwpQHj4.js} +1 -1
  3. package/lib/Attachment.cjs +1 -1
  4. package/lib/Attachment.d.cts +13 -13
  5. package/lib/Attachment.d.ts +13 -13
  6. package/lib/Attachment.js +3 -3
  7. package/lib/Blockquote.cjs +1 -1
  8. package/lib/Blockquote.d.cts +13 -13
  9. package/lib/Blockquote.d.ts +13 -13
  10. package/lib/Blockquote.js +2 -2
  11. package/lib/Bold.cjs +1 -1
  12. package/lib/Bold.d.cts +13 -13
  13. package/lib/Bold.d.ts +13 -13
  14. package/lib/Bold.js +2 -2
  15. package/lib/BulletList.cjs +1 -1
  16. package/lib/BulletList.d.cts +13 -13
  17. package/lib/BulletList.d.ts +13 -13
  18. package/lib/BulletList.js +2 -2
  19. package/lib/Clear.cjs +1 -1
  20. package/lib/Clear.d.cts +13 -13
  21. package/lib/Clear.d.ts +13 -13
  22. package/lib/Clear.js +2 -2
  23. package/lib/Code.cjs +1 -1
  24. package/lib/Code.d.cts +13 -13
  25. package/lib/Code.d.ts +13 -13
  26. package/lib/Code.js +2 -2
  27. package/lib/CodeBlock.cjs +1 -1
  28. package/lib/CodeBlock.d.cts +13 -13
  29. package/lib/CodeBlock.d.ts +13 -13
  30. package/lib/CodeBlock.js +3 -3
  31. package/lib/CodeView.cjs +1 -1
  32. package/lib/CodeView.d.cts +13 -13
  33. package/lib/CodeView.d.ts +13 -13
  34. package/lib/CodeView.js +2 -2
  35. package/lib/Color.cjs +1 -1
  36. package/lib/Color.d.cts +13 -13
  37. package/lib/Color.d.ts +13 -13
  38. package/lib/Color.js +3 -3
  39. package/lib/Document.cjs +1 -1
  40. package/lib/Document.d.cts +13 -13
  41. package/lib/Document.d.ts +13 -13
  42. package/lib/Document.js +1 -1
  43. package/lib/{Drawer-DdyndCxA.js → Drawer-B6uGc4Ab.js} +3 -3
  44. package/lib/{Drawer-C6yrcHc7.cjs → Drawer-DBt_aN5x.cjs} +1 -1
  45. package/lib/Drawer.cjs +1 -1
  46. package/lib/Drawer.d.cts +13 -13
  47. package/lib/Drawer.d.ts +13 -13
  48. package/lib/Drawer.js +4 -4
  49. package/lib/Emoji.cjs +1 -1
  50. package/lib/Emoji.d.cts +13 -13
  51. package/lib/Emoji.d.ts +13 -13
  52. package/lib/Emoji.js +4 -4
  53. package/lib/{Excalidraw-D5qXWfKq.js → Excalidraw-Bp252YTN.js} +3 -3
  54. package/lib/{Excalidraw-BS6_3xHm.cjs → Excalidraw-CYLyPnI4.cjs} +1 -1
  55. package/lib/Excalidraw.cjs +1 -1
  56. package/lib/Excalidraw.d.cts +13 -13
  57. package/lib/Excalidraw.d.ts +13 -13
  58. package/lib/Excalidraw.js +3 -3
  59. package/lib/ExportPdf.cjs +1 -1
  60. package/lib/ExportPdf.d.cts +13 -13
  61. package/lib/ExportPdf.d.ts +13 -13
  62. package/lib/ExportPdf.js +2 -2
  63. package/lib/ExportWord.cjs +1 -1
  64. package/lib/ExportWord.d.cts +13 -13
  65. package/lib/ExportWord.d.ts +13 -13
  66. package/lib/ExportWord.js +2 -2
  67. package/lib/FontFamily.cjs +1 -1
  68. package/lib/FontFamily.d.cts +13 -13
  69. package/lib/FontFamily.d.ts +13 -13
  70. package/lib/FontFamily.js +4 -4
  71. package/lib/FontSize.cjs +1 -1
  72. package/lib/FontSize.d.cts +13 -13
  73. package/lib/FontSize.d.ts +13 -13
  74. package/lib/FontSize.js +3 -3
  75. package/lib/FormatPainter.cjs +1 -1
  76. package/lib/FormatPainter.d.cts +13 -13
  77. package/lib/FormatPainter.d.ts +13 -13
  78. package/lib/FormatPainter.js +2 -2
  79. package/lib/Heading.cjs +1 -1
  80. package/lib/Heading.d.cts +13 -13
  81. package/lib/Heading.d.ts +13 -13
  82. package/lib/Heading.js +3 -3
  83. package/lib/Highlight.cjs +1 -1
  84. package/lib/Highlight.d.cts +13 -13
  85. package/lib/Highlight.d.ts +13 -13
  86. package/lib/Highlight.js +2 -2
  87. package/lib/History.cjs +1 -1
  88. package/lib/History.d.cts +13 -13
  89. package/lib/History.d.ts +13 -13
  90. package/lib/History.js +2 -2
  91. package/lib/HorizontalRule.cjs +1 -1
  92. package/lib/HorizontalRule.d.cts +13 -13
  93. package/lib/HorizontalRule.d.ts +13 -13
  94. package/lib/HorizontalRule.js +10 -8
  95. package/lib/Iframe.cjs +1 -1
  96. package/lib/Iframe.d.cts +13 -13
  97. package/lib/Iframe.d.ts +13 -13
  98. package/lib/Iframe.js +3 -3
  99. package/lib/Image.cjs +1 -1
  100. package/lib/Image.d.cts +13 -13
  101. package/lib/Image.d.ts +13 -13
  102. package/lib/Image.js +3 -3
  103. package/lib/ImageGif.cjs +1 -1
  104. package/lib/ImageGif.d.cts +13 -13
  105. package/lib/ImageGif.d.ts +13 -13
  106. package/lib/ImageGif.js +3 -3
  107. package/lib/ImportWord.cjs +2 -2
  108. package/lib/ImportWord.d.cts +13 -13
  109. package/lib/ImportWord.d.ts +13 -13
  110. package/lib/ImportWord.js +4 -4
  111. package/lib/Indent.cjs +1 -1
  112. package/lib/Indent.d.cts +13 -13
  113. package/lib/Indent.d.ts +13 -13
  114. package/lib/Indent.js +2 -2
  115. package/lib/Italic.cjs +1 -1
  116. package/lib/Italic.d.cts +13 -13
  117. package/lib/Italic.d.ts +13 -13
  118. package/lib/Italic.js +2 -2
  119. package/lib/Katex.cjs +1 -1
  120. package/lib/Katex.d.cts +13 -13
  121. package/lib/Katex.d.ts +13 -13
  122. package/lib/Katex.js +4 -4
  123. package/lib/LineHeight.cjs +1 -1
  124. package/lib/LineHeight.d.cts +13 -13
  125. package/lib/LineHeight.d.ts +13 -13
  126. package/lib/LineHeight.js +2 -2
  127. package/lib/Link.cjs +1 -1
  128. package/lib/Link.d.cts +13 -13
  129. package/lib/Link.d.ts +13 -13
  130. package/lib/Link.js +2 -2
  131. package/lib/ListItem.cjs +1 -1
  132. package/lib/ListItem.d.cts +13 -13
  133. package/lib/ListItem.d.ts +13 -13
  134. package/lib/ListItem.js +1 -1
  135. package/lib/Mention.cjs +1 -1
  136. package/lib/Mention.d.cts +13 -13
  137. package/lib/Mention.d.ts +13 -13
  138. package/lib/Mention.js +3 -3
  139. package/lib/Mermaid.cjs +1 -1
  140. package/lib/Mermaid.d.cts +13 -13
  141. package/lib/Mermaid.d.ts +13 -13
  142. package/lib/Mermaid.js +16 -16
  143. package/lib/MoreMark.cjs +1 -1
  144. package/lib/MoreMark.d.cts +13 -13
  145. package/lib/MoreMark.d.ts +13 -13
  146. package/lib/MoreMark.js +3 -3
  147. package/lib/MultiColumn.cjs +1 -1
  148. package/lib/MultiColumn.d.cts +13 -13
  149. package/lib/MultiColumn.d.ts +13 -13
  150. package/lib/MultiColumn.js +2 -2
  151. package/lib/OrderedList.cjs +1 -1
  152. package/lib/OrderedList.d.cts +13 -13
  153. package/lib/OrderedList.d.ts +13 -13
  154. package/lib/OrderedList.js +2 -2
  155. package/lib/{RichTextEditor-DS30aD8t.js → RichTextEditor-BfYZYQb9.js} +899 -905
  156. package/lib/RichTextEditor-Db6oQoYY.cjs +137 -0
  157. package/lib/SearchAndReplace.cjs +1 -1
  158. package/lib/SearchAndReplace.d.cts +13 -13
  159. package/lib/SearchAndReplace.d.ts +13 -13
  160. package/lib/SearchAndReplace.js +2 -2
  161. package/lib/Selection.cjs +1 -1
  162. package/lib/Selection.d.cts +13 -13
  163. package/lib/Selection.d.ts +13 -13
  164. package/lib/Selection.js +1 -1
  165. package/lib/SlashCommand.cjs +1 -1
  166. package/lib/SlashCommand.d.cts +13 -13
  167. package/lib/SlashCommand.d.ts +13 -13
  168. package/lib/SlashCommand.js +4 -4
  169. package/lib/Strike.cjs +1 -1
  170. package/lib/Strike.d.cts +13 -13
  171. package/lib/Strike.d.ts +13 -13
  172. package/lib/Strike.js +2 -2
  173. package/lib/SubAndSuperScript.cjs +1 -1
  174. package/lib/SubAndSuperScript.d.cts +13 -13
  175. package/lib/SubAndSuperScript.d.ts +13 -13
  176. package/lib/SubAndSuperScript.js +3 -3
  177. package/lib/Table.cjs +1 -1
  178. package/lib/Table.d.cts +13 -13
  179. package/lib/Table.d.ts +13 -13
  180. package/lib/Table.js +15 -15
  181. package/lib/TableOfContent.cjs +1 -1
  182. package/lib/TableOfContent.d.cts +13 -13
  183. package/lib/TableOfContent.d.ts +13 -13
  184. package/lib/TableOfContent.js +3 -3
  185. package/lib/TaskList.cjs +1 -1
  186. package/lib/TaskList.d.cts +13 -13
  187. package/lib/TaskList.d.ts +13 -13
  188. package/lib/TaskList.js +2 -2
  189. package/lib/TextAlign.cjs +1 -1
  190. package/lib/TextAlign.d.cts +13 -13
  191. package/lib/TextAlign.d.ts +13 -13
  192. package/lib/TextAlign.js +47 -46
  193. package/lib/TextBubble.cjs +1 -1
  194. package/lib/TextBubble.d.cts +13 -13
  195. package/lib/TextBubble.d.ts +13 -13
  196. package/lib/TextBubble.js +2 -2
  197. package/lib/TextDirection.cjs +1 -1
  198. package/lib/TextDirection.d.cts +13 -13
  199. package/lib/TextDirection.d.ts +13 -13
  200. package/lib/TextDirection.js +2 -2
  201. package/lib/TextUnderline.cjs +1 -1
  202. package/lib/TextUnderline.d.cts +13 -13
  203. package/lib/TextUnderline.d.ts +13 -13
  204. package/lib/TextUnderline.js +2 -2
  205. package/lib/TrailingNode.cjs +1 -1
  206. package/lib/TrailingNode.d.cts +13 -13
  207. package/lib/TrailingNode.d.ts +13 -13
  208. package/lib/TrailingNode.js +1 -1
  209. package/lib/{Twitter-VKMhfUTN.js → Twitter-CZA9dXpC.js} +44 -44
  210. package/lib/{Twitter-Dwmo5UJ-.cjs → Twitter-DLO12QnF.cjs} +1 -1
  211. package/lib/Twitter.cjs +1 -1
  212. package/lib/Twitter.d.cts +13 -13
  213. package/lib/Twitter.d.ts +13 -13
  214. package/lib/Twitter.js +3 -3
  215. package/lib/Video.cjs +1 -1
  216. package/lib/Video.d.cts +13 -13
  217. package/lib/Video.d.ts +13 -13
  218. package/lib/Video.js +2 -2
  219. package/lib/bubble-extra.cjs +1 -1
  220. package/lib/bubble-extra.d.cts +13 -13
  221. package/lib/bubble-extra.d.ts +13 -13
  222. package/lib/bubble-extra.js +6 -6
  223. package/lib/{dom-dataset-pKb7TLlt.js → dom-dataset-2RXYq9wp.js} +397 -376
  224. package/lib/dom-dataset-DmsCLv1q.cjs +33 -0
  225. package/lib/{index-BaTWsqZj.js → index-BGwJ0NfQ.js} +1 -1
  226. package/lib/{index-Dk3tSDmG.js → index-BkoojfPK.js} +1 -1
  227. package/lib/{index-COecBbaE.cjs → index-CSvnpArE.cjs} +11 -11
  228. package/lib/{index-DEe_Svay.js → index-CXIIg9Sq.js} +676 -644
  229. package/lib/{index-DjP7Onch.cjs → index-CrxasX7b.cjs} +1 -1
  230. package/lib/{index-CySbCeQd.cjs → index-Cyh1yoFk.cjs} +1 -1
  231. package/lib/{index-DCFzuS5p.js → index-fKx6CYUM.js} +1 -1
  232. package/lib/{index-ClFtfQ0J.cjs → index-h9_SDuwc.cjs} +1 -1
  233. package/lib/index.cjs +1 -1
  234. package/lib/index.d.cts +13 -13
  235. package/lib/index.d.ts +13 -13
  236. package/lib/index.js +27 -27
  237. package/lib/locale-bundle.d.cts +13 -13
  238. package/lib/locale-bundle.d.ts +13 -13
  239. package/lib/{textarea-DITg4shx.js → textarea-BUlQB7hI.js} +1 -1
  240. package/lib/{textarea-I3qcfzYg.cjs → textarea-ILk3QoYy.cjs} +1 -1
  241. package/package.json +71 -71
  242. package/lib/RichTextEditor-CFS3E6GK.cjs +0 -137
  243. package/lib/dom-dataset-CAXnsjYE.cjs +0 -33
package/lib/Emoji.d.ts CHANGED
@@ -250,14 +250,15 @@ declare module '@tiptap/core' {
250
250
 
251
251
  declare module '@tiptap/core' {
252
252
  interface Commands<ReturnType> {
253
- twitter: {
253
+ video: {
254
254
  /**
255
- * Insert a tweet
256
- * @param options The tweet attributes
257
- * @example editor.commands.setTweet({ src: 'https://x.com/seanpk/status/1800145949580517852' })
255
+ * Add an video
258
256
  */
259
- setTweet: (options: SetTweetOptions) => ReturnType;
260
- updateTweet: (options: SetTweetOptions) => ReturnType;
257
+ setVideo: (options: Partial<SetVideoOptions>) => ReturnType;
258
+ /**
259
+ * Update an video
260
+ */
261
+ updateVideo: (options: Partial<SetVideoOptions>) => ReturnType;
261
262
  };
262
263
  }
263
264
  }
@@ -265,15 +266,14 @@ declare module '@tiptap/core' {
265
266
 
266
267
  declare module '@tiptap/core' {
267
268
  interface Commands<ReturnType> {
268
- video: {
269
- /**
270
- * Add an video
271
- */
272
- setVideo: (options: Partial<SetVideoOptions>) => ReturnType;
269
+ twitter: {
273
270
  /**
274
- * Update an video
271
+ * Insert a tweet
272
+ * @param options The tweet attributes
273
+ * @example editor.commands.setTweet({ src: 'https://x.com/seanpk/status/1800145949580517852' })
275
274
  */
276
- updateVideo: (options: Partial<SetVideoOptions>) => ReturnType;
275
+ setTweet: (options: SetTweetOptions) => ReturnType;
276
+ updateTweet: (options: SetTweetOptions) => ReturnType;
277
277
  };
278
278
  }
279
279
  }
package/lib/Emoji.js CHANGED
@@ -1,10 +1,10 @@
1
- import { a as f, N as k } from "./index-DEe_Svay.js";
2
- import { c as y, a as x } from "./dom-dataset-pKb7TLlt.js";
3
- import { S as v } from "./index-DCFzuS5p.js";
1
+ import { a as f, N as k } from "./index-CXIIg9Sq.js";
2
+ import { c as y, a as x } from "./dom-dataset-2RXYq9wp.js";
3
+ import { S as v } from "./index-fKx6CYUM.js";
4
4
  import j from "tippy.js";
5
5
  import { jsx as i, jsxs as l, Fragment as z } from "react/jsx-runtime";
6
6
  import { useCallback as q, forwardRef as E, useRef as N, useState as P, useEffect as u, useImperativeHandle as C } from "react";
7
- import { d as m, A as R, P as S, m as I, n as A } from "./RichTextEditor-DS30aD8t.js";
7
+ import { d as m, A as R, P as S, m as I, n as A } from "./RichTextEditor-BfYZYQb9.js";
8
8
  import { EmojiPicker as _ } from "frimousse";
9
9
  import { SearchIcon as H, LoaderIcon as T } from "lucide-react";
10
10
  import L from "scroll-into-view-if-needed";
@@ -1,8 +1,8 @@
1
- import { N as at, n as st, m as lt } from "./index-DEe_Svay.js";
2
- import { N as ut, c as q, R as ct, n as ft, g as $ } from "./dom-dataset-pKb7TLlt.js";
1
+ import { N as at, n as st, m as lt } from "./index-CXIIg9Sq.js";
2
+ import { N as ut, c as q, R as ct, n as ft, g as $ } from "./dom-dataset-2RXYq9wp.js";
3
3
  import { jsxs as B, jsx as g } from "react/jsx-runtime";
4
4
  import it, { useState as O, useCallback as I, useEffect as G, useRef as pt } from "react";
5
- import { w as dt, x as ht, A as Y, y as mt, z as bt, F as gt, B as yt, a2 as vt, p as _t, K as wt } from "./RichTextEditor-DS30aD8t.js";
5
+ import { w as dt, x as ht, A as Y, y as mt, z as bt, F as gt, B as yt, a2 as vt, p as _t, K as wt } from "./RichTextEditor-BfYZYQb9.js";
6
6
  import { n as Et } from "./index-D-DR0FPY.js";
7
7
  import { Resizable as Tt } from "re-resizable";
8
8
  import Ot from "react-dom";
@@ -1 +1 @@
1
- "use strict";var ot=Object.create;var Y=Object.defineProperty;var at=Object.getOwnPropertyDescriptor;var st=Object.getOwnPropertyNames;var lt=Object.getPrototypeOf,ut=Object.prototype.hasOwnProperty;var ct=(o,c,x,w)=>{if(c&&typeof c=="object"||typeof c=="function")for(let u of st(c))!ut.call(o,u)&&u!==x&&Y(o,u,{get:()=>c[u],enumerable:!(w=at(c,u))||w.enumerable});return o};var J=(o,c,x)=>(x=o!=null?ot(lt(o)):{},ct(c||!o||!o.__esModule?Y(x,"default",{value:o,enumerable:!0}):x,o));const K=require("./index-COecBbaE.cjs"),W=require("./dom-dataset-CAXnsjYE.cjs"),p=require("react/jsx-runtime"),b=require("react"),O=require("./RichTextEditor-CFS3E6GK.cjs"),ft=require("./index-Dz3YxLE7.cjs"),pt=require("re-resizable"),dt=require("react-dom");let q;function G(){try{return q||(q=ft.mitt()),q}catch{throw new Error("Error EventEmitter")}}const X="OPEN_EXCALIDRAW_SETTING_MODAL";function ht(o,c){G().on(o,c)}function bt(o,c){G().off(o,c)}function gt(o){G().emit(X,o)}const mt=({editor:o})=>{const[c,x]=b.useState(null),[w,u]=b.useState({}),[d,n]=b.useState({elements:[],appState:{isLoading:!1},files:null}),[e,r]=b.useState(!1),[g,l]=b.useState(!0),[y,i]=b.useState(null),R=b.useCallback(E=>{E&&import("@excalidraw/excalidraw").then(S=>{x(S.Excalidraw)}).catch(i).finally(()=>l(!1))},[l]),L=b.useCallback(E=>{setTimeout(()=>{E.refresh()})},[]),C=b.useCallback((E,S,M)=>{u({elements:E,appState:{isLoading:!1},files:M})},[]),V=b.useCallback(()=>{if(!c){r(!1);return}o.chain().focus().setExcalidraw({data:w}).run(),r(!1)},[c,o,w,r]);return b.useEffect(()=>{const E=S=>{r(!0),S&&n(S.data)};return ht(X,E),()=>{bt(X,E)}},[o,r]),p.jsxs(O.Dialog,{onOpenChange:r,open:e,children:[p.jsx(O.DialogTrigger,{asChild:!0,children:p.jsx(O.ActionButton,{action:()=>r(!0),icon:"Excalidraw",tooltip:"Excalidraw"})}),p.jsxs(O.DialogContent,{className:"richtext-z-[99999] !richtext-max-w-[1300px]",children:[p.jsx(O.DialogTitle,{children:"Excalidraw"}),p.jsxs("div",{style:{height:"100%",borderWidth:1},children:[g&&p.jsx("p",{children:"Loading..."}),y&&p.jsx("p",{children:y&&y.message||"Error"}),p.jsx("div",{ref:R,style:{width:"100%",height:600},children:!g&&!y&&c?p.jsx(c,{initialData:d,langCode:"en",onChange:C,ref:L}):null})]}),p.jsx(O.DialogFooter,{children:p.jsx(O.Button,{onClick:V,type:"button",children:"Save changes"})})]})]})};var H={exports:{}},yt=H.exports,Q;function vt(){return Q||(Q=1,function(o,c){(function(w,u){o.exports=u(b,dt)})(yt,function(x,w){return function(u){var d={};function n(e){if(d[e])return d[e].exports;var r=d[e]={i:e,l:!1,exports:{}};return u[e].call(r.exports,r,r.exports,n),r.l=!0,r.exports}return n.m=u,n.c=d,n.d=function(e,r,g){n.o(e,r)||Object.defineProperty(e,r,{enumerable:!0,get:g})},n.r=function(e){typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,r){if(r&1&&(e=n(e)),r&8||r&4&&typeof e=="object"&&e&&e.__esModule)return e;var g=Object.create(null);if(n.r(g),Object.defineProperty(g,"default",{enumerable:!0,value:e}),r&2&&typeof e!="string")for(var l in e)n.d(g,l,(function(y){return e[y]}).bind(null,l));return g},n.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(r,"a",r),r},n.o=function(e,r){return Object.prototype.hasOwnProperty.call(e,r)},n.p="",n(n.s=4)}([function(u,d,n){u.exports=n(5)()},function(u,d){u.exports=x},function(u,d){u.exports=w},function(u,d){u.exports=function(n,e,r){var g=n.direction,l=n.value;switch(g){case"top":return r.top+l<e.top&&r.bottom>e.bottom&&r.left<e.left&&r.right>e.right;case"left":return r.left+l<e.left&&r.bottom>e.bottom&&r.top<e.top&&r.right>e.right;case"bottom":return r.bottom-l>e.bottom&&r.left<e.left&&r.right>e.right&&r.top<e.top;case"right":return r.right-l>e.right&&r.left<e.left&&r.top<e.top&&r.bottom>e.bottom}}},function(u,d,n){n.r(d),n.d(d,"default",function(){return Z});var e=n(1),r=n.n(e),g=n(2),l=n.n(g),y=n(0),i=n.n(y),R=n(3),L=n.n(R);function C(a){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?C=function(f){return typeof f}:C=function(f){return f&&typeof Symbol=="function"&&f.constructor===Symbol&&f!==Symbol.prototype?"symbol":typeof f},C(a)}function V(a,s){if(!(a instanceof s))throw new TypeError("Cannot call a class as a function")}function E(a,s){for(var f=0;f<s.length;f++){var t=s[f];t.enumerable=t.enumerable||!1,t.configurable=!0,"value"in t&&(t.writable=!0),Object.defineProperty(a,t.key,t)}}function S(a,s,f){return s&&E(a.prototype,s),a}function M(a,s){return s&&(C(s)==="object"||typeof s=="function")?s:h(a)}function N(a){return N=Object.setPrototypeOf?Object.getPrototypeOf:function(f){return f.__proto__||Object.getPrototypeOf(f)},N(a)}function h(a){if(a===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return a}function D(a,s){if(typeof s!="function"&&s!==null)throw new TypeError("Super expression must either be null or a function");a.prototype=Object.create(s&&s.prototype,{constructor:{value:a,writable:!0,configurable:!0}}),s&&j(a,s)}function j(a,s){return j=Object.setPrototypeOf||function(t,T){return t.__proto__=T,t},j(a,s)}function P(a,s,f){return s in a?Object.defineProperty(a,s,{value:f,enumerable:!0,configurable:!0,writable:!0}):a[s]=f,a}function it(a){return a.width===void 0&&(a.width=a.right-a.left),a.height===void 0&&(a.height=a.bottom-a.top),a}var Z=function(a){D(s,a);function s(f){var t;return V(this,s),t=M(this,N(s).call(this,f)),P(h(t),"getContainer",function(){return t.props.containment||window}),P(h(t),"addEventListener",function(T,m,v,I){t.debounceCheck||(t.debounceCheck={});var _,z,k=function(){_=null,t.check()};I>-1?z=function(){_||(_=setTimeout(k,I||0))}:z=function(){clearTimeout(_),_=setTimeout(k,v||0)};var U={target:T,fn:z,getLastTimeout:function(){return _}};T.addEventListener(m,U.fn),t.debounceCheck[m]=U}),P(h(t),"startWatching",function(){t.debounceCheck||t.interval||(t.props.intervalCheck&&(t.interval=setInterval(t.check,t.props.intervalDelay)),t.props.scrollCheck&&t.addEventListener(t.getContainer(),"scroll",t.props.scrollDelay,t.props.scrollThrottle),t.props.resizeCheck&&t.addEventListener(window,"resize",t.props.resizeDelay,t.props.resizeThrottle),!t.props.delayedCall&&t.check())}),P(h(t),"stopWatching",function(){if(t.debounceCheck){for(var T in t.debounceCheck)if(t.debounceCheck.hasOwnProperty(T)){var m=t.debounceCheck[T];clearTimeout(m.getLastTimeout()),m.target.removeEventListener(T,m.fn),t.debounceCheck[T]=null}}t.debounceCheck=null,t.interval&&(t.interval=clearInterval(t.interval))}),P(h(t),"check",function(){var T=t.node,m,v;if(!T)return t.state;if(m=it(t.roundRectDown(T.getBoundingClientRect())),t.props.containment){var I=t.props.containment.getBoundingClientRect();v={top:I.top,left:I.left,bottom:I.bottom,right:I.right}}else v={top:0,left:0,bottom:window.innerHeight||document.documentElement.clientHeight,right:window.innerWidth||document.documentElement.clientWidth};var _=t.props.offset||{},z=C(_)==="object";z&&(v.top+=_.top||0,v.left+=_.left||0,v.bottom-=_.bottom||0,v.right-=_.right||0);var k={top:m.top>=v.top,left:m.left>=v.left,bottom:m.bottom<=v.bottom,right:m.right<=v.right},U=m.height>0&&m.width>0,A=U&&k.top&&k.left&&k.bottom&&k.right;if(U&&t.props.partialVisibility){var $=m.top<=v.bottom&&m.bottom>=v.top&&m.left<=v.right&&m.right>=v.left;typeof t.props.partialVisibility=="string"&&($=k[t.props.partialVisibility]),A=t.props.minTopValue?$&&m.top<=v.bottom-t.props.minTopValue:$}typeof _.direction=="string"&&typeof _.value=="number"&&(console.warn("[notice] offset.direction and offset.value have been deprecated. They still work for now, but will be removed in next major version. Please upgrade to the new syntax: { %s: %d }",_.direction,_.value),A=L()(_,m,v));var F=t.state;return t.state.isVisible!==A&&(F={isVisible:A,visibilityRect:k},t.setState(F),t.props.onChange&&t.props.onChange(A)),F}),t.state={isVisible:null,visibilityRect:{}},t}return S(s,[{key:"componentDidMount",value:function(){this.node=l.a.findDOMNode(this),this.props.active&&this.startWatching()}},{key:"componentWillUnmount",value:function(){this.stopWatching()}},{key:"componentDidUpdate",value:function(t){this.node=l.a.findDOMNode(this),this.props.active&&!t.active?(this.setState({isVisible:null,visibilityRect:{}}),this.startWatching()):this.props.active||this.stopWatching()}},{key:"roundRectDown",value:function(t){return{top:Math.floor(t.top),left:Math.floor(t.left),bottom:Math.floor(t.bottom),right:Math.floor(t.right)}}},{key:"render",value:function(){return this.props.children instanceof Function?this.props.children({isVisible:this.state.isVisible,visibilityRect:this.state.visibilityRect}):r.a.Children.only(this.props.children)}}]),s}(r.a.Component);P(Z,"defaultProps",{active:!0,partialVisibility:!1,minTopValue:0,scrollCheck:!1,scrollDelay:250,scrollThrottle:-1,resizeCheck:!1,resizeDelay:250,resizeThrottle:-1,intervalCheck:!0,intervalDelay:100,delayedCall:!1,offset:{},containment:null,children:r.a.createElement("span",null)}),P(Z,"propTypes",{onChange:i.a.func,active:i.a.bool,partialVisibility:i.a.oneOfType([i.a.bool,i.a.oneOf(["top","right","bottom","left"])]),delayedCall:i.a.bool,offset:i.a.oneOfType([i.a.shape({top:i.a.number,left:i.a.number,bottom:i.a.number,right:i.a.number}),i.a.shape({direction:i.a.oneOf(["top","right","bottom","left"]),value:i.a.number})]),scrollCheck:i.a.bool,scrollDelay:i.a.number,scrollThrottle:i.a.number,resizeCheck:i.a.bool,resizeDelay:i.a.number,resizeThrottle:i.a.number,intervalCheck:i.a.bool,intervalDelay:i.a.number,containment:typeof window<"u"?i.a.instanceOf(window.Element):i.a.any,children:i.a.oneOfType([i.a.element,i.a.func]),minTopValue:i.a.number})},function(u,d,n){var e=n(6);function r(){}function g(){}g.resetWarningCache=r,u.exports=function(){function l(R,L,C,V,E,S){if(S!==e){var M=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw M.name="Invariant Violation",M}}l.isRequired=l;function y(){return l}var i={array:l,bool:l,func:l,number:l,object:l,string:l,symbol:l,any:l,arrayOf:y,element:l,elementType:l,instanceOf:y,node:l,objectOf:y,oneOf:y,oneOfType:y,shape:y,exact:y,checkPropTypes:g,resetWarningCache:r};return i.PropTypes=i,i}},function(u,d,n){var e="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";u.exports=e}])})}(H)),H.exports}var _t=vt();const xt=O.getDefaultExportFromCjs(_t),wt="_wrap_15k3c_1",Et="_renderWrap_15k3c_7",Tt="_title_15k3c_14",Ot="_handlerWrap_15k3c_30",B={wrap:wt,renderWrap:Et,title:Tt,handlerWrap:Ot},Ct=10,St=200,tt=15,et={width:"100%",height:"100%",maxWidth:"100%"};function Dt({editor:o,node:c,updateAttributes:x}){const w=b.useRef(null),u=o.isActive(nt.name),{data:d,width:n,height:e}=c.attrs,[r,g]=b.useState(null),[l,y]=b.useState(!0),[i,R]=b.useState(null),[L,C]=b.useState(!1),[V,E]=b.useState(100),S=b.useCallback(h=>{h&&C(!0)},[C]),M=b.useCallback(h=>()=>{E(D=>O.clamp(h==="minus"?D-tt:D+tt,Ct,St))},[]);b.useEffect(()=>{let h=!1;return import("@excalidraw/excalidraw").then(D=>{h||(w.current=D.exportToSvg)}).catch(D=>!h&&R(D)).finally(()=>!h&&y(!1)),()=>{h=!0}},[y,d]),b.useEffect(()=>{let h=!1;return(async()=>{if(h||l||i||!L||!d)return;const j=await w.current(d);h||(j.setAttribute("width","100%"),j.setAttribute("height","100%"),j.setAttribute("display","block"),g(j))})(),()=>{h=!0}},[d,l,i,L]);const N=h=>{x({width:h.width,height:h.height})};return p.jsx(W.NodeViewWrapper,{className:W.clsx(B.wrap,u&&B.isActive),children:p.jsx(xt,{onChange:S,children:p.jsx(pt.Resizable,{size:{width:Number.parseInt(n),height:Number.parseInt(e)},onResizeStop:(h,D,j,P)=>{N({width:Number.parseInt(n)+P.width,height:Number.parseInt(e)+P.height})},children:p.jsxs("div",{className:W.clsx(B.renderWrap,"render-wrapper"),style:{...et,overflow:"hidden"},children:[i&&p.jsx("div",{style:et,children:p.jsx("p",{children:i.message||i})}),l&&p.jsx("p",{children:"Loading..."}),!l&&!i&&L&&p.jsx("div",{dangerouslySetInnerHTML:{__html:(r==null?void 0:r.outerHTML)??""},style:{height:"100%",maxHeight:"100%",padding:24,overflow:"hidden",display:"flex",justifyContent:"center",alignItems:"center",transform:`scale(${V/100})`,transition:"all ease-in-out .3s"}}),p.jsx("div",{className:B.title}),p.jsxs("div",{className:B.handlerWrap,children:[p.jsx(O.ActionButton,{action:M("minus"),icon:"ZoomOut",tooltip:"Zoom Out"}),p.jsx(O.ActionButton,{action:M("plus"),icon:"ZoomIn",tooltip:"Zoom In"})]})]})})})})}const Pt=b.memo(Dt,(o,c)=>!!O.deepEqual(o.node.attrs,c.node.attrs)),rt={elements:[]},nt=K.Node.create({name:"excalidraw",group:"block",selectable:!0,atom:!0,draggable:!0,inline:!1,addAttributes(){return{defaultShowPicker:{default:!1},createUser:{default:null},width:{default:"100%",parseHTML:W.getDatasetAttribute("width")},height:{default:240,parseHTML:W.getDatasetAttribute("height")},data:{default:rt,parseHTML:W.getDatasetAttribute("data",!0)}}},addOptions(){var o;return{...(o=this.parent)==null?void 0:o.call(this),HTMLAttributes:{class:"excalidraw"},button:({editor:c})=>({component:mt,componentProps:{editor:c}})}},parseHTML(){return[{tag:"div[class=excalidraw]"}]},renderHTML({HTMLAttributes:o,node:c}){return["div",K.mergeAttributes(this.options.HTMLAttributes,o,W.nodeAttrsToDataset(c))]},addCommands(){return{setExcalidraw:o=>({tr:c,commands:x,chain:w})=>{var u,d,n;return o=o||{},o.data=o.data||rt,((n=(d=(u=c.selection)==null?void 0:u.node)==null?void 0:d.type)==null?void 0:n.name)==this.name?x.updateAttributes(this.name,o):w().insertContent({type:this.name,attrs:o}).run()}}},addNodeView(){return W.ReactNodeViewRenderer(Pt)},addInputRules(){return[K.nodeInputRule({find:/^\$excalidraw\$$/,type:this.type,getAttributes:()=>({width:"100%"})})]}});exports.Excalidraw=nt;exports.triggerOpenExcalidrawSettingModal=gt;
1
+ "use strict";var ot=Object.create;var Y=Object.defineProperty;var at=Object.getOwnPropertyDescriptor;var st=Object.getOwnPropertyNames;var lt=Object.getPrototypeOf,ut=Object.prototype.hasOwnProperty;var ct=(o,c,x,w)=>{if(c&&typeof c=="object"||typeof c=="function")for(let u of st(c))!ut.call(o,u)&&u!==x&&Y(o,u,{get:()=>c[u],enumerable:!(w=at(c,u))||w.enumerable});return o};var J=(o,c,x)=>(x=o!=null?ot(lt(o)):{},ct(c||!o||!o.__esModule?Y(x,"default",{value:o,enumerable:!0}):x,o));const K=require("./index-CSvnpArE.cjs"),W=require("./dom-dataset-DmsCLv1q.cjs"),p=require("react/jsx-runtime"),b=require("react"),O=require("./RichTextEditor-Db6oQoYY.cjs"),ft=require("./index-Dz3YxLE7.cjs"),pt=require("re-resizable"),dt=require("react-dom");let q;function G(){try{return q||(q=ft.mitt()),q}catch{throw new Error("Error EventEmitter")}}const X="OPEN_EXCALIDRAW_SETTING_MODAL";function ht(o,c){G().on(o,c)}function bt(o,c){G().off(o,c)}function gt(o){G().emit(X,o)}const mt=({editor:o})=>{const[c,x]=b.useState(null),[w,u]=b.useState({}),[d,n]=b.useState({elements:[],appState:{isLoading:!1},files:null}),[e,r]=b.useState(!1),[g,l]=b.useState(!0),[y,i]=b.useState(null),R=b.useCallback(E=>{E&&import("@excalidraw/excalidraw").then(S=>{x(S.Excalidraw)}).catch(i).finally(()=>l(!1))},[l]),L=b.useCallback(E=>{setTimeout(()=>{E.refresh()})},[]),C=b.useCallback((E,S,M)=>{u({elements:E,appState:{isLoading:!1},files:M})},[]),V=b.useCallback(()=>{if(!c){r(!1);return}o.chain().focus().setExcalidraw({data:w}).run(),r(!1)},[c,o,w,r]);return b.useEffect(()=>{const E=S=>{r(!0),S&&n(S.data)};return ht(X,E),()=>{bt(X,E)}},[o,r]),p.jsxs(O.Dialog,{onOpenChange:r,open:e,children:[p.jsx(O.DialogTrigger,{asChild:!0,children:p.jsx(O.ActionButton,{action:()=>r(!0),icon:"Excalidraw",tooltip:"Excalidraw"})}),p.jsxs(O.DialogContent,{className:"richtext-z-[99999] !richtext-max-w-[1300px]",children:[p.jsx(O.DialogTitle,{children:"Excalidraw"}),p.jsxs("div",{style:{height:"100%",borderWidth:1},children:[g&&p.jsx("p",{children:"Loading..."}),y&&p.jsx("p",{children:y&&y.message||"Error"}),p.jsx("div",{ref:R,style:{width:"100%",height:600},children:!g&&!y&&c?p.jsx(c,{initialData:d,langCode:"en",onChange:C,ref:L}):null})]}),p.jsx(O.DialogFooter,{children:p.jsx(O.Button,{onClick:V,type:"button",children:"Save changes"})})]})]})};var H={exports:{}},yt=H.exports,Q;function vt(){return Q||(Q=1,function(o,c){(function(w,u){o.exports=u(b,dt)})(yt,function(x,w){return function(u){var d={};function n(e){if(d[e])return d[e].exports;var r=d[e]={i:e,l:!1,exports:{}};return u[e].call(r.exports,r,r.exports,n),r.l=!0,r.exports}return n.m=u,n.c=d,n.d=function(e,r,g){n.o(e,r)||Object.defineProperty(e,r,{enumerable:!0,get:g})},n.r=function(e){typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,r){if(r&1&&(e=n(e)),r&8||r&4&&typeof e=="object"&&e&&e.__esModule)return e;var g=Object.create(null);if(n.r(g),Object.defineProperty(g,"default",{enumerable:!0,value:e}),r&2&&typeof e!="string")for(var l in e)n.d(g,l,(function(y){return e[y]}).bind(null,l));return g},n.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(r,"a",r),r},n.o=function(e,r){return Object.prototype.hasOwnProperty.call(e,r)},n.p="",n(n.s=4)}([function(u,d,n){u.exports=n(5)()},function(u,d){u.exports=x},function(u,d){u.exports=w},function(u,d){u.exports=function(n,e,r){var g=n.direction,l=n.value;switch(g){case"top":return r.top+l<e.top&&r.bottom>e.bottom&&r.left<e.left&&r.right>e.right;case"left":return r.left+l<e.left&&r.bottom>e.bottom&&r.top<e.top&&r.right>e.right;case"bottom":return r.bottom-l>e.bottom&&r.left<e.left&&r.right>e.right&&r.top<e.top;case"right":return r.right-l>e.right&&r.left<e.left&&r.top<e.top&&r.bottom>e.bottom}}},function(u,d,n){n.r(d),n.d(d,"default",function(){return Z});var e=n(1),r=n.n(e),g=n(2),l=n.n(g),y=n(0),i=n.n(y),R=n(3),L=n.n(R);function C(a){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?C=function(f){return typeof f}:C=function(f){return f&&typeof Symbol=="function"&&f.constructor===Symbol&&f!==Symbol.prototype?"symbol":typeof f},C(a)}function V(a,s){if(!(a instanceof s))throw new TypeError("Cannot call a class as a function")}function E(a,s){for(var f=0;f<s.length;f++){var t=s[f];t.enumerable=t.enumerable||!1,t.configurable=!0,"value"in t&&(t.writable=!0),Object.defineProperty(a,t.key,t)}}function S(a,s,f){return s&&E(a.prototype,s),a}function M(a,s){return s&&(C(s)==="object"||typeof s=="function")?s:h(a)}function N(a){return N=Object.setPrototypeOf?Object.getPrototypeOf:function(f){return f.__proto__||Object.getPrototypeOf(f)},N(a)}function h(a){if(a===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return a}function D(a,s){if(typeof s!="function"&&s!==null)throw new TypeError("Super expression must either be null or a function");a.prototype=Object.create(s&&s.prototype,{constructor:{value:a,writable:!0,configurable:!0}}),s&&j(a,s)}function j(a,s){return j=Object.setPrototypeOf||function(t,T){return t.__proto__=T,t},j(a,s)}function P(a,s,f){return s in a?Object.defineProperty(a,s,{value:f,enumerable:!0,configurable:!0,writable:!0}):a[s]=f,a}function it(a){return a.width===void 0&&(a.width=a.right-a.left),a.height===void 0&&(a.height=a.bottom-a.top),a}var Z=function(a){D(s,a);function s(f){var t;return V(this,s),t=M(this,N(s).call(this,f)),P(h(t),"getContainer",function(){return t.props.containment||window}),P(h(t),"addEventListener",function(T,m,v,I){t.debounceCheck||(t.debounceCheck={});var _,z,k=function(){_=null,t.check()};I>-1?z=function(){_||(_=setTimeout(k,I||0))}:z=function(){clearTimeout(_),_=setTimeout(k,v||0)};var U={target:T,fn:z,getLastTimeout:function(){return _}};T.addEventListener(m,U.fn),t.debounceCheck[m]=U}),P(h(t),"startWatching",function(){t.debounceCheck||t.interval||(t.props.intervalCheck&&(t.interval=setInterval(t.check,t.props.intervalDelay)),t.props.scrollCheck&&t.addEventListener(t.getContainer(),"scroll",t.props.scrollDelay,t.props.scrollThrottle),t.props.resizeCheck&&t.addEventListener(window,"resize",t.props.resizeDelay,t.props.resizeThrottle),!t.props.delayedCall&&t.check())}),P(h(t),"stopWatching",function(){if(t.debounceCheck){for(var T in t.debounceCheck)if(t.debounceCheck.hasOwnProperty(T)){var m=t.debounceCheck[T];clearTimeout(m.getLastTimeout()),m.target.removeEventListener(T,m.fn),t.debounceCheck[T]=null}}t.debounceCheck=null,t.interval&&(t.interval=clearInterval(t.interval))}),P(h(t),"check",function(){var T=t.node,m,v;if(!T)return t.state;if(m=it(t.roundRectDown(T.getBoundingClientRect())),t.props.containment){var I=t.props.containment.getBoundingClientRect();v={top:I.top,left:I.left,bottom:I.bottom,right:I.right}}else v={top:0,left:0,bottom:window.innerHeight||document.documentElement.clientHeight,right:window.innerWidth||document.documentElement.clientWidth};var _=t.props.offset||{},z=C(_)==="object";z&&(v.top+=_.top||0,v.left+=_.left||0,v.bottom-=_.bottom||0,v.right-=_.right||0);var k={top:m.top>=v.top,left:m.left>=v.left,bottom:m.bottom<=v.bottom,right:m.right<=v.right},U=m.height>0&&m.width>0,A=U&&k.top&&k.left&&k.bottom&&k.right;if(U&&t.props.partialVisibility){var $=m.top<=v.bottom&&m.bottom>=v.top&&m.left<=v.right&&m.right>=v.left;typeof t.props.partialVisibility=="string"&&($=k[t.props.partialVisibility]),A=t.props.minTopValue?$&&m.top<=v.bottom-t.props.minTopValue:$}typeof _.direction=="string"&&typeof _.value=="number"&&(console.warn("[notice] offset.direction and offset.value have been deprecated. They still work for now, but will be removed in next major version. Please upgrade to the new syntax: { %s: %d }",_.direction,_.value),A=L()(_,m,v));var F=t.state;return t.state.isVisible!==A&&(F={isVisible:A,visibilityRect:k},t.setState(F),t.props.onChange&&t.props.onChange(A)),F}),t.state={isVisible:null,visibilityRect:{}},t}return S(s,[{key:"componentDidMount",value:function(){this.node=l.a.findDOMNode(this),this.props.active&&this.startWatching()}},{key:"componentWillUnmount",value:function(){this.stopWatching()}},{key:"componentDidUpdate",value:function(t){this.node=l.a.findDOMNode(this),this.props.active&&!t.active?(this.setState({isVisible:null,visibilityRect:{}}),this.startWatching()):this.props.active||this.stopWatching()}},{key:"roundRectDown",value:function(t){return{top:Math.floor(t.top),left:Math.floor(t.left),bottom:Math.floor(t.bottom),right:Math.floor(t.right)}}},{key:"render",value:function(){return this.props.children instanceof Function?this.props.children({isVisible:this.state.isVisible,visibilityRect:this.state.visibilityRect}):r.a.Children.only(this.props.children)}}]),s}(r.a.Component);P(Z,"defaultProps",{active:!0,partialVisibility:!1,minTopValue:0,scrollCheck:!1,scrollDelay:250,scrollThrottle:-1,resizeCheck:!1,resizeDelay:250,resizeThrottle:-1,intervalCheck:!0,intervalDelay:100,delayedCall:!1,offset:{},containment:null,children:r.a.createElement("span",null)}),P(Z,"propTypes",{onChange:i.a.func,active:i.a.bool,partialVisibility:i.a.oneOfType([i.a.bool,i.a.oneOf(["top","right","bottom","left"])]),delayedCall:i.a.bool,offset:i.a.oneOfType([i.a.shape({top:i.a.number,left:i.a.number,bottom:i.a.number,right:i.a.number}),i.a.shape({direction:i.a.oneOf(["top","right","bottom","left"]),value:i.a.number})]),scrollCheck:i.a.bool,scrollDelay:i.a.number,scrollThrottle:i.a.number,resizeCheck:i.a.bool,resizeDelay:i.a.number,resizeThrottle:i.a.number,intervalCheck:i.a.bool,intervalDelay:i.a.number,containment:typeof window<"u"?i.a.instanceOf(window.Element):i.a.any,children:i.a.oneOfType([i.a.element,i.a.func]),minTopValue:i.a.number})},function(u,d,n){var e=n(6);function r(){}function g(){}g.resetWarningCache=r,u.exports=function(){function l(R,L,C,V,E,S){if(S!==e){var M=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw M.name="Invariant Violation",M}}l.isRequired=l;function y(){return l}var i={array:l,bool:l,func:l,number:l,object:l,string:l,symbol:l,any:l,arrayOf:y,element:l,elementType:l,instanceOf:y,node:l,objectOf:y,oneOf:y,oneOfType:y,shape:y,exact:y,checkPropTypes:g,resetWarningCache:r};return i.PropTypes=i,i}},function(u,d,n){var e="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";u.exports=e}])})}(H)),H.exports}var _t=vt();const xt=O.getDefaultExportFromCjs(_t),wt="_wrap_15k3c_1",Et="_renderWrap_15k3c_7",Tt="_title_15k3c_14",Ot="_handlerWrap_15k3c_30",B={wrap:wt,renderWrap:Et,title:Tt,handlerWrap:Ot},Ct=10,St=200,tt=15,et={width:"100%",height:"100%",maxWidth:"100%"};function Dt({editor:o,node:c,updateAttributes:x}){const w=b.useRef(null),u=o.isActive(nt.name),{data:d,width:n,height:e}=c.attrs,[r,g]=b.useState(null),[l,y]=b.useState(!0),[i,R]=b.useState(null),[L,C]=b.useState(!1),[V,E]=b.useState(100),S=b.useCallback(h=>{h&&C(!0)},[C]),M=b.useCallback(h=>()=>{E(D=>O.clamp(h==="minus"?D-tt:D+tt,Ct,St))},[]);b.useEffect(()=>{let h=!1;return import("@excalidraw/excalidraw").then(D=>{h||(w.current=D.exportToSvg)}).catch(D=>!h&&R(D)).finally(()=>!h&&y(!1)),()=>{h=!0}},[y,d]),b.useEffect(()=>{let h=!1;return(async()=>{if(h||l||i||!L||!d)return;const j=await w.current(d);h||(j.setAttribute("width","100%"),j.setAttribute("height","100%"),j.setAttribute("display","block"),g(j))})(),()=>{h=!0}},[d,l,i,L]);const N=h=>{x({width:h.width,height:h.height})};return p.jsx(W.NodeViewWrapper,{className:W.clsx(B.wrap,u&&B.isActive),children:p.jsx(xt,{onChange:S,children:p.jsx(pt.Resizable,{size:{width:Number.parseInt(n),height:Number.parseInt(e)},onResizeStop:(h,D,j,P)=>{N({width:Number.parseInt(n)+P.width,height:Number.parseInt(e)+P.height})},children:p.jsxs("div",{className:W.clsx(B.renderWrap,"render-wrapper"),style:{...et,overflow:"hidden"},children:[i&&p.jsx("div",{style:et,children:p.jsx("p",{children:i.message||i})}),l&&p.jsx("p",{children:"Loading..."}),!l&&!i&&L&&p.jsx("div",{dangerouslySetInnerHTML:{__html:(r==null?void 0:r.outerHTML)??""},style:{height:"100%",maxHeight:"100%",padding:24,overflow:"hidden",display:"flex",justifyContent:"center",alignItems:"center",transform:`scale(${V/100})`,transition:"all ease-in-out .3s"}}),p.jsx("div",{className:B.title}),p.jsxs("div",{className:B.handlerWrap,children:[p.jsx(O.ActionButton,{action:M("minus"),icon:"ZoomOut",tooltip:"Zoom Out"}),p.jsx(O.ActionButton,{action:M("plus"),icon:"ZoomIn",tooltip:"Zoom In"})]})]})})})})}const Pt=b.memo(Dt,(o,c)=>!!O.deepEqual(o.node.attrs,c.node.attrs)),rt={elements:[]},nt=K.Node.create({name:"excalidraw",group:"block",selectable:!0,atom:!0,draggable:!0,inline:!1,addAttributes(){return{defaultShowPicker:{default:!1},createUser:{default:null},width:{default:"100%",parseHTML:W.getDatasetAttribute("width")},height:{default:240,parseHTML:W.getDatasetAttribute("height")},data:{default:rt,parseHTML:W.getDatasetAttribute("data",!0)}}},addOptions(){var o;return{...(o=this.parent)==null?void 0:o.call(this),HTMLAttributes:{class:"excalidraw"},button:({editor:c})=>({component:mt,componentProps:{editor:c}})}},parseHTML(){return[{tag:"div[class=excalidraw]"}]},renderHTML({HTMLAttributes:o,node:c}){return["div",K.mergeAttributes(this.options.HTMLAttributes,o,W.nodeAttrsToDataset(c))]},addCommands(){return{setExcalidraw:o=>({tr:c,commands:x,chain:w})=>{var u,d,n;return o=o||{},o.data=o.data||rt,((n=(d=(u=c.selection)==null?void 0:u.node)==null?void 0:d.type)==null?void 0:n.name)==this.name?x.updateAttributes(this.name,o):w().insertContent({type:this.name,attrs:o}).run()}}},addNodeView(){return W.ReactNodeViewRenderer(Pt)},addInputRules(){return[K.nodeInputRule({find:/^\$excalidraw\$$/,type:this.type,getAttributes:()=>({width:"100%"})})]}});exports.Excalidraw=nt;exports.triggerOpenExcalidrawSettingModal=gt;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("./index-COecBbaE.cjs");require("./dom-dataset-CAXnsjYE.cjs");const e=require("./Excalidraw-BS6_3xHm.cjs");exports.Excalidraw=e.Excalidraw;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("./index-CSvnpArE.cjs");require("./dom-dataset-DmsCLv1q.cjs");const e=require("./Excalidraw-CYLyPnI4.cjs");exports.Excalidraw=e.Excalidraw;
@@ -251,14 +251,15 @@ declare module '@tiptap/core' {
251
251
 
252
252
  declare module '@tiptap/core' {
253
253
  interface Commands<ReturnType> {
254
- twitter: {
254
+ video: {
255
255
  /**
256
- * Insert a tweet
257
- * @param options The tweet attributes
258
- * @example editor.commands.setTweet({ src: 'https://x.com/seanpk/status/1800145949580517852' })
256
+ * Add an video
259
257
  */
260
- setTweet: (options: SetTweetOptions) => ReturnType;
261
- updateTweet: (options: SetTweetOptions) => ReturnType;
258
+ setVideo: (options: Partial<SetVideoOptions>) => ReturnType;
259
+ /**
260
+ * Update an video
261
+ */
262
+ updateVideo: (options: Partial<SetVideoOptions>) => ReturnType;
262
263
  };
263
264
  }
264
265
  }
@@ -266,15 +267,14 @@ declare module '@tiptap/core' {
266
267
 
267
268
  declare module '@tiptap/core' {
268
269
  interface Commands<ReturnType> {
269
- video: {
270
- /**
271
- * Add an video
272
- */
273
- setVideo: (options: Partial<SetVideoOptions>) => ReturnType;
270
+ twitter: {
274
271
  /**
275
- * Update an video
272
+ * Insert a tweet
273
+ * @param options The tweet attributes
274
+ * @example editor.commands.setTweet({ src: 'https://x.com/seanpk/status/1800145949580517852' })
276
275
  */
277
- updateVideo: (options: Partial<SetVideoOptions>) => ReturnType;
276
+ setTweet: (options: SetTweetOptions) => ReturnType;
277
+ updateTweet: (options: SetTweetOptions) => ReturnType;
278
278
  };
279
279
  }
280
280
  }
@@ -251,14 +251,15 @@ declare module '@tiptap/core' {
251
251
 
252
252
  declare module '@tiptap/core' {
253
253
  interface Commands<ReturnType> {
254
- twitter: {
254
+ video: {
255
255
  /**
256
- * Insert a tweet
257
- * @param options The tweet attributes
258
- * @example editor.commands.setTweet({ src: 'https://x.com/seanpk/status/1800145949580517852' })
256
+ * Add an video
259
257
  */
260
- setTweet: (options: SetTweetOptions) => ReturnType;
261
- updateTweet: (options: SetTweetOptions) => ReturnType;
258
+ setVideo: (options: Partial<SetVideoOptions>) => ReturnType;
259
+ /**
260
+ * Update an video
261
+ */
262
+ updateVideo: (options: Partial<SetVideoOptions>) => ReturnType;
262
263
  };
263
264
  }
264
265
  }
@@ -266,15 +267,14 @@ declare module '@tiptap/core' {
266
267
 
267
268
  declare module '@tiptap/core' {
268
269
  interface Commands<ReturnType> {
269
- video: {
270
- /**
271
- * Add an video
272
- */
273
- setVideo: (options: Partial<SetVideoOptions>) => ReturnType;
270
+ twitter: {
274
271
  /**
275
- * Update an video
272
+ * Insert a tweet
273
+ * @param options The tweet attributes
274
+ * @example editor.commands.setTweet({ src: 'https://x.com/seanpk/status/1800145949580517852' })
276
275
  */
277
- updateVideo: (options: Partial<SetVideoOptions>) => ReturnType;
276
+ setTweet: (options: SetTweetOptions) => ReturnType;
277
+ updateTweet: (options: SetTweetOptions) => ReturnType;
278
278
  };
279
279
  }
280
280
  }
package/lib/Excalidraw.js CHANGED
@@ -1,6 +1,6 @@
1
- import "./index-DEe_Svay.js";
2
- import "./dom-dataset-pKb7TLlt.js";
3
- import { E as m } from "./Excalidraw-D5qXWfKq.js";
1
+ import "./index-CXIIg9Sq.js";
2
+ import "./dom-dataset-2RXYq9wp.js";
3
+ import { E as m } from "./Excalidraw-Bp252YTN.js";
4
4
  export {
5
5
  m as Excalidraw
6
6
  };
package/lib/ExportPdf.cjs CHANGED
@@ -1,4 +1,4 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("./index-COecBbaE.cjs"),d=require("./RichTextEditor-CFS3E6GK.cjs");function s(n){const t=document.createElement("iframe");t.setAttribute("style","position: absolute; width: 0; height: 0; top: 0; left: 0;"),document.body.appendChild(t),t.textContent=`
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("./index-CSvnpArE.cjs"),d=require("./RichTextEditor-Db6oQoYY.cjs");function s(n){const t=document.createElement("iframe");t.setAttribute("style","position: absolute; width: 0; height: 0; top: 0; left: 0;"),document.body.appendChild(t),t.textContent=`
2
2
  <!DOCTYPE html>
3
3
  <html lang="en">
4
4
  <head>
@@ -243,14 +243,15 @@ declare module '@tiptap/core' {
243
243
 
244
244
  declare module '@tiptap/core' {
245
245
  interface Commands<ReturnType> {
246
- twitter: {
246
+ video: {
247
247
  /**
248
- * Insert a tweet
249
- * @param options The tweet attributes
250
- * @example editor.commands.setTweet({ src: 'https://x.com/seanpk/status/1800145949580517852' })
248
+ * Add an video
251
249
  */
252
- setTweet: (options: SetTweetOptions) => ReturnType;
253
- updateTweet: (options: SetTweetOptions) => ReturnType;
250
+ setVideo: (options: Partial<SetVideoOptions>) => ReturnType;
251
+ /**
252
+ * Update an video
253
+ */
254
+ updateVideo: (options: Partial<SetVideoOptions>) => ReturnType;
254
255
  };
255
256
  }
256
257
  }
@@ -258,15 +259,14 @@ declare module '@tiptap/core' {
258
259
 
259
260
  declare module '@tiptap/core' {
260
261
  interface Commands<ReturnType> {
261
- video: {
262
- /**
263
- * Add an video
264
- */
265
- setVideo: (options: Partial<SetVideoOptions>) => ReturnType;
262
+ twitter: {
266
263
  /**
267
- * Update an video
264
+ * Insert a tweet
265
+ * @param options The tweet attributes
266
+ * @example editor.commands.setTweet({ src: 'https://x.com/seanpk/status/1800145949580517852' })
268
267
  */
269
- updateVideo: (options: Partial<SetVideoOptions>) => ReturnType;
268
+ setTweet: (options: SetTweetOptions) => ReturnType;
269
+ updateTweet: (options: SetTweetOptions) => ReturnType;
270
270
  };
271
271
  }
272
272
  }
@@ -243,14 +243,15 @@ declare module '@tiptap/core' {
243
243
 
244
244
  declare module '@tiptap/core' {
245
245
  interface Commands<ReturnType> {
246
- twitter: {
246
+ video: {
247
247
  /**
248
- * Insert a tweet
249
- * @param options The tweet attributes
250
- * @example editor.commands.setTweet({ src: 'https://x.com/seanpk/status/1800145949580517852' })
248
+ * Add an video
251
249
  */
252
- setTweet: (options: SetTweetOptions) => ReturnType;
253
- updateTweet: (options: SetTweetOptions) => ReturnType;
250
+ setVideo: (options: Partial<SetVideoOptions>) => ReturnType;
251
+ /**
252
+ * Update an video
253
+ */
254
+ updateVideo: (options: Partial<SetVideoOptions>) => ReturnType;
254
255
  };
255
256
  }
256
257
  }
@@ -258,15 +259,14 @@ declare module '@tiptap/core' {
258
259
 
259
260
  declare module '@tiptap/core' {
260
261
  interface Commands<ReturnType> {
261
- video: {
262
- /**
263
- * Add an video
264
- */
265
- setVideo: (options: Partial<SetVideoOptions>) => ReturnType;
262
+ twitter: {
266
263
  /**
267
- * Update an video
264
+ * Insert a tweet
265
+ * @param options The tweet attributes
266
+ * @example editor.commands.setTweet({ src: 'https://x.com/seanpk/status/1800145949580517852' })
268
267
  */
269
- updateVideo: (options: Partial<SetVideoOptions>) => ReturnType;
268
+ setTweet: (options: SetTweetOptions) => ReturnType;
269
+ updateTweet: (options: SetTweetOptions) => ReturnType;
270
270
  };
271
271
  }
272
272
  }
package/lib/ExportPdf.js CHANGED
@@ -1,5 +1,5 @@
1
- import { E as c } from "./index-DEe_Svay.js";
2
- import { A as d } from "./RichTextEditor-DS30aD8t.js";
1
+ import { E as c } from "./index-CXIIg9Sq.js";
2
+ import { A as d } from "./RichTextEditor-BfYZYQb9.js";
3
3
  function s(n) {
4
4
  const t = document.createElement("iframe");
5
5
  t.setAttribute("style", "position: absolute; width: 0; height: 0; top: 0; left: 0;"), document.body.appendChild(t), t.textContent = `
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("./index-COecBbaE.cjs"),s=require("docx"),t=require("prosemirror-docx"),i=require("./RichTextEditor-CFS3E6GK.cjs"),l=typeof window<"u";function c(o,e){if(l){const n=window.URL.createObjectURL(o),r=document.createElement("a");return r.href=n,r.download=e,r.click(),window.URL.revokeObjectURL(n),Promise.resolve()}return console.error("Download is not supported in Node.js"),Promise.resolve()}const u={...t.defaultNodes,hardBreak:t.defaultNodes.hard_break,codeBlock:t.defaultNodes.code_block,orderedList:t.defaultNodes.ordered_list,listItem:t.defaultNodes.list_item,bulletList:t.defaultNodes.bullet_list,horizontalRule:t.defaultNodes.horizontal_rule,image(o,e){o.renderInline(e),o.closeBlock(e)},table(o,e){o.table(e,{tableOptions:{width:{size:100,type:s.WidthType.PERCENTAGE}}})}},p=new t.DocxSerializer(u,t.defaultMarks),f=a.Extension.create({name:"exportWord",addOptions(){var o;return{...(o=this.parent)==null?void 0:o.call(this),button:({editor:e,t:n})=>({component:i.ActionButton,componentProps:{icon:"ExportWord",action:()=>{e==null||e.commands.exportToWord()},tooltip:n("editor.exportWord.tooltip"),isActive:()=>!1,disabled:!1}})}},addCommands(){return{exportToWord:()=>async({editor:o})=>{const e={getImageBuffer:async r=>{const d=await(await fetch(r)).arrayBuffer();return new Uint8Array(d)}},n=p.serialize(o.state.doc,e);return s.Packer.toBlob(n).then(r=>c(new Blob([r]),"export-document.docx")),!0}}}});exports.ExportWord=f;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("./index-CSvnpArE.cjs"),s=require("docx"),t=require("prosemirror-docx"),i=require("./RichTextEditor-Db6oQoYY.cjs"),l=typeof window<"u";function c(o,e){if(l){const n=window.URL.createObjectURL(o),r=document.createElement("a");return r.href=n,r.download=e,r.click(),window.URL.revokeObjectURL(n),Promise.resolve()}return console.error("Download is not supported in Node.js"),Promise.resolve()}const u={...t.defaultNodes,hardBreak:t.defaultNodes.hard_break,codeBlock:t.defaultNodes.code_block,orderedList:t.defaultNodes.ordered_list,listItem:t.defaultNodes.list_item,bulletList:t.defaultNodes.bullet_list,horizontalRule:t.defaultNodes.horizontal_rule,image(o,e){o.renderInline(e),o.closeBlock(e)},table(o,e){o.table(e,{tableOptions:{width:{size:100,type:s.WidthType.PERCENTAGE}}})}},p=new t.DocxSerializer(u,t.defaultMarks),f=a.Extension.create({name:"exportWord",addOptions(){var o;return{...(o=this.parent)==null?void 0:o.call(this),button:({editor:e,t:n})=>({component:i.ActionButton,componentProps:{icon:"ExportWord",action:()=>{e==null||e.commands.exportToWord()},tooltip:n("editor.exportWord.tooltip"),isActive:()=>!1,disabled:!1}})}},addCommands(){return{exportToWord:()=>async({editor:o})=>{const e={getImageBuffer:async r=>{const d=await(await fetch(r)).arrayBuffer();return new Uint8Array(d)}},n=p.serialize(o.state.doc,e);return s.Packer.toBlob(n).then(r=>c(new Blob([r]),"export-document.docx")),!0}}}});exports.ExportWord=f;
@@ -314,14 +314,15 @@ declare module '@tiptap/core' {
314
314
 
315
315
  declare module '@tiptap/core' {
316
316
  interface Commands<ReturnType> {
317
- twitter: {
317
+ video: {
318
318
  /**
319
- * Insert a tweet
320
- * @param options The tweet attributes
321
- * @example editor.commands.setTweet({ src: 'https://x.com/seanpk/status/1800145949580517852' })
319
+ * Add an video
322
320
  */
323
- setTweet: (options: SetTweetOptions) => ReturnType;
324
- updateTweet: (options: SetTweetOptions) => ReturnType;
321
+ setVideo: (options: Partial<SetVideoOptions>) => ReturnType;
322
+ /**
323
+ * Update an video
324
+ */
325
+ updateVideo: (options: Partial<SetVideoOptions>) => ReturnType;
325
326
  };
326
327
  }
327
328
  }
@@ -329,15 +330,14 @@ declare module '@tiptap/core' {
329
330
 
330
331
  declare module '@tiptap/core' {
331
332
  interface Commands<ReturnType> {
332
- video: {
333
- /**
334
- * Add an video
335
- */
336
- setVideo: (options: Partial<SetVideoOptions>) => ReturnType;
333
+ twitter: {
337
334
  /**
338
- * Update an video
335
+ * Insert a tweet
336
+ * @param options The tweet attributes
337
+ * @example editor.commands.setTweet({ src: 'https://x.com/seanpk/status/1800145949580517852' })
339
338
  */
340
- updateVideo: (options: Partial<SetVideoOptions>) => ReturnType;
339
+ setTweet: (options: SetTweetOptions) => ReturnType;
340
+ updateTweet: (options: SetTweetOptions) => ReturnType;
341
341
  };
342
342
  }
343
343
  }
@@ -314,14 +314,15 @@ declare module '@tiptap/core' {
314
314
 
315
315
  declare module '@tiptap/core' {
316
316
  interface Commands<ReturnType> {
317
- twitter: {
317
+ video: {
318
318
  /**
319
- * Insert a tweet
320
- * @param options The tweet attributes
321
- * @example editor.commands.setTweet({ src: 'https://x.com/seanpk/status/1800145949580517852' })
319
+ * Add an video
322
320
  */
323
- setTweet: (options: SetTweetOptions) => ReturnType;
324
- updateTweet: (options: SetTweetOptions) => ReturnType;
321
+ setVideo: (options: Partial<SetVideoOptions>) => ReturnType;
322
+ /**
323
+ * Update an video
324
+ */
325
+ updateVideo: (options: Partial<SetVideoOptions>) => ReturnType;
325
326
  };
326
327
  }
327
328
  }
@@ -329,15 +330,14 @@ declare module '@tiptap/core' {
329
330
 
330
331
  declare module '@tiptap/core' {
331
332
  interface Commands<ReturnType> {
332
- video: {
333
- /**
334
- * Add an video
335
- */
336
- setVideo: (options: Partial<SetVideoOptions>) => ReturnType;
333
+ twitter: {
337
334
  /**
338
- * Update an video
335
+ * Insert a tweet
336
+ * @param options The tweet attributes
337
+ * @example editor.commands.setTweet({ src: 'https://x.com/seanpk/status/1800145949580517852' })
339
338
  */
340
- updateVideo: (options: Partial<SetVideoOptions>) => ReturnType;
339
+ setTweet: (options: SetTweetOptions) => ReturnType;
340
+ updateTweet: (options: SetTweetOptions) => ReturnType;
341
341
  };
342
342
  }
343
343
  }
package/lib/ExportWord.js CHANGED
@@ -1,7 +1,7 @@
1
- import { E as a } from "./index-DEe_Svay.js";
1
+ import { E as a } from "./index-CXIIg9Sq.js";
2
2
  import { Packer as i, WidthType as c } from "docx";
3
3
  import { defaultNodes as t, DocxSerializer as d, defaultMarks as l } from "prosemirror-docx";
4
- import { A as p } from "./RichTextEditor-DS30aD8t.js";
4
+ import { A as p } from "./RichTextEditor-BfYZYQb9.js";
5
5
  const m = typeof window < "u";
6
6
  function u(e, o) {
7
7
  if (m) {
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("./index-DjP7Onch.cjs");const y=require("./index-COecBbaE.cjs"),m=require("./index-Dz3YxLE7.cjs"),o=require("react/jsx-runtime"),F=require("react"),h=require("./ActionMenuButton-DocMG_Xt.cjs"),s=require("./RichTextEditor-CFS3E6GK.cjs"),x=y.Extension.create({name:"fontFamily",addOptions(){return{types:["textStyle"]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{fontFamily:{default:null,parseHTML:t=>t.style.fontFamily,renderHTML:t=>t.fontFamily?{style:`font-family: ${t.fontFamily}`}:{}}}}]},addCommands(){return{setFontFamily:t=>({chain:i})=>i().setMark("textStyle",{fontFamily:t}).run(),unsetFontFamily:()=>({chain:t})=>t().setMark("textStyle",{fontFamily:null}).removeEmptyTextStyle().run()}}});function M(t){var r,f,d;const{t:i,lang:u}=m.useLocale(),e=F.useMemo(()=>{var a;const n=(a=t==null?void 0:t.items)==null?void 0:a.find(l=>l.isActive());return n&&!n.default?{...n}:{title:t.tooltip,font:i("editor.fontFamily.default.tooltip"),isActive:()=>!1,disabled:!1,action:()=>t.editor.chain().focus().unsetFontFamily().run()}},[i,u,t]);return o.jsxs(s.DropdownMenu,{children:[o.jsx(s.DropdownMenuTrigger,{asChild:!0,disabled:t==null?void 0:t.disabled,children:o.jsx(h.ActionMenuButton,{disabled:t==null?void 0:t.disabled,icon:"MenuDown",title:((r=e==null?void 0:e.font)==null?void 0:r.length)>7?`${(f=e==null?void 0:e.font)==null?void 0:f.slice(0,6)}...`:e==null?void 0:e.font,tooltip:t==null?void 0:t.tooltip})}),o.jsx(s.DropdownMenuContent,{className:"richtext-w-full",children:(d=t==null?void 0:t.items)==null?void 0:d.map((n,c)=>{const a=n.font===i("editor.fontFamily.default.tooltip")?{}:{fontFamily:n.font};return o.jsxs(F.Fragment,{children:[o.jsx(s.DropdownMenuCheckboxItem,{checked:(e==null?void 0:e.font)===n.font,onClick:n.action,children:o.jsx("div",{className:"richtext-ml-1 richtext-h-full",style:a,children:n.font})}),n.font===i("editor.fontFamily.default.tooltip")&&o.jsx(s.DropdownMenuSeparator,{})]},`font-family-${c}`)})})]})}const b=x.extend({addOptions(){var t;return{...(t=this.parent)==null?void 0:t.call(this),fontFamilyList:m.DEFAULT_FONT_FAMILY_LIST,button({editor:i,extension:u,t:e}){var a;const{extensions:r=[]}=i.extensionManager??[],f=s.ensureNameValueOptions(((a=u==null?void 0:u.options)==null?void 0:a.fontFamilyList)||[]),d=r.find(l=>l.name==="base-kit"),n=f.map(l=>({action:()=>{i.chain().focus().setFontFamily(l.value).run()},isActive:()=>i.isActive("textStyle",{fontFamily:l.value})||!1,disabled:!i.can().setFontFamily(l.value),title:l.name,font:l.value}));d&&d.options.textStyle!==!1&&n.unshift({action:()=>i.chain().focus().unsetFontFamily().run(),isActive:()=>!1,disabled:!1,font:e("editor.fontFamily.default.tooltip"),title:e("editor.fontFamily.tooltip")});const c=n.filter(l=>l.disabled).length===n.length;return{component:M,componentProps:{tooltip:e("editor.fontFamily.tooltip"),disabled:c,items:n,editor:i}}}}}});exports.DEFAULT_FONT_FAMILY_LIST=m.DEFAULT_FONT_FAMILY_LIST;exports.FontFamily=b;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("./index-CrxasX7b.cjs");const y=require("./index-CSvnpArE.cjs"),m=require("./index-Dz3YxLE7.cjs"),o=require("react/jsx-runtime"),F=require("react"),h=require("./ActionMenuButton-CqlhqVIW.cjs"),s=require("./RichTextEditor-Db6oQoYY.cjs"),x=y.Extension.create({name:"fontFamily",addOptions(){return{types:["textStyle"]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{fontFamily:{default:null,parseHTML:t=>t.style.fontFamily,renderHTML:t=>t.fontFamily?{style:`font-family: ${t.fontFamily}`}:{}}}}]},addCommands(){return{setFontFamily:t=>({chain:i})=>i().setMark("textStyle",{fontFamily:t}).run(),unsetFontFamily:()=>({chain:t})=>t().setMark("textStyle",{fontFamily:null}).removeEmptyTextStyle().run()}}});function M(t){var r,f,d;const{t:i,lang:u}=m.useLocale(),e=F.useMemo(()=>{var a;const n=(a=t==null?void 0:t.items)==null?void 0:a.find(l=>l.isActive());return n&&!n.default?{...n}:{title:t.tooltip,font:i("editor.fontFamily.default.tooltip"),isActive:()=>!1,disabled:!1,action:()=>t.editor.chain().focus().unsetFontFamily().run()}},[i,u,t]);return o.jsxs(s.DropdownMenu,{children:[o.jsx(s.DropdownMenuTrigger,{asChild:!0,disabled:t==null?void 0:t.disabled,children:o.jsx(h.ActionMenuButton,{disabled:t==null?void 0:t.disabled,icon:"MenuDown",title:((r=e==null?void 0:e.font)==null?void 0:r.length)>7?`${(f=e==null?void 0:e.font)==null?void 0:f.slice(0,6)}...`:e==null?void 0:e.font,tooltip:t==null?void 0:t.tooltip})}),o.jsx(s.DropdownMenuContent,{className:"richtext-w-full",children:(d=t==null?void 0:t.items)==null?void 0:d.map((n,c)=>{const a=n.font===i("editor.fontFamily.default.tooltip")?{}:{fontFamily:n.font};return o.jsxs(F.Fragment,{children:[o.jsx(s.DropdownMenuCheckboxItem,{checked:(e==null?void 0:e.font)===n.font,onClick:n.action,children:o.jsx("div",{className:"richtext-ml-1 richtext-h-full",style:a,children:n.font})}),n.font===i("editor.fontFamily.default.tooltip")&&o.jsx(s.DropdownMenuSeparator,{})]},`font-family-${c}`)})})]})}const b=x.extend({addOptions(){var t;return{...(t=this.parent)==null?void 0:t.call(this),fontFamilyList:m.DEFAULT_FONT_FAMILY_LIST,button({editor:i,extension:u,t:e}){var a;const{extensions:r=[]}=i.extensionManager??[],f=s.ensureNameValueOptions(((a=u==null?void 0:u.options)==null?void 0:a.fontFamilyList)||[]),d=r.find(l=>l.name==="base-kit"),n=f.map(l=>({action:()=>{i.chain().focus().setFontFamily(l.value).run()},isActive:()=>i.isActive("textStyle",{fontFamily:l.value})||!1,disabled:!i.can().setFontFamily(l.value),title:l.name,font:l.value}));d&&d.options.textStyle!==!1&&n.unshift({action:()=>i.chain().focus().unsetFontFamily().run(),isActive:()=>!1,disabled:!1,font:e("editor.fontFamily.default.tooltip"),title:e("editor.fontFamily.tooltip")});const c=n.filter(l=>l.disabled).length===n.length;return{component:M,componentProps:{tooltip:e("editor.fontFamily.tooltip"),disabled:c,items:n,editor:i}}}}}});exports.DEFAULT_FONT_FAMILY_LIST=m.DEFAULT_FONT_FAMILY_LIST;exports.FontFamily=b;
@@ -327,14 +327,15 @@ declare module '@tiptap/core' {
327
327
 
328
328
  declare module '@tiptap/core' {
329
329
  interface Commands<ReturnType> {
330
- twitter: {
330
+ video: {
331
331
  /**
332
- * Insert a tweet
333
- * @param options The tweet attributes
334
- * @example editor.commands.setTweet({ src: 'https://x.com/seanpk/status/1800145949580517852' })
332
+ * Add an video
335
333
  */
336
- setTweet: (options: SetTweetOptions) => ReturnType;
337
- updateTweet: (options: SetTweetOptions) => ReturnType;
334
+ setVideo: (options: Partial<SetVideoOptions>) => ReturnType;
335
+ /**
336
+ * Update an video
337
+ */
338
+ updateVideo: (options: Partial<SetVideoOptions>) => ReturnType;
338
339
  };
339
340
  }
340
341
  }
@@ -342,15 +343,14 @@ declare module '@tiptap/core' {
342
343
 
343
344
  declare module '@tiptap/core' {
344
345
  interface Commands<ReturnType> {
345
- video: {
346
- /**
347
- * Add an video
348
- */
349
- setVideo: (options: Partial<SetVideoOptions>) => ReturnType;
346
+ twitter: {
350
347
  /**
351
- * Update an video
348
+ * Insert a tweet
349
+ * @param options The tweet attributes
350
+ * @example editor.commands.setTweet({ src: 'https://x.com/seanpk/status/1800145949580517852' })
352
351
  */
353
- updateVideo: (options: Partial<SetVideoOptions>) => ReturnType;
352
+ setTweet: (options: SetTweetOptions) => ReturnType;
353
+ updateTweet: (options: SetTweetOptions) => ReturnType;
354
354
  };
355
355
  }
356
356
  }
@@ -327,14 +327,15 @@ declare module '@tiptap/core' {
327
327
 
328
328
  declare module '@tiptap/core' {
329
329
  interface Commands<ReturnType> {
330
- twitter: {
330
+ video: {
331
331
  /**
332
- * Insert a tweet
333
- * @param options The tweet attributes
334
- * @example editor.commands.setTweet({ src: 'https://x.com/seanpk/status/1800145949580517852' })
332
+ * Add an video
335
333
  */
336
- setTweet: (options: SetTweetOptions) => ReturnType;
337
- updateTweet: (options: SetTweetOptions) => ReturnType;
334
+ setVideo: (options: Partial<SetVideoOptions>) => ReturnType;
335
+ /**
336
+ * Update an video
337
+ */
338
+ updateVideo: (options: Partial<SetVideoOptions>) => ReturnType;
338
339
  };
339
340
  }
340
341
  }
@@ -342,15 +343,14 @@ declare module '@tiptap/core' {
342
343
 
343
344
  declare module '@tiptap/core' {
344
345
  interface Commands<ReturnType> {
345
- video: {
346
- /**
347
- * Add an video
348
- */
349
- setVideo: (options: Partial<SetVideoOptions>) => ReturnType;
346
+ twitter: {
350
347
  /**
351
- * Update an video
348
+ * Insert a tweet
349
+ * @param options The tweet attributes
350
+ * @example editor.commands.setTweet({ src: 'https://x.com/seanpk/status/1800145949580517852' })
352
351
  */
353
- updateVideo: (options: Partial<SetVideoOptions>) => ReturnType;
352
+ setTweet: (options: SetTweetOptions) => ReturnType;
353
+ updateTweet: (options: SetTweetOptions) => ReturnType;
354
354
  };
355
355
  }
356
356
  }
package/lib/FontFamily.js CHANGED
@@ -1,10 +1,10 @@
1
- import "./index-Dk3tSDmG.js";
2
- import { E as c } from "./index-DEe_Svay.js";
1
+ import "./index-BkoojfPK.js";
2
+ import { E as c } from "./index-CXIIg9Sq.js";
3
3
  import { u as y, g as F } from "./index-D-DR0FPY.js";
4
4
  import { jsxs as r, jsx as a } from "react/jsx-runtime";
5
5
  import { useMemo as h, Fragment as b } from "react";
6
- import { A as x } from "./ActionMenuButton-D9WfF2ep.js";
7
- import { D as M, e as A, f as g, h as L, u as D, j as S } from "./RichTextEditor-DS30aD8t.js";
6
+ import { A as x } from "./ActionMenuButton-DXwpQHj4.js";
7
+ import { D as M, e as A, f as g, h as L, u as D, j as S } from "./RichTextEditor-BfYZYQb9.js";
8
8
  const w = c.create({
9
9
  name: "fontFamily",
10
10
  addOptions() {
package/lib/FontSize.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const f=require("./index-COecBbaE.cjs"),r=require("./index-Dz3YxLE7.cjs"),a=require("./RichTextEditor-CFS3E6GK.cjs"),u=require("react/jsx-runtime"),m=require("react"),z=require("./ActionMenuButton-DocMG_Xt.cjs");function x(e){var s;const{t}=r.useLocale(),l=m.useMemo(()=>{const i=(e.items||[]).find(c=>c.isActive());return i||{title:t("editor.fontSize.default.tooltip"),isActive:()=>!1}},[e]);return u.jsxs(a.DropdownMenu,{children:[u.jsx(a.DropdownMenuTrigger,{asChild:!0,disabled:e==null?void 0:e.disabled,children:u.jsx(z.ActionMenuButton,{disabled:e==null?void 0:e.disabled,icon:"MenuDown",title:l==null?void 0:l.title,tooltip:`${e==null?void 0:e.tooltip}`})}),u.jsx(a.DropdownMenuContent,{className:"richtext-max-h-96 richtext-w-32 richtext-overflow-y-auto",children:(s=e==null?void 0:e.items)==null?void 0:s.map((i,o)=>u.jsx(a.DropdownMenuCheckboxItem,{checked:l.title===i.title,onClick:i.action,children:u.jsx("div",{className:"richtext-ml-1 richtext-h-full",children:i.title})},`font-size-${o}`))})]})}const v=f.Extension.create({name:"fontSize",addOptions(){var e;return{...(e=this.parent)==null?void 0:e.call(this),types:["textStyle"],fontSizes:[...r.DEFAULT_FONT_SIZE_LIST],button({editor:t,extension:l,t:s}){var d;const i=a.ensureNameValueOptions(((d=l.options)==null?void 0:d.fontSizes)||r.DEFAULT_FONT_SIZE_VALUE),o=a.ensureNameValueOptions([r.DEFAULT_FONT_SIZE_VALUE])[0],c=i.map(n=>({title:n.value===o.value?s("editor.fontSize.default.tooltip"):String(n.name),isActive:()=>{const{fontSize:S}=t.getAttributes("textStyle");return n.value===o.value&&S===void 0?!0:t.isActive({fontSize:String(n.value)})||!1},action:()=>{if(n.value===o.value){t.commands.unsetFontSize();return}t.commands.setFontSize(String(n.value))},disabled:!t.can().setFontSize(String(n.value)),divider:n.value===o.value||!1,default:n.value===o.value||!1}));return{component:x,componentProps:{editor:t,tooltip:s("editor.fontSize.tooltip"),disabled:!1,items:c,maxHeight:280}}}}},addGlobalAttributes(){return[{types:this.options.types,attributes:{fontSize:{default:null,parseHTML:e=>e.style.fontSize.replaceAll(/["']+/g,""),renderHTML:e=>e.fontSize?{style:`font-size: ${e.fontSize}`}:{}}}}]},addCommands(){return{setFontSize:e=>({chain:t})=>t().setMark("textStyle",{fontSize:e}).run(),unsetFontSize:()=>({chain:e})=>e().setMark("textStyle",{fontSize:null}).removeEmptyTextStyle().run()}}});exports.DEFAULT_FONT_SIZE_LIST=r.DEFAULT_FONT_SIZE_LIST;exports.FontSize=v;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const f=require("./index-CSvnpArE.cjs"),r=require("./index-Dz3YxLE7.cjs"),a=require("./RichTextEditor-Db6oQoYY.cjs"),u=require("react/jsx-runtime"),m=require("react"),z=require("./ActionMenuButton-CqlhqVIW.cjs");function x(e){var s;const{t}=r.useLocale(),l=m.useMemo(()=>{const i=(e.items||[]).find(c=>c.isActive());return i||{title:t("editor.fontSize.default.tooltip"),isActive:()=>!1}},[e]);return u.jsxs(a.DropdownMenu,{children:[u.jsx(a.DropdownMenuTrigger,{asChild:!0,disabled:e==null?void 0:e.disabled,children:u.jsx(z.ActionMenuButton,{disabled:e==null?void 0:e.disabled,icon:"MenuDown",title:l==null?void 0:l.title,tooltip:`${e==null?void 0:e.tooltip}`})}),u.jsx(a.DropdownMenuContent,{className:"richtext-max-h-96 richtext-w-32 richtext-overflow-y-auto",children:(s=e==null?void 0:e.items)==null?void 0:s.map((i,o)=>u.jsx(a.DropdownMenuCheckboxItem,{checked:l.title===i.title,onClick:i.action,children:u.jsx("div",{className:"richtext-ml-1 richtext-h-full",children:i.title})},`font-size-${o}`))})]})}const v=f.Extension.create({name:"fontSize",addOptions(){var e;return{...(e=this.parent)==null?void 0:e.call(this),types:["textStyle"],fontSizes:[...r.DEFAULT_FONT_SIZE_LIST],button({editor:t,extension:l,t:s}){var d;const i=a.ensureNameValueOptions(((d=l.options)==null?void 0:d.fontSizes)||r.DEFAULT_FONT_SIZE_VALUE),o=a.ensureNameValueOptions([r.DEFAULT_FONT_SIZE_VALUE])[0],c=i.map(n=>({title:n.value===o.value?s("editor.fontSize.default.tooltip"):String(n.name),isActive:()=>{const{fontSize:S}=t.getAttributes("textStyle");return n.value===o.value&&S===void 0?!0:t.isActive({fontSize:String(n.value)})||!1},action:()=>{if(n.value===o.value){t.commands.unsetFontSize();return}t.commands.setFontSize(String(n.value))},disabled:!t.can().setFontSize(String(n.value)),divider:n.value===o.value||!1,default:n.value===o.value||!1}));return{component:x,componentProps:{editor:t,tooltip:s("editor.fontSize.tooltip"),disabled:!1,items:c,maxHeight:280}}}}},addGlobalAttributes(){return[{types:this.options.types,attributes:{fontSize:{default:null,parseHTML:e=>e.style.fontSize.replaceAll(/["']+/g,""),renderHTML:e=>e.fontSize?{style:`font-size: ${e.fontSize}`}:{}}}}]},addCommands(){return{setFontSize:e=>({chain:t})=>t().setMark("textStyle",{fontSize:e}).run(),unsetFontSize:()=>({chain:e})=>e().setMark("textStyle",{fontSize:null}).removeEmptyTextStyle().run()}}});exports.DEFAULT_FONT_SIZE_LIST=r.DEFAULT_FONT_SIZE_LIST;exports.FontSize=v;