@remarkablejames/editor 0.0.1 → 0.0.2

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 (178) hide show
  1. package/lib/{ActionMenuButton-B0EHT9CC.js → ActionMenuButton-Bmn3RME4.js} +10 -9
  2. package/lib/ActionMenuButton-C5P0Kzrb.cjs +1 -0
  3. package/lib/Attachment.cjs +2 -2
  4. package/lib/Attachment.js +33 -31
  5. package/lib/Blockquote.cjs +2 -2
  6. package/lib/Blockquote.js +12 -13
  7. package/lib/Bold.cjs +1 -1
  8. package/lib/Bold.js +10 -11
  9. package/lib/BulletList.cjs +1 -1
  10. package/lib/BulletList.js +8 -9
  11. package/lib/Callout.cjs +1 -1
  12. package/lib/Callout.js +45 -41
  13. package/lib/Clear.cjs +1 -1
  14. package/lib/Clear.js +14 -13
  15. package/lib/Code.cjs +1 -1
  16. package/lib/Code.js +5 -6
  17. package/lib/CodeBlock.cjs +1 -44
  18. package/lib/CodeBlock.js +183 -3858
  19. package/lib/CodeView.cjs +1 -1
  20. package/lib/CodeView.js +8 -9
  21. package/lib/Color.cjs +1 -1
  22. package/lib/Color.js +19 -18
  23. package/lib/Column.cjs +1 -1
  24. package/lib/Column.js +8 -9
  25. package/lib/{Drawer-BCWVN-4l.js → Drawer-DvGh9aXG.js} +52 -46
  26. package/lib/Drawer-gz9U5ArC.cjs +2 -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 +15 -14
  31. package/lib/Excalidraw.cjs +1 -1
  32. package/lib/Excalidraw.js +20 -16
  33. package/lib/ExportPdf.cjs +3 -3
  34. package/lib/ExportPdf.js +13 -14
  35. package/lib/ExportWord.cjs +1 -1
  36. package/lib/ExportWord.js +6 -6
  37. package/lib/FontFamily.cjs +1 -1
  38. package/lib/FontFamily.js +6 -7
  39. package/lib/FontSize.cjs +1 -1
  40. package/lib/FontSize.js +14 -15
  41. package/lib/Heading.cjs +1 -1
  42. package/lib/Heading.js +26 -26
  43. package/lib/Highlight.cjs +1 -1
  44. package/lib/Highlight.js +23 -22
  45. package/lib/History.cjs +1 -1
  46. package/lib/History.js +11 -11
  47. package/lib/HorizontalRule.cjs +1 -1
  48. package/lib/HorizontalRule.js +9 -10
  49. package/lib/Icon-CKM0tYbW.js +15 -0
  50. package/lib/Icon-CQyFgXeo.cjs +1 -0
  51. package/lib/{Iframe-BdgiWGml.js → Iframe-CnnvV6cK.js} +21 -19
  52. package/lib/Iframe-Ds6gG2YO.cjs +1 -0
  53. package/lib/Iframe.cjs +1 -1
  54. package/lib/Iframe.js +2 -2
  55. package/lib/Image.cjs +1 -1
  56. package/lib/Image.js +5 -4
  57. package/lib/ImageCropper-BKhXlnXN.cjs +1 -0
  58. package/lib/ImageCropper-DUzu_9-6.js +896 -0
  59. package/lib/ImageGif.cjs +1 -1
  60. package/lib/ImageGif.js +94 -91
  61. package/lib/ImportWord.cjs +1 -1
  62. package/lib/ImportWord.js +26 -25
  63. package/lib/{Indent-BpMcZKok.js → Indent-Bsj8gKvT.js} +30 -31
  64. package/lib/Indent-D_7HOYYd.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 +11 -12
  69. package/lib/{Katex-B8_uprkO.js → Katex-CilGTz7u.js} +22 -19
  70. package/lib/Katex-lL3bHXJd.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 +20 -19
  75. package/lib/Link.cjs +1 -1
  76. package/lib/Link.js +2 -2
  77. package/lib/{LinkEditBlock-BX0fXXpF.js → LinkEditBlock-BD_WvA3r.js} +24 -19
  78. package/lib/LinkEditBlock-D3HSHmsU.cjs +5 -0
  79. package/lib/Mention.js +3 -3
  80. package/lib/Mermaid-BfeLPzoS.cjs +2 -0
  81. package/lib/{Mermaid-D8bbIgAl.js → Mermaid-BrjU75Bs.js} +48 -45
  82. package/lib/Mermaid.cjs +1 -1
  83. package/lib/Mermaid.js +2 -2
  84. package/lib/MoreMark.cjs +1 -1
  85. package/lib/MoreMark.js +28 -26
  86. package/lib/OrderedList.cjs +1 -1
  87. package/lib/OrderedList.js +10 -11
  88. package/lib/SearchAndReplace.cjs +1 -1
  89. package/lib/SearchAndReplace.js +42 -37
  90. package/lib/SlashCommand.cjs +1 -1
  91. package/lib/SlashCommand.js +5 -5
  92. package/lib/{SlashCommandNodeView-BcmtKbEE.js → SlashCommandNodeView-COx5qZ2y.js} +41 -39
  93. package/lib/SlashCommandNodeView-DD-nlhM-.cjs +1 -0
  94. package/lib/Strike.cjs +1 -1
  95. package/lib/Strike.js +11 -12
  96. package/lib/{Table-DbxuP5xh.js → Table-BlM8yMhr.js} +46 -46
  97. package/lib/Table-C21AlUrh.cjs +5 -0
  98. package/lib/Table.cjs +1 -1
  99. package/lib/Table.js +1 -1
  100. package/lib/TaskList.cjs +1 -1
  101. package/lib/TaskList.js +11 -12
  102. package/lib/TextAlign.cjs +1 -1
  103. package/lib/TextAlign.js +27 -26
  104. package/lib/TextDirection.cjs +1 -1
  105. package/lib/TextDirection.js +19 -18
  106. package/lib/TextUnderline.cjs +1 -1
  107. package/lib/TextUnderline.js +8 -9
  108. package/lib/{Twitter-9I6BLNmg.js → Twitter-BP8sYXX7.js} +22 -18
  109. package/lib/Twitter-D46MnvPr.cjs +1 -0
  110. package/lib/Twitter.cjs +1 -1
  111. package/lib/Twitter.js +2 -2
  112. package/lib/Video-Bpd8W8l6.js +231 -0
  113. package/lib/Video-BwrHx6B1.cjs +1 -0
  114. package/lib/Video.cjs +1 -1
  115. package/lib/Video.js +5 -4
  116. package/lib/bubble.cjs +3 -3
  117. package/lib/bubble.js +171 -162
  118. package/lib/button-BmTP96NR.cjs +1 -0
  119. package/lib/button-CDIxPURh.js +35 -0
  120. package/lib/checkbox-7sfSdzy9.js +29 -0
  121. package/lib/checkbox-DyVlLWHv.cjs +1 -0
  122. package/lib/{clsx-CDyrfCnw.js → clsx-m_C5j3RU.js} +24 -24
  123. package/lib/dialog-B-jOQ5i3.cjs +1 -0
  124. package/lib/dialog-QWWUWOGP.js +95 -0
  125. package/lib/{dropdown-menu-Bs69ZBbO.js → dropdown-menu-C1hdPLCZ.js} +1 -1
  126. package/lib/{dropdown-menu-DjWlG2-J.cjs → dropdown-menu-CkHN04Mx.cjs} +1 -1
  127. package/lib/events.constant-Bh2uzJud.js +71 -0
  128. package/lib/events.constant-ELn21EzG.cjs +1 -0
  129. package/lib/extensions/CodeBlock/CodeBlock.d.ts +1 -1
  130. package/lib/file-BLas99n7.js +43 -0
  131. package/lib/file-i7e4nQY2.cjs +1 -0
  132. package/lib/{index-C-tDsIKJ.js → index-B3Ijnbxs.js} +1 -1
  133. package/lib/{index-C1WCZhyA.js → index-C1KQsOcg.js} +1 -1
  134. package/lib/{index-CsSfYR30.js → index-C8FjP66D.js} +1 -1
  135. package/lib/index-CAiZY1nx.js +2741 -0
  136. package/lib/index-DWSAk_9a.cjs +1 -0
  137. package/lib/{index-DjDf4BK8.js → index-s3l5RdyW.js} +1 -1
  138. package/lib/index.cjs +4 -4
  139. package/lib/index.js +392 -147
  140. package/lib/input-qvpuOf-3.js +21 -0
  141. package/lib/input-s0JD5kf2.cjs +1 -0
  142. package/lib/isNumber-BTYSVlKo.cjs +1 -0
  143. package/lib/isNumber-WaBzl_0s.js +15 -0
  144. package/lib/label-CFax-gzo.cjs +1 -0
  145. package/lib/label-DC37f2RQ.js +11 -0
  146. package/lib/{popover-D-hUKDYu.cjs → popover-B05Fd8lC.cjs} +1 -1
  147. package/lib/{popover-CPr9bHYn.js → popover-CsSXh7w6.js} +1 -1
  148. package/lib/{renderNodeView-BJSrgyGj.js → renderNodeView-C_hPIdEs.js} +2 -2
  149. package/lib/{select-C2KF4RNg.cjs → select-7ubC1NF0.cjs} +1 -1
  150. package/lib/{select-CuE_HaQJ.js → select-B3-5wTqn.js} +1 -1
  151. package/lib/{separator-CHzYNMVt.js → separator-CYCA8tSn.js} +13 -12
  152. package/lib/separator-ncbdw4oq.cjs +1 -0
  153. package/lib/style.css +1 -1
  154. package/lib/tabs-BeHxylKH.js +46 -0
  155. package/lib/tabs-DBqNpGAq.cjs +1 -0
  156. package/lib/{textarea-gEoNp9CA.js → textarea-1FhpmBkP.js} +1 -1
  157. package/lib/{textarea-DZj6EY-N.cjs → textarea-Bjhcpp76.cjs} +1 -1
  158. package/lib/throttle-CRNq0z-O.js +249 -0
  159. package/lib/throttle-gTTvqDTW.cjs +1 -0
  160. package/lib/toggle-DoJTBdvy.js +89 -0
  161. package/lib/toggle-oFwBZC4x.cjs +1 -0
  162. package/lib/{updatePosition-e90ZrFWW.js → updatePosition-DvfTZHcH.js} +2 -2
  163. package/lib/useButtonProps-BE10eHkG.js +165 -0
  164. package/lib/useButtonProps-CFu0GHzW.cjs +1 -0
  165. package/package.json +1 -1
  166. package/lib/ActionMenuButton-J1el_e6Z.cjs +0 -1
  167. package/lib/Drawer-BTouEroZ.cjs +0 -2
  168. package/lib/Iframe-BfBLILDA.cjs +0 -1
  169. package/lib/Indent-Dvqz_WEn.cjs +0 -1
  170. package/lib/Katex-BQyeCeQ0.cjs +0 -4
  171. package/lib/LinkEditBlock-CIshn_8F.cjs +0 -5
  172. package/lib/Mermaid-0GiGVxn0.cjs +0 -2
  173. package/lib/SlashCommandNodeView-rDJ7OjRd.cjs +0 -1
  174. package/lib/Table-BEhNBeuA.cjs +0 -5
  175. package/lib/Twitter-BuEBgpi9.cjs +0 -1
  176. package/lib/index-D9oM__YW.cjs +0 -1
  177. package/lib/index-lj3VWExo.js +0 -4883
  178. package/lib/separator-_gvUNba_.cjs +0 -1
