reactjs-tiptap-editor 1.0.19 → 1.0.20

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 (149) hide show
  1. package/lib/{ActionMenuButton-D3b_bcin.cjs → ActionMenuButton-BPgqKDXT.cjs} +1 -1
  2. package/lib/{ActionMenuButton-B1Nfn5Hm.js → ActionMenuButton-CMXWxvWu.js} +1 -1
  3. package/lib/Attachment.cjs +1 -1
  4. package/lib/Attachment.js +3 -3
  5. package/lib/Blockquote.cjs +1 -1
  6. package/lib/Blockquote.js +2 -2
  7. package/lib/Bold.cjs +1 -1
  8. package/lib/Bold.js +2 -2
  9. package/lib/BulletList.cjs +1 -1
  10. package/lib/BulletList.js +2 -2
  11. package/lib/Callout.cjs +1 -1
  12. package/lib/Callout.js +3 -3
  13. package/lib/Clear.cjs +1 -1
  14. package/lib/Clear.js +2 -2
  15. package/lib/Code.cjs +1 -1
  16. package/lib/Code.js +2 -2
  17. package/lib/CodeBlock.cjs +20 -44
  18. package/lib/CodeBlock.js +1385 -4011
  19. package/lib/CodeView.cjs +1 -1
  20. package/lib/CodeView.js +2 -2
  21. package/lib/Color.cjs +1 -1
  22. package/lib/Color.js +3 -3
  23. package/lib/Column.cjs +1 -1
  24. package/lib/Column.js +2 -2
  25. package/lib/{Drawer-kEO7KzzC.cjs → Drawer-BivLAzMN.cjs} +1 -1
  26. package/lib/{Drawer-B1-7Y4HB.js → Drawer-BmVmgJsc.js} +3 -3
  27. package/lib/Drawer.cjs +1 -1
  28. package/lib/Drawer.js +4 -4
  29. package/lib/Emoji.cjs +1 -1
  30. package/lib/Emoji.js +8 -8
  31. package/lib/Excalidraw.cjs +1 -1
  32. package/lib/Excalidraw.js +3 -3
  33. package/lib/ExportPdf.cjs +1 -1
  34. package/lib/ExportPdf.js +2 -2
  35. package/lib/ExportWord.cjs +1 -1
  36. package/lib/ExportWord.js +2 -2
  37. package/lib/FontFamily.cjs +1 -1
  38. package/lib/FontFamily.js +4 -4
  39. package/lib/FontSize.cjs +1 -1
  40. package/lib/FontSize.js +4 -4
  41. package/lib/Heading.cjs +1 -1
  42. package/lib/Heading.js +4 -4
  43. package/lib/Highlight.cjs +1 -1
  44. package/lib/Highlight.js +3 -3
  45. package/lib/History.cjs +1 -1
  46. package/lib/History.js +3 -3
  47. package/lib/HorizontalRule.cjs +1 -1
  48. package/lib/HorizontalRule.js +2 -2
  49. package/lib/{Iframe-XlAb03_r.js → Iframe-CAUrccA0.js} +3 -3
  50. package/lib/{Iframe-Bk5OIlvy.cjs → Iframe-hwg9FxhU.cjs} +1 -1
  51. package/lib/Iframe.cjs +1 -1
  52. package/lib/Iframe.js +3 -3
  53. package/lib/Image.cjs +1 -1
  54. package/lib/Image.js +3 -3
  55. package/lib/ImageGif.cjs +1 -1
  56. package/lib/ImageGif.js +4 -4
  57. package/lib/ImportWord.cjs +1 -1
  58. package/lib/ImportWord.js +2 -2
  59. package/lib/{Indent-ruPuj5xn.js → Indent-3MoIatX1.js} +2 -2
  60. package/lib/{Indent-XaZNTsOk.cjs → Indent-MuSU0kXz.cjs} +1 -1
  61. package/lib/Indent.cjs +1 -1
  62. package/lib/Indent.js +2 -2
  63. package/lib/Italic.cjs +1 -1
  64. package/lib/Italic.js +2 -2
  65. package/lib/Katex-BPQ7_A3w.cjs +4 -0
  66. package/lib/{Katex-DKspCn-p.js → Katex-xS-XZKQc.js} +400 -422
  67. package/lib/Katex.cjs +1 -1
  68. package/lib/Katex.js +3 -3
  69. package/lib/LineHeight.cjs +1 -1
  70. package/lib/LineHeight.js +3 -3
  71. package/lib/Link.cjs +1 -1
  72. package/lib/Link.js +2 -2
  73. package/lib/{LinkEditBlock-DhesHreq.cjs → LinkEditBlock-DLDY-8Ax.cjs} +1 -1
  74. package/lib/{LinkEditBlock-BWm2Ypt2.js → LinkEditBlock-Dhvz7DCA.js} +3 -3
  75. package/lib/MarkdownPaste.cjs +1 -1
  76. package/lib/MarkdownPaste.js +1 -1
  77. package/lib/Mention.cjs +1 -1
  78. package/lib/Mention.js +4 -4
  79. package/lib/Mermaid.cjs +1 -1
  80. package/lib/Mermaid.js +3 -3
  81. package/lib/MoreMark.cjs +1 -1
  82. package/lib/MoreMark.js +3 -3
  83. package/lib/OrderedList.cjs +1 -1
  84. package/lib/OrderedList.js +2 -2
  85. package/lib/SearchAndReplace.cjs +1 -1
  86. package/lib/SearchAndReplace.js +3 -3
  87. package/lib/SlashCommand.cjs +1 -1
  88. package/lib/SlashCommand.js +6 -6
  89. package/lib/{SlashCommandNodeView-CojfS61Q.cjs → SlashCommandNodeView-CavaOSwo.cjs} +1 -1
  90. package/lib/{SlashCommandNodeView-Hf2DX4km.js → SlashCommandNodeView-RnDRm4Z1.js} +1 -1
  91. package/lib/Strike.cjs +1 -1
  92. package/lib/Strike.js +2 -2
  93. package/lib/{Table-BTkFUATL.js → Table-DN4TuDz1.js} +35 -35
  94. package/lib/{Table-C1_xLqV0.cjs → Table-m32ZhtxF.cjs} +1 -1
  95. package/lib/Table.cjs +1 -1
  96. package/lib/Table.js +1 -1
  97. package/lib/TaskList.cjs +1 -1
  98. package/lib/TaskList.js +2 -2
  99. package/lib/TextAlign.cjs +1 -1
  100. package/lib/TextAlign.js +3 -3
  101. package/lib/TextDirection.cjs +1 -1
  102. package/lib/TextDirection.js +3 -3
  103. package/lib/TextUnderline.cjs +1 -1
  104. package/lib/TextUnderline.js +2 -2
  105. package/lib/{Twitter-D5mUTILj.js → Twitter-B2FDarxE.js} +4 -4
  106. package/lib/{Twitter-Cj-0yyQQ.cjs → Twitter-CJhQLKYS.cjs} +1 -1
  107. package/lib/Twitter.cjs +1 -1
  108. package/lib/Twitter.js +3 -3
  109. package/lib/Video.cjs +1 -1
  110. package/lib/Video.js +2 -2
  111. package/lib/_commonjsHelpers-B4e78b8K.js +28 -0
  112. package/lib/_commonjsHelpers-BTDuMlIz.cjs +1 -0
  113. package/lib/bubble.cjs +6 -6
  114. package/lib/bubble.js +1796 -1683
  115. package/lib/{clsx-OumA9x-8.js → clsx-Bg-2aTKh.js} +11 -11
  116. package/lib/{clsx-BSBE1eoY.cjs → clsx-DSAWW32g.cjs} +1 -1
  117. package/lib/components/Bubble/RichTextBubbleCodeBlock.d.ts +1 -0
  118. package/lib/components/Bubble/index.d.ts +1 -0
  119. package/lib/{dropdown-menu-CUeq1boX.cjs → dropdown-menu-C0VlKIZC.cjs} +1 -1
  120. package/lib/{dropdown-menu-Bragdu5m.js → dropdown-menu-CWd8VVRO.js} +1 -1
  121. package/lib/extensions/CodeBlock/CodeBlock.d.ts +3 -18
  122. package/lib/{index-CDFAs4RT.js → index-B2a7NqnN.js} +3 -3
  123. package/lib/{index-CnePcUeF.cjs → index-C3dgmjIF.cjs} +1 -1
  124. package/lib/{index-DwSnESy-.cjs → index-C4WLt4NA.cjs} +4 -4
  125. package/lib/{index-BKlbc8Qo.js → index-CbkpBnTX.js} +1 -1
  126. package/lib/{index-CZ1_8JQQ.js → index-CjLxMm5d.js} +1 -1
  127. package/lib/{index-BVRHx_ha.js → index-D0EmqTpe.js} +74 -64
  128. package/lib/{index-cPEuL4Zr.js → index-DXtVL0al.js} +1 -1
  129. package/lib/{index-CMLwKzI0.cjs → index-DlxZt4_j.cjs} +1 -1
  130. package/lib/{index-B-7eHzaO.js → index-P5_MyY0i.js} +1 -1
  131. package/lib/{index-D7wfvzJg.cjs → index-TcJ2UKnv.cjs} +1 -1
  132. package/lib/{index-BLrMslr7.cjs → index-czmcFIW7.cjs} +1 -1
  133. package/lib/{index-COCTP78Y.cjs → index-fbGGohBT.cjs} +1 -1
  134. package/lib/index.cjs +1 -1
  135. package/lib/index.js +2 -2
  136. package/lib/{popover-C2BbhsXH.js → popover-BrSDMb_n.js} +1 -1
  137. package/lib/{popover-DCJpsZx0.cjs → popover-UUKfPWue.cjs} +1 -1
  138. package/lib/{renderNodeView-CmnUEfby.js → renderNodeView-CbxCTni3.js} +2 -2
  139. package/lib/{renderNodeView-DQjWzXDA.cjs → renderNodeView-DFVrJy0l.cjs} +1 -1
  140. package/lib/{separator-BuG1zwKa.cjs → separator-LH5EzF0T.cjs} +1 -1
  141. package/lib/{separator-lkMWuUvf.js → separator-fpWkZkoh.js} +2 -2
  142. package/lib/style.css +1 -1
  143. package/lib/{updatePosition-DYuAiqx-.js → updatePosition-BGD41Hbg.js} +2 -2
  144. package/lib/{updatePosition-D6AScA-1.cjs → updatePosition-CQE1ct18.cjs} +1 -1
  145. package/package.json +4 -2
  146. package/lib/Katex-BFIYLrwm.cjs +0 -4
  147. package/lib/delete-node-CosiBes5.cjs +0 -1
  148. package/lib/delete-node-eQHsyyhR.js +0 -24
  149. package/lib/extensions/CodeBlock/components/NodeViewCodeBlock/NodeViewCodeBlock.d.ts +0 -1
package/lib/Emoji.js CHANGED
@@ -1,15 +1,15 @@
1
- import { N as B, z as A, B as x, C as z, P as q, J as S, I as M, n as N, m as T, E as G } from "./index-BVRHx_ha.js";
1
+ import { N as B, z as A, B as x, C as z, P as q, K as S, I as M, n as N, m as T, E as G } from "./index-D0EmqTpe.js";
2
2
  import { PluginKey as D, Plugin as H } from "@tiptap/pm/state";
3
- import { i as P } from "./index-B-7eHzaO.js";
4
- import { r as R } from "./renderNodeView-CmnUEfby.js";
3
+ import { i as P } from "./index-P5_MyY0i.js";
4
+ import { r as R } from "./renderNodeView-CbxCTni3.js";
5
5
  import { jsx as p, jsxs as f, Fragment as I } from "react/jsx-runtime";
6
- import { c as L } from "./clsx-OumA9x-8.js";
6
+ import { c as L } from "./clsx-Bg-2aTKh.js";
7
7
  import { forwardRef as O, useRef as K, useState as y, useEffect as k, useImperativeHandle as V } from "react";
8
8
  import $ from "scroll-into-view-if-needed";
9
9
  import { u as U } from "./index-BlXGgvT-.js";
10
- import { c as b, u as W, e as Z, A as Y } from "./index-CDFAs4RT.js";
10
+ import { c as b, u as W, e as Z, A as Y } from "./index-B2a7NqnN.js";
11
11
  import "./theme.js";
12
- import { P as J, a as X, b as Q } from "./popover-C2BbhsXH.js";
12
+ import { P as X, a as J, b as Q } from "./popover-BrSDMb_n.js";
13
13
  import { EmojiPicker as u } from "frimousse";
14
14
  import { SearchIcon as ee, LoaderIcon as ae } from "lucide-react";
