@remarkablejames/editor 0.0.6 → 0.0.7

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 (187) hide show
  1. package/README.md +1 -1
  2. package/lib/ActionMenuButton-D9o3Kwmv.cjs +1 -0
  3. package/lib/{ActionMenuButton-CpmEfz31.js → ActionMenuButton-nxV91Fqo.js} +10 -9
  4. package/lib/Attachment.cjs +19 -1
  5. package/lib/Attachment.js +270 -7
  6. package/lib/Blockquote.cjs +2 -2
  7. package/lib/Blockquote.js +12 -13
  8. package/lib/Bold.cjs +1 -1
  9. package/lib/Bold.js +10 -11
  10. package/lib/BulletList.cjs +1 -1
  11. package/lib/BulletList.js +8 -9
  12. package/lib/Callout.cjs +1 -1
  13. package/lib/Callout.js +45 -40
  14. package/lib/Clear.cjs +1 -1
  15. package/lib/Clear.js +14 -13
  16. package/lib/Code.cjs +1 -1
  17. package/lib/Code.js +5 -6
  18. package/lib/CodeBlock.cjs +1 -1
  19. package/lib/CodeBlock.js +33 -31
  20. package/lib/CodeView.cjs +1 -1
  21. package/lib/CodeView.js +8 -9
  22. package/lib/Color.cjs +1 -1
  23. package/lib/Color.js +19 -18
  24. package/lib/Column.cjs +1 -1
  25. package/lib/Column.js +8 -9
  26. package/lib/Drawer-Bh-y5bs8.cjs +2 -0
  27. package/lib/{Drawer-CayP4Ww4.js → Drawer-CF6Z_IA2.js} +36 -30
  28. package/lib/Drawer.cjs +1 -1
  29. package/lib/Drawer.js +3 -3
  30. package/lib/Emoji.cjs +1 -1
  31. package/lib/Emoji.js +18 -17
  32. package/lib/Excalidraw.cjs +1 -1
  33. package/lib/Excalidraw.js +37 -32
  34. package/lib/ExportPdf.cjs +3 -3
  35. package/lib/ExportPdf.js +13 -14
  36. package/lib/ExportWord.cjs +1 -1
  37. package/lib/ExportWord.js +6 -6
  38. package/lib/FontFamily.cjs +1 -1
  39. package/lib/FontFamily.js +6 -7
  40. package/lib/FontSize.cjs +1 -1
  41. package/lib/FontSize.js +14 -15
  42. package/lib/Heading.cjs +1 -1
  43. package/lib/Heading.js +28 -28
  44. package/lib/Highlight.cjs +1 -1
  45. package/lib/Highlight.js +23 -22
  46. package/lib/History.cjs +1 -1
  47. package/lib/History.js +11 -11
  48. package/lib/HorizontalRule.cjs +1 -1
  49. package/lib/HorizontalRule.js +9 -10
  50. package/lib/Icon-BvGyfX2j.js +15 -0
  51. package/lib/Icon-wjwoRc9F.cjs +1 -0
  52. package/lib/Iframe-BbfZKbPY.cjs +1 -0
  53. package/lib/{Iframe-C6Sb97KS.js → Iframe-Dfd3LI7b.js} +14 -11
  54. package/lib/Iframe.cjs +1 -1
  55. package/lib/Iframe.js +3 -3
  56. package/lib/Image.cjs +1 -1
  57. package/lib/Image.js +5 -4
  58. package/lib/ImageCropper-CY1ETEjC.cjs +10 -0
  59. package/lib/ImageCropper-DrSdjo9x.js +979 -0
  60. package/lib/ImageGif.cjs +1 -1
  61. package/lib/ImageGif.js +83 -80
  62. package/lib/ImportWord.cjs +1 -1
  63. package/lib/ImportWord.js +37 -35
  64. package/lib/{Indent-CcFe8py3.js → Indent-CDVF9DWN.js} +30 -31
  65. package/lib/Indent-Q1VuhSM2.cjs +1 -0
  66. package/lib/Indent.cjs +1 -1
  67. package/lib/Indent.js +2 -2
  68. package/lib/Italic.cjs +1 -1
  69. package/lib/Italic.js +11 -12
  70. package/lib/{Katex-Bp6AnIUF.js → Katex-DqhWWAA-.js} +22 -18
  71. package/lib/Katex-K1QU2SB2.cjs +4 -0
  72. package/lib/Katex.cjs +1 -1
  73. package/lib/Katex.js +2 -2
  74. package/lib/LineHeight.cjs +1 -1
  75. package/lib/LineHeight.js +20 -19
  76. package/lib/Link.cjs +1 -1
  77. package/lib/Link.js +2 -2
  78. package/lib/LinkEditBlock-CBYGLs3J.cjs +5 -0
  79. package/lib/{LinkEditBlock-BiHumIJR.js → LinkEditBlock-xP0pGVhB.js} +27 -22
  80. package/lib/Mention.js +3 -3
  81. package/lib/{Mermaid-Dlx0XTJj.js → Mermaid-BJ6ryVdY.js} +59 -55
  82. package/lib/Mermaid-D3_nLeOW.cjs +2 -0
  83. package/lib/Mermaid.cjs +1 -1
  84. package/lib/Mermaid.js +2 -2
  85. package/lib/MoreMark.cjs +1 -1
  86. package/lib/MoreMark.js +28 -26
  87. package/lib/OrderedList.cjs +1 -1
  88. package/lib/OrderedList.js +10 -11
  89. package/lib/PaywallSeparator.cjs +1 -1
  90. package/lib/PaywallSeparator.js +9 -9
  91. package/lib/SearchAndReplace.cjs +1 -1
  92. package/lib/SearchAndReplace.js +39 -34
  93. package/lib/SlashCommand.cjs +1 -1
  94. package/lib/SlashCommand.js +5 -5
  95. package/lib/SlashCommandNodeView-CUJrDQS7.cjs +1 -0
  96. package/lib/{SlashCommandNodeView-DzmsYaNc.js → SlashCommandNodeView-DS9FqMiY.js} +23 -21
  97. package/lib/Strike.cjs +1 -1
  98. package/lib/Strike.js +11 -12
  99. package/lib/Table-CV6pUoVf.cjs +5 -0
  100. package/lib/{Table-IH34r4jd.js → Table-CcG-JNtV.js} +46 -46
  101. package/lib/Table.cjs +1 -1
  102. package/lib/Table.js +1 -1
  103. package/lib/TaskList.cjs +1 -1
  104. package/lib/TaskList.js +11 -12
  105. package/lib/TextAlign.cjs +1 -1
  106. package/lib/TextAlign.js +27 -26
  107. package/lib/TextDirection.cjs +1 -1
  108. package/lib/TextDirection.js +19 -18
  109. package/lib/TextUnderline.cjs +1 -1
  110. package/lib/TextUnderline.js +8 -9
  111. package/lib/{Twitter-FVQKPaq6.js → Twitter-BIL3o833.js} +19 -15
  112. package/lib/Twitter-BfSTqPDh.cjs +1 -0
  113. package/lib/Twitter.cjs +1 -1
  114. package/lib/Twitter.js +2 -2
  115. package/lib/Video-DAKr90QL.js +231 -0
  116. package/lib/Video-HAinT0w6.cjs +1 -0
  117. package/lib/Video.cjs +1 -1
  118. package/lib/Video.js +5 -4
  119. package/lib/bubble.cjs +3 -3
  120. package/lib/bubble.js +112 -101
  121. package/lib/button-090-I3tp.js +35 -0
  122. package/lib/button-B4Sz2ZhW.cjs +1 -0
  123. package/lib/checkbox-BCPsu7yR.cjs +1 -0
  124. package/lib/checkbox-DiXWHAI0.js +29 -0
  125. package/lib/{clsx-BUPZHhq3.js → clsx-m_C5j3RU.js} +24 -24
  126. package/lib/components/RichTextProvider.d.ts +1 -1
  127. package/lib/dialog-C8J59d2J.cjs +1 -0
  128. package/lib/dialog-bDkDW-C_.js +95 -0
  129. package/lib/dom-dataset-BqoJhJXt.cjs +1 -0
  130. package/lib/dom-dataset-CIEeltF6.js +47 -0
  131. package/lib/{dropdown-menu-Ce2TorkG.js → dropdown-menu-DWt_xj4h.js} +1 -1
  132. package/lib/{dropdown-menu-DirUyRAI.cjs → dropdown-menu-tUP872Zv.cjs} +1 -1
  133. package/lib/events.constant-Bke62qxm.cjs +1 -0
  134. package/lib/events.constant-CSWD3-ho.js +72 -0
  135. package/lib/file-i7e4nQY2.cjs +1 -0
  136. package/lib/file-jDdkhyj7.js +43 -0
  137. package/lib/{index-RkKGy5oa.js → index-B3Ijnbxs.js} +1 -1
  138. package/lib/index-BXh8X1ch.cjs +1 -0
  139. package/lib/{index-Dl3OjzmR.js → index-C1KQsOcg.js} +1 -1
  140. package/lib/{index-D4M4hrH4.js → index-C8FjP66D.js} +1 -1
  141. package/lib/index-jMN4V2hr.js +2763 -0
  142. package/lib/{index-DZj2z9_1.js → index-s3l5RdyW.js} +1 -1
  143. package/lib/index.cjs +4 -4
  144. package/lib/index.js +464 -149
  145. package/lib/input-C_J-pfTx.js +21 -0
  146. package/lib/input-DwLo4r7V.cjs +1 -0
  147. package/lib/isNumber-BTYSVlKo.cjs +1 -0
  148. package/lib/isNumber-WaBzl_0s.js +15 -0
  149. package/lib/label-BgIVynq3.cjs +1 -0
  150. package/lib/label-ClsOg9Hr.js +11 -0
  151. package/lib/{popover-BzJyaFvy.js → popover-BC7FRr8B.js} +1 -1
  152. package/lib/{popover-BdLwAlrM.cjs → popover-C3A6zzNV.cjs} +1 -1
  153. package/lib/{renderNodeView-dj6AaFSX.js → renderNodeView-C_hPIdEs.js} +2 -2
  154. package/lib/select-B8HIWDXf.cjs +1 -0
  155. package/lib/select-DSKqhVGR.js +120 -0
  156. package/lib/{separator-D-fyzbfx.js → separator-BJWSNjvr.js} +23 -22
  157. package/lib/separator-D6ruF682.cjs +1 -0
  158. package/lib/style.css +1 -1
  159. package/lib/tabs-D1J1iB7B.js +46 -0
  160. package/lib/tabs-IEbMQmNX.cjs +1 -0
  161. package/lib/textarea-Ch5w3PiI.js +20 -0
  162. package/lib/textarea-CtVdqwSM.cjs +1 -0
  163. package/lib/theme.cjs +1 -1
  164. package/lib/theme.js +18 -18
  165. package/lib/throttle-CRNq0z-O.js +249 -0
  166. package/lib/throttle-gTTvqDTW.cjs +1 -0
  167. package/lib/toggle-C9tcMm1r.cjs +1 -0
  168. package/lib/toggle-CaSwYCk4.js +89 -0
  169. package/lib/{updatePosition-C294Pixi.js → updatePosition-DvfTZHcH.js} +2 -2
  170. package/lib/use-toast-C6zPo25l.cjs +1 -0
  171. package/lib/use-toast-CEOqhXfx.js +97 -0
  172. package/lib/useButtonProps-D-ruygH7.js +165 -0
  173. package/lib/useButtonProps-D9ndBdmA.cjs +1 -0
  174. package/package.json +21 -32
  175. package/lib/ActionMenuButton-NfiUDE60.cjs +0 -1
  176. package/lib/Drawer-DlgdaO_B.cjs +0 -2
  177. package/lib/Iframe-CANdxSpV.cjs +0 -1
  178. package/lib/Indent-DuB2U6Cs.cjs +0 -1
  179. package/lib/Katex-DFU1unCm.cjs +0 -4
  180. package/lib/LinkEditBlock-C2zX0WVK.cjs +0 -5
  181. package/lib/Mermaid-B8lQSOGn.cjs +0 -2
  182. package/lib/SlashCommandNodeView-BfWNWGRr.cjs +0 -1
  183. package/lib/Table-BfM6ywrZ.cjs +0 -5
  184. package/lib/Twitter-axcoCgD7.cjs +0 -1
  185. package/lib/index-BynXHtjJ.cjs +0 -28
  186. package/lib/index-CnKgiZFQ.js +0 -5576
  187. package/lib/separator-CoQaQmFK.cjs +0 -1