package/lib/index.js CHANGED
@@ -1,24 +1,36 @@
1
- import { jsx as i, jsxs as f, Fragment as m } from "react/jsx-runtime";
2
- import { K as O } from "./clsx-CDyrfCnw.js";
3
- import * as u from "react";
4
- import { useEffect as x, useId as z } from "react";
5
- import { c as l, S as H, r as L, U as Q, V as _, W as I, X as K } from "./index-lj3VWExo.js";
6
- import * as c from "@radix-ui/react-toast";
7
- import { X as Y } 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 N, jsxs as l } from "react/jsx-runtime";
2
+ import { a1 as ye } from "./clsx-m_C5j3RU.js";
3
+ import * as C from "react";
4
+ import { useState as v, useRef as Y, useMemo as K, useEffect as D, useId as Ne } from "react";
5
+ import { E as G, u as W, R as we } from "./events.constant-Bh2uzJud.js";
6
+ import { D as X, b as J, c as Z } from "./dialog-QWWUWOGP.js";
7
+ import { u as ee, I as Ee, a as Ce, v as Te } from "./ImageCropper-DUzu_9-6.js";
8
+ import { f as te, c as re, i as ie, n as ke, o as Ie } from "./useButtonProps-BE10eHkG.js";
9
+ import { u as oe } from "./index-4Q5IhypJ.js";
10
+ import { T as ae, a as ne, b as j, c as A } from "./tabs-BeHxylKH.js";
11
+ import { C as Re } from "./checkbox-7sfSdzy9.js";
12
+ import { L as B } from "./label-DC37f2RQ.js";
13
+ import { I as _ } from "./input-qvpuOf-3.js";
14
+ import { B as M } from "./button-CDIxPURh.js";
15
+ import { I as De } from "./Icon-CKM0tYbW.js";
16
+ import { V as Ve, c as Le } from "./Video-Bpd8W8l6.js";
17
+ import * as p from "@radix-ui/react-toast";
18
+ import { c as T, a as Se } from "./index-CAiZY1nx.js";
19
+ import { X as Pe } from "lucide-react";
20
+ import { useTheme as je, THEME as H } from "./theme.js";
21
+ const Ae = p.Provider, ce = C.forwardRef(({ className: e, ...i }, t) => /* @__PURE__ */ r(
22
+ p.Viewport,
11
23
  {
12
- ref: e,
13
- className: l(
24
+ ref: t,
25
+ className: T(
14
26
  "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
27
+ e
16
28
  ),
17
- ...r
29
+ ...i
18
30
  }
19
31
  ));
20
- T.displayName = c.Viewport.displayName;
21
- const F = H(
32
+ ce.displayName = p.Viewport.displayName;
33
+ const Me = Se(
22
34
  "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
35
  {
24
36
  variants: {
@@ -31,74 +43,307 @@ const F = H(
31
43
  variant: "default"
32
44
  }
33
45
  }
34
- ), R = u.forwardRef(({ className: t, variant: r, ...e }, n) => /* @__PURE__ */ i(
35
- c.Root,
46
+ ), se = C.forwardRef(({ className: e, variant: i, ...t }, n) => /* @__PURE__ */ r(
47
+ p.Root,
36
48
  {
37
49
  ref: n,
38
- className: l(F({ variant: r }), t),
39
- ...e
50
+ className: T(Me({ variant: i }), e),
51
+ ...t
40
52
  }
41
53
  ));
42
- R.displayName = c.Root.displayName;
43
- const W = u.forwardRef(({ className: t, ...r }, e) => /* @__PURE__ */ i(
44
- c.Action,
54
+ se.displayName = p.Root.displayName;
55
+ const Ue = C.forwardRef(({ className: e, ...i }, t) => /* @__PURE__ */ r(
56
+ p.Action,
45
57
  {
46
- ref: e,
47
- className: l(
58
+ ref: t,
59
+ className: T(
48
60
  "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
61
+ e
50
62
  ),
51
- ...r
63
+ ...i
52
64
  }
53
65
  ));
54
- W.displayName = c.Action.displayName;
55
- const E = u.forwardRef(({ className: t, ...r }, e) => /* @__PURE__ */ i(
56
- c.Close,
66
+ Ue.displayName = p.Action.displayName;
67
+ const le = C.forwardRef(({ className: e, ...i }, t) => /* @__PURE__ */ r(
68
+ p.Close,
57
69
  {
58
- ref: e,
59
- className: l(
70
+ ref: t,
71
+ className: T(
60
72
  "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
73
+ e
62
74
  ),
63
75
  "toast-close": "",
64
- ...r,
65
- children: /* @__PURE__ */ i(Y, { className: "richtext-h-4 richtext-w-4" })
76
+ ...i,
77
+ children: /* @__PURE__ */ r(Pe, { className: "richtext-h-4 richtext-w-4" })
66
78
  }
67
79
  ));
68
- E.displayName = c.Close.displayName;
69
- const S = u.forwardRef(({ className: t, ...r }, e) => /* @__PURE__ */ i(
70
- c.Title,
80
+ le.displayName = p.Close.displayName;
81
+ const de = C.forwardRef(({ className: e, ...i }, t) => /* @__PURE__ */ r(
82
+ p.Title,
71
83
  {
72
- ref: e,
73
- className: l("richtext-text-sm richtext-font-semibold", t),
74
- ...r
84
+ ref: t,
85
+ className: T("richtext-text-sm richtext-font-semibold", e),
86
+ ...i
75
87
  }
76
88
  ));
77
- S.displayName = c.Title.displayName;
78
- const C = u.forwardRef(({ className: t, ...r }, e) => /* @__PURE__ */ i(
79
- c.Description,
89
+ de.displayName = p.Title.displayName;
90
+ const ue = C.forwardRef(({ className: e, ...i }, t) => /* @__PURE__ */ r(
91
+ p.Description,
80
92
  {
81
- ref: e,
82
- className: l("richtext-text-sm richtext-opacity-90", t),
83
- ...r
93
+ ref: t,
94
+ className: T("richtext-text-sm richtext-opacity-90", e),
95
+ ...i
84
96
  }
85
97
  ));
86
- C.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(S, { children: e }),
93
- n && /* @__PURE__ */ i(C, { children: n })
98
+ ue.displayName = p.Description.displayName;
99
+ function ze() {
100
+ const { t: e } = oe(), { toast: i } = ee(), t = te(), { editorDisabled: n } = re(), [s, d] = v(!1), f = G.UPLOAD_IMAGE(t.id);
101
+ W(d, [f]);
102
+ const [c, x] = v(!1), m = ie(Ee.name), [b, y] = v(""), [o, w] = v(""), V = Y(null), k = (m == null ? void 0 : m.options.defaultInline) || !1, [u, g] = v(k), a = K(() => m == null ? void 0 : m.options, [m]);
103
+ async function I(h) {
104
+ var q;
105
+ const R = (q = h == null ? void 0 : h.target) == null ? void 0 : q.files;
106
+ if (!t || t.isDestroyed || R.length === 0 || c) {
107
+ h.target.value = "";
108
+ return;
109
+ }
110
+ const U = Te(R, {
111
+ acceptMimes: a == null ? void 0 : a.acceptMimes,
112
+ maxSize: a == null ? void 0 : a.maxSize,
113
+ t: e,
114
+ toast: i,
115
+ onError: a.onError
116
+ });
117
+ if (U.length <= 0) {
118
+ h.target.value = "";
119
+ return;
120
+ }
121
+ x(!0);
122
+ try {
123
+ if (a != null && a.multiple) {
124
+ const E = U.map(async (P) => {
125
+ let z = "";
126
+ return a.upload ? z = await a.upload(P) : z = URL.createObjectURL(P), z;
127
+ });
128
+ (await Promise.all(E)).forEach((P) => {
129
+ t.chain().focus().setImageInline({ src: P, inline: u, alt: o }).run();
130
+ });
131
+ } else {
132
+ const E = U[0];
133
+ let S = "";
134
+ a.upload ? S = await a.upload(E) : S = URL.createObjectURL(E), t.chain().focus().setImageInline({ src: S, inline: u, alt: o }).run();
135
+ }
136
+ d(!1), w(""), g(k);
137
+ } catch (E) {
138
+ console.error("Error uploading image", E), a.onError ? a.onError({
139
+ type: "upload",
140
+ message: e("editor.upload.error")
141
+ }) : i({
142
+ variant: "destructive",
143
+ title: e("editor.upload.error")
144
+ });
145
+ } finally {
146
+ x(!1), h.target.value = "";
147
+ }
148
+ }
149
+ function L(h) {
150
+ h.preventDefault(), h.stopPropagation(), t.chain().focus().setImageInline({ src: b, inline: u, alt: o }).run(), d(!1), g(k), y(""), w("");
151
+ }
152
+ function ve(h) {
153
+ var R;
154
+ h.preventDefault(), (R = V.current) == null || R.click();
155
+ }
156
+ return n ? /* @__PURE__ */ r(N, {}) : /* @__PURE__ */ r(X, { onOpenChange: d, open: s, children: /* @__PURE__ */ l(J, { children: [
157
+ /* @__PURE__ */ r(Z, { children: e("editor.image.dialog.title") }),
158
+ /* @__PURE__ */ l(
159
+ ae,
160
+ {
161
+ activationMode: "manual",
162
+ defaultValue: a.resourceImage === "both" || a.resourceImage === "upload" ? "upload" : "link",
163
+ children: [
164
+ a.resourceImage === "both" && /* @__PURE__ */ l(ne, { className: "richtext-grid richtext-w-full richtext-grid-cols-2", children: [
165
+ /* @__PURE__ */ r(j, { value: "upload", children: e("editor.image.dialog.tab.upload") }),
166
+ /* @__PURE__ */ r(j, { value: "link", children: e("editor.image.dialog.tab.url") })
167
+ ] }),
168
+ /* @__PURE__ */ l("div", { className: "richtext-my-[10px] richtext-flex richtext-items-center richtext-gap-[4px]", children: [
169
+ /* @__PURE__ */ r(
170
+ Re,
171
+ {
172
+ checked: u,
173
+ onCheckedChange: (h) => {
174
+ g(h);
175
+ }
176
+ }
177
+ ),
178
+ /* @__PURE__ */ r(B, { children: e("editor.link.dialog.inline") })
179
+ ] }),
180
+ a.enableAlt && /* @__PURE__ */ l("div", { className: "richtext-my-[10px]", children: [
181
+ /* @__PURE__ */ r(B, { className: "mb-[6px]", children: e("editor.imageUpload.alt") }),
182
+ /* @__PURE__ */ r(_, { onChange: (h) => w(h.target.value), required: !0, type: "text", value: o })
183
+ ] }),
184
+ /* @__PURE__ */ l(A, { value: "upload", children: [
185
+ /* @__PURE__ */ l("div", { className: "richtext-flex richtext-items-center richtext-gap-[10px]", children: [
186
+ /* @__PURE__ */ r(
187
+ M,
188
+ {
189
+ className: "richtext-mt-1 richtext-w-full",
190
+ disabled: c,
191
+ onClick: ve,
192
+ size: "sm",
193
+ children: c ? /* @__PURE__ */ l(N, { children: [
194
+ e("editor.imageUpload.uploading"),
195
+ /* @__PURE__ */ r(De, { className: "richtext-ml-1 richtext-animate-spin", name: "Loader" })
196
+ ] }) : e("editor.image.dialog.tab.upload")
197
+ }
198
+ ),
199
+ /* @__PURE__ */ r(
200
+ Ce,
201
+ {
202
+ alt: o,
203
+ disabled: c,
204
+ editor: t,
205
+ imageInline: u,
206
+ onClose: () => {
207
+ w("");
208
+ }
209
+ }
210
+ )
211
+ ] }),
212
+ /* @__PURE__ */ r(
213
+ "input",
214
+ {
215
+ accept: a.acceptMimes.join(",") || "image/*",
216
+ multiple: a.multiple,
217
+ onChange: I,
218
+ ref: V,
219
+ style: { display: "none" },
220
+ type: "file"
221
+ }
222
+ )
223
+ ] }),
224
+ /* @__PURE__ */ r(A, { value: "link", children: /* @__PURE__ */ r("form", { onSubmit: L, children: /* @__PURE__ */ l("div", { className: "richtext-flex richtext-items-center richtext-gap-2", children: [
225
+ /* @__PURE__ */ r(
226
+ _,
227
+ {
228
+ autoFocus: !0,
229
+ onChange: (h) => y(h.target.value),
230
+ placeholder: e("editor.image.dialog.placeholder"),
231
+ required: !0,
232
+ type: "url",
233
+ value: b
234
+ }
235
+ ),
236
+ /* @__PURE__ */ r(M, { type: "submit", children: e("editor.image.dialog.button.apply") })
237
+ ] }) }) })
238
+ ]
239
+ }
240
+ )
241
+ ] }) });
242
+ }
243
+ function _e() {
244
+ const { t: e } = oe(), i = te(), { editorDisabled: t } = re(), [n, s] = v(""), d = Y(null), [f, c] = v(""), [x, m] = v(!1), b = ie(Ve.name), y = G.UPLOAD_VIDEO(i.id);
245
+ W(m, [y]);
246
+ const o = K(() => (b == null ? void 0 : b.options) ?? {}, [b]);
247
+ async function w(u) {
248
+ var L;
249
+ const g = (L = u == null ? void 0 : u.target) == null ? void 0 : L.files;
250
+ if (!i || i.isDestroyed || g.length === 0)
251
+ return;
252
+ const a = g[0];
253
+ let I = "";
254
+ o.upload ? I = await o.upload(a) : I = URL.createObjectURL(a), i.chain().focus().setVideo({
255
+ src: I,
256
+ width: "100%"
257
+ }).run(), m(!1);
258
+ }
259
+ function V(u) {
260
+ u.preventDefault(), u.stopPropagation(), n && (i.chain().focus().setVideo({
261
+ src: n,
262
+ width: "100%"
263
+ }).run(), m(!1), s(""));
264
+ }
265
+ function k(u) {
266
+ var g;
267
+ u.preventDefault(), (g = d.current) == null || g.click();
268
+ }
269
+ return t ? /* @__PURE__ */ r(N, {}) : /* @__PURE__ */ r(X, { onOpenChange: m, open: x, children: /* @__PURE__ */ l(J, { children: [
270
+ /* @__PURE__ */ r(Z, { children: e("editor.video.dialog.title") }),
271
+ /* @__PURE__ */ l(
272
+ ae,
273
+ {
274
+ activationMode: "manual",
275
+ defaultValue: (o == null ? void 0 : o.resourceVideo) === "both" || (o == null ? void 0 : o.resourceVideo) === "upload" ? "upload" : "link",
276
+ children: [
277
+ /* @__PURE__ */ l(ne, { className: "richtext-grid richtext-w-full richtext-grid-cols-2", children: [
278
+ ((o == null ? void 0 : o.resourceVideo) === "both" || (o == null ? void 0 : o.resourceVideo) === "upload") && /* @__PURE__ */ r(j, { value: "upload", children: e("editor.video.dialog.tab.upload") }),
279
+ ((o == null ? void 0 : o.resourceVideo) === "both" || (o == null ? void 0 : o.resourceVideo) === "link") && /* @__PURE__ */ r(j, { value: "link", children: e("editor.video.dialog.link") })
280
+ ] }),
281
+ /* @__PURE__ */ l(A, { value: "upload", children: [
282
+ /* @__PURE__ */ r("div", { className: "richtext-flex richtext-items-center richtext-gap-[10px]", children: /* @__PURE__ */ r(M, { className: "richtext-mt-1 richtext-w-full", onClick: k, size: "sm", children: e("editor.video.dialog.tab.upload") }) }),
283
+ /* @__PURE__ */ r(
284
+ "input",
285
+ {
286
+ accept: "video/*",
287
+ multiple: !0,
288
+ onChange: w,
289
+ ref: d,
290
+ type: "file",
291
+ style: {
292
+ display: "none"
293
+ }
294
+ }
295
+ )
296
+ ] }),
297
+ /* @__PURE__ */ l(A, { value: "link", children: [
298
+ /* @__PURE__ */ r("div", { children: /* @__PURE__ */ l("div", { className: "richtext-flex richtext-items-center richtext-gap-2", children: [
299
+ /* @__PURE__ */ r(
300
+ _,
301
+ {
302
+ autoFocus: !0,
303
+ placeholder: e("editor.video.dialog.placeholder"),
304
+ required: !0,
305
+ type: "url",
306
+ value: n,
307
+ onBlur: (u) => {
308
+ const g = u.target.value, a = o.videoProviders || ["."];
309
+ g && !Le(g, a) ? c("Invalid video URL") : c("");
310
+ },
311
+ onChange: (u) => {
312
+ s(u.target.value);
313
+ }
314
+ }
315
+ ),
316
+ /* @__PURE__ */ r(M, { onClick: V, type: "button", children: e("editor.video.dialog.button.apply") })
317
+ ] }) }),
318
+ f && /* @__PURE__ */ r("div", { className: "richtext-my-[5px] richtext-text-red-500", children: f })
319
+ ] })
320
+ ]
321
+ }
322
+ )
323
+ ] }) });
324
+ }
325
+ function he() {
326
+ return /* @__PURE__ */ l(N, { children: [
327
+ /* @__PURE__ */ r(ze, {}),
328
+ /* @__PURE__ */ r(_e, {})
329
+ ] });
330
+ }
331
+ process.env.NODE_ENV !== "production" && (he.displayName = "SlashDialogTrigger");
332
+ function Fe() {
333
+ const { toasts: e } = ee();
334
+ return /* @__PURE__ */ l(Ae, { children: [
335
+ e.map(({ id: i, title: t, description: n, action: s, ...d }) => /* @__PURE__ */ l(se, { ...d, children: [
336
+ /* @__PURE__ */ l("div", { className: "richtext-grid richtext-gap-1", children: [
337
+ t && /* @__PURE__ */ r(de, { children: t }),
338
+ n && /* @__PURE__ */ r(ue, { children: n })
94
339
  ] }),
95
- o,
96
- /* @__PURE__ */ i(E, {})
97
- ] }, r)),
98
- /* @__PURE__ */ i(T, {})
340
+ s,
341
+ /* @__PURE__ */ r(le, {})
342
+ ] }, i)),
343
+ /* @__PURE__ */ r(ce, {})
99
344
  ] });
100
345
  }
101
- const U = `
346
+ const $e = `
102
347
  .remarkablejames-editor {
103
348
  button,
104
349
  input:where([type=button]),
@@ -206,106 +451,106 @@ const U = `
206
451
  }
207
452
  }
208
453
  `;
209
- function G({ editor: t }) {
210
- const r = Q();
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);
454
+ function qe({ editor: e }) {
455
+ const i = ke();
456
+ D(() => {
457
+ i(e == null ? void 0 : e.isEditable);
458
+ }, [e == null ? void 0 : e.isEditable]);
459
+ const t = () => {
460
+ i(e == null ? void 0 : e.isEditable);
216
461
  };
217
- return x(() => (t && t.on("update", e), () => {
218
- t && t.off("update", e);
219
- }), [t]), /* @__PURE__ */ i(m, {});
462
+ return D(() => (e && e.on("update", t), () => {
463
+ e && e.off("update", t);
464
+ }), [e]), /* @__PURE__ */ r(N, {});
220
465
  }
221
- const w = "data-rc-order", N = "data-rc-priority", J = "rc-util-key", p = /* @__PURE__ */ new Map();
222
- function Z(t, r) {
223
- if (!t)
466
+ const O = "data-rc-order", Q = "data-rc-priority", Be = "rc-util-key", F = /* @__PURE__ */ new Map();
467
+ function He(e, i) {
468
+ if (!e)
224
469
  return !1;
225
- if (t.contains)
226
- return t.contains(r);
227
- let e = r;
228
- for (; e; ) {
229
- if (e === t)
470
+ if (e.contains)
471
+ return e.contains(i);
472
+ let t = i;
473
+ for (; t; ) {
474
+ if (t === e)
230
475
  return !0;
231
- e = e.parentNode;
476
+ t = t.parentNode;
232
477
  }
233
478
  return !1;
234
479
  }
235
- function j({ mark: t } = {}) {
236
- return t ? t.startsWith("data-") ? t : `data-${t}` : J;
480
+ function fe({ mark: e } = {}) {
481
+ return e ? e.startsWith("data-") ? e : `data-${e}` : Be;
237
482
  }
238
- function g(t) {
239
- return t.attachTo ? t.attachTo : document.querySelector("head") || document.body;
483
+ function $(e) {
484
+ return e.attachTo ? e.attachTo : document.querySelector("head") || document.body;
240
485
  }
241
- function tt(t) {
242
- return t === "queue" ? "prependQueue" : t ? "prepend" : "append";
486
+ function Oe(e) {
487
+ return e === "queue" ? "prependQueue" : e ? "prepend" : "append";
243
488
  }
244
- function P(t) {
245
- return [...(p.get(t) || t).children].filter(
246
- (r) => r.tagName === "STYLE"
489
+ function me(e) {
490
+ return [...(F.get(e) || e).children].filter(
491
+ (i) => i.tagName === "STYLE"
247
492
  );
248
493
  }
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;
494
+ function pe(e, i = {}) {
495
+ const { csp: t, prepend: n, priority: s = 0 } = i, d = Oe(n), f = d === "prependQueue", c = document.createElement("style");
496
+ c.setAttribute(O, d), f && s && c.setAttribute(Q, `${s}`), t != null && t.nonce && (c.nonce = t == null ? void 0 : t.nonce), c.innerHTML = e;
497
+ const x = $(i), { firstChild: m } = x;
253
498
  if (n) {
254
- if (d) {
255
- const b = P(h).filter((v) => {
256
- if (!["prepend", "prependQueue"].includes(v.getAttribute(w)))
499
+ if (f) {
500
+ const b = me(x).filter((y) => {
501
+ if (!["prepend", "prependQueue"].includes(y.getAttribute(O)))
257
502
  return !1;
258
- const $ = Number(v.getAttribute(N) || 0);
259
- return o >= $;
503
+ const o = Number(y.getAttribute(Q) || 0);
504
+ return s >= o;
260
505
  });
261
506
  if (b.length > 0)
262
- return h.insertBefore(a, b.at(-1).nextSibling), a;
507
+ return x.insertBefore(c, b.at(-1).nextSibling), c;
263
508
  }
264
- V.before(a);
509
+ m.before(c);
265
510
  } else
266
- h.append(a);
267
- return a;
511
+ x.append(c);
512
+ return c;
268
513
  }
269
- function M(t, r = {}) {
270
- const e = g(r);
271
- return P(e).find((n) => n.getAttribute(j(r)) === t);
514
+ function xe(e, i = {}) {
515
+ const t = $(i);
516
+ return me(t).find((n) => n.getAttribute(fe(i)) === e);
272
517
  }
273
- function k(t, r = {}) {
274
- const e = M(t, r);
275
- e && e.remove();
518
+ function ge(e, i = {}) {
519
+ const t = xe(e, i);
520
+ t && t.remove();
276
521
  }
277
- function et(t, r) {
278
- const e = p.get(t);
279
- if (!e || !Z(document, e)) {
280
- const n = A("", r), { parentNode: o } = n;
281
- p.set(t, o), n.remove();
522
+ function Qe(e, i) {
523
+ const t = F.get(e);
524
+ if (!t || !He(document, t)) {
525
+ const n = pe("", i), { parentNode: s } = n;
526
+ F.set(e, s), n.remove();
282
527
  }
283
528
  }
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;
529
+ function be(e, i, t = {}) {
530
+ var f, c, x;
531
+ const n = $(t);
532
+ Qe(n, t);
533
+ const s = xe(i, t);
534
+ if (s)
535
+ return (f = t.csp) != null && f.nonce && s.nonce !== ((c = t.csp) == null ? void 0 : c.nonce) && (s.nonce = (x = t.csp) == null ? void 0 : x.nonce), s.innerHTML !== e && (s.innerHTML = e), s;
536
+ const d = pe(e, t);
537
+ return d.setAttribute(fe(t), i), d;
293
538
  }
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;
539
+ function Ye() {
540
+ const { theme: e, color: i, borderRadius: t } = je();
541
+ return D(() => {
542
+ const n = e || "light", s = i || "default";
543
+ let d = H[n][s];
544
+ if (!d) {
545
+ d = H.light.default;
301
546
  return;
302
547
  }
303
- return D(
548
+ return be(
304
549
  `
305
550
  .remarkablejames-editor, .remarkablejames-editor *,
306
551
  .remarkablejames-editor-theme, .remarkablejames-editor-theme *,
307
552
  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(`
553
+ ${Object.entries(d).map(([f, c]) => typeof t == "string" && f === "radius" ? `--${f}: ${t};` : `--${f}: ${c};`).join(`
309
554
  `)}
310
555
  }
311
556
  `,
@@ -314,25 +559,25 @@ function rt() {
314
559
  priority: 50
315
560
  }
316
561
  ), () => {
317
- k("richtext-theme");
562
+ ge("richtext-theme");
318
563
  };
319
- }, [t, r, e]), /* @__PURE__ */ i(m, {});
564
+ }, [e, i, t]), /* @__PURE__ */ r(N, {});
320
565
  }
321
- function dt({ editor: t, children: r }) {
322
- const e = z();
323
- return x(() => (D(U, "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(_, { children: /* @__PURE__ */ f(O.Provider, { value: { editor: t }, children: [
328
- /* @__PURE__ */ i(I, { delayDuration: 0, disableHoverableContent: !0, children: r }),
329
- /* @__PURE__ */ i(G, { editor: t }),
330
- /* @__PURE__ */ i(K, {}),
331
- /* @__PURE__ */ i(rt, {}),
332
- /* @__PURE__ */ i(X, {})
333
- ] }) }) }) : /* @__PURE__ */ i(m, {});
566
+ function ht({ editor: e, children: i }) {
567
+ const t = Ne();
568
+ return D(() => (be($e, "react-tiptap-reset"), () => {
569
+ ge("react-tiptap-reset");
570
+ }), []), D(() => {
571
+ e && (e.id = t);
572
+ }, [t, e]), e ? /* @__PURE__ */ r("div", { className: "remarkablejames-editor", children: /* @__PURE__ */ r(we, { children: /* @__PURE__ */ l(ye.Provider, { value: { editor: e }, children: [
573
+ /* @__PURE__ */ r(Ie, { delayDuration: 0, disableHoverableContent: !0, children: i }),
574
+ /* @__PURE__ */ r(qe, { editor: e }),
575
+ /* @__PURE__ */ r(he, {}),
576
+ /* @__PURE__ */ r(Ye, {}),
577
+ /* @__PURE__ */ r(Fe, {})
578
+ ] }) }) }) : /* @__PURE__ */ r(N, {});
334
579
  }
335
580
  export {
336
- dt as RichTextProvider,
337
- I as TooltipProvider
581
+ ht as RichTextProvider,
582
+ Ie as TooltipProvider
338
583
  };
@@ -0,0 +1,21 @@
1
+ import { jsx as c } from "react/jsx-runtime";
2
+ import * as o from "react";
3
+ import { c as x } from "./index-CAiZY1nx.js";
4
+ const h = o.forwardRef(
5
+ ({ className: t, type: e, ...r }, i) => /* @__PURE__ */ c(
6
+ "input",
7
+ {
8
+ ref: i,
9
+ type: e,
10
+ className: x(
11
+ "richtext-flex richtext-h-10 richtext-w-full richtext-rounded-md !richtext-border richtext-border-input richtext-bg-transparent richtext-px-3 richtext-py-2 richtext-text-sm richtext-text-foreground richtext-ring-offset-background file:richtext-border-0 file:richtext-bg-transparent file:richtext-text-sm file:richtext-font-medium placeholder:richtext-text-muted-foreground focus-visible:richtext-outline-none focus-visible:richtext-ring-1 focus-visible:richtext-ring-ring focus-visible:richtext-ring-offset-1 disabled:richtext-cursor-not-allowed disabled:richtext-opacity-50",
12
+ t
13
+ ),
14
+ ...r
15
+ }
16
+ )
17
+ );
18
+ h.displayName = "Input";
19
+ export {
20
+ h as I
21
+ };
@@ -0,0 +1 @@
1
+ "use strict";const n=require("react/jsx-runtime"),o=require("react"),s=require("./index-DWSAk_9a.cjs");function u(t){const r=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const e in t)if(e!=="default"){const i=Object.getOwnPropertyDescriptor(t,e);Object.defineProperty(r,e,i.get?i:{enumerable:!0,get:()=>t[e]})}}return r.default=t,Object.freeze(r)}const x=u(o),c=x.forwardRef(({className:t,type:r,...e},i)=>n.jsx("input",{ref:i,type:r,className:s.cn("richtext-flex richtext-h-10 richtext-w-full richtext-rounded-md !richtext-border richtext-border-input richtext-bg-transparent richtext-px-3 richtext-py-2 richtext-text-sm richtext-text-foreground richtext-ring-offset-background file:richtext-border-0 file:richtext-bg-transparent file:richtext-text-sm file:richtext-font-medium placeholder:richtext-text-muted-foreground focus-visible:richtext-outline-none focus-visible:richtext-ring-1 focus-visible:richtext-ring-ring focus-visible:richtext-ring-offset-1 disabled:richtext-cursor-not-allowed disabled:richtext-opacity-50",t),...e}));c.displayName="Input";exports.Input=c;