@remarkablejames/editor 0.0.2 → 0.0.3

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 (180) hide show
  1. package/lib/{ActionMenuButton-Bmn3RME4.js → ActionMenuButton-D5HLfRzv.js} +9 -10
  2. package/lib/ActionMenuButton-DN6VHLkp.cjs +1 -0
  3. package/lib/Attachment.cjs +2 -2
  4. package/lib/Attachment.js +31 -33
  5. package/lib/Blockquote.cjs +2 -2
  6. package/lib/Blockquote.js +13 -12
  7. package/lib/Bold.cjs +1 -1
  8. package/lib/Bold.js +11 -10
  9. package/lib/BulletList.cjs +1 -1
  10. package/lib/BulletList.js +9 -8
  11. package/lib/Callout.cjs +1 -1
  12. package/lib/Callout.js +41 -45
  13. package/lib/Clear.cjs +1 -1
  14. package/lib/Clear.js +13 -14
  15. package/lib/Code.cjs +1 -1
  16. package/lib/Code.js +6 -5
  17. package/lib/CodeBlock.cjs +1 -1
  18. package/lib/CodeBlock.js +30 -31
  19. package/lib/CodeView.cjs +1 -1
  20. package/lib/CodeView.js +9 -8
  21. package/lib/Color.cjs +1 -1
  22. package/lib/Color.js +18 -19
  23. package/lib/Column.cjs +1 -1
  24. package/lib/Column.js +9 -8
  25. package/lib/{Drawer-DvGh9aXG.js → Drawer-B9l1SoRJ.js} +41 -47
  26. package/lib/Drawer-BN0lYcnJ.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 +14 -15
  31. package/lib/Excalidraw.cjs +1 -1
  32. package/lib/Excalidraw.js +24 -28
  33. package/lib/ExportPdf.cjs +3 -3
  34. package/lib/ExportPdf.js +14 -13
  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 +7 -6
  39. package/lib/FontSize.cjs +1 -1
  40. package/lib/FontSize.js +15 -14
  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 +22 -23
  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 +10 -9
  49. package/lib/Iframe-CXFk3GEq.cjs +1 -0
  50. package/lib/{Iframe-CnnvV6cK.js → Iframe-MjeJ2OOI.js} +11 -13
  51. package/lib/Iframe.cjs +1 -1
  52. package/lib/Iframe.js +2 -2
  53. package/lib/Image.cjs +1 -1
  54. package/lib/Image.js +4 -5
  55. package/lib/ImageGif.cjs +1 -1
  56. package/lib/ImageGif.js +79 -82
  57. package/lib/ImportWord.cjs +1 -1
  58. package/lib/ImportWord.js +25 -26
  59. package/lib/Indent-BPX9XRos.cjs +1 -0
  60. package/lib/{Indent-Bsj8gKvT.js → Indent-CgwDItIf.js} +31 -30
  61. package/lib/Indent.cjs +1 -1
  62. package/lib/Indent.js +2 -2
  63. package/lib/Italic.cjs +1 -1
  64. package/lib/Italic.js +12 -11
  65. package/lib/{Katex-CilGTz7u.js → Katex-CZ4g3vA9.js} +19 -22
  66. package/lib/Katex-DIgsR_dS.cjs +4 -0
  67. package/lib/Katex.cjs +1 -1
  68. package/lib/Katex.js +2 -2
  69. package/lib/LineHeight.cjs +1 -1
  70. package/lib/LineHeight.js +19 -20
  71. package/lib/Link.cjs +1 -1
  72. package/lib/Link.js +2 -2
  73. package/lib/LinkEditBlock-B2bU0Mcr.cjs +5 -0
  74. package/lib/{LinkEditBlock-BD_WvA3r.js → LinkEditBlock-CaDV3Vq5.js} +19 -24
  75. package/lib/Mention.js +3 -3
  76. package/lib/Mermaid-B9h7XKFo.cjs +2 -0
  77. package/lib/{Mermaid-BrjU75Bs.js → Mermaid-EhYj_ICn.js} +45 -48
  78. package/lib/Mermaid.cjs +1 -1
  79. package/lib/Mermaid.js +2 -2
  80. package/lib/MoreMark.cjs +1 -1
  81. package/lib/MoreMark.js +26 -28
  82. package/lib/OrderedList.cjs +1 -1
  83. package/lib/OrderedList.js +11 -10
  84. package/lib/SearchAndReplace.cjs +1 -1
  85. package/lib/SearchAndReplace.js +37 -42
  86. package/lib/SlashCommand.cjs +1 -1
  87. package/lib/SlashCommand.js +5 -5
  88. package/lib/SlashCommandNodeView-COlWSlnE.cjs +1 -0
  89. package/lib/{SlashCommandNodeView-COx5qZ2y.js → SlashCommandNodeView-CY3peX5x.js} +39 -41
  90. package/lib/Strike.cjs +1 -1
  91. package/lib/Strike.js +12 -11
  92. package/lib/{Table-BlM8yMhr.js → Table-Bw7rLue7.js} +46 -46
  93. package/lib/Table-DLrtX6T7.cjs +5 -0
  94. package/lib/Table.cjs +1 -1
  95. package/lib/Table.js +1 -1
  96. package/lib/TaskList.cjs +1 -1
  97. package/lib/TaskList.js +12 -11
  98. package/lib/TextAlign.cjs +1 -1
  99. package/lib/TextAlign.js +26 -27
  100. package/lib/TextDirection.cjs +1 -1
  101. package/lib/TextDirection.js +18 -19
  102. package/lib/TextUnderline.cjs +1 -1
  103. package/lib/TextUnderline.js +9 -8
  104. package/lib/Twitter-Ck6vGefg.cjs +1 -0
  105. package/lib/{Twitter-BP8sYXX7.js → Twitter-pM0y5Z-L.js} +18 -22
  106. package/lib/Twitter.cjs +1 -1
  107. package/lib/Twitter.js +2 -2
  108. package/lib/Video.cjs +1 -1
  109. package/lib/Video.js +4 -5
  110. package/lib/bubble.cjs +3 -3
  111. package/lib/bubble.js +77 -86
  112. package/lib/{clsx-m_C5j3RU.js → clsx-CDyrfCnw.js} +24 -24
  113. package/lib/{dropdown-menu-CkHN04Mx.cjs → dropdown-menu-DwR8tTs9.cjs} +1 -1
  114. package/lib/{dropdown-menu-C1hdPLCZ.js → dropdown-menu-nX-u8e2w.js} +1 -1
  115. package/lib/extensions/Image/Image.d.ts +11 -0
  116. package/lib/extensions/Image/components/ImageCropper.d.ts +1 -1
  117. package/lib/{index-B3Ijnbxs.js → index-C-tDsIKJ.js} +1 -1
  118. package/lib/{index-C1KQsOcg.js → index-C1WCZhyA.js} +1 -1
  119. package/lib/{index-C8FjP66D.js → index-CsSfYR30.js} +1 -1
  120. package/lib/index-Dib4cXXf.cjs +10 -0
  121. package/lib/{index-s3l5RdyW.js → index-DjDf4BK8.js} +1 -1
  122. package/lib/index-_WrFM-Fk.js +5054 -0
  123. package/lib/index.cjs +4 -4
  124. package/lib/index.js +147 -392
  125. package/lib/{popover-B05Fd8lC.cjs → popover-BY7j9SiD.cjs} +1 -1
  126. package/lib/{popover-CsSXh7w6.js → popover-CSvY4C-l.js} +1 -1
  127. package/lib/{renderNodeView-C_hPIdEs.js → renderNodeView-BJSrgyGj.js} +2 -2
  128. package/lib/{select-B3-5wTqn.js → select-BelNLNvT.js} +1 -1
  129. package/lib/{select-7ubC1NF0.cjs → select-Bu-5iIA9.cjs} +1 -1
  130. package/lib/{separator-CYCA8tSn.js → separator-Br5kcIJa.js} +12 -13
  131. package/lib/separator-Cp9Lg3HU.cjs +1 -0
  132. package/lib/style.css +1 -1
  133. package/lib/{textarea-1FhpmBkP.js → textarea-Ceev4t42.js} +1 -1
  134. package/lib/{textarea-Bjhcpp76.cjs → textarea-DfqvYaA6.cjs} +1 -1
  135. package/lib/theme/theme.d.ts +1 -1
  136. package/lib/{updatePosition-DvfTZHcH.js → updatePosition-e90ZrFWW.js} +2 -2
  137. package/package.json +1 -1
  138. package/lib/ActionMenuButton-C5P0Kzrb.cjs +0 -1
  139. package/lib/Drawer-gz9U5ArC.cjs +0 -2
  140. package/lib/Icon-CKM0tYbW.js +0 -15
  141. package/lib/Icon-CQyFgXeo.cjs +0 -1
  142. package/lib/Iframe-Ds6gG2YO.cjs +0 -1
  143. package/lib/ImageCropper-BKhXlnXN.cjs +0 -1
  144. package/lib/ImageCropper-DUzu_9-6.js +0 -896
  145. package/lib/Indent-D_7HOYYd.cjs +0 -1
  146. package/lib/Katex-lL3bHXJd.cjs +0 -4
  147. package/lib/LinkEditBlock-D3HSHmsU.cjs +0 -5
  148. package/lib/Mermaid-BfeLPzoS.cjs +0 -2
  149. package/lib/SlashCommandNodeView-DD-nlhM-.cjs +0 -1
  150. package/lib/Table-C21AlUrh.cjs +0 -5
  151. package/lib/Twitter-D46MnvPr.cjs +0 -1
  152. package/lib/Video-Bpd8W8l6.js +0 -231
  153. package/lib/Video-BwrHx6B1.cjs +0 -1
  154. package/lib/button-BmTP96NR.cjs +0 -1
  155. package/lib/button-CDIxPURh.js +0 -35
  156. package/lib/checkbox-7sfSdzy9.js +0 -29
  157. package/lib/checkbox-DyVlLWHv.cjs +0 -1
  158. package/lib/dialog-B-jOQ5i3.cjs +0 -1
  159. package/lib/dialog-QWWUWOGP.js +0 -95
  160. package/lib/events.constant-Bh2uzJud.js +0 -71
  161. package/lib/events.constant-ELn21EzG.cjs +0 -1
  162. package/lib/file-BLas99n7.js +0 -43
  163. package/lib/file-i7e4nQY2.cjs +0 -1
  164. package/lib/index-CAiZY1nx.js +0 -2741
  165. package/lib/index-DWSAk_9a.cjs +0 -1
  166. package/lib/input-qvpuOf-3.js +0 -21
  167. package/lib/input-s0JD5kf2.cjs +0 -1
  168. package/lib/isNumber-BTYSVlKo.cjs +0 -1
  169. package/lib/isNumber-WaBzl_0s.js +0 -15
  170. package/lib/label-CFax-gzo.cjs +0 -1
  171. package/lib/label-DC37f2RQ.js +0 -11
  172. package/lib/separator-ncbdw4oq.cjs +0 -1
  173. package/lib/tabs-BeHxylKH.js +0 -46
  174. package/lib/tabs-DBqNpGAq.cjs +0 -1
  175. package/lib/throttle-CRNq0z-O.js +0 -249
  176. package/lib/throttle-gTTvqDTW.cjs +0 -1
  177. package/lib/toggle-DoJTBdvy.js +0 -89
  178. package/lib/toggle-oFwBZC4x.cjs +0 -1
  179. package/lib/useButtonProps-BE10eHkG.js +0 -165
  180. package/lib/useButtonProps-CFu0GHzW.cjs +0 -1
