reactjs-tiptap-editor 1.0.17 → 1.0.19

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (213) hide show
  1. package/lib/{ActionMenuButton-lsIBc9sU.js → ActionMenuButton-B1Nfn5Hm.js} +6 -6
  2. package/lib/ActionMenuButton-D3b_bcin.cjs +1 -0
  3. package/lib/Attachment.cjs +2 -2
  4. package/lib/Attachment.js +48 -86
  5. package/lib/Blockquote.cjs +3 -3
  6. package/lib/Blockquote.js +33 -29
  7. package/lib/Bold.cjs +1 -1
  8. package/lib/Bold.js +16 -11
  9. package/lib/BulletList.cjs +1 -1
  10. package/lib/BulletList.js +2 -3
  11. package/lib/Callout.cjs +1 -1
  12. package/lib/Callout.js +108 -103
  13. package/lib/Clear.cjs +1 -1
  14. package/lib/Clear.js +2 -3
  15. package/lib/Code.cjs +1 -1
  16. package/lib/Code.js +2 -3
  17. package/lib/CodeBlock.cjs +38 -38
  18. package/lib/CodeBlock.js +1565 -1610
  19. package/lib/CodeView.cjs +1 -1
  20. package/lib/CodeView.js +2 -2
  21. package/lib/Color.cjs +1 -1
  22. package/lib/Color.js +46 -63
  23. package/lib/Column.cjs +1 -1
  24. package/lib/Column.js +24 -10
  25. package/lib/Drawer-B1-7Y4HB.js +1099 -0
  26. package/lib/Drawer-kEO7KzzC.cjs +1 -0
  27. package/lib/Drawer.cjs +1 -1
  28. package/lib/Drawer.js +6 -5
  29. package/lib/Emoji.cjs +1 -1
  30. package/lib/Emoji.js +69 -93
  31. package/lib/Excalidraw.cjs +1 -1
  32. package/lib/Excalidraw.js +101 -112
  33. package/lib/ExportPdf.cjs +4 -4
  34. package/lib/ExportPdf.js +4 -13
  35. package/lib/ExportWord.cjs +1 -1
  36. package/lib/ExportWord.js +9 -7
  37. package/lib/FontFamily.cjs +1 -1
  38. package/lib/FontFamily.js +12 -34
  39. package/lib/FontSize.cjs +1 -1
  40. package/lib/FontSize.js +12 -27
  41. package/lib/Heading.cjs +1 -1
  42. package/lib/Heading.js +32 -45
  43. package/lib/Highlight.cjs +1 -1
  44. package/lib/Highlight.js +39 -52
  45. package/lib/History.cjs +1 -1
  46. package/lib/History.js +320 -313
  47. package/lib/HorizontalRule.cjs +1 -1
  48. package/lib/HorizontalRule.js +2 -3
  49. package/lib/Iframe-Bk5OIlvy.cjs +1 -0
  50. package/lib/{Iframe-CTajPyzs.js → Iframe-XlAb03_r.js} +21 -30
  51. package/lib/Iframe.cjs +1 -1
  52. package/lib/Iframe.js +5 -4
  53. package/lib/Image.cjs +1 -1
  54. package/lib/Image.js +5 -3
  55. package/lib/ImageGif.cjs +1 -1
  56. package/lib/ImageGif.js +89 -117
  57. package/lib/ImportWord.cjs +1 -1
  58. package/lib/ImportWord.js +16 -20
  59. package/lib/Indent-XaZNTsOk.cjs +1 -0
  60. package/lib/{Indent-BGEHlRx_.js → Indent-ruPuj5xn.js} +3 -7
  61. package/lib/Indent.cjs +1 -1
  62. package/lib/Indent.js +2 -2
  63. package/lib/Italic.cjs +1 -1
  64. package/lib/Italic.js +24 -19
  65. package/lib/Katex-BFIYLrwm.cjs +4 -0
  66. package/lib/{Katex-tMh4bfBb.js → Katex-DKspCn-p.js} +238 -253
  67. package/lib/Katex.cjs +1 -1
  68. package/lib/Katex.js +5 -4
  69. package/lib/LineHeight.cjs +1 -1
  70. package/lib/LineHeight.js +13 -21
  71. package/lib/Link.cjs +1 -1
  72. package/lib/Link.js +2 -2
  73. package/lib/{LinkEditBlock-CA5NhP-m.js → LinkEditBlock-BWm2Ypt2.js} +329 -379
  74. package/lib/LinkEditBlock-DhesHreq.cjs +5 -0
  75. package/lib/MarkdownPaste.cjs +58 -0
  76. package/lib/MarkdownPaste.js +1656 -0
  77. package/lib/Mention.cjs +1 -1
  78. package/lib/Mention.js +22 -17
  79. package/lib/Mermaid.cjs +2 -2
  80. package/lib/Mermaid.js +130 -155
  81. package/lib/MoreMark.cjs +1 -1
  82. package/lib/MoreMark.js +12 -20
  83. package/lib/OrderedList.cjs +1 -1
  84. package/lib/OrderedList.js +2 -3
  85. package/lib/SearchAndReplace.cjs +1 -1
  86. package/lib/SearchAndReplace.js +69 -134
  87. package/lib/SlashCommand.cjs +1 -1
  88. package/lib/SlashCommand.js +15 -14
  89. package/lib/{SlashCommandNodeView-CZoM3ZlS.cjs → SlashCommandNodeView-CojfS61Q.cjs} +1 -1
  90. package/lib/{SlashCommandNodeView-DLuqbX2o.js → SlashCommandNodeView-Hf2DX4km.js} +18 -20
  91. package/lib/Strike.cjs +1 -1
  92. package/lib/Strike.js +2 -3
  93. package/lib/{Table-BC4Lbqzn.js → Table-BTkFUATL.js} +95 -133
  94. package/lib/Table-C1_xLqV0.cjs +9 -0
  95. package/lib/Table.cjs +1 -1
  96. package/lib/Table.js +1 -1
  97. package/lib/TaskList.cjs +1 -1
  98. package/lib/TaskList.js +2 -3
  99. package/lib/TextAlign.cjs +1 -1
  100. package/lib/TextAlign.js +51 -60
  101. package/lib/TextDirection.cjs +1 -1
  102. package/lib/TextDirection.js +47 -69
  103. package/lib/TextUnderline.cjs +1 -1
  104. package/lib/TextUnderline.js +2 -3
  105. package/lib/Twitter-Cj-0yyQQ.cjs +1 -0
  106. package/lib/{Twitter-D8Cbgl7g.js → Twitter-D5mUTILj.js} +567 -593
  107. package/lib/Twitter.cjs +1 -1
  108. package/lib/Twitter.js +4 -3
  109. package/lib/Video.cjs +1 -1
  110. package/lib/Video.js +5 -5
  111. package/lib/bubble.cjs +6 -4
  112. package/lib/bubble.js +3891 -3001
  113. package/lib/clsx-BSBE1eoY.cjs +33 -0
  114. package/lib/clsx-OumA9x-8.js +1062 -0
  115. package/lib/components/ActionButton.d.ts +2 -2
  116. package/lib/components/ActionMenuButton.d.ts +1 -1
  117. package/lib/components/Bubble/formatBubble.d.ts +5 -5
  118. package/lib/components/ui/checkbox.d.ts +1 -1
  119. package/lib/components/ui/dialog.d.ts +1 -1
  120. package/lib/components/ui/dropdown-menu.d.ts +1 -1
  121. package/lib/components/ui/emoji-picker.d.ts +1 -1
  122. package/lib/components/ui/label.d.ts +1 -1
  123. package/lib/components/ui/popover.d.ts +1 -1
  124. package/lib/components/ui/select.d.ts +1 -1
  125. package/lib/components/ui/separator.d.ts +1 -1
  126. package/lib/components/ui/switch.d.ts +1 -1
  127. package/lib/components/ui/tabs.d.ts +1 -1
  128. package/lib/components/ui/toast.d.ts +1 -1
  129. package/lib/components/ui/toggle.d.ts +1 -1
  130. package/lib/components/ui/tooltip.d.ts +1 -1
  131. package/lib/{delete-node-IyVmiRbI.js → delete-node-eQHsyyhR.js} +3 -1
  132. package/lib/{dropdown-menu-q6RL_fkA.js → dropdown-menu-Bragdu5m.js} +8 -8
  133. package/lib/{dropdown-menu-C_F7LEy5.cjs → dropdown-menu-CUeq1boX.cjs} +1 -1
  134. package/lib/extensions/Blockquote/Blockquote.d.ts +1 -1
  135. package/lib/extensions/Bold/Bold.d.ts +1 -1
  136. package/lib/extensions/Code/Code.d.ts +1 -1
  137. package/lib/extensions/CodeView/CodeView.d.ts +2 -2
  138. package/lib/extensions/Heading/Heading.d.ts +1 -1
  139. package/lib/extensions/Highlight/Highlight.d.ts +1 -1
  140. package/lib/extensions/HorizontalRule/HorizontalRule.d.ts +1 -1
  141. package/lib/extensions/Image/Image.d.ts +1 -0
  142. package/lib/extensions/ImportWord/ImportWord.d.ts +2 -2
  143. package/lib/extensions/Italic/Italic.d.ts +1 -1
  144. package/lib/extensions/Link/Link.d.ts +1 -1
  145. package/lib/extensions/MarkdownPaste/MarkdownPaste.d.ts +5 -0
  146. package/lib/extensions/MarkdownPaste/index.d.ts +1 -0
  147. package/lib/extensions/Mermaid/Mermaid.d.ts +1 -1
  148. package/lib/extensions/MoreMark/MoreMark.d.ts +1 -1
  149. package/lib/extensions/Strike/Strike.d.ts +1 -1
  150. package/lib/extensions/Table/Table.d.ts +1 -1
  151. package/lib/extensions/TextAlign/TextAlign.d.ts +1 -1
  152. package/lib/extensions/TextUnderline/TextUnderline.d.ts +1 -1
  153. package/lib/index-B-7eHzaO.js +1362 -0
  154. package/lib/{index-BDYJ8Ph2.js → index-BKlbc8Qo.js} +1 -1
  155. package/lib/index-BLrMslr7.cjs +1 -0
  156. package/lib/index-BVRHx_ha.js +6473 -0
  157. package/lib/{index-C07N8gA1.js → index-BlXGgvT-.js} +21 -18
  158. package/lib/{index-BsFvo9PG.cjs → index-BqL4vAWE.cjs} +1 -1
  159. package/lib/{index-RcSPeQHn.js → index-CDFAs4RT.js} +1508 -1464
  160. package/lib/index-CMLwKzI0.cjs +1 -0
  161. package/lib/index-COCTP78Y.cjs +12 -0
  162. package/lib/{index-DqruLhsu.js → index-CZ1_8JQQ.js} +23 -23
  163. package/lib/{index-neeeY2o7.cjs → index-CnePcUeF.cjs} +3 -3
  164. package/lib/index-D7wfvzJg.cjs +1 -0
  165. package/lib/index-DwSnESy-.cjs +24 -0
  166. package/lib/{index-Do_dsOGB.js → index-cPEuL4Zr.js} +175 -158
  167. package/lib/index.cjs +1 -1
  168. package/lib/index.js +33 -41
  169. package/lib/locale-bundle.cjs +1 -1
  170. package/lib/locale-bundle.js +1 -1
  171. package/lib/plugins/image-upload.d.ts +1 -1
  172. package/lib/popover-C2BbhsXH.js +24 -0
  173. package/lib/popover-DCJpsZx0.cjs +1 -0
  174. package/lib/{renderNodeView-BEkECnnY.js → renderNodeView-CmnUEfby.js} +2 -2
  175. package/lib/{renderNodeView-DfLmGrgA.cjs → renderNodeView-DQjWzXDA.cjs} +1 -1
  176. package/lib/{separator-BLp6xpSY.cjs → separator-BuG1zwKa.cjs} +1 -1
  177. package/lib/separator-lkMWuUvf.js +293 -0
  178. package/lib/store/editor.d.ts +1 -1
  179. package/lib/store/store.d.ts +1 -1
  180. package/lib/style.css +1 -1
  181. package/lib/theme.js +1 -1
  182. package/lib/types.d.ts +3 -3
  183. package/lib/updatePosition-D6AScA-1.cjs +1 -0
  184. package/lib/updatePosition-DYuAiqx-.js +16 -0
  185. package/lib/utils/columns.d.ts +1 -1
  186. package/lib/utils/pdf.d.ts +1 -1
  187. package/lib/utils/utils.d.ts +1 -1
  188. package/package.json +262 -247
  189. package/lib/ActionMenuButton-B_E2mbAW.cjs +0 -1
  190. package/lib/Drawer-DQ4CxBwG.js +0 -1373
  191. package/lib/Drawer-FUeUKshi.cjs +0 -1
  192. package/lib/Iframe-EVWXCqe4.cjs +0 -1
  193. package/lib/Indent-q9cEWAa_.cjs +0 -1
  194. package/lib/Katex-ClqcEnN_.cjs +0 -4
  195. package/lib/LinkEditBlock-DZXk4ln_.cjs +0 -5
  196. package/lib/Table-BmDopO43.cjs +0 -9
  197. package/lib/Twitter-BbMD3Ybp.cjs +0 -1
  198. package/lib/clsx-CXbNJWDD.cjs +0 -54
  199. package/lib/clsx-DaPvp9ji.js +0 -7391
  200. package/lib/index-BCzvbrf5.cjs +0 -12
  201. package/lib/index-BnVcq33n.cjs +0 -1
  202. package/lib/index-CjhjjJsN.cjs +0 -1
  203. package/lib/index-Cs6cp0Y6.cjs +0 -1
  204. package/lib/index-Qcl3BG94.js +0 -1351
  205. package/lib/popover-CtinPbiy.js +0 -24
  206. package/lib/popover-DIMT3pae.cjs +0 -1
  207. package/lib/select-CYyIeImH.cjs +0 -1
  208. package/lib/select-CmV5uTXr.js +0 -117
  209. package/lib/separator-C7luvaG8.js +0 -327
  210. package/lib/textarea-CkVKMPqK.js +0 -20
  211. package/lib/textarea-Cn75Cm2n.cjs +0 -1
  212. package/lib/updatePosition-Cjuj2E26.cjs +0 -1
  213. package/lib/updatePosition-DRmKQBGm.js +0 -16
