reactjs-tiptap-editor 1.0.11 → 1.0.13

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 (226) hide show
  1. package/lib/ActionMenuButton-DNj0f_A4.cjs +1 -0
  2. package/lib/{ActionMenuButton-DTXFBdGX.js → ActionMenuButton-l5rSmAO_.js} +18 -14
  3. package/lib/Attachment.cjs +2 -2
  4. package/lib/Attachment.js +24 -21
  5. package/lib/Blockquote.cjs +2 -2
  6. package/lib/Blockquote.js +7 -5
  7. package/lib/Bold.cjs +1 -1
  8. package/lib/Bold.js +11 -9
  9. package/lib/BulletList.cjs +1 -1
  10. package/lib/BulletList.js +14 -12
  11. package/lib/Callout.cjs +1 -0
  12. package/lib/Callout.js +230 -0
  13. package/lib/Clear.cjs +1 -1
  14. package/lib/Clear.js +3 -3
  15. package/lib/Code.cjs +1 -1
  16. package/lib/Code.js +11 -9
  17. package/lib/CodeBlock.cjs +39 -39
  18. package/lib/CodeBlock.js +840 -945
  19. package/lib/CodeView.cjs +1 -1
  20. package/lib/CodeView.js +10 -8
  21. package/lib/Color.cjs +1 -1
  22. package/lib/Color.js +20 -18
  23. package/lib/Column.cjs +1 -1
  24. package/lib/Column.js +7 -5
  25. package/lib/{Drawer-D0yQ0wR7.js → Drawer-Cbi_MURj.js} +10 -9
  26. package/lib/Drawer-DKU32YW_.cjs +1 -0
  27. package/lib/Drawer.cjs +1 -1
  28. package/lib/Drawer.js +3 -3
  29. package/lib/Emoji.cjs +1 -1
  30. package/lib/Emoji.js +11 -9
  31. package/lib/{Excalidraw-CO4IRHmG.js → Excalidraw-CWrVL5hs.js} +28 -27
  32. package/lib/Excalidraw-Kb-TRcWY.cjs +1 -0
  33. package/lib/Excalidraw.cjs +1 -1
  34. package/lib/Excalidraw.js +2 -2
  35. package/lib/ExportPdf.cjs +2 -2
  36. package/lib/ExportPdf.js +7 -5
  37. package/lib/ExportWord.cjs +1 -1
  38. package/lib/ExportWord.js +7 -5
  39. package/lib/FontFamily.cjs +1 -1
  40. package/lib/FontFamily.js +9 -8
  41. package/lib/FontSize.cjs +1 -1
  42. package/lib/FontSize.js +13 -12
  43. package/lib/Heading.cjs +1 -1
  44. package/lib/Heading.js +20 -19
  45. package/lib/Highlight.cjs +1 -1
  46. package/lib/Highlight.js +9 -7
  47. package/lib/History.cjs +1 -1
  48. package/lib/History.js +11 -8
  49. package/lib/HorizontalRule.cjs +1 -1
  50. package/lib/HorizontalRule.js +7 -5
  51. package/lib/Icon-Ctva8VeB.js +12 -0
  52. package/lib/Icon-yqCglrdK.cjs +1 -0
  53. package/lib/Iframe-BczF8Hex.cjs +1 -0
  54. package/lib/{Iframe-BEO28NPs.js → Iframe-C942bNjs.js} +42 -40
  55. package/lib/Iframe.cjs +1 -1
  56. package/lib/Iframe.js +2 -2
  57. package/lib/Image.cjs +1 -1
  58. package/lib/Image.js +25 -23
  59. package/lib/ImageGif.cjs +1 -1
  60. package/lib/ImageGif.js +50 -48
  61. package/lib/ImportWord.cjs +31 -31
  62. package/lib/ImportWord.js +8 -6
  63. package/lib/{Indent-CXurBbOr.js → Indent-C_O5WdyR.js} +26 -24
  64. package/lib/Indent-CkEC7x36.cjs +1 -0
  65. package/lib/Indent.cjs +1 -1
  66. package/lib/Indent.js +2 -2
  67. package/lib/Italic.cjs +1 -1
  68. package/lib/Italic.js +12 -10
  69. package/lib/{Katex-Bvj469K1.js → Katex-D3PEWimM.js} +12 -10
  70. package/lib/Katex-DW_HjgNM.cjs +4 -0
  71. package/lib/Katex.cjs +1 -1
  72. package/lib/Katex.js +2 -2
  73. package/lib/LineHeight.cjs +1 -1
  74. package/lib/LineHeight.js +10 -8
  75. package/lib/Link.cjs +1 -1
  76. package/lib/Link.js +2 -2
  77. package/lib/{LinkEditBlock-8ePAZ-G1.cjs → LinkEditBlock-DL1e2ILk.cjs} +1 -1
  78. package/lib/{LinkEditBlock-DjXUEubR.js → LinkEditBlock-h5054QDo.js} +22 -20
  79. package/lib/Mention.cjs +1 -1
  80. package/lib/Mention.js +3 -3
  81. package/lib/Mermaid.cjs +2 -2
  82. package/lib/Mermaid.js +8 -8
  83. package/lib/MoreMark.cjs +1 -1
  84. package/lib/MoreMark.js +25 -22
  85. package/lib/OrderedList.cjs +1 -1
  86. package/lib/OrderedList.js +10 -8
  87. package/lib/SearchAndReplace.cjs +1 -1
  88. package/lib/SearchAndReplace.js +43 -41
  89. package/lib/SlashCommand.cjs +1 -1
  90. package/lib/SlashCommand.js +6 -6
  91. package/lib/SlashCommandNodeView-BqrmHCpu.cjs +1 -0
  92. package/lib/{SlashCommandNodeView-CcqL8ymb.js → SlashCommandNodeView-DXUqkx82.js} +75 -66
  93. package/lib/Strike.cjs +1 -1
  94. package/lib/Strike.js +7 -5
  95. package/lib/{Table-9Y0Cg8Ab.js → Table-DdrY4jcM.js} +10 -8
  96. package/lib/Table-kY0nbqJo.cjs +9 -0
  97. package/lib/Table.cjs +1 -1
  98. package/lib/Table.js +1 -1
  99. package/lib/TaskList.cjs +1 -1
  100. package/lib/TaskList.js +15 -13
  101. package/lib/TextAlign.cjs +1 -1
  102. package/lib/TextAlign.js +20 -17
  103. package/lib/TextDirection.cjs +1 -1
  104. package/lib/TextDirection.js +20 -17
  105. package/lib/TextUnderline.cjs +1 -1
  106. package/lib/TextUnderline.js +7 -5
  107. package/lib/{Twitter-DWwd0vHR.js → Twitter-B-JQ3ZJ1.js} +51 -49
  108. package/lib/Twitter-DjZcVa3l.cjs +1 -0
  109. package/lib/Twitter.cjs +1 -1
  110. package/lib/Twitter.js +2 -2
  111. package/lib/Video.cjs +1 -1
  112. package/lib/Video.js +13 -11
  113. package/lib/bubble.cjs +4 -4
  114. package/lib/bubble.js +2084 -1949
  115. package/lib/button-BS3n6_Aq.cjs +1 -0
  116. package/lib/{button-RnHbJfd-.js → button-Uv01FNnd.js} +9 -8
  117. package/lib/{checkbox-CTEN0q4y.cjs → checkbox-C8ByRi7-.cjs} +1 -1
  118. package/lib/{checkbox-CLSoR1Qj.js → checkbox-DEFNwGwb.js} +1 -1
  119. package/lib/{index-sVScpCFG.js → clsx-BWSGDJNJ.js} +224 -224
  120. package/lib/{index-BBNITgNi.cjs → clsx-CXbNJWDD.cjs} +13 -13
  121. package/lib/components/Bubble/RichTextBubbleCallout.d.ts +1 -0
  122. package/lib/components/Bubble/index.d.ts +1 -0
  123. package/lib/components/ui/index.d.ts +1 -0
  124. package/lib/{dialog-CMC9hsCo.cjs → dialog-Bt5zwGYB.cjs} +1 -1
  125. package/lib/{dialog-D_HCtKvc.js → dialog-DwTMZSt6.js} +1 -1
  126. package/lib/{dropdown-menu-66q7Ofc5.js → dropdown-menu-BetI14G6.js} +1 -1
  127. package/lib/{dropdown-menu-DKSAS-w_.cjs → dropdown-menu-Bo68IEOT.cjs} +1 -1
  128. package/lib/events.constant-Dq21NPdV.cjs +1 -0
  129. package/lib/events.constant-do95b767.js +21 -0
  130. package/lib/extensions/Callout/Callout.d.ts +18 -0
  131. package/lib/extensions/Callout/components/NodeViewCallout/NodeViewCallout.d.ts +1 -0
  132. package/lib/extensions/Callout/components/RichTextCallout.d.ts +1 -0
  133. package/lib/extensions/Callout/index.d.ts +1 -0
  134. package/lib/{index-CApXPpjF.cjs → index-BCzvbrf5.cjs} +1 -1
  135. package/lib/{index-9A6-kVBM.js → index-BDKHXe7R.js} +1 -1
  136. package/lib/{index-DmPwbBqm.js → index-CHKWG6E8.js} +1 -1
  137. package/lib/index-CcoWj0mF.js +426 -0
  138. package/lib/index-CjhjjJsN.cjs +1 -0
  139. package/lib/index-Cs6cp0Y6.cjs +1 -0
  140. package/lib/index-D3RLYf-J.cjs +1 -0
  141. package/lib/{index-C3zg3DPB.js → index-DF5ZPtWM.js} +371 -1177
  142. package/lib/{index-DRHrDScg.js → index-DJbmnBzK.js} +1 -1
  143. package/lib/index-Doks9cbR.cjs +1 -0
  144. package/lib/{index-0OnGZkVF.js → index-Dujzr6bY.js} +179 -317
  145. package/lib/index-VhKd73hZ.cjs +1 -0
  146. package/lib/{index-DKt5wfAc.js → index-mR8PNv5P.js} +1 -1
  147. package/lib/{index--nUS7Y66.cjs → index-neeeY2o7.cjs} +3 -3
  148. package/lib/index.cjs +9 -2
  149. package/lib/index.js +142 -26
  150. package/lib/{input-CvyMYMZG.js → input-DUBdJD3L.js} +5 -5
  151. package/lib/{input-D555880-.cjs → input-Dt_BA_9B.cjs} +1 -1
  152. package/lib/{isNumber-Bv1Qhmw8.cjs → isNumber-BTYSVlKo.cjs} +1 -1
  153. package/lib/{isNumber-DF0fU3ob.js → isNumber-CIgubz2e.js} +1 -1
  154. package/lib/label-JNOksCA-.cjs +1 -0
  155. package/lib/label-topD46-u.js +19 -0
  156. package/lib/locale-bundle.cjs +1 -1
  157. package/lib/locale-bundle.js +6 -7
  158. package/lib/locales/en.d.ts +16 -0
  159. package/lib/locales/fi.d.ts +16 -0
  160. package/lib/locales/hu.d.ts +16 -0
  161. package/lib/locales/index.d.ts +99 -4316
  162. package/lib/locales/pt-br.d.ts +16 -0
  163. package/lib/locales/vi.d.ts +16 -0
  164. package/lib/locales/zh-cn.d.ts +16 -0
  165. package/lib/{popover-B7ec5-u2.js → popover-LfNBhRyz.js} +1 -1
  166. package/lib/{popover-BSzR_R01.cjs → popover-mL-2sX5r.cjs} +1 -1
  167. package/lib/react-BEoMZB61.cjs +1 -0
  168. package/lib/react-c9FSfB30.js +27 -0
  169. package/lib/select-CwGYPsPq.cjs +1 -0
  170. package/lib/select-DctYuHLH.js +117 -0
  171. package/lib/separator-Ddfrhn4D.js +329 -0
  172. package/lib/separator-NoH_SLRW.cjs +1 -0
  173. package/lib/store/EditorEditableReactive.d.ts +1 -0
  174. package/lib/store/ThemeColorReactive.d.ts +1 -0
  175. package/lib/store/commandList.d.ts +1 -1
  176. package/lib/store/store.d.ts +6 -7
  177. package/lib/store-CkjKIgjQ.cjs +1 -0
  178. package/lib/store-DNpS8vXA.js +10 -0
  179. package/lib/style.css +1 -1
  180. package/lib/{tabs-CWr9HYaM.js → tabs-BT3AeqQQ.js} +1 -1
  181. package/lib/{tabs-BTwiZkWd.cjs → tabs-DRSwUeKP.cjs} +1 -1
  182. package/lib/{textarea-Yetl_PZi.cjs → textarea-BDO6XQoF.cjs} +1 -1
  183. package/lib/{textarea-BdeLXbp8.js → textarea-DZzMEDfZ.js} +1 -1
  184. package/lib/theme/theme.d.ts +5 -0
  185. package/lib/theme.cjs +1 -1
  186. package/lib/theme.js +37 -8
  187. package/lib/{throttle-DsowOft0.js → throttle-IERhwcLa.js} +1 -1
  188. package/lib/throttle-gTTvqDTW.cjs +1 -0
  189. package/lib/toggle-BQHMh_Q-.cjs +1 -0
  190. package/lib/toggle-DKHg5sLm.js +99 -0
  191. package/lib/tooltip-BYtGp6FM.cjs +1 -0
  192. package/lib/tooltip-DNKq7zgN.js +24 -0
  193. package/lib/{updatePosition-Bbd8ETMv.js → updatePosition-Bie75EFq.js} +2 -2
  194. package/lib/updatePosition-Cjuj2E26.cjs +1 -0
  195. package/lib/useButtonProps-DBJkNDS2.cjs +1 -0
  196. package/lib/{useButtonProps-cMoicZgd.js → useButtonProps-DVP4s_ER.js} +48 -36
  197. package/lib/utils/customEvents/events.constant.d.ts +0 -5
  198. package/package.json +3 -3
  199. package/lib/ActionMenuButton-BLlse5KO.cjs +0 -1
  200. package/lib/Drawer-kv6BU_6O.cjs +0 -1
  201. package/lib/Excalidraw-B82ThkJA.cjs +0 -1
  202. package/lib/Icon-DRuJhcHK.js +0 -10
  203. package/lib/Icon-DXePECFW.cjs +0 -1
  204. package/lib/Iframe-03dn9wcM.cjs +0 -1
  205. package/lib/Indent-Cqjdn3Jt.cjs +0 -1
  206. package/lib/Katex-DdWTV5NJ.cjs +0 -4
  207. package/lib/SlashCommandNodeView-Bl_gwZJB.cjs +0 -1
  208. package/lib/Table-DBGjezZK.cjs +0 -9
  209. package/lib/Twitter-Cnvt7GBg.cjs +0 -1
  210. package/lib/button-BW5bDPz_.cjs +0 -1
  211. package/lib/events.constant-DQYeJpu5.cjs +0 -1
  212. package/lib/events.constant-wrlJ_7JZ.js +0 -26
  213. package/lib/index-BZ6DfR2r.cjs +0 -1
  214. package/lib/index-C838s-or.cjs +0 -8
  215. package/lib/index-Cv9Z6dyV.cjs +0 -1
  216. package/lib/index-FSRjMsxW.cjs +0 -1
  217. package/lib/label-DsOYPjAo.js +0 -18
  218. package/lib/label-E6jF3Xud.cjs +0 -1
  219. package/lib/separator-JaTTqb3J.js +0 -241
  220. package/lib/separator-PGnA-6Hr.cjs +0 -1
  221. package/lib/store/ProviderUniqueId.d.ts +0 -6
  222. package/lib/store-Cf7tFiiI.js +0 -10
  223. package/lib/store-oDk-lTPM.cjs +0 -1
  224. package/lib/throttle-BM3Bmbf_.cjs +0 -1
  225. package/lib/updatePosition-M2IyqkI1.cjs +0 -1
  226. package/lib/useButtonProps-DfnJiJLV.cjs +0 -1