package/lib/index.js CHANGED
@@ -1,24 +1,38 @@
1
- import { jsx as i, jsxs as f, Fragment as m } from "react/jsx-runtime";
2
- import { K as O } from "./clsx-BUPZHhq3.js";
3
- import * as u from "react";
4
- import { useEffect as x, useId as z } from "react";
5
- import { c as l, W as H, w as L, X as _, Y as Q, Z as Y, _ as I } from "./index-CnKgiZFQ.js";
6
- import * as c from "@radix-ui/react-toast";
7
- import { X as K } from "lucide-react";
8
- import { useTheme as q, THEME as y } from "./theme.js";
9
- const B = c.Provider, T = u.forwardRef(({ className: t, ...r }, e) => /* @__PURE__ */ i(
10
- c.Viewport,
1
+ import { jsx as r, Fragment as E, jsxs as h } from "react/jsx-runtime";
2
+ import { a1 as ve } from "./clsx-m_C5j3RU.js";
3
+ import * as I from "react";
4
+ import { useState as y, useRef as _, useMemo as re, useEffect as D, useId as ye } from "react";
5
+ import { E as z, u as F, R as Ne } from "./events.constant-CSWD3-ho.js";
6
+ import { D as $, b as H, c as O } from "./dialog-bDkDW-C_.js";
7
+ import { Attachment as we } from "./Attachment.js";
8
+ import { f as q, c as B, i as Q, n as Te, o as Ce } from "./useButtonProps-D-ruygH7.js";
9
+ import { u as Y } from "./index-BGd2HiwP.js";
10
+ import { e as Ee, b as ke } from "./file-jDdkhyj7.js";
11
+ import { B as A } from "./button-090-I3tp.js";
12
+ import { I as De, a as Ie, v as Re } from "./ImageCropper-DrSdjo9x.js";
13
+ import { u as ie } from "./use-toast-CEOqhXfx.js";
14
+ import { T as ne, a as oe, b as S, c as L } from "./tabs-D1J1iB7B.js";
15
+ import { C as Ve } from "./checkbox-DiXWHAI0.js";
16
+ import { L as J } from "./label-ClsOg9Hr.js";
17
+ import { I as j } from "./input-C_J-pfTx.js";
18
+ import { V as Ae, c as Se } from "./Video-DAKr90QL.js";
19
+ import * as g from "@radix-ui/react-toast";
20
+ import { c as k, a as Le } from "./index-jMN4V2hr.js";
21
+ import { X as Pe } from "lucide-react";
22
+ import { useTheme as Me, THEME as Z, themeActions as je } from "./theme.js";
23
+ const Ue = g.Provider, ae = I.forwardRef(({ className: e, ...i }, t) => /* @__PURE__ */ r(
24
+ g.Viewport,
11
25
  {
12
- ref: e,
13
- className: l(
26
+ ref: t,
27
+ className: k(
14
28
  "richtext-fixed richtext-top-0 richtext-z-[100] richtext-flex richtext-max-h-screen richtext-w-full richtext-flex-col-reverse richtext-p-4 sm:richtext-bottom-0 sm:richtext-right-0 sm:richtext-top-auto sm:richtext-flex-col md:richtext-max-w-[420px]",
15
- t
29
+ e
16
30
  ),
17
- ...r
31
+ ...i
18
32
  }
19
33
  ));
20
- T.displayName = c.Viewport.displayName;
21
- const F = H(
34
+ ae.displayName = g.Viewport.displayName;
35
+ const _e = Le(
22
36
  "richtext-group richtext-pointer-events-auto richtext-relative richtext-flex richtext-w-full richtext-items-center richtext-justify-between richtext-space-x-4 richtext-overflow-hidden richtext-rounded-md !richtext-border richtext-p-6 richtext-pr-8 richtext-shadow-lg richtext-transition-all data-[swipe=cancel]:richtext-translate-x-0 data-[swipe=end]:richtext-translate-x-[var(--radix-toast-swipe-end-x)] data-[swipe=move]:richtext-translate-x-[var(--radix-toast-swipe-move-x)] data-[swipe=move]:richtext-transition-none data-[state=open]:richtext-animate-in data-[state=closed]:richtext-animate-out data-[swipe=end]:richtext-animate-out data-[state=closed]:richtext-fade-out-80 data-[state=closed]:richtext-slide-out-to-right-full data-[state=open]:richtext-slide-in-from-top-full data-[state=open]:sm:richtext-slide-in-from-bottom-full",
23
37
  {
24
38
  variants: {
@@ -31,74 +45,373 @@ const F = H(
31
45
  variant: "default"
32
46
  }
33
47
  }
34
- ), R = u.forwardRef(({ className: t, variant: r, ...e }, n) => /* @__PURE__ */ i(
35
- c.Root,
48
+ ), ce = I.forwardRef(({ className: e, variant: i, ...t }, s) => /* @__PURE__ */ r(
49
+ g.Root,
36
50
  {
37
- ref: n,
38
- className: l(F({ variant: r }), t),
39
- ...e
51
+ ref: s,
52
+ className: k(_e({ variant: i }), e),
53
+ ...t
40
54
  }
41
55
  ));
42
- R.displayName = c.Root.displayName;
43
- const W = u.forwardRef(({ className: t, ...r }, e) => /* @__PURE__ */ i(
44
- c.Action,
56
+ ce.displayName = g.Root.displayName;
57
+ const ze = I.forwardRef(({ className: e, ...i }, t) => /* @__PURE__ */ r(
58
+ g.Action,
45
59
  {
46
- ref: e,
47
- className: l(
60
+ ref: t,
61
+ className: k(
48
62
  "richtext-inline-flex richtext-h-8 richtext-shrink-0 richtext-items-center richtext-justify-center richtext-rounded-md !richtext-border richtext-bg-transparent richtext-px-3 richtext-text-sm richtext-font-medium richtext-ring-offset-background richtext-transition-colors hover:richtext-bg-secondary focus:richtext-outline-none focus:richtext-ring-2 focus:richtext-ring-ring focus:richtext-ring-offset-1 disabled:richtext-pointer-events-none disabled:richtext-opacity-50 group-[.destructive]:richtext-border-muted/40 group-[.destructive]:hover:richtext-border-destructive/30 group-[.destructive]:hover:richtext-bg-destructive group-[.destructive]:hover:richtext-text-destructive-foreground group-[.destructive]:focus:richtext-ring-destructive",
49
- t
63
+ e
50
64
  ),
51
- ...r
65
+ ...i
52
66
  }
53
67
  ));
54
- W.displayName = c.Action.displayName;
55
- const E = u.forwardRef(({ className: t, ...r }, e) => /* @__PURE__ */ i(
56
- c.Close,
68
+ ze.displayName = g.Action.displayName;
69
+ const se = I.forwardRef(({ className: e, ...i }, t) => /* @__PURE__ */ r(
70
+ g.Close,
57
71
  {
58
- ref: e,
59
- className: l(
72
+ ref: t,
73
+ className: k(
60
74
  "richtext-absolute richtext-right-2 richtext-top-2 richtext-rounded-md richtext-p-1 richtext-text-foreground/50 richtext-opacity-0 richtext-transition-opacity hover:richtext-text-foreground focus:richtext-opacity-100 focus:richtext-outline-none focus:richtext-ring-2 group-hover:richtext-opacity-100 group-[.destructive]:richtext-text-red-300 group-[.destructive]:hover:richtext-text-red-50 group-[.destructive]:focus:richtext-ring-red-400 group-[.destructive]:focus:richtext-ring-offset-red-600",
61
- t
75
+ e
62
76
  ),
63
77
  "toast-close": "",
64
- ...r,
65
- children: /* @__PURE__ */ i(K, { className: "richtext-h-4 richtext-w-4" })
78
+ ...i,
79
+ children: /* @__PURE__ */ r(Pe, { className: "richtext-h-4 richtext-w-4" })
66
80
  }
67
81
  ));
68
- E.displayName = c.Close.displayName;
69
- const C = u.forwardRef(({ className: t, ...r }, e) => /* @__PURE__ */ i(
70
- c.Title,
82
+ se.displayName = g.Close.displayName;
83
+ const le = I.forwardRef(({ className: e, ...i }, t) => /* @__PURE__ */ r(
84
+ g.Title,
71
85
  {
72
- ref: e,
73
- className: l("richtext-text-sm richtext-font-semibold", t),
74
- ...r
86
+ ref: t,
87
+ className: k("richtext-text-sm richtext-font-semibold", e),
88
+ ...i
75
89
  }
76
90
  ));
77
- C.displayName = c.Title.displayName;
78
- const S = u.forwardRef(({ className: t, ...r }, e) => /* @__PURE__ */ i(
79
- c.Description,
91
+ le.displayName = g.Title.displayName;
92
+ const de = I.forwardRef(({ className: e, ...i }, t) => /* @__PURE__ */ r(
93
+ g.Description,
80
94
  {
81
- ref: e,
82
- className: l("richtext-text-sm richtext-opacity-90", t),
83
- ...r
95
+ ref: t,
96
+ className: k("richtext-text-sm richtext-opacity-90", e),
97
+ ...i
84
98
  }
85
99
  ));
86
- S.displayName = c.Description.displayName;
87
- function X() {
88
- const { toasts: t } = L();
89
- return /* @__PURE__ */ f(B, { children: [
90
- t.map(({ id: r, title: e, description: n, action: o, ...s }) => /* @__PURE__ */ f(R, { ...s, children: [
91
- /* @__PURE__ */ f("div", { className: "richtext-grid richtext-gap-1", children: [
92
- e && /* @__PURE__ */ i(C, { children: e }),
93
- n && /* @__PURE__ */ i(S, { children: n })
100
+ de.displayName = g.Description.displayName;
101
+ function Fe() {
102
+ var n;
103
+ const { t: e } = Y(), i = q(), { editorDisabled: t } = B(), [s, l] = y(!1), [d, f] = y(!1), [a, m] = y(null), b = _(null), p = Q(we.name), v = z.UPLOAD_ATTACHMENT(i.id);
104
+ F((u) => {
105
+ u && (m(null), f(!1), l(!0));
106
+ }, [v]);
107
+ const o = (n = p == null ? void 0 : p.options) == null ? void 0 : n.upload;
108
+ function T(u) {
109
+ var x;
110
+ u.preventDefault(), (x = b.current) == null || x.click();
111
+ }
112
+ async function N(u) {
113
+ var w;
114
+ const x = (w = u.target.files) == null ? void 0 : w[0];
115
+ if (!x || !i || i.isDestroyed) {
116
+ u.target.value = "";
117
+ return;
118
+ }
119
+ if (!o) {
120
+ m(e("editor.attachment.error.no_upload_fn")), u.target.value = "";
121
+ return;
122
+ }
123
+ m(null), f(!0);
124
+ try {
125
+ const c = await o(x);
126
+ i.chain().focus().setAttachment({
127
+ id: c,
128
+ fileName: ke(x.name),
129
+ fileSize: x.size,
130
+ fileType: x.type,
131
+ fileExt: Ee(x.name)
132
+ }).run(), l(!1);
133
+ } catch (c) {
134
+ m(
135
+ c != null && c.message ? `${e("editor.attachment.error.upload_failed")}: ${c.message}` : e("editor.attachment.error.upload_failed")
136
+ );
137
+ } finally {
138
+ f(!1), u.target.value = "";
139
+ }
140
+ }
141
+ function C(u) {
142
+ d || (l(u), u || m(null));
143
+ }
144
+ return t ? /* @__PURE__ */ r(E, {}) : /* @__PURE__ */ r($, { onOpenChange: C, open: s, children: /* @__PURE__ */ h(H, { children: [
145
+ /* @__PURE__ */ r(O, { children: e("editor.attachment.dialog.title") }),
146
+ /* @__PURE__ */ h("div", { className: "richtext-flex richtext-flex-col richtext-gap-3", children: [
147
+ /* @__PURE__ */ r("p", { className: "richtext-text-sm richtext-text-muted-foreground", children: e("editor.attachment.dialog.description") }),
148
+ /* @__PURE__ */ r(
149
+ A,
150
+ {
151
+ className: "richtext-w-full",
152
+ disabled: d,
153
+ onClick: T,
154
+ size: "sm",
155
+ children: e(d ? "editor.attachment.uploading" : "editor.attachment.dialog.button.choose")
156
+ }
157
+ ),
158
+ a && /* @__PURE__ */ r("p", { className: "richtext-text-sm richtext-text-destructive", children: a })
159
+ ] }),
160
+ /* @__PURE__ */ r(
161
+ "input",
162
+ {
163
+ hidden: !0,
164
+ onChange: N,
165
+ ref: b,
166
+ type: "file"
167
+ }
168
+ )
169
+ ] }) });
170
+ }
171
+ function $e() {
172
+ const { t: e } = Y(), { toast: i } = ie(), t = q(), { editorDisabled: s } = B(), [l, d] = y(!1), f = z.UPLOAD_IMAGE(t.id);
173
+ F(d, [f]);
174
+ const a = Q(De.name), [m, b] = y(""), [p, v] = y(""), o = _(null), T = (a == null ? void 0 : a.options.defaultInline) || !1, [N, C] = y(T), n = re(() => a == null ? void 0 : a.options, [a]);
175
+ function u(c) {
176
+ var X;
177
+ const R = (X = c == null ? void 0 : c.target) == null ? void 0 : X.files;
178
+ if (!t || t.isDestroyed || R.length === 0) {
179
+ c.target.value = "";
180
+ return;
181
+ }
182
+ const V = Re(R, {
183
+ acceptMimes: n == null ? void 0 : n.acceptMimes,
184
+ maxSize: n == null ? void 0 : n.maxSize,
185
+ t: e,
186
+ toast: i,
187
+ onError: n.onError
188
+ });
189
+ if (V.length <= 0) {
190
+ c.target.value = "";
191
+ return;
192
+ }
193
+ d(!1);
194
+ const G = p, W = N;
195
+ if (v(""), C(T), n.upload) {
196
+ const P = n != null && n.multiple ? V : [V[0]];
197
+ for (const M of P)
198
+ t.chain().focus().insertImagePlaceholder({
199
+ file: M,
200
+ inline: W,
201
+ alt: G
202
+ }).run();
203
+ } else {
204
+ const P = n != null && n.multiple ? V : [V[0]];
205
+ for (const M of P) {
206
+ const be = URL.createObjectURL(M);
207
+ t.chain().focus().setImageInline({ src: be, inline: W, alt: G }).run();
208
+ }
209
+ }
210
+ c.target.value = "";
211
+ }
212
+ function x(c) {
213
+ c.preventDefault(), c.stopPropagation(), t.chain().focus().setImageInline({ src: m, inline: N, alt: p }).run(), d(!1), C(T), b(""), v("");
214
+ }
215
+ function w(c) {
216
+ var R;
217
+ c.preventDefault(), (R = o.current) == null || R.click();
218
+ }
219
+ return s ? /* @__PURE__ */ r(E, {}) : /* @__PURE__ */ r($, { onOpenChange: d, open: l, children: /* @__PURE__ */ h(H, { children: [
220
+ /* @__PURE__ */ r(O, { children: e("editor.image.dialog.title") }),
221
+ /* @__PURE__ */ h(
222
+ ne,
223
+ {
224
+ activationMode: "manual",
225
+ defaultValue: n.resourceImage === "both" || n.resourceImage === "upload" ? "upload" : "link",
226
+ children: [
227
+ n.resourceImage === "both" && /* @__PURE__ */ h(oe, { className: "richtext-grid richtext-w-full richtext-grid-cols-2", children: [
228
+ /* @__PURE__ */ r(S, { value: "upload", children: e("editor.image.dialog.tab.upload") }),
229
+ /* @__PURE__ */ r(S, { value: "link", children: e("editor.image.dialog.tab.url") })
230
+ ] }),
231
+ /* @__PURE__ */ h("div", { className: "richtext-my-[10px] richtext-flex richtext-items-center richtext-gap-[4px]", children: [
232
+ /* @__PURE__ */ r(
233
+ Ve,
234
+ {
235
+ checked: N,
236
+ onCheckedChange: (c) => {
237
+ C(c);
238
+ }
239
+ }
240
+ ),
241
+ /* @__PURE__ */ r(J, { children: e("editor.link.dialog.inline") })
242
+ ] }),
243
+ n.enableAlt && /* @__PURE__ */ h("div", { className: "richtext-my-[10px]", children: [
244
+ /* @__PURE__ */ r(J, { className: "mb-[6px]", children: e("editor.imageUpload.alt") }),
245
+ /* @__PURE__ */ r(
246
+ j,
247
+ {
248
+ onChange: (c) => v(c.target.value),
249
+ required: !0,
250
+ type: "text",
251
+ value: p
252
+ }
253
+ )
254
+ ] }),
255
+ /* @__PURE__ */ h(L, { value: "upload", children: [
256
+ /* @__PURE__ */ h("div", { className: "richtext-flex richtext-items-center richtext-gap-[10px]", children: [
257
+ /* @__PURE__ */ r(
258
+ A,
259
+ {
260
+ className: "richtext-mt-1 richtext-w-full",
261
+ onClick: w,
262
+ size: "sm",
263
+ children: e("editor.image.dialog.tab.upload")
264
+ }
265
+ ),
266
+ /* @__PURE__ */ r(
267
+ Ie,
268
+ {
269
+ alt: p,
270
+ disabled: !1,
271
+ editor: t,
272
+ imageInline: N,
273
+ onClose: () => {
274
+ v("");
275
+ }
276
+ }
277
+ )
278
+ ] }),
279
+ /* @__PURE__ */ r(
280
+ "input",
281
+ {
282
+ accept: n.acceptMimes.join(",") || "image/*",
283
+ multiple: n.multiple,
284
+ onChange: u,
285
+ ref: o,
286
+ style: { display: "none" },
287
+ type: "file"
288
+ }
289
+ )
290
+ ] }),
291
+ /* @__PURE__ */ r(L, { value: "link", children: /* @__PURE__ */ r("form", { onSubmit: x, children: /* @__PURE__ */ h("div", { className: "richtext-flex richtext-items-center richtext-gap-2", children: [
292
+ /* @__PURE__ */ r(
293
+ j,
294
+ {
295
+ autoFocus: !0,
296
+ onChange: (c) => b(c.target.value),
297
+ placeholder: e("editor.image.dialog.placeholder"),
298
+ required: !0,
299
+ type: "url",
300
+ value: m
301
+ }
302
+ ),
303
+ /* @__PURE__ */ r(A, { type: "submit", children: e("editor.image.dialog.button.apply") })
304
+ ] }) }) })
305
+ ]
306
+ }
307
+ )
308
+ ] }) });
309
+ }
310
+ function He() {
311
+ const { t: e } = Y(), i = q(), { editorDisabled: t } = B(), [s, l] = y(""), d = _(null), [f, a] = y(""), [m, b] = y(!1), p = Q(Ae.name), v = z.UPLOAD_VIDEO(i.id);
312
+ F(b, [v]);
313
+ const o = re(() => (p == null ? void 0 : p.options) ?? {}, [p]);
314
+ async function T(n) {
315
+ var c;
316
+ const u = (c = n == null ? void 0 : n.target) == null ? void 0 : c.files;
317
+ if (!i || i.isDestroyed || u.length === 0)
318
+ return;
319
+ const x = u[0];
320
+ let w = "";
321
+ o.upload ? w = await o.upload(x) : w = URL.createObjectURL(x), i.chain().focus().setVideo({
322
+ src: w,
323
+ width: "100%"
324
+ }).run(), b(!1);
325
+ }
326
+ function N(n) {
327
+ n.preventDefault(), n.stopPropagation(), s && (i.chain().focus().setVideo({
328
+ src: s,
329
+ width: "100%"
330
+ }).run(), b(!1), l(""));
331
+ }
332
+ function C(n) {
333
+ var u;
334
+ n.preventDefault(), (u = d.current) == null || u.click();
335
+ }
336
+ return t ? /* @__PURE__ */ r(E, {}) : /* @__PURE__ */ r($, { onOpenChange: b, open: m, children: /* @__PURE__ */ h(H, { children: [
337
+ /* @__PURE__ */ r(O, { children: e("editor.video.dialog.title") }),
338
+ /* @__PURE__ */ h(
339
+ ne,
340
+ {
341
+ activationMode: "manual",
342
+ defaultValue: (o == null ? void 0 : o.resourceVideo) === "both" || (o == null ? void 0 : o.resourceVideo) === "upload" ? "upload" : "link",
343
+ children: [
344
+ /* @__PURE__ */ h(oe, { className: "richtext-grid richtext-w-full richtext-grid-cols-2", children: [
345
+ ((o == null ? void 0 : o.resourceVideo) === "both" || (o == null ? void 0 : o.resourceVideo) === "upload") && /* @__PURE__ */ r(S, { value: "upload", children: e("editor.video.dialog.tab.upload") }),
346
+ ((o == null ? void 0 : o.resourceVideo) === "both" || (o == null ? void 0 : o.resourceVideo) === "link") && /* @__PURE__ */ r(S, { value: "link", children: e("editor.video.dialog.link") })
347
+ ] }),
348
+ /* @__PURE__ */ h(L, { value: "upload", children: [
349
+ /* @__PURE__ */ r("div", { className: "richtext-flex richtext-items-center richtext-gap-[10px]", children: /* @__PURE__ */ r(A, { className: "richtext-mt-1 richtext-w-full", onClick: C, size: "sm", children: e("editor.video.dialog.tab.upload") }) }),
350
+ /* @__PURE__ */ r(
351
+ "input",
352
+ {
353
+ accept: "video/*",
354
+ multiple: !0,
355
+ onChange: T,
356
+ ref: d,
357
+ type: "file",
358
+ style: {
359
+ display: "none"
360
+ }
361
+ }
362
+ )
363
+ ] }),
364
+ /* @__PURE__ */ h(L, { value: "link", children: [
365
+ /* @__PURE__ */ r("div", { children: /* @__PURE__ */ h("div", { className: "richtext-flex richtext-items-center richtext-gap-2", children: [
366
+ /* @__PURE__ */ r(
367
+ j,
368
+ {
369
+ autoFocus: !0,
370
+ placeholder: e("editor.video.dialog.placeholder"),
371
+ required: !0,
372
+ type: "url",
373
+ value: s,
374
+ onBlur: (n) => {
375
+ const u = n.target.value, x = o.videoProviders || ["."];
376
+ u && !Se(u, x) ? a("Invalid video URL") : a("");
377
+ },
378
+ onChange: (n) => {
379
+ l(n.target.value);
380
+ }
381
+ }
382
+ ),
383
+ /* @__PURE__ */ r(A, { onClick: N, type: "button", children: e("editor.video.dialog.button.apply") })
384
+ ] }) }),
385
+ f && /* @__PURE__ */ r("div", { className: "richtext-my-[5px] richtext-text-red-500", children: f })
386
+ ] })
387
+ ]
388
+ }
389
+ )
390
+ ] }) });
391
+ }
392
+ function ue() {
393
+ return /* @__PURE__ */ h(E, { children: [
394
+ /* @__PURE__ */ r($e, {}),
395
+ /* @__PURE__ */ r(He, {}),
396
+ /* @__PURE__ */ r(Fe, {})
397
+ ] });
398
+ }
399
+ process.env.NODE_ENV !== "production" && (ue.displayName = "SlashDialogTrigger");
400
+ function Oe() {
401
+ const { toasts: e } = ie();
402
+ return /* @__PURE__ */ h(Ue, { children: [
403
+ e.map(({ id: i, title: t, description: s, action: l, ...d }) => /* @__PURE__ */ h(ce, { ...d, children: [
404
+ /* @__PURE__ */ h("div", { className: "richtext-grid richtext-gap-1", children: [
405
+ t && /* @__PURE__ */ r(le, { children: t }),
406
+ s && /* @__PURE__ */ r(de, { children: s })
94
407
  ] }),
95
- o,
96
- /* @__PURE__ */ i(E, {})
97
- ] }, r)),
98
- /* @__PURE__ */ i(T, {})
408
+ l,
409
+ /* @__PURE__ */ r(se, {})
410
+ ] }, i)),
411
+ /* @__PURE__ */ r(ae, {})
99
412
  ] });
100
413
  }
101
- const Z = `
414
+ const qe = `
102
415
  .remarkablejames-editor {
103
416
  button,
104
417
  input:where([type=button]),
@@ -206,106 +519,106 @@ const Z = `
206
519
  }
207
520
  }
208
521
  `;
209
- function G({ editor: t }) {
210
- const r = _();
211
- x(() => {
212
- r(t == null ? void 0 : t.isEditable);
213
- }, [t == null ? void 0 : t.isEditable]);
214
- const e = () => {
215
- r(t == null ? void 0 : t.isEditable);
522
+ function Be({ editor: e }) {
523
+ const i = Te();
524
+ D(() => {
525
+ i(e == null ? void 0 : e.isEditable);
526
+ }, [e == null ? void 0 : e.isEditable]);
527
+ const t = () => {
528
+ i(e == null ? void 0 : e.isEditable);
216
529
  };
217
- return x(() => (t && t.on("update", e), () => {
218
- t && t.off("update", e);
219
- }), [t]), /* @__PURE__ */ i(m, {});
530
+ return D(() => (e && e.on("update", t), () => {
531
+ e && e.off("update", t);
532
+ }), [e]), /* @__PURE__ */ r(E, {});
220
533
  }
221
- const w = "data-rc-order", N = "data-rc-priority", J = "rc-util-key", p = /* @__PURE__ */ new Map();
222
- function U(t, r) {
223
- if (!t)
534
+ const ee = "data-rc-order", te = "data-rc-priority", Qe = "rc-util-key", U = /* @__PURE__ */ new Map();
535
+ function Ye(e, i) {
536
+ if (!e)
224
537
  return !1;
225
- if (t.contains)
226
- return t.contains(r);
227
- let e = r;
228
- for (; e; ) {
229
- if (e === t)
538
+ if (e.contains)
539
+ return e.contains(i);
540
+ let t = i;
541
+ for (; t; ) {
542
+ if (t === e)
230
543
  return !0;
231
- e = e.parentNode;
544
+ t = t.parentNode;
232
545
  }
233
546
  return !1;
234
547
  }
235
- function j({ mark: t } = {}) {
236
- return t ? t.startsWith("data-") ? t : `data-${t}` : J;
548
+ function he({ mark: e } = {}) {
549
+ return e ? e.startsWith("data-") ? e : `data-${e}` : Qe;
237
550
  }
238
- function g(t) {
239
- return t.attachTo ? t.attachTo : document.querySelector("head") || document.body;
551
+ function K(e) {
552
+ return e.attachTo ? e.attachTo : document.querySelector("head") || document.body;
240
553
  }
241
- function tt(t) {
242
- return t === "queue" ? "prependQueue" : t ? "prepend" : "append";
554
+ function Ke(e) {
555
+ return e === "queue" ? "prependQueue" : e ? "prepend" : "append";
243
556
  }
244
- function P(t) {
245
- return [...(p.get(t) || t).children].filter(
246
- (r) => r.tagName === "STYLE"
557
+ function fe(e) {
558
+ return [...(U.get(e) || e).children].filter(
559
+ (i) => i.tagName === "STYLE"
247
560
  );
248
561
  }
249
- function A(t, r = {}) {
250
- const { csp: e, prepend: n, priority: o = 0 } = r, s = tt(n), d = s === "prependQueue", a = document.createElement("style");
251
- a.setAttribute(w, s), d && o && a.setAttribute(N, `${o}`), e != null && e.nonce && (a.nonce = e == null ? void 0 : e.nonce), a.innerHTML = t;
252
- const h = g(r), { firstChild: V } = h;
253
- if (n) {
254
- if (d) {
255
- const b = P(h).filter((v) => {
256
- if (!["prepend", "prependQueue"].includes(v.getAttribute(w)))
562
+ function me(e, i = {}) {
563
+ const { csp: t, prepend: s, priority: l = 0 } = i, d = Ke(s), f = d === "prependQueue", a = document.createElement("style");
564
+ a.setAttribute(ee, d), f && l && a.setAttribute(te, `${l}`), t != null && t.nonce && (a.nonce = t == null ? void 0 : t.nonce), a.innerHTML = e;
565
+ const m = K(i), { firstChild: b } = m;
566
+ if (s) {
567
+ if (f) {
568
+ const p = fe(m).filter((v) => {
569
+ if (!["prepend", "prependQueue"].includes(v.getAttribute(ee)))
257
570
  return !1;
258
- const $ = Number(v.getAttribute(N) || 0);
259
- return o >= $;
571
+ const o = Number(v.getAttribute(te) || 0);
572
+ return l >= o;
260
573
  });
261
- if (b.length > 0)
262
- return h.insertBefore(a, b.at(-1).nextSibling), a;
574
+ if (p.length > 0)
575
+ return m.insertBefore(a, p.at(-1).nextSibling), a;
263
576
  }
264
- V.before(a);
577
+ b.before(a);
265
578
  } else
266
- h.append(a);
579
+ m.append(a);
267
580
  return a;
268
581
  }
269
- function M(t, r = {}) {
270
- const e = g(r);
271
- return P(e).find((n) => n.getAttribute(j(r)) === t);
582
+ function pe(e, i = {}) {
583
+ const t = K(i);
584
+ return fe(t).find((s) => s.getAttribute(he(i)) === e);
272
585
  }
273
- function k(t, r = {}) {
274
- const e = M(t, r);
275
- e && e.remove();
586
+ function xe(e, i = {}) {
587
+ const t = pe(e, i);
588
+ t && t.remove();
276
589
  }
277
- function et(t, r) {
278
- const e = p.get(t);
279
- if (!e || !U(document, e)) {
280
- const n = A("", r), { parentNode: o } = n;
281
- p.set(t, o), n.remove();
590
+ function Ge(e, i) {
591
+ const t = U.get(e);
592
+ if (!t || !Ye(document, t)) {
593
+ const s = me("", i), { parentNode: l } = s;
594
+ U.set(e, l), s.remove();
282
595
  }
283
596
  }
284
- function D(t, r, e = {}) {
285
- var d, a, h;
286
- const n = g(e);
287
- et(n, e);
288
- const o = M(r, e);
289
- if (o)
290
- return (d = e.csp) != null && d.nonce && o.nonce !== ((a = e.csp) == null ? void 0 : a.nonce) && (o.nonce = (h = e.csp) == null ? void 0 : h.nonce), o.innerHTML !== t && (o.innerHTML = t), o;
291
- const s = A(t, e);
292
- return s.setAttribute(j(e), r), s;
597
+ function ge(e, i, t = {}) {
598
+ var f, a, m;
599
+ const s = K(t);
600
+ Ge(s, t);
601
+ const l = pe(i, t);
602
+ if (l)
603
+ return (f = t.csp) != null && f.nonce && l.nonce !== ((a = t.csp) == null ? void 0 : a.nonce) && (l.nonce = (m = t.csp) == null ? void 0 : m.nonce), l.innerHTML !== e && (l.innerHTML = e), l;
604
+ const d = me(e, t);
605
+ return d.setAttribute(he(t), i), d;
293
606
  }
294
- function rt() {
295
- const { theme: t, color: r, borderRadius: e } = q();
296
- return x(() => {
297
- const n = t || "light", o = r || "default";
298
- let s = y[n][o];
299
- if (!s) {
300
- s = y.light.default;
607
+ function We() {
608
+ const { theme: e, color: i, borderRadius: t } = Me();
609
+ return D(() => {
610
+ const s = e || "light", l = i || "default";
611
+ let d = Z[s][l];
612
+ if (!d) {
613
+ d = Z.light.default;
301
614
  return;
302
615
  }
303
- return D(
616
+ return ge(
304
617
  `
305
618
  .remarkablejames-editor, .remarkablejames-editor *,
306
619
  .remarkablejames-editor-theme, .remarkablejames-editor-theme *,
307
620
  div[data-richtext-portal], div[data-richtext-portal] * {
308
- ${Object.entries(s).map(([d, a]) => typeof e == "string" && d === "radius" ? `--${d}: ${e};` : `--${d}: ${a};`).join(`
621
+ ${Object.entries(d).map(([f, a]) => typeof t == "string" && f === "radius" ? `--${f}: ${t};` : `--${f}: ${a};`).join(`
309
622
  `)}
310
623
  }
311
624
  `,
@@ -314,25 +627,27 @@ function rt() {
314
627
  priority: 50
315
628
  }
316
629
  ), () => {
317
- k("richtext-theme");
630
+ xe("richtext-theme");
318
631
  };
319
- }, [t, r, e]), /* @__PURE__ */ i(m, {});
632
+ }, [e, i, t]), /* @__PURE__ */ r(E, {});
320
633
  }
321
- function dt({ editor: t, children: r }) {
322
- const e = z();
323
- return x(() => (D(Z, "react-tiptap-reset"), () => {
324
- k("react-tiptap-reset");
325
- }), []), x(() => {
326
- t && (t.id = e);
327
- }, [e, t]), t ? /* @__PURE__ */ i("div", { className: "remarkablejames-editor", children: /* @__PURE__ */ i(Q, { children: /* @__PURE__ */ f(O.Provider, { value: { editor: t }, children: [
328
- /* @__PURE__ */ i(Y, { delayDuration: 0, disableHoverableContent: !0, children: r }),
329
- /* @__PURE__ */ i(G, { editor: t }),
330
- /* @__PURE__ */ i(I, {}),
331
- /* @__PURE__ */ i(rt, {}),
332
- /* @__PURE__ */ i(X, {})
333
- ] }) }) }) : /* @__PURE__ */ i(m, {});
634
+ function gt({ editor: e, children: i, dark: t }) {
635
+ const s = ye();
636
+ return D(() => (ge(qe, "react-tiptap-reset"), () => {
637
+ xe("react-tiptap-reset");
638
+ }), []), D(() => {
639
+ e && (e.id = s);
640
+ }, [s, e]), D(() => {
641
+ typeof t == "boolean" && je.setTheme(t ? "dark" : "light");
642
+ }, [t]), e ? /* @__PURE__ */ r("div", { className: k("remarkablejames-editor", t && "dark"), children: /* @__PURE__ */ r(Ne, { children: /* @__PURE__ */ h(ve.Provider, { value: { editor: e }, children: [
643
+ /* @__PURE__ */ r(Ce, { delayDuration: 0, disableHoverableContent: !0, children: i }),
644
+ /* @__PURE__ */ r(Be, { editor: e }),
645
+ /* @__PURE__ */ r(ue, {}),
646
+ /* @__PURE__ */ r(We, {}),
647
+ /* @__PURE__ */ r(Oe, {})
648
+ ] }) }) }) : /* @__PURE__ */ r(E, {});
334
649
  }
335
650
  export {
336
- dt as RichTextProvider,
337
- Y as TooltipProvider
651
+ gt as RichTextProvider,
652
+ Ce as TooltipProvider
338
653
  };