@@ -1,17 +1,17 @@
1
1
  import { jsxs as c, jsx as e } from "react/jsx-runtime";
2
- import n from "react";
3
- import { Slot as r } from "@radix-ui/react-slot";
4
- import { i as d, T as m, a as f, B as s, b as u, g } from "./index-RcSPeQHn.js";
2
+ import { Slot as n } from "@radix-ui/react-slot";
3
+ import r from "react";
4
+ import { i as d, T as m, a as f, B as s, b as u, g } from "./index-CDFAs4RT.js";
5
5
  import "./theme.js";
6
- const C = n.forwardRef(
6
+ const C = r.forwardRef(
7
7
  ({ asChild: x = !1, tooltip: i, ...t }, l) => {
8
8
  var a;
9
9
  const h = d[t.icon];
10
10
  return /* @__PURE__ */ c(m, { children: [
11
11
  /* @__PURE__ */ e(f, { asChild: !0, children: /* @__PURE__ */ e(
12
- x ? r : s,
12
+ x ? n : s,
13
13
  {
14
- className: "richtext-h-[32px] richtext-min-w-24 richtext-overflow-hidden richtext-px-[5px] richtext-py-0",
14
+ className: "richtext-h-[32px] richtext-min-w-24 richtext-overflow-hidden richtext-px-[5px] richtext-py-0",
15
15
  "data-state": t != null && t.dataState ? "on" : "off",
16
16
  disabled: t == null ? void 0 : t.disabled,
17
17
  ref: l,
@@ -0,0 +1 @@
1
+ "use strict";const e=require("react/jsx-runtime"),a=require("@radix-ui/react-slot"),d=require("react"),i=require("./index-BLrMslr7.cjs");require("./theme.cjs");const s=d.forwardRef(({asChild:h=!1,tooltip:c,...t},l)=>{var n;const x=i.icons[t.icon],r=h?a.Slot:i.Button;return e.jsxs(i.Tooltip,{children:[e.jsx(i.TooltipTrigger,{asChild:!0,children:e.jsx(r,{className:"richtext-h-[32px] richtext-min-w-24 richtext-overflow-hidden richtext-px-[5px] richtext-py-0","data-state":t!=null&&t.dataState?"on":"off",disabled:t==null?void 0:t.disabled,ref:l,variant:"ghost",...t,children:e.jsxs("div",{className:"richtext-flex richtext-h-full richtext-items-center richtext-font-normal",children:[(t==null?void 0:t.title)&&e.jsx("div",{className:"richtext-grow richtext-truncate richtext-text-left richtext-text-sm",children:t==null?void 0:t.title}),x&&e.jsx(x,{className:"richtext-ml-1 richtext-size-3 richtext-shrink-0 richtext-text-zinc-500"})]})})}),c&&e.jsx(i.TooltipContent,{children:e.jsxs("div",{className:"richtext-flex richtext-max-w-24 richtext-flex-col richtext-items-center richtext-text-center",children:[c&&e.jsx("div",{children:c}),e.jsx("div",{className:"richtext-flex",children:!!((n=t==null?void 0:t.shortcutKeys)!=null&&n.length)&&e.jsx("span",{children:i.getShortcutKeys(t==null?void 0:t.shortcutKeys)})})]})})]})});exports.ActionMenuButton=s;
@@ -1,4 +1,4 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("./clsx-CXbNJWDD.cjs"),s=require("./index-BnVcq33n.cjs"),e=require("react/jsx-runtime"),v=require("react");require("./theme.cjs");const x=require("lucide-react"),D=require("./index-BsFvo9PG.cjs"),u=require("./dom-dataset-BqoJhJXt.cjs"),S={audio:'<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-audio-lines"><path d="M2 10v3"/><path d="M6 6v11"/><path d="M10 3v18"/><path d="M14 8v7"/><path d="M18 5v13"/><path d="M22 10v3"/></svg>',video:'<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-video"><path d="m16 13 5.223 3.482a.5.5 0 0 0 .777-.416V7.87a.5.5 0 0 0-.752-.432L16 10.5"/><rect x="2" y="6" width="14" height="12" rx="2"/></svg>',file:'<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-file"><path d="M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z"/><path d="M14 2v4a2 2 0 0 0 2 2h4"/></svg>',image:'<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-image"><rect width="18" height="18" x="3" y="3" rx="2" ry="2"/><circle cx="9" cy="9" r="2"/><path d="m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21"/></svg>',pdf:`<svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" viewBox="0 0 32 32">
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const b=require("./index-DwSnESy-.cjs"),u=require("./clsx-BSBE1eoY.cjs"),s=require("./index-BLrMslr7.cjs"),e=require("react/jsx-runtime"),v=require("react");require("./theme.cjs");const x=require("lucide-react"),S=require("./index-BqL4vAWE.cjs"),d=require("./dom-dataset-BqoJhJXt.cjs"),B={audio:'<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-audio-lines"><path d="M2 10v3"/><path d="M6 6v11"/><path d="M10 3v18"/><path d="M14 8v7"/><path d="M18 5v13"/><path d="M22 10v3"/></svg>',video:'<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-video"><path d="m16 13 5.223 3.482a.5.5 0 0 0 .777-.416V7.87a.5.5 0 0 0-.752-.432L16 10.5"/><rect x="2" y="6" width="14" height="12" rx="2"/></svg>',file:'<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-file"><path d="M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z"/><path d="M14 2v4a2 2 0 0 0 2 2h4"/></svg>',image:'<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-image"><rect width="18" height="18" x="3" y="3" rx="2" ry="2"/><circle cx="9" cy="9" r="2"/><path d="m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21"/></svg>',pdf:`<svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" viewBox="0 0 32 32">
2
2
  <path fill="currentColor" d="M30 18v-2h-6v10h2v-4h3v-2h-3v-2zm-11 8h-4V16h4a3.003 3.003 0 0 1 3 3v4a3.003 3.003 0 0 1-3 3m-2-2h2a1 1 0 0 0 1-1v-4a1 1 0 0 0-1-1h-2zm-6-8H6v10h2v-3h3a2.003 2.003 0 0 0 2-2v-3a2 2 0 0 0-2-2m-3 5v-3h3l.001 3z"></path>
3
3
  <path fill="currentColor" d="M22 14v-4a.91.91 0 0 0-.3-.7l-7-7A.9.9 0 0 0 14 2H4a2.006 2.006 0 0 0-2 2v24a2 2 0 0 0 2 2h16v-2H4V4h8v6a2.006 2.006 0 0 0 2 2h6v2Zm-8-4V4.4l5.6 5.6Z"></path>
4
4
  </svg>`,word:`<svg
@@ -16,4 +16,4 @@
16
16
  fill="currentColor"
17
17
  d="m810.667 913.135-.478.068H201.796c-19.865 0-36.727-11.673-36.727-25.6v-618.36h154.965c51.268 0 92.911-39.39 92.911-87.858v-87.86H810.19c19.797 0 36.522 11.742 36.522 25.669V739.26h61.987V119.262c0-46.421-44.169-84.241-98.51-84.241H328.364l-225.28 194.56v658.09c0 46.285 44.236 84.105 98.713 84.105H810.19c43.759 0 80.554-24.713 93.32-58.573h-92.842zM350.89 94.89v86.562c0 16.11-13.858 29.286-30.925 29.286H216.815L350.959 94.891z"
18
18
  />
19
- </svg>`,excel:'<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-sheet"><rect width="18" height="18" x="3" y="3" rx="2" ry="2"/><line x1="3" x2="21" y1="9" y2="9"/><line x1="3" x2="21" y1="15" y2="15"/><line x1="9" x2="9" y1="9" y2="21"/><line x1="15" x2="15" y1="9" y2="21"/></svg>',ppt:'<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-table-properties"><path d="M15 3v18"/><rect width="18" height="18" x="3" y="3" rx="2"/><path d="M21 9H3"/><path d="M21 15H3"/></svg>'};function B(t){const n=S[t],l=new DOMParser().parseFromString(n,"image/svg+xml").documentElement,o=["svg",{...Array.from(l.attributes).reduce((i,a)=>(i[a.name]=a.value,i),{})}];return Array.from(l.childNodes).forEach(i=>{if(i.nodeType===1){const a=[i.tagName.toLowerCase(),Array.from(i.attributes).reduce((h,p)=>(h[p.name]=p.value,h),{})];i.textContent&&a.push(i.textContent),o.push(a)}}),o}const _={audio:e.jsx(x.LucideAudioLines,{}),video:e.jsx(x.LucideVideo,{}),file:e.jsx(x.LucideFile,{}),image:e.jsx(x.LucideImage,{}),pdf:e.jsx(s.ExportPdf,{}),word:e.jsx(s.ExportWord,{}),excel:e.jsx(x.LucideSheet,{}),ppt:e.jsx(x.LucideTableProperties,{})};function b(t,n=!1){const r=s.normalizeFileType(t),d=_[r]||e.jsx(e.Fragment,{});return n?B(r):d}const R="_wrap_17afc_2",k={wrap:R};function q({editor:t,node:n,updateAttributes:r,deleteNode:d,extension:l}){var M;const o=v.useRef(null),i=s.useEditableEditor(),{hasTrigger:a,fileName:h,fileSize:p,fileExt:C,fileType:H,url:g,error:A}=n.attrs,[N,w]=v.useState(!1),{t:j}=D.useLocale(),z=(M=l==null?void 0:l.options)==null?void 0:M.upload,f=v.useCallback(()=>{!i||g||o.current.click()},[g,i]),E=v.useCallback(async T=>{const m=T.target.files&&T.target.files[0];if(!m)return;const V={fileName:s.extractFilename(m.name),fileSize:m.size,fileType:m.type,fileExt:s.extractFileExtension(m.name)};w(!0);try{const y=await z(m);r({...V,url:y}),w(!1)}catch(y){r({error:`File upload fail: ${y&&y.message}`||"Unknown error"}),w(!1),o.current.value=""}},[w,r]);v.useEffect(()=>{!g&&!a&&(f(),r({hasTrigger:!0}))},[g,a,f,r]);const F=v.useCallback(()=>d(),[t]);return i&&!g?e.jsx(c.NodeViewWrapper,{children:e.jsxs("div",{className:c.clsx(k.wrap,"render-wrapper"),children:[e.jsx("p",{onClick:f,style:{cursor:"pointer"},children:N?e.jsx("span",{children:j("editor.attachment.uploading")}):e.jsx("span",{children:j("editor.attachment.please_upload")})}),e.jsx("input",{hidden:!0,onChange:E,ref:o,type:"file"})]})}):g?e.jsx(c.NodeViewWrapper,{children:e.jsxs("div",{className:c.clsx(k.wrap,"render-wrapper"),onClick:f,children:[e.jsxs("div",{className:"richtext-flex richtext-items-center richtext-gap-[4px]",children:[e.jsx("span",{children:b(H)}),e.jsxs("span",{children:[h,".",C]}),e.jsxs("span",{children:["(",s.normalizeFileSize(p),")"]})]}),e.jsx(s.ActionButton,{action:F,icon:"Trash2",tooltip:j("editor.delete")})]})}):A!=="null"?e.jsx(c.NodeViewWrapper,{children:e.jsx("div",{className:c.clsx(k.wrap,"render-wrapper"),onClick:f,children:e.jsx("p",{children:A})})}):e.jsx(e.Fragment,{})}function P(){const t=s.useButtonProps(L.name),{icon:n=void 0,tooltip:r=void 0,shortcutKeys:d=void 0,tooltipOptions:l={},action:o=void 0,isActive:i=void 0}=(t==null?void 0:t.componentProps)??{},{editorDisabled:a,update:h}=s.useToggleActive(i),p=()=>{a||o&&(o(),h())};return t?e.jsx(s.ActionButton,{action:p,disabled:a,icon:n,shortcutKeys:d,tooltip:r,tooltipOptions:l}):e.jsx(e.Fragment,{})}const L=c.Node3.create({name:"attachment",content:"",marks:"",group:"block",selectable:!0,atom:!0,draggable:!0,addOptions(){var t;return{...(t=this.parent)==null?void 0:t.call(this),HTMLAttributes:{class:"attachment"},button:({editor:n,t:r})=>({component:s.ActionButton,componentProps:{action:()=>n.chain().focus().setAttachment().run(),isActive:()=>!1,disabled:!1,icon:"Attachment",tooltip:r("editor.attachment.tooltip")}})}},parseHTML(){return[{tag:"div[class=attachment]"}]},renderHTML({HTMLAttributes:t}){const{url:n="",fileName:r="",fileSize:d="",fileType:l="",fileExt:o=""}=t||{};return["div",c.mergeAttributes(this.options.HTMLAttributes||{},t||{}),n?["a",{href:n||"#"},["span",{class:"attachment__icon"},b(l,!0)],["span",{class:"attachment__text"},`${r}.${o} (${s.normalizeFileSize(d)})`]]:["div",{class:"attachment__placeholder"}]]},addAttributes(){return{fileName:{default:null,parseHTML:u.getDatasetAttribute("filename")},fileSize:{default:null,parseHTML:u.getDatasetAttribute("filesize")},fileType:{default:null,parseHTML:u.getDatasetAttribute("filetype")},fileExt:{default:null,parseHTML:u.getDatasetAttribute("fileext")},url:{default:null,parseHTML:u.getDatasetAttribute("url")},hasTrigger:{default:!1,parseHTML:t=>u.getDatasetAttribute("hastrigger")(t)==="true"},error:{default:null,parseHTML:u.getDatasetAttribute("error")}}},addCommands(){return{setAttachment:(t={})=>({chain:n})=>n().insertContent({type:this.name,attrs:t}).run()}},addNodeView(){return c.ReactNodeViewRenderer(q)}});exports.Attachment=L;exports.RichTextAttachment=P;
19
+ </svg>`,excel:'<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-sheet"><rect width="18" height="18" x="3" y="3" rx="2" ry="2"/><line x1="3" x2="21" y1="9" y2="9"/><line x1="3" x2="21" y1="15" y2="15"/><line x1="9" x2="9" y1="9" y2="21"/><line x1="15" x2="15" y1="9" y2="21"/></svg>',ppt:'<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-table-properties"><path d="M15 3v18"/><rect width="18" height="18" x="3" y="3" rx="2"/><path d="M21 9H3"/><path d="M21 15H3"/></svg>'};function _(t){const n=B[t],l=new DOMParser().parseFromString(n,"image/svg+xml").documentElement,o=["svg",{...Array.from(l.attributes).reduce((i,a)=>(i[a.name]=a.value,i),{})}];return Array.from(l.childNodes).forEach(i=>{if(i.nodeType===1){const a=[i.tagName.toLowerCase(),Array.from(i.attributes).reduce((h,p)=>(h[p.name]=p.value,h),{})];i.textContent&&a.push(i.textContent),o.push(a)}}),o}const q={audio:e.jsx(x.LucideAudioLines,{}),video:e.jsx(x.LucideVideo,{}),file:e.jsx(x.LucideFile,{}),image:e.jsx(x.LucideImage,{}),pdf:e.jsx(s.ExportPdf,{}),word:e.jsx(s.ExportWord,{}),excel:e.jsx(x.LucideSheet,{}),ppt:e.jsx(x.LucideTableProperties,{})};function L(t,n=!1){const r=s.normalizeFileType(t),c=q[r]||e.jsx(e.Fragment,{});return n?_(r):c}const R="_wrap_15oj2_2",k={wrap:R};function P({editor:t,node:n,updateAttributes:r,deleteNode:c,extension:l}){var M;const o=v.useRef(null),i=s.useEditableEditor(),{hasTrigger:a,fileName:h,fileSize:p,fileExt:H,fileType:N,url:g,error:A}=n.attrs,[z,w]=v.useState(!1),{t:y}=S.useLocale(),E=(M=l==null?void 0:l.options)==null?void 0:M.upload,f=v.useCallback(()=>{!i||g||o.current.click()},[g,i]),F=v.useCallback(async T=>{const m=T.target.files&&T.target.files[0];if(!m)return;const D={fileName:s.extractFilename(m.name),fileSize:m.size,fileType:m.type,fileExt:s.extractFileExtension(m.name)};w(!0);try{const j=await E(m);r({...D,url:j}),w(!1)}catch(j){r({error:`File upload fail: ${j&&j.message}`}),w(!1),o.current.value=""}},[w,r]);v.useEffect(()=>{!g&&!a&&(f(),r({hasTrigger:!0}))},[g,a,f,r]);const V=v.useCallback(()=>c(),[t]);return i&&!g?e.jsx(u.NodeViewWrapper,{children:e.jsxs("div",{className:u.clsx(k.wrap,"render-wrapper"),children:[e.jsx("p",{onClick:f,style:{cursor:"pointer"},children:z?e.jsx("span",{children:y("editor.attachment.uploading")}):e.jsx("span",{children:y("editor.attachment.please_upload")})}),e.jsx("input",{hidden:!0,onChange:F,ref:o,type:"file"})]})}):g?e.jsx(u.NodeViewWrapper,{children:e.jsxs("div",{className:u.clsx(k.wrap,"render-wrapper"),onClick:f,children:[e.jsxs("div",{className:"richtext-flex richtext-items-center richtext-gap-[4px]",children:[e.jsx("span",{children:L(N)}),e.jsxs("span",{children:[h,".",H]}),e.jsxs("span",{children:["(",s.normalizeFileSize(p),")"]})]}),e.jsx(s.ActionButton,{action:V,icon:"Trash2",tooltip:y("editor.delete")})]})}):A!=="null"?e.jsx(u.NodeViewWrapper,{children:e.jsx("div",{className:u.clsx(k.wrap,"render-wrapper"),onClick:f,children:e.jsx("p",{children:A})})}):e.jsx(e.Fragment,{})}function $(){const t=s.useButtonProps(C.name),{icon:n=void 0,tooltip:r=void 0,shortcutKeys:c=void 0,tooltipOptions:l={},action:o=void 0,isActive:i=void 0}=(t==null?void 0:t.componentProps)??{},{editorDisabled:a,update:h}=s.useToggleActive(i),p=()=>{a||o&&(o(),h())};return t?e.jsx(s.ActionButton,{action:p,disabled:a,icon:n,shortcutKeys:c,tooltip:r,tooltipOptions:l}):e.jsx(e.Fragment,{})}const C=b.Node3.create({name:"attachment",content:"",marks:"",group:"block",selectable:!0,atom:!0,draggable:!0,addOptions(){var t;return{...(t=this.parent)==null?void 0:t.call(this),HTMLAttributes:{class:"attachment"},button:({editor:n,t:r})=>({component:s.ActionButton,componentProps:{action:()=>n.chain().focus().setAttachment().run(),isActive:()=>!1,disabled:!1,icon:"Attachment",tooltip:r("editor.attachment.tooltip")}})}},parseHTML(){return[{tag:"div[class=attachment]"}]},renderHTML({HTMLAttributes:t}){const{url:n="",fileName:r="",fileSize:c="",fileType:l="",fileExt:o=""}=t||{};return["div",b.mergeAttributes(this.options.HTMLAttributes||{},t||{}),n?["a",{href:n||"#"},["span",{class:"attachment__icon"},L(l,!0)],["span",{class:"attachment__text"},`${r}.${o} (${s.normalizeFileSize(c)})`]]:["div",{class:"attachment__placeholder"}]]},addAttributes(){return{fileName:{default:null,parseHTML:d.getDatasetAttribute("filename")},fileSize:{default:null,parseHTML:d.getDatasetAttribute("filesize")},fileType:{default:null,parseHTML:d.getDatasetAttribute("filetype")},fileExt:{default:null,parseHTML:d.getDatasetAttribute("fileext")},url:{default:null,parseHTML:d.getDatasetAttribute("url")},hasTrigger:{default:!1,parseHTML:t=>d.getDatasetAttribute("hastrigger")(t)==="true"},error:{default:null,parseHTML:d.getDatasetAttribute("error")}}},addCommands(){return{setAttachment:(t={})=>({chain:n})=>n().insertContent({type:this.name,attrs:t}).run()}},addNodeView(){return u.ReactNodeViewRenderer(P)}});exports.Attachment=C;exports.RichTextAttachment=$;
package/lib/Attachment.js CHANGED
@@ -1,10 +1,11 @@
1
- import { h as x, j as y, N as j, k as P, m as D } from "./clsx-DaPvp9ji.js";
2
- import { P as R, Q as $, U as I, G as O, V as W, W as Z, X as N, A as T, u as U, d as G } from "./index-RcSPeQHn.js";
1
+ import { N as j, m as D } from "./index-BVRHx_ha.js";
2
+ import { N as x, c as y, a as P } from "./clsx-OumA9x-8.js";
3
+ import { Y as $, Z as R, _ as I, M as Z, $ as O, a0 as W, a1 as N, A as T, u as K, d as Y } from "./index-CDFAs4RT.js";
3
4
  import { jsx as e, Fragment as L, jsxs as f } from "react/jsx-runtime";
4
- import { useRef as K, useState as Q, useCallback as k, useEffect as X } from "react";
5
+ import { useRef as q, useState as G, useCallback as k, useEffect as J } from "react";
5
6
  import "./theme.js";
6
- import { LucideTableProperties as q, LucideSheet as J, LucideImage as Y, LucideFile as ee, LucideVideo as te, LucideAudioLines as re } from "lucide-react";
7
- import { u as ie } from "./index-C07N8gA1.js";
7
+ import { LucideTableProperties as Q, LucideSheet as U, LucideImage as X, LucideFile as ee, LucideVideo as te, LucideAudioLines as re } from "lucide-react";
8
+ import { u as ie } from "./index-BlXGgvT-.js";
8
9
  import { g as c } from "./dom-dataset-CIEeltF6.js";
9
10
  const oe = {
10
11
  audio: '<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-audio-lines"><path d="M2 10v3"/><path d="M6 6v11"/><path d="M10 3v18"/><path d="M14 8v7"/><path d="M18 5v13"/><path d="M22 10v3"/></svg>',
@@ -55,113 +56,78 @@ const ae = {
55
56
  audio: /* @__PURE__ */ e(re, {}),
56
57
  video: /* @__PURE__ */ e(te, {}),
57
58
  file: /* @__PURE__ */ e(ee, {}),
58
- image: /* @__PURE__ */ e(Y, {}),
59
+ image: /* @__PURE__ */ e(X, {}),
59
60
  pdf: /* @__PURE__ */ e(I, {}),
60
- word: /* @__PURE__ */ e($, {}),
61
- excel: /* @__PURE__ */ e(J, {}),
62
- ppt: /* @__PURE__ */ e(q, {})
61
+ word: /* @__PURE__ */ e(R, {}),
62
+ excel: /* @__PURE__ */ e(U, {}),
63
+ ppt: /* @__PURE__ */ e(Q, {})
63
64
  };
64
65
  function b(t, o = !1) {
65
- const r = R(t), l = ae[r] || /* @__PURE__ */ e(L, {});
66
+ const r = $(t), l = ae[r] || /* @__PURE__ */ e(L, {});
66
67
  return o ? ne(r) : l;
67
68
  }
68
- const se = "_wrap_17afc_2", M = {
69
+ const se = "_wrap_15oj2_2", M = {
69
70
  wrap: se
70
71
  };
71
72
  function le({ editor: t, node: o, updateAttributes: r, deleteNode: l, extension: s }) {
72
73
  var A;
73
- const n = K(null), i = O(), { hasTrigger: a, fileName: d, fileSize: h, fileExt: z, fileType: E, url: u, error: H } = o.attrs, [V, v] = Q(!1), { t: w } = ie(), F = (A = s == null ? void 0 : s.options) == null ? void 0 : A.upload, m = k(() => {
74
+ const n = q(null), i = Z(), { hasTrigger: a, fileName: d, fileSize: h, fileExt: z, fileType: E, url: u, error: H } = o.attrs, [F, v] = G(!1), { t: w } = ie(), V = (A = s == null ? void 0 : s.options) == null ? void 0 : A.upload, m = k(() => {
74
75
  !i || u || n.current.click();
75
- }, [u, i]), B = k(
76
+ }, [u, i]), _ = k(
76
77
  async (C) => {
77
78
  const p = C.target.files && C.target.files[0];
78
- if (!p)
79
- return;
80
- const _ = {
81
- fileName: Z(p.name),
79
+ if (!p) return;
80
+ const S = {
81
+ fileName: W(p.name),
82
82
  fileSize: p.size,
83
83
  fileType: p.type,
84
- fileExt: W(p.name)
84
+ fileExt: O(p.name)
85
85
  };
86
86
  v(!0);
87
87
  try {
88
- const g = await F(p);
89
- r({ ..._, url: g }), v(!1);
88
+ const g = await V(p);
89
+ r({ ...S, url: g }), v(!1);
90
90
  } catch (g) {
91
- r({ error: `File upload fail: ${g && g.message}` || "Unknown error" }), v(!1), n.current.value = "";
91
+ r({
92
+ error: `File upload fail: ${g && g.message}`
93
+ }), v(!1), n.current.value = "";
92
94
  }
93
95
  },
94
96
  [v, r]
95
97
  );
96
- X(() => {
98
+ J(() => {
97
99
  !u && !a && (m(), r({ hasTrigger: !0 }));
98
100
  }, [u, a, m, r]);
99
- const S = k(() => l(), [t]);
101
+ const B = k(() => l(), [t]);
100
102
  return i && !u ? /* @__PURE__ */ e(x, { children: /* @__PURE__ */ f("div", { className: y(M.wrap, "render-wrapper"), children: [
101
- /* @__PURE__ */ e(
102
- "p",
103
- {
104
- onClick: m,
105
- style: { cursor: "pointer" },
106
- children: V ? /* @__PURE__ */ e("span", { children: w("editor.attachment.uploading") }) : /* @__PURE__ */ e("span", { children: w("editor.attachment.please_upload") })
107
- }
108
- ),
109
- /* @__PURE__ */ e(
110
- "input",
111
- {
112
- hidden: !0,
113
- onChange: B,
114
- ref: n,
115
- type: "file"
116
- }
117
- )
118
- ] }) }) : u ? /* @__PURE__ */ e(x, { children: /* @__PURE__ */ f(
119
- "div",
120
- {
121
- className: y(M.wrap, "render-wrapper"),
122
- onClick: m,
123
- children: [
124
- /* @__PURE__ */ f("div", { className: "richtext-flex richtext-items-center richtext-gap-[4px]", children: [
125
- /* @__PURE__ */ e("span", { children: b(E) }),
126
- /* @__PURE__ */ f("span", { children: [
127
- d,
128
- ".",
129
- z
130
- ] }),
131
- /* @__PURE__ */ f("span", { children: [
132
- "(",
133
- N(h),
134
- ")"
135
- ] })
136
- ] }),
137
- /* @__PURE__ */ e(
138
- T,
139
- {
140
- action: S,
141
- icon: "Trash2",
142
- tooltip: w("editor.delete")
143
- }
144
- )
145
- ]
146
- }
147
- ) }) : H !== "null" ? /* @__PURE__ */ e(x, { children: /* @__PURE__ */ e(
148
- "div",
149
- {
150
- className: y(M.wrap, "render-wrapper"),
151
- onClick: m,
152
- children: /* @__PURE__ */ e("p", { children: H })
153
- }
154
- ) }) : /* @__PURE__ */ e(L, {});
103
+ /* @__PURE__ */ e("p", { onClick: m, style: { cursor: "pointer" }, children: F ? /* @__PURE__ */ e("span", { children: w("editor.attachment.uploading") }) : /* @__PURE__ */ e("span", { children: w("editor.attachment.please_upload") }) }),
104
+ /* @__PURE__ */ e("input", { hidden: !0, onChange: _, ref: n, type: "file" })
105
+ ] }) }) : u ? /* @__PURE__ */ e(x, { children: /* @__PURE__ */ f("div", { className: y(M.wrap, "render-wrapper"), onClick: m, children: [
106
+ /* @__PURE__ */ f("div", { className: "richtext-flex richtext-items-center richtext-gap-[4px]", children: [
107
+ /* @__PURE__ */ e("span", { children: b(E) }),
108
+ /* @__PURE__ */ f("span", { children: [
109
+ d,
110
+ ".",
111
+ z
112
+ ] }),
113
+ /* @__PURE__ */ f("span", { children: [
114
+ "(",
115
+ N(h),
116
+ ")"
117
+ ] })
118
+ ] }),
119
+ /* @__PURE__ */ e(T, { action: B, icon: "Trash2", tooltip: w("editor.delete") })
120
+ ] }) }) : H !== "null" ? /* @__PURE__ */ e(x, { children: /* @__PURE__ */ e("div", { className: y(M.wrap, "render-wrapper"), onClick: m, children: /* @__PURE__ */ e("p", { children: H }) }) }) : /* @__PURE__ */ e(L, {});
155
121
  }
156
- function we() {
157
- const t = U(ce.name), {
122
+ function xe() {
123
+ const t = K(ce.name), {
158
124
  icon: o = void 0,
159
125
  tooltip: r = void 0,
160
126
  shortcutKeys: l = void 0,
161
127
  tooltipOptions: s = {},
162
128
  action: n = void 0,
163
129
  isActive: i = void 0
164
- } = (t == null ? void 0 : t.componentProps) ?? {}, { editorDisabled: a, update: d } = G(i), h = () => {
130
+ } = (t == null ? void 0 : t.componentProps) ?? {}, { editorDisabled: a, update: d } = Y(i), h = () => {
165
131
  a || n && (n(), d());
166
132
  };
167
133
  return t ? /* @__PURE__ */ e(
@@ -225,11 +191,7 @@ const ce = /* @__PURE__ */ j.create({
225
191
  o ? [
226
192
  "a",
227
193
  { href: o || "#" },
228
- [
229
- "span",
230
- { class: "attachment__icon" },
231
- b(s, !0)
232
- ],
194
+ ["span", { class: "attachment__icon" }, b(s, !0)],
233
195
  [
234
196
  "span",
235
197
  { class: "attachment__text" },
@@ -281,5 +243,5 @@ const ce = /* @__PURE__ */ j.create({
281
243
  });
282
244
  export {
283
245
  ce as Attachment,
284
- we as RichTextAttachment
246
+ xe as RichTextAttachment
285
247
  };
@@ -1,5 +1,5 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("./clsx-CXbNJWDD.cjs"),p=require("./jsx-runtime-C_NLcKys.cjs"),l=require("react/jsx-runtime"),a=require("./index-BnVcq33n.cjs");require("react");require("./theme.cjs");var g=/^\s*>\s$/,m=c.Node3.create({name:"blockquote",addOptions(){return{HTMLAttributes:{}}},content:"block+",group:"block",defining:!0,parseHTML(){return[{tag:"blockquote"}]},renderHTML({HTMLAttributes:t}){return p.h("blockquote",{...c.mergeAttributes(this.options.HTMLAttributes,t),children:p.h("slot",{})})},parseMarkdown:(t,e)=>e.createNode("blockquote",void 0,e.parseChildren(t.tokens||[])),renderMarkdown:(t,e)=>{if(!t.content)return"";const o=">",n=[];return t.content.forEach(i=>{const u=e.renderChildren([i]).split(`
2
- `).map(r=>r.trim()===""?o:`${o} ${r}`);n.push(u.join(`
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("./index-DwSnESy-.cjs"),h=require("./jsx-runtime-C_NLcKys.cjs"),d=require("react/jsx-runtime"),p=require("./index-BLrMslr7.cjs");require("react");require("./theme.cjs");var m=/^\s*>\s$/,b=a.Node3.create({name:"blockquote",addOptions(){return{HTMLAttributes:{}}},content:"block+",group:"block",defining:!0,parseHTML(){return[{tag:"blockquote"}]},renderHTML({HTMLAttributes:t}){return h.h("blockquote",{...a.mergeAttributes(this.options.HTMLAttributes,t),children:h.h("slot",{})})},parseMarkdown:(t,e)=>{var o;const n=(o=e.parseBlockChildren)!=null?o:e.parseChildren;return e.createNode("blockquote",void 0,n(t.tokens||[]))},renderMarkdown:(t,e)=>{if(!t.content)return"";const o=">",n=[];return t.content.forEach((r,i)=>{var s,u;const l=((u=(s=e.renderChild)==null?void 0:s.call(e,r,i))!=null?u:e.renderChildren([r])).split(`
2
+ `).map(q=>q.trim()===""?o:`${o} ${q}`);n.push(l.join(`
3
3
  `))}),n.join(`
4
4
  ${o}
5
- `)},addCommands(){return{setBlockquote:()=>({commands:t})=>t.wrapIn(this.name),toggleBlockquote:()=>({commands:t})=>t.toggleWrap(this.name),unsetBlockquote:()=>({commands:t})=>t.lift(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-b":()=>this.editor.commands.toggleBlockquote()}},addInputRules(){return[c.wrappingInputRule({find:g,type:this.type})]}});function b(){const t=a.useButtonProps(h.name),{icon:e=void 0,tooltip:o=void 0,shortcutKeys:n=void 0,tooltipOptions:i={},action:s=void 0,isActive:d=void 0}=(t==null?void 0:t.componentProps)??{},{dataState:u,disabled:r,update:q}=a.useToggleActive(d),k=()=>{r||s&&(s(),q())};return t?l.jsx(a.ActionButton,{action:k,dataState:u,disabled:r,icon:e,shortcutKeys:n,tooltip:o,tooltipOptions:i}):l.jsx(l.Fragment,{})}const h=m.extend({addOptions(){var t;return{...(t=this.parent)==null?void 0:t.call(this),HTMLAttributes:{class:"blockquote"},button:({editor:e,t:o,extension:n})=>({componentProps:{action:()=>e.commands.toggleBlockquote(),isActive:()=>e.isActive("blockquote"),disabled:!e.can().toggleBlockquote(),icon:"TextQuote",shortcutKeys:n.options.shortcutKeys??["shift","mod","B"],tooltip:o("editor.blockquote.tooltip")}})}}});exports.Blockquote=h;exports.RichTextBlockquote=b;
5
+ `)},addCommands(){return{setBlockquote:()=>({commands:t})=>t.wrapIn(this.name),toggleBlockquote:()=>({commands:t})=>t.toggleWrap(this.name),unsetBlockquote:()=>({commands:t})=>t.lift(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-b":()=>this.editor.commands.toggleBlockquote()}},addInputRules(){return[a.wrappingInputRule({find:m,type:this.type})]}});function v(){const t=p.useButtonProps(g.name),{icon:e=void 0,tooltip:o=void 0,shortcutKeys:n=void 0,tooltipOptions:r={},action:i=void 0,isActive:s=void 0}=(t==null?void 0:t.componentProps)??{},{dataState:u,disabled:c,update:k}=p.useToggleActive(s),l=()=>{c||i&&(i(),k())};return t?d.jsx(p.ActionButton,{action:l,dataState:u,disabled:c,icon:e,shortcutKeys:n,tooltip:o,tooltipOptions:r}):d.jsx(d.Fragment,{})}const g=b.extend({addOptions(){var t;return{...(t=this.parent)==null?void 0:t.call(this),HTMLAttributes:{class:"blockquote"},button:({editor:e,t:o,extension:n})=>({componentProps:{action:()=>e.commands.toggleBlockquote(),isActive:()=>e.isActive("blockquote"),disabled:!e.can().toggleBlockquote(),icon:"TextQuote",shortcutKeys:n.options.shortcutKeys??["shift","mod","B"],tooltip:o("editor.blockquote.tooltip")}})}}});exports.Blockquote=g;exports.RichTextBlockquote=v;
package/lib/Blockquote.js CHANGED
@@ -1,10 +1,10 @@
1
- import { N as m, w as h, m as k } from "./clsx-DaPvp9ji.js";
2
- import { h as a } from "./jsx-runtime-CT7Pcg-t.js";
3
- import { jsx as d, Fragment as g } from "react/jsx-runtime";
4
- import { u as f, d as b, A as q } from "./index-RcSPeQHn.js";
1
+ import { N as k, w as h, m as g } from "./index-BVRHx_ha.js";
2
+ import { h as p } from "./jsx-runtime-CT7Pcg-t.js";
3
+ import { jsx as m, Fragment as b } from "react/jsx-runtime";
4
+ import { u as f, d as q, A as v } from "./index-CDFAs4RT.js";
5
5
  import "react";
6
6
  import "./theme.js";
7
- var v = /^\s*>\s$/, B = m.create({
7
+ var B = /^\s*>\s$/, A = k.create({
8
8
  name: "blockquote",
9
9
  addOptions() {
10
10
  return {
@@ -18,17 +18,22 @@ var v = /^\s*>\s$/, B = m.create({
18
18
  return [{ tag: "blockquote" }];
19
19
  },
20
20
  renderHTML({ HTMLAttributes: t }) {
21
- return /* @__PURE__ */ a("blockquote", { ...k(this.options.HTMLAttributes, t), children: /* @__PURE__ */ a("slot", {}) });
21
+ return /* @__PURE__ */ p("blockquote", { ...g(this.options.HTMLAttributes, t), children: /* @__PURE__ */ p("slot", {}) });
22
+ },
23
+ parseMarkdown: (t, o) => {
24
+ var e;
25
+ const n = (e = o.parseBlockChildren) != null ? e : o.parseChildren;
26
+ return o.createNode("blockquote", void 0, n(t.tokens || []));
22
27
  },
23
- parseMarkdown: (t, o) => o.createNode("blockquote", void 0, o.parseChildren(t.tokens || [])),
24
28
  renderMarkdown: (t, o) => {
25
29
  if (!t.content)
26
30
  return "";
27
31
  const e = ">", n = [];
28
- return t.content.forEach((i) => {
29
- const c = o.renderChildren([i]).split(`
30
- `).map((r) => r.trim() === "" ? e : `${e} ${r}`);
31
- n.push(c.join(`
32
+ return t.content.forEach((r, i) => {
33
+ var s, c;
34
+ const a = ((c = (s = o.renderChild) == null ? void 0 : s.call(o, r, i)) != null ? c : o.renderChildren([r])).split(`
35
+ `).map((d) => d.trim() === "" ? e : `${e} ${d}`);
36
+ n.push(a.join(`
32
37
  `));
33
38
  }), n.join(`
34
39
  ${e}
@@ -49,38 +54,37 @@ ${e}
49
54
  addInputRules() {
50
55
  return [
51
56
  h({
52
- find: v,
57
+ find: B,
53
58
  type: this.type
54
59
  })
55
60
  ];
56
61
  }
57
62
  });
58
- function H() {
59
- const t = f(A.name), {
63
+ function L() {
64
+ const t = f(x.name), {
60
65
  icon: o = void 0,
61
66
  tooltip: e = void 0,
62
67
  shortcutKeys: n = void 0,
63
- tooltipOptions: i = {},
64
- action: s = void 0,
65
- isActive: u = void 0
66
- } = (t == null ? void 0 : t.componentProps) ?? {}, { dataState: c, disabled: r, update: l } = b(u), p = () => {
67
- r || s && (s(), l());
68
+ tooltipOptions: r = {},
69
+ action: i = void 0,
70
+ isActive: s = void 0
71
+ } = (t == null ? void 0 : t.componentProps) ?? {}, { dataState: c, disabled: u, update: l } = q(s), a = () => {
72
+ u || i && (i(), l());
68
73
  };
69
- return t ? /* @__PURE__ */ d(
70
- q,
74
+ return t ? /* @__PURE__ */ m(
75
+ v,
71
76
  {
72
- action: p,
77
+ action: a,
73
78
  dataState: c,
74
- disabled: r,
79
+ disabled: u,
75
80
  icon: o,
76
81
  shortcutKeys: n,
77
82
  tooltip: e,
78
- tooltipOptions: i
83
+ tooltipOptions: r
79
84
  }
80
- ) : /* @__PURE__ */ d(g, {});
85
+ ) : /* @__PURE__ */ m(b, {});
81
86
  }
82
- const A = /* @__PURE__ */ B.extend({
83
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
87
+ const x = /* @__PURE__ */ A.extend({
84
88
  //@ts-expect-error
85
89
  addOptions() {
86
90
  var t;
@@ -103,6 +107,6 @@ const A = /* @__PURE__ */ B.extend({
103
107
  }
104
108
  });
105
109
  export {
106
- A as Blockquote,
107
- H as RichTextBlockquote
110
+ x as Blockquote,
111
+ L as RichTextBlockquote
108
112
  };
package/lib/Bold.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("./clsx-CXbNJWDD.cjs"),u=require("./jsx-runtime-C_NLcKys.cjs"),r=require("./index-BnVcq33n.cjs"),i=require("react/jsx-runtime");require("react");require("./theme.cjs");var y=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/,_=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))/g,B=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))$/,k=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))/g,v=o.Mark.create({name:"bold",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"strong"},{tag:"b",getAttrs:t=>t.style.fontWeight!=="normal"&&null},{style:"font-weight=400",clearMark:t=>t.type.name===this.name},{style:"font-weight",getAttrs:t=>/^(bold(er)?|[5-9]\d{2,})$/.test(t)&&null}]},renderHTML({HTMLAttributes:t}){return u.h("strong",{...o.mergeAttributes(this.options.HTMLAttributes,t),children:u.h("slot",{})})},markdownTokenName:"strong",parseMarkdown:(t,e)=>e.applyMark("bold",e.parseInline(t.tokens||[])),renderMarkdown:(t,e)=>`**${e.renderChildren(t)}**`,addCommands(){return{setBold:()=>({commands:t})=>t.setMark(this.name),toggleBold:()=>({commands:t})=>t.toggleMark(this.name),unsetBold:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-b":()=>this.editor.commands.toggleBold(),"Mod-B":()=>this.editor.commands.toggleBold()}},addInputRules(){return[o.markInputRule({find:y,type:this.type}),o.markInputRule({find:B,type:this.type})]},addPasteRules(){return[o.markPasteRule({find:_,type:this.type}),o.markPasteRule({find:k,type:this.type})]}});function M(){const t=r.useButtonProps(l.name),{icon:e=void 0,tooltip:n=void 0,shortcutKeys:s=void 0,tooltipOptions:c={},action:a=void 0,isActive:p=void 0}=(t==null?void 0:t.componentProps)??{},{dataState:g,disabled:d,update:m}=r.useToggleActive(p),h=()=>{d||a&&(a(),m())};return t?i.jsx(r.ActionButton,{action:h,dataState:g,disabled:d,icon:e,shortcutKeys:s,tooltip:n,tooltipOptions:c}):i.jsx(i.Fragment,{})}const l=v.extend({addOptions(){var t;return{...(t=this.parent)==null?void 0:t.call(this),button:({editor:e,t:n,extension:s})=>({component:r.ActionButton,componentProps:{action:()=>e.commands.toggleBold(),isActive:()=>e.isActive("bold"),icon:"Bold",shortcutKeys:s.options.shortcutKeys??["mod","B"],tooltip:n("editor.bold.tooltip")}})}}});exports.Bold=l;exports.RichTextBold=M;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("./index-DwSnESy-.cjs"),u=require("./jsx-runtime-C_NLcKys.cjs"),n=require("./index-BLrMslr7.cjs"),i=require("react/jsx-runtime");require("react");require("./theme.cjs");var y=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/,_=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))/g,B=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))$/,k=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))/g,v=o.Mark.create({name:"bold",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"strong"},{tag:"b",getAttrs:t=>t.style.fontWeight!=="normal"&&null},{style:"font-weight=400",clearMark:t=>t.type.name===this.name},{style:"font-weight",getAttrs:t=>/^(bold(er)?|[5-9]\d{2,})$/.test(t)&&null}]},renderHTML({HTMLAttributes:t}){return u.h("strong",{...o.mergeAttributes(this.options.HTMLAttributes,t),children:u.h("slot",{})})},markdownTokenName:"strong",parseMarkdown:(t,e)=>e.applyMark("bold",e.parseInline(t.tokens||[])),markdownOptions:{htmlReopen:{open:"<strong>",close:"</strong>"}},renderMarkdown:(t,e)=>`**${e.renderChildren(t)}**`,addCommands(){return{setBold:()=>({commands:t})=>t.setMark(this.name),toggleBold:()=>({commands:t})=>t.toggleMark(this.name),unsetBold:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-b":()=>this.editor.commands.toggleBold(),"Mod-B":()=>this.editor.commands.toggleBold()}},addInputRules(){return[o.markInputRule({find:y,type:this.type}),o.markInputRule({find:B,type:this.type})]},addPasteRules(){return[o.markPasteRule({find:_,type:this.type}),o.markPasteRule({find:k,type:this.type})]}});function M(){const t=n.useButtonProps(l.name),{icon:e=void 0,tooltip:r=void 0,shortcutKeys:s=void 0,tooltipOptions:c={},action:d=void 0,isActive:p=void 0}=(t==null?void 0:t.componentProps)??{},{dataState:g,disabled:a,update:m}=n.useToggleActive(p),h=()=>{a||d&&(d(),m())};return t?i.jsx(n.ActionButton,{action:h,dataState:g,disabled:a,icon:e,shortcutKeys:s,tooltip:r,tooltipOptions:c}):i.jsx(i.Fragment,{})}const l=v.extend({addOptions(){var t;return{...(t=this.parent)==null?void 0:t.call(this),button:({editor:e,t:r,extension:s})=>({component:n.ActionButton,componentProps:{action:()=>e.commands.toggleBold(),isActive:()=>e.isActive("bold"),icon:"Bold",shortcutKeys:s.options.shortcutKeys??["mod","B"],tooltip:r("editor.bold.tooltip")}})}}});exports.Bold=l;exports.RichTextBold=M;
package/lib/Bold.js CHANGED
@@ -1,10 +1,10 @@
1
- import { M as _, e as a, f as i, m as y } from "./clsx-DaPvp9ji.js";
1
+ import { M as _, f as a, h as i, m as y } from "./index-BVRHx_ha.js";
2
2
  import { h as d } from "./jsx-runtime-CT7Pcg-t.js";
3
- import { u as f, d as M, A as l } from "./index-RcSPeQHn.js";
4
- import { jsx as u, Fragment as v } from "react/jsx-runtime";
3
+ import { u as f, d as M, A as u } from "./index-CDFAs4RT.js";
4
+ import { jsx as l, Fragment as k } from "react/jsx-runtime";
5
5
  import "react";
6
6
  import "./theme.js";
7
- var B = /(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/, k = /(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))/g, b = /(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))$/, A = /(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))/g, R = _.create({
7
+ var v = /(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/, B = /(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))/g, b = /(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))$/, A = /(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))/g, R = _.create({
8
8
  name: "bold",
9
9
  addOptions() {
10
10
  return {
@@ -35,6 +35,12 @@ var B = /(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/, k = /(?:^|\s)(\*
35
35
  },
36
36
  markdownTokenName: "strong",
37
37
  parseMarkdown: (t, e) => e.applyMark("bold", e.parseInline(t.tokens || [])),
38
+ markdownOptions: {
39
+ htmlReopen: {
40
+ open: "<strong>",
41
+ close: "</strong>"
42
+ }
43
+ },
38
44
  renderMarkdown: (t, e) => `**${e.renderChildren(t)}**`,
39
45
  addCommands() {
40
46
  return {
@@ -52,7 +58,7 @@ var B = /(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/, k = /(?:^|\s)(\*
52
58
  addInputRules() {
53
59
  return [
54
60
  i({
55
- find: B,
61
+ find: v,
56
62
  type: this.type
57
63
  }),
58
64
  i({
@@ -64,7 +70,7 @@ var B = /(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/, k = /(?:^|\s)(\*
64
70
  addPasteRules() {
65
71
  return [
66
72
  a({
67
- find: k,
73
+ find: B,
68
74
  type: this.type
69
75
  }),
70
76
  a({
@@ -85,8 +91,8 @@ function K() {
85
91
  } = (t == null ? void 0 : t.componentProps) ?? {}, { dataState: c, disabled: s, update: g } = M(m), h = () => {
86
92
  s || n && (n(), g());
87
93
  };
88
- return t ? /* @__PURE__ */ u(
89
- l,
94
+ return t ? /* @__PURE__ */ l(
95
+ u,
90
96
  {
91
97
  action: h,
92
98
  dataState: c,
@@ -96,17 +102,16 @@ function K() {
96
102
  tooltip: o,
97
103
  tooltipOptions: p
98
104
  }
99
- ) : /* @__PURE__ */ u(v, {});
105
+ ) : /* @__PURE__ */ l(k, {});
100
106
  }
101
107
  const x = /* @__PURE__ */ R.extend({
102
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
103
108
  //@ts-expect-error
104
109
  addOptions() {
105
110
  var t;
106
111
  return {
107
112
  ...(t = this.parent) == null ? void 0 : t.call(this),
108
113
  button: ({ editor: e, t: o, extension: r }) => ({
109
- component: l,
114
+ component: u,
110
115
  componentProps: {
111
116
  action: () => e.commands.toggleBold(),
112
117
  isActive: () => e.isActive("bold"),
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const v=require("./index-BCzvbrf5.cjs"),s=require("react/jsx-runtime"),n=require("./index-BnVcq33n.cjs");require("react");require("./theme.cjs");function g(){const t=n.useButtonProps(l.name),{icon:e=void 0,tooltip:i=void 0,shortcutKeys:o=void 0,tooltipOptions:r={},action:c=void 0,isActive:d=void 0}=(t==null?void 0:t.componentProps)??{},{dataState:a,disabled:u,update:p}=n.useToggleActive(d),m=()=>{u||c&&(c(),p())};return t?s.jsx(n.ActionButton,{action:m,dataState:a,disabled:u,icon:e,shortcutKeys:o,tooltip:i,tooltipOptions:r}):s.jsx(s.Fragment,{})}const l=v.BulletList.extend({addOptions(){var t;return{...(t=this.parent)==null?void 0:t.call(this),button:({editor:e,t:i,extension:o})=>({componentProps:{action:()=>e.commands.toggleBulletList(),isActive:()=>e.isActive("bulletList"),disabled:!1,shortcutKeys:o.options.shortcutKeys??["shift","mod","8"],icon:"List",tooltip:i("editor.bulletlist.tooltip")}})}}});exports.BulletList=l;exports.RichTextBulletList=g;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const v=require("./index-COCTP78Y.cjs"),s=require("react/jsx-runtime"),n=require("./index-BLrMslr7.cjs");require("react");require("./theme.cjs");function g(){const t=n.useButtonProps(l.name),{icon:e=void 0,tooltip:i=void 0,shortcutKeys:o=void 0,tooltipOptions:r={},action:c=void 0,isActive:d=void 0}=(t==null?void 0:t.componentProps)??{},{dataState:a,disabled:u,update:p}=n.useToggleActive(d),m=()=>{u||c&&(c(),p())};return t?s.jsx(n.ActionButton,{action:m,dataState:a,disabled:u,icon:e,shortcutKeys:o,tooltip:i,tooltipOptions:r}):s.jsx(s.Fragment,{})}const l=v.BulletList.extend({addOptions(){var t;return{...(t=this.parent)==null?void 0:t.call(this),button:({editor:e,t:i,extension:o})=>({componentProps:{action:()=>e.commands.toggleBulletList(),isActive:()=>e.isActive("bulletList"),disabled:!1,shortcutKeys:o.options.shortcutKeys??["shift","mod","8"],icon:"List",tooltip:i("editor.bulletlist.tooltip")}})}}});exports.BulletList=l;exports.RichTextBulletList=g;
package/lib/BulletList.js CHANGED
@@ -1,6 +1,6 @@
1
- import { B as d } from "./index-Do_dsOGB.js";
1
+ import { B as d } from "./index-cPEuL4Zr.js";
2
2
  import { jsx as c, Fragment as m } from "react/jsx-runtime";
3
- import { u as f, d as v, A } from "./index-RcSPeQHn.js";
3
+ import { u as f, d as v, A } from "./index-CDFAs4RT.js";
4
4
  import "react";
5
5
  import "./theme.js";
6
6
  function y() {
@@ -28,7 +28,6 @@ function y() {
28
28
  ) : /* @__PURE__ */ c(m, {});
29
29
  }
30
30
  const B = /* @__PURE__ */ d.extend({
31
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
32
31
  //@ts-expect-error
33
32
  addOptions() {
34
33
  var t;
package/lib/Callout.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("./clsx-CXbNJWDD.cjs"),o=require("./index-BnVcq33n.cjs"),t=require("react/jsx-runtime"),x=require("react");require("./theme.cjs");const c=require("lucide-react"),s=require("./select-CYyIeImH.cjs"),k=require("./index-BsFvo9PG.cjs"),j=[{value:"note",label:"Note",icon:c.Info,color:"#1f6feb",background:"#1f6feb1f"},{value:"tip",label:"Tip",icon:c.Lightbulb,color:"#238636",background:"#2386361f"},{value:"important",label:"Important",icon:c.AlertCircle,color:"#ab7df8",background:"#ab7df81f"},{value:"warning",label:"Warning",icon:c.TriangleAlert,color:"#d29922",background:"#d299221f"},{value:"caution",label:"Caution",icon:c.OctagonAlert,color:"#f85149",background:"#f851491f"}];function q({node:e}){const{type:l="note",title:r="",body:u=""}=e.attrs,d=(j.find(h=>h.value===l)||j[0]).icon;return t.jsx(a.NodeViewWrapper,{children:t.jsxs("div",{className:a.clsx("richtext-relative richtext-my-4 richtext-rounded-lg richtext-border richtext-p-4",{"richtext-bg-[#1f6feb1f] richtext-border-[#1f6feb]":l==="note","richtext-bg-[#2386361f] richtext-border-[#238636]":l==="tip","richtext-bg-[#ab7df81f] richtext-border-[#ab7df8]":l==="important","richtext-bg-[#d299221f] richtext-border-[#d29922]":l==="warning","richtext-bg-[#f851491f] richtext-border-[#f85149]":l==="caution"}),children:[t.jsxs("div",{className:a.clsx("richtext-mb-2 richtext-flex richtext-items-center richtext-gap-2",{"richtext-text-[#1f6feb]":l==="note","richtext-text-[#238636]":l==="tip","richtext-text-[#ab7df8]":l==="important","richtext-text-[#d29922]":l==="warning","richtext-text-[#f85149]":l==="caution"}),children:[t.jsx(d,{className:"richtext-size-5"}),t.jsx("span",{className:"richtext-font-semibold",children:r})]}),u&&t.jsx("p",{className:"richtext-pl-[28px]",children:u})]})})}const w=[{value:"note",label:"Note",icon:"Info"},{value:"tip",label:"Tip",icon:"Lightbulb"},{value:"important",label:"Important",icon:"AlertCircle"},{value:"warning",label:"Warning",icon:"TriangleAlert"},{value:"caution",label:"Caution",icon:"OctagonAlert"}];function M(){const{t:e}=k.useLocale(),l=o.useEditorInstance(),r=o.useButtonProps(C.name),[u,n]=x.useState(!1),[d,h]=x.useState("note"),[b,g]=x.useState(""),[f,v]=x.useState(""),{icon:y=void 0,tooltip:T=void 0,shortcutKeys:A=void 0,tooltipOptions:L={},isActive:N=void 0}=(r==null?void 0:r.componentProps)??{},{dataState:S,disabled:m}=o.useToggleActive(N),I=()=>{l&&(l.chain().focus().setCallout({type:d,title:b,body:f}).run(),n(!1),h("note"),g(""),v(""))},O=()=>{m||n(!0)};return r?t.jsxs(o.Dialog,{onOpenChange:n,open:u,children:[t.jsx(o.DialogTrigger,{asChild:!0,children:t.jsx(o.ActionButton,{action:O,dataState:S,disabled:m,icon:y,shortcutKeys:A,tooltip:T,tooltipOptions:L})}),t.jsxs(o.DialogContent,{children:[t.jsx(o.DialogTitle,{children:e("editor.callout.dialog.title")}),t.jsxs("div",{className:"richtext-space-y-4 richtext-py-4",children:[t.jsxs("div",{className:"richtext-space-y-2",children:[t.jsx(o.Label,{children:e("editor.callout.dialog.type")}),t.jsxs(s.Select,{onValueChange:h,value:d,children:[t.jsx(s.SelectTrigger,{children:t.jsx(s.SelectValue,{placeholder:e("editor.callout.dialog.type.placeholder")})}),t.jsx(s.SelectContent,{children:w.map(i=>t.jsx(s.SelectItem,{value:i.value,children:e(`editor.callout.type.${i.value}`)},i.value))})]})]}),t.jsxs("div",{className:"richtext-space-y-2",children:[t.jsx(o.Label,{children:e("editor.callout.dialog.title.label")}),t.jsx(o.Input,{onChange:i=>g(i.target.value),placeholder:e("editor.callout.dialog.title.placeholder"),value:b})]}),t.jsxs("div",{className:"richtext-space-y-2",children:[t.jsx(o.Label,{children:e("editor.callout.dialog.body.label")}),t.jsx(o.Input,{onChange:i=>v(i.target.value),placeholder:e("editor.callout.dialog.body.placeholder"),value:f})]})]}),t.jsxs(o.DialogFooter,{children:[t.jsx(o.Button,{onClick:()=>n(!1),variant:"outline",children:e("editor.callout.dialog.button.cancel")}),t.jsx(o.Button,{onClick:I,children:e("editor.callout.dialog.button.apply")})]})]})]}):t.jsx(t.Fragment,{})}function p(e){return l=>l.getAttribute(e)}const C=a.Node3.create({name:"callout",group:"block",selectable:!0,atom:!0,draggable:!0,inline:!1,addOptions(){var e;return{...(e=this.parent)==null?void 0:e.call(this),HTMLAttributes:{class:"callout"},button:({editor:l,t:r})=>({component:o.ActionButton,componentProps:{action:()=>!0,isActive:()=>l.isActive("callout"),disabled:!1,icon:"Callout",tooltip:r("editor.callout.tooltip")}})}},parseHTML(){return[{tag:"div.callout"}]},renderHTML({HTMLAttributes:e}){return["div",a.mergeAttributes(this.options&&this.options.HTMLAttributes||{},e)]},addAttributes(){return{type:{default:"",parseHTML:p("type")},title:{default:"",parseHTML:p("title")},body:{default:"",parseHTML:p("body")}}},addCommands(){return{setCallout:e=>({chain:l})=>l().insertContent({type:this.name,attrs:e}).run()}},addNodeView(){return a.ReactNodeViewRenderer(q)}});exports.Callout=C;exports.RichTextCallout=M;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const m=require("./index-DwSnESy-.cjs"),h=require("./clsx-BSBE1eoY.cjs"),e=require("./index-BLrMslr7.cjs"),t=require("react/jsx-runtime"),d=require("react");require("./theme.cjs");const n=require("lucide-react"),k=require("./index-BqL4vAWE.cjs"),j=[{value:"note",label:"Note",icon:n.Info,color:"#1f6feb",background:"#1f6feb1f"},{value:"tip",label:"Tip",icon:n.Lightbulb,color:"#238636",background:"#2386361f"},{value:"important",label:"Important",icon:n.AlertCircle,color:"#ab7df8",background:"#ab7df81f"},{value:"warning",label:"Warning",icon:n.TriangleAlert,color:"#d29922",background:"#d299221f"},{value:"caution",label:"Caution",icon:n.OctagonAlert,color:"#f85149",background:"#f851491f"}];function q({node:l}){const{type:o="note",title:i="",body:c=""}=l.attrs,s=(j.find(u=>u.value===o)||j[0]).icon;return t.jsx(h.NodeViewWrapper,{children:t.jsxs("div",{className:h.clsx("richtext-relative richtext-my-4 richtext-rounded-lg richtext-border richtext-p-4",{"richtext-bg-[#1f6feb1f] richtext-border-[#1f6feb]":o==="note","richtext-bg-[#2386361f] richtext-border-[#238636]":o==="tip","richtext-bg-[#ab7df81f] richtext-border-[#ab7df8]":o==="important","richtext-bg-[#d299221f] richtext-border-[#d29922]":o==="warning","richtext-bg-[#f851491f] richtext-border-[#f85149]":o==="caution"}),children:[t.jsxs("div",{className:h.clsx("richtext-mb-2 richtext-flex richtext-items-center richtext-gap-2",{"richtext-text-[#1f6feb]":o==="note","richtext-text-[#238636]":o==="tip","richtext-text-[#ab7df8]":o==="important","richtext-text-[#d29922]":o==="warning","richtext-text-[#f85149]":o==="caution"}),children:[t.jsx(s,{className:"richtext-size-5"}),t.jsx("span",{className:"richtext-font-semibold",children:i})]}),c&&t.jsx("p",{className:"richtext-pl-[28px]",children:c})]})})}const w=[{value:"note",label:"Note",icon:"Info"},{value:"tip",label:"Tip",icon:"Lightbulb"},{value:"important",label:"Important",icon:"AlertCircle"},{value:"warning",label:"Warning",icon:"TriangleAlert"},{value:"caution",label:"Caution",icon:"OctagonAlert"}];function M(){const{t:l}=k.useLocale(),o=e.useEditorInstance(),i=e.useButtonProps(C.name),[c,a]=d.useState(!1),[s,u]=d.useState("note"),[p,b]=d.useState(""),[g,f]=d.useState(""),{icon:y=void 0,tooltip:T=void 0,shortcutKeys:A=void 0,tooltipOptions:L={},isActive:N=void 0}=(i==null?void 0:i.componentProps)??{},{dataState:S,disabled:v}=e.useToggleActive(N),I=()=>{o&&(o.chain().focus().setCallout({type:s,title:p,body:g}).run(),a(!1),u("note"),b(""),f(""))},O=()=>{v||a(!0)};return i?t.jsxs(e.Dialog,{onOpenChange:a,open:c,children:[t.jsx(e.DialogTrigger,{asChild:!0,children:t.jsx(e.ActionButton,{action:O,dataState:S,disabled:v,icon:y,shortcutKeys:A,tooltip:T,tooltipOptions:L})}),t.jsxs(e.DialogContent,{children:[t.jsx(e.DialogTitle,{children:l("editor.callout.dialog.title")}),t.jsxs("div",{className:"richtext-space-y-4 richtext-py-4",children:[t.jsxs("div",{className:"richtext-space-y-2",children:[t.jsx(e.Label,{children:l("editor.callout.dialog.type")}),t.jsxs(e.Select,{onValueChange:u,value:s,children:[t.jsx(e.SelectTrigger,{children:t.jsx(e.SelectValue,{placeholder:l("editor.callout.dialog.type.placeholder")})}),t.jsx(e.SelectContent,{children:w.map(r=>t.jsx(e.SelectItem,{value:r.value,children:l(`editor.callout.type.${r.value}`)},r.value))})]})]}),t.jsxs("div",{className:"richtext-space-y-2",children:[t.jsx(e.Label,{children:l("editor.callout.dialog.title.label")}),t.jsx(e.Input,{onChange:r=>b(r.target.value),placeholder:l("editor.callout.dialog.title.placeholder"),value:p})]}),t.jsxs("div",{className:"richtext-space-y-2",children:[t.jsx(e.Label,{children:l("editor.callout.dialog.body.label")}),t.jsx(e.Input,{onChange:r=>f(r.target.value),placeholder:l("editor.callout.dialog.body.placeholder"),value:g})]})]}),t.jsxs(e.DialogFooter,{children:[t.jsx(e.Button,{onClick:()=>a(!1),variant:"outline",children:l("editor.callout.dialog.button.cancel")}),t.jsx(e.Button,{onClick:I,children:l("editor.callout.dialog.button.apply")})]})]})]}):t.jsx(t.Fragment,{})}function x(l){return o=>o.getAttribute(l)}const C=m.Node3.create({name:"callout",group:"block",selectable:!0,atom:!0,draggable:!0,inline:!1,addOptions(){var l;return{...(l=this.parent)==null?void 0:l.call(this),HTMLAttributes:{class:"callout"},button:({editor:o,t:i})=>({component:e.ActionButton,componentProps:{action:()=>!0,isActive:()=>o.isActive("callout"),disabled:!1,icon:"Callout",tooltip:i("editor.callout.tooltip")}})}},parseHTML(){return[{tag:"div.callout"}]},renderHTML({HTMLAttributes:l}){return["div",m.mergeAttributes(this.options&&this.options.HTMLAttributes||{},l)]},addAttributes(){return{type:{default:"",parseHTML:x("type")},title:{default:"",parseHTML:x("title")},body:{default:"",parseHTML:x("body")}}},addCommands(){return{setCallout:l=>({chain:o})=>o().insertContent({type:this.name,attrs:l}).run()}},addNodeView(){return h.ReactNodeViewRenderer(q)}});exports.Callout=C;exports.RichTextCallout=M;