reactjs-tiptap-editor 0.3.17 → 0.3.19

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 (229) hide show
  1. package/lib/{ActionMenuButton-KFJKTwTF.cjs → ActionMenuButton-BPq-R8E7.cjs} +1 -1
  2. package/lib/{ActionMenuButton-BrCaG1xk.js → ActionMenuButton-DCACoSG3.js} +1 -1
  3. package/lib/Attachment.cjs +1 -1
  4. package/lib/Attachment.d.cts +8 -8
  5. package/lib/Attachment.d.ts +8 -8
  6. package/lib/Attachment.js +2 -2
  7. package/lib/Blockquote.cjs +1 -1
  8. package/lib/Blockquote.d.cts +8 -8
  9. package/lib/Blockquote.d.ts +8 -8
  10. package/lib/Blockquote.js +1 -1
  11. package/lib/Bold.cjs +1 -1
  12. package/lib/Bold.d.cts +8 -8
  13. package/lib/Bold.d.ts +8 -8
  14. package/lib/Bold.js +1 -1
  15. package/lib/BulletList.cjs +1 -1
  16. package/lib/BulletList.d.cts +8 -8
  17. package/lib/BulletList.d.ts +8 -8
  18. package/lib/BulletList.js +1 -1
  19. package/lib/Clear.cjs +1 -1
  20. package/lib/Clear.d.cts +8 -8
  21. package/lib/Clear.d.ts +8 -8
  22. package/lib/Clear.js +1 -1
  23. package/lib/Code.cjs +1 -1
  24. package/lib/Code.d.cts +8 -8
  25. package/lib/Code.d.ts +8 -8
  26. package/lib/Code.js +1 -1
  27. package/lib/CodeBlock.cjs +1 -1
  28. package/lib/CodeBlock.d.cts +8 -8
  29. package/lib/CodeBlock.d.ts +8 -8
  30. package/lib/CodeBlock.js +1 -1
  31. package/lib/CodeView.cjs +1 -1
  32. package/lib/CodeView.d.cts +8 -8
  33. package/lib/CodeView.d.ts +8 -8
  34. package/lib/CodeView.js +1 -1
  35. package/lib/Color.cjs +1 -1
  36. package/lib/Color.d.cts +8 -8
  37. package/lib/Color.d.ts +8 -8
  38. package/lib/Color.js +1 -1
  39. package/lib/Document.d.cts +8 -8
  40. package/lib/Document.d.ts +8 -8
  41. package/lib/{Drawer-DIGVbwK_.cjs → Drawer-Dwx9V0Xb.cjs} +1 -1
  42. package/lib/{Drawer-BoMVb5A7.js → Drawer-Qh1zEBl3.js} +2 -2
  43. package/lib/Drawer.cjs +1 -1
  44. package/lib/Drawer.d.cts +8 -8
  45. package/lib/Drawer.d.ts +8 -8
  46. package/lib/Drawer.js +2 -2
  47. package/lib/Emoji.cjs +1 -1
  48. package/lib/Emoji.d.cts +8 -8
  49. package/lib/Emoji.d.ts +8 -8
  50. package/lib/Emoji.js +2 -2
  51. package/lib/Excalidraw-BP_-zWZH.cjs +1 -0
  52. package/lib/Excalidraw-DD3P3ClH.js +289 -0
  53. package/lib/Excalidraw.cjs +1 -1
  54. package/lib/Excalidraw.d.cts +8 -8
  55. package/lib/Excalidraw.d.ts +8 -8
  56. package/lib/Excalidraw.js +1 -1
  57. package/lib/ExportPdf.cjs +1 -1
  58. package/lib/ExportPdf.d.cts +8 -8
  59. package/lib/ExportPdf.d.ts +8 -8
  60. package/lib/ExportPdf.js +1 -1
  61. package/lib/ExportWord.cjs +1 -1
  62. package/lib/ExportWord.d.cts +8 -8
  63. package/lib/ExportWord.d.ts +8 -8
  64. package/lib/ExportWord.js +1 -1
  65. package/lib/FontFamily.cjs +1 -1
  66. package/lib/FontFamily.d.cts +8 -8
  67. package/lib/FontFamily.d.ts +8 -8
  68. package/lib/FontFamily.js +3 -3
  69. package/lib/FontSize.cjs +1 -1
  70. package/lib/FontSize.d.cts +8 -8
  71. package/lib/FontSize.d.ts +8 -8
  72. package/lib/FontSize.js +3 -3
  73. package/lib/FormatPainter.cjs +1 -1
  74. package/lib/FormatPainter.d.cts +8 -8
  75. package/lib/FormatPainter.d.ts +8 -8
  76. package/lib/FormatPainter.js +1 -1
  77. package/lib/Heading.cjs +1 -1
  78. package/lib/Heading.d.cts +8 -8
  79. package/lib/Heading.d.ts +8 -8
  80. package/lib/Heading.js +2 -2
  81. package/lib/Highlight.cjs +1 -1
  82. package/lib/Highlight.d.cts +8 -8
  83. package/lib/Highlight.d.ts +8 -8
  84. package/lib/Highlight.js +1 -1
  85. package/lib/History.cjs +1 -1
  86. package/lib/History.d.cts +8 -8
  87. package/lib/History.d.ts +8 -8
  88. package/lib/History.js +1 -1
  89. package/lib/HorizontalRule.cjs +1 -1
  90. package/lib/HorizontalRule.d.cts +8 -8
  91. package/lib/HorizontalRule.d.ts +8 -8
  92. package/lib/HorizontalRule.js +1 -1
  93. package/lib/Iframe.cjs +1 -1
  94. package/lib/Iframe.d.cts +8 -8
  95. package/lib/Iframe.d.ts +8 -8
  96. package/lib/Iframe.js +1 -1
  97. package/lib/Image.cjs +1 -1
  98. package/lib/Image.d.cts +9 -8
  99. package/lib/Image.d.ts +9 -8
  100. package/lib/Image.js +1 -1
  101. package/lib/ImageGif.cjs +1 -1
  102. package/lib/ImageGif.d.cts +8 -8
  103. package/lib/ImageGif.d.ts +8 -8
  104. package/lib/ImageGif.js +1 -1
  105. package/lib/ImportWord.cjs +1 -1
  106. package/lib/ImportWord.d.cts +8 -8
  107. package/lib/ImportWord.d.ts +8 -8
  108. package/lib/ImportWord.js +2 -2
  109. package/lib/Indent.cjs +1 -1
  110. package/lib/Indent.d.cts +8 -8
  111. package/lib/Indent.d.ts +8 -8
  112. package/lib/Indent.js +1 -1
  113. package/lib/Italic.cjs +1 -1
  114. package/lib/Italic.d.cts +8 -8
  115. package/lib/Italic.d.ts +8 -8
  116. package/lib/Italic.js +1 -1
  117. package/lib/Katex.cjs +1 -1
  118. package/lib/Katex.d.cts +8 -8
  119. package/lib/Katex.d.ts +8 -8
  120. package/lib/Katex.js +3 -3
  121. package/lib/LineHeight.cjs +1 -1
  122. package/lib/LineHeight.d.cts +8 -8
  123. package/lib/LineHeight.d.ts +8 -8
  124. package/lib/LineHeight.js +2 -2
  125. package/lib/Link.cjs +1 -1
  126. package/lib/Link.d.cts +8 -8
  127. package/lib/Link.d.ts +8 -8
  128. package/lib/Link.js +1 -1
  129. package/lib/ListItem.d.cts +8 -8
  130. package/lib/ListItem.d.ts +8 -8
  131. package/lib/Mention.d.cts +8 -8
  132. package/lib/Mention.d.ts +8 -8
  133. package/lib/Mermaid.cjs +1 -1
  134. package/lib/Mermaid.d.cts +8 -8
  135. package/lib/Mermaid.d.ts +8 -8
  136. package/lib/Mermaid.js +3 -3
  137. package/lib/MoreMark.cjs +1 -1
  138. package/lib/MoreMark.d.cts +8 -8
  139. package/lib/MoreMark.d.ts +8 -8
  140. package/lib/MoreMark.js +1 -1
  141. package/lib/MultiColumn.cjs +1 -1
  142. package/lib/MultiColumn.d.cts +8 -8
  143. package/lib/MultiColumn.d.ts +8 -8
  144. package/lib/MultiColumn.js +1 -1
  145. package/lib/OrderedList.cjs +1 -1
  146. package/lib/OrderedList.d.cts +8 -8
  147. package/lib/OrderedList.d.ts +8 -8
  148. package/lib/OrderedList.js +1 -1
  149. package/lib/{RichTextEditor-Coaq773Y.js → RichTextEditor-DIvPROxl.js} +1073 -1069
  150. package/lib/RichTextEditor-DszaQdvS.cjs +141 -0
  151. package/lib/SearchAndReplace.cjs +1 -1
  152. package/lib/SearchAndReplace.d.cts +8 -8
  153. package/lib/SearchAndReplace.d.ts +8 -8
  154. package/lib/SearchAndReplace.js +2 -2
  155. package/lib/Selection.d.cts +8 -8
  156. package/lib/Selection.d.ts +8 -8
  157. package/lib/SlashCommand.cjs +1 -1
  158. package/lib/SlashCommand.d.cts +8 -8
  159. package/lib/SlashCommand.d.ts +8 -8
  160. package/lib/SlashCommand.js +2 -2
  161. package/lib/Strike.cjs +1 -1
  162. package/lib/Strike.d.cts +8 -8
  163. package/lib/Strike.d.ts +8 -8
  164. package/lib/Strike.js +1 -1
  165. package/lib/SubAndSuperScript.cjs +1 -1
  166. package/lib/SubAndSuperScript.d.cts +8 -8
  167. package/lib/SubAndSuperScript.d.ts +8 -8
  168. package/lib/SubAndSuperScript.js +1 -1
  169. package/lib/Table.cjs +1 -1
  170. package/lib/Table.d.cts +8 -8
  171. package/lib/Table.d.ts +8 -8
  172. package/lib/Table.js +2 -2
  173. package/lib/TableOfContent.cjs +1 -1
  174. package/lib/TableOfContent.d.cts +8 -8
  175. package/lib/TableOfContent.d.ts +8 -8
  176. package/lib/TableOfContent.js +2 -2
  177. package/lib/TaskList.cjs +1 -1
  178. package/lib/TaskList.d.cts +8 -8
  179. package/lib/TaskList.d.ts +8 -8
  180. package/lib/TaskList.js +1 -1
  181. package/lib/TextAlign.cjs +1 -1
  182. package/lib/TextAlign.d.cts +8 -8
  183. package/lib/TextAlign.d.ts +8 -8
  184. package/lib/TextAlign.js +1 -1
  185. package/lib/TextBubble.cjs +1 -1
  186. package/lib/TextBubble.d.cts +8 -8
  187. package/lib/TextBubble.d.ts +8 -8
  188. package/lib/TextBubble.js +2 -2
  189. package/lib/TextDirection.cjs +1 -1
  190. package/lib/TextDirection.d.cts +8 -8
  191. package/lib/TextDirection.d.ts +8 -8
  192. package/lib/TextDirection.js +1 -1
  193. package/lib/TextUnderline.cjs +1 -1
  194. package/lib/TextUnderline.d.cts +8 -8
  195. package/lib/TextUnderline.d.ts +8 -8
  196. package/lib/TextUnderline.js +1 -1
  197. package/lib/TrailingNode.d.cts +8 -8
  198. package/lib/TrailingNode.d.ts +8 -8
  199. package/lib/{Twitter-D9TEh74u.cjs → Twitter-Bl5HyIX0.cjs} +1 -1
  200. package/lib/{Twitter-4jWZEzW-.js → Twitter-raSi7ATg.js} +2 -2
  201. package/lib/Twitter.cjs +1 -1
  202. package/lib/Twitter.d.cts +8 -8
  203. package/lib/Twitter.d.ts +8 -8
  204. package/lib/Twitter.js +1 -1
  205. package/lib/Video.cjs +1 -1
  206. package/lib/Video.d.cts +8 -8
  207. package/lib/Video.d.ts +8 -8
  208. package/lib/Video.js +2 -2
  209. package/lib/bubble-extra.cjs +1 -1
  210. package/lib/bubble-extra.d.cts +8 -8
  211. package/lib/bubble-extra.d.ts +8 -8
  212. package/lib/bubble-extra.js +6 -6
  213. package/lib/index-C19MB4Al.cjs +1 -0
  214. package/lib/{index-zcKfSGd5.js → index-Tj3Ci7xM.js} +13 -8
  215. package/lib/index.cjs +1 -1
  216. package/lib/index.d.cts +8 -8
  217. package/lib/index.d.ts +8 -8
  218. package/lib/index.js +3 -3
  219. package/lib/locale-bundle.cjs +1 -1
  220. package/lib/locale-bundle.d.cts +13 -8
  221. package/lib/locale-bundle.d.ts +13 -8
  222. package/lib/locale-bundle.js +1 -1
  223. package/lib/{textarea-hHZqZb43.cjs → textarea-DgXP0XRK.cjs} +1 -1
  224. package/lib/{textarea-D432J9HA.js → textarea-DnBlTntN.js} +1 -1
  225. package/package.json +1 -1
  226. package/lib/Excalidraw-36ndx1gh.cjs +0 -1
  227. package/lib/Excalidraw-DhvtW1HZ.js +0 -282
  228. package/lib/RichTextEditor-B7GWBCUZ.cjs +0 -141
  229. package/lib/index-jEB3jXoa.cjs +0 -1