@@ -0,0 +1 @@
1
+ "use strict";const e=require("react/jsx-runtime"),a=require("react"),s=require("@radix-ui/react-slot");require("./index-D3RLYf-J.cjs");require("./theme.cjs");const d=require("./useButtonProps-DBJkNDS2.cjs"),u=require("./button-BS3n6_Aq.cjs"),m=require("./index-VhKd73hZ.cjs"),c=require("./tooltip-BYtGp6FM.cjs"),f=a.forwardRef(({asChild:h=!1,tooltip:i,...t},r)=>{var x;const n=m.icons[t.icon],l=h?s.Slot:u.Button;return e.jsxs(c.Tooltip,{children:[e.jsx(c.TooltipTrigger,{asChild:!0,children:e.jsx(l,{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:r,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}),n&&e.jsx(n,{className:"richtext-ml-1 richtext-size-3 richtext-shrink-0 richtext-text-zinc-500"})]})})}),i&&e.jsx(c.TooltipContent,{children:e.jsxs("div",{className:"richtext-flex richtext-max-w-24 richtext-flex-col richtext-items-center richtext-text-center",children:[i&&e.jsx("div",{children:i}),e.jsx("div",{className:"richtext-flex",children:!!((x=t==null?void 0:t.shortcutKeys)!=null&&x.length)&&e.jsx("span",{children:d.getShortcutKeys(t==null?void 0:t.shortcutKeys)})})]})})]})});exports.ActionMenuButton=f;
@@ -1,20 +1,24 @@
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, g as u } from "./index-C3zg3DPB.js";
5
- import { B as o } from "./button-RnHbJfd-.js";
6
- const C = n.forwardRef(
7
- ({ asChild: x = !1, tooltip: i, ...t }, l) => {
2
+ import l from "react";
3
+ import { Slot as n } from "@radix-ui/react-slot";
4
+ import "./index-DF5ZPtWM.js";
5
+ import "./theme.js";
6
+ import { g as m } from "./useButtonProps-DVP4s_ER.js";
7
+ import { B as d } from "./button-Uv01FNnd.js";
8
+ import { i as f } from "./index-CcoWj0mF.js";
9
+ import { T as o, a as s, b as u } from "./tooltip-DNKq7zgN.js";
10
+ const S = l.forwardRef(
11
+ ({ asChild: r = !1, tooltip: i, ...t }, x) => {
8
12
  var a;
9
- const h = d[t.icon];
10
- return /* @__PURE__ */ c(m, { children: [
11
- /* @__PURE__ */ e(f, { asChild: !0, children: /* @__PURE__ */ e(
12
- x ? r : o,
13
+ const h = f[t.icon];
14
+ return /* @__PURE__ */ c(o, { children: [
15
+ /* @__PURE__ */ e(s, { asChild: !0, children: /* @__PURE__ */ e(
16
+ r ? n : d,
13
17
  {
14
18
  className: "richtext-h-[32px] richtext-min-w-24 richtext-overflow-hidden richtext-px-[5px] richtext-py-0",
15
19
  "data-state": t != null && t.dataState ? "on" : "off",
16
20
  disabled: t == null ? void 0 : t.disabled,
17
- ref: l,
21
+ ref: x,
18
22
  variant: "ghost",
19
23
  ...t,
20
24
  children: /* @__PURE__ */ c("div", { className: "richtext-flex richtext-h-full richtext-items-center richtext-font-normal", children: [
@@ -23,13 +27,13 @@ const C = n.forwardRef(
23
27
  ] })
24
28
  }
25
29
  ) }),
26
- i && /* @__PURE__ */ e(s, { children: /* @__PURE__ */ c("div", { className: "richtext-flex richtext-max-w-24 richtext-flex-col richtext-items-center richtext-text-center", children: [
30
+ i && /* @__PURE__ */ e(u, { children: /* @__PURE__ */ c("div", { className: "richtext-flex richtext-max-w-24 richtext-flex-col richtext-items-center richtext-text-center", children: [
27
31
  i && /* @__PURE__ */ e("div", { children: i }),
28
- /* @__PURE__ */ e("div", { className: "richtext-flex", children: !!((a = t == null ? void 0 : t.shortcutKeys) != null && a.length) && /* @__PURE__ */ e("span", { children: u(t == null ? void 0 : t.shortcutKeys) }) })
32
+ /* @__PURE__ */ e("div", { className: "richtext-flex", children: !!((a = t == null ? void 0 : t.shortcutKeys) != null && a.length) && /* @__PURE__ */ e("span", { children: m(t == null ? void 0 : t.shortcutKeys) }) })
29
33
  ] }) })
30
34
  ] });
31
35
  }
32
36
  );
33
37
  export {
34
- C as A
38
+ S as A
35
39
  };
@@ -1,4 +1,4 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("./index-BBNITgNi.cjs"),x=require("./index-C838s-or.cjs"),e=require("react/jsx-runtime"),m=require("react"),v=require("lucide-react"),w=require("./file-i7e4nQY2.cjs"),S=require("./index-FSRjMsxW.cjs"),d=require("./dom-dataset-BqoJhJXt.cjs"),L=require("./useButtonProps-DfnJiJLV.cjs"),_={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 l=require("./clsx-CXbNJWDD.cjs"),A=require("./toggle-BQHMh_Q-.cjs"),e=require("react/jsx-runtime"),m=require("react"),q=require("./index-D3RLYf-J.cjs");require("./theme.cjs");const v=require("lucide-react"),L=require("./index-VhKd73hZ.cjs"),f=require("./file-i7e4nQY2.cjs"),_=require("./index-Doks9cbR.cjs"),d=require("./dom-dataset-BqoJhJXt.cjs"),C=require("./useButtonProps-DBJkNDS2.cjs"),R={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 q(t){const n=_[t],a=new DOMParser().parseFromString(n,"image/svg+xml").documentElement,s=["svg",{...Array.from(a.attributes).reduce((i,o)=>(i[o.name]=o.value,i),{})}];return Array.from(a.childNodes).forEach(i=>{if(i.nodeType===1){const o=[i.tagName.toLowerCase(),Array.from(i.attributes).reduce((u,h)=>(u[h.name]=h.value,u),{})];i.textContent&&o.push(i.textContent),s.push(o)}}),s}const R={audio:e.jsx(v.LucideAudioLines,{}),video:e.jsx(v.LucideVideo,{}),file:e.jsx(v.LucideFile,{}),image:e.jsx(v.LucideImage,{}),pdf:e.jsx(x.ExportPdf,{}),word:e.jsx(x.ExportWord,{}),excel:e.jsx(v.LucideSheet,{}),ppt:e.jsx(v.LucideTableProperties,{})};function C(t,n=!1){const r=w.normalizeFileType(t),c=R[r]||e.jsx(e.Fragment,{});return n?q(r):c}const P="_wrap_17afc_2",A={wrap:P};function $({editor:t,node:n,updateAttributes:r,deleteNode:c,extension:a}){var T;const s=m.useRef(null),i=x.useEditableEditor(),{hasTrigger:o,fileName:u,fileSize:h,fileExt:N,fileType:z,url:p,error:M}=n.attrs,[E,y]=m.useState(!1),{t:k}=S.useLocale(),F=(T=a==null?void 0:a.options)==null?void 0:T.upload,f=m.useCallback(()=>{!i||p||s.current.click()},[p,i]),V=m.useCallback(async b=>{const g=b.target.files&&b.target.files[0];if(!g)return;const D={fileName:w.extractFilename(g.name),fileSize:g.size,fileType:g.type,fileExt:w.extractFileExtension(g.name)};y(!0);try{const j=await F(g);r({...D,url:j}),y(!1)}catch(j){r({error:`File upload fail: ${j&&j.message}`||"Unknown error"}),y(!1),s.current.value=""}},[y,r]);m.useEffect(()=>{!p&&!o&&(f(),r({hasTrigger:!0}))},[p,o,f,r]);const B=m.useCallback(()=>c(),[t]);return i&&!p?e.jsx(l.NodeViewWrapper,{children:e.jsxs("div",{className:l.clsx(A.wrap,"render-wrapper"),children:[e.jsx("p",{onClick:f,style:{cursor:"pointer"},children:E?e.jsx("span",{children:k("editor.attachment.uploading")}):e.jsx("span",{children:k("editor.attachment.please_upload")})}),e.jsx("input",{hidden:!0,onChange:V,ref:s,type:"file"})]})}):p?e.jsx(l.NodeViewWrapper,{children:e.jsxs("div",{className:l.clsx(A.wrap,"render-wrapper"),onClick:f,children:[e.jsxs("div",{className:"richtext-flex richtext-items-center richtext-gap-[4px]",children:[e.jsx("span",{children:C(z)}),e.jsxs("span",{children:[u,".",N]}),e.jsxs("span",{children:["(",w.normalizeFileSize(h),")"]})]}),e.jsx(x.ActionButton,{action:B,icon:"Trash2",tooltip:k("editor.delete")})]})}):M!=="null"?e.jsx(l.NodeViewWrapper,{children:e.jsx("div",{className:l.clsx(A.wrap,"render-wrapper"),onClick:f,children:e.jsx("p",{children:M})})}):e.jsx(e.Fragment,{})}function I(){const t=L.useButtonProps(H.name),{icon:n=void 0,tooltip:r=void 0,shortcutKeys:c=void 0,tooltipOptions:a={},action:s=void 0,isActive:i=void 0}=(t==null?void 0:t.componentProps)??{},{editorDisabled:o,update:u}=L.useToggleActive(i),h=()=>{o||s&&(s(),u())};return t?e.jsx(x.ActionButton,{action:h,disabled:o,icon:n,shortcutKeys:c,tooltip:r,tooltipOptions:a}):e.jsx(e.Fragment,{})}const H=l.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:x.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:a="",fileExt:s=""}=t||{};return["div",l.mergeAttributes(this.options.HTMLAttributes||{},t||{}),n?["a",{href:n||"#"},["span",{class:"attachment__icon"},C(a,!0)],["span",{class:"attachment__text"},`${r}.${s} (${w.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 l.ReactNodeViewRenderer($)}});exports.Attachment=H;exports.RichTextAttachment=I;
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 P(t){const n=R[t],a=new DOMParser().parseFromString(n,"image/svg+xml").documentElement,s=["svg",{...Array.from(a.attributes).reduce((i,o)=>(i[o.name]=o.value,i),{})}];return Array.from(a.childNodes).forEach(i=>{if(i.nodeType===1){const o=[i.tagName.toLowerCase(),Array.from(i.attributes).reduce((u,h)=>(u[h.name]=h.value,u),{})];i.textContent&&o.push(i.textContent),s.push(o)}}),s}const $={audio:e.jsx(v.LucideAudioLines,{}),video:e.jsx(v.LucideVideo,{}),file:e.jsx(v.LucideFile,{}),image:e.jsx(v.LucideImage,{}),pdf:e.jsx(L.ExportPdf,{}),word:e.jsx(L.ExportWord,{}),excel:e.jsx(v.LucideSheet,{}),ppt:e.jsx(v.LucideTableProperties,{})};function H(t,n=!1){const r=f.normalizeFileType(t),c=$[r]||e.jsx(e.Fragment,{});return n?P(r):c}const I="_wrap_17afc_2",k={wrap:I};function O({editor:t,node:n,updateAttributes:r,deleteNode:c,extension:a}){var T;const s=m.useRef(null),i=q.useEditableEditor(),{hasTrigger:o,fileName:u,fileSize:h,fileExt:z,fileType:E,url:p,error:M}=n.attrs,[F,w]=m.useState(!1),{t:j}=_.useLocale(),V=(T=a==null?void 0:a.options)==null?void 0:T.upload,x=m.useCallback(()=>{!i||p||s.current.click()},[p,i]),B=m.useCallback(async b=>{const g=b.target.files&&b.target.files[0];if(!g)return;const S={fileName:f.extractFilename(g.name),fileSize:g.size,fileType:g.type,fileExt:f.extractFileExtension(g.name)};w(!0);try{const y=await V(g);r({...S,url:y}),w(!1)}catch(y){r({error:`File upload fail: ${y&&y.message}`||"Unknown error"}),w(!1),s.current.value=""}},[w,r]);m.useEffect(()=>{!p&&!o&&(x(),r({hasTrigger:!0}))},[p,o,x,r]);const D=m.useCallback(()=>c(),[t]);return i&&!p?e.jsx(l.NodeViewWrapper,{children:e.jsxs("div",{className:l.clsx(k.wrap,"render-wrapper"),children:[e.jsx("p",{onClick:x,style:{cursor:"pointer"},children:F?e.jsx("span",{children:j("editor.attachment.uploading")}):e.jsx("span",{children:j("editor.attachment.please_upload")})}),e.jsx("input",{hidden:!0,onChange:B,ref:s,type:"file"})]})}):p?e.jsx(l.NodeViewWrapper,{children:e.jsxs("div",{className:l.clsx(k.wrap,"render-wrapper"),onClick:x,children:[e.jsxs("div",{className:"richtext-flex richtext-items-center richtext-gap-[4px]",children:[e.jsx("span",{children:H(E)}),e.jsxs("span",{children:[u,".",z]}),e.jsxs("span",{children:["(",f.normalizeFileSize(h),")"]})]}),e.jsx(A.ActionButton,{action:D,icon:"Trash2",tooltip:j("editor.delete")})]})}):M!=="null"?e.jsx(l.NodeViewWrapper,{children:e.jsx("div",{className:l.clsx(k.wrap,"render-wrapper"),onClick:x,children:e.jsx("p",{children:M})})}):e.jsx(e.Fragment,{})}function W(){const t=C.useButtonProps(N.name),{icon:n=void 0,tooltip:r=void 0,shortcutKeys:c=void 0,tooltipOptions:a={},action:s=void 0,isActive:i=void 0}=(t==null?void 0:t.componentProps)??{},{editorDisabled:o,update:u}=C.useToggleActive(i),h=()=>{o||s&&(s(),u())};return t?e.jsx(A.ActionButton,{action:h,disabled:o,icon:n,shortcutKeys:c,tooltip:r,tooltipOptions:a}):e.jsx(e.Fragment,{})}const N=l.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:A.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:a="",fileExt:s=""}=t||{};return["div",l.mergeAttributes(this.options.HTMLAttributes||{},t||{}),n?["a",{href:n||"#"},["span",{class:"attachment__icon"},H(a,!0)],["span",{class:"attachment__text"},`${r}.${s} (${f.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 l.ReactNodeViewRenderer(O)}});exports.Attachment=N;exports.RichTextAttachment=W;
package/lib/Attachment.js CHANGED
@@ -1,12 +1,15 @@
1
- import { q as x, C as y, N as j, u as D, m as P } from "./index-sVScpCFG.js";
2
- import { E as R, l as $, k as I, A as T } from "./index-C3zg3DPB.js";
1
+ import { h as x, j as y, N as j, k as D, m as P } from "./clsx-BWSGDJNJ.js";
2
+ import { A as T } from "./toggle-DKHg5sLm.js";
3
3
  import { jsx as e, Fragment as L, jsxs as f } from "react/jsx-runtime";
4
- import { useRef as O, useState as Z, useCallback as k, useEffect as W } from "react";
5
- import { LucideTableProperties as q, LucideSheet as K, LucideImage as U, LucideFile as G, LucideVideo as J, LucideAudioLines as Q } from "lucide-react";
4
+ import { useRef as R, useState as $, useCallback as k, useEffect as I } from "react";
5
+ import { a as O } from "./index-DF5ZPtWM.js";
6
+ import "./theme.js";
7
+ import { LucideTableProperties as Z, LucideSheet as W, LucideImage as K, LucideFile as U, LucideVideo as q, LucideAudioLines as G } from "lucide-react";
8
+ import { E as J, a as Q } from "./index-CcoWj0mF.js";
6
9
  import { n as X, e as Y, a as ee, b as N } from "./file-BLas99n7.js";
7
- import { u as te } from "./index-0OnGZkVF.js";
10
+ import { u as te } from "./index-Dujzr6bY.js";
8
11
  import { g as c } from "./dom-dataset-CIEeltF6.js";
9
- import { u as re, a as ie } from "./useButtonProps-cMoicZgd.js";
12
+ import { u as re, a as ie } from "./useButtonProps-DVP4s_ER.js";
10
13
  const oe = {
11
14
  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>',
12
15
  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>',
@@ -53,14 +56,14 @@ function ne(t) {
53
56
  }), n;
54
57
  }
55
58
  const ae = {
56
- audio: /* @__PURE__ */ e(Q, {}),
57
- video: /* @__PURE__ */ e(J, {}),
58
- file: /* @__PURE__ */ e(G, {}),
59
- image: /* @__PURE__ */ e(U, {}),
60
- pdf: /* @__PURE__ */ e($, {}),
61
- word: /* @__PURE__ */ e(R, {}),
62
- excel: /* @__PURE__ */ e(K, {}),
63
- ppt: /* @__PURE__ */ e(q, {})
59
+ audio: /* @__PURE__ */ e(G, {}),
60
+ video: /* @__PURE__ */ e(q, {}),
61
+ file: /* @__PURE__ */ e(U, {}),
62
+ image: /* @__PURE__ */ e(K, {}),
63
+ pdf: /* @__PURE__ */ e(Q, {}),
64
+ word: /* @__PURE__ */ e(J, {}),
65
+ excel: /* @__PURE__ */ e(W, {}),
66
+ ppt: /* @__PURE__ */ e(Z, {})
64
67
  };
65
68
  function b(t, o = !1) {
66
69
  const r = X(t), l = ae[r] || /* @__PURE__ */ e(L, {});
@@ -70,12 +73,12 @@ const se = "_wrap_17afc_2", M = {
70
73
  wrap: se
71
74
  };
72
75
  function le({ editor: t, node: o, updateAttributes: r, deleteNode: l, extension: s }) {
73
- var C;
74
- const n = O(null), i = I(), { hasTrigger: a, fileName: d, fileSize: h, fileExt: E, fileType: z, url: u, error: H } = o.attrs, [F, v] = Z(!1), { t: w } = te(), V = (C = s == null ? void 0 : s.options) == null ? void 0 : C.upload, m = k(() => {
76
+ var A;
77
+ const n = R(null), i = O(), { hasTrigger: a, fileName: d, fileSize: h, fileExt: E, fileType: z, url: u, error: H } = o.attrs, [F, v] = $(!1), { t: w } = te(), V = (A = s == null ? void 0 : s.options) == null ? void 0 : A.upload, m = k(() => {
75
78
  !i || u || n.current.click();
76
79
  }, [u, i]), B = k(
77
- async (A) => {
78
- const p = A.target.files && A.target.files[0];
80
+ async (C) => {
81
+ const p = C.target.files && C.target.files[0];
79
82
  if (!p)
80
83
  return;
81
84
  const _ = {
@@ -94,7 +97,7 @@ function le({ editor: t, node: o, updateAttributes: r, deleteNode: l, extension:
94
97
  },
95
98
  [v, r]
96
99
  );
97
- W(() => {
100
+ I(() => {
98
101
  !u && !a && (m(), r({ hasTrigger: !0 }));
99
102
  }, [u, a, m, r]);
100
103
  const S = k(() => l(), [t]);
@@ -154,7 +157,7 @@ function le({ editor: t, node: o, updateAttributes: r, deleteNode: l, extension:
154
157
  }
155
158
  ) }) : /* @__PURE__ */ e(L, {});
156
159
  }
157
- function xe() {
160
+ function Me() {
158
161
  const t = re(ce.name), {
159
162
  icon: o = void 0,
160
163
  tooltip: r = void 0,
@@ -282,5 +285,5 @@ const ce = /* @__PURE__ */ j.create({
282
285
  });
283
286
  export {
284
287
  ce as Attachment,
285
- xe as RichTextAttachment
288
+ Me as RichTextAttachment
286
289
  };
@@ -1,5 +1,5 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("./index-BBNITgNi.cjs"),a=require("./jsx-runtime-C_NLcKys.cjs"),l=require("react/jsx-runtime"),g=require("./index-C838s-or.cjs");require("react");const p=require("./useButtonProps-DfnJiJLV.cjs");var m=/^\s*>\s$/,b=c.Node3.create({name:"blockquote",addOptions(){return{HTMLAttributes:{}}},content:"block+",group:"block",defining:!0,parseHTML(){return[{tag:"blockquote"}]},renderHTML({HTMLAttributes:t}){return a.h("blockquote",{...c.mergeAttributes(this.options.HTMLAttributes,t),children:a.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(`
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("./clsx-CXbNJWDD.cjs"),d=require("./jsx-runtime-C_NLcKys.cjs"),l=require("react/jsx-runtime"),k=require("./toggle-BQHMh_Q-.cjs");require("react");require("./index-D3RLYf-J.cjs");require("./theme.cjs");const p=require("./useButtonProps-DBJkNDS2.cjs");var m=/^\s*>\s$/,b=c.Node3.create({name:"blockquote",addOptions(){return{HTMLAttributes:{}}},content:"block+",group:"block",defining:!0,parseHTML(){return[{tag:"blockquote"}]},renderHTML({HTMLAttributes:t}){return d.h("blockquote",{...c.mergeAttributes(this.options.HTMLAttributes,t),children:d.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
2
  `).map(r=>r.trim()===""?o:`${o} ${r}`);n.push(u.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:m,type:this.type})]}});function f(){const t=p.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}=p.useToggleActive(d),k=()=>{r||s&&(s(),q())};return t?l.jsx(g.ActionButton,{action:k,dataState:u,disabled:r,icon:e,shortcutKeys:n,tooltip:o,tooltipOptions:i}):l.jsx(l.Fragment,{})}const h=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=h;exports.RichTextBlockquote=f;
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:m,type:this.type})]}});function f(){const t=p.useButtonProps(q.name),{icon:e=void 0,tooltip:o=void 0,shortcutKeys:n=void 0,tooltipOptions:i={},action:s=void 0,isActive:a=void 0}=(t==null?void 0:t.componentProps)??{},{dataState:u,disabled:r,update:h}=p.useToggleActive(a),g=()=>{r||s&&(s(),h())};return t?l.jsx(k.ActionButton,{action:g,dataState:u,disabled:r,icon:e,shortcutKeys:n,tooltip:o,tooltipOptions:i}):l.jsx(l.Fragment,{})}const q=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=q;exports.RichTextBlockquote=f;
package/lib/Blockquote.js CHANGED
@@ -1,9 +1,11 @@
1
- import { N as m, w as h, m as k } from "./index-sVScpCFG.js";
1
+ import { N as m, w as h, m as k } from "./clsx-BWSGDJNJ.js";
2
2
  import { h as a } from "./jsx-runtime-CT7Pcg-t.js";
3
3
  import { jsx as l, Fragment as f } from "react/jsx-runtime";
4
- import { A as g } from "./index-C3zg3DPB.js";
4
+ import { A as g } from "./toggle-DKHg5sLm.js";
5
5
  import "react";
6
- import { u as b, a as q } from "./useButtonProps-cMoicZgd.js";
6
+ import "./index-DF5ZPtWM.js";
7
+ import "./theme.js";
8
+ import { u as b, a as q } from "./useButtonProps-DVP4s_ER.js";
7
9
  var v = /^\s*>\s$/, B = m.create({
8
10
  name: "blockquote",
9
11
  addOptions() {
@@ -55,7 +57,7 @@ ${e}
55
57
  ];
56
58
  }
57
59
  });
58
- function H() {
60
+ function $() {
59
61
  const t = b(A.name), {
60
62
  icon: o = void 0,
61
63
  tooltip: e = void 0,
@@ -104,5 +106,5 @@ const A = /* @__PURE__ */ B.extend({
104
106
  });
105
107
  export {
106
108
  A as Blockquote,
107
- H as RichTextBlockquote
109
+ $ as RichTextBlockquote
108
110
  };
package/lib/Bold.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("./index-BBNITgNi.cjs"),a=require("./jsx-runtime-C_NLcKys.cjs"),l=require("./index-C838s-or.cjs"),s=require("react/jsx-runtime");require("react");const u=require("./useButtonProps-DfnJiJLV.cjs");var B=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/,_=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))/g,k=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))$/,v=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))/g,M=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 a.h("strong",{...o.mergeAttributes(this.options.HTMLAttributes,t),children:a.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:B,type:this.type}),o.markInputRule({find:k,type:this.type})]},addPasteRules(){return[o.markPasteRule({find:_,type:this.type}),o.markPasteRule({find:v,type:this.type})]}});function b(){const t=u.useButtonProps(c.name),{icon:e=void 0,tooltip:r=void 0,shortcutKeys:n=void 0,tooltipOptions:p={},action:i=void 0,isActive:g=void 0}=(t==null?void 0:t.componentProps)??{},{dataState:m,disabled:d,update:h}=u.useToggleActive(g),y=()=>{d||i&&(i(),h())};return t?s.jsx(l.ActionButton,{action:y,dataState:m,disabled:d,icon:e,shortcutKeys:n,tooltip:r,tooltipOptions:p}):s.jsx(s.Fragment,{})}const c=M.extend({addOptions(){var t;return{...(t=this.parent)==null?void 0:t.call(this),button:({editor:e,t:r,extension:n})=>({component:l.ActionButton,componentProps:{action:()=>e.commands.toggleBold(),isActive:()=>e.isActive("bold"),icon:"Bold",shortcutKeys:n.options.shortcutKeys??["mod","B"],tooltip:r("editor.bold.tooltip")}})}}});exports.Bold=c;exports.RichTextBold=b;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("./clsx-CXbNJWDD.cjs"),a=require("./jsx-runtime-C_NLcKys.cjs"),l=require("./toggle-BQHMh_Q-.cjs"),s=require("react/jsx-runtime");require("react");require("./index-D3RLYf-J.cjs");require("./theme.cjs");const u=require("./useButtonProps-DBJkNDS2.cjs");var B=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/,_=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))/g,k=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))$/,v=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))/g,M=r.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 a.h("strong",{...r.mergeAttributes(this.options.HTMLAttributes,t),children:a.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[r.markInputRule({find:B,type:this.type}),r.markInputRule({find:k,type:this.type})]},addPasteRules(){return[r.markPasteRule({find:_,type:this.type}),r.markPasteRule({find:v,type:this.type})]}});function b(){const t=u.useButtonProps(c.name),{icon:e=void 0,tooltip:o=void 0,shortcutKeys:n=void 0,tooltipOptions:p={},action:i=void 0,isActive:g=void 0}=(t==null?void 0:t.componentProps)??{},{dataState:m,disabled:d,update:h}=u.useToggleActive(g),y=()=>{d||i&&(i(),h())};return t?s.jsx(l.ActionButton,{action:y,dataState:m,disabled:d,icon:e,shortcutKeys:n,tooltip:o,tooltipOptions:p}):s.jsx(s.Fragment,{})}const c=M.extend({addOptions(){var t;return{...(t=this.parent)==null?void 0:t.call(this),button:({editor:e,t:o,extension:n})=>({component:l.ActionButton,componentProps:{action:()=>e.commands.toggleBold(),isActive:()=>e.isActive("bold"),icon:"Bold",shortcutKeys:n.options.shortcutKeys??["mod","B"],tooltip:o("editor.bold.tooltip")}})}}});exports.Bold=c;exports.RichTextBold=b;
package/lib/Bold.js CHANGED
@@ -1,9 +1,11 @@
1
- import { M as _, f as a, h as i, m as f } from "./index-sVScpCFG.js";
1
+ import { M as _, e as i, f as a, m as f } from "./clsx-BWSGDJNJ.js";
2
2
  import { h as d } from "./jsx-runtime-CT7Pcg-t.js";
3
- import { A as l } from "./index-C3zg3DPB.js";
3
+ import { A as l } from "./toggle-DKHg5sLm.js";
4
4
  import { jsx as u, Fragment as y } from "react/jsx-runtime";
5
5
  import "react";
6
- import { u as M, a as v } from "./useButtonProps-cMoicZgd.js";
6
+ import "./index-DF5ZPtWM.js";
7
+ import "./theme.js";
8
+ import { u as M, a as v } from "./useButtonProps-DVP4s_ER.js";
7
9
  var B = /(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/, k = /(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))/g, b = /(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))$/, A = /(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))/g, R = _.create({
8
10
  name: "bold",
9
11
  addOptions() {
@@ -51,11 +53,11 @@ var B = /(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/, k = /(?:^|\s)(\*
51
53
  },
52
54
  addInputRules() {
53
55
  return [
54
- i({
56
+ a({
55
57
  find: B,
56
58
  type: this.type
57
59
  }),
58
- i({
60
+ a({
59
61
  find: b,
60
62
  type: this.type
61
63
  })
@@ -63,18 +65,18 @@ var B = /(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/, k = /(?:^|\s)(\*
63
65
  },
64
66
  addPasteRules() {
65
67
  return [
66
- a({
68
+ i({
67
69
  find: k,
68
70
  type: this.type
69
71
  }),
70
- a({
72
+ i({
71
73
  find: A,
72
74
  type: this.type
73
75
  })
74
76
  ];
75
77
  }
76
78
  });
77
- function K() {
79
+ function O() {
78
80
  const t = M(x.name), {
79
81
  icon: e = void 0,
80
82
  tooltip: o = void 0,
@@ -120,5 +122,5 @@ const x = /* @__PURE__ */ R.extend({
120
122
  });
121
123
  export {
122
124
  x as Bold,
123
- K as RichTextBold
125
+ O as RichTextBold
124
126
  };
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const m=require("./index-CApXPpjF.cjs"),s=require("react/jsx-runtime"),B=require("./index-C838s-or.cjs");require("react");const c=require("./useButtonProps-DfnJiJLV.cjs");function x(){const t=c.useButtonProps(r.name),{icon:e=void 0,tooltip:i=void 0,shortcutKeys:o=void 0,tooltipOptions:l={},action:n=void 0,isActive:d=void 0}=(t==null?void 0:t.componentProps)??{},{dataState:a,disabled:u,update:p}=c.useToggleActive(d),v=()=>{u||n&&(n(),p())};return t?s.jsx(B.ActionButton,{action:v,dataState:a,disabled:u,icon:e,shortcutKeys:o,tooltip:i,tooltipOptions:l}):s.jsx(s.Fragment,{})}const r=m.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=r;exports.RichTextBulletList=x;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const g=require("./index-BCzvbrf5.cjs"),s=require("react/jsx-runtime"),m=require("./toggle-BQHMh_Q-.cjs");require("react");require("./index-D3RLYf-J.cjs");require("./theme.cjs");const u=require("./useButtonProps-DBJkNDS2.cjs");function B(){const t=u.useButtonProps(c.name),{icon:e=void 0,tooltip:i=void 0,shortcutKeys:o=void 0,tooltipOptions:l={},action:n=void 0,isActive:d=void 0}=(t==null?void 0:t.componentProps)??{},{dataState:a,disabled:r,update:p}=u.useToggleActive(d),v=()=>{r||n&&(n(),p())};return t?s.jsx(m.ActionButton,{action:v,dataState:a,disabled:r,icon:e,shortcutKeys:o,tooltip:i,tooltipOptions:l}):s.jsx(s.Fragment,{})}const c=g.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=c;exports.RichTextBulletList=B;
package/lib/BulletList.js CHANGED
@@ -1,9 +1,11 @@
1
- import { B as d } from "./index-DRHrDScg.js";
2
- import { jsx as r, Fragment as m } from "react/jsx-runtime";
3
- import { A as f } from "./index-C3zg3DPB.js";
1
+ import { B as m } from "./index-DJbmnBzK.js";
2
+ import { jsx as r, Fragment as d } from "react/jsx-runtime";
3
+ import { A as f } from "./toggle-DKHg5sLm.js";
4
4
  import "react";
5
- import { u as v, a as A } from "./useButtonProps-cMoicZgd.js";
6
- function y() {
5
+ import "./index-DF5ZPtWM.js";
6
+ import "./theme.js";
7
+ import { u as v, a as A } from "./useButtonProps-DVP4s_ER.js";
8
+ function O() {
7
9
  const t = v(B.name), {
8
10
  icon: o = void 0,
9
11
  tooltip: i = void 0,
@@ -11,23 +13,23 @@ function y() {
11
13
  tooltipOptions: c = {},
12
14
  action: e = void 0,
13
15
  isActive: l = void 0
14
- } = (t == null ? void 0 : t.componentProps) ?? {}, { dataState: a, disabled: n, update: u } = A(l), p = () => {
15
- n || e && (e(), u());
16
+ } = (t == null ? void 0 : t.componentProps) ?? {}, { dataState: p, disabled: n, update: a } = A(l), u = () => {
17
+ n || e && (e(), a());
16
18
  };
17
19
  return t ? /* @__PURE__ */ r(
18
20
  f,
19
21
  {
20
- action: p,
21
- dataState: a,
22
+ action: u,
23
+ dataState: p,
22
24
  disabled: n,
23
25
  icon: o,
24
26
  shortcutKeys: s,
25
27
  tooltip: i,
26
28
  tooltipOptions: c
27
29
  }
28
- ) : /* @__PURE__ */ r(m, {});
30
+ ) : /* @__PURE__ */ r(d, {});
29
31
  }
30
- const B = /* @__PURE__ */ d.extend({
32
+ const B = /* @__PURE__ */ m.extend({
31
33
  // eslint-disable-next-line @typescript-eslint/ban-ts-comment
32
34
  //@ts-expect-error
33
35
  addOptions() {
@@ -50,5 +52,5 @@ const B = /* @__PURE__ */ d.extend({
50
52
  });
51
53
  export {
52
54
  B as BulletList,
53
- y as RichTextBulletList
55
+ O as RichTextBulletList
54
56
  };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("./clsx-CXbNJWDD.cjs"),L=require("./toggle-BQHMh_Q-.cjs"),e=require("react/jsx-runtime"),x=require("react");require("./index-D3RLYf-J.cjs");require("./theme.cjs");const n=require("lucide-react"),c=require("./dialog-Bt5zwGYB.cjs"),s=require("./select-CwGYPsPq.cjs"),p=require("./useButtonProps-DBJkNDS2.cjs"),R=require("./index-Doks9cbR.cjs"),b=require("./label-JNOksCA-.cjs"),y=require("./input-Dt_BA_9B.cjs"),T=require("./button-BS3n6_Aq.cjs"),A=[{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 D({node:t}){const{type:o="note",title:l="",body:u=""}=t.attrs,d=(A.find(h=>h.value===o)||A[0]).icon;return e.jsx(i.NodeViewWrapper,{children:e.jsxs("div",{className:i.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:[e.jsxs("div",{className:i.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:[e.jsx(d,{className:"richtext-size-5"}),e.jsx("span",{className:"richtext-font-semibold",children:l})]}),u&&e.jsx("p",{className:"richtext-pl-[28px]",children:u})]})})}const H=[{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 P(){const{t}=R.useLocale(),o=p.useEditorInstance(),l=p.useButtonProps(N.name),[u,a]=x.useState(!1),[d,h]=x.useState("note"),[f,v]=x.useState(""),[m,j]=x.useState(""),{icon:q=void 0,tooltip:S=void 0,shortcutKeys:I=void 0,tooltipOptions:O={},isActive:k=void 0}=(l==null?void 0:l.componentProps)??{},{dataState:w,disabled:C}=p.useToggleActive(k),B=()=>{o&&(o.chain().focus().setCallout({type:d,title:f,body:m}).run(),a(!1),h("note"),v(""),j(""))},M=()=>{C||a(!0)};return l?e.jsxs(c.Dialog,{onOpenChange:a,open:u,children:[e.jsx(c.DialogTrigger,{asChild:!0,children:e.jsx(L.ActionButton,{action:M,dataState:w,disabled:C,icon:q,shortcutKeys:I,tooltip:S,tooltipOptions:O})}),e.jsxs(c.DialogContent,{children:[e.jsx(c.DialogTitle,{children:t("editor.callout.dialog.title")}),e.jsxs("div",{className:"richtext-space-y-4 richtext-py-4",children:[e.jsxs("div",{className:"richtext-space-y-2",children:[e.jsx(b.Label,{children:t("editor.callout.dialog.type")}),e.jsxs(s.Select,{onValueChange:h,value:d,children:[e.jsx(s.SelectTrigger,{children:e.jsx(s.SelectValue,{placeholder:t("editor.callout.dialog.type.placeholder")})}),e.jsx(s.SelectContent,{children:H.map(r=>e.jsx(s.SelectItem,{value:r.value,children:t(`editor.callout.type.${r.value}`)},r.value))})]})]}),e.jsxs("div",{className:"richtext-space-y-2",children:[e.jsx(b.Label,{children:t("editor.callout.dialog.title.label")}),e.jsx(y.Input,{onChange:r=>v(r.target.value),placeholder:t("editor.callout.dialog.title.placeholder"),value:f})]}),e.jsxs("div",{className:"richtext-space-y-2",children:[e.jsx(b.Label,{children:t("editor.callout.dialog.body.label")}),e.jsx(y.Input,{onChange:r=>j(r.target.value),placeholder:t("editor.callout.dialog.body.placeholder"),value:m})]})]}),e.jsxs(c.DialogFooter,{children:[e.jsx(T.Button,{onClick:()=>a(!1),variant:"outline",children:t("editor.callout.dialog.button.cancel")}),e.jsx(T.Button,{onClick:B,children:t("editor.callout.dialog.button.apply")})]})]})]}):e.jsx(e.Fragment,{})}function g(t){return o=>(console.log({element:o}),o.getAttribute(t))}const N=i.Node3.create({name:"callout",group:"block",selectable:!0,atom:!0,draggable:!0,inline:!1,addOptions(){var t;return{...(t=this.parent)==null?void 0:t.call(this),HTMLAttributes:{class:"callout"},button:({editor:o,t:l})=>({component:L.ActionButton,componentProps:{action:()=>!0,isActive:()=>o.isActive("callout"),disabled:!1,icon:"Callout",tooltip:l("editor.callout.tooltip")}})}},parseHTML(){return[{tag:"div.callout"}]},renderHTML({HTMLAttributes:t}){return console.log({HTMLAttributes:t}),["div",i.mergeAttributes(this.options&&this.options.HTMLAttributes||{},t)]},addAttributes(){return{type:{default:"",parseHTML:g("type")},title:{default:"",parseHTML:g("title")},body:{default:"",parseHTML:g("body")}}},addCommands(){return{setCallout:t=>({chain:o})=>o().insertContent({type:this.name,attrs:t}).run()}},addNodeView(){return i.ReactNodeViewRenderer(D)}});exports.Callout=N;exports.RichTextCallout=P;
package/lib/Callout.js ADDED
@@ -0,0 +1,230 @@
1
+ import { h as D, j as x, N as B, k as H, m as M } from "./clsx-BWSGDJNJ.js";
2
+ import { A as T } from "./toggle-DKHg5sLm.js";
3
+ import { jsx as o, jsxs as l, Fragment as V } from "react/jsx-runtime";
4
+ import { useState as s } from "react";
5
+ import "./index-DF5ZPtWM.js";
6
+ import "./theme.js";
7
+ import { Info as P, Lightbulb as j, AlertCircle as E, TriangleAlert as R, OctagonAlert as W } from "lucide-react";
8
+ import { D as F, a as U, b as Y, c as _, d as $ } from "./dialog-DwTMZSt6.js";
9
+ import { S as z, a as K, b as q, c as G, d as J } from "./select-DctYuHLH.js";
10
+ import { c as Q, u as X, a as Z } from "./useButtonProps-DVP4s_ER.js";
11
+ import { u as tt } from "./index-Dujzr6bY.js";
12
+ import { L as u } from "./label-topD46-u.js";
13
+ import { I as v } from "./input-DUBdJD3L.js";
14
+ import { B as C } from "./button-Uv01FNnd.js";
15
+ const y = [
16
+ { value: "note", label: "Note", icon: P, color: "#1f6feb", background: "#1f6feb1f" },
17
+ { value: "tip", label: "Tip", icon: j, color: "#238636", background: "#2386361f" },
18
+ { value: "important", label: "Important", icon: E, color: "#ab7df8", background: "#ab7df81f" },
19
+ { value: "warning", label: "Warning", icon: R, color: "#d29922", background: "#d299221f" },
20
+ { value: "caution", label: "Caution", icon: W, color: "#f85149", background: "#f851491f" }
21
+ ];
22
+ function et({ node: t }) {
23
+ const { type: e = "note", title: r = "", body: n = "" } = t.attrs, c = (y.find((d) => d.value === e) || y[0]).icon;
24
+ return /* @__PURE__ */ o(D, { children: /* @__PURE__ */ l(
25
+ "div",
26
+ {
27
+ className: x(
28
+ "richtext-relative richtext-my-4 richtext-rounded-lg richtext-border richtext-p-4",
29
+ {
30
+ "richtext-bg-[#1f6feb1f] richtext-border-[#1f6feb]": e === "note",
31
+ "richtext-bg-[#2386361f] richtext-border-[#238636]": e === "tip",
32
+ "richtext-bg-[#ab7df81f] richtext-border-[#ab7df8]": e === "important",
33
+ "richtext-bg-[#d299221f] richtext-border-[#d29922]": e === "warning",
34
+ "richtext-bg-[#f851491f] richtext-border-[#f85149]": e === "caution"
35
+ }
36
+ ),
37
+ children: [
38
+ /* @__PURE__ */ l(
39
+ "div",
40
+ {
41
+ className: x("richtext-mb-2 richtext-flex richtext-items-center richtext-gap-2", {
42
+ "richtext-text-[#1f6feb]": e === "note",
43
+ "richtext-text-[#238636]": e === "tip",
44
+ "richtext-text-[#ab7df8]": e === "important",
45
+ "richtext-text-[#d29922]": e === "warning",
46
+ "richtext-text-[#f85149]": e === "caution"
47
+ }),
48
+ children: [
49
+ /* @__PURE__ */ o(c, { className: "richtext-size-5" }),
50
+ /* @__PURE__ */ o("span", { className: "richtext-font-semibold", children: r })
51
+ ]
52
+ }
53
+ ),
54
+ n && /* @__PURE__ */ o("p", { className: "richtext-pl-[28px]", children: n })
55
+ ]
56
+ }
57
+ ) });
58
+ }
59
+ const ot = [
60
+ { value: "note", label: "Note", icon: "Info" },
61
+ { value: "tip", label: "Tip", icon: "Lightbulb" },
62
+ { value: "important", label: "Important", icon: "AlertCircle" },
63
+ { value: "warning", label: "Warning", icon: "TriangleAlert" },
64
+ { value: "caution", label: "Caution", icon: "OctagonAlert" }
65
+ ];
66
+ function xt() {
67
+ const { t } = tt(), e = Q(), r = X(lt.name), [n, i] = s(!1), [c, d] = s("note"), [h, b] = s(""), [f, g] = s(""), {
68
+ icon: A = void 0,
69
+ tooltip: N = void 0,
70
+ shortcutKeys: L = void 0,
71
+ tooltipOptions: I = {},
72
+ isActive: S = void 0
73
+ } = (r == null ? void 0 : r.componentProps) ?? {}, { dataState: k, disabled: m } = Z(S), w = () => {
74
+ e && (e.chain().focus().setCallout({ type: c, title: h, body: f }).run(), i(!1), d("note"), b(""), g(""));
75
+ }, O = () => {
76
+ m || i(!0);
77
+ };
78
+ return r ? /* @__PURE__ */ l(
79
+ F,
80
+ {
81
+ onOpenChange: i,
82
+ open: n,
83
+ children: [
84
+ /* @__PURE__ */ o(U, { asChild: !0, children: /* @__PURE__ */ o(
85
+ T,
86
+ {
87
+ action: O,
88
+ dataState: k,
89
+ disabled: m,
90
+ icon: A,
91
+ shortcutKeys: L,
92
+ tooltip: N,
93
+ tooltipOptions: I
94
+ }
95
+ ) }),
96
+ /* @__PURE__ */ l(Y, { children: [
97
+ /* @__PURE__ */ o(_, { children: t("editor.callout.dialog.title") }),
98
+ /* @__PURE__ */ l("div", { className: "richtext-space-y-4 richtext-py-4", children: [
99
+ /* @__PURE__ */ l("div", { className: "richtext-space-y-2", children: [
100
+ /* @__PURE__ */ o(u, { children: t("editor.callout.dialog.type") }),
101
+ /* @__PURE__ */ l(
102
+ z,
103
+ {
104
+ onValueChange: d,
105
+ value: c,
106
+ children: [
107
+ /* @__PURE__ */ o(K, { children: /* @__PURE__ */ o(q, { placeholder: t("editor.callout.dialog.type.placeholder") }) }),
108
+ /* @__PURE__ */ o(G, { children: ot.map((a) => /* @__PURE__ */ o(
109
+ J,
110
+ {
111
+ value: a.value,
112
+ children: t(`editor.callout.type.${a.value}`)
113
+ },
114
+ a.value
115
+ )) })
116
+ ]
117
+ }
118
+ )
119
+ ] }),
120
+ /* @__PURE__ */ l("div", { className: "richtext-space-y-2", children: [
121
+ /* @__PURE__ */ o(u, { children: t("editor.callout.dialog.title.label") }),
122
+ /* @__PURE__ */ o(
123
+ v,
124
+ {
125
+ onChange: (a) => b(a.target.value),
126
+ placeholder: t("editor.callout.dialog.title.placeholder"),
127
+ value: h
128
+ }
129
+ )
130
+ ] }),
131
+ /* @__PURE__ */ l("div", { className: "richtext-space-y-2", children: [
132
+ /* @__PURE__ */ o(u, { children: t("editor.callout.dialog.body.label") }),
133
+ /* @__PURE__ */ o(
134
+ v,
135
+ {
136
+ onChange: (a) => g(a.target.value),
137
+ placeholder: t("editor.callout.dialog.body.placeholder"),
138
+ value: f
139
+ }
140
+ )
141
+ ] })
142
+ ] }),
143
+ /* @__PURE__ */ l($, { children: [
144
+ /* @__PURE__ */ o(
145
+ C,
146
+ {
147
+ onClick: () => i(!1),
148
+ variant: "outline",
149
+ children: t("editor.callout.dialog.button.cancel")
150
+ }
151
+ ),
152
+ /* @__PURE__ */ o(C, { onClick: w, children: t("editor.callout.dialog.button.apply") })
153
+ ] })
154
+ ] })
155
+ ]
156
+ }
157
+ ) : /* @__PURE__ */ o(V, {});
158
+ }
159
+ function p(t) {
160
+ return (e) => (console.log({
161
+ element: e
162
+ }), e.getAttribute(t));
163
+ }
164
+ const lt = /* @__PURE__ */ B.create({
165
+ name: "callout",
166
+ group: "block",
167
+ selectable: !0,
168
+ atom: !0,
169
+ draggable: !0,
170
+ inline: !1,
171
+ //@ts-expect-error
172
+ addOptions() {
173
+ var t;
174
+ return {
175
+ ...(t = this.parent) == null ? void 0 : t.call(this),
176
+ HTMLAttributes: {
177
+ class: "callout"
178
+ },
179
+ button: ({ editor: e, t: r }) => ({
180
+ component: T,
181
+ componentProps: {
182
+ action: () => !0,
183
+ isActive: () => e.isActive("callout"),
184
+ disabled: !1,
185
+ icon: "Callout",
186
+ tooltip: r("editor.callout.tooltip")
187
+ }
188
+ })
189
+ };
190
+ },
191
+ parseHTML() {
192
+ return [{ tag: "div.callout" }];
193
+ },
194
+ renderHTML({ HTMLAttributes: t }) {
195
+ return console.log({
196
+ HTMLAttributes: t
197
+ }), ["div", M(this.options && this.options.HTMLAttributes || {}, t)];
198
+ },
199
+ addAttributes() {
200
+ return {
201
+ type: {
202
+ default: "",
203
+ parseHTML: p("type")
204
+ },
205
+ title: {
206
+ default: "",
207
+ parseHTML: p("title")
208
+ },
209
+ body: {
210
+ default: "",
211
+ parseHTML: p("body")
212
+ }
213
+ };
214
+ },
215
+ addCommands() {
216
+ return {
217
+ setCallout: (t) => ({ chain: e }) => e().insertContent({
218
+ type: this.name,
219
+ attrs: t
220
+ }).run()
221
+ };
222
+ },
223
+ addNodeView() {
224
+ return H(et);
225
+ }
226
+ });
227
+ export {
228
+ lt as Callout,
229
+ xt as RichTextCallout
230
+ };