reactjs-tiptap-editor 1.0.24 → 1.0.25

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 (123) hide show
  1. package/lib/{ActionMenuButton-HYlhmRvw.js → ActionMenuButton-8cTG45Ft.js} +1 -1
  2. package/lib/{ActionMenuButton-B8NhVw5m.cjs → ActionMenuButton-CXeFhner.cjs} +1 -1
  3. package/lib/Attachment.cjs +1 -1
  4. package/lib/Attachment.js +1 -1
  5. package/lib/Blockquote.cjs +1 -1
  6. package/lib/Blockquote.js +1 -1
  7. package/lib/Bold.cjs +1 -1
  8. package/lib/Bold.js +1 -1
  9. package/lib/BulletList.cjs +1 -1
  10. package/lib/BulletList.js +1 -1
  11. package/lib/{Callout-B-S2f0Qo.cjs → Callout-DWOMZPiP.cjs} +1 -1
  12. package/lib/{Callout-CF7Y9yJ7.js → Callout-ZlPQrMEt.js} +1 -1
  13. package/lib/Callout.cjs +1 -1
  14. package/lib/Callout.js +2 -2
  15. package/lib/Clear.cjs +1 -1
  16. package/lib/Clear.js +1 -1
  17. package/lib/Code.cjs +1 -1
  18. package/lib/Code.js +1 -1
  19. package/lib/CodeBlock.cjs +1 -1
  20. package/lib/CodeBlock.js +1 -1
  21. package/lib/CodeView.cjs +1 -1
  22. package/lib/CodeView.js +1 -1
  23. package/lib/Color.cjs +1 -1
  24. package/lib/Color.js +2 -2
  25. package/lib/Column.cjs +1 -1
  26. package/lib/Column.js +1 -1
  27. package/lib/{Drawer-CaXVhxo4.js → Drawer-C-EO1uoK.js} +1 -1
  28. package/lib/{Drawer-Was4hxYH.cjs → Drawer-TJY4NuHx.cjs} +1 -1
  29. package/lib/Drawer.cjs +1 -1
  30. package/lib/Drawer.js +2 -2
  31. package/lib/Emoji.cjs +1 -1
  32. package/lib/Emoji.js +2 -2
  33. package/lib/Excalidraw.cjs +1 -1
  34. package/lib/Excalidraw.js +1 -1
  35. package/lib/ExportPdf.cjs +1 -1
  36. package/lib/ExportPdf.js +1 -1
  37. package/lib/ExportWord.cjs +1 -1
  38. package/lib/ExportWord.js +1 -1
  39. package/lib/FontFamily.cjs +1 -1
  40. package/lib/FontFamily.js +3 -3
  41. package/lib/FontSize.cjs +1 -1
  42. package/lib/FontSize.js +3 -3
  43. package/lib/Heading.cjs +1 -1
  44. package/lib/Heading.js +8 -8
  45. package/lib/Highlight.cjs +1 -1
  46. package/lib/Highlight.js +38 -32
  47. package/lib/History.cjs +1 -1
  48. package/lib/History.js +1 -1
  49. package/lib/HorizontalRule.cjs +1 -1
  50. package/lib/HorizontalRule.js +1 -1
  51. package/lib/{Iframe-BI0sq6pd.cjs → Iframe-5zx43DL4.cjs} +1 -1
  52. package/lib/{Iframe-Bp986fj0.js → Iframe-CGb6-2LD.js} +1 -1
  53. package/lib/Iframe.cjs +1 -1
  54. package/lib/Iframe.js +1 -1
  55. package/lib/Image.cjs +1 -1
  56. package/lib/Image.js +1 -1
  57. package/lib/ImageGif.cjs +1 -1
  58. package/lib/ImageGif.js +2 -2
  59. package/lib/ImportWord.cjs +1 -1
  60. package/lib/ImportWord.js +1 -1
  61. package/lib/{Indent-E6B8DkyN.js → Indent-CdMYsDNS.js} +1 -1
  62. package/lib/{Indent-FvM52kjA.cjs → Indent-DuwV8s1t.cjs} +1 -1
  63. package/lib/Indent.cjs +1 -1
  64. package/lib/Indent.js +1 -1
  65. package/lib/Italic.cjs +1 -1
  66. package/lib/Italic.js +1 -1
  67. package/lib/{Katex-pzwyyiFJ.js → Katex-CCP_ZQz2.js} +2 -2
  68. package/lib/{Katex-DP6EjdKz.cjs → Katex-D9FP7EUE.cjs} +1 -1
  69. package/lib/Katex.cjs +1 -1
  70. package/lib/Katex.js +1 -1
  71. package/lib/LineHeight.cjs +1 -1
  72. package/lib/LineHeight.js +2 -2
  73. package/lib/Link.cjs +1 -1
  74. package/lib/Link.js +1 -1
  75. package/lib/{LinkEditBlock-OjN4F2rM.js → LinkEditBlock-B1m-TVMu.js} +2 -2
  76. package/lib/{LinkEditBlock-Cmkmp2fW.cjs → LinkEditBlock-DQ8-iufJ.cjs} +1 -1
  77. package/lib/Mermaid.cjs +1 -1
  78. package/lib/Mermaid.js +2 -2
  79. package/lib/MoreMark.cjs +1 -1
  80. package/lib/MoreMark.js +2 -2
  81. package/lib/OrderedList.cjs +1 -1
  82. package/lib/OrderedList.js +1 -1
  83. package/lib/SearchAndReplace.cjs +1 -1
  84. package/lib/SearchAndReplace.js +2 -2
  85. package/lib/SlashCommand.cjs +1 -1
  86. package/lib/SlashCommand.js +2 -2
  87. package/lib/{SlashCommandNodeView-DarAytvt.cjs → SlashCommandNodeView-DNixmQGa.cjs} +1 -1
  88. package/lib/{SlashCommandNodeView-o323V8li.js → SlashCommandNodeView-Dt6n1SP9.js} +1 -1
  89. package/lib/Strike.cjs +1 -1
  90. package/lib/Strike.js +1 -1
  91. package/lib/{Table-Clnz-i4l.cjs → Table-C5JxBXef.cjs} +1 -1
  92. package/lib/{Table-CC9uNHPL.js → Table-DdEgaUwa.js} +2 -2
  93. package/lib/Table.cjs +1 -1
  94. package/lib/Table.js +1 -1
  95. package/lib/TaskList.cjs +1 -1
  96. package/lib/TaskList.js +1 -1
  97. package/lib/TextAlign.cjs +1 -1
  98. package/lib/TextAlign.js +2 -2
  99. package/lib/TextDirection.cjs +1 -1
  100. package/lib/TextDirection.js +2 -2
  101. package/lib/TextUnderline.cjs +1 -1
  102. package/lib/TextUnderline.js +1 -1
  103. package/lib/{Twitter-0kmrijjL.cjs → Twitter--tfifMt1.cjs} +1 -1
  104. package/lib/{Twitter-BVnXL8we.js → Twitter-Dnz9qyW0.js} +2 -2
  105. package/lib/Twitter.cjs +1 -1
  106. package/lib/Twitter.js +1 -1
  107. package/lib/Video.cjs +1 -1
  108. package/lib/Video.js +1 -1
  109. package/lib/bubble.cjs +1 -1
  110. package/lib/bubble.js +14 -14
  111. package/lib/{dropdown-menu-BW2M6saA.js → dropdown-menu-ROihzXsP.js} +1 -1
  112. package/lib/{dropdown-menu-BIGvxqiu.cjs → dropdown-menu-yQ-sQ1k4.cjs} +1 -1
  113. package/lib/{index-deubsx3z.cjs → index-Gi752TMk.cjs} +1 -1
  114. package/lib/{index-BrsJsbds.js → index-X6WZUM9O.js} +15 -15
  115. package/lib/index.cjs +1 -1
  116. package/lib/index.js +1 -1
  117. package/lib/{popover-DoSfJsFS.cjs → popover-BPzkMuyi.cjs} +1 -1
  118. package/lib/{popover-BIVHT1W9.js → popover-BfWFqCIs.js} +1 -1
  119. package/lib/{separator-b-qOPJmp.js → separator-CBPrZizK.js} +2 -2
  120. package/lib/{separator-SRbPfmGa.cjs → separator-DpaS43Gt.cjs} +1 -1
  121. package/lib/{textarea-CpxXPky_.js → textarea-Bl64keav.js} +1 -1
  122. package/lib/{textarea-DbGw9oCU.cjs → textarea-wvARZKyA.cjs} +1 -1
  123. package/package.json +1 -1
package/lib/Emoji.js CHANGED
@@ -7,11 +7,11 @@ import { c as L } from "./clsx-0OU6n9va.js";
7
7
  import { forwardRef as O, useRef as K, useState as w, useEffect as _, useImperativeHandle as V } from "react";
8
8
  import $ from "scroll-into-view-if-needed";
9
9
  import { u as U } from "./index-oj858lQO.js";
10
- import { c as b, u as W, e as Z, A as Y } from "./index-BrsJsbds.js";
10
+ import { c as b, u as W, e as Z, A as Y } from "./index-X6WZUM9O.js";
11
11
  import "./theme.js";
12
12
  import { EmojiPicker as d } from "frimousse";
13
13
  import { SearchIcon as J, LoaderIcon as X } from "lucide-react";
14
- import { P as Q, a as ee, b as ae } from "./popover-BIVHT1W9.js";
14
+ import { P as Q, a as ee, b as ae } from "./popover-BfWFqCIs.js";
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;
16
16
  var F = /* @__PURE__ */ new Map();
