reactjs-tiptap-editor 0.3.30 → 0.3.31

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (224) hide show
  1. package/lib/{ActionMenuButton-wiDnIxE2.cjs → ActionMenuButton-BCgqJsST.cjs} +1 -1
  2. package/lib/{ActionMenuButton-B6fitGKu.js → ActionMenuButton-D97K0UWT.js} +5 -5
  3. package/lib/Attachment.cjs +1 -1
  4. package/lib/Attachment.d.cts +15 -15
  5. package/lib/Attachment.d.ts +15 -15
  6. package/lib/Attachment.js +1 -1
  7. package/lib/Blockquote.cjs +1 -1
  8. package/lib/Blockquote.d.cts +15 -15
  9. package/lib/Blockquote.d.ts +15 -15
  10. package/lib/Blockquote.js +1 -1
  11. package/lib/Bold.cjs +1 -1
  12. package/lib/Bold.d.cts +15 -15
  13. package/lib/Bold.d.ts +15 -15
  14. package/lib/Bold.js +1 -1
  15. package/lib/BulletList.cjs +1 -1
  16. package/lib/BulletList.d.cts +15 -15
  17. package/lib/BulletList.d.ts +15 -15
  18. package/lib/BulletList.js +1 -1
  19. package/lib/Clear.cjs +1 -1
  20. package/lib/Clear.d.cts +15 -15
  21. package/lib/Clear.d.ts +15 -15
  22. package/lib/Clear.js +1 -1
  23. package/lib/Code.cjs +1 -1
  24. package/lib/Code.d.cts +15 -15
  25. package/lib/Code.d.ts +15 -15
  26. package/lib/Code.js +1 -1
  27. package/lib/CodeBlock.cjs +1 -1
  28. package/lib/CodeBlock.d.cts +15 -15
  29. package/lib/CodeBlock.d.ts +15 -15
  30. package/lib/CodeBlock.js +3 -2
  31. package/lib/CodeView.cjs +1 -1
  32. package/lib/CodeView.d.cts +15 -15
  33. package/lib/CodeView.d.ts +15 -15
  34. package/lib/CodeView.js +1 -1
  35. package/lib/Color.cjs +1 -1
  36. package/lib/Color.d.cts +15 -15
  37. package/lib/Color.d.ts +15 -15
  38. package/lib/Color.js +2 -2
  39. package/lib/Document.d.cts +15 -15
  40. package/lib/Document.d.ts +15 -15
  41. package/lib/Drawer-5Q_-WRhc.cjs +1 -0
  42. package/lib/{Drawer-BKTU9CpU.js → Drawer-BHkje8ys.js} +250 -249
  43. package/lib/Drawer.cjs +1 -1
  44. package/lib/Drawer.d.cts +15 -15
  45. package/lib/Drawer.d.ts +15 -15
  46. package/lib/Drawer.js +2 -2
  47. package/lib/Emoji.cjs +1 -1
  48. package/lib/Emoji.d.cts +15 -15
  49. package/lib/Emoji.d.ts +15 -15
  50. package/lib/Emoji.js +22 -21
  51. package/lib/Excalidraw-CG498239.js +290 -0
  52. package/lib/Excalidraw-GUVW-IqC.cjs +1 -0
  53. package/lib/Excalidraw.cjs +1 -1
  54. package/lib/Excalidraw.d.cts +15 -15
  55. package/lib/Excalidraw.d.ts +15 -15
  56. package/lib/Excalidraw.js +1 -1
  57. package/lib/ExportPdf.cjs +1 -1
  58. package/lib/ExportPdf.d.cts +15 -15
  59. package/lib/ExportPdf.d.ts +15 -15
  60. package/lib/ExportPdf.js +1 -1
  61. package/lib/ExportWord.cjs +1 -1
  62. package/lib/ExportWord.d.cts +15 -15
  63. package/lib/ExportWord.d.ts +15 -15
  64. package/lib/ExportWord.js +1 -1
  65. package/lib/FontFamily.cjs +1 -1
  66. package/lib/FontFamily.d.cts +15 -15
  67. package/lib/FontFamily.d.ts +15 -15
  68. package/lib/FontFamily.js +11 -10
  69. package/lib/FontSize.cjs +1 -1
  70. package/lib/FontSize.d.cts +15 -15
  71. package/lib/FontSize.d.ts +15 -15
  72. package/lib/FontSize.js +6 -5
  73. package/lib/FormatPainter.cjs +1 -1
  74. package/lib/FormatPainter.d.cts +15 -15
  75. package/lib/FormatPainter.d.ts +15 -15
  76. package/lib/FormatPainter.js +1 -1
  77. package/lib/Heading.cjs +1 -1
  78. package/lib/Heading.d.cts +15 -15
  79. package/lib/Heading.d.ts +15 -15
  80. package/lib/Heading.js +32 -31
  81. package/lib/Highlight.cjs +1 -1
  82. package/lib/Highlight.d.cts +15 -15
  83. package/lib/Highlight.d.ts +15 -15
  84. package/lib/Highlight.js +1 -1
  85. package/lib/History.cjs +1 -1
  86. package/lib/History.d.cts +15 -15
  87. package/lib/History.d.ts +15 -15
  88. package/lib/History.js +1 -1
  89. package/lib/HorizontalRule.cjs +1 -1
  90. package/lib/HorizontalRule.d.cts +15 -15
  91. package/lib/HorizontalRule.d.ts +15 -15
  92. package/lib/HorizontalRule.js +1 -1
  93. package/lib/Iframe.cjs +1 -1
  94. package/lib/Iframe.d.cts +15 -15
  95. package/lib/Iframe.d.ts +15 -15
  96. package/lib/Iframe.js +1 -1
  97. package/lib/Image.cjs +1 -1
  98. package/lib/Image.d.cts +15 -15
  99. package/lib/Image.d.ts +15 -15
  100. package/lib/Image.js +1 -1
  101. package/lib/ImageGif.cjs +1 -1
  102. package/lib/ImageGif.d.cts +15 -15
  103. package/lib/ImageGif.d.ts +15 -15
  104. package/lib/ImageGif.js +1 -1
  105. package/lib/ImportWord.cjs +2 -2
  106. package/lib/ImportWord.d.cts +15 -15
  107. package/lib/ImportWord.d.ts +15 -15
  108. package/lib/ImportWord.js +3 -2
  109. package/lib/Indent.cjs +1 -1
  110. package/lib/Indent.d.cts +15 -15
  111. package/lib/Indent.d.ts +15 -15
  112. package/lib/Indent.js +1 -1
  113. package/lib/Italic.cjs +1 -1
  114. package/lib/Italic.d.cts +15 -15
  115. package/lib/Italic.d.ts +15 -15
  116. package/lib/Italic.js +1 -1
  117. package/lib/Katex.cjs +1 -1
  118. package/lib/Katex.d.cts +15 -15
  119. package/lib/Katex.d.ts +15 -15
  120. package/lib/Katex.js +41 -40
  121. package/lib/LineHeight.cjs +1 -1
  122. package/lib/LineHeight.d.cts +15 -15
  123. package/lib/LineHeight.d.ts +15 -15
  124. package/lib/LineHeight.js +17 -16
  125. package/lib/Link.cjs +1 -1
  126. package/lib/Link.d.cts +15 -15
  127. package/lib/Link.d.ts +15 -15
  128. package/lib/Link.js +1 -1
  129. package/lib/ListItem.d.cts +15 -15
  130. package/lib/ListItem.d.ts +15 -15
  131. package/lib/Mention.d.cts +15 -15
  132. package/lib/Mention.d.ts +15 -15
  133. package/lib/Mermaid.cjs +2 -2
  134. package/lib/Mermaid.d.cts +15 -15
  135. package/lib/Mermaid.d.ts +15 -15
  136. package/lib/Mermaid.js +138 -137
  137. package/lib/MoreMark.cjs +1 -1
  138. package/lib/MoreMark.d.cts +15 -15
  139. package/lib/MoreMark.d.ts +15 -15
  140. package/lib/MoreMark.js +1 -1
  141. package/lib/MultiColumn.cjs +1 -1
  142. package/lib/MultiColumn.d.cts +15 -15
  143. package/lib/MultiColumn.d.ts +15 -15
  144. package/lib/MultiColumn.js +1 -1
  145. package/lib/OrderedList.cjs +1 -1
  146. package/lib/OrderedList.d.cts +15 -15
  147. package/lib/OrderedList.d.ts +15 -15
  148. package/lib/OrderedList.js +1 -1
  149. package/lib/{RichTextEditor-C8Sm1E6J.cjs → RichTextEditor-DWlLqTl9.cjs} +4 -4
  150. package/lib/{RichTextEditor-BQN2eLD_.js → RichTextEditor-KP2Rgcqe.js} +15 -39
  151. package/lib/SearchAndReplace.cjs +1 -1
  152. package/lib/SearchAndReplace.d.cts +15 -15
  153. package/lib/SearchAndReplace.d.ts +15 -15
  154. package/lib/SearchAndReplace.js +68 -67
  155. package/lib/Selection.d.cts +15 -15
  156. package/lib/Selection.d.ts +15 -15
  157. package/lib/SlashCommand.cjs +1 -1
  158. package/lib/SlashCommand.d.cts +15 -15
  159. package/lib/SlashCommand.d.ts +15 -15
  160. package/lib/SlashCommand.js +1 -1
  161. package/lib/Strike.cjs +1 -1
  162. package/lib/Strike.d.cts +15 -15
  163. package/lib/Strike.d.ts +15 -15
  164. package/lib/Strike.js +1 -1
  165. package/lib/SubAndSuperScript.cjs +1 -1
  166. package/lib/SubAndSuperScript.d.cts +15 -15
  167. package/lib/SubAndSuperScript.d.ts +15 -15
  168. package/lib/SubAndSuperScript.js +1 -1
  169. package/lib/Table.cjs +1 -1
  170. package/lib/Table.d.cts +15 -15
  171. package/lib/Table.d.ts +15 -15
  172. package/lib/Table.js +2 -1
  173. package/lib/TableOfContent.cjs +1 -1
  174. package/lib/TableOfContent.d.cts +15 -15
  175. package/lib/TableOfContent.d.ts +15 -15
  176. package/lib/TableOfContent.js +50 -49
  177. package/lib/TaskList.cjs +1 -1
  178. package/lib/TaskList.d.cts +15 -15
  179. package/lib/TaskList.d.ts +15 -15
  180. package/lib/TaskList.js +1 -1
  181. package/lib/TextAlign.cjs +1 -1
  182. package/lib/TextAlign.d.cts +15 -15
  183. package/lib/TextAlign.d.ts +15 -15
  184. package/lib/TextAlign.js +8 -7
  185. package/lib/TextBubble.cjs +1 -1
  186. package/lib/TextBubble.d.cts +15 -15
  187. package/lib/TextBubble.d.ts +15 -15
  188. package/lib/TextBubble.js +1 -1
  189. package/lib/TextDirection.cjs +1 -1
  190. package/lib/TextDirection.d.cts +15 -15
  191. package/lib/TextDirection.d.ts +15 -15
  192. package/lib/TextDirection.js +14 -13
  193. package/lib/TextUnderline.cjs +1 -1
  194. package/lib/TextUnderline.d.cts +15 -15
  195. package/lib/TextUnderline.d.ts +15 -15
  196. package/lib/TextUnderline.js +1 -1
  197. package/lib/TrailingNode.d.cts +15 -15
  198. package/lib/TrailingNode.d.ts +15 -15
  199. package/lib/{Twitter-Dg6WWauX.js → Twitter-99ivY5qv.js} +62 -61
  200. package/lib/{Twitter-CL2pu4QM.cjs → Twitter-BvfvUtNT.cjs} +2 -2
  201. package/lib/Twitter.cjs +1 -1
  202. package/lib/Twitter.d.cts +15 -15
  203. package/lib/Twitter.d.ts +15 -15
  204. package/lib/Twitter.js +1 -1
  205. package/lib/Video.cjs +1 -1
  206. package/lib/Video.d.cts +15 -15
  207. package/lib/Video.d.ts +15 -15
  208. package/lib/Video.js +1 -1
  209. package/lib/bubble-extra.cjs +1 -1
  210. package/lib/bubble-extra.d.cts +15 -15
  211. package/lib/bubble-extra.d.ts +15 -15
  212. package/lib/bubble-extra.js +5 -5
  213. package/lib/index.cjs +1 -1
  214. package/lib/index.d.cts +16 -15
  215. package/lib/index.d.ts +16 -15
  216. package/lib/index.js +2 -2
  217. package/lib/locale-bundle.d.cts +15 -15
  218. package/lib/locale-bundle.d.ts +15 -15
  219. package/lib/{textarea-BglwYF6b.js → textarea-CktfkXNe.js} +1 -1
  220. package/lib/{textarea-D5WVZMgt.cjs → textarea-DdH64g04.cjs} +1 -1
  221. package/package.json +1 -1
  222. package/lib/Drawer-CmoEF-Zg.cjs +0 -1
  223. package/lib/Excalidraw-CM74U5tG.js +0 -289
  224. package/lib/Excalidraw-DAPP9qgY.cjs +0 -1