package/lib/index.js CHANGED
@@ -1,36 +1,24 @@
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,
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-_WrFM-Fk.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,
23
11
  {
24
- ref: t,
25
- className: T(
12
+ ref: e,
13
+ className: l(
26
14
  "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]",
27
- e
15
+ t
28
16
  ),
29
- ...i
17
+ ...r
30
18
  }
31
19
  ));
32
- ce.displayName = p.Viewport.displayName;
33
- const Me = Se(
20
+ T.displayName = c.Viewport.displayName;
21
+ const F = H(
34
22
  "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",
35
23
  {
36
24
  variants: {
@@ -43,307 +31,74 @@ const Me = Se(
43
31
  variant: "default"
44
32
  }
45
33
  }
46
- ), se = C.forwardRef(({ className: e, variant: i, ...t }, n) => /* @__PURE__ */ r(
47
- p.Root,
34
+ ), R = u.forwardRef(({ className: t, variant: r, ...e }, n) => /* @__PURE__ */ i(
35
+ c.Root,
48
36
  {
49
37
  ref: n,
50
- className: T(Me({ variant: i }), e),
51
- ...t
38
+ className: l(F({ variant: r }), t),
39
+ ...e
52
40
  }
53
41
  ));
54
- se.displayName = p.Root.displayName;
55
- const Ue = C.forwardRef(({ className: e, ...i }, t) => /* @__PURE__ */ r(
56
- p.Action,
42
+ R.displayName = c.Root.displayName;
43
+ const W = u.forwardRef(({ className: t, ...r }, e) => /* @__PURE__ */ i(
44
+ c.Action,
57
45
  {
58
- ref: t,
59
- className: T(
46
+ ref: e,
47
+ className: l(
60
48
  "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",
61
- e
49
+ t
62
50
  ),
63
- ...i
51
+ ...r
64
52
  }
65
53
  ));
66
- Ue.displayName = p.Action.displayName;
67
- const le = C.forwardRef(({ className: e, ...i }, t) => /* @__PURE__ */ r(
68
- p.Close,
54
+ W.displayName = c.Action.displayName;
55
+ const E = u.forwardRef(({ className: t, ...r }, e) => /* @__PURE__ */ i(
56
+ c.Close,
69
57
  {
70
- ref: t,
71
- className: T(
58
+ ref: e,
59
+ className: l(
72
60
  "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",
73
- e
61
+ t
74
62
  ),
75
63
  "toast-close": "",
76
- ...i,
77
- children: /* @__PURE__ */ r(Pe, { className: "richtext-h-4 richtext-w-4" })
64
+ ...r,
65
+ children: /* @__PURE__ */ i(Y, { className: "richtext-h-4 richtext-w-4" })
78
66
  }
79
67
  ));
80
- le.displayName = p.Close.displayName;
81
- const de = C.forwardRef(({ className: e, ...i }, t) => /* @__PURE__ */ r(
82
- p.Title,
68
+ E.displayName = c.Close.displayName;
69
+ const S = u.forwardRef(({ className: t, ...r }, e) => /* @__PURE__ */ i(
70
+ c.Title,
83
71
  {
84
- ref: t,
85
- className: T("richtext-text-sm richtext-font-semibold", e),
86
- ...i
72
+ ref: e,
73
+ className: l("richtext-text-sm richtext-font-semibold", t),
74
+ ...r
87
75
  }
88
76
  ));
89
- de.displayName = p.Title.displayName;
90
- const ue = C.forwardRef(({ className: e, ...i }, t) => /* @__PURE__ */ r(
91
- p.Description,
77
+ S.displayName = c.Title.displayName;
78
+ const C = u.forwardRef(({ className: t, ...r }, e) => /* @__PURE__ */ i(
79
+ c.Description,
92
80
  {
93
- ref: t,
94
- className: T("richtext-text-sm richtext-opacity-90", e),
95
- ...i
81
+ ref: e,
82
+ className: l("richtext-text-sm richtext-opacity-90", t),
83
+ ...r
96
84
  }
97
85
  ));
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 })
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 })
339
94
  ] }),
340
- s,
341
- /* @__PURE__ */ r(le, {})
342
- ] }, i)),
343
- /* @__PURE__ */ r(ce, {})
95
+ o,
96
+ /* @__PURE__ */ i(E, {})
97
+ ] }, r)),
98
+ /* @__PURE__ */ i(T, {})
344
99
  ] });