15
15
  const oe = () => /[#*0-9]\uFE0F?\u20E3|[\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23ED-\u23EF\u23F1\u23F2\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB\u25FC\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692\u2694-\u2697\u2699\u269B\u269C\u26A0\u26A7\u26AA\u26B0\u26B1\u26BD\u26BE\u26C4\u26C8\u26CF\u26D1\u26E9\u26F0-\u26F5\u26F7\u26F8\u26FA\u2702\u2708\u2709\u270F\u2712\u2714\u2716\u271D\u2721\u2733\u2734\u2744\u2747\u2757\u2763\u27A1\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B55\u3030\u303D\u3297\u3299]\uFE0F?|[\u261D\u270C\u270D](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?|[\u270A\u270B](?:\uD83C[\uDFFB-\uDFFF])?|[\u23E9-\u23EC\u23F0\u23F3\u25FD\u2693\u26A1\u26AB\u26C5\u26CE\u26D4\u26EA\u26FD\u2705\u2728\u274C\u274E\u2753-\u2755\u2795-\u2797\u27B0\u27BF\u2B50]|\u26D3\uFE0F?(?:\u200D\uD83D\uDCA5)?|\u26F9(?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|\u2764\uFE0F?(?:\u200D(?:\uD83D\uDD25|\uD83E\uDE79))?|\uD83C(?:[\uDC04\uDD70\uDD71\uDD7E\uDD7F\uDE02\uDE37\uDF21\uDF24-\uDF2C\uDF36\uDF7D\uDF96\uDF97\uDF99-\uDF9B\uDF9E\uDF9F\uDFCD\uDFCE\uDFD4-\uDFDF\uDFF5\uDFF7]\uFE0F?|[\uDF85\uDFC2\uDFC7](?:\uD83C[\uDFFB-\uDFFF])?|[\uDFC4\uDFCA](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDFCB\uDFCC](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDCCF\uDD8E\uDD91-\uDD9A\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF43\uDF45-\uDF4A\uDF4C-\uDF7C\uDF7E-\uDF84\uDF86-\uDF93\uDFA0-\uDFC1\uDFC5\uDFC6\uDFC8\uDFC9\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF8-\uDFFF]|\uDDE6\uD83C[\uDDE8-\uDDEC\uDDEE\uDDF1\uDDF2\uDDF4\uDDF6-\uDDFA\uDDFC\uDDFD\uDDFF]|\uDDE7\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF]|\uDDE8\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDEE\uDDF0-\uDDF7\uDDFA-\uDDFF]|\uDDE9\uD83C[\uDDEA\uDDEC\uDDEF\uDDF0\uDDF2\uDDF4\uDDFF]|\uDDEA\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDED\uDDF7-\uDDFA]|\uDDEB\uD83C[\uDDEE-\uDDF0\uDDF2\uDDF4\uDDF7]|\uDDEC\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEE\uDDF1-\uDDF3\uDDF5-\uDDFA\uDDFC\uDDFE]|\uDDED\uD83C[\uDDF0\uDDF2\uDDF3\uDDF7\uDDF9\uDDFA]|\uDDEE\uD83C[\uDDE8-\uDDEA\uDDF1-\uDDF4\uDDF6-\uDDF9]|\uDDEF\uD83C[\uDDEA\uDDF2\uDDF4\uDDF5]|\uDDF0\uD83C[\uDDEA\uDDEC-\uDDEE\uDDF2\uDDF3\uDDF5\uDDF7\uDDFC\uDDFE\uDDFF]|\uDDF1\uD83C[\uDDE6-\uDDE8\uDDEE\uDDF0\uDDF7-\uDDFB\uDDFE]|\uDDF2\uD83C[\uDDE6\uDDE8-\uDDED\uDDF0-\uDDFF]|\uDDF3\uD83C[\uDDE6\uDDE8\uDDEA-\uDDEC\uDDEE\uDDF1\uDDF4\uDDF5\uDDF7\uDDFA\uDDFF]|\uDDF4\uD83C\uDDF2|\uDDF5\uD83C[\uDDE6\uDDEA-\uDDED\uDDF0-\uDDF3\uDDF7-\uDDF9\uDDFC\uDDFE]|\uDDF6\uD83C\uDDE6|\uDDF7\uD83C[\uDDEA\uDDF4\uDDF8\uDDFA\uDDFC]|\uDDF8\uD83C[\uDDE6-\uDDEA\uDDEC-\uDDF4\uDDF7-\uDDF9\uDDFB\uDDFD-\uDDFF]|\uDDF9\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDED\uDDEF-\uDDF4\uDDF7\uDDF9\uDDFB\uDDFC\uDDFF]|\uDDFA\uD83C[\uDDE6\uDDEC\uDDF2\uDDF3\uDDF8\uDDFE\uDDFF]|\uDDFB\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDEE\uDDF3\uDDFA]|\uDDFC\uD83C[\uDDEB\uDDF8]|\uDDFD\uD83C\uDDF0|\uDDFE\uD83C[\uDDEA\uDDF9]|\uDDFF\uD83C[\uDDE6\uDDF2\uDDFC]|\uDF44(?:\u200D\uD83D\uDFEB)?|\uDF4B(?:\u200D\uD83D\uDFE9)?|\uDFC3(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?|\uDFF3\uFE0F?(?:\u200D(?:\u26A7\uFE0F?|\uD83C\uDF08))?|\uDFF4(?:\u200D\u2620\uFE0F?|\uDB40\uDC67\uDB40\uDC62\uDB40(?:\uDC65\uDB40\uDC6E\uDB40\uDC67|\uDC73\uDB40\uDC63\uDB40\uDC74|\uDC77\uDB40\uDC6C\uDB40\uDC73)\uDB40\uDC7F)?)|\uD83D(?:[\uDC3F\uDCFD\uDD49\uDD4A\uDD6F\uDD70\uDD73\uDD76-\uDD79\uDD87\uDD8A-\uDD8D\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA\uDECB\uDECD-\uDECF\uDEE0-\uDEE5\uDEE9\uDEF0\uDEF3]\uFE0F?|[\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDC8F\uDC91\uDCAA\uDD7A\uDD95\uDD96\uDE4C\uDE4F\uDEC0\uDECC](?:\uD83C[\uDFFB-\uDFFF])?|[\uDC6E-\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4\uDEB5](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDD74\uDD90](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?|[\uDC00-\uDC07\uDC09-\uDC14\uDC16-\uDC25\uDC27-\uDC3A\uDC3C-\uDC3E\uDC40\uDC44\uDC45\uDC51-\uDC65\uDC6A\uDC79-\uDC7B\uDC7D-\uDC80\uDC84\uDC88-\uDC8E\uDC90\uDC92-\uDCA9\uDCAB-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDDA4\uDDFB-\uDE2D\uDE2F-\uDE34\uDE37-\uDE41\uDE43\uDE44\uDE48-\uDE4A\uDE80-\uDEA2\uDEA4-\uDEB3\uDEB7-\uDEBF\uDEC1-\uDEC5\uDED0-\uDED2\uDED5-\uDED8\uDEDC-\uDEDF\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB\uDFF0]|\uDC08(?:\u200D\u2B1B)?|\uDC15(?:\u200D\uD83E\uDDBA)?|\uDC26(?:\u200D(?:\u2B1B|\uD83D\uDD25))?|\uDC3B(?:\u200D\u2744\uFE0F?)?|\uDC41\uFE0F?(?:\u200D\uD83D\uDDE8\uFE0F?)?|\uDC68(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDC68\uDC69]\u200D\uD83D(?:\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?)|[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?)|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFC-\uDFFF])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFC-\uDFFF]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFD-\uDFFF]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFD\uDFFF]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFE])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFE]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?))?|\uDC69(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?[\uDC68\uDC69]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?|\uDC69\u200D\uD83D(?:\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?))|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFC-\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFC-\uDFFF]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFC-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB\uDFFD-\uDFFF]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFB\uDFFD-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB-\uDFFD\uDFFF]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFB-\uDFFD\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFB-\uDFFE])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB-\uDFFE]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFB-\uDFFE])))?))?|\uDD75(?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|\uDE2E(?:\u200D\uD83D\uDCA8)?|\uDE35(?:\u200D\uD83D\uDCAB)?|\uDE36(?:\u200D\uD83C\uDF2B\uFE0F?)?|\uDE42(?:\u200D[\u2194\u2195]\uFE0F?)?|\uDEB6(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?)|\uD83E(?:[\uDD0C\uDD0F\uDD18-\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5\uDEC3-\uDEC5\uDEF0\uDEF2-\uDEF8](?:\uD83C[\uDFFB-\uDFFF])?|[\uDD26\uDD35\uDD37-\uDD39\uDD3C-\uDD3E\uDDB8\uDDB9\uDDCD\uDDCF\uDDD4\uDDD6-\uDDDD](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDDDE\uDDDF](?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDD0D\uDD0E\uDD10-\uDD17\uDD20-\uDD25\uDD27-\uDD2F\uDD3A\uDD3F-\uDD45\uDD47-\uDD76\uDD78-\uDDB4\uDDB7\uDDBA\uDDBC-\uDDCC\uDDD0\uDDE0-\uDDFF\uDE70-\uDE7C\uDE80-\uDE8A\uDE8E-\uDEC2\uDEC6\uDEC8\uDECD-\uDEDC\uDEDF-\uDEEA\uDEEF]|\uDDCE(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?|\uDDD1(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1|\uDDD1\u200D\uD83E\uDDD2(?:\u200D\uD83E\uDDD2)?|\uDDD2(?:\u200D\uD83E\uDDD2)?))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFC-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFC-\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFC-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB\uDFFD-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFB\uDFFD-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB-\uDFFD\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFD\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB-\uDFFE]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFE])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFE])))?))?|\uDEF1(?:\uD83C(?:\uDFFB(?:\u200D\uD83E\uDEF2\uD83C[\uDFFC-\uDFFF])?|\uDFFC(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB\uDFFD-\uDFFF])?|\uDFFD(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])?|\uDFFE(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB-\uDFFD\uDFFF])?|\uDFFF(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB-\uDFFE])?))?)/g;
@@ -19804,10 +19804,10 @@ function ke({ className: e, ...o }) {
19804
19804
  }
19805
19805
  function De({ onSelectEmoji: e, children: o, disabled: a }) {
19806
19806
  const [n, s] = y(!1);
19807
- return /* @__PURE__ */ f(J, { onOpenChange: (t) => {
19807
+ return /* @__PURE__ */ f(X, { onOpenChange: (t) => {
19808
19808
  a || s(t);
19809
19809
  }, open: n, children: [
19810
- /* @__PURE__ */ p(X, { asChild: !0, children: o }),
19810
+ /* @__PURE__ */ p(J, { asChild: !0, children: o }),
19811
19811
  /* @__PURE__ */ p(Q, { className: "!richtext-w-fit !richtext-p-0", children: /* @__PURE__ */ f(
19812
19812
  he,
19813
19813
  {
@@ -1 +1 @@
1
- "use strict";var z=Object.create;var M=Object.defineProperty;var P=Object.getOwnPropertyDescriptor;var V=Object.getOwnPropertyNames;var B=Object.getPrototypeOf,$=Object.prototype.hasOwnProperty;var U=(e,s,i,d)=>{if(s&&typeof s=="object"||typeof s=="function")for(let o of V(s))!$.call(e,o)&&o!==i&&M(e,o,{get:()=>s[o],enumerable:!(d=P(s,o))||d.enumerable});return e};var R=(e,s,i)=>(i=e!=null?z(B(e)):{},U(s||!e||!e.__esModule?M(i,"default",{value:e,enumerable:!0}):i,e));Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const N=require("./index-DwSnESy-.cjs"),y=require("./clsx-BSBE1eoY.cjs"),t=require("react/jsx-runtime"),F=require("re-resizable"),r=require("react"),a=require("./index-BLrMslr7.cjs"),v=require("./dom-dataset-BqoJhJXt.cjs"),X="_wrap_dra8y_1",Y="_renderWrap_dra8y_7",G="_handlerWrap_dra8y_30",J="_disabled_dra8y_40",T={wrap:X,renderWrap:Y,handlerWrap:G,disabled:J},K=10,Q=200,O=15,W={width:"100%",height:"100%",maxWidth:"100%"};function ee({editor:e,node:s,updateAttributes:i}){const d=r.useRef(null),o=a.useEditableEditor(),x=e.isActive(_.name),{data:p,width:c,height:A}=s.attrs,[m,I]=r.useState(null),[b,D]=r.useState(!0),[u,g]=r.useState(null),[E,S]=r.useState(100),f=r.useCallback(n=>()=>{S(h=>a.clamp(n==="minus"?h-O:h+O,K,Q))},[]);r.useEffect(()=>{let n=!1;return import("@excalidraw/excalidraw").then(h=>{n||(d.current=h.exportToSvg)}).catch(h=>!n&&g(h)).finally(()=>!n&&D(!1)),()=>{n=!0}},[p]),r.useEffect(()=>{let n=!1;return(async()=>{if(!d.current||n||b||u||!p)return;const w=await d.current(p);n||(w.setAttribute("width","100%"),w.setAttribute("height","100%"),w.setAttribute("display","block"),I(w))})(),()=>{n=!0}},[p,b,u]);const L=n=>{i({width:n.width,height:n.height})};return t.jsx(y.NodeViewWrapper,{className:y.clsx(T.wrap,{[T.active]:x,[T.disabled]:!o}),children:t.jsx(F.Resizable,{size:{width:Number.parseInt(c),height:Number.parseInt(A)},onResizeStop:(n,h,w,j)=>{L({width:Number.parseInt(c)+j.width,height:Number.parseInt(A)+j.height})},children:t.jsxs("div",{className:y.clsx(T.renderWrap,"render-wrapper"),style:{...W,overflow:"hidden"},children:[u&&t.jsx("div",{style:W,children:t.jsx("p",{children:u.message||u})}),b&&t.jsx("p",{children:"Loading..."}),!b&&!u&&m&&t.jsx("div",{dangerouslySetInnerHTML:{__html:(m==null?void 0:m.outerHTML)??""},style:{height:"100%",maxHeight:"100%",padding:24,overflow:"hidden",display:"flex",justifyContent:"center",alignItems:"center",transform:`scale(${E/100})`,transition:"all ease-in-out .3s"}}),t.jsxs("div",{className:T.handlerWrap,children:[t.jsx(a.ActionButton,{action:f("minus"),disabled:!o,icon:"ZoomOut",tooltip:"Zoom Out"}),t.jsx(a.ActionButton,{action:f("plus"),disabled:!o,icon:"ZoomIn",tooltip:"Zoom In"})]})]})})})}function te(){const e=a.useEditorInstance(),s=a.useButtonProps(_.name),i=a.useExtension(_.name),{tooltipOptions:d={},isActive:o=void 0}=(s==null?void 0:s.componentProps)??{},{editorDisabled:x}=a.useToggleActive(o),p=r.useMemo(()=>(i==null?void 0:i.options)||{},[i]),[c,A]=r.useState(null),[m,I]=r.useState({}),[b,D]=r.useState({elements:[],appState:{isLoading:!1},files:null}),[u,g]=r.useState(!1),[E,S]=r.useState(!0),[f,L]=r.useState(null),n=r.useCallback(l=>{l&&import("@excalidraw/excalidraw").then(C=>{A(C.Excalidraw)}).catch(L).finally(()=>S(!1))},[S]),h=r.useCallback(l=>{setTimeout(()=>{l.refresh()})},[]),w=r.useCallback((l,C,q)=>{I({elements:l,appState:{isLoading:!1},files:q})},[]),j=r.useCallback(()=>{if(!c){g(!1);return}e.chain().focus().setExcalidraw({data:m}).run(),g(!1)},[c,e,m,g]),k=l=>{g(!0),l!=null&&l.data&&D(l==null?void 0:l.data)},Z=a.EVENTS.EXCALIDRAW(e.id);return a.useListener(k,[Z]),r.useEffect(()=>{!E&&c&&u&&setTimeout(()=>{window.dispatchEvent(new Event("resize"))},400)},[E,c,u]),t.jsxs(a.Dialog,{onOpenChange:g,open:u,children:[t.jsx(a.DialogTrigger,{asChild:!0,children:t.jsx(a.ActionButton,{disabled:x,icon:"Excalidraw",tooltip:"Excalidraw",tooltipOptions:d,action:()=>{x||g(!0)}})}),t.jsxs(a.DialogContent,{className:"richtext-z-[99999] !richtext-max-w-[1300px]",children:[t.jsx(a.DialogTitle,{children:"Excalidraw"}),t.jsxs("div",{style:{height:"100%",borderWidth:1},children:[E&&t.jsx("p",{children:"Loading..."}),f&&t.jsx("p",{children:f&&f.message||"Error"}),t.jsx("div",{ref:n,style:{width:"100%",height:600},children:!E&&!f&&c?t.jsx(c,{initialData:b,langCode:"en",onChange:w,ref:h,...p.excalidrawProps}):null})]}),t.jsx(a.DialogFooter,{children:t.jsx(a.Button,{disabled:!c,onClick:j,type:"button",children:"Save changes"})})]})]})}const H={elements:[]},_=N.Node3.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:v.getDatasetAttribute("width")},height:{default:240,parseHTML:v.getDatasetAttribute("height")},data:{default:H,parseHTML:v.getDatasetAttribute("data",!0)}}},addOptions(){var e;return{...(e=this.parent)==null?void 0:e.call(this),HTMLAttributes:{class:"excalidraw"},excalidrawProps:{},button:()=>({componentProps:{}})}},parseHTML(){return[{tag:"div[class=excalidraw]"}]},renderHTML({HTMLAttributes:e,node:s}){return["div",N.mergeAttributes(this.options.HTMLAttributes,e,v.nodeAttrsToDataset(s))]},addCommands(){return{setExcalidraw:e=>({tr:s,commands:i,chain:d})=>{var o,x,p;return e=e||{},e.data=e.data||H,((p=(x=(o=s.selection)==null?void 0:o.node)==null?void 0:x.type)==null?void 0:p.name)==this.name?i.updateAttributes(this.name,e):d().insertContent({type:this.name,attrs:e}).run()}}},addNodeView(){return y.ReactNodeViewRenderer(ee)},addInputRules(){return[N.nodeInputRule({find:/^\$excalidraw\$$/,type:this.type,getAttributes:()=>({width:"100%"})})]}});exports.Excalidraw=_;exports.RichTextExcalidraw=te;
1
+ "use strict";var z=Object.create;var M=Object.defineProperty;var P=Object.getOwnPropertyDescriptor;var V=Object.getOwnPropertyNames;var B=Object.getPrototypeOf,$=Object.prototype.hasOwnProperty;var U=(e,s,i,d)=>{if(s&&typeof s=="object"||typeof s=="function")for(let o of V(s))!$.call(e,o)&&o!==i&&M(e,o,{get:()=>s[o],enumerable:!(d=P(s,o))||d.enumerable});return e};var R=(e,s,i)=>(i=e!=null?z(B(e)):{},U(s||!e||!e.__esModule?M(i,"default",{value:e,enumerable:!0}):i,e));Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const N=require("./index-C4WLt4NA.cjs"),y=require("./clsx-DSAWW32g.cjs"),t=require("react/jsx-runtime"),F=require("re-resizable"),r=require("react"),a=require("./index-czmcFIW7.cjs"),v=require("./dom-dataset-BqoJhJXt.cjs"),X="_wrap_dra8y_1",Y="_renderWrap_dra8y_7",G="_handlerWrap_dra8y_30",J="_disabled_dra8y_40",T={wrap:X,renderWrap:Y,handlerWrap:G,disabled:J},K=10,Q=200,O=15,W={width:"100%",height:"100%",maxWidth:"100%"};function ee({editor:e,node:s,updateAttributes:i}){const d=r.useRef(null),o=a.useEditableEditor(),x=e.isActive(_.name),{data:p,width:c,height:A}=s.attrs,[m,I]=r.useState(null),[b,D]=r.useState(!0),[u,g]=r.useState(null),[E,S]=r.useState(100),f=r.useCallback(n=>()=>{S(h=>a.clamp(n==="minus"?h-O:h+O,K,Q))},[]);r.useEffect(()=>{let n=!1;return import("@excalidraw/excalidraw").then(h=>{n||(d.current=h.exportToSvg)}).catch(h=>!n&&g(h)).finally(()=>!n&&D(!1)),()=>{n=!0}},[p]),r.useEffect(()=>{let n=!1;return(async()=>{if(!d.current||n||b||u||!p)return;const w=await d.current(p);n||(w.setAttribute("width","100%"),w.setAttribute("height","100%"),w.setAttribute("display","block"),I(w))})(),()=>{n=!0}},[p,b,u]);const L=n=>{i({width:n.width,height:n.height})};return t.jsx(y.NodeViewWrapper,{className:y.clsx(T.wrap,{[T.active]:x,[T.disabled]:!o}),children:t.jsx(F.Resizable,{size:{width:Number.parseInt(c),height:Number.parseInt(A)},onResizeStop:(n,h,w,j)=>{L({width:Number.parseInt(c)+j.width,height:Number.parseInt(A)+j.height})},children:t.jsxs("div",{className:y.clsx(T.renderWrap,"render-wrapper"),style:{...W,overflow:"hidden"},children:[u&&t.jsx("div",{style:W,children:t.jsx("p",{children:u.message||u})}),b&&t.jsx("p",{children:"Loading..."}),!b&&!u&&m&&t.jsx("div",{dangerouslySetInnerHTML:{__html:(m==null?void 0:m.outerHTML)??""},style:{height:"100%",maxHeight:"100%",padding:24,overflow:"hidden",display:"flex",justifyContent:"center",alignItems:"center",transform:`scale(${E/100})`,transition:"all ease-in-out .3s"}}),t.jsxs("div",{className:T.handlerWrap,children:[t.jsx(a.ActionButton,{action:f("minus"),disabled:!o,icon:"ZoomOut",tooltip:"Zoom Out"}),t.jsx(a.ActionButton,{action:f("plus"),disabled:!o,icon:"ZoomIn",tooltip:"Zoom In"})]})]})})})}function te(){const e=a.useEditorInstance(),s=a.useButtonProps(_.name),i=a.useExtension(_.name),{tooltipOptions:d={},isActive:o=void 0}=(s==null?void 0:s.componentProps)??{},{editorDisabled:x}=a.useToggleActive(o),p=r.useMemo(()=>(i==null?void 0:i.options)||{},[i]),[c,A]=r.useState(null),[m,I]=r.useState({}),[b,D]=r.useState({elements:[],appState:{isLoading:!1},files:null}),[u,g]=r.useState(!1),[E,S]=r.useState(!0),[f,L]=r.useState(null),n=r.useCallback(l=>{l&&import("@excalidraw/excalidraw").then(C=>{A(C.Excalidraw)}).catch(L).finally(()=>S(!1))},[S]),h=r.useCallback(l=>{setTimeout(()=>{l.refresh()})},[]),w=r.useCallback((l,C,q)=>{I({elements:l,appState:{isLoading:!1},files:q})},[]),j=r.useCallback(()=>{if(!c){g(!1);return}e.chain().focus().setExcalidraw({data:m}).run(),g(!1)},[c,e,m,g]),k=l=>{g(!0),l!=null&&l.data&&D(l==null?void 0:l.data)},Z=a.EVENTS.EXCALIDRAW(e.id);return a.useListener(k,[Z]),r.useEffect(()=>{!E&&c&&u&&setTimeout(()=>{window.dispatchEvent(new Event("resize"))},400)},[E,c,u]),t.jsxs(a.Dialog,{onOpenChange:g,open:u,children:[t.jsx(a.DialogTrigger,{asChild:!0,children:t.jsx(a.ActionButton,{disabled:x,icon:"Excalidraw",tooltip:"Excalidraw",tooltipOptions:d,action:()=>{x||g(!0)}})}),t.jsxs(a.DialogContent,{className:"richtext-z-[99999] !richtext-max-w-[1300px]",children:[t.jsx(a.DialogTitle,{children:"Excalidraw"}),t.jsxs("div",{style:{height:"100%",borderWidth:1},children:[E&&t.jsx("p",{children:"Loading..."}),f&&t.jsx("p",{children:f&&f.message||"Error"}),t.jsx("div",{ref:n,style:{width:"100%",height:600},children:!E&&!f&&c?t.jsx(c,{initialData:b,langCode:"en",onChange:w,ref:h,...p.excalidrawProps}):null})]}),t.jsx(a.DialogFooter,{children:t.jsx(a.Button,{disabled:!c,onClick:j,type:"button",children:"Save changes"})})]})]})}const H={elements:[]},_=N.Node3.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:v.getDatasetAttribute("width")},height:{default:240,parseHTML:v.getDatasetAttribute("height")},data:{default:H,parseHTML:v.getDatasetAttribute("data",!0)}}},addOptions(){var e;return{...(e=this.parent)==null?void 0:e.call(this),HTMLAttributes:{class:"excalidraw"},excalidrawProps:{},button:()=>({componentProps:{}})}},parseHTML(){return[{tag:"div[class=excalidraw]"}]},renderHTML({HTMLAttributes:e,node:s}){return["div",N.mergeAttributes(this.options.HTMLAttributes,e,v.nodeAttrsToDataset(s))]},addCommands(){return{setExcalidraw:e=>({tr:s,commands:i,chain:d})=>{var o,x,p;return e=e||{},e.data=e.data||H,((p=(x=(o=s.selection)==null?void 0:o.node)==null?void 0:x.type)==null?void 0:p.name)==this.name?i.updateAttributes(this.name,e):d().insertContent({type:this.name,attrs:e}).run()}}},addNodeView(){return y.ReactNodeViewRenderer(ee)},addInputRules(){return[N.nodeInputRule({find:/^\$excalidraw\$$/,type:this.type,getAttributes:()=>({width:"100%"})})]}});exports.Excalidraw=_;exports.RichTextExcalidraw=te;
package/lib/Excalidraw.js CHANGED
@@ -1,9 +1,9 @@
1
- import { N as k, n as $, m as B } from "./index-BVRHx_ha.js";
2
- import { N as U, c as R, a as j } from "./clsx-OumA9x-8.js";
1
+ import { N as k, n as $, m as B } from "./index-D0EmqTpe.js";
2
+ import { N as U, c as R, a as j } from "./clsx-Bg-2aTKh.js";
3
3
  import { jsx as t, jsxs as T } from "react/jsx-runtime";
4
4
  import { Resizable as F } from "re-resizable";
5
5
  import { useRef as X, useState as o, useCallback as v, useEffect as M, useMemo as J } from "react";
6
- import { M as Y, E as q, A as S, h as G, u as K, v as Q, d as ee, J as te, N as re, D as ae, m as ne, n as ie, o as se, t as oe, B as le } from "./index-CDFAs4RT.js";
6
+ import { M as Y, E as q, A as S, h as G, u as K, v as Q, d as ee, J as te, N as re, D as ae, m as ne, n as ie, o as se, t as oe, B as le } from "./index-B2a7NqnN.js";
7
7
  import { n as de, g as D } from "./dom-dataset-CIEeltF6.js";
8
8
  const ce = "_wrap_dra8y_1", ue = "_renderWrap_dra8y_7", he = "_handlerWrap_dra8y_30", pe = "_disabled_dra8y_40", x = {
9
9
  wrap: ce,
package/lib/ExportPdf.cjs CHANGED
@@ -1,4 +1,4 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const v=require("./index-DwSnESy-.cjs"),l=require("react/jsx-runtime"),m=require("./index-BLrMslr7.cjs");require("react");require("./theme.cjs");function y(e,n){var u;const t=document.createElement("iframe");t.setAttribute("style","position: absolute; width: 0; height: 0; top: 0; left: 0;"),document.body.appendChild(t);const o=t.contentDocument||((u=t.contentWindow)==null?void 0:u.document);if(!o)return;const{paperSize:d,title:i="React Tiptap Editor",margins:{top:s,right:a,bottom:r,left:c}}=n,p=`
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const v=require("./index-C4WLt4NA.cjs"),l=require("react/jsx-runtime"),m=require("./index-czmcFIW7.cjs");require("react");require("./theme.cjs");function y(e,n){var u;const t=document.createElement("iframe");t.setAttribute("style","position: absolute; width: 0; height: 0; top: 0; left: 0;"),document.body.appendChild(t);const o=t.contentDocument||((u=t.contentWindow)==null?void 0:u.document);if(!o)return;const{paperSize:d,title:i="React Tiptap Editor",margins:{top:s,right:a,bottom:r,left:c}}=n,p=`
2
2
  <!DOCTYPE html>
3
3
  <html lang="en">
4
4
  <head>
package/lib/ExportPdf.js CHANGED
@@ -1,6 +1,6 @@
1
- import { E as b } from "./index-BVRHx_ha.js";
1
+ import { E as b } from "./index-D0EmqTpe.js";
2
2
  import { jsx as f, Fragment as v } from "react/jsx-runtime";
3
- import { u as y, d as x, A as E } from "./index-CDFAs4RT.js";
3
+ import { u as y, d as x, A as E } from "./index-B2a7NqnN.js";
4
4
  import "react";
5
5
  import "./theme.js";
6
6
  function P(o, i) {
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const h=require("./index-DwSnESy-.cjs"),u=require("docx"),n=require("prosemirror-docx"),i=require("react/jsx-runtime"),y=require("react"),a=require("./index-BLrMslr7.cjs");require("./theme.cjs");const g=typeof window<"u";function v(o,e){if(g){const r=window.URL.createObjectURL(o),t=document.createElement("a");return t.href=r,t.download=e,t.click(),window.URL.revokeObjectURL(r),Promise.resolve()}return console.error("Download is not supported in Node.js"),Promise.resolve()}function B(){const o=a.useButtonProps(p.name),[e,r]=y.useState(!1),{icon:t=void 0,tooltip:c=void 0,shortcutKeys:s=void 0,tooltipOptions:f={},action:d=void 0,isActive:m=void 0}=(o==null?void 0:o.componentProps)??{},{dataState:x,disabled:l,update:w}=a.useToggleActive(m),b=async()=>{l||e||d&&(r(!0),await d(),w(),r(!1))};return o?i.jsx(a.ActionButton,{action:b,dataState:x,disabled:l||e,icon:e?"Loader":t,shortcutKeys:s,tooltip:c,tooltipOptions:f}):i.jsx(i.Fragment,{})}const E={...n.defaultNodes,hardBreak:n.defaultNodes.hard_break,codeBlock:n.defaultNodes.code_block,orderedList:n.defaultNodes.ordered_list,listItem:n.defaultNodes.list_item,bulletList:n.defaultNodes.bullet_list,horizontalRule:n.defaultNodes.horizontal_rule,image(o,e){o.renderInline(e),o.closeBlock(e)},table(o,e){o.table(e,{tableOptions:{width:{size:100,type:u.WidthType.PERCENTAGE}}})}},W=new n.DocxSerializer(E,n.defaultMarks),p=h.Extension.create({name:"exportWord",addOptions(){var o;return{...(o=this.parent)==null?void 0:o.call(this),button:({editor:e,t:r})=>({componentProps:{icon:"ExportWord",action:()=>{var t;return e==null?void 0:e.commands.exportToWord((t=e==null?void 0:e.state)==null?void 0:t.doc)},tooltip:r("editor.exportWord.tooltip"),isActive:()=>!1,disabled:!1}})}},addCommands(){return{exportToWord:o=>async()=>{try{const e={getImageBuffer:async t=>{const s=await(await fetch(t)).arrayBuffer();return new Uint8Array(s)}},r=W.serialize(o,e);return u.Packer.toBlob(r).then(t=>v(new Blob([t]),"richtext-export-document.docx")),!0}catch(e){return console.error("Error exporting to Word:",e),!1}}}}});exports.ExportWord=p;exports.RichTextExportWord=B;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const h=require("./index-C4WLt4NA.cjs"),u=require("docx"),n=require("prosemirror-docx"),i=require("react/jsx-runtime"),y=require("react"),a=require("./index-czmcFIW7.cjs");require("./theme.cjs");const g=typeof window<"u";function v(o,e){if(g){const r=window.URL.createObjectURL(o),t=document.createElement("a");return t.href=r,t.download=e,t.click(),window.URL.revokeObjectURL(r),Promise.resolve()}return console.error("Download is not supported in Node.js"),Promise.resolve()}function B(){const o=a.useButtonProps(p.name),[e,r]=y.useState(!1),{icon:t=void 0,tooltip:c=void 0,shortcutKeys:s=void 0,tooltipOptions:f={},action:d=void 0,isActive:m=void 0}=(o==null?void 0:o.componentProps)??{},{dataState:x,disabled:l,update:w}=a.useToggleActive(m),b=async()=>{l||e||d&&(r(!0),await d(),w(),r(!1))};return o?i.jsx(a.ActionButton,{action:b,dataState:x,disabled:l||e,icon:e?"Loader":t,shortcutKeys:s,tooltip:c,tooltipOptions:f}):i.jsx(i.Fragment,{})}const E={...n.defaultNodes,hardBreak:n.defaultNodes.hard_break,codeBlock:n.defaultNodes.code_block,orderedList:n.defaultNodes.ordered_list,listItem:n.defaultNodes.list_item,bulletList:n.defaultNodes.bullet_list,horizontalRule:n.defaultNodes.horizontal_rule,image(o,e){o.renderInline(e),o.closeBlock(e)},table(o,e){o.table(e,{tableOptions:{width:{size:100,type:u.WidthType.PERCENTAGE}}})}},W=new n.DocxSerializer(E,n.defaultMarks),p=h.Extension.create({name:"exportWord",addOptions(){var o;return{...(o=this.parent)==null?void 0:o.call(this),button:({editor:e,t:r})=>({componentProps:{icon:"ExportWord",action:()=>{var t;return e==null?void 0:e.commands.exportToWord((t=e==null?void 0:e.state)==null?void 0:t.doc)},tooltip:r("editor.exportWord.tooltip"),isActive:()=>!1,disabled:!1}})}},addCommands(){return{exportToWord:o=>async()=>{try{const e={getImageBuffer:async t=>{const s=await(await fetch(t)).arrayBuffer();return new Uint8Array(s)}},r=W.serialize(o,e);return u.Packer.toBlob(r).then(t=>v(new Blob([t]),"richtext-export-document.docx")),!0}catch(e){return console.error("Error exporting to Word:",e),!1}}}}});exports.ExportWord=p;exports.RichTextExportWord=B;
package/lib/ExportWord.js CHANGED
@@ -1,9 +1,9 @@
1
- import { E as w } from "./index-BVRHx_ha.js";
1
+ import { E as w } from "./index-D0EmqTpe.js";
2
2
  import { Packer as x, WidthType as b } from "docx";
3
3
  import { defaultNodes as n, DocxSerializer as h, defaultMarks as B } from "prosemirror-docx";
4
4
  import { jsx as d, Fragment as v } from "react/jsx-runtime";
5
5
  import { useState as y } from "react";
6
- import { u as E, d as g, A as k } from "./index-CDFAs4RT.js";
6
+ import { u as E, d as g, A as k } from "./index-B2a7NqnN.js";
7
7
  import "./theme.js";
8
8
  const W = typeof window < "u";
9
9
  function A(e, o) {
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const v=require("./index-CMLwKzI0.cjs"),F=require("./index-BqL4vAWE.cjs"),f=require("./index-BLrMslr7.cjs"),e=require("react/jsx-runtime"),m=require("react"),x=require("./ActionMenuButton-D3b_bcin.cjs");require("./theme.cjs");const d=require("./dropdown-menu-CUeq1boX.cjs");function M(){const{t:l}=F.useLocale(),o=f.useButtonProps(p.name),{icon:a=void 0,tooltip:u=void 0,items:r=[],isActive:s=void 0}=(o==null?void 0:o.componentProps)??{},{disabled:c,dataState:t}=f.useActive(s),n=m.useMemo(()=>(t==null?void 0:t.font)||l("editor.fontFamily.default.tooltip"),[t]);return o?e.jsxs(d.DropdownMenu,{children:[e.jsx(d.DropdownMenuTrigger,{asChild:!0,disabled:c,children:e.jsx(x.ActionMenuButton,{disabled:c,icon:a,title:(n==null?void 0:n.length)>12?`${n==null?void 0:n.slice(0,12)}...`:n,tooltip:u})}),e.jsx(d.DropdownMenuContent,{className:"richtext-w-full",children:r==null?void 0:r.map((i,y)=>{const h=i.font===l("editor.fontFamily.default.tooltip")?{}:{fontFamily:i.font};return e.jsxs(m.Fragment,{children:[e.jsx(d.DropdownMenuCheckboxItem,{checked:n===i.font,onClick:i.action,children:e.jsx("div",{className:"richtext-ml-1 richtext-h-full",style:h,children:i.font})}),i.font===l("editor.fontFamily.default.tooltip")&&e.jsx(d.DropdownMenuSeparator,{})]},`font-family-${y}`)})})]}):e.jsx(e.Fragment,{})}const p=v.FontFamily.extend({addOptions(){var l;return{...(l=this.parent)==null?void 0:l.call(this),fontFamilyList:F.DEFAULT_FONT_FAMILY_LIST,button({editor:o,extension:a,t:u}){var c;const r=f.ensureNameValueOptions(((c=a==null?void 0:a.options)==null?void 0:c.fontFamilyList)||[]),s=r.map(t=>({action:()=>{if(t.value==="Default"){o.chain().focus().unsetFontFamily().run();return}o.chain().focus().setFontFamily(t.value).run()},isActive:()=>o.isActive("textStyle",{fontFamily:t.value})||!1,title:t.name,font:t.value,default:t.value==="Default"}));return{componentProps:{tooltip:u("editor.fontFamily.tooltip"),disabled:!1,items:s,isActive:()=>{const t=s==null?void 0:s.find(i=>i.isActive());return t&&!t.default?t:{title:u("editor.fontFamily.default.tooltip"),font:u("editor.fontFamily.default.tooltip"),isActive:()=>!1,disabled:!1}},icon:"MenuDown",fontFamilyList:r}}}}}});exports.FontFamily=p;exports.RichTextFontFamily=M;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const v=require("./index-DlxZt4_j.cjs"),F=require("./index-BqL4vAWE.cjs"),f=require("./index-czmcFIW7.cjs"),e=require("react/jsx-runtime"),m=require("react"),x=require("./ActionMenuButton-BPgqKDXT.cjs");require("./theme.cjs");const d=require("./dropdown-menu-C0VlKIZC.cjs");function M(){const{t:l}=F.useLocale(),o=f.useButtonProps(p.name),{icon:a=void 0,tooltip:u=void 0,items:r=[],isActive:s=void 0}=(o==null?void 0:o.componentProps)??{},{disabled:c,dataState:t}=f.useActive(s),n=m.useMemo(()=>(t==null?void 0:t.font)||l("editor.fontFamily.default.tooltip"),[t]);return o?e.jsxs(d.DropdownMenu,{children:[e.jsx(d.DropdownMenuTrigger,{asChild:!0,disabled:c,children:e.jsx(x.ActionMenuButton,{disabled:c,icon:a,title:(n==null?void 0:n.length)>12?`${n==null?void 0:n.slice(0,12)}...`:n,tooltip:u})}),e.jsx(d.DropdownMenuContent,{className:"richtext-w-full",children:r==null?void 0:r.map((i,y)=>{const h=i.font===l("editor.fontFamily.default.tooltip")?{}:{fontFamily:i.font};return e.jsxs(m.Fragment,{children:[e.jsx(d.DropdownMenuCheckboxItem,{checked:n===i.font,onClick:i.action,children:e.jsx("div",{className:"richtext-ml-1 richtext-h-full",style:h,children:i.font})}),i.font===l("editor.fontFamily.default.tooltip")&&e.jsx(d.DropdownMenuSeparator,{})]},`font-family-${y}`)})})]}):e.jsx(e.Fragment,{})}const p=v.FontFamily.extend({addOptions(){var l;return{...(l=this.parent)==null?void 0:l.call(this),fontFamilyList:F.DEFAULT_FONT_FAMILY_LIST,button({editor:o,extension:a,t:u}){var c;const r=f.ensureNameValueOptions(((c=a==null?void 0:a.options)==null?void 0:c.fontFamilyList)||[]),s=r.map(t=>({action:()=>{if(t.value==="Default"){o.chain().focus().unsetFontFamily().run();return}o.chain().focus().setFontFamily(t.value).run()},isActive:()=>o.isActive("textStyle",{fontFamily:t.value})||!1,title:t.name,font:t.value,default:t.value==="Default"}));return{componentProps:{tooltip:u("editor.fontFamily.tooltip"),disabled:!1,items:s,isActive:()=>{const t=s==null?void 0:s.find(i=>i.isActive());return t&&!t.default?t:{title:u("editor.fontFamily.default.tooltip"),font:u("editor.fontFamily.default.tooltip"),isActive:()=>!1,disabled:!1}},icon:"MenuDown",fontFamilyList:r}}}}}});exports.FontFamily=p;exports.RichTextFontFamily=M;
package/lib/FontFamily.js CHANGED
@@ -1,11 +1,11 @@
1
- import { F as p } from "./index-BKlbc8Qo.js";
1
+ import { F as p } from "./index-CbkpBnTX.js";
2
2
  import { u as F, D as y } from "./index-BlXGgvT-.js";
3
- import { u as h, e as v, f as A } from "./index-CDFAs4RT.js";
3
+ import { u as h, e as v, f as A } from "./index-B2a7NqnN.js";
4
4
  import { jsx as i, Fragment as D, jsxs as f } from "react/jsx-runtime";
5
5
  import { useMemo as M, Fragment as w } from "react";
6
- import { A as L } from "./ActionMenuButton-B1Nfn5Hm.js";
6
+ import { A as L } from "./ActionMenuButton-CMXWxvWu.js";
7
7
  import "./theme.js";
8
- import { D as g, a as x, b, c as T, d as C } from "./dropdown-menu-Bragdu5m.js";
8
+ import { D as g, a as x, b, c as T, d as C } from "./dropdown-menu-CWd8VVRO.js";
9
9
  function S() {
10
10
  const { t: a } = F(), n = h(N.name), {
11
11
  icon: s = void 0,
package/lib/FontSize.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const m=require("./index-DwSnESy-.cjs"),x=require("./index-BqL4vAWE.cjs"),S=require("./index-BLrMslr7.cjs"),o=require("react/jsx-runtime"),p=require("react"),h=require("./ActionMenuButton-D3b_bcin.cjs");require("./theme.cjs");const l=require("./dropdown-menu-CUeq1boX.cjs");function v(){const{t}=x.useLocale(),n=S.useButtonProps(z.name),{icon:d=void 0,tooltip:s=void 0,items:c=[],isActive:a=void 0}=(n==null?void 0:n.componentProps)??{},{disabled:u,dataState:e}=S.useActive(a),r=p.useMemo(()=>(e==null?void 0:e.title)||t("editor.fontSize.default.tooltip"),[e]);return n?o.jsxs(l.DropdownMenu,{children:[o.jsx(l.DropdownMenuTrigger,{asChild:!0,disabled:u,children:o.jsx(h.ActionMenuButton,{disabled:u,icon:d,title:r,tooltip:s})}),o.jsx(l.DropdownMenuContent,{className:"richtext-max-h-96 richtext-w-32 richtext-overflow-y-auto",children:c==null?void 0:c.map((i,f)=>o.jsxs(p.Fragment,{children:[o.jsx(l.DropdownMenuCheckboxItem,{checked:r===i.title,onClick:i.action,children:o.jsx("div",{className:"richtext-ml-1 richtext-h-full",children:i.title})}),i.title===t("editor.fontSize.default.tooltip")&&o.jsx(l.DropdownMenuSeparator,{})]},`font-size-${f}`))})]}):o.jsx(o.Fragment,{})}const z=m.Extension.create({name:"fontSize",addOptions(){var t;return{...(t=this.parent)==null?void 0:t.call(this),types:["textStyle"],fontSizes:x.DEFAULT_FONT_SIZE_LIST,button({editor:n,extension:d,t:s}){var u;const a=S.ensureNameValueOptions((u=d.options)==null?void 0:u.fontSizes).map(e=>({title:e.value==="Default"?s("editor.fontSize.default.tooltip"):String(e.name),isActive:()=>{const{fontSize:r}=n.getAttributes("textStyle"),i=e.value==="Default",f=r==null||r==="";return i&&f?!0:n.isActive({fontSize:String(e.value)})||!1},action:()=>{if(e.value==="Default"){n.commands.unsetFontSize();return}n.commands.setFontSize(String(e.value))},default:e.value==="Default"||!1}));return{componentProps:{editor:n,tooltip:s("editor.fontSize.tooltip"),disabled:!1,items:a,maxHeight:280,icon:"MenuDown",isActive:()=>{const e=(a||[]).find(i=>i.isActive());return e&&!e.default?e:{title:s("editor.fontSize.default.tooltip"),isActive:()=>!1}}}}}}},addGlobalAttributes(){return[{types:this.options.types,attributes:{fontSize:{default:null,parseHTML:t=>t.style.fontSize.replaceAll(/["']+/g,""),renderHTML:t=>t.fontSize?{style:`font-size: ${t.fontSize}`}:{}}}}]},addCommands(){return{setFontSize:t=>({chain:n})=>n().setMark("textStyle",{fontSize:t}).run(),unsetFontSize:()=>({chain:t})=>t().setMark("textStyle",{fontSize:null}).removeEmptyTextStyle().run()}}});exports.FontSize=z;exports.RichTextFontSize=v;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const m=require("./index-C4WLt4NA.cjs"),x=require("./index-BqL4vAWE.cjs"),S=require("./index-czmcFIW7.cjs"),o=require("react/jsx-runtime"),p=require("react"),h=require("./ActionMenuButton-BPgqKDXT.cjs");require("./theme.cjs");const l=require("./dropdown-menu-C0VlKIZC.cjs");function v(){const{t}=x.useLocale(),n=S.useButtonProps(z.name),{icon:d=void 0,tooltip:s=void 0,items:c=[],isActive:a=void 0}=(n==null?void 0:n.componentProps)??{},{disabled:u,dataState:e}=S.useActive(a),r=p.useMemo(()=>(e==null?void 0:e.title)||t("editor.fontSize.default.tooltip"),[e]);return n?o.jsxs(l.DropdownMenu,{children:[o.jsx(l.DropdownMenuTrigger,{asChild:!0,disabled:u,children:o.jsx(h.ActionMenuButton,{disabled:u,icon:d,title:r,tooltip:s})}),o.jsx(l.DropdownMenuContent,{className:"richtext-max-h-96 richtext-w-32 richtext-overflow-y-auto",children:c==null?void 0:c.map((i,f)=>o.jsxs(p.Fragment,{children:[o.jsx(l.DropdownMenuCheckboxItem,{checked:r===i.title,onClick:i.action,children:o.jsx("div",{className:"richtext-ml-1 richtext-h-full",children:i.title})}),i.title===t("editor.fontSize.default.tooltip")&&o.jsx(l.DropdownMenuSeparator,{})]},`font-size-${f}`))})]}):o.jsx(o.Fragment,{})}const z=m.Extension.create({name:"fontSize",addOptions(){var t;return{...(t=this.parent)==null?void 0:t.call(this),types:["textStyle"],fontSizes:x.DEFAULT_FONT_SIZE_LIST,button({editor:n,extension:d,t:s}){var u;const a=S.ensureNameValueOptions((u=d.options)==null?void 0:u.fontSizes).map(e=>({title:e.value==="Default"?s("editor.fontSize.default.tooltip"):String(e.name),isActive:()=>{const{fontSize:r}=n.getAttributes("textStyle"),i=e.value==="Default",f=r==null||r==="";return i&&f?!0:n.isActive({fontSize:String(e.value)})||!1},action:()=>{if(e.value==="Default"){n.commands.unsetFontSize();return}n.commands.setFontSize(String(e.value))},default:e.value==="Default"||!1}));return{componentProps:{editor:n,tooltip:s("editor.fontSize.tooltip"),disabled:!1,items:a,maxHeight:280,icon:"MenuDown",isActive:()=>{const e=(a||[]).find(i=>i.isActive());return e&&!e.default?e:{title:s("editor.fontSize.default.tooltip"),isActive:()=>!1}}}}}}},addGlobalAttributes(){return[{types:this.options.types,attributes:{fontSize:{default:null,parseHTML:t=>t.style.fontSize.replaceAll(/["']+/g,""),renderHTML:t=>t.fontSize?{style:`font-size: ${t.fontSize}`}:{}}}}]},addCommands(){return{setFontSize:t=>({chain:n})=>n().setMark("textStyle",{fontSize:t}).run(),unsetFontSize:()=>({chain:t})=>t().setMark("textStyle",{fontSize:null}).removeEmptyTextStyle().run()}}});exports.FontSize=z;exports.RichTextFontSize=v;
package/lib/FontSize.js CHANGED
@@ -1,11 +1,11 @@
1
- import { E as m } from "./index-BVRHx_ha.js";
1
+ import { E as m } from "./index-D0EmqTpe.js";
2
2
  import { u as p, g as S } from "./index-BlXGgvT-.js";
3
- import { u as z, e as h, f as v } from "./index-CDFAs4RT.js";
3
+ import { u as z, e as h, f as v } from "./index-B2a7NqnN.js";
4
4
  import { jsx as r, Fragment as x, jsxs as d } from "react/jsx-runtime";
5
5
  import { useMemo as A, Fragment as D } from "react";
6
- import { A as g } from "./ActionMenuButton-B1Nfn5Hm.js";
6
+ import { A as g } from "./ActionMenuButton-CMXWxvWu.js";
7
7
  import "./theme.js";
8
- import { D as y, a as F, b as M, c as w, d as T } from "./dropdown-menu-Bragdu5m.js";
8
+ import { D as y, a as F, b as M, c as w, d as T } from "./dropdown-menu-CWd8VVRO.js";
9
9
  function $() {
10
10
  const { t: e } = p(), n = z(b.name), {
11
11
  icon: f = void 0,
package/lib/Heading.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const f=require("./index-DwSnESy-.cjs"),M=require("./index-BqL4vAWE.cjs"),s=require("react/jsx-runtime"),x=require("react"),v=require("./index-BLrMslr7.cjs"),b=require("./ActionMenuButton-D3b_bcin.cjs");require("./theme.cjs");const h=require("./dropdown-menu-CUeq1boX.cjs");var j=f.Node3.create({name:"heading",addOptions(){return{levels:[1,2,3,4,5,6],HTMLAttributes:{}}},content:"inline*",group:"block",defining:!0,addAttributes(){return{level:{default:1,rendered:!1}}},parseHTML(){return this.options.levels.map(e=>({tag:`h${e}`,attrs:{level:e}}))},renderHTML({node:e,HTMLAttributes:t}){return[`h${this.options.levels.includes(e.attrs.level)?e.attrs.level:this.options.levels[0]}`,f.mergeAttributes(this.options.HTMLAttributes,t),0]},parseMarkdown:(e,t)=>t.createNode("heading",{level:e.depth||1},t.parseInline(e.tokens||[])),renderMarkdown:(e,t)=>{var l;const i=(l=e.attrs)!=null&&l.level?parseInt(e.attrs.level,10):1,a="#".repeat(i);return e.content?`${a} ${t.renderChildren(e.content)}`:""},addCommands(){return{setHeading:e=>({commands:t})=>this.options.levels.includes(e.level)?t.setNode(this.name,e):!1,toggleHeading:e=>({commands:t})=>this.options.levels.includes(e.level)?t.toggleNode(this.name,"paragraph",e):!1}},addKeyboardShortcuts(){return this.options.levels.reduce((e,t)=>({...e,[`Mod-Alt-${t}`]:()=>this.editor.commands.toggleHeading({level:t})}),{})},addInputRules(){return this.options.levels.map(e=>f.textblockTypeInputRule({find:new RegExp(`^(#{${Math.min(...this.options.levels)},${e}})\\s$`),type:this.type,getAttributes:{level:e}}))}});function m(){const{t:e}=M.useLocale(),t=v.useButtonProps(A.name),{icon:l=void 0,tooltip:i=void 0,isActive:a=void 0,items:o=[]}=(t==null?void 0:t.componentProps)??{},{disabled:p,dataState:d}=v.useActive(a),r=x.useMemo(()=>(d==null?void 0:d.title)||e("editor.paragraph.tooltip"),[d]);return t?s.jsxs(h.DropdownMenu,{children:[s.jsx(h.DropdownMenuTrigger,{asChild:!0,disabled:p,children:s.jsx(b.ActionMenuButton,{disabled:p,icon:l,title:r,tooltip:i})}),s.jsx(h.DropdownMenuContent,{className:"richtext-w-full",children:o==null?void 0:o.map((n,c)=>{var u,g;return s.jsxs(x.Fragment,{children:[s.jsxs(h.DropdownMenuCheckboxItem,{checked:r===n.title,onClick:n.action,children:[s.jsx("div",{className:v.cn("richtext-ml-1 richtext-h-full",{"":n.level==="Paragraph","heading-1":n.level===1,"heading-2":n.level===2,"heading-3":n.level===3,"heading-4":n.level===4,"heading-5":n.level===5,"heading-6":n.level===6}),children:n.title}),!!((u=n==null?void 0:n.shortcutKeys)!=null&&u.length)&&s.jsx(h.DropdownMenuShortcut,{className:"richtext-pl-4",children:(g=n==null?void 0:n.shortcutKeys)==null?void 0:g.map(H=>v.getShortcutKey(H)).join(" ")})]}),n.level==="Paragraph"&&s.jsx(h.DropdownMenuSeparator,{})]},`heading-k-${c}`)})})]}):s.jsx(s.Fragment,{})}const A=j.extend({addOptions(){var e;return{...(e=this.parent)==null?void 0:e.call(this),levels:M.HEADINGS,button({editor:t,extension:l,t:i}){var d;const a=((d=l.options)==null?void 0:d.levels)||[],o=a.map(r=>{var c;const n=r==="Paragraph";return{action:()=>{if(n){const u=a.find(g=>t.isActive("heading",{level:g}));u&&u!=="Paragraph"&&t.commands.toggleHeading({level:u});return}t.commands.toggleHeading({level:r})},isActive:()=>n?!1:t.isActive("heading",{level:r})||!1,disabled:!t.can().toggleHeading({level:r}),title:i(n?"editor.paragraph.tooltip":`editor.heading.h${r}.tooltip`),level:r,shortcutKeys:((c=l.options.shortcutKeys)==null?void 0:c[r])??["alt","mod",`${r}`],default:n}}),p=o.filter(r=>r.disabled).length===o.length;return{componentProps:{tooltip:i("editor.heading.tooltip"),disabled:p,items:o,icon:"MenuDown",isActive:()=>{const r=o==null?void 0:o.find(c=>c.isActive());return r&&!r.default?r:{title:i("editor.paragraph.tooltip"),level:0,isActive:()=>!1}},levels:a}}}}}});exports.Heading=A;exports.RichTextHeading=m;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const f=require("./index-C4WLt4NA.cjs"),M=require("./index-BqL4vAWE.cjs"),s=require("react/jsx-runtime"),x=require("react"),v=require("./index-czmcFIW7.cjs"),b=require("./ActionMenuButton-BPgqKDXT.cjs");require("./theme.cjs");const h=require("./dropdown-menu-C0VlKIZC.cjs");var j=f.Node3.create({name:"heading",addOptions(){return{levels:[1,2,3,4,5,6],HTMLAttributes:{}}},content:"inline*",group:"block",defining:!0,addAttributes(){return{level:{default:1,rendered:!1}}},parseHTML(){return this.options.levels.map(e=>({tag:`h${e}`,attrs:{level:e}}))},renderHTML({node:e,HTMLAttributes:t}){return[`h${this.options.levels.includes(e.attrs.level)?e.attrs.level:this.options.levels[0]}`,f.mergeAttributes(this.options.HTMLAttributes,t),0]},parseMarkdown:(e,t)=>t.createNode("heading",{level:e.depth||1},t.parseInline(e.tokens||[])),renderMarkdown:(e,t)=>{var l;const i=(l=e.attrs)!=null&&l.level?parseInt(e.attrs.level,10):1,a="#".repeat(i);return e.content?`${a} ${t.renderChildren(e.content)}`:""},addCommands(){return{setHeading:e=>({commands:t})=>this.options.levels.includes(e.level)?t.setNode(this.name,e):!1,toggleHeading:e=>({commands:t})=>this.options.levels.includes(e.level)?t.toggleNode(this.name,"paragraph",e):!1}},addKeyboardShortcuts(){return this.options.levels.reduce((e,t)=>({...e,[`Mod-Alt-${t}`]:()=>this.editor.commands.toggleHeading({level:t})}),{})},addInputRules(){return this.options.levels.map(e=>f.textblockTypeInputRule({find:new RegExp(`^(#{${Math.min(...this.options.levels)},${e}})\\s$`),type:this.type,getAttributes:{level:e}}))}});function m(){const{t:e}=M.useLocale(),t=v.useButtonProps(A.name),{icon:l=void 0,tooltip:i=void 0,isActive:a=void 0,items:o=[]}=(t==null?void 0:t.componentProps)??{},{disabled:p,dataState:d}=v.useActive(a),r=x.useMemo(()=>(d==null?void 0:d.title)||e("editor.paragraph.tooltip"),[d]);return t?s.jsxs(h.DropdownMenu,{children:[s.jsx(h.DropdownMenuTrigger,{asChild:!0,disabled:p,children:s.jsx(b.ActionMenuButton,{disabled:p,icon:l,title:r,tooltip:i})}),s.jsx(h.DropdownMenuContent,{className:"richtext-w-full",children:o==null?void 0:o.map((n,c)=>{var u,g;return s.jsxs(x.Fragment,{children:[s.jsxs(h.DropdownMenuCheckboxItem,{checked:r===n.title,onClick:n.action,children:[s.jsx("div",{className:v.cn("richtext-ml-1 richtext-h-full",{"":n.level==="Paragraph","heading-1":n.level===1,"heading-2":n.level===2,"heading-3":n.level===3,"heading-4":n.level===4,"heading-5":n.level===5,"heading-6":n.level===6}),children:n.title}),!!((u=n==null?void 0:n.shortcutKeys)!=null&&u.length)&&s.jsx(h.DropdownMenuShortcut,{className:"richtext-pl-4",children:(g=n==null?void 0:n.shortcutKeys)==null?void 0:g.map(H=>v.getShortcutKey(H)).join(" ")})]}),n.level==="Paragraph"&&s.jsx(h.DropdownMenuSeparator,{})]},`heading-k-${c}`)})})]}):s.jsx(s.Fragment,{})}const A=j.extend({addOptions(){var e;return{...(e=this.parent)==null?void 0:e.call(this),levels:M.HEADINGS,button({editor:t,extension:l,t:i}){var d;const a=((d=l.options)==null?void 0:d.levels)||[],o=a.map(r=>{var c;const n=r==="Paragraph";return{action:()=>{if(n){const u=a.find(g=>t.isActive("heading",{level:g}));u&&u!=="Paragraph"&&t.commands.toggleHeading({level:u});return}t.commands.toggleHeading({level:r})},isActive:()=>n?!1:t.isActive("heading",{level:r})||!1,disabled:!t.can().toggleHeading({level:r}),title:i(n?"editor.paragraph.tooltip":`editor.heading.h${r}.tooltip`),level:r,shortcutKeys:((c=l.options.shortcutKeys)==null?void 0:c[r])??["alt","mod",`${r}`],default:n}}),p=o.filter(r=>r.disabled).length===o.length;return{componentProps:{tooltip:i("editor.heading.tooltip"),disabled:p,items:o,icon:"MenuDown",isActive:()=>{const r=o==null?void 0:o.find(c=>c.isActive());return r&&!r.default?r:{title:i("editor.paragraph.tooltip"),level:0,isActive:()=>!1}},levels:a}}}}}});exports.Heading=A;exports.RichTextHeading=m;
package/lib/Heading.js CHANGED
@@ -1,11 +1,11 @@
1
- import { N as f, t as m, m as A } from "./index-BVRHx_ha.js";
1
+ import { N as f, t as m, m as A } from "./index-D0EmqTpe.js";
2
2
  import { u as M, H } from "./index-BlXGgvT-.js";
3
3
  import { jsx as d, Fragment as $, jsxs as g } from "react/jsx-runtime";
4
4
  import { useMemo as b, Fragment as w } from "react";
5
- import { u as x, e as D, c as y, l as N } from "./index-CDFAs4RT.js";
6
- import { A as k } from "./ActionMenuButton-B1Nfn5Hm.js";
5
+ import { u as x, e as D, c as y, l as N } from "./index-B2a7NqnN.js";
6
+ import { A as k } from "./ActionMenuButton-CMXWxvWu.js";
7
7
  import "./theme.js";
8
- import { D as L, a as C, b as T, c as I, e as K, d as P } from "./dropdown-menu-Bragdu5m.js";
8
+ import { D as L, a as C, b as T, c as I, e as K, d as P } from "./dropdown-menu-CWd8VVRO.js";
9
9
  var R = f.create({
10
10
  name: "heading",
11
11
  addOptions() {
package/lib/Highlight.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("./index-DwSnESy-.cjs"),e=require("react/jsx-runtime"),x=require("react"),h=require("./index-BLrMslr7.cjs"),C=require("./separator-BuG1zwKa.cjs");require("./theme.cjs");const m=/(?:^|\s)(==(?!\s+==)((?:[^=]+))==(?!\s+==))$/,L=/(?:^|\s)(==(?!\s+==)((?:[^=]+))==(?!\s+==))/g,H=l.Mark.create({name:"highlight",addOptions(){return{multicolor:!1,HTMLAttributes:{}}},addAttributes(){return this.options.multicolor?{color:{default:null,parseHTML:t=>t.getAttribute("data-color")||t.style.backgroundColor,renderHTML:t=>t.color?{"data-color":t.color,style:`background-color: ${t.color}; color: inherit`}:{}}}:{}},parseHTML(){return[{tag:"mark"}]},renderHTML({HTMLAttributes:t}){return["mark",l.mergeAttributes(this.options.HTMLAttributes,t),0]},addCommands(){return{setHighlight:t=>({commands:r})=>r.setMark(this.name,t),toggleHighlight:t=>({commands:r})=>r.toggleMark(this.name,t),unsetHighlight:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-h":()=>this.editor.commands.toggleHighlight()}},addInputRules(){return[l.markInputRule({find:m,type:this.type})]},addPasteRules(){return[l.markPasteRule({find:L,type:this.type})]}});function M({fill:t}){return e.jsx("svg",{height:"18px",version:"1.1",viewBox:"0 0 256 256",width:"18px",xmlns:"http://www.w3.org/2000/svg",children:e.jsx("g",{fill:"none",fillRule:"evenodd",stroke:"none",strokeWidth:1,children:e.jsxs("g",{id:"icon/背景颜色",children:[e.jsx("g",{fill:"currentColor",children:e.jsxs("g",{transform:"translate(119.502295, 137.878331) rotate(-135.000000) translate(-119.502295, -137.878331) translate(48.002295, 31.757731)",children:[e.jsx("path",{d:"M100.946943,60.8084699 L43.7469427,60.8084699 C37.2852111,60.8084699 32.0469427,66.0467383 32.0469427,72.5084699 L32.0469427,118.70847 C32.0469427,125.170201 37.2852111,130.40847 43.7469427,130.40847 L100.946943,130.40847 C107.408674,130.40847 112.646943,125.170201 112.646943,118.70847 L112.646943,72.5084699 C112.646943,66.0467383 107.408674,60.8084699 100.946943,60.8084699 Z M93.646,79.808 L93.646,111.408 L51.046,111.408 L51.046,79.808 L93.646,79.808 Z",fillRule:"nonzero"}),e.jsx("path",{d:"M87.9366521,16.90916 L87.9194966,68.2000001 C87.9183543,69.4147389 86.9334998,70.399264 85.7187607,70.4 L56.9423078,70.4 C55.7272813,70.4 54.7423078,69.4150264 54.7423078,68.2 L54.7423078,39.4621057 C54.7423078,37.2523513 55.5736632,35.1234748 57.0711706,33.4985176 L76.4832996,12.4342613 C78.9534987,9.75382857 83.1289108,9.5834005 85.8093436,12.0535996 C87.1658473,13.303709 87.9372691,15.0644715 87.9366521,16.90916 Z",fillRule:"evenodd"}),e.jsx("path",{d:"M131.3,111.241199 L11.7,111.241199 C5.23826843,111.241199 0,116.479467 0,122.941199 L0,200.541199 C0,207.002931 5.23826843,212.241199 11.7,212.241199 L131.3,212.241199 C137.761732,212.241199 143,207.002931 143,200.541199 L143,122.941199 C143,116.479467 137.761732,111.241199 131.3,111.241199 Z M124,130.241 L124,193.241 L19,193.241 L19,130.241 L124,130.241 Z",fillRule:"nonzero"})]})}),e.jsx("path",{d:"M51,218 L205,218 C211.075132,218 216,222.924868 216,229 C216,235.075132 211.075132,240 205,240 L51,240 C44.9248678,240 40,235.075132 40,229 C40,222.924868 44.9248678,218 51,218 Z",fill:typeof t=="string"?t:"none",id:"矩形"})]})})})}function v(){const t=h.useButtonProps(d.name),{tooltip:r=void 0,isActive:s=void 0,defaultColor:i=void 0,colors:o,action:n,shortcutKeys:g}=(t==null?void 0:t.componentProps)??{},{editorDisabled:u}=h.useActive(s),[c,f]=x.useState(i);function p(a){u||n&&(n==null||n(a),f(a))}return t?e.jsx(C.ColorPicker,{colors:o,disabled:u,highlight:!0,onChange:p,value:c,children:e.jsx(h.ActionButton,{disabled:u,tooltip:r,shortcutKeys:g,children:e.jsxs("span",{className:"richtext-flex richtext-items-center richtext-justify-center richtext-gap-[4px] richtext-text-sm",children:[e.jsx(M,{fill:c}),e.jsx(h.IconComponent,{className:"!richtext-h-3 !richtext-w-3 richtext-text-zinc-500",name:"MenuDown"})]})})}):e.jsx(e.Fragment,{})}const d=H.extend({addStorage(){return{currentColor:this.options.defaultColor||void 0}},addOptions(){var t;return{...(t=this.parent)==null?void 0:t.call(this),multicolor:!0,button:({editor:r,t:s,extension:i})=>({componentProps:{action:o=>{if(typeof o=="string"){r.storage.highlight.currentColor=o,r.chain().focus().setHighlight({color:o}).run();return}r.chain().focus().unsetHighlight().run()},isActive:()=>r.isActive("highlight")||!1,disabled:!1,shortcutKeys:i.options.shortcutKeys??["⇧","mod","H"],tooltip:s("editor.highlight.tooltip"),defaultColor:i.options.defaultColor}})}},addKeyboardShortcuts(){var t;return{...(t=this.parent)==null?void 0:t.call(this),"Mod-Shift-h":()=>{const r=this.storage.currentColor||this.options.defaultColor;if(!r){const{color:i}=this.editor.getAttributes("highlight");return i?this.editor.chain().focus().unsetHighlight().run():!1}return this.editor.isActive("highlight",{color:r})?this.editor.chain().focus().unsetHighlight().run():this.editor.chain().focus().setHighlight({color:r}).run()}}}});exports.Highlight=d;exports.RichTextHighlight=v;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("./index-C4WLt4NA.cjs"),e=require("react/jsx-runtime"),x=require("react"),h=require("./index-czmcFIW7.cjs"),C=require("./separator-LH5EzF0T.cjs");require("./theme.cjs");const m=/(?:^|\s)(==(?!\s+==)((?:[^=]+))==(?!\s+==))$/,L=/(?:^|\s)(==(?!\s+==)((?:[^=]+))==(?!\s+==))/g,H=l.Mark.create({name:"highlight",addOptions(){return{multicolor:!1,HTMLAttributes:{}}},addAttributes(){return this.options.multicolor?{color:{default:null,parseHTML:t=>t.getAttribute("data-color")||t.style.backgroundColor,renderHTML:t=>t.color?{"data-color":t.color,style:`background-color: ${t.color}; color: inherit`}:{}}}:{}},parseHTML(){return[{tag:"mark"}]},renderHTML({HTMLAttributes:t}){return["mark",l.mergeAttributes(this.options.HTMLAttributes,t),0]},addCommands(){return{setHighlight:t=>({commands:r})=>r.setMark(this.name,t),toggleHighlight:t=>({commands:r})=>r.toggleMark(this.name,t),unsetHighlight:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-h":()=>this.editor.commands.toggleHighlight()}},addInputRules(){return[l.markInputRule({find:m,type:this.type})]},addPasteRules(){return[l.markPasteRule({find:L,type:this.type})]}});function M({fill:t}){return e.jsx("svg",{height:"18px",version:"1.1",viewBox:"0 0 256 256",width:"18px",xmlns:"http://www.w3.org/2000/svg",children:e.jsx("g",{fill:"none",fillRule:"evenodd",stroke:"none",strokeWidth:1,children:e.jsxs("g",{id:"icon/背景颜色",children:[e.jsx("g",{fill:"currentColor",children:e.jsxs("g",{transform:"translate(119.502295, 137.878331) rotate(-135.000000) translate(-119.502295, -137.878331) translate(48.002295, 31.757731)",children:[e.jsx("path",{d:"M100.946943,60.8084699 L43.7469427,60.8084699 C37.2852111,60.8084699 32.0469427,66.0467383 32.0469427,72.5084699 L32.0469427,118.70847 C32.0469427,125.170201 37.2852111,130.40847 43.7469427,130.40847 L100.946943,130.40847 C107.408674,130.40847 112.646943,125.170201 112.646943,118.70847 L112.646943,72.5084699 C112.646943,66.0467383 107.408674,60.8084699 100.946943,60.8084699 Z M93.646,79.808 L93.646,111.408 L51.046,111.408 L51.046,79.808 L93.646,79.808 Z",fillRule:"nonzero"}),e.jsx("path",{d:"M87.9366521,16.90916 L87.9194966,68.2000001 C87.9183543,69.4147389 86.9334998,70.399264 85.7187607,70.4 L56.9423078,70.4 C55.7272813,70.4 54.7423078,69.4150264 54.7423078,68.2 L54.7423078,39.4621057 C54.7423078,37.2523513 55.5736632,35.1234748 57.0711706,33.4985176 L76.4832996,12.4342613 C78.9534987,9.75382857 83.1289108,9.5834005 85.8093436,12.0535996 C87.1658473,13.303709 87.9372691,15.0644715 87.9366521,16.90916 Z",fillRule:"evenodd"}),e.jsx("path",{d:"M131.3,111.241199 L11.7,111.241199 C5.23826843,111.241199 0,116.479467 0,122.941199 L0,200.541199 C0,207.002931 5.23826843,212.241199 11.7,212.241199 L131.3,212.241199 C137.761732,212.241199 143,207.002931 143,200.541199 L143,122.941199 C143,116.479467 137.761732,111.241199 131.3,111.241199 Z M124,130.241 L124,193.241 L19,193.241 L19,130.241 L124,130.241 Z",fillRule:"nonzero"})]})}),e.jsx("path",{d:"M51,218 L205,218 C211.075132,218 216,222.924868 216,229 C216,235.075132 211.075132,240 205,240 L51,240 C44.9248678,240 40,235.075132 40,229 C40,222.924868 44.9248678,218 51,218 Z",fill:typeof t=="string"?t:"none",id:"矩形"})]})})})}function v(){const t=h.useButtonProps(d.name),{tooltip:r=void 0,isActive:s=void 0,defaultColor:i=void 0,colors:o,action:n,shortcutKeys:g}=(t==null?void 0:t.componentProps)??{},{editorDisabled:u}=h.useActive(s),[c,f]=x.useState(i);function p(a){u||n&&(n==null||n(a),f(a))}return t?e.jsx(C.ColorPicker,{colors:o,disabled:u,highlight:!0,onChange:p,value:c,children:e.jsx(h.ActionButton,{disabled:u,tooltip:r,shortcutKeys:g,children:e.jsxs("span",{className:"richtext-flex richtext-items-center richtext-justify-center richtext-gap-[4px] richtext-text-sm",children:[e.jsx(M,{fill:c}),e.jsx(h.IconComponent,{className:"!richtext-h-3 !richtext-w-3 richtext-text-zinc-500",name:"MenuDown"})]})})}):e.jsx(e.Fragment,{})}const d=H.extend({addStorage(){return{currentColor:this.options.defaultColor||void 0}},addOptions(){var t;return{...(t=this.parent)==null?void 0:t.call(this),multicolor:!0,button:({editor:r,t:s,extension:i})=>({componentProps:{action:o=>{if(typeof o=="string"){r.storage.highlight.currentColor=o,r.chain().focus().setHighlight({color:o}).run();return}r.chain().focus().unsetHighlight().run()},isActive:()=>r.isActive("highlight")||!1,disabled:!1,shortcutKeys:i.options.shortcutKeys??["⇧","mod","H"],tooltip:s("editor.highlight.tooltip"),defaultColor:i.options.defaultColor}})}},addKeyboardShortcuts(){var t;return{...(t=this.parent)==null?void 0:t.call(this),"Mod-Shift-h":()=>{const r=this.storage.currentColor||this.options.defaultColor;if(!r){const{color:i}=this.editor.getAttributes("highlight");return i?this.editor.chain().focus().unsetHighlight().run():!1}return this.editor.isActive("highlight",{color:r})?this.editor.chain().focus().unsetHighlight().run():this.editor.chain().focus().setHighlight({color:r}).run()}}}});exports.Highlight=d;exports.RichTextHighlight=v;
package/lib/Highlight.js CHANGED
@@ -1,8 +1,8 @@
1
- import { M as f, f as p, h as m, m as C } from "./index-BVRHx_ha.js";
1
+ import { M as f, f as p, h as m, m as C } from "./index-D0EmqTpe.js";
2
2
  import { jsx as r, jsxs as h, Fragment as L } from "react/jsx-runtime";
3
3
  import { useState as x } from "react";
4
- import { u as H, e as M, A as v, I as A } from "./index-CDFAs4RT.js";
5
- import { C as y } from "./separator-lkMWuUvf.js";
4
+ import { u as H, e as M, A as v, I as A } from "./index-B2a7NqnN.js";
5
+ import { C as y } from "./separator-fpWkZkoh.js";
6
6
  import "./theme.js";
7
7
  const k = /(?:^|\s)(==(?!\s+==)((?:[^=]+))==(?!\s+==))$/, b = /(?:^|\s)(==(?!\s+==)((?:[^=]+))==(?!\s+==))/g, R = f.create({
8
8
  name: "highlight",
package/lib/History.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const h=require("./index-DwSnESy-.cjs"),C=require("@tiptap/pm/state"),E=require("@tiptap/pm/view"),R=require("./index-CnePcUeF.cjs"),I=require("react/jsx-runtime"),x=require("./index-BLrMslr7.cjs");require("react");require("./theme.cjs");function U(n={}){return new h.Plugin({view(e){return new W(e,n)}})}class W{constructor(e,t){var r;this.editorView=e,this.cursorPos=null,this.element=null,this.timeout=-1,this.width=(r=t.width)!==null&&r!==void 0?r:1,this.color=t.color===!1?void 0:t.color||"black",this.class=t.class,this.handlers=["dragover","dragend","drop","dragleave"].map(i=>{let o=s=>{this[i](s)};return e.dom.addEventListener(i,o),{name:i,handler:o}})}destroy(){this.handlers.forEach(({name:e,handler:t})=>this.editorView.dom.removeEventListener(e,t))}update(e,t){this.cursorPos!=null&&t.doc!=e.state.doc&&(this.cursorPos>e.state.doc.content.size?this.setCursor(null):this.updateOverlay())}setCursor(e){e!=this.cursorPos&&(this.cursorPos=e,e==null?(this.element.parentNode.removeChild(this.element),this.element=null):this.updateOverlay())}updateOverlay(){let e=this.editorView.state.doc.resolve(this.cursorPos),t=!e.parent.inlineContent,r,i=this.editorView.dom,o=i.getBoundingClientRect(),s=o.width/i.offsetWidth,l=o.height/i.offsetHeight;if(t){let c=e.nodeBefore,p=e.nodeAfter;if(c||p){let m=this.editorView.nodeDOM(this.cursorPos-(c?c.nodeSize:0));if(m){let v=m.getBoundingClientRect(),A=c?v.bottom:v.top;c&&p&&(A=(A+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2);let M=this.width/2*l;r={left:v.left,right:v.right,top:A-M,bottom:A+M}}}}if(!r){let c=this.editorView.coordsAtPos(this.cursorPos),p=this.width/2*s;r={left:c.left-p,right:c.left+p,top:c.top,bottom:c.bottom}}let a=this.editorView.dom.offsetParent;this.element||(this.element=a.appendChild(document.createElement("div")),this.class&&(this.element.className=this.class),this.element.style.cssText="position: absolute; z-index: 50; pointer-events: none;",this.color&&(this.element.style.backgroundColor=this.color)),this.element.classList.toggle("prosemirror-dropcursor-block",t),this.element.classList.toggle("prosemirror-dropcursor-inline",!t);let d,u;if(!a||a==document.body&&getComputedStyle(a).position=="static")d=-pageXOffset,u=-pageYOffset;else{let c=a.getBoundingClientRect(),p=c.width/a.offsetWidth,m=c.height/a.offsetHeight;d=c.left-a.scrollLeft*p,u=c.top-a.scrollTop*m}this.element.style.left=(r.left-d)/s+"px",this.element.style.top=(r.top-u)/l+"px",this.element.style.width=(r.right-r.left)/s+"px",this.element.style.height=(r.bottom-r.top)/l+"px"}scheduleRemoval(e){clearTimeout(this.timeout),this.timeout=setTimeout(()=>this.setCursor(null),e)}dragover(e){if(!this.editorView.editable)return;let t=this.editorView.posAtCoords({left:e.clientX,top:e.clientY}),r=t&&t.inside>=0&&this.editorView.state.doc.nodeAt(t.inside),i=r&&r.type.spec.disableDropCursor,o=typeof i=="function"?i(this.editorView,t,e):i;if(t&&!o){let s=t.pos;if(this.editorView.dragging&&this.editorView.dragging.slice){let l=h.dropPoint(this.editorView.state.doc,s,this.editorView.dragging.slice);l!=null&&(s=l)}this.setCursor(s),this.scheduleRemoval(5e3)}}dragend(){this.scheduleRemoval(20)}drop(){this.scheduleRemoval(20)}dragleave(e){this.editorView.dom.contains(e.relatedTarget)||this.setCursor(null)}}class f extends h.Selection{constructor(e){super(e,e)}map(e,t){let r=e.resolve(t.map(this.head));return f.valid(r)?new f(r):h.Selection.near(r)}content(){return h.Slice.empty}eq(e){return e instanceof f&&e.head==this.head}toJSON(){return{type:"gapcursor",pos:this.head}}static fromJSON(e,t){if(typeof t.pos!="number")throw new RangeError("Invalid input for GapCursor.fromJSON");return new f(e.resolve(t.pos))}getBookmark(){return new z(this.anchor)}static valid(e){let t=e.parent;if(t.inlineContent||!q(e)||!X(e))return!1;let r=t.type.spec.allowGapCursor;if(r!=null)return r;let i=t.contentMatchAt(e.index()).defaultType;return i&&i.isTextblock}static findGapCursorFrom(e,t,r=!1){e:for(;;){if(!r&&f.valid(e))return e;let i=e.pos,o=null;for(let s=e.depth;;s--){let l=e.node(s);if(t>0?e.indexAfter(s)<l.childCount:e.index(s)>0){o=l.child(t>0?e.indexAfter(s):e.index(s)-1);break}else if(s==0)return null;i+=t;let a=e.doc.resolve(i);if(f.valid(a))return a}for(;;){let s=t>0?o.firstChild:o.lastChild;if(!s){if(o.isAtom&&!o.isText&&!h.NodeSelection.isSelectable(o)){e=e.doc.resolve(i+o.nodeSize*t),r=!1;continue e}break}o=s,i+=t;let l=e.doc.resolve(i);if(f.valid(l))return l}return null}}}f.prototype.visible=!1;f.findFrom=f.findGapCursorFrom;h.Selection.jsonID("gapcursor",f);class z{constructor(e){this.pos=e}map(e){return new z(e.map(this.pos))}resolve(e){let t=e.resolve(this.pos);return f.valid(t)?new f(t):h.Selection.near(t)}}function B(n){return n.isAtom||n.spec.isolating||n.spec.createGapCursor}function q(n){for(let e=n.depth;e>=0;e--){let t=n.index(e),r=n.node(e);if(t==0){if(r.type.spec.isolating)return!0;continue}for(let i=r.child(t-1);;i=i.lastChild){if(i.childCount==0&&!i.inlineContent||B(i.type))return!0;if(i.inlineContent)return!1}}return!0}function X(n){for(let e=n.depth;e>=0;e--){let t=n.indexAfter(e),r=n.node(e);if(t==r.childCount){if(r.type.spec.isolating)return!0;continue}for(let i=r.child(t);;i=i.firstChild){if(i.childCount==0&&!i.inlineContent||B(i.type))return!0;if(i.inlineContent)return!1}}return!0}function Y(){return new h.Plugin({props:{decorations:$,createSelectionBetween(n,e,t){return e.pos==t.pos&&f.valid(t)?new f(t):null},handleClick:J,handleKeyDown:Z,handleDOMEvents:{beforeinput:Q}}})}const Z=R.keydownHandler({ArrowLeft:S("horiz",-1),ArrowRight:S("horiz",1),ArrowUp:S("vert",-1),ArrowDown:S("vert",1)});function S(n,e){const t=n=="vert"?e>0?"down":"up":e>0?"right":"left";return function(r,i,o){let s=r.selection,l=e>0?s.$to:s.$from,a=s.empty;if(s instanceof h.TextSelection){if(!o.endOfTextblock(t)||l.depth==0)return!1;a=!1,l=r.doc.resolve(e>0?l.after():l.before())}let d=f.findGapCursorFrom(l,e,a);return d?(i&&i(r.tr.setSelection(new f(d))),!0):!1}}function J(n,e,t){if(!n||!n.editable)return!1;let r=n.state.doc.resolve(e);if(!f.valid(r))return!1;let i=n.posAtCoords({left:t.clientX,top:t.clientY});return i&&i.inside>-1&&h.NodeSelection.isSelectable(n.state.doc.nodeAt(i.inside))?!1:(n.dispatch(n.state.tr.setSelection(new f(r))),!0)}function Q(n,e){if(e.inputType!="insertCompositionText"||!(n.state.selection instanceof f))return!1;let{$from:t}=n.state.selection,r=t.parent.contentMatchAt(t.index()).findWrapping(n.state.schema.nodes.text);if(!r)return!1;let i=h.Fragment.empty;for(let s=r.length-1;s>=0;s--)i=h.Fragment.from(r[s].createAndFill(null,i));let o=n.state.tr.replace(t.pos,t.pos,new h.Slice(i,0,0));return o.setSelection(h.TextSelection.near(o.doc.resolve(t.pos+1))),n.dispatch(o),!1}function $(n){if(!(n.selection instanceof f))return null;let e=document.createElement("div");return e.className="ProseMirror-gapcursor",R.DecorationSet.create(n.doc,[R.Decoration.widget(n.selection.head,e,{key:"gapcursor"})])}var O=200,g=function(){};g.prototype.append=function(e){return e.length?(e=g.from(e),!this.length&&e||e.length<O&&this.leafAppend(e)||this.length<O&&e.leafPrepend(this)||this.appendInner(e)):this};g.prototype.prepend=function(e){return e.length?g.from(e).append(this):this};g.prototype.appendInner=function(e){return new ee(this,e)};g.prototype.slice=function(e,t){return e===void 0&&(e=0),t===void 0&&(t=this.length),e>=t?g.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,t))};g.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)};g.prototype.forEach=function(e,t,r){t===void 0&&(t=0),r===void 0&&(r=this.length),t<=r?this.forEachInner(e,t,r,0):this.forEachInvertedInner(e,t,r,0)};g.prototype.map=function(e,t,r){t===void 0&&(t=0),r===void 0&&(r=this.length);var i=[];return this.forEach(function(o,s){return i.push(e(o,s))},t,r),i};g.from=function(e){return e instanceof g?e:e&&e.length?new j(e):g.empty};var j=(function(n){function e(r){n.call(this),this.values=r}n&&(e.__proto__=n),e.prototype=Object.create(n&&n.prototype),e.prototype.constructor=e;var t={length:{configurable:!0},depth:{configurable:!0}};return e.prototype.flatten=function(){return this.values},e.prototype.sliceInner=function(i,o){return i==0&&o==this.length?this:new e(this.values.slice(i,o))},e.prototype.getInner=function(i){return this.values[i]},e.prototype.forEachInner=function(i,o,s,l){for(var a=o;a<s;a++)if(i(this.values[a],l+a)===!1)return!1},e.prototype.forEachInvertedInner=function(i,o,s,l){for(var a=o-1;a>=s;a--)if(i(this.values[a],l+a)===!1)return!1},e.prototype.leafAppend=function(i){if(this.length+i.length<=O)return new e(this.values.concat(i.flatten()))},e.prototype.leafPrepend=function(i){if(this.length+i.length<=O)return new e(i.flatten().concat(this.values))},t.length.get=function(){return this.values.length},t.depth.get=function(){return 0},Object.defineProperties(e.prototype,t),e})(g);g.empty=new j([]);var ee=(function(n){function e(t,r){n.call(this),this.left=t,this.right=r,this.length=t.length+r.length,this.depth=Math.max(t.depth,r.depth)+1}return n&&(e.__proto__=n),e.prototype=Object.create(n&&n.prototype),e.prototype.constructor=e,e.prototype.flatten=function(){return this.left.flatten().concat(this.right.flatten())},e.prototype.getInner=function(r){return r<this.left.length?this.left.get(r):this.right.get(r-this.left.length)},e.prototype.forEachInner=function(r,i,o,s){var l=this.left.length;if(i<l&&this.left.forEachInner(r,i,Math.min(o,l),s)===!1||o>l&&this.right.forEachInner(r,Math.max(i-l,0),Math.min(this.length,o)-l,s+l)===!1)return!1},e.prototype.forEachInvertedInner=function(r,i,o,s){var l=this.left.length;if(i>l&&this.right.forEachInvertedInner(r,i-l,Math.max(o,l)-l,s+l)===!1||o<l&&this.left.forEachInvertedInner(r,Math.min(i,l),o,s)===!1)return!1},e.prototype.sliceInner=function(r,i){if(r==0&&i==this.length)return this;var o=this.left.length;return i<=o?this.left.slice(r,i):r>=o?this.right.slice(r-o,i-o):this.left.slice(r,o).append(this.right.slice(0,i-o))},e.prototype.leafAppend=function(r){var i=this.right.leafAppend(r);if(i)return new e(this.left,i)},e.prototype.leafPrepend=function(r){var i=this.left.leafPrepend(r);if(i)return new e(i,this.right)},e.prototype.appendInner=function(r){return this.left.depth>=Math.max(this.right.depth,r.depth)+1?new e(this.left,new e(this.right,r)):new e(this,r)},e})(g);const te=500;class w{constructor(e,t){this.items=e,this.eventCount=t}popEvent(e,t){if(this.eventCount==0)return null;let r=this.items.length;for(;;r--)if(this.items.get(r-1).selection){--r;break}let i,o;t&&(i=this.remapping(r,this.items.length),o=i.maps.length);let s=e.tr,l,a,d=[],u=[];return this.items.forEach((c,p)=>{if(!c.step){i||(i=this.remapping(r,p+1),o=i.maps.length),o--,u.push(c);return}if(i){u.push(new y(c.map));let m=c.step.map(i.slice(o)),v;m&&s.maybeStep(m).doc&&(v=s.mapping.maps[s.mapping.maps.length-1],d.push(new y(v,void 0,void 0,d.length+u.length))),o--,v&&i.appendMap(v,o)}else s.maybeStep(c.step);if(c.selection)return l=i?c.selection.map(i.slice(o)):c.selection,a=new w(this.items.slice(0,r).append(u.reverse().concat(d)),this.eventCount-1),!1},this.items.length,0),{remaining:a,transform:s,selection:l}}addTransform(e,t,r,i){let o=[],s=this.eventCount,l=this.items,a=!i&&l.length?l.get(l.length-1):null;for(let u=0;u<e.steps.length;u++){let c=e.steps[u].invert(e.docs[u]),p=new y(e.mapping.maps[u],c,t),m;(m=a&&a.merge(p))&&(p=m,u?o.pop():l=l.slice(0,l.length-1)),o.push(p),t&&(s++,t=void 0),i||(a=p)}let d=s-r.depth;return d>ie&&(l=ne(l,d),s-=d),new w(l.append(o),s)}remapping(e,t){let r=new h.Mapping;return this.items.forEach((i,o)=>{let s=i.mirrorOffset!=null&&o-i.mirrorOffset>=e?r.maps.length-i.mirrorOffset:void 0;r.appendMap(i.map,s)},e,t),r}addMaps(e){return this.eventCount==0?this:new w(this.items.append(e.map(t=>new y(t))),this.eventCount)}rebased(e,t){if(!this.eventCount)return this;let r=[],i=Math.max(0,this.items.length-t),o=e.mapping,s=e.steps.length,l=this.eventCount;this.items.forEach(p=>{p.selection&&l--},i);let a=t;this.items.forEach(p=>{let m=o.getMirror(--a);if(m==null)return;s=Math.min(s,m);let v=o.maps[m];if(p.step){let A=e.steps[m].invert(e.docs[m]),M=p.selection&&p.selection.map(o.slice(a+1,m));M&&l++,r.push(new y(v,A,M))}else r.push(new y(v))},i);let d=[];for(let p=t;p<s;p++)d.push(new y(o.maps[p]));let u=this.items.slice(0,i).append(d).append(r),c=new w(u,l);return c.emptyItemCount()>te&&(c=c.compress(this.items.length-r.length)),c}emptyItemCount(){let e=0;return this.items.forEach(t=>{t.step||e++}),e}compress(e=this.items.length){let t=this.remapping(0,e),r=t.maps.length,i=[],o=0;return this.items.forEach((s,l)=>{if(l>=e)i.push(s),s.selection&&o++;else if(s.step){let a=s.step.map(t.slice(r)),d=a&&a.getMap();if(r--,d&&t.appendMap(d,r),a){let u=s.selection&&s.selection.map(t.slice(r));u&&o++;let c=new y(d.invert(),a,u),p,m=i.length-1;(p=i.length&&i[m].merge(c))?i[m]=p:i.push(c)}}else s.map&&r--},this.items.length,0),new w(g.from(i.reverse()),o)}}w.empty=new w(g.empty,0);function ne(n,e){let t;return n.forEach((r,i)=>{if(r.selection&&e--==0)return t=i,!1}),n.slice(t)}class y{constructor(e,t,r,i){this.map=e,this.step=t,this.selection=r,this.mirrorOffset=i}merge(e){if(this.step&&e.step&&!e.selection){let t=e.step.merge(this.step);if(t)return new y(t.getMap().invert(),t,this.selection)}}}class P{constructor(e,t,r,i,o){this.done=e,this.undone=t,this.prevRanges=r,this.prevTime=i,this.prevComposition=o}}const ie=20;function re(n,e,t,r){let i=t.getMeta(b),o;if(i)return i.historyState;t.getMeta(le)&&(n=new P(n.done,n.undone,null,0,-1));let s=t.getMeta("appendedTransaction");if(t.steps.length==0)return n;if(s&&s.getMeta(b))return s.getMeta(b).redo?new P(n.done.addTransform(t,void 0,r,T(e)),n.undone,F(t.mapping.maps),n.prevTime,n.prevComposition):new P(n.done,n.undone.addTransform(t,void 0,r,T(e)),null,n.prevTime,n.prevComposition);if(t.getMeta("addToHistory")!==!1&&!(s&&s.getMeta("addToHistory")===!1)){let l=t.getMeta("composition"),a=n.prevTime==0||!s&&n.prevComposition!=l&&(n.prevTime<(t.time||0)-r.newGroupDelay||!oe(t,n.prevRanges)),d=s?D(n.prevRanges,t.mapping):F(t.mapping.maps);return new P(n.done.addTransform(t,a?e.selection.getBookmark():void 0,r,T(e)),w.empty,d,t.time,l??n.prevComposition)}else return(o=t.getMeta("rebased"))?new P(n.done.rebased(t,o),n.undone.rebased(t,o),D(n.prevRanges,t.mapping),n.prevTime,n.prevComposition):new P(n.done.addMaps(t.mapping.maps),n.undone.addMaps(t.mapping.maps),D(n.prevRanges,t.mapping),n.prevTime,n.prevComposition)}function oe(n,e){if(!e)return!1;if(!n.docChanged)return!0;let t=!1;return n.mapping.maps[0].forEach((r,i)=>{for(let o=0;o<e.length;o+=2)r<=e[o+1]&&i>=e[o]&&(t=!0)}),t}function F(n){let e=[];for(let t=n.length-1;t>=0&&e.length==0;t--)n[t].forEach((r,i,o,s)=>e.push(o,s));return e}function D(n,e){if(!n)return null;let t=[];for(let r=0;r<n.length;r+=2){let i=e.map(n[r],1),o=e.map(n[r+1],-1);i<=o&&t.push(i,o)}return t}function se(n,e,t){let r=T(e),i=b.get(e).spec.config,o=(t?n.undone:n.done).popEvent(e,r);if(!o)return null;let s=o.selection.resolve(o.transform.doc),l=(t?n.done:n.undone).addTransform(o.transform,e.selection.getBookmark(),i,r),a=new P(t?l:o.remaining,t?o.remaining:l,null,0,-1);return o.transform.setSelection(s).setMeta(b,{redo:t,historyState:a})}let k=!1,L=null;function T(n){let e=n.plugins;if(L!=e){k=!1,L=e;for(let t=0;t<e.length;t++)if(e[t].spec.historyPreserveItems){k=!0;break}}return k}const b=new h.PluginKey("history"),le=new h.PluginKey("closeHistory");function ae(n={}){return n={depth:n.depth||100,newGroupDelay:n.newGroupDelay||500},new h.Plugin({key:b,state:{init(){return new P(w.empty,w.empty,null,0,-1)},apply(e,t,r){return re(t,r,e,n)}},config:n,props:{handleDOMEvents:{beforeinput(e,t){let r=t.inputType,i=r=="historyUndo"?H:r=="historyRedo"?G:null;return!i||!e.editable?!1:(t.preventDefault(),i(e.state,e.dispatch))}}}})}function _(n,e){return(t,r)=>{let i=b.getState(t);if(!i||(n?i.undone:i.done).eventCount==0)return!1;if(r){let o=se(i,t,n);o&&r(e?o.scrollIntoView():o)}return!0}}const H=_(!1,!0),G=_(!0,!0);h.Extension.create({name:"characterCount",addOptions(){return{limit:null,mode:"textSize",textCounter:n=>n.length,wordCounter:n=>n.split(" ").filter(e=>e!=="").length}},addStorage(){return{characters:()=>0,words:()=>0}},onBeforeCreate(){this.storage.characters=n=>{const e=(n==null?void 0:n.node)||this.editor.state.doc;if(((n==null?void 0:n.mode)||this.options.mode)==="textSize"){const r=e.textBetween(0,e.content.size,void 0," ");return this.options.textCounter(r)}return e.nodeSize},this.storage.words=n=>{const e=(n==null?void 0:n.node)||this.editor.state.doc,t=e.textBetween(0,e.content.size," "," ");return this.options.wordCounter(t)}},addProseMirrorPlugins(){let n=!1;return[new C.Plugin({key:new C.PluginKey("characterCount"),appendTransaction:(e,t,r)=>{if(n)return;const i=this.options.limit;if(i==null||i===0){n=!0;return}const o=this.storage.characters({node:r.doc});if(o>i){const s=o-i,l=0,a=s;console.warn(`[CharacterCount] Initial content exceeded limit of ${i} characters. Content was automatically trimmed.`);const d=r.tr.deleteRange(l,a);return n=!0,d}n=!0},filterTransaction:(e,t)=>{const r=this.options.limit;if(!e.docChanged||r===0||r===null||r===void 0)return!0;const i=this.storage.characters({node:t.doc}),o=this.storage.characters({node:e.doc});if(o<=r||i>r&&o>r&&o<=i)return!0;if(i>r&&o>r&&o>i||!e.getMeta("paste"))return!1;const l=e.selection.$head.pos,a=o-r,d=l-a,u=l;return e.deleteRange(d,u),!(this.storage.characters({node:e.doc})>r)}})]}});h.Extension.create({name:"dropCursor",addOptions(){return{color:"currentColor",width:1,class:void 0}},addProseMirrorPlugins(){return[U(this.options)]}});h.Extension.create({name:"focus",addOptions(){return{className:"has-focus",mode:"all"}},addProseMirrorPlugins(){return[new C.Plugin({key:new C.PluginKey("focus"),props:{decorations:({doc:n,selection:e})=>{const{isEditable:t,isFocused:r}=this.editor,{anchor:i}=e,o=[];if(!t||!r)return E.DecorationSet.create(n,[]);let s=0;this.options.mode==="deepest"&&n.descendants((a,d)=>{if(a.isText)return;if(!(i>=d&&i<=d+a.nodeSize-1))return!1;s+=1});let l=0;return n.descendants((a,d)=>{if(a.isText||!(i>=d&&i<=d+a.nodeSize-1))return!1;if(l+=1,this.options.mode==="deepest"&&s-l>0||this.options.mode==="shallowest"&&l>1)return this.options.mode==="deepest";o.push(E.Decoration.node(d,d+a.nodeSize,{class:this.options.className}))}),E.DecorationSet.create(n,o)}}})]}});h.Extension.create({name:"gapCursor",addProseMirrorPlugins(){return[Y()]},extendNodeSchema(n){var e;const t={name:n.name,options:n.options,storage:n.storage};return{allowGapCursor:(e=h.callOrReturn(h.getExtensionField(n,"allowGapCursor",t)))!=null?e:null}}});var V="placeholder";function de(n){return n.replace(/\s+/g,"-").replace(/[^a-zA-Z0-9-]/g,"").replace(/^[0-9-]+/,"").replace(/^-+/,"").toLowerCase()}h.Extension.create({name:"placeholder",addOptions(){return{emptyEditorClass:"is-editor-empty",emptyNodeClass:"is-empty",dataAttribute:V,placeholder:"Write something …",showOnlyWhenEditable:!0,showOnlyCurrent:!0,includeChildren:!1}},addProseMirrorPlugins(){const n=this.options.dataAttribute?`data-${de(this.options.dataAttribute)}`:`data-${V}`;return[new C.Plugin({key:new C.PluginKey("placeholder"),props:{decorations:({doc:e,selection:t})=>{const r=this.editor.isEditable||!this.options.showOnlyWhenEditable,{anchor:i}=t,o=[];if(!r)return null;const s=this.editor.isEmpty;return e.descendants((l,a)=>{const d=i>=a&&i<=a+l.nodeSize,u=!l.isLeaf&&h.isNodeEmpty(l);if(!l.type.isTextblock)return this.options.includeChildren;if((d||!this.options.showOnlyCurrent)&&u){const c=[this.options.emptyNodeClass];s&&c.push(this.options.emptyEditorClass);const p=E.Decoration.node(a,a+l.nodeSize,{class:c.join(" "),[n]:typeof this.options.placeholder=="function"?this.options.placeholder({editor:this.editor,node:l,pos:a,hasAnchor:d}):this.options.placeholder});o.push(p)}return this.options.includeChildren}),E.DecorationSet.create(e,o)}}})]}});h.Extension.create({name:"selection",addOptions(){return{className:"selection"}},addProseMirrorPlugins(){const{editor:n,options:e}=this;return[new C.Plugin({key:new C.PluginKey("selection"),props:{decorations(t){return t.selection.empty||n.isFocused||!n.isEditable||h.isNodeSelection(t.selection)||n.view.dragging?null:E.DecorationSet.create(t.doc,[E.Decoration.inline(t.selection.from,t.selection.to,{class:e.className})])}}})]}});function K({types:n,node:e}){return e&&Array.isArray(n)&&n.includes(e.type)||(e==null?void 0:e.type)===n}h.Extension.create({name:"trailingNode",addOptions(){return{node:void 0,notAfter:[]}},addProseMirrorPlugins(){var n;const e=new C.PluginKey(this.name),t=this.options.node||((n=this.editor.schema.topNodeType.contentMatch.defaultType)==null?void 0:n.name)||"paragraph",r=Object.entries(this.editor.schema.nodes).map(([,i])=>i).filter(i=>(this.options.notAfter||[]).concat(t).includes(i.name));return[new C.Plugin({key:e,appendTransaction:(i,o,s)=>{const{doc:l,tr:a,schema:d}=s,u=e.getState(s),c=l.content.size,p=d.nodes[t];if(u)return a.insert(c,p.create())},state:{init:(i,o)=>{const s=o.tr.doc.lastChild;return!K({node:s,types:r})},apply:(i,o)=>{if(!i.docChanged||i.getMeta("__uniqueIDTransaction"))return o;const s=i.doc.lastChild;return!K({node:s,types:r})}}})]}});var ce=h.Extension.create({name:"undoRedo",addOptions(){return{depth:100,newGroupDelay:500}},addCommands(){return{undo:()=>({state:n,dispatch:e})=>H(n,e),redo:()=>({state:n,dispatch:e})=>G(n,e)}},addProseMirrorPlugins(){return[ae(this.options)]},addKeyboardShortcuts(){return{"Mod-z":()=>this.editor.commands.undo(),"Shift-Mod-z":()=>this.editor.commands.redo(),"Mod-y":()=>this.editor.commands.redo(),"Mod-я":()=>this.editor.commands.undo(),"Shift-Mod-я":()=>this.editor.commands.redo()}}});function ue(){var u;const n=x.useButtonProps(N.name),{icon:e=void 0,tooltip:t=void 0,shortcutKeys:r=void 0,tooltipOptions:i={},action:o=void 0,isActive:s=void 0}=((u=n==null?void 0:n.componentProps)==null?void 0:u.undo)??{},{disabled:l}=x.useActive(s),a=x.icons[e],d=()=>{l||o&&o()};return!n||!a?I.jsx(I.Fragment,{}):I.jsx(x.ActionButton,{action:d,disabled:l,icon:e,shortcutKeys:r,tooltip:t,tooltipOptions:i})}function pe(){var d;const n=x.useButtonProps(N.name),{icon:e=void 0,tooltip:t=void 0,shortcutKeys:r=void 0,tooltipOptions:i={},action:o=void 0,isActive:s=void 0}=((d=n==null?void 0:n.componentProps)==null?void 0:d.redo)??{},{disabled:l}=x.useActive(s),a=()=>{l||o&&o()};return n?I.jsx(x.ActionButton,{action:a,disabled:l,icon:e,shortcutKeys:r,tooltip:t,tooltipOptions:i}):I.jsx(I.Fragment,{})}const N=ce.extend({addOptions(){var n;return{...(n=this.parent)==null?void 0:n.call(this),depth:100,newGroupDelay:500,button:({editor:e,t,extension:r})=>{var i,o;return{componentProps:{undo:{action:()=>{e.chain().focus().undo().run()},shortcutKeys:((i=r.options.shortcutKeys)==null?void 0:i[0])??["mod","Z"],isActive:()=>e.can().undo(),icon:"Undo2",tooltip:t("editor.undo.tooltip")},redo:{action:()=>{e.chain().focus().redo().run()},shortcutKeys:((o=r.options.shortcutKeys)==null?void 0:o[1])??["shift","mod","Z"],isActive:()=>e.can().redo(),icon:"Redo2",tooltip:t("editor.redo.tooltip")}}}}}}});exports.History=N;exports.RichTextRedo=pe;exports.RichTextUndo=ue;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const h=require("./index-C4WLt4NA.cjs"),C=require("@tiptap/pm/state"),E=require("@tiptap/pm/view"),R=require("./index-C3dgmjIF.cjs"),I=require("react/jsx-runtime"),x=require("./index-czmcFIW7.cjs");require("react");require("./theme.cjs");function U(n={}){return new h.Plugin({view(e){return new W(e,n)}})}class W{constructor(e,t){var r;this.editorView=e,this.cursorPos=null,this.element=null,this.timeout=-1,this.width=(r=t.width)!==null&&r!==void 0?r:1,this.color=t.color===!1?void 0:t.color||"black",this.class=t.class,this.handlers=["dragover","dragend","drop","dragleave"].map(i=>{let o=s=>{this[i](s)};return e.dom.addEventListener(i,o),{name:i,handler:o}})}destroy(){this.handlers.forEach(({name:e,handler:t})=>this.editorView.dom.removeEventListener(e,t))}update(e,t){this.cursorPos!=null&&t.doc!=e.state.doc&&(this.cursorPos>e.state.doc.content.size?this.setCursor(null):this.updateOverlay())}setCursor(e){e!=this.cursorPos&&(this.cursorPos=e,e==null?(this.element.parentNode.removeChild(this.element),this.element=null):this.updateOverlay())}updateOverlay(){let e=this.editorView.state.doc.resolve(this.cursorPos),t=!e.parent.inlineContent,r,i=this.editorView.dom,o=i.getBoundingClientRect(),s=o.width/i.offsetWidth,l=o.height/i.offsetHeight;if(t){let c=e.nodeBefore,p=e.nodeAfter;if(c||p){let m=this.editorView.nodeDOM(this.cursorPos-(c?c.nodeSize:0));if(m){let v=m.getBoundingClientRect(),A=c?v.bottom:v.top;c&&p&&(A=(A+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2);let M=this.width/2*l;r={left:v.left,right:v.right,top:A-M,bottom:A+M}}}}if(!r){let c=this.editorView.coordsAtPos(this.cursorPos),p=this.width/2*s;r={left:c.left-p,right:c.left+p,top:c.top,bottom:c.bottom}}let a=this.editorView.dom.offsetParent;this.element||(this.element=a.appendChild(document.createElement("div")),this.class&&(this.element.className=this.class),this.element.style.cssText="position: absolute; z-index: 50; pointer-events: none;",this.color&&(this.element.style.backgroundColor=this.color)),this.element.classList.toggle("prosemirror-dropcursor-block",t),this.element.classList.toggle("prosemirror-dropcursor-inline",!t);let d,u;if(!a||a==document.body&&getComputedStyle(a).position=="static")d=-pageXOffset,u=-pageYOffset;else{let c=a.getBoundingClientRect(),p=c.width/a.offsetWidth,m=c.height/a.offsetHeight;d=c.left-a.scrollLeft*p,u=c.top-a.scrollTop*m}this.element.style.left=(r.left-d)/s+"px",this.element.style.top=(r.top-u)/l+"px",this.element.style.width=(r.right-r.left)/s+"px",this.element.style.height=(r.bottom-r.top)/l+"px"}scheduleRemoval(e){clearTimeout(this.timeout),this.timeout=setTimeout(()=>this.setCursor(null),e)}dragover(e){if(!this.editorView.editable)return;let t=this.editorView.posAtCoords({left:e.clientX,top:e.clientY}),r=t&&t.inside>=0&&this.editorView.state.doc.nodeAt(t.inside),i=r&&r.type.spec.disableDropCursor,o=typeof i=="function"?i(this.editorView,t,e):i;if(t&&!o){let s=t.pos;if(this.editorView.dragging&&this.editorView.dragging.slice){let l=h.dropPoint(this.editorView.state.doc,s,this.editorView.dragging.slice);l!=null&&(s=l)}this.setCursor(s),this.scheduleRemoval(5e3)}}dragend(){this.scheduleRemoval(20)}drop(){this.scheduleRemoval(20)}dragleave(e){this.editorView.dom.contains(e.relatedTarget)||this.setCursor(null)}}class f extends h.Selection{constructor(e){super(e,e)}map(e,t){let r=e.resolve(t.map(this.head));return f.valid(r)?new f(r):h.Selection.near(r)}content(){return h.Slice.empty}eq(e){return e instanceof f&&e.head==this.head}toJSON(){return{type:"gapcursor",pos:this.head}}static fromJSON(e,t){if(typeof t.pos!="number")throw new RangeError("Invalid input for GapCursor.fromJSON");return new f(e.resolve(t.pos))}getBookmark(){return new z(this.anchor)}static valid(e){let t=e.parent;if(t.inlineContent||!q(e)||!X(e))return!1;let r=t.type.spec.allowGapCursor;if(r!=null)return r;let i=t.contentMatchAt(e.index()).defaultType;return i&&i.isTextblock}static findGapCursorFrom(e,t,r=!1){e:for(;;){if(!r&&f.valid(e))return e;let i=e.pos,o=null;for(let s=e.depth;;s--){let l=e.node(s);if(t>0?e.indexAfter(s)<l.childCount:e.index(s)>0){o=l.child(t>0?e.indexAfter(s):e.index(s)-1);break}else if(s==0)return null;i+=t;let a=e.doc.resolve(i);if(f.valid(a))return a}for(;;){let s=t>0?o.firstChild:o.lastChild;if(!s){if(o.isAtom&&!o.isText&&!h.NodeSelection.isSelectable(o)){e=e.doc.resolve(i+o.nodeSize*t),r=!1;continue e}break}o=s,i+=t;let l=e.doc.resolve(i);if(f.valid(l))return l}return null}}}f.prototype.visible=!1;f.findFrom=f.findGapCursorFrom;h.Selection.jsonID("gapcursor",f);class z{constructor(e){this.pos=e}map(e){return new z(e.map(this.pos))}resolve(e){let t=e.resolve(this.pos);return f.valid(t)?new f(t):h.Selection.near(t)}}function B(n){return n.isAtom||n.spec.isolating||n.spec.createGapCursor}function q(n){for(let e=n.depth;e>=0;e--){let t=n.index(e),r=n.node(e);if(t==0){if(r.type.spec.isolating)return!0;continue}for(let i=r.child(t-1);;i=i.lastChild){if(i.childCount==0&&!i.inlineContent||B(i.type))return!0;if(i.inlineContent)return!1}}return!0}function X(n){for(let e=n.depth;e>=0;e--){let t=n.indexAfter(e),r=n.node(e);if(t==r.childCount){if(r.type.spec.isolating)return!0;continue}for(let i=r.child(t);;i=i.firstChild){if(i.childCount==0&&!i.inlineContent||B(i.type))return!0;if(i.inlineContent)return!1}}return!0}function Y(){return new h.Plugin({props:{decorations:$,createSelectionBetween(n,e,t){return e.pos==t.pos&&f.valid(t)?new f(t):null},handleClick:J,handleKeyDown:Z,handleDOMEvents:{beforeinput:Q}}})}const Z=R.keydownHandler({ArrowLeft:S("horiz",-1),ArrowRight:S("horiz",1),ArrowUp:S("vert",-1),ArrowDown:S("vert",1)});function S(n,e){const t=n=="vert"?e>0?"down":"up":e>0?"right":"left";return function(r,i,o){let s=r.selection,l=e>0?s.$to:s.$from,a=s.empty;if(s instanceof h.TextSelection){if(!o.endOfTextblock(t)||l.depth==0)return!1;a=!1,l=r.doc.resolve(e>0?l.after():l.before())}let d=f.findGapCursorFrom(l,e,a);return d?(i&&i(r.tr.setSelection(new f(d))),!0):!1}}function J(n,e,t){if(!n||!n.editable)return!1;let r=n.state.doc.resolve(e);if(!f.valid(r))return!1;let i=n.posAtCoords({left:t.clientX,top:t.clientY});return i&&i.inside>-1&&h.NodeSelection.isSelectable(n.state.doc.nodeAt(i.inside))?!1:(n.dispatch(n.state.tr.setSelection(new f(r))),!0)}function Q(n,e){if(e.inputType!="insertCompositionText"||!(n.state.selection instanceof f))return!1;let{$from:t}=n.state.selection,r=t.parent.contentMatchAt(t.index()).findWrapping(n.state.schema.nodes.text);if(!r)return!1;let i=h.Fragment.empty;for(let s=r.length-1;s>=0;s--)i=h.Fragment.from(r[s].createAndFill(null,i));let o=n.state.tr.replace(t.pos,t.pos,new h.Slice(i,0,0));return o.setSelection(h.TextSelection.near(o.doc.resolve(t.pos+1))),n.dispatch(o),!1}function $(n){if(!(n.selection instanceof f))return null;let e=document.createElement("div");return e.className="ProseMirror-gapcursor",R.DecorationSet.create(n.doc,[R.Decoration.widget(n.selection.head,e,{key:"gapcursor"})])}var O=200,g=function(){};g.prototype.append=function(e){return e.length?(e=g.from(e),!this.length&&e||e.length<O&&this.leafAppend(e)||this.length<O&&e.leafPrepend(this)||this.appendInner(e)):this};g.prototype.prepend=function(e){return e.length?g.from(e).append(this):this};g.prototype.appendInner=function(e){return new ee(this,e)};g.prototype.slice=function(e,t){return e===void 0&&(e=0),t===void 0&&(t=this.length),e>=t?g.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,t))};g.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)};g.prototype.forEach=function(e,t,r){t===void 0&&(t=0),r===void 0&&(r=this.length),t<=r?this.forEachInner(e,t,r,0):this.forEachInvertedInner(e,t,r,0)};g.prototype.map=function(e,t,r){t===void 0&&(t=0),r===void 0&&(r=this.length);var i=[];return this.forEach(function(o,s){return i.push(e(o,s))},t,r),i};g.from=function(e){return e instanceof g?e:e&&e.length?new j(e):g.empty};var j=(function(n){function e(r){n.call(this),this.values=r}n&&(e.__proto__=n),e.prototype=Object.create(n&&n.prototype),e.prototype.constructor=e;var t={length:{configurable:!0},depth:{configurable:!0}};return e.prototype.flatten=function(){return this.values},e.prototype.sliceInner=function(i,o){return i==0&&o==this.length?this:new e(this.values.slice(i,o))},e.prototype.getInner=function(i){return this.values[i]},e.prototype.forEachInner=function(i,o,s,l){for(var a=o;a<s;a++)if(i(this.values[a],l+a)===!1)return!1},e.prototype.forEachInvertedInner=function(i,o,s,l){for(var a=o-1;a>=s;a--)if(i(this.values[a],l+a)===!1)return!1},e.prototype.leafAppend=function(i){if(this.length+i.length<=O)return new e(this.values.concat(i.flatten()))},e.prototype.leafPrepend=function(i){if(this.length+i.length<=O)return new e(i.flatten().concat(this.values))},t.length.get=function(){return this.values.length},t.depth.get=function(){return 0},Object.defineProperties(e.prototype,t),e})(g);g.empty=new j([]);var ee=(function(n){function e(t,r){n.call(this),this.left=t,this.right=r,this.length=t.length+r.length,this.depth=Math.max(t.depth,r.depth)+1}return n&&(e.__proto__=n),e.prototype=Object.create(n&&n.prototype),e.prototype.constructor=e,e.prototype.flatten=function(){return this.left.flatten().concat(this.right.flatten())},e.prototype.getInner=function(r){return r<this.left.length?this.left.get(r):this.right.get(r-this.left.length)},e.prototype.forEachInner=function(r,i,o,s){var l=this.left.length;if(i<l&&this.left.forEachInner(r,i,Math.min(o,l),s)===!1||o>l&&this.right.forEachInner(r,Math.max(i-l,0),Math.min(this.length,o)-l,s+l)===!1)return!1},e.prototype.forEachInvertedInner=function(r,i,o,s){var l=this.left.length;if(i>l&&this.right.forEachInvertedInner(r,i-l,Math.max(o,l)-l,s+l)===!1||o<l&&this.left.forEachInvertedInner(r,Math.min(i,l),o,s)===!1)return!1},e.prototype.sliceInner=function(r,i){if(r==0&&i==this.length)return this;var o=this.left.length;return i<=o?this.left.slice(r,i):r>=o?this.right.slice(r-o,i-o):this.left.slice(r,o).append(this.right.slice(0,i-o))},e.prototype.leafAppend=function(r){var i=this.right.leafAppend(r);if(i)return new e(this.left,i)},e.prototype.leafPrepend=function(r){var i=this.left.leafPrepend(r);if(i)return new e(i,this.right)},e.prototype.appendInner=function(r){return this.left.depth>=Math.max(this.right.depth,r.depth)+1?new e(this.left,new e(this.right,r)):new e(this,r)},e})(g);const te=500;class w{constructor(e,t){this.items=e,this.eventCount=t}popEvent(e,t){if(this.eventCount==0)return null;let r=this.items.length;for(;;r--)if(this.items.get(r-1).selection){--r;break}let i,o;t&&(i=this.remapping(r,this.items.length),o=i.maps.length);let s=e.tr,l,a,d=[],u=[];return this.items.forEach((c,p)=>{if(!c.step){i||(i=this.remapping(r,p+1),o=i.maps.length),o--,u.push(c);return}if(i){u.push(new y(c.map));let m=c.step.map(i.slice(o)),v;m&&s.maybeStep(m).doc&&(v=s.mapping.maps[s.mapping.maps.length-1],d.push(new y(v,void 0,void 0,d.length+u.length))),o--,v&&i.appendMap(v,o)}else s.maybeStep(c.step);if(c.selection)return l=i?c.selection.map(i.slice(o)):c.selection,a=new w(this.items.slice(0,r).append(u.reverse().concat(d)),this.eventCount-1),!1},this.items.length,0),{remaining:a,transform:s,selection:l}}addTransform(e,t,r,i){let o=[],s=this.eventCount,l=this.items,a=!i&&l.length?l.get(l.length-1):null;for(let u=0;u<e.steps.length;u++){let c=e.steps[u].invert(e.docs[u]),p=new y(e.mapping.maps[u],c,t),m;(m=a&&a.merge(p))&&(p=m,u?o.pop():l=l.slice(0,l.length-1)),o.push(p),t&&(s++,t=void 0),i||(a=p)}let d=s-r.depth;return d>ie&&(l=ne(l,d),s-=d),new w(l.append(o),s)}remapping(e,t){let r=new h.Mapping;return this.items.forEach((i,o)=>{let s=i.mirrorOffset!=null&&o-i.mirrorOffset>=e?r.maps.length-i.mirrorOffset:void 0;r.appendMap(i.map,s)},e,t),r}addMaps(e){return this.eventCount==0?this:new w(this.items.append(e.map(t=>new y(t))),this.eventCount)}rebased(e,t){if(!this.eventCount)return this;let r=[],i=Math.max(0,this.items.length-t),o=e.mapping,s=e.steps.length,l=this.eventCount;this.items.forEach(p=>{p.selection&&l--},i);let a=t;this.items.forEach(p=>{let m=o.getMirror(--a);if(m==null)return;s=Math.min(s,m);let v=o.maps[m];if(p.step){let A=e.steps[m].invert(e.docs[m]),M=p.selection&&p.selection.map(o.slice(a+1,m));M&&l++,r.push(new y(v,A,M))}else r.push(new y(v))},i);let d=[];for(let p=t;p<s;p++)d.push(new y(o.maps[p]));let u=this.items.slice(0,i).append(d).append(r),c=new w(u,l);return c.emptyItemCount()>te&&(c=c.compress(this.items.length-r.length)),c}emptyItemCount(){let e=0;return this.items.forEach(t=>{t.step||e++}),e}compress(e=this.items.length){let t=this.remapping(0,e),r=t.maps.length,i=[],o=0;return this.items.forEach((s,l)=>{if(l>=e)i.push(s),s.selection&&o++;else if(s.step){let a=s.step.map(t.slice(r)),d=a&&a.getMap();if(r--,d&&t.appendMap(d,r),a){let u=s.selection&&s.selection.map(t.slice(r));u&&o++;let c=new y(d.invert(),a,u),p,m=i.length-1;(p=i.length&&i[m].merge(c))?i[m]=p:i.push(c)}}else s.map&&r--},this.items.length,0),new w(g.from(i.reverse()),o)}}w.empty=new w(g.empty,0);function ne(n,e){let t;return n.forEach((r,i)=>{if(r.selection&&e--==0)return t=i,!1}),n.slice(t)}class y{constructor(e,t,r,i){this.map=e,this.step=t,this.selection=r,this.mirrorOffset=i}merge(e){if(this.step&&e.step&&!e.selection){let t=e.step.merge(this.step);if(t)return new y(t.getMap().invert(),t,this.selection)}}}class P{constructor(e,t,r,i,o){this.done=e,this.undone=t,this.prevRanges=r,this.prevTime=i,this.prevComposition=o}}const ie=20;function re(n,e,t,r){let i=t.getMeta(b),o;if(i)return i.historyState;t.getMeta(le)&&(n=new P(n.done,n.undone,null,0,-1));let s=t.getMeta("appendedTransaction");if(t.steps.length==0)return n;if(s&&s.getMeta(b))return s.getMeta(b).redo?new P(n.done.addTransform(t,void 0,r,T(e)),n.undone,F(t.mapping.maps),n.prevTime,n.prevComposition):new P(n.done,n.undone.addTransform(t,void 0,r,T(e)),null,n.prevTime,n.prevComposition);if(t.getMeta("addToHistory")!==!1&&!(s&&s.getMeta("addToHistory")===!1)){let l=t.getMeta("composition"),a=n.prevTime==0||!s&&n.prevComposition!=l&&(n.prevTime<(t.time||0)-r.newGroupDelay||!oe(t,n.prevRanges)),d=s?D(n.prevRanges,t.mapping):F(t.mapping.maps);return new P(n.done.addTransform(t,a?e.selection.getBookmark():void 0,r,T(e)),w.empty,d,t.time,l??n.prevComposition)}else return(o=t.getMeta("rebased"))?new P(n.done.rebased(t,o),n.undone.rebased(t,o),D(n.prevRanges,t.mapping),n.prevTime,n.prevComposition):new P(n.done.addMaps(t.mapping.maps),n.undone.addMaps(t.mapping.maps),D(n.prevRanges,t.mapping),n.prevTime,n.prevComposition)}function oe(n,e){if(!e)return!1;if(!n.docChanged)return!0;let t=!1;return n.mapping.maps[0].forEach((r,i)=>{for(let o=0;o<e.length;o+=2)r<=e[o+1]&&i>=e[o]&&(t=!0)}),t}function F(n){let e=[];for(let t=n.length-1;t>=0&&e.length==0;t--)n[t].forEach((r,i,o,s)=>e.push(o,s));return e}function D(n,e){if(!n)return null;let t=[];for(let r=0;r<n.length;r+=2){let i=e.map(n[r],1),o=e.map(n[r+1],-1);i<=o&&t.push(i,o)}return t}function se(n,e,t){let r=T(e),i=b.get(e).spec.config,o=(t?n.undone:n.done).popEvent(e,r);if(!o)return null;let s=o.selection.resolve(o.transform.doc),l=(t?n.done:n.undone).addTransform(o.transform,e.selection.getBookmark(),i,r),a=new P(t?l:o.remaining,t?o.remaining:l,null,0,-1);return o.transform.setSelection(s).setMeta(b,{redo:t,historyState:a})}let k=!1,L=null;function T(n){let e=n.plugins;if(L!=e){k=!1,L=e;for(let t=0;t<e.length;t++)if(e[t].spec.historyPreserveItems){k=!0;break}}return k}const b=new h.PluginKey("history"),le=new h.PluginKey("closeHistory");function ae(n={}){return n={depth:n.depth||100,newGroupDelay:n.newGroupDelay||500},new h.Plugin({key:b,state:{init(){return new P(w.empty,w.empty,null,0,-1)},apply(e,t,r){return re(t,r,e,n)}},config:n,props:{handleDOMEvents:{beforeinput(e,t){let r=t.inputType,i=r=="historyUndo"?H:r=="historyRedo"?G:null;return!i||!e.editable?!1:(t.preventDefault(),i(e.state,e.dispatch))}}}})}function _(n,e){return(t,r)=>{let i=b.getState(t);if(!i||(n?i.undone:i.done).eventCount==0)return!1;if(r){let o=se(i,t,n);o&&r(e?o.scrollIntoView():o)}return!0}}const H=_(!1,!0),G=_(!0,!0);h.Extension.create({name:"characterCount",addOptions(){return{limit:null,mode:"textSize",textCounter:n=>n.length,wordCounter:n=>n.split(" ").filter(e=>e!=="").length}},addStorage(){return{characters:()=>0,words:()=>0}},onBeforeCreate(){this.storage.characters=n=>{const e=(n==null?void 0:n.node)||this.editor.state.doc;if(((n==null?void 0:n.mode)||this.options.mode)==="textSize"){const r=e.textBetween(0,e.content.size,void 0," ");return this.options.textCounter(r)}return e.nodeSize},this.storage.words=n=>{const e=(n==null?void 0:n.node)||this.editor.state.doc,t=e.textBetween(0,e.content.size," "," ");return this.options.wordCounter(t)}},addProseMirrorPlugins(){let n=!1;return[new C.Plugin({key:new C.PluginKey("characterCount"),appendTransaction:(e,t,r)=>{if(n)return;const i=this.options.limit;if(i==null||i===0){n=!0;return}const o=this.storage.characters({node:r.doc});if(o>i){const s=o-i,l=0,a=s;console.warn(`[CharacterCount] Initial content exceeded limit of ${i} characters. Content was automatically trimmed.`);const d=r.tr.deleteRange(l,a);return n=!0,d}n=!0},filterTransaction:(e,t)=>{const r=this.options.limit;if(!e.docChanged||r===0||r===null||r===void 0)return!0;const i=this.storage.characters({node:t.doc}),o=this.storage.characters({node:e.doc});if(o<=r||i>r&&o>r&&o<=i)return!0;if(i>r&&o>r&&o>i||!e.getMeta("paste"))return!1;const l=e.selection.$head.pos,a=o-r,d=l-a,u=l;return e.deleteRange(d,u),!(this.storage.characters({node:e.doc})>r)}})]}});h.Extension.create({name:"dropCursor",addOptions(){return{color:"currentColor",width:1,class:void 0}},addProseMirrorPlugins(){return[U(this.options)]}});h.Extension.create({name:"focus",addOptions(){return{className:"has-focus",mode:"all"}},addProseMirrorPlugins(){return[new C.Plugin({key:new C.PluginKey("focus"),props:{decorations:({doc:n,selection:e})=>{const{isEditable:t,isFocused:r}=this.editor,{anchor:i}=e,o=[];if(!t||!r)return E.DecorationSet.create(n,[]);let s=0;this.options.mode==="deepest"&&n.descendants((a,d)=>{if(a.isText)return;if(!(i>=d&&i<=d+a.nodeSize-1))return!1;s+=1});let l=0;return n.descendants((a,d)=>{if(a.isText||!(i>=d&&i<=d+a.nodeSize-1))return!1;if(l+=1,this.options.mode==="deepest"&&s-l>0||this.options.mode==="shallowest"&&l>1)return this.options.mode==="deepest";o.push(E.Decoration.node(d,d+a.nodeSize,{class:this.options.className}))}),E.DecorationSet.create(n,o)}}})]}});h.Extension.create({name:"gapCursor",addProseMirrorPlugins(){return[Y()]},extendNodeSchema(n){var e;const t={name:n.name,options:n.options,storage:n.storage};return{allowGapCursor:(e=h.callOrReturn(h.getExtensionField(n,"allowGapCursor",t)))!=null?e:null}}});var V="placeholder";function de(n){return n.replace(/\s+/g,"-").replace(/[^a-zA-Z0-9-]/g,"").replace(/^[0-9-]+/,"").replace(/^-+/,"").toLowerCase()}h.Extension.create({name:"placeholder",addOptions(){return{emptyEditorClass:"is-editor-empty",emptyNodeClass:"is-empty",dataAttribute:V,placeholder:"Write something …",showOnlyWhenEditable:!0,showOnlyCurrent:!0,includeChildren:!1}},addProseMirrorPlugins(){const n=this.options.dataAttribute?`data-${de(this.options.dataAttribute)}`:`data-${V}`;return[new C.Plugin({key:new C.PluginKey("placeholder"),props:{decorations:({doc:e,selection:t})=>{const r=this.editor.isEditable||!this.options.showOnlyWhenEditable,{anchor:i}=t,o=[];if(!r)return null;const s=this.editor.isEmpty;return e.descendants((l,a)=>{const d=i>=a&&i<=a+l.nodeSize,u=!l.isLeaf&&h.isNodeEmpty(l);if(!l.type.isTextblock)return this.options.includeChildren;if((d||!this.options.showOnlyCurrent)&&u){const c=[this.options.emptyNodeClass];s&&c.push(this.options.emptyEditorClass);const p=E.Decoration.node(a,a+l.nodeSize,{class:c.join(" "),[n]:typeof this.options.placeholder=="function"?this.options.placeholder({editor:this.editor,node:l,pos:a,hasAnchor:d}):this.options.placeholder});o.push(p)}return this.options.includeChildren}),E.DecorationSet.create(e,o)}}})]}});h.Extension.create({name:"selection",addOptions(){return{className:"selection"}},addProseMirrorPlugins(){const{editor:n,options:e}=this;return[new C.Plugin({key:new C.PluginKey("selection"),props:{decorations(t){return t.selection.empty||n.isFocused||!n.isEditable||h.isNodeSelection(t.selection)||n.view.dragging?null:E.DecorationSet.create(t.doc,[E.Decoration.inline(t.selection.from,t.selection.to,{class:e.className})])}}})]}});function K({types:n,node:e}){return e&&Array.isArray(n)&&n.includes(e.type)||(e==null?void 0:e.type)===n}h.Extension.create({name:"trailingNode",addOptions(){return{node:void 0,notAfter:[]}},addProseMirrorPlugins(){var n;const e=new C.PluginKey(this.name),t=this.options.node||((n=this.editor.schema.topNodeType.contentMatch.defaultType)==null?void 0:n.name)||"paragraph",r=Object.entries(this.editor.schema.nodes).map(([,i])=>i).filter(i=>(this.options.notAfter||[]).concat(t).includes(i.name));return[new C.Plugin({key:e,appendTransaction:(i,o,s)=>{const{doc:l,tr:a,schema:d}=s,u=e.getState(s),c=l.content.size,p=d.nodes[t];if(u)return a.insert(c,p.create())},state:{init:(i,o)=>{const s=o.tr.doc.lastChild;return!K({node:s,types:r})},apply:(i,o)=>{if(!i.docChanged||i.getMeta("__uniqueIDTransaction"))return o;const s=i.doc.lastChild;return!K({node:s,types:r})}}})]}});var ce=h.Extension.create({name:"undoRedo",addOptions(){return{depth:100,newGroupDelay:500}},addCommands(){return{undo:()=>({state:n,dispatch:e})=>H(n,e),redo:()=>({state:n,dispatch:e})=>G(n,e)}},addProseMirrorPlugins(){return[ae(this.options)]},addKeyboardShortcuts(){return{"Mod-z":()=>this.editor.commands.undo(),"Shift-Mod-z":()=>this.editor.commands.redo(),"Mod-y":()=>this.editor.commands.redo(),"Mod-я":()=>this.editor.commands.undo(),"Shift-Mod-я":()=>this.editor.commands.redo()}}});function ue(){var u;const n=x.useButtonProps(N.name),{icon:e=void 0,tooltip:t=void 0,shortcutKeys:r=void 0,tooltipOptions:i={},action:o=void 0,isActive:s=void 0}=((u=n==null?void 0:n.componentProps)==null?void 0:u.undo)??{},{disabled:l}=x.useActive(s),a=x.icons[e],d=()=>{l||o&&o()};return!n||!a?I.jsx(I.Fragment,{}):I.jsx(x.ActionButton,{action:d,disabled:l,icon:e,shortcutKeys:r,tooltip:t,tooltipOptions:i})}function pe(){var d;const n=x.useButtonProps(N.name),{icon:e=void 0,tooltip:t=void 0,shortcutKeys:r=void 0,tooltipOptions:i={},action:o=void 0,isActive:s=void 0}=((d=n==null?void 0:n.componentProps)==null?void 0:d.redo)??{},{disabled:l}=x.useActive(s),a=()=>{l||o&&o()};return n?I.jsx(x.ActionButton,{action:a,disabled:l,icon:e,shortcutKeys:r,tooltip:t,tooltipOptions:i}):I.jsx(I.Fragment,{})}const N=ce.extend({addOptions(){var n;return{...(n=this.parent)==null?void 0:n.call(this),depth:100,newGroupDelay:500,button:({editor:e,t,extension:r})=>{var i,o;return{componentProps:{undo:{action:()=>{e.chain().focus().undo().run()},shortcutKeys:((i=r.options.shortcutKeys)==null?void 0:i[0])??["mod","Z"],isActive:()=>e.can().undo(),icon:"Undo2",tooltip:t("editor.undo.tooltip")},redo:{action:()=>{e.chain().focus().redo().run()},shortcutKeys:((o=r.options.shortcutKeys)==null?void 0:o[1])??["shift","mod","Z"],isActive:()=>e.can().redo(),icon:"Redo2",tooltip:t("editor.redo.tooltip")}}}}}}});exports.History=N;exports.RichTextRedo=pe;exports.RichTextUndo=ue;
package/lib/History.js CHANGED
@@ -1,9 +1,9 @@
1
- import { K as R, v as ne, F as L, u as G, T as H, s as U, S as T, L as W, O as re, E as C, Q as ie, R as oe, U as se, l as le } from "./index-BVRHx_ha.js";
1
+ import { L as R, v as ne, F as L, u as G, T as H, s as U, S as T, O as W, Q as re, E as C, R as ie, U as oe, V as se, l as le } from "./index-D0EmqTpe.js";
2
2
  import { Plugin as A, PluginKey as I } from "@tiptap/pm/state";
3
3
  import { DecorationSet as S, Decoration as N } from "@tiptap/pm/view";
4
- import { k as ae, D as de, a as ce } from "./index-CZ1_8JQQ.js";
4
+ import { k as ae, D as de, a as ce } from "./index-CjLxMm5d.js";
5
5
  import { jsx as O, Fragment as j } from "react/jsx-runtime";
6
- import { u as X, e as Y, A as Z, i as ue } from "./index-CDFAs4RT.js";
6
+ import { u as X, e as Y, A as Z, i as ue } from "./index-B2a7NqnN.js";
7
7
  import "react";
8
8
  import "./theme.js";
9
9
  function pe(n = {}) {
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("./index-DwSnESy-.cjs"),l=require("@tiptap/pm/state"),p=require("./index-BLrMslr7.cjs"),m=require("react/jsx-runtime");require("react");require("./theme.cjs");var y=i.Node3.create({name:"horizontalRule",addOptions(){return{HTMLAttributes:{},nextNodeType:"paragraph"}},group:"block",parseHTML(){return[{tag:"hr"}]},renderHTML({HTMLAttributes:t}){return["hr",i.mergeAttributes(this.options.HTMLAttributes,t)]},markdownTokenName:"hr",parseMarkdown:(t,n)=>n.createNode("horizontalRule"),renderMarkdown:()=>"---",addCommands(){return{setHorizontalRule:()=>({chain:t,state:n})=>{if(!i.canInsertNode(n,n.schema.nodes[this.name]))return!1;const{selection:r}=n,{$to:s}=r,c=t();return i.isNodeSelection(r)?c.insertContentAt(s.pos,{type:this.name}):c.insertContent({type:this.name}),c.command(({state:a,tr:e,dispatch:h})=>{if(h){const{$to:o}=e.selection,u=o.end();if(o.nodeAfter)o.nodeAfter.isTextblock?e.setSelection(l.TextSelection.create(e.doc,o.pos+1)):o.nodeAfter.isBlock?e.setSelection(l.NodeSelection.create(e.doc,o.pos)):e.setSelection(l.TextSelection.create(e.doc,o.pos));else{const d=a.schema.nodes[this.options.nextNodeType]||o.parent.type.contentMatch.defaultType,T=d==null?void 0:d.create();T&&(e.insert(u,T),e.setSelection(l.TextSelection.create(e.doc,u+1)))}e.scrollIntoView()}return!0}).run()}}},addInputRules(){return[i.nodeInputRule({find:/^(?:---|—-|___\s|\*\*\*\s)$/,type:this.type})]}});function A(){const t=p.useButtonProps(f.name),{icon:n=void 0,tooltip:r=void 0,shortcutKeys:s=void 0,tooltipOptions:c={},action:a=void 0,isActive:e=void 0}=(t==null?void 0:t.componentProps)??{},{dataState:h,disabled:o,update:u}=p.useToggleActive(e),d=()=>{o||a&&(a(),u())};return t?m.jsx(p.ActionButton,{action:d,dataState:h,disabled:o,icon:n,shortcutKeys:s,tooltip:r,tooltipOptions:c}):m.jsx(m.Fragment,{})}const f=y.extend({addOptions(){var t;return{...(t=this.parent)==null?void 0:t.call(this),button:({editor:n,t:r,extension:s})=>({component:p.ActionButton,componentProps:{action:()=>n.commands.setHorizontalRule(),disabled:!n.can().setHorizontalRule(),icon:"Minus",shortcutKeys:s.options.shortcutKeys??["mod","alt","S"],tooltip:r("editor.horizontalrule.tooltip")}})}},addKeyboardShortcuts(){return{"Mod-Alt-s":()=>this.editor.commands.setHorizontalRule()}},renderHTML(){return["div",i.mergeAttributes(this.options.HTMLAttributes,{"data-type":this.name}),["hr"]]}});exports.HorizontalRule=f;exports.RichTextHorizontalRule=A;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("./index-C4WLt4NA.cjs"),l=require("@tiptap/pm/state"),p=require("./index-czmcFIW7.cjs"),m=require("react/jsx-runtime");require("react");require("./theme.cjs");var y=i.Node3.create({name:"horizontalRule",addOptions(){return{HTMLAttributes:{},nextNodeType:"paragraph"}},group:"block",parseHTML(){return[{tag:"hr"}]},renderHTML({HTMLAttributes:t}){return["hr",i.mergeAttributes(this.options.HTMLAttributes,t)]},markdownTokenName:"hr",parseMarkdown:(t,n)=>n.createNode("horizontalRule"),renderMarkdown:()=>"---",addCommands(){return{setHorizontalRule:()=>({chain:t,state:n})=>{if(!i.canInsertNode(n,n.schema.nodes[this.name]))return!1;const{selection:r}=n,{$to:s}=r,c=t();return i.isNodeSelection(r)?c.insertContentAt(s.pos,{type:this.name}):c.insertContent({type:this.name}),c.command(({state:a,tr:e,dispatch:h})=>{if(h){const{$to:o}=e.selection,u=o.end();if(o.nodeAfter)o.nodeAfter.isTextblock?e.setSelection(l.TextSelection.create(e.doc,o.pos+1)):o.nodeAfter.isBlock?e.setSelection(l.NodeSelection.create(e.doc,o.pos)):e.setSelection(l.TextSelection.create(e.doc,o.pos));else{const d=a.schema.nodes[this.options.nextNodeType]||o.parent.type.contentMatch.defaultType,T=d==null?void 0:d.create();T&&(e.insert(u,T),e.setSelection(l.TextSelection.create(e.doc,u+1)))}e.scrollIntoView()}return!0}).run()}}},addInputRules(){return[i.nodeInputRule({find:/^(?:---|—-|___\s|\*\*\*\s)$/,type:this.type})]}});function A(){const t=p.useButtonProps(f.name),{icon:n=void 0,tooltip:r=void 0,shortcutKeys:s=void 0,tooltipOptions:c={},action:a=void 0,isActive:e=void 0}=(t==null?void 0:t.componentProps)??{},{dataState:h,disabled:o,update:u}=p.useToggleActive(e),d=()=>{o||a&&(a(),u())};return t?m.jsx(p.ActionButton,{action:d,dataState:h,disabled:o,icon:n,shortcutKeys:s,tooltip:r,tooltipOptions:c}):m.jsx(m.Fragment,{})}const f=y.extend({addOptions(){var t;return{...(t=this.parent)==null?void 0:t.call(this),button:({editor:n,t:r,extension:s})=>({component:p.ActionButton,componentProps:{action:()=>n.commands.setHorizontalRule(),disabled:!n.can().setHorizontalRule(),icon:"Minus",shortcutKeys:s.options.shortcutKeys??["mod","alt","S"],tooltip:r("editor.horizontalrule.tooltip")}})}},addKeyboardShortcuts(){return{"Mod-Alt-s":()=>this.editor.commands.setHorizontalRule()}},renderHTML(){return["div",i.mergeAttributes(this.options.HTMLAttributes,{"data-type":this.name}),["hr"]]}});exports.HorizontalRule=f;exports.RichTextHorizontalRule=A;
@@ -1,6 +1,6 @@
1
- import { N as T, n as A, k as y, l as H, m as h } from "./index-BVRHx_ha.js";
1
+ import { N as T, n as A, k as y, l as H, m as h } from "./index-D0EmqTpe.js";
2
2
  import { TextSelection as u, NodeSelection as R } from "@tiptap/pm/state";
3
- import { u as M, d as v, A as f } from "./index-CDFAs4RT.js";
3
+ import { u as M, d as v, A as f } from "./index-B2a7NqnN.js";
4
4
  import { jsx as m, Fragment as z } from "react/jsx-runtime";
5
5
  import "react";
6
6
  import "./theme.js";
@@ -1,9 +1,9 @@
1
- import { N as v, n as x, m as k } from "./index-BVRHx_ha.js";
2
- import { N as y, c as S, a as I } from "./clsx-OumA9x-8.js";
1
+ import { N as v, n as x, m as k } from "./index-D0EmqTpe.js";
2
+ import { N as y, c as S, a as I } from "./clsx-Bg-2aTKh.js";
3
3
  import { jsxs as f, jsx as d, Fragment as P } from "react/jsx-runtime";
4
4
  import { Resizable as M } from "re-resizable";
5
5
  import { useState as N, useCallback as R } from "react";
6
- import { M as j, j as U, B as q, u as A, d as L, A as D } from "./index-CDFAs4RT.js";
6
+ import { M as j, j as U, B as q, u as A, d as L, A as D } from "./index-B2a7NqnN.js";
7
7
  import { g as l } from "./dom-dataset-CIEeltF6.js";
8
8
  import "./theme.js";
9
9
  const m = {
@@ -1 +1 @@
1
- "use strict";const h=require("./index-DwSnESy-.cjs"),w=require("./clsx-BSBE1eoY.cjs"),s=require("react/jsx-runtime"),S=require("re-resizable"),v=require("react"),u=require("./index-BLrMslr7.cjs"),f=require("./dom-dataset-BqoJhJXt.cjs");require("./theme.cjs");const m={youtube:{example:"https://www.youtube.com/watch?v=I4sMhHbHYXM",src:"https://www.youtube.com/embed/I4sMhHbHYXM",srcPrefix:"https://www.youtube.com/embed",linkRule:[/(?:https?:\/\/)?(?:www\.)?(?:youtube\.com\/(?:[^\s/]+\/\S+\/|(?:v|e(?:mbed)?)\/|\S*?[&?]v=)|youtu\.be\/)([\w-]{11})/]},youku:{example:"https://v.youku.com/v_show/id_XNDM0NDM4MTcy.html?spm=a2h0c.8166622.PhoneSokuUgc_4.dtitle",src:"https://player.youku.com/embed/XNDM0NDM4MTcy",srcPrefix:"https://player.youku.com/embed",linkRule:[String.raw`v.youku.com\/v_show\/id_\w+\=*`],idRule:String.raw`id_\w+\=*`},bilibili:{example:"https://www.bilibili.com/video/BV1EJ411u7DN",src:"https://player.bilibili.com/player.html?bvid=BV1EJ411u7DN",srcPrefix:"https://player.bilibili.com/player.html?bvid",linkRule:[String.raw`www.bilibili.com\/video\/\w+`]},qqvideo:{example:"https://v.qq.com/x/cover/mzc0020006aw1mn/u0033nvzb5v.html",src:"https://v.qq.com/txp/iframe/player.html?vid=u0033nvzb5v",srcPrefix:"https://v.qq.com/txp/iframe/player.html?vid",linkRule:[String.raw`v.qq.com\/x\/cover\/\w+\/\w+`]},amap:{example:"https://ditu.amap.com/",src:"https://www.amap.com/place/B000A45467",srcPrefix:"",linkRule:[String.raw`\.amap\.com`]},baidu_map:{example:"https://j.map.baidu.com/15/fo",src:"https://j.map.baidu.com/15/fo",srcPrefix:"",linkRule:[String.raw`map\.baidu\.com`]},modao:{example:"https://free.modao.cc/app/2cd26580a6717a147454df7470e7ec464093cba3/embed/v2#screen=sk71k6d1dfxulzx",src:"https://free.modao.cc/app/6UkpAxcGE3nPz52GLqhnOZgC7MATBSy/embed/v2",srcPrefix:"",linkRule:[String.raw`https:\/\/\w+.modao.cc\/app\/\w+\/embed\/v2`],tips:"Modao > More > Share > Embed > COPY"},lanhu:{example:"https://lanhuapp.com/link/#/invite?sid=evP7L",src:"https://lanhuapp.com/url/evP7L",srcPrefix:"",linkRule:[String.raw`https:\/\/lanhuapp.com\/url\/\w+`],tips:"Lanhu > Project > Share > Copy Link"},figma:{example:"https://www.figma.com/file/aS9uSgPXoNpaPkzbjNcK8v/Demo?node-id=0%3A1",src:"https://www.figma.com/file/aS9uSgPXoNpaPkzbjNcK8v/Demo?node-id=0%3A1",srcPrefix:"https://www.figma.com/embed?embed_host=share&url",linkRule:[String.raw`https:\/\/www.figma.com\/file\/\w+`]},canva:{example:"https://www.canva.cn/design/DAD61-t29UI/view",src:"https://www.canva.cn/design/DAD61-t29UI/view",srcPrefix:"",linkRule:[String.raw`https:\/\/www.canva.cn\/design\/.+\/view`]},processon:{example:"https://www.processon.com/embed/5ea99d8607912948b0e6fe78",src:"https://www.processon.com/embed/5ea99d8607912948b0e6fe78",srcPrefix:"",linkRule:[String.raw`https:\/\/www.processon.com\/embed\/\w+`]},codepen:{example:"https://codepen.io/mekery/embed/YzyrKOJ",src:"https://codepen.io/mekery/embed/YzyrKOJ",srcPrefix:"",linkRule:[String.raw`https:\/\/codepen.io\/.+\/embed\/\w+`]},jinshuju:{example:"https://jinshuju.net/f/q9YvVf",src:"https://jinshuju.net/f/q9YvVf",srcPrefix:"",linkRule:[String.raw`https:\/\/jinshuju.net\/f\/\w+`]},iframe:{example:"https://v.youku.com/v_show/id_XNDM0NDM4MTcy.html",src:"https://player.youku.com/embed/XNDM0NDM4MTcy",srcPrefix:"",linkRule:[".+"]},googlemaps:{example:"https://goo.gl/maps/8Ys8b4K1ZJY2",src:"https://www.google.com/maps/embed?pb=https://goo.gl/maps/8Ys8b4K1ZJY2",srcPrefix:"",linkRule:[String.raw`https:\/\/goo.gl\/maps\/\w+`]}};function I(e){const t=m.youtube,i=e.matchedUrl;e.validLink=!0;const r=i.split("="),n=r.length;if(n>0){const c=r[n-1];e.src=`${t.srcPrefix}/${c}`,e.validId=!0}return e}function R(e){const t=m.youku,i=e.matchedUrl,r=t.idRule,n=new RegExp(r),c=i.match(n);if(c&&c.length>0){const o=c[0].slice(3);e.validId=!0,e.src=`${t.srcPrefix}/${o}`}else e.validId=!1;return e}function P(e){const t=m.bilibili,r=e.matchedUrl.split("/"),n=r.length;if(n>0){const c=r[n-1];e.src=`${t.srcPrefix}=${c}`,e.validId=!0}return e}function j(e){const t=m.qqvideo,r=e.matchedUrl.split("/"),n=r.length;if(n>0){const c=r[n-1];e.src=`${t.srcPrefix}=${c}`,e.validId=!0}return e}function M(e,t){return t.src=e,t.validId=!0,t}function N(e,t){return t.src=e,t.validId=!0,t}function q(e,t){return t.src=e,t.validId=!0,t.originalLink=e,t}function U(e){return e.src=e.matchedUrl,e.validId=!0,e.originalLink=e.src,e}function A(e){return e.src=e.matchedUrl,e.validId=!0,e.originalLink=e.src,e}function D(e){const t=m.figma;return e.src=`${t.srcPrefix}=${encodeURIComponent(e.matchedUrl)}`,e.validId=!0,e.originalLink=e.matchedUrl,e}function L(e,t){return t.src=`${t.matchedUrl}?embed`,t.validId=!0,t.originalLink=e,t}function _(e,t){return t.src=`${t.matchedUrl}`,t.validId=!0,t.originalLink=e,t}function $(e){return e.src=`${e.matchedUrl}`,e.validId=!0,e.originalLink=e.src,e}function T(e,t){return t.src=`${t.matchedUrl}?background=white&banner=show&embedded=true`,t.validId=!0,t.originalLink=e,t}function z(e,t){return t.src=`${t.matchedUrl}`,t.validId=!0,t.originalLink=e,t}function Y(e,t,i){if(e==="googlemaps")return i.validLink=!0,i.matchedUrl=t,i;const n=m[e].linkRule;for(const c of n){const o=new RegExp(c),a=t.match(o);if(a&&a.length>0)return i.validLink=!0,i.matchedUrl=e==="youtube"?a[1]:a[0],i}return i}function C(e){var i,r;let t="iframe";return((i=e.includes)!=null&&i.call(e,"youtube")||(r=e.includes)!=null&&r.call(e,"youtu.be"))&&(t="youtube"),e.includes("youku")&&(t="youku"),e.includes("bilibili")&&(t="bilibili"),e.includes("qq")&&(t="qqvideo"),e.includes("amap")&&(t="amap"),e.includes("map.baidu")&&(t="baidu_map"),(e.includes("google.com/maps")||e.includes("maps.app.goo.gl"))&&(t="googlemaps"),e.includes("modao")&&(t="modao"),e.includes("lanhuapp")&&(t="lanhu"),e.includes("figma")&&(t="figma"),e.includes("canva")&&(t="canva"),e.includes("processon")&&(t="processon"),e.includes("codepen")&&(t="codepen"),e.includes("jinshuju")&&(t="jinshuju"),e.includes("iframe")&&(t="iframe"),t}function k(e){let t={validLink:!1,validId:!1,matchedUrl:"",originalLink:e,src:""};const i=C(e);if(t=Y(i,e,t),!t.validLink)return t;switch(i){case"youtube":return I(t);case"youku":return R(t);case"bilibili":return P(t);case"qqvideo":return j(t);case"amap":return M(e,t);case"baidu_map":return N(e,t);case"googlemaps":return q(e,t);case"modao":return U(t);case"lanhu":return A(t);case"figma":return D(t);case"canva":return L(e,t);case"processon":return _(e,t);case"codepen":return $(t);case"jinshuju":return T(e,t);case"iframe":return z(e,t);default:return e}}const E="_wrap_5y04w_1",H="_innerWrap_5y04w_15",x={wrap:E,innerWrap:H};function B({editor:e,node:t,updateAttributes:i}){const r=u.useEditableEditor(),{src:n,width:c,height:o}=t.attrs,[a,p]=v.useState("");function l(){if(!a)return;const d=k(a);e.chain().updateAttributes(b.name,{src:(d==null?void 0:d.src)||a}).setNodeSelection(e.state.selection.from).focus().run()}const y=v.useCallback(d=>{i({width:d.width,height:d.height})},[i]);return s.jsxs(w.NodeViewWrapper,{children:[!n&&s.jsxs("div",{className:"richtext-mx-auto richtext-my-[12px] richtext-flex richtext-max-w-[600px] richtext-items-center richtext-justify-center richtext-gap-[10px] richtext-rounded-[12px] richtext-border richtext-border-solid richtext-border-border richtext-p-[10px]",children:[s.jsx(u.Input,{autoFocus:!0,className:"richtext-flex-1",onInput:d=>p(d.target.value),placeholder:"Enter link",type:"url",value:a}),s.jsx(u.Button,{className:"richtext-w-[60px]",onClick:l,children:"OK"})]}),n&&s.jsx(S.Resizable,{size:{width:Number.parseInt(c),height:Number.parseInt(o)},onResizeStop:(d,K,O,g)=>{y({width:Number.parseInt(c)+g.width,height:Number.parseInt(o)+g.height})},children:s.jsx("div",{className:w.clsx(x.wrap,"render-wrapper"),children:s.jsx("div",{className:x.innerWrap,style:{pointerEvents:r?"none":"auto"},children:s.jsx("iframe",{className:"richtext-my-[12px]",src:n})})})})]})}function V(){const e=u.useButtonProps(b.name),{icon:t=void 0,tooltip:i=void 0,shortcutKeys:r=void 0,tooltipOptions:n={},action:c=void 0,isActive:o=void 0}=(e==null?void 0:e.componentProps)??{},{editorDisabled:a,update:p}=u.useToggleActive(o),l=()=>{a||c&&(c(),p())};return e?s.jsx(u.ActionButton,{action:l,disabled:a,icon:t,shortcutKeys:r,tooltip:i,tooltipOptions:n}):s.jsx(s.Fragment,{})}const b=h.Node3.create({name:"iframe",content:"",marks:"",group:"block",selectable:!0,atom:!0,draggable:!0,addOptions(){var e;return{...(e=this.parent)==null?void 0:e.call(this),HTMLAttributes:{class:"iframe"},button:({editor:t,extension:i,t:r})=>({componentProps:{action:n=>t.commands.setIframe(n),upload:i.options.upload,icon:"Iframe",tooltip:r("editor.iframe.tooltip")}})}},addAttributes(){return{width:{default:600,parseHTML:f.getDatasetAttribute("width")},height:{default:300,parseHTML:f.getDatasetAttribute("height")},src:{default:null,parseHTML:f.getDatasetAttribute("src")},defaultShowPicker:{default:!1},frameborder:{default:0},allowfullscreen:{default:this.options.allowFullscreen,parseHTML:()=>this.options.allowFullscreen}}},parseHTML(){return[{tag:"iframe"}]},renderHTML({HTMLAttributes:e}){return["iframe",h.mergeAttributes(this.options.HTMLAttributes,e)]},addCommands(){return{setIframe:e=>({tr:t,commands:i,chain:r})=>{var c,o,a;if(((a=(o=(c=t.selection)==null?void 0:c.node)==null?void 0:o.type)==null?void 0:a.name)==this.name)return i.updateAttributes(this.name,e);const n=e||{url:""};return r().insertContent({type:this.name,attrs:n}).run()}}},addInputRules(){return[h.nodeInputRule({find:/^\$iframe\$$/,type:this.type,getAttributes:()=>({width:"100%"})})]},addNodeView(){return w.ReactNodeViewRenderer(B)}});exports.Iframe=b;exports.RichTextIframe=V;exports.getServiceSrc=k;
1
+ "use strict";const h=require("./index-C4WLt4NA.cjs"),w=require("./clsx-DSAWW32g.cjs"),s=require("react/jsx-runtime"),S=require("re-resizable"),v=require("react"),u=require("./index-czmcFIW7.cjs"),f=require("./dom-dataset-BqoJhJXt.cjs");require("./theme.cjs");const m={youtube:{example:"https://www.youtube.com/watch?v=I4sMhHbHYXM",src:"https://www.youtube.com/embed/I4sMhHbHYXM",srcPrefix:"https://www.youtube.com/embed",linkRule:[/(?:https?:\/\/)?(?:www\.)?(?:youtube\.com\/(?:[^\s/]+\/\S+\/|(?:v|e(?:mbed)?)\/|\S*?[&?]v=)|youtu\.be\/)([\w-]{11})/]},youku:{example:"https://v.youku.com/v_show/id_XNDM0NDM4MTcy.html?spm=a2h0c.8166622.PhoneSokuUgc_4.dtitle",src:"https://player.youku.com/embed/XNDM0NDM4MTcy",srcPrefix:"https://player.youku.com/embed",linkRule:[String.raw`v.youku.com\/v_show\/id_\w+\=*`],idRule:String.raw`id_\w+\=*`},bilibili:{example:"https://www.bilibili.com/video/BV1EJ411u7DN",src:"https://player.bilibili.com/player.html?bvid=BV1EJ411u7DN",srcPrefix:"https://player.bilibili.com/player.html?bvid",linkRule:[String.raw`www.bilibili.com\/video\/\w+`]},qqvideo:{example:"https://v.qq.com/x/cover/mzc0020006aw1mn/u0033nvzb5v.html",src:"https://v.qq.com/txp/iframe/player.html?vid=u0033nvzb5v",srcPrefix:"https://v.qq.com/txp/iframe/player.html?vid",linkRule:[String.raw`v.qq.com\/x\/cover\/\w+\/\w+`]},amap:{example:"https://ditu.amap.com/",src:"https://www.amap.com/place/B000A45467",srcPrefix:"",linkRule:[String.raw`\.amap\.com`]},baidu_map:{example:"https://j.map.baidu.com/15/fo",src:"https://j.map.baidu.com/15/fo",srcPrefix:"",linkRule:[String.raw`map\.baidu\.com`]},modao:{example:"https://free.modao.cc/app/2cd26580a6717a147454df7470e7ec464093cba3/embed/v2#screen=sk71k6d1dfxulzx",src:"https://free.modao.cc/app/6UkpAxcGE3nPz52GLqhnOZgC7MATBSy/embed/v2",srcPrefix:"",linkRule:[String.raw`https:\/\/\w+.modao.cc\/app\/\w+\/embed\/v2`],tips:"Modao > More > Share > Embed > COPY"},lanhu:{example:"https://lanhuapp.com/link/#/invite?sid=evP7L",src:"https://lanhuapp.com/url/evP7L",srcPrefix:"",linkRule:[String.raw`https:\/\/lanhuapp.com\/url\/\w+`],tips:"Lanhu > Project > Share > Copy Link"},figma:{example:"https://www.figma.com/file/aS9uSgPXoNpaPkzbjNcK8v/Demo?node-id=0%3A1",src:"https://www.figma.com/file/aS9uSgPXoNpaPkzbjNcK8v/Demo?node-id=0%3A1",srcPrefix:"https://www.figma.com/embed?embed_host=share&url",linkRule:[String.raw`https:\/\/www.figma.com\/file\/\w+`]},canva:{example:"https://www.canva.cn/design/DAD61-t29UI/view",src:"https://www.canva.cn/design/DAD61-t29UI/view",srcPrefix:"",linkRule:[String.raw`https:\/\/www.canva.cn\/design\/.+\/view`]},processon:{example:"https://www.processon.com/embed/5ea99d8607912948b0e6fe78",src:"https://www.processon.com/embed/5ea99d8607912948b0e6fe78",srcPrefix:"",linkRule:[String.raw`https:\/\/www.processon.com\/embed\/\w+`]},codepen:{example:"https://codepen.io/mekery/embed/YzyrKOJ",src:"https://codepen.io/mekery/embed/YzyrKOJ",srcPrefix:"",linkRule:[String.raw`https:\/\/codepen.io\/.+\/embed\/\w+`]},jinshuju:{example:"https://jinshuju.net/f/q9YvVf",src:"https://jinshuju.net/f/q9YvVf",srcPrefix:"",linkRule:[String.raw`https:\/\/jinshuju.net\/f\/\w+`]},iframe:{example:"https://v.youku.com/v_show/id_XNDM0NDM4MTcy.html",src:"https://player.youku.com/embed/XNDM0NDM4MTcy",srcPrefix:"",linkRule:[".+"]},googlemaps:{example:"https://goo.gl/maps/8Ys8b4K1ZJY2",src:"https://www.google.com/maps/embed?pb=https://goo.gl/maps/8Ys8b4K1ZJY2",srcPrefix:"",linkRule:[String.raw`https:\/\/goo.gl\/maps\/\w+`]}};function I(e){const t=m.youtube,i=e.matchedUrl;e.validLink=!0;const r=i.split("="),n=r.length;if(n>0){const c=r[n-1];e.src=`${t.srcPrefix}/${c}`,e.validId=!0}return e}function R(e){const t=m.youku,i=e.matchedUrl,r=t.idRule,n=new RegExp(r),c=i.match(n);if(c&&c.length>0){const o=c[0].slice(3);e.validId=!0,e.src=`${t.srcPrefix}/${o}`}else e.validId=!1;return e}function P(e){const t=m.bilibili,r=e.matchedUrl.split("/"),n=r.length;if(n>0){const c=r[n-1];e.src=`${t.srcPrefix}=${c}`,e.validId=!0}return e}function j(e){const t=m.qqvideo,r=e.matchedUrl.split("/"),n=r.length;if(n>0){const c=r[n-1];e.src=`${t.srcPrefix}=${c}`,e.validId=!0}return e}function M(e,t){return t.src=e,t.validId=!0,t}function N(e,t){return t.src=e,t.validId=!0,t}function q(e,t){return t.src=e,t.validId=!0,t.originalLink=e,t}function U(e){return e.src=e.matchedUrl,e.validId=!0,e.originalLink=e.src,e}function A(e){return e.src=e.matchedUrl,e.validId=!0,e.originalLink=e.src,e}function D(e){const t=m.figma;return e.src=`${t.srcPrefix}=${encodeURIComponent(e.matchedUrl)}`,e.validId=!0,e.originalLink=e.matchedUrl,e}function L(e,t){return t.src=`${t.matchedUrl}?embed`,t.validId=!0,t.originalLink=e,t}function _(e,t){return t.src=`${t.matchedUrl}`,t.validId=!0,t.originalLink=e,t}function $(e){return e.src=`${e.matchedUrl}`,e.validId=!0,e.originalLink=e.src,e}function T(e,t){return t.src=`${t.matchedUrl}?background=white&banner=show&embedded=true`,t.validId=!0,t.originalLink=e,t}function z(e,t){return t.src=`${t.matchedUrl}`,t.validId=!0,t.originalLink=e,t}function Y(e,t,i){if(e==="googlemaps")return i.validLink=!0,i.matchedUrl=t,i;const n=m[e].linkRule;for(const c of n){const o=new RegExp(c),a=t.match(o);if(a&&a.length>0)return i.validLink=!0,i.matchedUrl=e==="youtube"?a[1]:a[0],i}return i}function C(e){var i,r;let t="iframe";return((i=e.includes)!=null&&i.call(e,"youtube")||(r=e.includes)!=null&&r.call(e,"youtu.be"))&&(t="youtube"),e.includes("youku")&&(t="youku"),e.includes("bilibili")&&(t="bilibili"),e.includes("qq")&&(t="qqvideo"),e.includes("amap")&&(t="amap"),e.includes("map.baidu")&&(t="baidu_map"),(e.includes("google.com/maps")||e.includes("maps.app.goo.gl"))&&(t="googlemaps"),e.includes("modao")&&(t="modao"),e.includes("lanhuapp")&&(t="lanhu"),e.includes("figma")&&(t="figma"),e.includes("canva")&&(t="canva"),e.includes("processon")&&(t="processon"),e.includes("codepen")&&(t="codepen"),e.includes("jinshuju")&&(t="jinshuju"),e.includes("iframe")&&(t="iframe"),t}function k(e){let t={validLink:!1,validId:!1,matchedUrl:"",originalLink:e,src:""};const i=C(e);if(t=Y(i,e,t),!t.validLink)return t;switch(i){case"youtube":return I(t);case"youku":return R(t);case"bilibili":return P(t);case"qqvideo":return j(t);case"amap":return M(e,t);case"baidu_map":return N(e,t);case"googlemaps":return q(e,t);case"modao":return U(t);case"lanhu":return A(t);case"figma":return D(t);case"canva":return L(e,t);case"processon":return _(e,t);case"codepen":return $(t);case"jinshuju":return T(e,t);case"iframe":return z(e,t);default:return e}}const E="_wrap_5y04w_1",H="_innerWrap_5y04w_15",x={wrap:E,innerWrap:H};function B({editor:e,node:t,updateAttributes:i}){const r=u.useEditableEditor(),{src:n,width:c,height:o}=t.attrs,[a,p]=v.useState("");function l(){if(!a)return;const d=k(a);e.chain().updateAttributes(b.name,{src:(d==null?void 0:d.src)||a}).setNodeSelection(e.state.selection.from).focus().run()}const y=v.useCallback(d=>{i({width:d.width,height:d.height})},[i]);return s.jsxs(w.NodeViewWrapper,{children:[!n&&s.jsxs("div",{className:"richtext-mx-auto richtext-my-[12px] richtext-flex richtext-max-w-[600px] richtext-items-center richtext-justify-center richtext-gap-[10px] richtext-rounded-[12px] richtext-border richtext-border-solid richtext-border-border richtext-p-[10px]",children:[s.jsx(u.Input,{autoFocus:!0,className:"richtext-flex-1",onInput:d=>p(d.target.value),placeholder:"Enter link",type:"url",value:a}),s.jsx(u.Button,{className:"richtext-w-[60px]",onClick:l,children:"OK"})]}),n&&s.jsx(S.Resizable,{size:{width:Number.parseInt(c),height:Number.parseInt(o)},onResizeStop:(d,K,O,g)=>{y({width:Number.parseInt(c)+g.width,height:Number.parseInt(o)+g.height})},children:s.jsx("div",{className:w.clsx(x.wrap,"render-wrapper"),children:s.jsx("div",{className:x.innerWrap,style:{pointerEvents:r?"none":"auto"},children:s.jsx("iframe",{className:"richtext-my-[12px]",src:n})})})})]})}function V(){const e=u.useButtonProps(b.name),{icon:t=void 0,tooltip:i=void 0,shortcutKeys:r=void 0,tooltipOptions:n={},action:c=void 0,isActive:o=void 0}=(e==null?void 0:e.componentProps)??{},{editorDisabled:a,update:p}=u.useToggleActive(o),l=()=>{a||c&&(c(),p())};return e?s.jsx(u.ActionButton,{action:l,disabled:a,icon:t,shortcutKeys:r,tooltip:i,tooltipOptions:n}):s.jsx(s.Fragment,{})}const b=h.Node3.create({name:"iframe",content:"",marks:"",group:"block",selectable:!0,atom:!0,draggable:!0,addOptions(){var e;return{...(e=this.parent)==null?void 0:e.call(this),HTMLAttributes:{class:"iframe"},button:({editor:t,extension:i,t:r})=>({componentProps:{action:n=>t.commands.setIframe(n),upload:i.options.upload,icon:"Iframe",tooltip:r("editor.iframe.tooltip")}})}},addAttributes(){return{width:{default:600,parseHTML:f.getDatasetAttribute("width")},height:{default:300,parseHTML:f.getDatasetAttribute("height")},src:{default:null,parseHTML:f.getDatasetAttribute("src")},defaultShowPicker:{default:!1},frameborder:{default:0},allowfullscreen:{default:this.options.allowFullscreen,parseHTML:()=>this.options.allowFullscreen}}},parseHTML(){return[{tag:"iframe"}]},renderHTML({HTMLAttributes:e}){return["iframe",h.mergeAttributes(this.options.HTMLAttributes,e)]},addCommands(){return{setIframe:e=>({tr:t,commands:i,chain:r})=>{var c,o,a;if(((a=(o=(c=t.selection)==null?void 0:c.node)==null?void 0:o.type)==null?void 0:a.name)==this.name)return i.updateAttributes(this.name,e);const n=e||{url:""};return r().insertContent({type:this.name,attrs:n}).run()}}},addInputRules(){return[h.nodeInputRule({find:/^\$iframe\$$/,type:this.type,getAttributes:()=>({width:"100%"})})]},addNodeView(){return w.ReactNodeViewRenderer(B)}});exports.Iframe=b;exports.RichTextIframe=V;exports.getServiceSrc=k;
package/lib/Iframe.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("./index-DwSnESy-.cjs");require("./clsx-BSBE1eoY.cjs");const e=require("./Iframe-Bk5OIlvy.cjs");require("./dom-dataset-BqoJhJXt.cjs");exports.Iframe=e.Iframe;exports.RichTextIframe=e.RichTextIframe;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("./index-C4WLt4NA.cjs");require("./clsx-DSAWW32g.cjs");const e=require("./Iframe-hwg9FxhU.cjs");require("./dom-dataset-BqoJhJXt.cjs");exports.Iframe=e.Iframe;exports.RichTextIframe=e.RichTextIframe;
package/lib/Iframe.js CHANGED
@@ -1,6 +1,6 @@
1
- import "./index-BVRHx_ha.js";
2
- import "./clsx-OumA9x-8.js";
3
- import { I as e, R as i } from "./Iframe-XlAb03_r.js";
1
+ import "./index-D0EmqTpe.js";
2
+ import "./clsx-Bg-2aTKh.js";
3
+ import { I as e, R as i } from "./Iframe-CAUrccA0.js";
4
4
  import "./dom-dataset-CIEeltF6.js";
5
5
  export {
6
6
  e as Iframe,
package/lib/Image.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("./index-DwSnESy-.cjs");const e=require("./index-BLrMslr7.cjs");require("./clsx-BSBE1eoY.cjs");exports.DEFAULT_OPTIONS=e.DEFAULT_OPTIONS;exports.Image=e.Image;exports.RichTextImage=e.RichTextImage;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("./index-C4WLt4NA.cjs");const e=require("./index-czmcFIW7.cjs");require("./clsx-DSAWW32g.cjs");exports.DEFAULT_OPTIONS=e.DEFAULT_OPTIONS;exports.Image=e.Image;exports.RichTextImage=e.RichTextImage;
package/lib/Image.js CHANGED
@@ -1,6 +1,6 @@
1
- import "./index-BVRHx_ha.js";
2
- import { a4 as r, y as t, a5 as i } from "./index-CDFAs4RT.js";
3
- import "./clsx-OumA9x-8.js";
1
+ import "./index-D0EmqTpe.js";
2
+ import { a4 as r, y as t, a5 as i } from "./index-B2a7NqnN.js";
3
+ import "./clsx-Bg-2aTKh.js";
4
4
  export {
5
5
  r as DEFAULT_OPTIONS,
6
6
  t as Image,