@@ -1 +0,0 @@
1
- "use strict";const D=require("./index-ByRfqzMr.cjs"),a=require("./RichTextEditor-C8Sm1E6J.cjs"),U=require("./dom-dataset-Byuf1YmW.cjs"),e=require("react/jsx-runtime"),m=require("react"),g=require("easydrawer"),G=require("./shortId-Bfj8TyNr.cjs"),q=require("./index-D_A0TBRA.cjs"),K="_wrapper_rraz2_1",Q="_tool_rraz2_17",Y="_active_rraz2_37",J="_pen_rraz2_41",ee="_line_rraz2_48",te="_options_rraz2_56",oe="_colorWrap_rraz2_66",re="_color_rraz2_66",le="_colorActive_rraz2_83",l={wrapper:K,tool:Q,active:Y,pen:J,line:ee,options:te,colorWrap:oe,color:re,colorActive:le};function ne(t){return e.jsx("svg",{height:"1em",viewBox:"0 0 24 24",width:"1em",xmlns:"http://www.w3.org/2000/svg",...t,children:e.jsx("path",{color:"currentColor",d:"M2 9.2v3.6M12.8 2H9.2M7.5 20H9M20 7.5V9M2.133 4.699c.155-.727.415-1.274.854-1.712c.426-.426.954-.684 1.652-.84m15.228 2.552c-.155-.727-.415-1.274-.854-1.712c-.417-.417-.932-.673-1.608-.83M4.64 19.853c-.698-.156-1.226-.414-1.652-.84c-.43-.43-.69-.965-.845-1.673m11.638 3.626c-1.812.125-3.607-8.326-2.374-9.559s9.684.561 9.559 2.373c-.087 1.187-2.095 1.656-2.037 2.711c.018.309.408.59 1.188 1.154c.543.39 1.096.77 1.629 1.175a.66.66 0 0 1 .234.687a3.35 3.35 0 0 1-2.472 2.473a.66.66 0 0 1-.688-.235c-.404-.533-.784-1.086-1.175-1.628c-.563-.78-.844-1.17-1.153-1.188c-1.055-.059-1.524 1.95-2.71 2.037",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.5"})})}function se(t){return e.jsx("svg",{height:"1em",viewBox:"0 0 24 24",width:"1em",xmlns:"http://www.w3.org/2000/svg",...t,children:e.jsx("path",{d:"M20.06 18a4 4 0 0 1-.2-.89c-.67.7-1.48 1.05-2.41 1.05c-.83 0-1.52-.24-2.05-.71c-.53-.45-.8-1.06-.8-1.79c0-.88.33-1.56 1-2.05s1.61-.73 2.83-.73h1.4v-.64q0-.735-.45-1.17c-.3-.29-.75-.43-1.33-.43c-.52 0-.95.12-1.3.36c-.35.25-.52.54-.52.89h-1.46c0-.43.15-.84.45-1.24c.28-.4.71-.71 1.22-.94c.51-.21 1.06-.35 1.69-.35c.98 0 1.74.24 2.29.73s.84 1.16.86 2.02V16c0 .8.1 1.42.3 1.88V18zm-2.4-1.12c.45 0 .88-.11 1.29-.32c.4-.21.7-.49.88-.83v-1.57H18.7c-1.77 0-2.66.47-2.66 1.41c0 .43.15.73.46.96c.3.23.68.35 1.16.35m-12.2-3.17h4.07L7.5 8.29zM6.64 6h1.72l4.71 12h-1.93l-.97-2.57H4.82L3.86 18H1.93z",fill:"currentColor"})})}function ie(t){return e.jsx("svg",{height:"1em",viewBox:"0 0 24 24",width:"1em",xmlns:"http://www.w3.org/2000/svg",...t,children:e.jsx("path",{d:"M3 21v-4.25L16.2 3.575q.3-.275.663-.425t.762-.15t.775.15t.65.45L20.425 5q.3.275.438.65T21 6.4q0 .4-.137.763t-.438.662L7.25 21zM17.6 7.8L19 6.4L17.6 5l-1.4 1.4z",fill:"currentColor"})})}function ae(t){return e.jsx("svg",{height:"1em",viewBox:"0 0 256 256",width:"1em",xmlns:"http://www.w3.org/2000/svg",...t,children:e.jsx("path",{d:"M253.66 106.34a8 8 0 0 0-11.32 0L192 156.69L107.31 72l50.35-50.34a8 8 0 1 0-11.32-11.32L96 60.69a16 16 0 0 0-2.82 18.81L72 100.69a16 16 0 0 0 0 22.62l4.69 4.69l-58.35 58.34a8 8 0 0 0 3.13 13.25l72 24A7.9 7.9 0 0 0 96 224a8 8 0 0 0 5.66-2.34L136 187.31l4.69 4.69a16 16 0 0 0 22.62 0l21.19-21.18a16 16 0 0 0 18.81-2.82l50.35-50.34a8 8 0 0 0 0-11.32M93.84 206.85l-55-18.35L88 139.31L124.69 176ZM152 180.69L83.31 112L104 91.31L172.69 160Z",fill:"currentColor"})})}function ce(t){return e.jsxs("svg",{height:"1em",viewBox:"0 0 16 16",width:"1em",xmlns:"http://www.w3.org/2000/svg",...t,children:[e.jsx("path",{d:"m2.648 9.937l7.29-7.288a2.21 2.21 0 0 1 3.124 0l2.29 2.288a2.21 2.21 0 0 1 0 3.126L10.413 13H12.5a.5.5 0 0 1 0 1H4.501a2.2 2.2 0 0 1-1.563-.647l.707-.707c.227.226.535.354.856.354h4.005a1.2 1.2 0 0 0 .848-.354l1.292-1.293l-4-4l-3.29 3.291a1.21 1.21 0 0 0 0 1.712l.29.29l-.708.707l-.29-.29a2.21 2.21 0 0 1 0-3.126M8 6h6.89a1.2 1.2 0 0 0-.246-.356L14 5H9zm2-2h3l-.645-.644a1.21 1.21 0 0 0-1.71 0zm4.89 3H7.708l1 1H14l.644-.644A1.2 1.2 0 0 0 14.891 7zM9.708 9l1.646 1.646L13 9z",fill:"currentColor"}),e.jsx("path",{d:"M14 11.5a.5.5 0 1 1-1 0a.5.5 0 0 1 1 0m1.5-.5a.5.5 0 1 0 0-1a.5.5 0 0 0 0 1m-1 2a.5.5 0 0 0 0 1h1a.5.5 0 0 0 0-1z",fill:"currentColor"})]})}function he(t){return e.jsx("svg",{height:"1em",viewBox:"0 0 24 24",width:"1em",xmlns:"http://www.w3.org/2000/svg",...t,children:e.jsx("path",{d:"M3 3h18v18H3zm2 2v14h14V5z",fill:"currentColor"})})}function ue(t){return e.jsx("svg",{height:"1em",viewBox:"0 0 24 24",width:"1em",xmlns:"http://www.w3.org/2000/svg",...t,children:e.jsx("path",{d:"M2 20V4h20v16zm2-2h16V6H4zm0 0V6z",fill:"currentColor"})})}function de(t){return e.jsx("svg",{height:"1em",viewBox:"0 0 24 24",width:"1em",xmlns:"http://www.w3.org/2000/svg",...t,children:e.jsx("path",{d:"M12 22q-2.075 0-3.9-.788t-3.175-2.137T2.788 15.9T2 12t.788-3.9t2.137-3.175T8.1 2.788T12 2t3.9.788t3.175 2.137T21.213 8.1T22 12t-.788 3.9t-2.137 3.175t-3.175 2.138T12 22m0-2q3.35 0 5.675-2.325T20 12t-2.325-5.675T12 4T6.325 6.325T4 12t2.325 5.675T12 20m0-8",fill:"currentColor"})})}function ge(t){return e.jsx("svg",{height:"1em",viewBox:"0 0 24 24",width:"1em",xmlns:"http://www.w3.org/2000/svg",...t,children:e.jsx("path",{d:"M10.363 3.591L2.257 17.125a1.914 1.914 0 0 0 1.636 2.871h16.214a1.914 1.914 0 0 0 1.636-2.87L13.637 3.59a1.914 1.914 0 0 0-3.274 0z",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2"})})}function me(t){return e.jsx("svg",{height:"1em",viewBox:"0 0 24 24",width:"1em",xmlns:"http://www.w3.org/2000/svg",...t,children:e.jsx("path",{d:"m6.8 21l-5.2-9l5.2-9h10.4l5.2 9l-5.2 9zm1.15-2h8.1l4.025-7l-4.025-7h-8.1L3.9 12zM12 12",fill:"currentColor"})})}function xe(t){return e.jsx("svg",{height:"1em",viewBox:"0 0 24 24",width:"1em",xmlns:"http://www.w3.org/2000/svg",...t,children:e.jsxs("g",{fill:"none",fillRule:"evenodd",children:[e.jsx("path",{d:"m12.594 23.258l-.012.002l-.071.035l-.02.004l-.014-.004l-.071-.036q-.016-.004-.024.006l-.004.01l-.017.428l.005.02l.01.013l.104.074l.015.004l.012-.004l.104-.074l.012-.016l.004-.017l-.017-.427q-.004-.016-.016-.018m.264-.113l-.014.002l-.184.093l-.01.01l-.003.011l.018.43l.005.012l.008.008l.201.092q.019.005.029-.008l.004-.014l-.034-.614q-.005-.019-.02-.022m-.715.002a.02.02 0 0 0-.027.006l-.006.014l-.034.614q.001.018.017.024l.015-.002l.201-.093l.01-.008l.003-.011l.018-.43l-.003-.012l-.01-.01z"}),e.jsx("path",{d:"M10.586 2.807a2 2 0 0 1 2.828 0l7.778 7.779a2 2 0 0 1 0 2.828l-7.778 7.778a2 2 0 0 1-2.828 0l-7.778-7.778a2 2 0 0 1 0-2.828zM12 4.222L4.222 12L12 19.778L19.778 12z",fill:"currentColor"})]})})}function pe(t){return e.jsx("svg",{height:"1em",viewBox:"0 0 24 24",width:"1em",xmlns:"http://www.w3.org/2000/svg",...t,children:e.jsx("path",{d:"M16.01 11H4v2h12.01v3L20 12l-3.99-4z",fill:"currentColor"})})}function we(t){return e.jsx("svg",{height:"1em",viewBox:"0 0 24 24",width:"1em",xmlns:"http://www.w3.org/2000/svg",...t,children:e.jsx("path",{clipRule:"evenodd",d:"M7.53 3.47a.75.75 0 0 1 0 1.06L5.81 6.25H15a5.75 5.75 0 0 1 0 11.5H8a.75.75 0 0 1 0-1.5h7a4.25 4.25 0 0 0 0-8.5H5.81l1.72 1.72a.75.75 0 1 1-1.06 1.06l-3-3a.75.75 0 0 1 0-1.06l3-3a.75.75 0 0 1 1.06 0",fill:"currentColor",fillRule:"evenodd"})})}function ve(t){return e.jsx("svg",{height:"1em",viewBox:"0 0 24 24",width:"1em",xmlns:"http://www.w3.org/2000/svg",...t,children:e.jsx("path",{clipRule:"evenodd",d:"M16.47 3.47a.75.75 0 0 1 1.06 0l3 3a.75.75 0 0 1 0 1.06l-3 3a.75.75 0 1 1-1.06-1.06l1.72-1.72H9a4.25 4.25 0 0 0 0 8.5h7a.75.75 0 0 1 0 1.5H9a5.75 5.75 0 0 1 0-11.5h9.19l-1.72-1.72a.75.75 0 0 1 0-1.06",fill:"currentColor",fillRule:"evenodd"})})}function Ce(t){return e.jsx("svg",{height:"1em",viewBox:"0 0 24 24",width:"1em",xmlns:"http://www.w3.org/2000/svg",...t,children:e.jsx("path",{d:"M7 21q-.825 0-1.412-.587T5 19V6H4V4h5V3h6v1h5v2h-1v13q0 .825-.587 1.413T17 21zm2-4h2V8H9zm4 0h2V8h-2z",fill:"currentColor"})})}function fe(t){return e.jsx("svg",{height:"1em",viewBox:"0 0 256 256",width:"1em",xmlns:"http://www.w3.org/2000/svg",...t,children:e.jsx("path",{d:"M211.81 83.79a28 28 0 0 1-33.12 4.83l-90.07 90.07a28 28 0 1 1-44.43-6.48a28 28 0 0 1 33.12-4.83l90.07-90.07a28 28 0 1 1 44.43 6.48",fill:"currentColor"})})}function Te(t){return e.jsx("svg",{height:"1em",viewBox:"0 0 24 24",width:"1em",xmlns:"http://www.w3.org/2000/svg",...t,children:e.jsx("path",{d:"M12 20.325q-.35 0-.712-.125t-.638-.4l-1.725-1.575q-2.65-2.425-4.788-4.812T2 8.15Q2 5.8 3.575 4.225T7.5 2.65q1.325 0 2.5.562t2 1.538q.825-.975 2-1.537t2.5-.563q2.35 0 3.925 1.575T22 8.15q0 2.875-2.125 5.275T15.05 18.25l-1.7 1.55q-.275.275-.637.4t-.713.125M11.05 6.75q-.725-1.025-1.55-1.563t-2-.537q-1.5 0-2.5 1t-1 2.5q0 1.3.925 2.763t2.213 2.837t2.65 2.575T12 18.3q.85-.775 2.213-1.975t2.65-2.575t2.212-2.837T20 8.15q0-1.5-1-2.5t-2.5-1q-1.175 0-2 .538T12.95 6.75q-.175.25-.425.375T12 7.25t-.525-.125t-.425-.375m.95 4.725",fill:"currentColor"})})}function je(t){return e.jsx("svg",{height:"1em",viewBox:"0 0 24 24",width:"1em",xmlns:"http://www.w3.org/2000/svg",...t,children:e.jsx("path",{d:"m7.625 6.4l2.8-3.625q.3-.4.713-.587T12 2t.863.188t.712.587l2.8 3.625l4.25 1.425q.65.2 1.025.738t.375 1.187q0 .3-.088.6t-.287.575l-2.75 3.9l.1 4.1q.025.875-.575 1.475t-1.4.6q-.05 0-.55-.075L12 19.675l-4.475 1.25q-.125.05-.275.063T6.975 21q-.8 0-1.4-.6T5 18.925l.1-4.125l-2.725-3.875q-.2-.275-.288-.575T2 9.75q0-.625.363-1.162t1.012-.763zM8.85 8.125L4 9.725L7.1 14.2L7 18.975l5-1.375l5 1.4l-.1-4.8L20 9.775l-4.85-1.65L12 4zM12 11.5",fill:"currentColor"})})}function be(t){return e.jsx("svg",{height:"1em",viewBox:"0 0 24 24",width:"1em",xmlns:"http://www.w3.org/2000/svg",...t,children:e.jsx("path",{d:"M12.01 6c2.61 0 4.89 1.86 5.4 4.43l.3 1.5l1.52.11c1.56.11 2.78 1.41 2.78 2.96c0 1.65-1.35 3-3 3h-13c-2.21 0-4-1.79-4-4c0-2.05 1.53-3.76 3.56-3.97l1.07-.11l.5-.95A5.46 5.46 0 0 1 12.01 6m0-2C9.12 4 6.6 5.64 5.35 8.04C2.35 8.36.01 10.91.01 14c0 3.31 2.69 6 6 6h13c2.76 0 5-2.24 5-5c0-2.64-2.05-4.78-4.64-4.96C18.68 6.59 15.65 4 12.01 4",fill:"currentColor"})})}function Me(t){return e.jsx("svg",{height:"1em",viewBox:"0 0 24 24",width:"1em",xmlns:"http://www.w3.org/2000/svg",...t,children:e.jsx("path",{d:"M5.586 6.45A2 2 0 0 1 7.509 5h11.84a2 2 0 0 1 1.923 2.55l-2.858 10A2 2 0 0 1 16.491 19H4.651a2 2 0 0 1-1.923-2.55z",fill:"none",stroke:"currentColor",strokeWidth:"2"})})}const ye=[g.Color4.blackHighlight,g.Color4.ofRGBA(166/255,81/255,167/255,.3),g.Color4.ofRGBA(247/255,78/255,158/255,.3),g.Color4.ofRGBA(166/255,83/255,88/255,.3),g.Color4.ofRGBA(246/255,130/255,28/255,.3),g.Color4.ofRGBA(166/255,198/255,0,.3),g.Color4.ofRGBA(98/255,186/255,70/255,.3)],$=[g.Color4.black,g.Color4.fromHex("#007AFF"),g.Color4.fromHex("#A651A7"),g.Color4.fromHex("#F74E9E"),g.Color4.fromHex("#FF5358"),g.Color4.fromHex("#F6821C"),g.Color4.fromHex("#FFC600"),g.Color4.fromHex("#62BA46"),g.Color4.fromHex("#E6BFE8"),g.Color4.fromHex("#FEA3D2"),g.Color4.fromHex("#FFA0A3"),g.Color4.fromHex("#FBC276"),g.Color4.fromHex("#FFFB85"),g.Color4.fromHex("#AADC99")];function Se({onChange:t}){const[o,r]=m.useState(g.Color4.blackHighlight);return e.jsx("div",{className:l.colorWrap,children:ye.map((s,i)=>e.jsx("button",{style:{backgroundColor:s.toHexString()},className:a.cn(l.color,{[l.colorActive]:o.toHexString()===s.toHexString()}),onClick:()=>{r(s),t(s)}},i))})}function F({onChange:t}){const[o,r]=m.useState(g.Color4.black);return e.jsxs(e.Fragment,{children:[e.jsx("div",{className:l.colorWrap,children:$.slice(0,7).map((s,i)=>e.jsx("button",{style:{backgroundColor:s.toHexString()},className:a.cn(l.color,{[l.colorActive]:o.toHexString()===s.toHexString()}),onClick:()=>{r(s),t(s)}},i))}),e.jsx("div",{className:l.colorWrap,children:$.slice(7).map((s,i)=>e.jsx("button",{style:{backgroundColor:s.toHexString()},className:a.cn(l.color,{[l.colorActive]:o.toHexString()===s.toHexString()}),onClick:()=>{r(s),t(s)}},i))})]})}function Ee({setColorPen:t,setThicknessPen:o}){const[r,s]=m.useState(2);return e.jsxs("div",{className:l.options,children:[e.jsx("div",{children:e.jsx(F,{onChange:i=>t(i)})}),e.jsx("div",{className:l.line}),e.jsx("div",{children:e.jsx("input",{max:10,min:1,step:.1,type:"range",value:r,onChange:i=>{o(Number.parseFloat(i.target.value)),s(Number.parseFloat(i.target.value))}})})]})}function He({setColorHighlight:t}){return e.jsx("div",{className:l.options,children:e.jsx(Se,{onChange:o=>t(o)})})}function Le({changeColorShape:t,changeBorderColorShape:o,onThicknessChange:r}){return e.jsxs("div",{className:l.options,children:[e.jsx("div",{children:e.jsx(F,{onChange:s=>t(s)})}),e.jsx("div",{className:l.line}),e.jsx("div",{children:e.jsx(F,{onChange:s=>o(s)})}),e.jsx("div",{className:l.line}),e.jsx("div",{children:e.jsx("input",{defaultValue:0,max:20,min:0,step:1,type:"range",onChange:s=>{r(Number.parseFloat(s.target.value))}})})]})}function Z(t){const{setColorPen:o,refEditor:r,setThicknessPen:s,setColorHighlight:i,changeBorderColorShape:T,onUndo:A,changeColorShape:N,changeShape:C,onThicknessChange:H,onRedo:j,onClear:z}=t,[c,u]=m.useState(null),[f,x]=m.useState(0);return e.jsx(e.Fragment,{children:e.jsxs("div",{className:l.wrapper,children:[e.jsxs("div",{className:l.pen,children:[e.jsx("button",{className:a.cn(l.tool,{[l.active]:c==="select"}),onClick:()=>{const n=r.current.toolController.getPrimaryTools();if(c==="select"){u(null),n[0].setEnabled(!1);return}u("select"),n[0].setEnabled(!0)},children:e.jsx(ne,{})}),e.jsx("div",{className:l.line}),e.jsx("button",{className:a.cn(l.tool,{[l.active]:c==="text"}),onClick:()=>{const n=r.current.toolController.getPrimaryTools();if(r.current.toolController.setToolEnabled(n[1]),c==="text"){n[1].setEnabled(!1),u(null);return}u("text"),n[1].setEnabled(!0)},children:e.jsx(se,{})}),e.jsx("div",{className:l.line}),e.jsx("button",{className:a.cn(l.tool,{[l.active]:c==="pencil"}),onClick:()=>{const n=r.current.toolController.getPrimaryTools();if(c==="pencil"){u(null),n[2].setEnabled(!1);return}u("pencil"),n[2].setEnabled(!0)},children:e.jsx(ie,{})}),e.jsx("button",{className:a.cn(l.tool,{[l.active]:c==="highlighter"}),onClick:()=>{const n=r.current.toolController.getPrimaryTools();if(c==="highlighter"){u(null),n[3].setEnabled(!1);return}u("highlighter"),n[3].setEnabled(!0)},children:e.jsx(ae,{})}),e.jsx("div",{className:l.line}),e.jsx("button",{className:a.cn(l.tool,{[l.active]:c==="eraser"}),onClick:()=>{const n=r.current.toolController.getPrimaryTools();if(c==="eraser"){u(null),n[4].setEnabled(!1);return}u("eraser"),n[4].setEnabled(!0)},children:e.jsx(ce,{})}),e.jsx("div",{className:l.line}),e.jsx("button",{className:a.cn(l.tool,{[l.active]:c==="shapes"&&f===0}),onClick:()=>{const n=r.current.toolController.getPrimaryTools();r.current.toolController.setToolEnabled(n[5]),u("shapes"),n[5].setEnabled(!0),C(0),x(0)},children:e.jsx(he,{})}),e.jsx("button",{className:a.cn(l.tool,{[l.active]:c==="shapes"&&f===1}),onClick:()=>{const n=r.current.toolController.getPrimaryTools();r.current.toolController.setToolEnabled(n[5]),u("shapes"),n[5].setEnabled(!0),C(1),x(1)},children:e.jsx(ue,{})}),e.jsx("button",{className:a.cn(l.tool,{[l.active]:c==="shapes"&&f===2}),onClick:()=>{const n=r.current.toolController.getPrimaryTools();r.current.toolController.setToolEnabled(n[5]),u("shapes"),n[5].setEnabled(!0),C(2),x(2)},children:e.jsx(de,{})}),e.jsx("button",{className:a.cn(l.tool,{[l.active]:c==="shapes"&&f===3}),onClick:()=>{const n=r.current.toolController.getPrimaryTools();r.current.toolController.setToolEnabled(n[5]),u("shapes"),n[5].setEnabled(!0),C(3),x(3)},children:e.jsx(ge,{})}),e.jsx("button",{className:a.cn(l.tool,{[l.active]:c==="shapes"&&f===4}),onClick:()=>{const n=r.current.toolController.getPrimaryTools();r.current.toolController.setToolEnabled(n[5]),u("shapes"),n[5].setEnabled(!0),C(4),x(4)},children:e.jsx(me,{})}),e.jsx("button",{className:a.cn(l.tool,{[l.active]:c==="shapes"&&f===5}),onClick:()=>{const n=r.current.toolController.getPrimaryTools();r.current.toolController.setToolEnabled(n[5]),u("shapes"),n[5].setEnabled(!0),C(5),x(5)},children:e.jsx(xe,{})}),e.jsx("button",{className:a.cn(l.tool,{[l.active]:c==="shapes"&&f===6}),onClick:()=>{const n=r.current.toolController.getPrimaryTools();r.current.toolController.setToolEnabled(n[5]),u("shapes"),n[5].setEnabled(!0),C(6),x(6)},children:e.jsx(pe,{})}),e.jsx("button",{className:a.cn(l.tool,{[l.active]:c==="shapes"&&f===7}),onClick:()=>{const n=r.current.toolController.getPrimaryTools();r.current.toolController.setToolEnabled(n[5]),u("shapes"),n[5].setEnabled(!0),C(7),x(7)},children:e.jsx(fe,{})}),e.jsx("button",{className:a.cn(l.tool,{[l.active]:c==="shapes"&&f===8}),onClick:()=>{const n=r.current.toolController.getPrimaryTools();r.current.toolController.setToolEnabled(n[5]),u("shapes"),n[5].setEnabled(!0),C(8),x(8)},children:e.jsx(Te,{})}),e.jsx("button",{className:a.cn(l.tool,{[l.active]:c==="shapes"&&f===9}),onClick:()=>{const n=r.current.toolController.getPrimaryTools();r.current.toolController.setToolEnabled(n[5]),u("shapes"),n[5].setEnabled(!0),C(9),x(9)},children:e.jsx(je,{})}),e.jsx("button",{className:a.cn(l.tool,{[l.active]:c==="shapes"&&f===10}),onClick:()=>{const n=r.current.toolController.getPrimaryTools();r.current.toolController.setToolEnabled(n[5]),u("shapes"),n[5].setEnabled(!0),C(10),x(10)},children:e.jsx(be,{})}),e.jsx("button",{className:a.cn(l.tool,{[l.active]:c==="shapes"&&f===11}),onClick:()=>{const n=r.current.toolController.getPrimaryTools();r.current.toolController.setToolEnabled(n[5]),u("shapes"),n[5].setEnabled(!0),C(11),x(11)},children:e.jsx(Me,{})}),e.jsx("div",{className:l.line}),e.jsx("button",{className:a.cn(l.tool),onClick:A,children:e.jsx(we,{})}),e.jsx("button",{className:a.cn(l.tool),onClick:j,children:e.jsx(ve,{})}),e.jsx("button",{className:a.cn(l.tool),onClick:z,children:e.jsx(Ce,{})})]}),e.jsxs("div",{className:l.optionsWrap,children:[c==="pencil"&&e.jsx(Ee,{setColorPen:o,setThicknessPen:s}),c==="highlighter"&&e.jsx(He,{setColorHighlight:i}),c==="shapes"&&e.jsx(Le,{changeBorderColorShape:T,changeColorShape:N,changeShape:C,onThicknessChange:H})]})]})})}let B=!1;const ke=({editor:t,upload:o})=>{const[r,s]=m.useState(!1),i=m.useRef(null),T=m.useRef(null),A=()=>{(async()=>{const h=document.querySelector("#easydrawer");h&&(i.current=new g.Editor(h,{wheelEventsEnabled:!1,disableZoom:!0}),T.current=g.makeDropdownToolbar(i.current),T.current.addDefaultToolWidgets())})()};m.useEffect(()=>{r&&setTimeout(()=>{A()},200)},[r]);const N=async()=>{if(i.current){const p=i.current.toSVG(),h=p.outerHTML,w=`drawer-${G.shortId()}.svg`;let E=G.i(p.outerHTML);if(o){const _=a.dataURLtoFile(E,w);E=await o(_)}t==null||t.chain().focus().setDrawer({type:"drawer",src:E,alt:encodeURIComponent(h),width:426,height:212},!!h).run()}s(!1)},C=p=>{const h=i.current.toolController.getPrimaryTools()[2],w=T.current.getWidgetById("pen-1");h&&w&&(h.setColor(p),w.serializeState())},H=p=>{const h=i.current.toolController.getPrimaryTools()[2],w=T.current.getWidgetById("pen-1");h&&w&&(h.setThickness(p),w.serializeState())},j=p=>{const h=i.current.toolController.getPrimaryTools()[3],w=T.current.getWidgetById("pen-2");h&&w&&(h.setColor(p),w.serializeState())},z=p=>{const h=T.current.getWidgetById("shape");h&&h.setShapeType(p)},c=p=>{const h=i.current.toolController.getPrimaryTools()[5],w=T.current.getWidgetById("shape");h&&w&&(h.setColor(p),w.serializeState())},u=p=>{const h=i.current.toolController.getPrimaryTools()[5],w=T.current.getWidgetById("shape");h&&w&&(h.setThickness(p),w.serializeState())},f=p=>{const h=i.current.toolController.getPrimaryTools()[5],w=T.current.getWidgetById("shape");h&&w&&(h.setBorderColor(p),w.serializeState())},x=()=>{if(B){for(;i.current.history.redoStackSize>0;)i.current.history.redo();B=!1;return}i.current.history.undo()},n=()=>{B||i.current.history.redo()},I=()=>{if(!B){for(;i.current.history.undoStackSize>0;)x();B=!0}};return e.jsxs(a.Dialog,{onOpenChange:s,open:r,children:[e.jsx(a.DialogTrigger,{asChild:!0,children:e.jsx(a.ActionButton,{action:()=>s(!0),icon:"PencilRuler",tooltip:"Drawer"})}),e.jsxs(a.DialogContent,{className:"richtext-z-[99999] !richtext-max-w-[1300px]",children:[e.jsx(a.DialogTitle,{children:"Drawer"}),e.jsxs("div",{style:{height:"600px",width:"100%",borderWidth:1,background:"white",position:"relative"},children:[e.jsx("div",{className:"richtext-size-full",id:"easydrawer"}),e.jsx(Z,{changeBorderColorShape:f,changeColorShape:c,changeShape:z,onClear:I,onRedo:n,onThicknessChange:u,onUndo:x,refEditor:i,setColorHighlight:j,setColorPen:C,setThicknessPen:H})]}),e.jsx(a.DialogFooter,{children:e.jsx(a.Button,{onClick:N,type:"button",children:"Save changes"})})]})]})},P={TOP_LEFT:"tl",TOP_RIGHT:"tr",BOTTOM_LEFT:"bl",BOTTOM_RIGHT:"br"};function Ne({editor:t,node:o,updateAttributes:r,getPos:s,selected:i}){const[T,A]=m.useState({width:q.IMAGE_MAX_SIZE,height:q.IMAGE_MAX_SIZE}),[N,C]=m.useState({width:0,height:0}),[H]=m.useState([P.TOP_LEFT,P.TOP_RIGHT,P.BOTTOM_LEFT,P.BOTTOM_RIGHT]),[j,z]=m.useState(!1),[c,u]=m.useState({x:0,y:0,w:0,h:0,dir:""}),{align:f}=o==null?void 0:o.attrs,x=m.useMemo(()=>{const{src:d,alt:M,width:y,height:L}=o==null?void 0:o.attrs,k=D.isNumber(y)?`${y}px`:y,v=D.isNumber(L)?`${L}px`:L;return{src:d||void 0,alt:M||void 0,style:{width:k||void 0,height:v||void 0}}},[o==null?void 0:o.attrs]),n=m.useMemo(()=>{const{style:{width:d}}=x;return{width:d==="100%"?d:void 0}},[x]);function I(d){C({width:d.target.width,height:d.target.height})}function p(){t.commands.setNodeSelection(s())}const h=m.useCallback(a.throttle(()=>{const{width:d}=getComputedStyle(t.view.dom);A(M=>({...M,width:Number.parseInt(d,10)}))},q.IMAGE_THROTTLE_WAIT_TIME),[t]);function w(d,M){d.preventDefault(),d.stopPropagation();const y=N.width,L=N.height,k=y/L;let v=Number(o.attrs.width),S=Number(o.attrs.height);const b=T.width;v&&!S?(v=v>b?b:v,S=Math.round(v/k)):S&&!v?(v=Math.round(S*k),v=v>b?b:v):!v&&!S?(v=y>b?b:y,S=Math.round(v/k)):v=v>b?b:v,z(!0),u({x:d.clientX,y:d.clientY,w:v,h:S,dir:M})}const E=m.useCallback(a.throttle(d=>{if(d.preventDefault(),d.stopPropagation(),!j)return;const{x:M,w:y,dir:L}=c,k=(d.clientX-M)*(/l/.test(L)?-1:1),{width:v,height:S}=o==null?void 0:o.attrs,b=v/S,V=a.clamp(y+k,q.IMAGE_MIN_SIZE,T.width),X=Math.round(V/b);r({width:V,height:X})},q.IMAGE_THROTTLE_WAIT_TIME),[j,c,T,r,o==null?void 0:o.attrs]),_=m.useCallback(d=>{d.preventDefault(),d.stopPropagation(),j&&(u({x:0,y:0,w:0,h:0,dir:""}),z(!1),p())},[j,p]),O=m.useCallback(()=>{document==null||document.addEventListener("mousemove",E,!0),document==null||document.addEventListener("mouseup",_,!0)},[E,_]),R=m.useCallback(()=>{document==null||document.removeEventListener("mousemove",E,!0),document==null||document.removeEventListener("mouseup",_,!0)},[E,_]);m.useEffect(()=>(j?O():R(),()=>{R()}),[j,O,R]);const W=m.useMemo(()=>new ResizeObserver(()=>h()),[h]);return m.useEffect(()=>(W.observe(t.view.dom),()=>{W.disconnect()}),[t.view.dom,W]),e.jsx(U.NodeViewWrapper,{className:"image-view",style:{...n,width:"100%",textAlign:f},children:e.jsxs("div",{"data-drag-handle":!0,draggable:"true",style:{...n,background:"#fff"},className:`image-view__body ${i?"image-view__body--focused":""} ${j?"image-view__body--resizing":""}`,children:[e.jsx("img",{alt:x.alt,className:"image-view__body__image block",height:"auto",onClick:p,onLoad:I,src:x.src,style:x.style}),t.view.editable&&(i||j)&&e.jsx("div",{className:"image-resizer",children:H==null?void 0:H.map(d=>e.jsx("span",{className:`image-resizer__handler image-resizer__handler--${d}`,onMouseDown:M=>w(M,d)},`image-dir-${d}`))})]})})}const ze=a.Image.extend({name:"drawer",addOptions(){var t;return{...(t=this.parent)==null?void 0:t.call(this),inline:!1,content:"",marks:"",group:"block",draggable:!1,selectable:!0,atom:!0,HTMLAttributes:{class:"drawer"},button:({editor:o,t:r,extension:s})=>{var i;return{component:ke,componentProps:{action:()=>!0,isActive:()=>!1,disabled:!1,editor:o,icon:"PencilRuler",tooltip:r("editor.drawer.tooltip"),upload:(i=s==null?void 0:s.options)==null?void 0:i.upload}}}}},addAttributes(){var t;return{...(t=this.parent)==null?void 0:t.call(this),width:{default:null,parseHTML:o=>{const r=o.querySelector("img"),s=r==null?void 0:r.getAttribute("width");return s?Number.parseInt(s,10):320},renderHTML:o=>({width:o.width})},height:{default:null,parseHTML:o=>{const r=o.querySelector("img"),s=r==null?void 0:r.getAttribute("height");return s?Number.parseInt(s,10):212},renderHTML:o=>({height:o.height})},align:{default:"center",parseHTML:o=>o.getAttribute("align"),renderHTML:o=>({align:o.align})}}},addNodeView(){return U.ReactNodeViewRenderer(Ne)},addCommands(){return{setDrawer:(t,o)=>({commands:r,editor:s})=>o?r.insertContent({type:this.name,attrs:t}):r.insertContentAt(s.state.selection.anchor,{type:this.name,attrs:t}),setAlignImageDrawer:t=>({commands:o})=>o.updateAttributes(this.name,{align:t})}},renderHTML({HTMLAttributes:t}){const{align:o}=t;return["div",{style:o?`text-align: ${o};`:"",class:"imageDrawer"},["img",D.mergeAttributes(this.options.HTMLAttributes,t)]]},parseHTML(){return[{tag:"div[class=imageDrawer]",getAttrs:t=>{const o=t.querySelector("img"),r=o==null?void 0:o.getAttribute("width"),s=o==null?void 0:o.getAttribute("height");return{src:o==null?void 0:o.getAttribute("src"),alt:o==null?void 0:o.getAttribute("alt"),width:r?Number.parseInt(r,10):null,height:s?Number.parseInt(s,10):null,align:(o==null?void 0:o.getAttribute("align"))||t.style.textAlign||null}}}]}});exports.ControlDrawer=Z;exports.Drawer=ze;
@@ -1,289 +0,0 @@
1
- import { N as Z, n as k, m as z } from "./index-DI9T3iLd.js";
2
- import { N as P, c as C, R as j, n as V, g as y } from "./dom-dataset-Di3tIRrR.js";
3
- import { jsxs as w, jsx as n } from "react/jsx-runtime";
4
- import { useMemo as B, useState as o, useCallback as f, useEffect as A, useRef as U } from "react";
5
- import { w as $, x as F, A as M, y as X, z as G, F as K, B as Y, K as q } from "./RichTextEditor-BQN2eLD_.js";
6
- import { o as J } from "./index-CsK90iVd.js";
7
- import { Resizable as Q } from "re-resizable";
8
- let I;
9
- function D() {
10
- try {
11
- return I || (I = J()), I;
12
- } catch {
13
- throw new Error("Error EventEmitter");
14
- }
15
- }
16
- const S = "OPEN_EXCALIDRAW_SETTING_MODAL";
17
- function ee(e, a) {
18
- D().on(e, a);
19
- }
20
- function te(e, a) {
21
- D().off(e, a);
22
- }
23
- function we(e) {
24
- D().emit(S, e);
25
- }
26
- const re = ({ editor: e }) => {
27
- const a = B(() => {
28
- var t;
29
- return ((t = e.extensionManager.extensions.find(
30
- (r) => r.name === "excalidraw"
31
- )) == null ? void 0 : t.options) || {};
32
- }, [e]), [i, h] = o(null), [p, l] = o({}), [m, E] = o({ elements: [], appState: { isLoading: !1 }, files: null }), [u, c] = o(!1), [d, x] = o(!0), [s, T] = o(null), _ = f(
33
- (t) => {
34
- t && import("@excalidraw/excalidraw").then((r) => {
35
- h(r.Excalidraw);
36
- }).catch(T).finally(() => x(!1));
37
- },
38
- [x]
39
- ), N = f((t) => {
40
- setTimeout(() => {
41
- t.refresh();
42
- });
43
- }, []), v = f((t, r, g) => {
44
- l({
45
- elements: t,
46
- appState: { isLoading: !1 },
47
- files: g
48
- });
49
- }, []), L = f(() => {
50
- if (!i) {
51
- c(!1);
52
- return;
53
- }
54
- e.chain().focus().setExcalidraw({ data: p }).run(), c(!1);
55
- }, [i, e, p, c]);
56
- return A(() => {
57
- const t = (r) => {
58
- (r == null ? void 0 : r.editor) === e && (c(!0), r && E(r.data));
59
- };
60
- return ee(S, t), () => {
61
- te(S, t);
62
- };
63
- }, [e, c]), A(() => {
64
- !d && i && u && setTimeout(() => {
65
- window.dispatchEvent(new Event("resize"));
66
- }, 400);
67
- }, [d, i, u]), /* @__PURE__ */ w(
68
- $,
69
- {
70
- onOpenChange: c,
71
- open: u,
72
- children: [
73
- /* @__PURE__ */ n(F, { asChild: !0, children: /* @__PURE__ */ n(
74
- M,
75
- {
76
- action: () => c(!0),
77
- icon: "Excalidraw",
78
- tooltip: "Excalidraw"
79
- }
80
- ) }),
81
- /* @__PURE__ */ w(X, { className: "richtext-z-[99999] !richtext-max-w-[1300px]", children: [
82
- /* @__PURE__ */ n(G, { children: "Excalidraw" }),
83
- /* @__PURE__ */ w("div", { style: { height: "100%", borderWidth: 1 }, children: [
84
- d && /* @__PURE__ */ n("p", { children: "Loading..." }),
85
- s && /* @__PURE__ */ n("p", { children: s && s.message || "Error" }),
86
- /* @__PURE__ */ n(
87
- "div",
88
- {
89
- ref: _,
90
- style: { width: "100%", height: 600 },
91
- children: !d && !s && i ? /* @__PURE__ */ n(
92
- i,
93
- {
94
- initialData: m,
95
- langCode: "en",
96
- onChange: v,
97
- ref: N,
98
- ...a.excalidrawProps
99
- }
100
- ) : null
101
- }
102
- )
103
- ] }),
104
- /* @__PURE__ */ n(K, { children: /* @__PURE__ */ n(
105
- Y,
106
- {
107
- onClick: L,
108
- type: "button",
109
- children: "Save changes"
110
- }
111
- ) })
112
- ] })
113
- ]
114
- }
115
- );
116
- }, ne = "_wrap_15k3c_1", ae = "_renderWrap_15k3c_7", ie = "_handlerWrap_15k3c_30", b = {
117
- wrap: ne,
118
- renderWrap: ae,
119
- handlerWrap: ie
120
- }, se = 10, oe = 200, R = 15, W = { width: "100%", height: "100%", maxWidth: "100%" };
121
- function le({ editor: e, node: a, updateAttributes: i }) {
122
- const h = U(null), p = e.isActive(ce.name), { data: l, width: m, height: E } = a.attrs, [u, c] = o(null), [d, x] = o(!0), [s, T] = o(null), [_, N] = o(100), v = f((t) => () => {
123
- N(
124
- (r) => q(t === "minus" ? r - R : r + R, se, oe)
125
- );
126
- }, []);
127
- A(() => {
128
- let t = !1;
129
- return import("@excalidraw/excalidraw").then((r) => {
130
- t || (h.current = r.exportToSvg);
131
- }).catch((r) => !t && T(r)).finally(() => !t && x(!1)), () => {
132
- t = !0;
133
- };
134
- }, [l]), A(() => {
135
- let t = !1;
136
- return (async () => {
137
- if (!h.current || t || d || s || !l)
138
- return;
139
- const g = await h.current(l);
140
- t || (g.setAttribute("width", "100%"), g.setAttribute("height", "100%"), g.setAttribute("display", "block"), c(g));
141
- })(), () => {
142
- t = !0;
143
- };
144
- }, [l, d, s]);
145
- const L = (t) => {
146
- i({ width: t.width, height: t.height });
147
- };
148
- return /* @__PURE__ */ n(P, { className: C(b.wrap, p && b.isActive), children: /* @__PURE__ */ n(
149
- Q,
150
- {
151
- size: { width: Number.parseInt(m), height: Number.parseInt(E) },
152
- onResizeStop: (t, r, g, O) => {
153
- L({
154
- width: Number.parseInt(m) + O.width,
155
- height: Number.parseInt(E) + O.height
156
- });
157
- },
158
- children: /* @__PURE__ */ w(
159
- "div",
160
- {
161
- className: C(b.renderWrap, "render-wrapper"),
162
- style: { ...W, overflow: "hidden" },
163
- children: [
164
- s && /* @__PURE__ */ n("div", { style: W, children: /* @__PURE__ */ n("p", { children: s.message || s }) }),
165
- d && /* @__PURE__ */ n("p", { children: "Loading..." }),
166
- !d && !s && u && /* @__PURE__ */ n(
167
- "div",
168
- {
169
- dangerouslySetInnerHTML: { __html: (u == null ? void 0 : u.outerHTML) ?? "" },
170
- style: {
171
- height: "100%",
172
- maxHeight: "100%",
173
- padding: 24,
174
- overflow: "hidden",
175
- display: "flex",
176
- justifyContent: "center",
177
- alignItems: "center",
178
- transform: `scale(${_ / 100})`,
179
- transition: "all ease-in-out .3s"
180
- }
181
- }
182
- ),
183
- /* @__PURE__ */ w("div", { className: b.handlerWrap, children: [
184
- /* @__PURE__ */ n(
185
- M,
186
- {
187
- action: v("minus"),
188
- icon: "ZoomOut",
189
- tooltip: "Zoom Out"
190
- }
191
- ),
192
- /* @__PURE__ */ n(
193
- M,
194
- {
195
- action: v("plus"),
196
- icon: "ZoomIn",
197
- tooltip: "Zoom In"
198
- }
199
- )
200
- ] })
201
- ]
202
- }
203
- )
204
- }
205
- ) });
206
- }
207
- const H = { elements: [] }, ce = /* @__PURE__ */ Z.create({
208
- name: "excalidraw",
209
- group: "block",
210
- selectable: !0,
211
- atom: !0,
212
- draggable: !0,
213
- inline: !1,
214
- addAttributes() {
215
- return {
216
- defaultShowPicker: {
217
- default: !1
218
- },
219
- createUser: {
220
- default: null
221
- },
222
- width: {
223
- default: "100%",
224
- parseHTML: y("width")
225
- },
226
- height: {
227
- default: 240,
228
- parseHTML: y("height")
229
- },
230
- data: {
231
- default: H,
232
- parseHTML: y("data", !0)
233
- }
234
- };
235
- },
236
- addOptions() {
237
- var e;
238
- return {
239
- ...(e = this.parent) == null ? void 0 : e.call(this),
240
- HTMLAttributes: {
241
- class: "excalidraw"
242
- },
243
- excalidrawProps: {},
244
- button: ({ editor: a }) => ({
245
- component: re,
246
- componentProps: {
247
- editor: a
248
- }
249
- })
250
- };
251
- },
252
- parseHTML() {
253
- return [
254
- {
255
- tag: "div[class=excalidraw]"
256
- }
257
- ];
258
- },
259
- renderHTML({ HTMLAttributes: e, node: a }) {
260
- return ["div", z(this.options.HTMLAttributes, e, V(a))];
261
- },
262
- addCommands() {
263
- return {
264
- setExcalidraw: (e) => ({ tr: a, commands: i, chain: h }) => {
265
- var p, l, m;
266
- return e = e || {}, e.data = e.data || H, ((m = (l = (p = a.selection) == null ? void 0 : p.node) == null ? void 0 : l.type) == null ? void 0 : m.name) == this.name ? i.updateAttributes(this.name, e) : h().insertContent({
267
- type: this.name,
268
- attrs: e
269
- }).run();
270
- }
271
- };
272
- },
273
- addNodeView() {
274
- return j(le);
275
- },
276
- addInputRules() {
277
- return [
278
- k({
279
- find: /^\$excalidraw\$$/,
280
- type: this.type,
281
- getAttributes: () => ({ width: "100%" })
282
- })
283
- ];
284
- }
285
- });
286
- export {
287
- ce as E,
288
- we as t
289
- };
@@ -1 +0,0 @@
1
- "use strict";var W=Object.create;var N=Object.defineProperty;var H=Object.getOwnPropertyDescriptor;var Z=Object.getOwnPropertyNames;var q=Object.getPrototypeOf,z=Object.prototype.hasOwnProperty;var P=(e,n,i,l)=>{if(n&&typeof n=="object"||typeof n=="function")for(let o of Z(n))!z.call(e,o)&&o!==i&&N(e,o,{get:()=>n[o],enumerable:!(l=H(n,o))||l.enumerable});return e};var y=(e,n,i)=>(i=e!=null?W(q(e)):{},P(n||!e||!e.__esModule?N(i,"default",{value:e,enumerable:!0}):i,e));const _=require("./index-ByRfqzMr.cjs"),x=require("./dom-dataset-Byuf1YmW.cjs"),r=require("react/jsx-runtime"),a=require("react"),u=require("./RichTextEditor-C8Sm1E6J.cjs"),B=require("./index-D_A0TBRA.cjs"),V=require("re-resizable");let L;function D(){try{return L||(L=B.mitt()),L}catch{throw new Error("Error EventEmitter")}}const M="OPEN_EXCALIDRAW_SETTING_MODAL";function $(e,n){D().on(e,n)}function U(e,n){D().off(e,n)}function X(e){D().emit(M,e)}const F=({editor:e})=>{const n=a.useMemo(()=>{var t;return((t=e.extensionManager.extensions.find(s=>s.name==="excalidraw"))==null?void 0:t.options)||{}},[e]),[i,l]=a.useState(null),[o,d]=a.useState({}),[f,m]=a.useState({elements:[],appState:{isLoading:!1},files:null}),[g,h]=a.useState(!1),[p,E]=a.useState(!0),[c,A]=a.useState(null),S=a.useCallback(t=>{t&&import("@excalidraw/excalidraw").then(s=>{l(s.Excalidraw)}).catch(A).finally(()=>E(!1))},[E]),j=a.useCallback(t=>{setTimeout(()=>{t.refresh()})},[]),b=a.useCallback((t,s,w)=>{d({elements:t,appState:{isLoading:!1},files:w})},[]),T=a.useCallback(()=>{if(!i){h(!1);return}e.chain().focus().setExcalidraw({data:o}).run(),h(!1)},[i,e,o,h]);return a.useEffect(()=>{const t=s=>{(s==null?void 0:s.editor)===e&&(h(!0),s&&m(s.data))};return $(M,t),()=>{U(M,t)}},[e,h]),a.useEffect(()=>{!p&&i&&g&&setTimeout(()=>{window.dispatchEvent(new Event("resize"))},400)},[p,i,g]),r.jsxs(u.Dialog,{onOpenChange:h,open:g,children:[r.jsx(u.DialogTrigger,{asChild:!0,children:r.jsx(u.ActionButton,{action:()=>h(!0),icon:"Excalidraw",tooltip:"Excalidraw"})}),r.jsxs(u.DialogContent,{className:"richtext-z-[99999] !richtext-max-w-[1300px]",children:[r.jsx(u.DialogTitle,{children:"Excalidraw"}),r.jsxs("div",{style:{height:"100%",borderWidth:1},children:[p&&r.jsx("p",{children:"Loading..."}),c&&r.jsx("p",{children:c&&c.message||"Error"}),r.jsx("div",{ref:S,style:{width:"100%",height:600},children:!p&&!c&&i?r.jsx(i,{initialData:f,langCode:"en",onChange:b,ref:j,...n.excalidrawProps}):null})]}),r.jsx(u.DialogFooter,{children:r.jsx(u.Button,{onClick:T,type:"button",children:"Save changes"})})]})]})},G="_wrap_15k3c_1",Y="_renderWrap_15k3c_7",J="_handlerWrap_15k3c_30",v={wrap:G,renderWrap:Y,handlerWrap:J},K=10,Q=200,C=15,O={width:"100%",height:"100%",maxWidth:"100%"};function ee({editor:e,node:n,updateAttributes:i}){const l=a.useRef(null),o=e.isActive(k.name),{data:d,width:f,height:m}=n.attrs,[g,h]=a.useState(null),[p,E]=a.useState(!0),[c,A]=a.useState(null),[S,j]=a.useState(100),b=a.useCallback(t=>()=>{j(s=>u.clamp(t==="minus"?s-C:s+C,K,Q))},[]);a.useEffect(()=>{let t=!1;return import("@excalidraw/excalidraw").then(s=>{t||(l.current=s.exportToSvg)}).catch(s=>!t&&A(s)).finally(()=>!t&&E(!1)),()=>{t=!0}},[d]),a.useEffect(()=>{let t=!1;return(async()=>{if(!l.current||t||p||c||!d)return;const w=await l.current(d);t||(w.setAttribute("width","100%"),w.setAttribute("height","100%"),w.setAttribute("display","block"),h(w))})(),()=>{t=!0}},[d,p,c]);const T=t=>{i({width:t.width,height:t.height})};return r.jsx(x.NodeViewWrapper,{className:x.clsx(v.wrap,o&&v.isActive),children:r.jsx(V.Resizable,{size:{width:Number.parseInt(f),height:Number.parseInt(m)},onResizeStop:(t,s,w,I)=>{T({width:Number.parseInt(f)+I.width,height:Number.parseInt(m)+I.height})},children:r.jsxs("div",{className:x.clsx(v.renderWrap,"render-wrapper"),style:{...O,overflow:"hidden"},children:[c&&r.jsx("div",{style:O,children:r.jsx("p",{children:c.message||c})}),p&&r.jsx("p",{children:"Loading..."}),!p&&!c&&g&&r.jsx("div",{dangerouslySetInnerHTML:{__html:(g==null?void 0:g.outerHTML)??""},style:{height:"100%",maxHeight:"100%",padding:24,overflow:"hidden",display:"flex",justifyContent:"center",alignItems:"center",transform:`scale(${S/100})`,transition:"all ease-in-out .3s"}}),r.jsxs("div",{className:v.handlerWrap,children:[r.jsx(u.ActionButton,{action:b("minus"),icon:"ZoomOut",tooltip:"Zoom Out"}),r.jsx(u.ActionButton,{action:b("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:x.getDatasetAttribute("width")},height:{default:240,parseHTML:x.getDatasetAttribute("height")},data:{default:R,parseHTML:x.getDatasetAttribute("data",!0)}}},addOptions(){var e;return{...(e=this.parent)==null?void 0:e.call(this),HTMLAttributes:{class:"excalidraw"},excalidrawProps:{},button:({editor:n})=>({component:F,componentProps:{editor:n}})}},parseHTML(){return[{tag:"div[class=excalidraw]"}]},renderHTML({HTMLAttributes:e,node:n}){return["div",_.mergeAttributes(this.options.HTMLAttributes,e,x.nodeAttrsToDataset(n))]},addCommands(){return{setExcalidraw:e=>({tr:n,commands:i,chain:l})=>{var o,d,f;return e=e||{},e.data=e.data||R,((f=(d=(o=n.selection)==null?void 0:o.node)==null?void 0:d.type)==null?void 0:f.name)==this.name?i.updateAttributes(this.name,e):l().insertContent({type:this.name,attrs:e}).run()}}},addNodeView(){return x.ReactNodeViewRenderer(ee)},addInputRules(){return[_.nodeInputRule({find:/^\$excalidraw\$$/,type:this.type,getAttributes:()=>({width:"100%"})})]}});exports.Excalidraw=k;exports.triggerOpenExcalidrawSettingModal=X;