345
100
  }
346
- const $e = `
101
+ const U = `
347
102
  .remarkablejames-editor {
348
103
  button,
349
104
  input:where([type=button]),
@@ -451,106 +206,106 @@ const $e = `
451
206
  }
452
207
  }
453
208
  `;
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);
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);
461
216
  };
462
- return D(() => (e && e.on("update", t), () => {
463
- e && e.off("update", t);
464
- }), [e]), /* @__PURE__ */ r(N, {});
217
+ return x(() => (t && t.on("update", e), () => {
218
+ t && t.off("update", e);
219
+ }), [t]), /* @__PURE__ */ i(m, {});
465
220
  }
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)
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)
469
224
  return !1;
470
- if (e.contains)
471
- return e.contains(i);
472
- let t = i;
473
- for (; t; ) {
474
- if (t === e)
225
+ if (t.contains)
226
+ return t.contains(r);
227
+ let e = r;
228
+ for (; e; ) {
229
+ if (e === t)
475
230
  return !0;
476
- t = t.parentNode;
231
+ e = e.parentNode;
477
232
  }
478
233
  return !1;
479
234
  }
480
- function fe({ mark: e } = {}) {
481
- return e ? e.startsWith("data-") ? e : `data-${e}` : Be;
235
+ function j({ mark: t } = {}) {
236
+ return t ? t.startsWith("data-") ? t : `data-${t}` : J;
482
237
  }
483
- function $(e) {
484
- return e.attachTo ? e.attachTo : document.querySelector("head") || document.body;
238
+ function g(t) {
239
+ return t.attachTo ? t.attachTo : document.querySelector("head") || document.body;
485
240
  }
486
- function Oe(e) {
487
- return e === "queue" ? "prependQueue" : e ? "prepend" : "append";
241
+ function tt(t) {
242
+ return t === "queue" ? "prependQueue" : t ? "prepend" : "append";
488
243
  }
489
- function me(e) {
490
- return [...(F.get(e) || e).children].filter(
491
- (i) => i.tagName === "STYLE"
244
+ function P(t) {
245
+ return [...(p.get(t) || t).children].filter(
246
+ (r) => r.tagName === "STYLE"
492
247
  );
493
248
  }
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;
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;
498
253
  if (n) {
499
- if (f) {
500
- const b = me(x).filter((y) => {
501
- if (!["prepend", "prependQueue"].includes(y.getAttribute(O)))
254
+ if (d) {
255
+ const b = P(h).filter((v) => {
256
+ if (!["prepend", "prependQueue"].includes(v.getAttribute(w)))
502
257
  return !1;
503
- const o = Number(y.getAttribute(Q) || 0);
504
- return s >= o;
258
+ const $ = Number(v.getAttribute(N) || 0);
259
+ return o >= $;
505
260
  });
506
261
  if (b.length > 0)
507
- return x.insertBefore(c, b.at(-1).nextSibling), c;
262
+ return h.insertBefore(a, b.at(-1).nextSibling), a;
508
263
  }
509
- m.before(c);
264
+ V.before(a);
510
265
  } else
511
- x.append(c);
512
- return c;
266
+ h.append(a);
267
+ return a;
513
268
  }
514
- function xe(e, i = {}) {
515
- const t = $(i);
516
- return me(t).find((n) => n.getAttribute(fe(i)) === e);
269
+ function M(t, r = {}) {
270
+ const e = g(r);
271
+ return P(e).find((n) => n.getAttribute(j(r)) === t);
517
272
  }
518
- function ge(e, i = {}) {
519
- const t = xe(e, i);
520
- t && t.remove();
273
+ function k(t, r = {}) {
274
+ const e = M(t, r);
275
+ e && e.remove();
521
276
  }
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();
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();
527
282
  }
528
283
  }
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;
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;
538
293
  }
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;
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;
546
301
  return;
547
302
  }
548
- return be(
303
+ return D(
549
304
  `
550
305
  .remarkablejames-editor, .remarkablejames-editor *,
551
306
  .remarkablejames-editor-theme, .remarkablejames-editor-theme *,
552
307
  div[data-richtext-portal], div[data-richtext-portal] * {
553
- ${Object.entries(d).map(([f, c]) => typeof t == "string" && f === "radius" ? `--${f}: ${t};` : `--${f}: ${c};`).join(`
308
+ ${Object.entries(s).map(([d, a]) => typeof e == "string" && d === "radius" ? `--${d}: ${e};` : `--${d}: ${a};`).join(`
554
309
  `)}
555
310
  }
556
311
  `,
@@ -559,25 +314,25 @@ function Ye() {
559
314
  priority: 50
560
315
  }
561
316
  ), () => {
562
- ge("richtext-theme");
317
+ k("richtext-theme");
563
318
  };
564
- }, [e, i, t]), /* @__PURE__ */ r(N, {});
319
+ }, [t, r, e]), /* @__PURE__ */ i(m, {});
565
320
  }
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, {});
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, {});
579
334
  }
580
335
  export {
581
- ht as RichTextProvider,
582
- Ie as TooltipProvider
336
+ dt as RichTextProvider,
337
+ I as TooltipProvider
583
338
  };
@@ -1 +1 @@
1
- "use strict";const a=require("react/jsx-runtime"),s=require("@radix-ui/react-popover"),p=require("react"),x=require("./index-DWSAk_9a.cjs");function n(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 o=n(s),h=n(p),l=o.Root,m=o.Trigger,c=h.forwardRef(({className:t,align:r="center",sideOffset:e=4,...i},d)=>a.jsx(o.Portal,{children:a.jsx(o.Content,{align:r,"data-richtext-portal":!0,ref:d,sideOffset:e,className:x.cn("richtext-z-50 richtext-w-72 richtext-rounded-md !richtext-border !richtext-border-border richtext-bg-popover richtext-p-4 richtext-text-popover-foreground richtext-shadow-md richtext-outline-none data-[state=open]:richtext-animate-in data-[state=closed]:richtext-animate-out data-[state=closed]:richtext-fade-out-0 data-[state=open]:richtext-fade-in-0 data-[state=closed]:richtext-zoom-out-95 data-[state=open]:richtext-zoom-in-95 data-[side=bottom]:richtext-slide-in-from-top-2 data-[side=left]:richtext-slide-in-from-right-2 data-[side=right]:richtext-slide-in-from-left-2 data-[side=top]:richtext-slide-in-from-bottom-2",t),...i})}));c.displayName=o.Content.displayName;exports.Popover=l;exports.PopoverContent=c;exports.PopoverTrigger=m;
1
+ "use strict";const a=require("react/jsx-runtime"),d=require("@radix-ui/react-popover"),p=require("react"),h=require("./index-Dib4cXXf.cjs");function n(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 o=n(d),l=n(p),x=o.Root,m=o.Trigger,c=l.forwardRef(({className:t,align:r="center",sideOffset:e=4,...i},s)=>a.jsx(o.Portal,{children:a.jsx(o.Content,{align:r,"data-richtext-portal":!0,ref:s,sideOffset:e,className:h.cn("richtext-z-50 richtext-w-72 richtext-rounded-md !richtext-border !richtext-border-border richtext-bg-popover richtext-p-4 richtext-text-popover-foreground richtext-shadow-md richtext-outline-none data-[state=open]:richtext-animate-in data-[state=closed]:richtext-animate-out data-[state=closed]:richtext-fade-out-0 data-[state=open]:richtext-fade-in-0 data-[state=closed]:richtext-zoom-out-95 data-[state=open]:richtext-zoom-in-95 data-[side=bottom]:richtext-slide-in-from-top-2 data-[side=left]:richtext-slide-in-from-right-2 data-[side=right]:richtext-slide-in-from-left-2 data-[side=top]:richtext-slide-in-from-bottom-2",t),...i})}));c.displayName=o.Content.displayName;exports.Popover=x;exports.PopoverContent=c;exports.PopoverTrigger=m;
@@ -1,7 +1,7 @@
1
1
  import { jsx as e } from "react/jsx-runtime";
2
2
  import * as t from "@radix-ui/react-popover";
3
3
  import * as c from "react";
4
- import { c as s } from "./index-CAiZY1nx.js";
4
+ import { c as s } from "./index-_WrFM-Fk.js";
5
5
  const x = t.Root, p = t.Trigger, n = c.forwardRef(({ className: o, align: r = "center", sideOffset: i = 4, ...a }, d) => /* @__PURE__ */ e(t.Portal, { children: /* @__PURE__ */ e(
6
6
  t.Content,
7
7
  {