@@ -117,6 +117,7 @@ export declare const en: {
117
117
  'editor.imageUpload.cancel': string;
118
118
  'editor.imageUpload.crop': string;
119
119
  'editor.imageUpload.uploading': string;
120
+ 'editor.imageUpload.alt': string;
120
121
  'editor.imageUpload.fileTypeNotSupported': string;
121
122
  'editor.imageUpload.fileSizeTooBig': string;
122
123
  'editor.table.menu.insertColumnBefore': string;
@@ -294,6 +295,7 @@ export declare const hu_HU: {
294
295
  'editor.imageUpload.cancel': string;
295
296
  'editor.imageUpload.crop': string;
296
297
  'editor.imageUpload.uploading': string;
298
+ 'editor.imageUpload.alt': string;
297
299
  'editor.imageUpload.fileTypeNotSupported': string;
298
300
  'editor.imageUpload.fileSizeTooBig': string;
299
301
  'editor.table.menu.insertColumnBefore': string;
@@ -494,6 +496,7 @@ export declare const pt_BR: {
494
496
  'editor.imageUpload.cancel': string;
495
497
  'editor.imageUpload.crop': string;
496
498
  'editor.imageUpload.uploading': string;
499
+ 'editor.imageUpload.alt': string;
497
500
  'editor.imageUpload.fileTypeNotSupported': string;
498
501
  'editor.imageUpload.fileSizeTooBig': string;
499
502
  'editor.table.menu.insertColumnBefore': string;
@@ -671,6 +674,7 @@ export declare const vi: {
671
674
  'editor.imageUpload.cancel': string;
672
675
  'editor.imageUpload.crop': string;
673
676
  'editor.imageUpload.uploading': string;
677
+ 'editor.imageUpload.alt': string;
674
678
  'editor.imageUpload.fileTypeNotSupported': string;
675
679
  'editor.imageUpload.fileSizeTooBig': string;
676
680
  'editor.table.menu.insertColumnBefore': string;
@@ -848,6 +852,7 @@ export declare const zh_CN: {
848
852
  'editor.imageUpload.cancel': string;
849
853
  'editor.imageUpload.crop': string;
850
854
  'editor.imageUpload.uploading': string;
855
+ 'editor.imageUpload.alt': string;
851
856
  'editor.imageUpload.fileTypeNotSupported': string;
852
857
  'editor.imageUpload.fileSizeTooBig': string;
853
858
  'editor.table.menu.insertColumnBefore': string;
@@ -941,11 +946,9 @@ declare module '@tiptap/core' {
941
946
 
942
947
  declare module '@tiptap/core' {
943
948
  interface Commands<ReturnType> {
944
- emoji: {
945
- setEmoji: (emoji: {
946
- name: string;
947
- emoji: string;
948
- }) => ReturnType;
949
+ drawer: {
950
+ setDrawer: (options: any, replace?: any) => ReturnType;
951
+ setAlignImageDrawer: (align: 'left' | 'center' | 'right') => ReturnType;
949
952
  };
950
953
  }
951
954
  }
@@ -953,9 +956,11 @@ declare module '@tiptap/core' {
953
956
 
954
957
  declare module '@tiptap/core' {
955
958
  interface Commands<ReturnType> {
956
- drawer: {
957
- setDrawer: (options: any, replace?: any) => ReturnType;
958
- setAlignImageDrawer: (align: 'left' | 'center' | 'right') => ReturnType;
959
+ emoji: {
960
+ setEmoji: (emoji: {
961
+ name: string;
962
+ emoji: string;
963
+ }) => ReturnType;
959
964
  };
960
965
  }
961
966
  }
@@ -1,4 +1,4 @@
1
- import { a as e, b as l, l as o, e as _, c, d as h } from "./index-zcKfSGd5.js";
1
+ import { a as e, b as l, l as o, e as _, c, d as h } from "./index-Tj3Ci7xM.js";
2
2
  export {
3
3
  e as en,
4
4
  l as hu_HU,
@@ -1 +1 @@
1
- "use strict";const n=require("react/jsx-runtime"),o=require("react"),a=require("./RichTextEditor-B7GWBCUZ.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-DszaQdvS.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,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-Coaq773Y.js";
3
+ import { d as o } from "./RichTextEditor-DIvPROxl.js";
4
4
  const x = c.forwardRef(
5
5
  ({ className: t, ...e }, r) => /* @__PURE__ */ i(
6
6
  "textarea",
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "reactjs-tiptap-editor",
3
3
  "type": "module",
4
- "version": "0.3.17",
4
+ "version": "0.3.19",
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",
@@ -1 +0,0 @@
1
- "use strict";var W=Object.create;var y=Object.defineProperty;var H=Object.getOwnPropertyDescriptor;var Z=Object.getOwnPropertyNames;var q=Object.getPrototypeOf,z=Object.prototype.hasOwnProperty;var B=(e,t,s,l)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of Z(t))!z.call(e,i)&&i!==s&&y(e,i,{get:()=>t[i],enumerable:!(l=H(t,i))||l.enumerable});return e};var M=(e,t,s)=>(s=e!=null?W(q(e)):{},B(t||!e||!e.__esModule?y(s,"default",{value:e,enumerable:!0}):s,e));const _=require("./index-CSvnpArE.cjs"),p=require("./dom-dataset-Cuy-pIfj.cjs"),n=require("react/jsx-runtime"),a=require("react"),d=require("./RichTextEditor-B7GWBCUZ.cjs"),P=require("./index-jEB3jXoa.cjs"),V=require("re-resizable");let L;function I(){try{return L||(L=P.mitt()),L}catch{throw new Error("Error EventEmitter")}}const D="OPEN_EXCALIDRAW_SETTING_MODAL";function $(e,t){I().on(e,t)}function U(e,t){I().off(e,t)}function X(e){I().emit(D,e)}const F=({editor:e})=>{const[t,s]=a.useState(null),[l,i]=a.useState({}),[h,f]=a.useState({elements:[],appState:{isLoading:!1},files:null}),[m,o]=a.useState(!1),[w,x]=a.useState(!0),[E,g]=a.useState(null),S=a.useCallback(c=>{c&&import("@excalidraw/excalidraw").then(r=>{s(r.Excalidraw)}).catch(g).finally(()=>x(!1))},[x]),j=a.useCallback(c=>{setTimeout(()=>{c.refresh()})},[]),T=a.useCallback((c,r,u)=>{i({elements:c,appState:{isLoading:!1},files:u})},[]),v=a.useCallback(()=>{if(!t){o(!1);return}e.chain().focus().setExcalidraw({data:l}).run(),o(!1)},[t,e,l,o]);return a.useEffect(()=>{const c=r=>{(r==null?void 0:r.editor)===e&&(o(!0),r&&f(r.data))};return $(D,c),()=>{U(D,c)}},[e,o]),a.useEffect(()=>{!w&&t&&m&&setTimeout(()=>{window.dispatchEvent(new Event("resize"))},400)},[w,t,m]),n.jsxs(d.Dialog,{onOpenChange:o,open:m,children:[n.jsx(d.DialogTrigger,{asChild:!0,children:n.jsx(d.ActionButton,{action:()=>o(!0),icon:"Excalidraw",tooltip:"Excalidraw"})}),n.jsxs(d.DialogContent,{className:"richtext-z-[99999] !richtext-max-w-[1300px]",children:[n.jsx(d.DialogTitle,{children:"Excalidraw"}),n.jsxs("div",{style:{height:"100%",borderWidth:1},children:[w&&n.jsx("p",{children:"Loading..."}),E&&n.jsx("p",{children:E&&E.message||"Error"}),n.jsx("div",{ref:S,style:{width:"100%",height:600},children:!w&&!E&&t?n.jsx(t,{initialData:h,langCode:"en",onChange:T,ref:j}):null})]}),n.jsx(d.DialogFooter,{children:n.jsx(d.Button,{onClick:v,type:"button",children:"Save changes"})})]})]})},G="_wrap_15k3c_1",Y="_renderWrap_15k3c_7",J="_handlerWrap_15k3c_30",A={wrap:G,renderWrap:Y,handlerWrap:J},K=10,Q=200,C=15,O={width:"100%",height:"100%",maxWidth:"100%"};function ee({editor:e,node:t,updateAttributes:s}){const l=a.useRef(null),i=e.isActive(k.name),{data:h,width:f,height:m}=t.attrs,[o,w]=a.useState(null),[x,E]=a.useState(!0),[g,S]=a.useState(null),[j,T]=a.useState(100),v=a.useCallback(r=>()=>{T(u=>d.clamp(r==="minus"?u-C:u+C,K,Q))},[]);a.useEffect(()=>{let r=!1;return import("@excalidraw/excalidraw").then(u=>{r||(l.current=u.exportToSvg)}).catch(u=>!r&&S(u)).finally(()=>!r&&E(!1)),()=>{r=!0}},[h]),a.useEffect(()=>{let r=!1;return(async()=>{if(!l.current||r||x||g||!h)return;const b=await l.current(h);r||(b.setAttribute("width","100%"),b.setAttribute("height","100%"),b.setAttribute("display","block"),w(b))})(),()=>{r=!0}},[h,x,g]);const c=r=>{s({width:r.width,height:r.height})};return n.jsx(p.NodeViewWrapper,{className:p.clsx(A.wrap,i&&A.isActive),children:n.jsx(V.Resizable,{size:{width:Number.parseInt(f),height:Number.parseInt(m)},onResizeStop:(r,u,b,N)=>{c({width:Number.parseInt(f)+N.width,height:Number.parseInt(m)+N.height})},children:n.jsxs("div",{className:p.clsx(A.renderWrap,"render-wrapper"),style:{...O,overflow:"hidden"},children:[g&&n.jsx("div",{style:O,children:n.jsx("p",{children:g.message||g})}),x&&n.jsx("p",{children:"Loading..."}),!x&&!g&&o&&n.jsx("div",{dangerouslySetInnerHTML:{__html:(o==null?void 0:o.outerHTML)??""},style:{height:"100%",maxHeight:"100%",padding:24,overflow:"hidden",display:"flex",justifyContent:"center",alignItems:"center",transform:`scale(${j/100})`,transition:"all ease-in-out .3s"}}),n.jsxs("div",{className:A.handlerWrap,children:[n.jsx(d.ActionButton,{action:v("minus"),icon:"ZoomOut",tooltip:"Zoom Out"}),n.jsx(d.ActionButton,{action:v("plus"),icon:"ZoomIn",tooltip:"Zoom In"})]})]})})})}const R={elements:[]},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:p.getDatasetAttribute("width")},height:{default:240,parseHTML:p.getDatasetAttribute("height")},data:{default:R,parseHTML:p.getDatasetAttribute("data",!0)}}},addOptions(){var e;return{...(e=this.parent)==null?void 0:e.call(this),HTMLAttributes:{class:"excalidraw"},button:({editor:t})=>({component:F,componentProps:{editor:t}})}},parseHTML(){return[{tag:"div[class=excalidraw]"}]},renderHTML({HTMLAttributes:e,node:t}){return["div",_.mergeAttributes(this.options.HTMLAttributes,e,p.nodeAttrsToDataset(t))]},addCommands(){return{setExcalidraw:e=>({tr:t,commands:s,chain:l})=>{var i,h,f;return e=e||{},e.data=e.data||R,((f=(h=(i=t.selection)==null?void 0:i.node)==null?void 0:h.type)==null?void 0:f.name)==this.name?s.updateAttributes(this.name,e):l().insertContent({type:this.name,attrs:e}).run()}}},addNodeView(){return p.ReactNodeViewRenderer(ee)},addInputRules(){return[_.nodeInputRule({find:/^\$excalidraw\$$/,type:this.type,getAttributes:()=>({width:"100%"})})]}});exports.Excalidraw=k;exports.triggerOpenExcalidrawSettingModal=X;
@@ -1,282 +0,0 @@
1
- import { N as Z, n as k, m as z } from "./index-BWx1Mchx.js";
2
- import { N as j, c as C, R as P, n as V, g as y } from "./dom-dataset-CHDbKz5J.js";
3
- import { jsxs as x, jsx as n } from "react/jsx-runtime";
4
- import { useState as o, useCallback as v, useEffect as T, useRef as B } from "react";
5
- import { w as U, x as $, A as M, y as F, z as X, F as G, B as K, K as Y } from "./RichTextEditor-Coaq773Y.js";
6
- import { n as q } from "./index-zcKfSGd5.js";
7
- import { Resizable as J } from "re-resizable";
8
- let I;
9
- function D() {
10
- try {
11
- return I || (I = q()), I;
12
- } catch {
13
- throw new Error("Error EventEmitter");
14
- }
15
- }
16
- const S = "OPEN_EXCALIDRAW_SETTING_MODAL";
17
- function Q(e, r) {
18
- D().on(e, r);
19
- }
20
- function ee(e, r) {
21
- D().off(e, r);
22
- }
23
- function fe(e) {
24
- D().emit(S, e);
25
- }
26
- const te = ({ editor: e }) => {
27
- const [r, u] = o(null), [c, m] = o({}), [l, h] = o({ elements: [], appState: { isLoading: !1 }, files: null }), [g, a] = o(!1), [f, p] = o(!0), [w, d] = o(null), _ = v(
28
- (i) => {
29
- i && import("@excalidraw/excalidraw").then((t) => {
30
- u(t.Excalidraw);
31
- }).catch(d).finally(() => p(!1));
32
- },
33
- [p]
34
- ), N = v((i) => {
35
- setTimeout(() => {
36
- i.refresh();
37
- });
38
- }, []), L = v((i, t, s) => {
39
- m({
40
- elements: i,
41
- appState: { isLoading: !1 },
42
- files: s
43
- });
44
- }, []), b = v(() => {
45
- if (!r) {
46
- a(!1);
47
- return;
48
- }
49
- e.chain().focus().setExcalidraw({ data: c }).run(), a(!1);
50
- }, [r, e, c, a]);
51
- return T(() => {
52
- const i = (t) => {
53
- (t == null ? void 0 : t.editor) === e && (a(!0), t && h(t.data));
54
- };
55
- return Q(S, i), () => {
56
- ee(S, i);
57
- };
58
- }, [e, a]), T(() => {
59
- !f && r && g && setTimeout(() => {
60
- window.dispatchEvent(new Event("resize"));
61
- }, 400);
62
- }, [f, r, g]), /* @__PURE__ */ x(
63
- U,
64
- {
65
- onOpenChange: a,
66
- open: g,
67
- children: [
68
- /* @__PURE__ */ n($, { asChild: !0, children: /* @__PURE__ */ n(
69
- M,
70
- {
71
- action: () => a(!0),
72
- icon: "Excalidraw",
73
- tooltip: "Excalidraw"
74
- }
75
- ) }),
76
- /* @__PURE__ */ x(F, { className: "richtext-z-[99999] !richtext-max-w-[1300px]", children: [
77
- /* @__PURE__ */ n(X, { children: "Excalidraw" }),
78
- /* @__PURE__ */ x("div", { style: { height: "100%", borderWidth: 1 }, children: [
79
- f && /* @__PURE__ */ n("p", { children: "Loading..." }),
80
- w && /* @__PURE__ */ n("p", { children: w && w.message || "Error" }),
81
- /* @__PURE__ */ n(
82
- "div",
83
- {
84
- ref: _,
85
- style: { width: "100%", height: 600 },
86
- children: !f && !w && r ? /* @__PURE__ */ n(
87
- r,
88
- {
89
- initialData: l,
90
- langCode: "en",
91
- onChange: L,
92
- ref: N
93
- }
94
- ) : null
95
- }
96
- )
97
- ] }),
98
- /* @__PURE__ */ n(G, { children: /* @__PURE__ */ n(
99
- K,
100
- {
101
- onClick: b,
102
- type: "button",
103
- children: "Save changes"
104
- }
105
- ) })
106
- ] })
107
- ]
108
- }
109
- );
110
- }, re = "_wrap_15k3c_1", ne = "_renderWrap_15k3c_7", ae = "_handlerWrap_15k3c_30", A = {
111
- wrap: re,
112
- renderWrap: ne,
113
- handlerWrap: ae
114
- }, ie = 10, se = 200, R = 15, W = { width: "100%", height: "100%", maxWidth: "100%" };
115
- function oe({ editor: e, node: r, updateAttributes: u }) {
116
- const c = B(null), m = e.isActive(le.name), { data: l, width: h, height: g } = r.attrs, [a, f] = o(null), [p, w] = o(!0), [d, _] = o(null), [N, L] = o(100), b = v((t) => () => {
117
- L(
118
- (s) => Y(t === "minus" ? s - R : s + R, ie, se)
119
- );
120
- }, []);
121
- T(() => {
122
- let t = !1;
123
- return import("@excalidraw/excalidraw").then((s) => {
124
- t || (c.current = s.exportToSvg);
125
- }).catch((s) => !t && _(s)).finally(() => !t && w(!1)), () => {
126
- t = !0;
127
- };
128
- }, [l]), T(() => {
129
- let t = !1;
130
- return (async () => {
131
- if (!c.current || t || p || d || !l)
132
- return;
133
- const E = await c.current(l);
134
- t || (E.setAttribute("width", "100%"), E.setAttribute("height", "100%"), E.setAttribute("display", "block"), f(E));
135
- })(), () => {
136
- t = !0;
137
- };
138
- }, [l, p, d]);
139
- const i = (t) => {
140
- u({ width: t.width, height: t.height });
141
- };
142
- return /* @__PURE__ */ n(j, { className: C(A.wrap, m && A.isActive), children: /* @__PURE__ */ n(
143
- J,
144
- {
145
- size: { width: Number.parseInt(h), height: Number.parseInt(g) },
146
- onResizeStop: (t, s, E, O) => {
147
- i({
148
- width: Number.parseInt(h) + O.width,
149
- height: Number.parseInt(g) + O.height
150
- });
151
- },
152
- children: /* @__PURE__ */ x(
153
- "div",
154
- {
155
- className: C(A.renderWrap, "render-wrapper"),
156
- style: { ...W, overflow: "hidden" },
157
- children: [
158
- d && /* @__PURE__ */ n("div", { style: W, children: /* @__PURE__ */ n("p", { children: d.message || d }) }),
159
- p && /* @__PURE__ */ n("p", { children: "Loading..." }),
160
- !p && !d && a && /* @__PURE__ */ n(
161
- "div",
162
- {
163
- dangerouslySetInnerHTML: { __html: (a == null ? void 0 : a.outerHTML) ?? "" },
164
- style: {
165
- height: "100%",
166
- maxHeight: "100%",
167
- padding: 24,
168
- overflow: "hidden",
169
- display: "flex",
170
- justifyContent: "center",
171
- alignItems: "center",
172
- transform: `scale(${N / 100})`,
173
- transition: "all ease-in-out .3s"
174
- }
175
- }
176
- ),
177
- /* @__PURE__ */ x("div", { className: A.handlerWrap, children: [
178
- /* @__PURE__ */ n(
179
- M,
180
- {
181
- action: b("minus"),
182
- icon: "ZoomOut",
183
- tooltip: "Zoom Out"
184
- }
185
- ),
186
- /* @__PURE__ */ n(
187
- M,
188
- {
189
- action: b("plus"),
190
- icon: "ZoomIn",
191
- tooltip: "Zoom In"
192
- }
193
- )
194
- ] })
195
- ]
196
- }
197
- )
198
- }
199
- ) });
200
- }
201
- const H = { elements: [] }, le = /* @__PURE__ */ Z.create({
202
- name: "excalidraw",
203
- group: "block",
204
- selectable: !0,
205
- atom: !0,
206
- draggable: !0,
207
- inline: !1,
208
- addAttributes() {
209
- return {
210
- defaultShowPicker: {
211
- default: !1
212
- },
213
- createUser: {
214
- default: null
215
- },
216
- width: {
217
- default: "100%",
218
- parseHTML: y("width")
219
- },
220
- height: {
221
- default: 240,
222
- parseHTML: y("height")
223
- },
224
- data: {
225
- default: H,
226
- parseHTML: y("data", !0)
227
- }
228
- };
229
- },
230
- addOptions() {
231
- var e;
232
- return {
233
- ...(e = this.parent) == null ? void 0 : e.call(this),
234
- HTMLAttributes: {
235
- class: "excalidraw"
236
- },
237
- button: ({ editor: r }) => ({
238
- component: te,
239
- componentProps: {
240
- editor: r
241
- }
242
- })
243
- };
244
- },
245
- parseHTML() {
246
- return [
247
- {
248
- tag: "div[class=excalidraw]"
249
- }
250
- ];
251
- },
252
- renderHTML({ HTMLAttributes: e, node: r }) {
253
- return ["div", z(this.options.HTMLAttributes, e, V(r))];
254
- },
255
- addCommands() {
256
- return {
257
- setExcalidraw: (e) => ({ tr: r, commands: u, chain: c }) => {
258
- var m, l, h;
259
- return e = e || {}, e.data = e.data || H, ((h = (l = (m = r.selection) == null ? void 0 : m.node) == null ? void 0 : l.type) == null ? void 0 : h.name) == this.name ? u.updateAttributes(this.name, e) : c().insertContent({
260
- type: this.name,
261
- attrs: e
262
- }).run();
263
- }
264
- };
265
- },
266
- addNodeView() {
267
- return P(oe);
268
- },
269
- addInputRules() {
270
- return [
271
- k({
272
- find: /^\$excalidraw\$$/,
273
- type: this.type,
274
- getAttributes: () => ({ width: "100%" })
275
- })
276
- ];
277
- }
278
- });
279
- export {
280
- le as E,
281
- fe as t
282
- };