17
17
  function se(e) {
@@ -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-Bcj8cyOO.cjs"),y=require("./clsx-D6gYQn3o.cjs"),t=require("react/jsx-runtime"),F=require("re-resizable"),r=require("react"),a=require("./index-deubsx3z.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-Bcj8cyOO.cjs"),y=require("./clsx-D6gYQn3o.cjs"),t=require("react/jsx-runtime"),F=require("re-resizable"),r=require("react"),a=require("./index-Gi752TMk.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
@@ -3,7 +3,7 @@ import { N as U, c as R, a as j } from "./clsx-0OU6n9va.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 q } from "react";
6
- import { F as G, q as Y, A as S, h as J, u as K, m as Q, d as ee, E as te, G as re, D as ae, r as ne, s as ie, v as se, w as oe, B as le } from "./index-BrsJsbds.js";
6
+ import { F as G, q as Y, A as S, h as J, u as K, m as Q, d as ee, E as te, G as re, D as ae, r as ne, s as ie, v as se, w as oe, B as le } from "./index-X6WZUM9O.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-Bcj8cyOO.cjs"),l=require("react/jsx-runtime"),m=require("./index-deubsx3z.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-Bcj8cyOO.cjs"),l=require("react/jsx-runtime"),m=require("./index-Gi752TMk.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
1
  import { E as b } from "./index-BblvcbTH.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-BrsJsbds.js";
3
+ import { u as y, d as x, A as E } from "./index-X6WZUM9O.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-Bcj8cyOO.cjs"),u=require("docx"),n=require("prosemirror-docx"),i=require("react/jsx-runtime"),y=require("react"),a=require("./index-deubsx3z.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-Bcj8cyOO.cjs"),u=require("docx"),n=require("prosemirror-docx"),i=require("react/jsx-runtime"),y=require("react"),a=require("./index-Gi752TMk.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
@@ -3,7 +3,7 @@ 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-BrsJsbds.js";
6
+ import { u as E, d as g, A as k } from "./index-X6WZUM9O.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-BAb_UADw.cjs"),F=require("./index-CWw4s87s.cjs"),f=require("./index-deubsx3z.cjs"),e=require("react/jsx-runtime"),m=require("react"),x=require("./ActionMenuButton-B8NhVw5m.cjs");require("./theme.cjs");const d=require("./dropdown-menu-BIGvxqiu.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-BAb_UADw.cjs"),F=require("./index-CWw4s87s.cjs"),f=require("./index-Gi752TMk.cjs"),e=require("react/jsx-runtime"),m=require("react"),x=require("./ActionMenuButton-CXeFhner.cjs");require("./theme.cjs");const d=require("./dropdown-menu-yQ-sQ1k4.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
1
  import { F as p } from "./index-zw-Kd38i.js";
2
2
  import { u as F, D as y } from "./index-oj858lQO.js";
3
- import { u as h, e as v, f as A } from "./index-BrsJsbds.js";
3
+ import { u as h, e as v, f as A } from "./index-X6WZUM9O.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-HYlhmRvw.js";
6
+ import { A as L } from "./ActionMenuButton-8cTG45Ft.js";
7
7
  import "./theme.js";
8
- import { D as g, a as x, b, c as T, d as C } from "./dropdown-menu-BW2M6saA.js";
8
+ import { D as g, a as x, b, c as T, d as C } from "./dropdown-menu-ROihzXsP.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-Bcj8cyOO.cjs"),x=require("./index-CWw4s87s.cjs"),S=require("./index-deubsx3z.cjs"),o=require("react/jsx-runtime"),p=require("react"),h=require("./ActionMenuButton-B8NhVw5m.cjs");require("./theme.cjs");const l=require("./dropdown-menu-BIGvxqiu.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-Bcj8cyOO.cjs"),x=require("./index-CWw4s87s.cjs"),S=require("./index-Gi752TMk.cjs"),o=require("react/jsx-runtime"),p=require("react"),h=require("./ActionMenuButton-CXeFhner.cjs");require("./theme.cjs");const l=require("./dropdown-menu-yQ-sQ1k4.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
1
  import { E as m } from "./index-BblvcbTH.js";
2
2
  import { u as p, h as S } from "./index-oj858lQO.js";
3
- import { u as z, e as h, f as v } from "./index-BrsJsbds.js";
3
+ import { u as z, e as h, f as v } from "./index-X6WZUM9O.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 y } from "./ActionMenuButton-HYlhmRvw.js";
6
+ import { A as y } from "./ActionMenuButton-8cTG45Ft.js";
7
7
  import "./theme.js";
8
- import { D as F, a as M, b as g, c as w, d as T } from "./dropdown-menu-BW2M6saA.js";
8
+ import { D as F, a as M, b as g, c as w, d as T } from "./dropdown-menu-ROihzXsP.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-Bcj8cyOO.cjs"),M=require("./index-CWw4s87s.cjs"),s=require("react/jsx-runtime"),x=require("react"),b=require("./ActionMenuButton-B8NhVw5m.cjs"),v=require("./index-deubsx3z.cjs");require("./theme.cjs");const h=require("./dropdown-menu-BIGvxqiu.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-Bcj8cyOO.cjs"),M=require("./index-CWw4s87s.cjs"),s=require("react/jsx-runtime"),x=require("react"),v=require("./index-Gi752TMk.cjs"),b=require("./ActionMenuButton-CXeFhner.cjs");require("./theme.cjs");const h=require("./dropdown-menu-yQ-sQ1k4.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
@@ -2,10 +2,10 @@ import { N as f, t as m, m as A } from "./index-BblvcbTH.js";
2
2
  import { u as M, H } from "./index-oj858lQO.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 { A as x } from "./ActionMenuButton-HYlhmRvw.js";
6
- import { u as D, e as y, c as N, l as k } from "./index-BrsJsbds.js";
5
+ import { u as x, e as D, c as y, l as N } from "./index-X6WZUM9O.js";
6
+ import { A as k } from "./ActionMenuButton-8cTG45Ft.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-BW2M6saA.js";
8
+ import { D as L, a as C, b as T, c as I, e as K, d as P } from "./dropdown-menu-ROihzXsP.js";
9
9
  var R = f.create({
10
10
  name: "heading",
11
11
  addOptions() {
@@ -66,15 +66,15 @@ var R = f.create({
66
66
  }
67
67
  });
68
68
  function z() {
69
- const { t: e } = M(), t = D(S.name), {
69
+ const { t: e } = M(), t = x(S.name), {
70
70
  icon: a = void 0,
71
71
  tooltip: o = void 0,
72
72
  isActive: i = void 0,
73
73
  items: s = []
74
- } = (t == null ? void 0 : t.componentProps) ?? {}, { disabled: p, dataState: l } = y(i), r = b(() => (l == null ? void 0 : l.title) || e("editor.paragraph.tooltip"), [l]);
74
+ } = (t == null ? void 0 : t.componentProps) ?? {}, { disabled: p, dataState: l } = D(i), r = b(() => (l == null ? void 0 : l.title) || e("editor.paragraph.tooltip"), [l]);
75
75
  return t ? /* @__PURE__ */ g(L, { children: [
76
76
  /* @__PURE__ */ d(C, { asChild: !0, disabled: p, children: /* @__PURE__ */ d(
77
- x,
77
+ k,
78
78
  {
79
79
  disabled: p,
80
80
  icon: a,
@@ -89,7 +89,7 @@ function z() {
89
89
  /* @__PURE__ */ d(
90
90
  "div",
91
91
  {
92
- className: N("richtext-ml-1 richtext-h-full", {
92
+ className: y("richtext-ml-1 richtext-h-full", {
93
93
  "": n.level === "Paragraph",
94
94
  "heading-1": n.level === 1,
95
95
  "heading-2": n.level === 2,
@@ -101,7 +101,7 @@ function z() {
101
101
  children: n.title
102
102
  }
103
103
  ),
104
- !!((u = n == null ? void 0 : n.shortcutKeys) != null && u.length) && /* @__PURE__ */ d(K, { className: "richtext-pl-4", children: (h = n == null ? void 0 : n.shortcutKeys) == null ? void 0 : h.map((v) => k(v)).join(" ") })
104
+ !!((u = n == null ? void 0 : n.shortcutKeys) != null && u.length) && /* @__PURE__ */ d(K, { className: "richtext-pl-4", children: (h = n == null ? void 0 : n.shortcutKeys) == null ? void 0 : h.map((v) => N(v)).join(" ") })
105
105
  ] }),
106
106
  n.level === "Paragraph" && /* @__PURE__ */ d(P, {})
107
107
  ] }, `heading-k-${c}`);
package/lib/Highlight.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("./index-Bcj8cyOO.cjs"),r=require("react/jsx-runtime"),x=require("react"),h=require("./index-deubsx3z.cjs"),C=require("./separator-SRbPfmGa.cjs");require("./theme.cjs");var m=/(?:^|\s)(==(?!\s+==)((?:[^=]+))==(?!\s+==))$/,L=/(?:^|\s)(==(?!\s+==)((?:[^=]+))==(?!\s+==))/g,k=l.Mark.create({name:"highlight",addOptions(){return{multicolor:!1,HTMLAttributes:{}}},addAttributes(){return this.options.multicolor?{color:{default:null,parseHTML:t=>t.getAttribute("data-color")||l.getStyleProperty(t,"background-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]},renderMarkdown:(t,e)=>`==${e.renderChildren(t)}==`,parseMarkdown:(t,e)=>e.applyMark("highlight",e.parseInline(t.tokens||[])),markdownTokenizer:{name:"highlight",level:"inline",start:t=>t.indexOf("=="),tokenize(t,e,s){const i=/^(==)([^=]+)(==)/.exec(t);if(i){const n=i[2].trim(),a=s.inlineTokens(n);return{type:"highlight",raw:i[0],text:n,tokens:a}}}},addCommands(){return{setHighlight:t=>({commands:e})=>e.setMark(this.name,t),toggleHighlight:t=>({commands:e})=>e.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 v({fill:t}){return r.jsx("svg",{height:"18px",version:"1.1",viewBox:"0 0 256 256",width:"18px",xmlns:"http://www.w3.org/2000/svg",children:r.jsx("g",{fill:"none",fillRule:"evenodd",stroke:"none",strokeWidth:1,children:r.jsxs("g",{id:"icon/背景颜色",children:[r.jsx("g",{fill:"currentColor",children:r.jsxs("g",{transform:"translate(119.502295, 137.878331) rotate(-135.000000) translate(-119.502295, -137.878331) translate(48.002295, 31.757731)",children:[r.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"}),r.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"}),r.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"})]})}),r.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 H(){const t=h.useButtonProps(g.name),{tooltip:e=void 0,isActive:s=void 0,defaultColor:o=void 0,colors:i,action:n,shortcutKeys:a}=(t==null?void 0:t.componentProps)??{},{editorDisabled:u}=h.useActive(s),[c,p]=x.useState(o);function f(d){u||n&&(n==null||n(d),p(d))}return t?r.jsx(C.ColorPicker,{colors:i,disabled:u,highlight:!0,onChange:f,value:c,children:r.jsx(h.ActionButton,{disabled:u,tooltip:e,shortcutKeys:a,children:r.jsxs("span",{className:"richtext-flex richtext-items-center richtext-justify-center richtext-gap-[4px] richtext-text-sm",children:[r.jsx(v,{fill:c}),r.jsx(h.IconComponent,{className:"!richtext-h-3 !richtext-w-3 richtext-text-zinc-500",name:"MenuDown"})]})})}):r.jsx(r.Fragment,{})}const g=k.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:e,t:s,extension:o})=>({componentProps:{action:i=>{if(typeof i=="string"){e.storage.highlight.currentColor=i,e.chain().focus().setHighlight({color:i}).run();return}e.chain().focus().unsetHighlight().run()},isActive:()=>e.isActive("highlight")||!1,disabled:!1,shortcutKeys:o.options.shortcutKeys??["⇧","mod","H"],tooltip:s("editor.highlight.tooltip"),defaultColor:o.options.defaultColor}})}},addKeyboardShortcuts(){var t;return{...(t=this.parent)==null?void 0:t.call(this),"Mod-Shift-h":()=>{const e=this.storage.currentColor||this.options.defaultColor;if(!e){const{color:o}=this.editor.getAttributes("highlight");return o?this.editor.chain().focus().unsetHighlight().run():!1}return this.editor.isActive("highlight",{color:e})?this.editor.chain().focus().unsetHighlight().run():this.editor.chain().focus().setHighlight({color:e}).run()}}}});exports.Highlight=g;exports.RichTextHighlight=H;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("./index-Bcj8cyOO.cjs"),r=require("react/jsx-runtime"),p=require("react"),h=require("./index-Gi752TMk.cjs"),m=require("./separator-DpaS43Gt.cjs");require("./theme.cjs");var L=/(?:^|\s)(==(?!\s+==)((?:[^=]+))==(?!\s+==))$/,k=/(?:^|\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")||l.getStyleProperty(t,"background-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]},renderMarkdown:(t,e)=>`==${e.renderChildren(t)}==`,parseMarkdown:(t,e)=>e.applyMark("highlight",e.parseInline(t.tokens||[])),markdownTokenizer:{name:"highlight",level:"inline",start:t=>t.indexOf("=="),tokenize(t,e,s){const i=/^(==)([^=]+)(==)/.exec(t);if(i){const n=i[2].trim(),u=s.inlineTokens(n);return{type:"highlight",raw:i[0],text:n,tokens:u}}}},addCommands(){return{setHighlight:t=>({commands:e})=>e.setMark(this.name,t),toggleHighlight:t=>({commands:e})=>e.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:L,type:this.type})]},addPasteRules(){return[l.markPasteRule({find:k,type:this.type})]}});function M({fill:t}){return r.jsx("svg",{height:"18px",version:"1.1",viewBox:"0 0 256 256",width:"18px",xmlns:"http://www.w3.org/2000/svg",children:r.jsx("g",{fill:"none",fillRule:"evenodd",stroke:"none",strokeWidth:1,children:r.jsxs("g",{id:"icon/背景颜色",children:[r.jsx("g",{fill:"currentColor",children:r.jsxs("g",{transform:"translate(119.502295, 137.878331) rotate(-135.000000) translate(-119.502295, -137.878331) translate(48.002295, 31.757731)",children:[r.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"}),r.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"}),r.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"})]})}),r.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(f.name),{tooltip:e=void 0,isActive:s=void 0,defaultColor:o=void 0,colors:i,action:n,shortcutKeys:u}=(t==null?void 0:t.componentProps)??{},{disabled:c,dataState:a}=h.useActive(s),[x,g]=p.useState(o);p.useEffect(()=>{g(a)},[a]);function C(d){c||n&&(n==null||n(d),g(d))}return t?r.jsx(m.ColorPicker,{colors:i,disabled:c,highlight:!0,onChange:C,value:x,children:r.jsx(h.ActionButton,{disabled:c,tooltip:e,shortcutKeys:u,children:r.jsxs("span",{className:"richtext-flex richtext-items-center richtext-justify-center richtext-gap-[4px] richtext-text-sm",children:[r.jsx(M,{fill:a}),r.jsx(h.IconComponent,{className:"!richtext-h-3 !richtext-w-3 richtext-text-zinc-500",name:"MenuDown"})]})})}):r.jsx(r.Fragment,{})}const f=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:e,t:s,extension:o})=>({componentProps:{action:i=>{if(typeof i=="string"){e.storage.highlight.currentColor=i,e.chain().focus().setHighlight({color:i}).run();return}e.chain().focus().unsetHighlight().run()},isActive:()=>{const{color:i}=e.getAttributes("highlight");return i},disabled:!1,shortcutKeys:o.options.shortcutKeys??["⇧","mod","H"],tooltip:s("editor.highlight.tooltip"),defaultColor:o.options.defaultColor}})}},addKeyboardShortcuts(){var t;return{...(t=this.parent)==null?void 0:t.call(this),"Mod-Shift-h":()=>{const e=this.storage.currentColor||this.options.defaultColor;if(!e){const{color:o}=this.editor.getAttributes("highlight");return o?this.editor.chain().focus().unsetHighlight().run():!1}return this.editor.isActive("highlight",{color:e})?this.editor.chain().focus().unsetHighlight().run():this.editor.chain().focus().setHighlight({color:e}).run()}}}});exports.Highlight=f;exports.RichTextHighlight=v;
package/lib/Highlight.js CHANGED
@@ -1,10 +1,10 @@
1
- import { M as p, h as f, j as m, m as C, g as L } from "./index-BblvcbTH.js";
2
- import { jsx as r, jsxs as a, Fragment as x } from "react/jsx-runtime";
3
- import { useState as k } from "react";
4
- import { u as M, e as v, A as H, I as y } from "./index-BrsJsbds.js";
5
- import { C as A } from "./separator-b-qOPJmp.js";
1
+ import { M as f, h as m, j as C, m as L, g as x } from "./index-BblvcbTH.js";
2
+ import { jsx as r, jsxs as u, Fragment as k } from "react/jsx-runtime";
3
+ import { useState as M, useEffect as v } from "react";
4
+ import { u as H, e as y, A, I as b } from "./index-X6WZUM9O.js";
5
+ import { C as w } from "./separator-CBPrZizK.js";
6
6
  import "./theme.js";
7
- var b = /(?:^|\s)(==(?!\s+==)((?:[^=]+))==(?!\s+==))$/, w = /(?:^|\s)(==(?!\s+==)((?:[^=]+))==(?!\s+==))/g, R = p.create({
7
+ var R = /(?:^|\s)(==(?!\s+==)((?:[^=]+))==(?!\s+==))$/, T = /(?:^|\s)(==(?!\s+==)((?:[^=]+))==(?!\s+==))/g, S = f.create({
8
8
  name: "highlight",
9
9
  addOptions() {
10
10
  return {
@@ -20,7 +20,7 @@ var b = /(?:^|\s)(==(?!\s+==)((?:[^=]+))==(?!\s+==))$/, w = /(?:^|\s)(==(?!\s+==
20
20
  // round-trips. Otherwise parse the raw inline `style` attribute so
21
21
  // the original color format (e.g. `#rrggbb`) is preserved instead of
22
22
  // the canonicalized `rgb(...)` value from `element.style.backgroundColor`.
23
- parseHTML: (t) => t.getAttribute("data-color") || L(t, "background-color") || t.style.backgroundColor,
23
+ parseHTML: (t) => t.getAttribute("data-color") || x(t, "background-color") || t.style.backgroundColor,
24
24
  renderHTML: (t) => t.color ? {
25
25
  "data-color": t.color,
26
26
  style: `background-color: ${t.color}; color: inherit`
@@ -36,7 +36,7 @@ var b = /(?:^|\s)(==(?!\s+==)((?:[^=]+))==(?!\s+==))$/, w = /(?:^|\s)(==(?!\s+==
36
36
  ];
37
37
  },
38
38
  renderHTML({ HTMLAttributes: t }) {
39
- return ["mark", C(this.options.HTMLAttributes, t), 0];
39
+ return ["mark", L(this.options.HTMLAttributes, t), 0];
40
40
  },
41
41
  renderMarkdown: (t, e) => `==${e.renderChildren(t)}==`,
42
42
  parseMarkdown: (t, e) => e.applyMark("highlight", e.parseInline(t.tokens || [])),
@@ -71,22 +71,22 @@ var b = /(?:^|\s)(==(?!\s+==)((?:[^=]+))==(?!\s+==))$/, w = /(?:^|\s)(==(?!\s+==
71
71
  },
72
72
  addInputRules() {
73
73
  return [
74
- m({
75
- find: b,
74
+ C({
75
+ find: R,
76
76
  type: this.type
77
77
  })
78
78
  ];
79
79
  },
80
80
  addPasteRules() {
81
81
  return [
82
- f({
83
- find: w,
82
+ m({
83
+ find: T,
84
84
  type: this.type
85
85
  })
86
86
  ];
87
87
  }
88
88
  });
89
- function T({ fill: t }) {
89
+ function I({ fill: t }) {
90
90
  return /* @__PURE__ */ r(
91
91
  "svg",
92
92
  {
@@ -95,8 +95,8 @@ function T({ fill: t }) {
95
95
  viewBox: "0 0 256 256",
96
96
  width: "18px",
97
97
  xmlns: "http://www.w3.org/2000/svg",
98
- children: /* @__PURE__ */ r("g", { fill: "none", fillRule: "evenodd", stroke: "none", strokeWidth: 1, children: /* @__PURE__ */ a("g", { id: "icon/背景颜色", children: [
99
- /* @__PURE__ */ r("g", { fill: "currentColor", children: /* @__PURE__ */ a("g", { transform: "translate(119.502295, 137.878331) rotate(-135.000000) translate(-119.502295, -137.878331) translate(48.002295, 31.757731)", children: [
98
+ children: /* @__PURE__ */ r("g", { fill: "none", fillRule: "evenodd", stroke: "none", strokeWidth: 1, children: /* @__PURE__ */ u("g", { id: "icon/背景颜色", children: [
99
+ /* @__PURE__ */ r("g", { fill: "currentColor", children: /* @__PURE__ */ u("g", { transform: "translate(119.502295, 137.878331) rotate(-135.000000) translate(-119.502295, -137.878331) translate(48.002295, 31.757731)", children: [
100
100
  /* @__PURE__ */ r(
101
101
  "path",
102
102
  {
@@ -131,36 +131,39 @@ function T({ fill: t }) {
131
131
  }
132
132
  );
133
133
  }
134
- function $() {
135
- const t = M(S.name), {
134
+ function E() {
135
+ const t = H(P.name), {
136
136
  tooltip: e = void 0,
137
137
  isActive: s = void 0,
138
138
  defaultColor: o = void 0,
139
139
  colors: i,
140
140
  action: n,
141
141
  shortcutKeys: l
142
- } = (t == null ? void 0 : t.componentProps) ?? {}, { editorDisabled: h } = v(s), [u, d] = k(o);
143
- function g(c) {
144
- h || n && (n == null || n(c), d(c));
142
+ } = (t == null ? void 0 : t.componentProps) ?? {}, { disabled: h, dataState: a } = y(s), [g, c] = M(o);
143
+ v(() => {
144
+ c(a);
145
+ }, [a]);
146
+ function p(d) {
147
+ h || n && (n == null || n(d), c(d));
145
148
  }
146
149
  return t ? /* @__PURE__ */ r(
147
- A,
150
+ w,
148
151
  {
149
152
  colors: i,
150
153
  disabled: h,
151
154
  highlight: !0,
152
- onChange: g,
153
- value: u,
155
+ onChange: p,
156
+ value: g,
154
157
  children: /* @__PURE__ */ r(
155
- H,
158
+ A,
156
159
  {
157
160
  disabled: h,
158
161
  tooltip: e,
159
162
  shortcutKeys: l,
160
- children: /* @__PURE__ */ a("span", { className: "richtext-flex richtext-items-center richtext-justify-center richtext-gap-[4px] richtext-text-sm", children: [
161
- /* @__PURE__ */ r(T, { fill: u }),
163
+ children: /* @__PURE__ */ u("span", { className: "richtext-flex richtext-items-center richtext-justify-center richtext-gap-[4px] richtext-text-sm", children: [
164
+ /* @__PURE__ */ r(I, { fill: a }),
162
165
  /* @__PURE__ */ r(
163
- y,
166
+ b,
164
167
  {
165
168
  className: "!richtext-h-3 !richtext-w-3 richtext-text-zinc-500",
166
169
  name: "MenuDown"
@@ -170,9 +173,9 @@ function $() {
170
173
  }
171
174
  )
172
175
  }
173
- ) : /* @__PURE__ */ r(x, {});
176
+ ) : /* @__PURE__ */ r(k, {});
174
177
  }
175
- const S = /* @__PURE__ */ R.extend({
178
+ const P = /* @__PURE__ */ S.extend({
176
179
  addStorage() {
177
180
  return {
178
181
  // Stores the currently selected highlight color; undefined indicates "No Fill".
@@ -194,7 +197,10 @@ const S = /* @__PURE__ */ R.extend({
194
197
  }
195
198
  e.chain().focus().unsetHighlight().run();
196
199
  },
197
- isActive: () => e.isActive("highlight") || !1,
200
+ isActive: () => {
201
+ const { color: i } = e.getAttributes("highlight");
202
+ return i;
203
+ },
198
204
  disabled: !1,
199
205
  shortcutKeys: o.options.shortcutKeys ?? ["⇧", "mod", "H"],
200
206
  tooltip: s("editor.highlight.tooltip"),
@@ -221,6 +227,6 @@ const S = /* @__PURE__ */ R.extend({
221
227
  }
222
228
  });
223
229
  export {
224
- S as Highlight,
225
- $ as RichTextHighlight
230
+ P as Highlight,
231
+ E as RichTextHighlight
226
232
  };
package/lib/History.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const h=require("./index-Bcj8cyOO.cjs"),C=require("@tiptap/pm/state"),S=require("@tiptap/pm/view"),z=require("./index-CUvjYuRp.cjs"),T=require("react/jsx-runtime"),x=require("./index-deubsx3z.cjs");require("react");require("./theme.cjs");function X(o={}){return new h.Plugin({view(e){return new q(e,o)}})}class q{constructor(e,t){var n;this.editorView=e,this.cursorPos=null,this.element=null,this.timeout=-1,this.width=(n=t.width)!==null&&n!==void 0?n:1,this.color=t.color===!1?void 0:t.color||"black",this.class=t.class,this.handlers=["dragover","dragend","drop","dragleave"].map(i=>{let r=s=>{this[i](s)};return e.dom.addEventListener(i,r),{name:i,handler:r}})}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,n,i=this.editorView.dom,r=i.getBoundingClientRect(),s=r.width/i.offsetWidth,l=r.height/i.offsetHeight;if(t){let d=e.nodeBefore,p=e.nodeAfter;if(d||p){let f=this.editorView.nodeDOM(this.cursorPos-(d?d.nodeSize:0));if(f){let g=f.getBoundingClientRect(),P=d?g.bottom:g.top;d&&p&&(P=(P+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2);let E=this.width/2*l;n={left:g.left,right:g.right,top:P-E,bottom:P+E}}}}if(!n){let d=this.editorView.coordsAtPos(this.cursorPos),p=this.width/2*s;n={left:d.left-p,right:d.left+p,top:d.top,bottom:d.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 c,u;if(!a||a==document.body&&getComputedStyle(a).position=="static")c=-pageXOffset,u=-pageYOffset;else{let d=a.getBoundingClientRect(),p=d.width/a.offsetWidth,f=d.height/a.offsetHeight;c=d.left-a.scrollLeft*p,u=d.top-a.scrollTop*f}this.element.style.left=(n.left-c)/s+"px",this.element.style.top=(n.top-u)/l+"px",this.element.style.width=(n.right-n.left)/s+"px",this.element.style.height=(n.bottom-n.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}),n=t&&t.inside>=0&&this.editorView.state.doc.nodeAt(t.inside),i=n&&n.type.spec.disableDropCursor,r=typeof i=="function"?i(this.editorView,t,e):i;if(t&&!r){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 m extends h.Selection{constructor(e){super(e,e)}map(e,t){let n=e.resolve(t.map(this.head));return m.valid(n)?new m(n):h.Selection.near(n)}content(){return h.Slice.empty}eq(e){return e instanceof m&&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 m(e.resolve(t.pos))}getBookmark(){return new k(this.anchor)}static valid(e){let t=e.parent;if(t.inlineContent||!Z(e)||!J(e))return!1;let n=t.type.spec.allowGapCursor;if(n!=null)return n;let i=t.contentMatchAt(e.index()).defaultType;return i&&i.isTextblock}static findGapCursorFrom(e,t,n=!1){e:for(;;){if(!n&&m.valid(e))return e;let i=e.pos,r=null;for(let s=e.depth;;s--){let l=e.node(s);if(t>0?e.indexAfter(s)<l.childCount:e.index(s)>0){r=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(m.valid(a))return a}for(;;){let s=t>0?r.firstChild:r.lastChild;if(!s){if(r.isAtom&&!r.isText&&!h.NodeSelection.isSelectable(r)){e=e.doc.resolve(i+r.nodeSize*t),n=!1;continue e}break}r=s,i+=t;let l=e.doc.resolve(i);if(m.valid(l))return l}return null}}}m.prototype.visible=!1;m.findFrom=m.findGapCursorFrom;h.Selection.jsonID("gapcursor",m);class k{constructor(e){this.pos=e}map(e){return new k(e.map(this.pos))}resolve(e){let t=e.resolve(this.pos);return m.valid(t)?new m(t):h.Selection.near(t)}}function H(o){return o.isAtom||o.spec.isolating||o.spec.createGapCursor}function Z(o){for(let e=o.depth;e>=0;e--){let t=o.index(e),n=o.node(e);if(t==0){if(n.type.spec.isolating)return!0;continue}for(let i=n.child(t-1);;i=i.lastChild){if(i.childCount==0&&!i.inlineContent||H(i.type))return!0;if(i.inlineContent)return!1}}return!0}function J(o){for(let e=o.depth;e>=0;e--){let t=o.indexAfter(e),n=o.node(e);if(t==n.childCount){if(n.type.spec.isolating)return!0;continue}for(let i=n.child(t);;i=i.firstChild){if(i.childCount==0&&!i.inlineContent||H(i.type))return!0;if(i.inlineContent)return!1}}return!0}function Q(){return new h.Plugin({props:{decorations:ne,createSelectionBetween(o,e,t){return e.pos==t.pos&&m.valid(t)?new m(t):null},handleClick:ee,handleKeyDown:$,handleDOMEvents:{beforeinput:te}}})}const $=z.keydownHandler({ArrowLeft:I("horiz",-1),ArrowRight:I("horiz",1),ArrowUp:I("vert",-1),ArrowDown:I("vert",1)});function I(o,e){const t=o=="vert"?e>0?"down":"up":e>0?"right":"left";return function(n,i,r){let s=n.selection,l=e>0?s.$to:s.$from,a=s.empty;if(s instanceof h.TextSelection){if(!r.endOfTextblock(t)||l.depth==0)return!1;a=!1,l=n.doc.resolve(e>0?l.after():l.before())}let c=m.findGapCursorFrom(l,e,a);return c?(i&&i(n.tr.setSelection(new m(c))),!0):!1}}function ee(o,e,t){if(!o||!o.editable)return!1;let n=o.state.doc.resolve(e);if(!m.valid(n))return!1;let i=o.posAtCoords({left:t.clientX,top:t.clientY});return i&&i.inside>-1&&h.NodeSelection.isSelectable(o.state.doc.nodeAt(i.inside))?!1:(o.dispatch(o.state.tr.setSelection(new m(n))),!0)}function te(o,e){if(e.inputType!="insertCompositionText"||!(o.state.selection instanceof m))return!1;let{$from:t}=o.state.selection,n=t.parent.contentMatchAt(t.index()).findWrapping(o.state.schema.nodes.text);if(!n)return!1;let i=h.Fragment.empty;for(let s=n.length-1;s>=0;s--)i=h.Fragment.from(n[s].createAndFill(null,i));let r=o.state.tr.replace(t.pos,t.pos,new h.Slice(i,0,0));return r.setSelection(h.TextSelection.near(r.doc.resolve(t.pos+1))),o.dispatch(r),!1}function ne(o){if(!(o.selection instanceof m))return null;let e=document.createElement("div");return e.className="ProseMirror-gapcursor",z.DecorationSet.create(o.doc,[z.Decoration.widget(o.selection.head,e,{key:"gapcursor"})])}var R=200,v=function(){};v.prototype.append=function(e){return e.length?(e=v.from(e),!this.length&&e||e.length<R&&this.leafAppend(e)||this.length<R&&e.leafPrepend(this)||this.appendInner(e)):this};v.prototype.prepend=function(e){return e.length?v.from(e).append(this):this};v.prototype.appendInner=function(e){return new oe(this,e)};v.prototype.slice=function(e,t){return e===void 0&&(e=0),t===void 0&&(t=this.length),e>=t?v.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,t))};v.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)};v.prototype.forEach=function(e,t,n){t===void 0&&(t=0),n===void 0&&(n=this.length),t<=n?this.forEachInner(e,t,n,0):this.forEachInvertedInner(e,t,n,0)};v.prototype.map=function(e,t,n){t===void 0&&(t=0),n===void 0&&(n=this.length);var i=[];return this.forEach(function(r,s){return i.push(e(r,s))},t,n),i};v.from=function(e){return e instanceof v?e:e&&e.length?new j(e):v.empty};var j=(function(o){function e(n){o.call(this),this.values=n}o&&(e.__proto__=o),e.prototype=Object.create(o&&o.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,r){return i==0&&r==this.length?this:new e(this.values.slice(i,r))},e.prototype.getInner=function(i){return this.values[i]},e.prototype.forEachInner=function(i,r,s,l){for(var a=r;a<s;a++)if(i(this.values[a],l+a)===!1)return!1},e.prototype.forEachInvertedInner=function(i,r,s,l){for(var a=r-1;a>=s;a--)if(i(this.values[a],l+a)===!1)return!1},e.prototype.leafAppend=function(i){if(this.length+i.length<=R)return new e(this.values.concat(i.flatten()))},e.prototype.leafPrepend=function(i){if(this.length+i.length<=R)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})(v);v.empty=new j([]);var oe=(function(o){function e(t,n){o.call(this),this.left=t,this.right=n,this.length=t.length+n.length,this.depth=Math.max(t.depth,n.depth)+1}return o&&(e.__proto__=o),e.prototype=Object.create(o&&o.prototype),e.prototype.constructor=e,e.prototype.flatten=function(){return this.left.flatten().concat(this.right.flatten())},e.prototype.getInner=function(n){return n<this.left.length?this.left.get(n):this.right.get(n-this.left.length)},e.prototype.forEachInner=function(n,i,r,s){var l=this.left.length;if(i<l&&this.left.forEachInner(n,i,Math.min(r,l),s)===!1||r>l&&this.right.forEachInner(n,Math.max(i-l,0),Math.min(this.length,r)-l,s+l)===!1)return!1},e.prototype.forEachInvertedInner=function(n,i,r,s){var l=this.left.length;if(i>l&&this.right.forEachInvertedInner(n,i-l,Math.max(r,l)-l,s+l)===!1||r<l&&this.left.forEachInvertedInner(n,Math.min(i,l),r,s)===!1)return!1},e.prototype.sliceInner=function(n,i){if(n==0&&i==this.length)return this;var r=this.left.length;return i<=r?this.left.slice(n,i):n>=r?this.right.slice(n-r,i-r):this.left.slice(n,r).append(this.right.slice(0,i-r))},e.prototype.leafAppend=function(n){var i=this.right.leafAppend(n);if(i)return new e(this.left,i)},e.prototype.leafPrepend=function(n){var i=this.left.leafPrepend(n);if(i)return new e(i,this.right)},e.prototype.appendInner=function(n){return this.left.depth>=Math.max(this.right.depth,n.depth)+1?new e(this.left,new e(this.right,n)):new e(this,n)},e})(v);const ie=500;class y{constructor(e,t){this.items=e,this.eventCount=t}popEvent(e,t){if(this.eventCount==0)return null;let n=this.items.length;for(;;n--)if(this.items.get(n-1).selection){--n;break}let i,r;t&&(i=this.remapping(n,this.items.length),r=i.maps.length);let s=e.tr,l,a,c=[],u=[];return this.items.forEach((d,p)=>{if(!d.step){i||(i=this.remapping(n,p+1),r=i.maps.length),r--,u.push(d);return}if(i){u.push(new w(d.map));let f=d.step.map(i.slice(r)),g;f&&s.maybeStep(f).doc&&(g=s.mapping.maps[s.mapping.maps.length-1],c.push(new w(g,void 0,void 0,c.length+u.length))),r--,g&&i.appendMap(g,r)}else s.maybeStep(d.step);if(d.selection)return l=i?d.selection.map(i.slice(r)):d.selection,a=new y(this.items.slice(0,n).append(u.reverse().concat(c)),this.eventCount-1),!1},this.items.length,0),{remaining:a,transform:s,selection:l}}addTransform(e,t,n,i){let r=[],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 d=e.steps[u].invert(e.docs[u]),p=new w(e.mapping.maps[u],d,t),f;(f=a&&a.merge(p))&&(p=f,u?r.pop():l=l.slice(0,l.length-1)),r.push(p),t&&(s++,t=void 0),i||(a=p)}let c=s-n.depth;return c>se&&(l=re(l,c),s-=c),new y(l.append(r),s)}remapping(e,t){let n=new h.Mapping;return this.items.forEach((i,r)=>{let s=i.mirrorOffset!=null&&r-i.mirrorOffset>=e?n.maps.length-i.mirrorOffset:void 0;n.appendMap(i.map,s)},e,t),n}addMaps(e){return this.eventCount==0?this:new y(this.items.append(e.map(t=>new w(t))),this.eventCount)}rebased(e,t){if(!this.eventCount)return this;let n=[],i=Math.max(0,this.items.length-t),r=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 f=r.getMirror(--a);if(f==null)return;s=Math.min(s,f);let g=r.maps[f];if(p.step){let P=e.steps[f].invert(e.docs[f]),E=p.selection&&p.selection.map(r.slice(a+1,f));E&&l++,n.push(new w(g,P,E))}else n.push(new w(g))},i);let c=[];for(let p=t;p<s;p++)c.push(new w(r.maps[p]));let u=this.items.slice(0,i).append(c).append(n),d=new y(u,l);return d.emptyItemCount()>ie&&(d=d.compress(this.items.length-n.length)),d}emptyItemCount(){let e=0;return this.items.forEach(t=>{t.step||e++}),e}compress(e=this.items.length){let t=this.remapping(0,e),n=t.maps.length,i=[],r=0;return this.items.forEach((s,l)=>{if(l>=e)i.push(s),s.selection&&r++;else if(s.step){let a=s.step.map(t.slice(n)),c=a&&a.getMap();if(n--,c&&t.appendMap(c,n),a){let u=s.selection&&s.selection.map(t.slice(n));u&&r++;let d=new w(c.invert(),a,u),p,f=i.length-1;(p=i.length&&i[f].merge(d))?i[f]=p:i.push(d)}}else s.map&&n--},this.items.length,0),new y(v.from(i.reverse()),r)}}y.empty=new y(v.empty,0);function re(o,e){let t;return o.forEach((n,i)=>{if(n.selection&&e--==0)return t=i,!1}),o.slice(t)}class w{constructor(e,t,n,i){this.map=e,this.step=t,this.selection=n,this.mirrorOffset=i}merge(e){if(this.step&&e.step&&!e.selection){let t=e.step.merge(this.step);if(t)return new w(t.getMap().invert(),t,this.selection)}}}class b{constructor(e,t,n,i,r){this.done=e,this.undone=t,this.prevRanges=n,this.prevTime=i,this.prevComposition=r}}const se=20;function le(o,e,t,n){let i=t.getMeta(M),r;if(i)return i.historyState;t.getMeta(de)&&(o=new b(o.done,o.undone,null,0,-1));let s=t.getMeta("appendedTransaction");if(t.steps.length==0)return o;if(s&&s.getMeta(M))return s.getMeta(M).redo?new b(o.done.addTransform(t,void 0,n,O(e)),o.undone,B(t.mapping.maps),o.prevTime,o.prevComposition):new b(o.done,o.undone.addTransform(t,void 0,n,O(e)),null,o.prevTime,o.prevComposition);if(t.getMeta("addToHistory")!==!1&&!(s&&s.getMeta("addToHistory")===!1)){let l=t.getMeta("composition"),a=o.prevTime==0||!s&&o.prevComposition!=l&&(o.prevTime<(t.time||0)-n.newGroupDelay||!ae(t,o.prevRanges)),c=s?D(o.prevRanges,t.mapping):B(t.mapping.maps);return new b(o.done.addTransform(t,a?e.selection.getBookmark():void 0,n,O(e)),y.empty,c,t.time,l??o.prevComposition)}else return(r=t.getMeta("rebased"))?new b(o.done.rebased(t,r),o.undone.rebased(t,r),D(o.prevRanges,t.mapping),o.prevTime,o.prevComposition):new b(o.done.addMaps(t.mapping.maps),o.undone.addMaps(t.mapping.maps),D(o.prevRanges,t.mapping),o.prevTime,o.prevComposition)}function ae(o,e){if(!e)return!1;if(!o.docChanged)return!0;let t=!1;return o.mapping.maps[0].forEach((n,i)=>{for(let r=0;r<e.length;r+=2)n<=e[r+1]&&i>=e[r]&&(t=!0)}),t}function B(o){let e=[];for(let t=o.length-1;t>=0&&e.length==0;t--)o[t].forEach((n,i,r,s)=>e.push(r,s));return e}function D(o,e){if(!o)return null;let t=[];for(let n=0;n<o.length;n+=2){let i=e.map(o[n],1),r=e.map(o[n+1],-1);i<=r&&t.push(i,r)}return t}function ce(o,e,t){let n=O(e),i=M.get(e).spec.config,r=(t?o.undone:o.done).popEvent(e,n);if(!r)return null;let s=r.selection.resolve(r.transform.doc),l=(t?o.done:o.undone).addTransform(r.transform,e.selection.getBookmark(),i,n),a=new b(t?l:r.remaining,t?r.remaining:l,null,0,-1);return r.transform.setSelection(s).setMeta(M,{redo:t,historyState:a})}let N=!1,F=null;function O(o){let e=o.plugins;if(F!=e){N=!1,F=e;for(let t=0;t<e.length;t++)if(e[t].spec.historyPreserveItems){N=!0;break}}return N}const M=new h.PluginKey("history"),de=new h.PluginKey("closeHistory");function ue(o={}){return o={depth:o.depth||100,newGroupDelay:o.newGroupDelay||500},new h.Plugin({key:M,state:{init(){return new b(y.empty,y.empty,null,0,-1)},apply(e,t,n){return le(t,n,e,o)}},config:o,props:{handleDOMEvents:{beforeinput(e,t){let n=t.inputType,i=n=="historyUndo"?U:n=="historyRedo"?W:null;return!i||!e.editable?!1:(t.preventDefault(),i(e.state,e.dispatch))}}}})}function G(o,e){return(t,n)=>{let i=M.getState(t);if(!i||(o?i.undone:i.done).eventCount==0)return!1;if(n){let r=ce(i,t,o);r&&n(e?r.scrollIntoView():r)}return!0}}const U=G(!1,!0),W=G(!0,!0);h.Extension.create({name:"characterCount",addOptions(){return{limit:null,autoTrim:!0,mode:"textSize",textCounter:o=>o.length,wordCounter:o=>o.split(" ").filter(e=>e!=="").length}},addStorage(){return{characters:()=>0,words:()=>0}},onBeforeCreate(){this.storage.characters=o=>{const e=(o==null?void 0:o.node)||this.editor.state.doc;if(((o==null?void 0:o.mode)||this.options.mode)==="textSize"){const n=e.textBetween(0,e.content.size,void 0," ");return this.options.textCounter(n)}return e.nodeSize},this.storage.words=o=>{const e=(o==null?void 0:o.node)||this.editor.state.doc,t=e.textBetween(0,e.content.size," "," ");return this.options.wordCounter(t)}},addProseMirrorPlugins(){let o=!1;return[new C.Plugin({key:new C.PluginKey("characterCount"),appendTransaction:(e,t,n)=>{if(o)return;const i=this.options.limit,r=this.options.autoTrim;if(i==null||i===0||r===!1){o=!0;return}const s=this.storage.characters({node:n.doc});if(s>i){const l=s-i,a=0,c=l;console.warn(`[CharacterCount] Initial content exceeded limit of ${i} characters. Content was automatically trimmed.`);const u=n.tr.deleteRange(a,c);return o=!0,u}o=!0},filterTransaction:(e,t)=>{const n=this.options.limit;if(!e.docChanged||n===0||n===null||n===void 0)return!0;const i=this.storage.characters({node:t.doc}),r=this.storage.characters({node:e.doc});if(r<=n||i>n&&r>n&&r<=i)return!0;if(i>n&&r>n&&r>i||!e.getMeta("paste"))return!1;const l=e.selection.$head.pos,a=r-n,c=l-a,u=l;return e.deleteRange(c,u),!(this.storage.characters({node:e.doc})>n)}})]}});h.Extension.create({name:"dropCursor",addOptions(){return{color:"currentColor",width:1,class:void 0}},addProseMirrorPlugins(){return[X(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:o,selection:e})=>{const{isEditable:t,isFocused:n}=this.editor,{anchor:i}=e,r=[];if(!t||!n)return S.DecorationSet.create(o,[]);let s=0;this.options.mode==="deepest"&&o.descendants((a,c)=>{if(a.isText)return;if(!(i>=c&&i<=c+a.nodeSize-1))return!1;s+=1});let l=0;return o.descendants((a,c)=>{if(a.isText||!(i>=c&&i<=c+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";r.push(S.Decoration.node(c,c+a.nodeSize,{class:this.options.className}))}),S.DecorationSet.create(o,r)}}})]}});h.Extension.create({name:"gapCursor",addProseMirrorPlugins(){return[Q()]},extendNodeSchema(o){var e;const t={name:o.name,options:o.options,storage:o.storage};return{allowGapCursor:(e=h.callOrReturn(h.getExtensionField(o,"allowGapCursor",t)))!=null?e:null}}});function _(o){const{editor:e,placeholder:t,dataAttribute:n,pos:i,node:r,isEmptyDoc:s,hasAnchor:l,classes:{emptyNode:a,emptyEditor:c}}=o,u=[a];return s&&u.push(c),S.Decoration.node(i,i+r.nodeSize,{class:u.join(" "),[n]:typeof t=="function"?t({editor:e,node:r,pos:i,hasAnchor:l}):t})}function pe(o){const e=getComputedStyle(o),t=`${e.overflow} ${e.overflowY} ${e.overflowX}`;return/auto|scroll|overlay/.test(t)}function he(o){let e=o;for(;e;){if(pe(e))return e;const t=e.parentElement;if(!t){const n=e.getRootNode();if(n instanceof ShadowRoot){e=n.host;continue}return window}e=t}return window}function fe(o){return o===window?{top:0,bottom:window.innerHeight}:o.getBoundingClientRect()}function me({doc:o,view:e,scrollContainer:t}){const n=e.dom.getBoundingClientRect(),i=t?fe(t):{top:0,bottom:window.innerHeight},r=Math.max(n.top,i.top),s=Math.min(n.bottom,i.bottom);if(r>=s)return{top:0,bottom:o.content.size};const a=getComputedStyle(e.dom).direction==="rtl"?Math.max(n.right-2,n.left+2):n.left+2,c=e.posAtCoords({left:a,top:r+2}),u=e.posAtCoords({left:a,top:s-2});return{top:c?c.pos:0,bottom:u?u.pos:o.content.size}}function ge(o,e){let t=null;return{call:((...r)=>{t||(o(...r),t=setTimeout(()=>{t=null},e))}),cancel:()=>{t&&(clearTimeout(t),t=null)}}}var V="placeholder";function ve(o){return o.replace(/\s+/g,"-").replace(/[^a-zA-Z0-9-]/g,"").replace(/^[0-9-]+/,"").replace(/^-+/,"").toLowerCase()}var A=new C.PluginKey("tiptap__placeholder");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 o=this.options.dataAttribute?`data-${ve(this.options.dataAttribute)}`:`data-${V}`;return[new C.Plugin({state:{init(){return{topPos:null,bottomPos:null}},apply(e,t){const n=e.getMeta(A);return n!=null&&n.positions?{topPos:n.positions.top,bottomPos:n.positions.bottom}:e.docChanged?{topPos:t.topPos!==null?e.mapping.map(t.topPos):null,bottomPos:t.bottomPos!==null?e.mapping.map(t.bottomPos):null}:t}},key:A,view(e){const t=he(e.dom),n=()=>{const l=me({view:e,doc:e.state.doc,scrollContainer:t}),a=A.getState(e.state);if(a.topPos===l.top&&a.bottomPos===l.bottom)return;const c=e.state.tr.setMeta(A,{positions:l}).setMeta("tiptap__viewportUpdate",!0);e.dispatch(c)},{call:i,cancel:r}=ge(n,250),s=t;return s.addEventListener("scroll",i,{passive:!0}),n(),{update(l,a){e.state.doc.content.size!==a.doc.content.size&&n()},destroy:()=>{r(),s.removeEventListener("scroll",i)}}},props:{decorations:({doc:e,selection:t})=>{var n,i;if(!(this.editor.isEditable||!this.options.showOnlyWhenEditable))return null;const{anchor:s}=t,l=[],a=this.editor.isEmpty;if(this.options.showOnlyCurrent&&!this.options.includeChildren){const u=e.resolve(s);if(u.depth>0){const d=u.node(1),p=u.before(1);if(d.type.isTextblock&&h.isNodeEmpty(d)){const f=s>=p&&s<=p+d.nodeSize,g=_({node:d,dataAttribute:o,hasAnchor:f,placeholder:this.options.placeholder,classes:{emptyEditor:this.options.emptyEditorClass,emptyNode:this.options.emptyNodeClass},editor:this.editor,isEmptyDoc:a,pos:u.before(1)});l.push(g)}}}else{const u=A.getState(this.editor.state),d=(n=u.topPos)!=null?n:0,p=(i=u.bottomPos)!=null?i:e.content.size;e.nodesBetween(d,p,(f,g)=>{const P=s>=g&&s<=g+f.nodeSize,E=!f.isLeaf&&h.isNodeEmpty(f);if(!f.type.isTextblock)return this.options.includeChildren;if((P||!this.options.showOnlyCurrent)&&E){const Y=_({classes:{emptyEditor:this.options.emptyEditorClass,emptyNode:this.options.emptyNodeClass},editor:this.editor,isEmptyDoc:a,dataAttribute:o,hasAnchor:P,placeholder:this.options.placeholder,node:f,pos:g});l.push(Y)}return this.options.includeChildren})}return S.DecorationSet.create(e,l)}}})]}});h.Extension.create({name:"selection",addOptions(){return{className:"selection"}},addProseMirrorPlugins(){const{editor:o,options:e}=this;return[new C.Plugin({key:new C.PluginKey("selection"),props:{decorations(t){return t.selection.empty||o.isFocused||!o.isEditable||h.isNodeSelection(t.selection)||o.view.dragging?null:S.DecorationSet.create(t.doc,[S.Decoration.inline(t.selection.from,t.selection.to,{class:e.className})])}}})]}});var ye="skipTrailingNode";function K({types:o,node:e}){return e&&Array.isArray(o)&&o.includes(e.type)||(e==null?void 0:e.type)===o}h.Extension.create({name:"trailingNode",addOptions(){return{node:void 0,notAfter:[]}},addProseMirrorPlugins(){var o;const e=new C.PluginKey(this.name),t=this.options.node||((o=this.editor.schema.topNodeType.contentMatch.defaultType)==null?void 0:o.name)||"paragraph",n=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,r,s)=>{const{doc:l,tr:a,schema:c}=s,u=e.getState(s),d=l.content.size,p=c.nodes[t];if(!i.some(f=>f.getMeta(ye))&&u)return a.insert(d,p.create())},state:{init:(i,r)=>{const s=r.tr.doc.lastChild;return!K({node:s,types:n})},apply:(i,r)=>{if(!i.docChanged||i.getMeta("__uniqueIDTransaction"))return r;const s=i.doc.lastChild;return!K({node:s,types:n})}}})]}});var we=h.Extension.create({name:"undoRedo",addOptions(){return{depth:100,newGroupDelay:500}},addCommands(){return{undo:()=>({state:o,dispatch:e})=>U(o,e),redo:()=>({state:o,dispatch:e})=>W(o,e)}},addProseMirrorPlugins(){return[ue(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 Ce(){var u;const o=x.useButtonProps(L.name),{icon:e=void 0,tooltip:t=void 0,shortcutKeys:n=void 0,tooltipOptions:i={},action:r=void 0,isActive:s=void 0}=((u=o==null?void 0:o.componentProps)==null?void 0:u.undo)??{},{disabled:l}=x.useActive(s),a=x.icons[e],c=()=>{l||r&&r()};return!o||!a?T.jsx(T.Fragment,{}):T.jsx(x.ActionButton,{action:c,disabled:l,icon:e,shortcutKeys:n,tooltip:t,tooltipOptions:i})}function Pe(){var c;const o=x.useButtonProps(L.name),{icon:e=void 0,tooltip:t=void 0,shortcutKeys:n=void 0,tooltipOptions:i={},action:r=void 0,isActive:s=void 0}=((c=o==null?void 0:o.componentProps)==null?void 0:c.redo)??{},{disabled:l}=x.useActive(s),a=()=>{l||r&&r()};return o?T.jsx(x.ActionButton,{action:a,disabled:l,icon:e,shortcutKeys:n,tooltip:t,tooltipOptions:i}):T.jsx(T.Fragment,{})}const L=we.extend({addOptions(){var o;return{...(o=this.parent)==null?void 0:o.call(this),depth:100,newGroupDelay:500,button:({editor:e,t,extension:n})=>{var i,r;return{componentProps:{undo:{action:()=>{e.chain().focus().undo().run()},shortcutKeys:((i=n.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:((r=n.options.shortcutKeys)==null?void 0:r[1])??["shift","mod","Z"],isActive:()=>e.can().redo(),icon:"Redo2",tooltip:t("editor.redo.tooltip")}}}}}}});exports.History=L;exports.RichTextRedo=Pe;exports.RichTextUndo=Ce;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const h=require("./index-Bcj8cyOO.cjs"),C=require("@tiptap/pm/state"),S=require("@tiptap/pm/view"),z=require("./index-CUvjYuRp.cjs"),T=require("react/jsx-runtime"),x=require("./index-Gi752TMk.cjs");require("react");require("./theme.cjs");function X(o={}){return new h.Plugin({view(e){return new q(e,o)}})}class q{constructor(e,t){var n;this.editorView=e,this.cursorPos=null,this.element=null,this.timeout=-1,this.width=(n=t.width)!==null&&n!==void 0?n:1,this.color=t.color===!1?void 0:t.color||"black",this.class=t.class,this.handlers=["dragover","dragend","drop","dragleave"].map(i=>{let r=s=>{this[i](s)};return e.dom.addEventListener(i,r),{name:i,handler:r}})}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,n,i=this.editorView.dom,r=i.getBoundingClientRect(),s=r.width/i.offsetWidth,l=r.height/i.offsetHeight;if(t){let d=e.nodeBefore,p=e.nodeAfter;if(d||p){let f=this.editorView.nodeDOM(this.cursorPos-(d?d.nodeSize:0));if(f){let g=f.getBoundingClientRect(),P=d?g.bottom:g.top;d&&p&&(P=(P+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2);let E=this.width/2*l;n={left:g.left,right:g.right,top:P-E,bottom:P+E}}}}if(!n){let d=this.editorView.coordsAtPos(this.cursorPos),p=this.width/2*s;n={left:d.left-p,right:d.left+p,top:d.top,bottom:d.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 c,u;if(!a||a==document.body&&getComputedStyle(a).position=="static")c=-pageXOffset,u=-pageYOffset;else{let d=a.getBoundingClientRect(),p=d.width/a.offsetWidth,f=d.height/a.offsetHeight;c=d.left-a.scrollLeft*p,u=d.top-a.scrollTop*f}this.element.style.left=(n.left-c)/s+"px",this.element.style.top=(n.top-u)/l+"px",this.element.style.width=(n.right-n.left)/s+"px",this.element.style.height=(n.bottom-n.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}),n=t&&t.inside>=0&&this.editorView.state.doc.nodeAt(t.inside),i=n&&n.type.spec.disableDropCursor,r=typeof i=="function"?i(this.editorView,t,e):i;if(t&&!r){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 m extends h.Selection{constructor(e){super(e,e)}map(e,t){let n=e.resolve(t.map(this.head));return m.valid(n)?new m(n):h.Selection.near(n)}content(){return h.Slice.empty}eq(e){return e instanceof m&&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 m(e.resolve(t.pos))}getBookmark(){return new k(this.anchor)}static valid(e){let t=e.parent;if(t.inlineContent||!Z(e)||!J(e))return!1;let n=t.type.spec.allowGapCursor;if(n!=null)return n;let i=t.contentMatchAt(e.index()).defaultType;return i&&i.isTextblock}static findGapCursorFrom(e,t,n=!1){e:for(;;){if(!n&&m.valid(e))return e;let i=e.pos,r=null;for(let s=e.depth;;s--){let l=e.node(s);if(t>0?e.indexAfter(s)<l.childCount:e.index(s)>0){r=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(m.valid(a))return a}for(;;){let s=t>0?r.firstChild:r.lastChild;if(!s){if(r.isAtom&&!r.isText&&!h.NodeSelection.isSelectable(r)){e=e.doc.resolve(i+r.nodeSize*t),n=!1;continue e}break}r=s,i+=t;let l=e.doc.resolve(i);if(m.valid(l))return l}return null}}}m.prototype.visible=!1;m.findFrom=m.findGapCursorFrom;h.Selection.jsonID("gapcursor",m);class k{constructor(e){this.pos=e}map(e){return new k(e.map(this.pos))}resolve(e){let t=e.resolve(this.pos);return m.valid(t)?new m(t):h.Selection.near(t)}}function H(o){return o.isAtom||o.spec.isolating||o.spec.createGapCursor}function Z(o){for(let e=o.depth;e>=0;e--){let t=o.index(e),n=o.node(e);if(t==0){if(n.type.spec.isolating)return!0;continue}for(let i=n.child(t-1);;i=i.lastChild){if(i.childCount==0&&!i.inlineContent||H(i.type))return!0;if(i.inlineContent)return!1}}return!0}function J(o){for(let e=o.depth;e>=0;e--){let t=o.indexAfter(e),n=o.node(e);if(t==n.childCount){if(n.type.spec.isolating)return!0;continue}for(let i=n.child(t);;i=i.firstChild){if(i.childCount==0&&!i.inlineContent||H(i.type))return!0;if(i.inlineContent)return!1}}return!0}function Q(){return new h.Plugin({props:{decorations:ne,createSelectionBetween(o,e,t){return e.pos==t.pos&&m.valid(t)?new m(t):null},handleClick:ee,handleKeyDown:$,handleDOMEvents:{beforeinput:te}}})}const $=z.keydownHandler({ArrowLeft:I("horiz",-1),ArrowRight:I("horiz",1),ArrowUp:I("vert",-1),ArrowDown:I("vert",1)});function I(o,e){const t=o=="vert"?e>0?"down":"up":e>0?"right":"left";return function(n,i,r){let s=n.selection,l=e>0?s.$to:s.$from,a=s.empty;if(s instanceof h.TextSelection){if(!r.endOfTextblock(t)||l.depth==0)return!1;a=!1,l=n.doc.resolve(e>0?l.after():l.before())}let c=m.findGapCursorFrom(l,e,a);return c?(i&&i(n.tr.setSelection(new m(c))),!0):!1}}function ee(o,e,t){if(!o||!o.editable)return!1;let n=o.state.doc.resolve(e);if(!m.valid(n))return!1;let i=o.posAtCoords({left:t.clientX,top:t.clientY});return i&&i.inside>-1&&h.NodeSelection.isSelectable(o.state.doc.nodeAt(i.inside))?!1:(o.dispatch(o.state.tr.setSelection(new m(n))),!0)}function te(o,e){if(e.inputType!="insertCompositionText"||!(o.state.selection instanceof m))return!1;let{$from:t}=o.state.selection,n=t.parent.contentMatchAt(t.index()).findWrapping(o.state.schema.nodes.text);if(!n)return!1;let i=h.Fragment.empty;for(let s=n.length-1;s>=0;s--)i=h.Fragment.from(n[s].createAndFill(null,i));let r=o.state.tr.replace(t.pos,t.pos,new h.Slice(i,0,0));return r.setSelection(h.TextSelection.near(r.doc.resolve(t.pos+1))),o.dispatch(r),!1}function ne(o){if(!(o.selection instanceof m))return null;let e=document.createElement("div");return e.className="ProseMirror-gapcursor",z.DecorationSet.create(o.doc,[z.Decoration.widget(o.selection.head,e,{key:"gapcursor"})])}var R=200,v=function(){};v.prototype.append=function(e){return e.length?(e=v.from(e),!this.length&&e||e.length<R&&this.leafAppend(e)||this.length<R&&e.leafPrepend(this)||this.appendInner(e)):this};v.prototype.prepend=function(e){return e.length?v.from(e).append(this):this};v.prototype.appendInner=function(e){return new oe(this,e)};v.prototype.slice=function(e,t){return e===void 0&&(e=0),t===void 0&&(t=this.length),e>=t?v.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,t))};v.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)};v.prototype.forEach=function(e,t,n){t===void 0&&(t=0),n===void 0&&(n=this.length),t<=n?this.forEachInner(e,t,n,0):this.forEachInvertedInner(e,t,n,0)};v.prototype.map=function(e,t,n){t===void 0&&(t=0),n===void 0&&(n=this.length);var i=[];return this.forEach(function(r,s){return i.push(e(r,s))},t,n),i};v.from=function(e){return e instanceof v?e:e&&e.length?new j(e):v.empty};var j=(function(o){function e(n){o.call(this),this.values=n}o&&(e.__proto__=o),e.prototype=Object.create(o&&o.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,r){return i==0&&r==this.length?this:new e(this.values.slice(i,r))},e.prototype.getInner=function(i){return this.values[i]},e.prototype.forEachInner=function(i,r,s,l){for(var a=r;a<s;a++)if(i(this.values[a],l+a)===!1)return!1},e.prototype.forEachInvertedInner=function(i,r,s,l){for(var a=r-1;a>=s;a--)if(i(this.values[a],l+a)===!1)return!1},e.prototype.leafAppend=function(i){if(this.length+i.length<=R)return new e(this.values.concat(i.flatten()))},e.prototype.leafPrepend=function(i){if(this.length+i.length<=R)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})(v);v.empty=new j([]);var oe=(function(o){function e(t,n){o.call(this),this.left=t,this.right=n,this.length=t.length+n.length,this.depth=Math.max(t.depth,n.depth)+1}return o&&(e.__proto__=o),e.prototype=Object.create(o&&o.prototype),e.prototype.constructor=e,e.prototype.flatten=function(){return this.left.flatten().concat(this.right.flatten())},e.prototype.getInner=function(n){return n<this.left.length?this.left.get(n):this.right.get(n-this.left.length)},e.prototype.forEachInner=function(n,i,r,s){var l=this.left.length;if(i<l&&this.left.forEachInner(n,i,Math.min(r,l),s)===!1||r>l&&this.right.forEachInner(n,Math.max(i-l,0),Math.min(this.length,r)-l,s+l)===!1)return!1},e.prototype.forEachInvertedInner=function(n,i,r,s){var l=this.left.length;if(i>l&&this.right.forEachInvertedInner(n,i-l,Math.max(r,l)-l,s+l)===!1||r<l&&this.left.forEachInvertedInner(n,Math.min(i,l),r,s)===!1)return!1},e.prototype.sliceInner=function(n,i){if(n==0&&i==this.length)return this;var r=this.left.length;return i<=r?this.left.slice(n,i):n>=r?this.right.slice(n-r,i-r):this.left.slice(n,r).append(this.right.slice(0,i-r))},e.prototype.leafAppend=function(n){var i=this.right.leafAppend(n);if(i)return new e(this.left,i)},e.prototype.leafPrepend=function(n){var i=this.left.leafPrepend(n);if(i)return new e(i,this.right)},e.prototype.appendInner=function(n){return this.left.depth>=Math.max(this.right.depth,n.depth)+1?new e(this.left,new e(this.right,n)):new e(this,n)},e})(v);const ie=500;class y{constructor(e,t){this.items=e,this.eventCount=t}popEvent(e,t){if(this.eventCount==0)return null;let n=this.items.length;for(;;n--)if(this.items.get(n-1).selection){--n;break}let i,r;t&&(i=this.remapping(n,this.items.length),r=i.maps.length);let s=e.tr,l,a,c=[],u=[];return this.items.forEach((d,p)=>{if(!d.step){i||(i=this.remapping(n,p+1),r=i.maps.length),r--,u.push(d);return}if(i){u.push(new w(d.map));let f=d.step.map(i.slice(r)),g;f&&s.maybeStep(f).doc&&(g=s.mapping.maps[s.mapping.maps.length-1],c.push(new w(g,void 0,void 0,c.length+u.length))),r--,g&&i.appendMap(g,r)}else s.maybeStep(d.step);if(d.selection)return l=i?d.selection.map(i.slice(r)):d.selection,a=new y(this.items.slice(0,n).append(u.reverse().concat(c)),this.eventCount-1),!1},this.items.length,0),{remaining:a,transform:s,selection:l}}addTransform(e,t,n,i){let r=[],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 d=e.steps[u].invert(e.docs[u]),p=new w(e.mapping.maps[u],d,t),f;(f=a&&a.merge(p))&&(p=f,u?r.pop():l=l.slice(0,l.length-1)),r.push(p),t&&(s++,t=void 0),i||(a=p)}let c=s-n.depth;return c>se&&(l=re(l,c),s-=c),new y(l.append(r),s)}remapping(e,t){let n=new h.Mapping;return this.items.forEach((i,r)=>{let s=i.mirrorOffset!=null&&r-i.mirrorOffset>=e?n.maps.length-i.mirrorOffset:void 0;n.appendMap(i.map,s)},e,t),n}addMaps(e){return this.eventCount==0?this:new y(this.items.append(e.map(t=>new w(t))),this.eventCount)}rebased(e,t){if(!this.eventCount)return this;let n=[],i=Math.max(0,this.items.length-t),r=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 f=r.getMirror(--a);if(f==null)return;s=Math.min(s,f);let g=r.maps[f];if(p.step){let P=e.steps[f].invert(e.docs[f]),E=p.selection&&p.selection.map(r.slice(a+1,f));E&&l++,n.push(new w(g,P,E))}else n.push(new w(g))},i);let c=[];for(let p=t;p<s;p++)c.push(new w(r.maps[p]));let u=this.items.slice(0,i).append(c).append(n),d=new y(u,l);return d.emptyItemCount()>ie&&(d=d.compress(this.items.length-n.length)),d}emptyItemCount(){let e=0;return this.items.forEach(t=>{t.step||e++}),e}compress(e=this.items.length){let t=this.remapping(0,e),n=t.maps.length,i=[],r=0;return this.items.forEach((s,l)=>{if(l>=e)i.push(s),s.selection&&r++;else if(s.step){let a=s.step.map(t.slice(n)),c=a&&a.getMap();if(n--,c&&t.appendMap(c,n),a){let u=s.selection&&s.selection.map(t.slice(n));u&&r++;let d=new w(c.invert(),a,u),p,f=i.length-1;(p=i.length&&i[f].merge(d))?i[f]=p:i.push(d)}}else s.map&&n--},this.items.length,0),new y(v.from(i.reverse()),r)}}y.empty=new y(v.empty,0);function re(o,e){let t;return o.forEach((n,i)=>{if(n.selection&&e--==0)return t=i,!1}),o.slice(t)}class w{constructor(e,t,n,i){this.map=e,this.step=t,this.selection=n,this.mirrorOffset=i}merge(e){if(this.step&&e.step&&!e.selection){let t=e.step.merge(this.step);if(t)return new w(t.getMap().invert(),t,this.selection)}}}class b{constructor(e,t,n,i,r){this.done=e,this.undone=t,this.prevRanges=n,this.prevTime=i,this.prevComposition=r}}const se=20;function le(o,e,t,n){let i=t.getMeta(M),r;if(i)return i.historyState;t.getMeta(de)&&(o=new b(o.done,o.undone,null,0,-1));let s=t.getMeta("appendedTransaction");if(t.steps.length==0)return o;if(s&&s.getMeta(M))return s.getMeta(M).redo?new b(o.done.addTransform(t,void 0,n,O(e)),o.undone,B(t.mapping.maps),o.prevTime,o.prevComposition):new b(o.done,o.undone.addTransform(t,void 0,n,O(e)),null,o.prevTime,o.prevComposition);if(t.getMeta("addToHistory")!==!1&&!(s&&s.getMeta("addToHistory")===!1)){let l=t.getMeta("composition"),a=o.prevTime==0||!s&&o.prevComposition!=l&&(o.prevTime<(t.time||0)-n.newGroupDelay||!ae(t,o.prevRanges)),c=s?D(o.prevRanges,t.mapping):B(t.mapping.maps);return new b(o.done.addTransform(t,a?e.selection.getBookmark():void 0,n,O(e)),y.empty,c,t.time,l??o.prevComposition)}else return(r=t.getMeta("rebased"))?new b(o.done.rebased(t,r),o.undone.rebased(t,r),D(o.prevRanges,t.mapping),o.prevTime,o.prevComposition):new b(o.done.addMaps(t.mapping.maps),o.undone.addMaps(t.mapping.maps),D(o.prevRanges,t.mapping),o.prevTime,o.prevComposition)}function ae(o,e){if(!e)return!1;if(!o.docChanged)return!0;let t=!1;return o.mapping.maps[0].forEach((n,i)=>{for(let r=0;r<e.length;r+=2)n<=e[r+1]&&i>=e[r]&&(t=!0)}),t}function B(o){let e=[];for(let t=o.length-1;t>=0&&e.length==0;t--)o[t].forEach((n,i,r,s)=>e.push(r,s));return e}function D(o,e){if(!o)return null;let t=[];for(let n=0;n<o.length;n+=2){let i=e.map(o[n],1),r=e.map(o[n+1],-1);i<=r&&t.push(i,r)}return t}function ce(o,e,t){let n=O(e),i=M.get(e).spec.config,r=(t?o.undone:o.done).popEvent(e,n);if(!r)return null;let s=r.selection.resolve(r.transform.doc),l=(t?o.done:o.undone).addTransform(r.transform,e.selection.getBookmark(),i,n),a=new b(t?l:r.remaining,t?r.remaining:l,null,0,-1);return r.transform.setSelection(s).setMeta(M,{redo:t,historyState:a})}let N=!1,F=null;function O(o){let e=o.plugins;if(F!=e){N=!1,F=e;for(let t=0;t<e.length;t++)if(e[t].spec.historyPreserveItems){N=!0;break}}return N}const M=new h.PluginKey("history"),de=new h.PluginKey("closeHistory");function ue(o={}){return o={depth:o.depth||100,newGroupDelay:o.newGroupDelay||500},new h.Plugin({key:M,state:{init(){return new b(y.empty,y.empty,null,0,-1)},apply(e,t,n){return le(t,n,e,o)}},config:o,props:{handleDOMEvents:{beforeinput(e,t){let n=t.inputType,i=n=="historyUndo"?U:n=="historyRedo"?W:null;return!i||!e.editable?!1:(t.preventDefault(),i(e.state,e.dispatch))}}}})}function G(o,e){return(t,n)=>{let i=M.getState(t);if(!i||(o?i.undone:i.done).eventCount==0)return!1;if(n){let r=ce(i,t,o);r&&n(e?r.scrollIntoView():r)}return!0}}const U=G(!1,!0),W=G(!0,!0);h.Extension.create({name:"characterCount",addOptions(){return{limit:null,autoTrim:!0,mode:"textSize",textCounter:o=>o.length,wordCounter:o=>o.split(" ").filter(e=>e!=="").length}},addStorage(){return{characters:()=>0,words:()=>0}},onBeforeCreate(){this.storage.characters=o=>{const e=(o==null?void 0:o.node)||this.editor.state.doc;if(((o==null?void 0:o.mode)||this.options.mode)==="textSize"){const n=e.textBetween(0,e.content.size,void 0," ");return this.options.textCounter(n)}return e.nodeSize},this.storage.words=o=>{const e=(o==null?void 0:o.node)||this.editor.state.doc,t=e.textBetween(0,e.content.size," "," ");return this.options.wordCounter(t)}},addProseMirrorPlugins(){let o=!1;return[new C.Plugin({key:new C.PluginKey("characterCount"),appendTransaction:(e,t,n)=>{if(o)return;const i=this.options.limit,r=this.options.autoTrim;if(i==null||i===0||r===!1){o=!0;return}const s=this.storage.characters({node:n.doc});if(s>i){const l=s-i,a=0,c=l;console.warn(`[CharacterCount] Initial content exceeded limit of ${i} characters. Content was automatically trimmed.`);const u=n.tr.deleteRange(a,c);return o=!0,u}o=!0},filterTransaction:(e,t)=>{const n=this.options.limit;if(!e.docChanged||n===0||n===null||n===void 0)return!0;const i=this.storage.characters({node:t.doc}),r=this.storage.characters({node:e.doc});if(r<=n||i>n&&r>n&&r<=i)return!0;if(i>n&&r>n&&r>i||!e.getMeta("paste"))return!1;const l=e.selection.$head.pos,a=r-n,c=l-a,u=l;return e.deleteRange(c,u),!(this.storage.characters({node:e.doc})>n)}})]}});h.Extension.create({name:"dropCursor",addOptions(){return{color:"currentColor",width:1,class:void 0}},addProseMirrorPlugins(){return[X(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:o,selection:e})=>{const{isEditable:t,isFocused:n}=this.editor,{anchor:i}=e,r=[];if(!t||!n)return S.DecorationSet.create(o,[]);let s=0;this.options.mode==="deepest"&&o.descendants((a,c)=>{if(a.isText)return;if(!(i>=c&&i<=c+a.nodeSize-1))return!1;s+=1});let l=0;return o.descendants((a,c)=>{if(a.isText||!(i>=c&&i<=c+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";r.push(S.Decoration.node(c,c+a.nodeSize,{class:this.options.className}))}),S.DecorationSet.create(o,r)}}})]}});h.Extension.create({name:"gapCursor",addProseMirrorPlugins(){return[Q()]},extendNodeSchema(o){var e;const t={name:o.name,options:o.options,storage:o.storage};return{allowGapCursor:(e=h.callOrReturn(h.getExtensionField(o,"allowGapCursor",t)))!=null?e:null}}});function _(o){const{editor:e,placeholder:t,dataAttribute:n,pos:i,node:r,isEmptyDoc:s,hasAnchor:l,classes:{emptyNode:a,emptyEditor:c}}=o,u=[a];return s&&u.push(c),S.Decoration.node(i,i+r.nodeSize,{class:u.join(" "),[n]:typeof t=="function"?t({editor:e,node:r,pos:i,hasAnchor:l}):t})}function pe(o){const e=getComputedStyle(o),t=`${e.overflow} ${e.overflowY} ${e.overflowX}`;return/auto|scroll|overlay/.test(t)}function he(o){let e=o;for(;e;){if(pe(e))return e;const t=e.parentElement;if(!t){const n=e.getRootNode();if(n instanceof ShadowRoot){e=n.host;continue}return window}e=t}return window}function fe(o){return o===window?{top:0,bottom:window.innerHeight}:o.getBoundingClientRect()}function me({doc:o,view:e,scrollContainer:t}){const n=e.dom.getBoundingClientRect(),i=t?fe(t):{top:0,bottom:window.innerHeight},r=Math.max(n.top,i.top),s=Math.min(n.bottom,i.bottom);if(r>=s)return{top:0,bottom:o.content.size};const a=getComputedStyle(e.dom).direction==="rtl"?Math.max(n.right-2,n.left+2):n.left+2,c=e.posAtCoords({left:a,top:r+2}),u=e.posAtCoords({left:a,top:s-2});return{top:c?c.pos:0,bottom:u?u.pos:o.content.size}}function ge(o,e){let t=null;return{call:((...r)=>{t||(o(...r),t=setTimeout(()=>{t=null},e))}),cancel:()=>{t&&(clearTimeout(t),t=null)}}}var V="placeholder";function ve(o){return o.replace(/\s+/g,"-").replace(/[^a-zA-Z0-9-]/g,"").replace(/^[0-9-]+/,"").replace(/^-+/,"").toLowerCase()}var A=new C.PluginKey("tiptap__placeholder");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 o=this.options.dataAttribute?`data-${ve(this.options.dataAttribute)}`:`data-${V}`;return[new C.Plugin({state:{init(){return{topPos:null,bottomPos:null}},apply(e,t){const n=e.getMeta(A);return n!=null&&n.positions?{topPos:n.positions.top,bottomPos:n.positions.bottom}:e.docChanged?{topPos:t.topPos!==null?e.mapping.map(t.topPos):null,bottomPos:t.bottomPos!==null?e.mapping.map(t.bottomPos):null}:t}},key:A,view(e){const t=he(e.dom),n=()=>{const l=me({view:e,doc:e.state.doc,scrollContainer:t}),a=A.getState(e.state);if(a.topPos===l.top&&a.bottomPos===l.bottom)return;const c=e.state.tr.setMeta(A,{positions:l}).setMeta("tiptap__viewportUpdate",!0);e.dispatch(c)},{call:i,cancel:r}=ge(n,250),s=t;return s.addEventListener("scroll",i,{passive:!0}),n(),{update(l,a){e.state.doc.content.size!==a.doc.content.size&&n()},destroy:()=>{r(),s.removeEventListener("scroll",i)}}},props:{decorations:({doc:e,selection:t})=>{var n,i;if(!(this.editor.isEditable||!this.options.showOnlyWhenEditable))return null;const{anchor:s}=t,l=[],a=this.editor.isEmpty;if(this.options.showOnlyCurrent&&!this.options.includeChildren){const u=e.resolve(s);if(u.depth>0){const d=u.node(1),p=u.before(1);if(d.type.isTextblock&&h.isNodeEmpty(d)){const f=s>=p&&s<=p+d.nodeSize,g=_({node:d,dataAttribute:o,hasAnchor:f,placeholder:this.options.placeholder,classes:{emptyEditor:this.options.emptyEditorClass,emptyNode:this.options.emptyNodeClass},editor:this.editor,isEmptyDoc:a,pos:u.before(1)});l.push(g)}}}else{const u=A.getState(this.editor.state),d=(n=u.topPos)!=null?n:0,p=(i=u.bottomPos)!=null?i:e.content.size;e.nodesBetween(d,p,(f,g)=>{const P=s>=g&&s<=g+f.nodeSize,E=!f.isLeaf&&h.isNodeEmpty(f);if(!f.type.isTextblock)return this.options.includeChildren;if((P||!this.options.showOnlyCurrent)&&E){const Y=_({classes:{emptyEditor:this.options.emptyEditorClass,emptyNode:this.options.emptyNodeClass},editor:this.editor,isEmptyDoc:a,dataAttribute:o,hasAnchor:P,placeholder:this.options.placeholder,node:f,pos:g});l.push(Y)}return this.options.includeChildren})}return S.DecorationSet.create(e,l)}}})]}});h.Extension.create({name:"selection",addOptions(){return{className:"selection"}},addProseMirrorPlugins(){const{editor:o,options:e}=this;return[new C.Plugin({key:new C.PluginKey("selection"),props:{decorations(t){return t.selection.empty||o.isFocused||!o.isEditable||h.isNodeSelection(t.selection)||o.view.dragging?null:S.DecorationSet.create(t.doc,[S.Decoration.inline(t.selection.from,t.selection.to,{class:e.className})])}}})]}});var ye="skipTrailingNode";function K({types:o,node:e}){return e&&Array.isArray(o)&&o.includes(e.type)||(e==null?void 0:e.type)===o}h.Extension.create({name:"trailingNode",addOptions(){return{node:void 0,notAfter:[]}},addProseMirrorPlugins(){var o;const e=new C.PluginKey(this.name),t=this.options.node||((o=this.editor.schema.topNodeType.contentMatch.defaultType)==null?void 0:o.name)||"paragraph",n=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,r,s)=>{const{doc:l,tr:a,schema:c}=s,u=e.getState(s),d=l.content.size,p=c.nodes[t];if(!i.some(f=>f.getMeta(ye))&&u)return a.insert(d,p.create())},state:{init:(i,r)=>{const s=r.tr.doc.lastChild;return!K({node:s,types:n})},apply:(i,r)=>{if(!i.docChanged||i.getMeta("__uniqueIDTransaction"))return r;const s=i.doc.lastChild;return!K({node:s,types:n})}}})]}});var we=h.Extension.create({name:"undoRedo",addOptions(){return{depth:100,newGroupDelay:500}},addCommands(){return{undo:()=>({state:o,dispatch:e})=>U(o,e),redo:()=>({state:o,dispatch:e})=>W(o,e)}},addProseMirrorPlugins(){return[ue(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 Ce(){var u;const o=x.useButtonProps(L.name),{icon:e=void 0,tooltip:t=void 0,shortcutKeys:n=void 0,tooltipOptions:i={},action:r=void 0,isActive:s=void 0}=((u=o==null?void 0:o.componentProps)==null?void 0:u.undo)??{},{disabled:l}=x.useActive(s),a=x.icons[e],c=()=>{l||r&&r()};return!o||!a?T.jsx(T.Fragment,{}):T.jsx(x.ActionButton,{action:c,disabled:l,icon:e,shortcutKeys:n,tooltip:t,tooltipOptions:i})}function Pe(){var c;const o=x.useButtonProps(L.name),{icon:e=void 0,tooltip:t=void 0,shortcutKeys:n=void 0,tooltipOptions:i={},action:r=void 0,isActive:s=void 0}=((c=o==null?void 0:o.componentProps)==null?void 0:c.redo)??{},{disabled:l}=x.useActive(s),a=()=>{l||r&&r()};return o?T.jsx(x.ActionButton,{action:a,disabled:l,icon:e,shortcutKeys:n,tooltip:t,tooltipOptions:i}):T.jsx(T.Fragment,{})}const L=we.extend({addOptions(){var o;return{...(o=this.parent)==null?void 0:o.call(this),depth:100,newGroupDelay:500,button:({editor:e,t,extension:n})=>{var i,r;return{componentProps:{undo:{action:()=>{e.chain().focus().undo().run()},shortcutKeys:((i=n.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:((r=n.options.shortcutKeys)==null?void 0:r[1])??["shift","mod","Z"],isActive:()=>e.can().redo(),icon:"Redo2",tooltip:t("editor.redo.tooltip")}}}}}}});exports.History=L;exports.RichTextRedo=Pe;exports.RichTextUndo=Ce;
package/lib/History.js CHANGED
@@ -3,7 +3,7 @@ import { Plugin as A, PluginKey as T } from "@tiptap/pm/state";
3
3
  import { DecorationSet as O, Decoration as L } from "@tiptap/pm/view";
4
4
  import { k as pe, D as ue, a as he } from "./index-D-Ouz0vF.js";
5
5
  import { jsx as R, Fragment as Z } from "react/jsx-runtime";
6
- import { u as J, e as Q, A as $, i as fe } from "./index-BrsJsbds.js";
6
+ import { u as J, e as Q, A as $, i as fe } from "./index-X6WZUM9O.js";
7
7
  import "react";
8
8
  import "./theme.js";
9
9
  function me(o = {}) {