@remarkablejames/editor 0.0.7 → 0.0.8

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 (185) hide show
  1. package/lib/ActionMenuButton-DI9_8wC0.cjs +1 -0
  2. package/lib/{ActionMenuButton-nxV91Fqo.js → ActionMenuButton-DL05l66z.js} +9 -10
  3. package/lib/Attachment.cjs +1 -19
  4. package/lib/Attachment.js +7 -270
  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-DEzhWKwY.cjs +2 -0
  26. package/lib/{Drawer-CF6Z_IA2.js → Drawer-DhM1qM6R.js} +41 -47
  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 +28 -33
  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-DbYJ82AI.cjs +1 -0
  50. package/lib/{Iframe-Dfd3LI7b.js → Iframe-yDX_zHls.js} +11 -14
  51. package/lib/Iframe.cjs +1 -1
  52. package/lib/Iframe.js +3 -3
  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 +83 -86
  57. package/lib/ImportWord.cjs +1 -1
  58. package/lib/ImportWord.js +26 -28
  59. package/lib/{Indent-CDVF9DWN.js → Indent-CA46zsbb.js} +31 -30
  60. package/lib/Indent-CYaCq_Mv.cjs +1 -0
  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-Dh-kTBjf.cjs +4 -0
  66. package/lib/{Katex-DqhWWAA-.js → Katex-g3ZS3zUf.js} +19 -22
  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-ClqpI1FH.cjs +5 -0
  74. package/lib/{LinkEditBlock-xP0pGVhB.js → LinkEditBlock-qE5KHPQs.js} +19 -24
  75. package/lib/Mention.js +3 -3
  76. package/lib/Mermaid-BmUChJSB.cjs +2 -0
  77. package/lib/{Mermaid-BJ6ryVdY.js → Mermaid-CefRECZY.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/PaywallSeparator.cjs +1 -1
  85. package/lib/PaywallSeparator.js +9 -9
  86. package/lib/SearchAndReplace.cjs +1 -1
  87. package/lib/SearchAndReplace.js +37 -42
  88. package/lib/SlashCommand.cjs +1 -1
  89. package/lib/SlashCommand.js +5 -5
  90. package/lib/{SlashCommandNodeView-DS9FqMiY.js → SlashCommandNodeView-BsIrWlhS.js} +19 -21
  91. package/lib/SlashCommandNodeView-DpXsfGmo.cjs +1 -0
  92. package/lib/Strike.cjs +1 -1
  93. package/lib/Strike.js +12 -11
  94. package/lib/Table-B-0TePQ3.cjs +5 -0
  95. package/lib/{Table-CcG-JNtV.js → Table-CG0nisk4.js} +46 -46
  96. package/lib/Table.cjs +1 -1
  97. package/lib/Table.js +1 -1
  98. package/lib/TaskList.cjs +1 -1
  99. package/lib/TaskList.js +12 -11
  100. package/lib/TextAlign.cjs +1 -1
  101. package/lib/TextAlign.js +26 -27
  102. package/lib/TextDirection.cjs +1 -1
  103. package/lib/TextDirection.js +18 -19
  104. package/lib/TextUnderline.cjs +1 -1
  105. package/lib/TextUnderline.js +9 -8
  106. package/lib/{Twitter-BIL3o833.js → Twitter-DlGSWdh7.js} +18 -22
  107. package/lib/Twitter-DvMmVNMF.cjs +1 -0
  108. package/lib/Twitter.cjs +1 -1
  109. package/lib/Twitter.js +2 -2
  110. package/lib/Video.cjs +1 -1
  111. package/lib/Video.js +4 -5
  112. package/lib/bubble.cjs +3 -3
  113. package/lib/bubble.js +77 -86
  114. package/lib/{clsx-m_C5j3RU.js → clsx-BUPZHhq3.js} +24 -24
  115. package/lib/{dropdown-menu-DWt_xj4h.js → dropdown-menu-D-mNjyKn.js} +1 -1
  116. package/lib/{dropdown-menu-tUP872Zv.cjs → dropdown-menu-gOopBX-L.cjs} +1 -1
  117. package/lib/index-CUnpdrCy.cjs +28 -0
  118. package/lib/index-CelRl0mr.js +5447 -0
  119. package/lib/{index-C8FjP66D.js → index-D4M4hrH4.js} +1 -1
  120. package/lib/{index-s3l5RdyW.js → index-DZj2z9_1.js} +1 -1
  121. package/lib/{index-C1KQsOcg.js → index-Dl3OjzmR.js} +1 -1
  122. package/lib/{index-B3Ijnbxs.js → index-RkKGy5oa.js} +1 -1
  123. package/lib/index.cjs +4 -4
  124. package/lib/index.js +151 -464
  125. package/lib/{popover-C3A6zzNV.cjs → popover-DEMkixfo.cjs} +1 -1
  126. package/lib/{popover-BC7FRr8B.js → popover-SMtif0E1.js} +1 -1
  127. package/lib/{renderNodeView-C_hPIdEs.js → renderNodeView-dj6AaFSX.js} +2 -2
  128. package/lib/{select-B8HIWDXf.cjs → select-BqlizSg4.cjs} +1 -1
  129. package/lib/{select-DSKqhVGR.js → select-Dc3RkAhQ.js} +1 -1
  130. package/lib/{separator-BJWSNjvr.js → separator-DWLSmuSh.js} +12 -13
  131. package/lib/separator-DuP4NoiV.cjs +1 -0
  132. package/lib/style.css +1 -1
  133. package/lib/{textarea-CtVdqwSM.cjs → textarea-C89l2GRG.cjs} +1 -1
  134. package/lib/{textarea-Ch5w3PiI.js → textarea-DvciwVxS.js} +1 -1
  135. package/lib/theme.cjs +1 -1
  136. package/lib/theme.js +18 -18
  137. package/lib/{updatePosition-DvfTZHcH.js → updatePosition-C294Pixi.js} +2 -2
  138. package/package.json +1 -1
  139. package/lib/ActionMenuButton-D9o3Kwmv.cjs +0 -1
  140. package/lib/Drawer-Bh-y5bs8.cjs +0 -2
  141. package/lib/Icon-BvGyfX2j.js +0 -15
  142. package/lib/Icon-wjwoRc9F.cjs +0 -1
  143. package/lib/Iframe-BbfZKbPY.cjs +0 -1
  144. package/lib/ImageCropper-CY1ETEjC.cjs +0 -10
  145. package/lib/ImageCropper-DrSdjo9x.js +0 -979
  146. package/lib/Indent-Q1VuhSM2.cjs +0 -1
  147. package/lib/Katex-K1QU2SB2.cjs +0 -4
  148. package/lib/LinkEditBlock-CBYGLs3J.cjs +0 -5
  149. package/lib/Mermaid-D3_nLeOW.cjs +0 -2
  150. package/lib/SlashCommandNodeView-CUJrDQS7.cjs +0 -1
  151. package/lib/Table-CV6pUoVf.cjs +0 -5
  152. package/lib/Twitter-BfSTqPDh.cjs +0 -1
  153. package/lib/Video-DAKr90QL.js +0 -231
  154. package/lib/Video-HAinT0w6.cjs +0 -1
  155. package/lib/button-090-I3tp.js +0 -35
  156. package/lib/button-B4Sz2ZhW.cjs +0 -1
  157. package/lib/checkbox-BCPsu7yR.cjs +0 -1
  158. package/lib/checkbox-DiXWHAI0.js +0 -29
  159. package/lib/dialog-C8J59d2J.cjs +0 -1
  160. package/lib/dialog-bDkDW-C_.js +0 -95
  161. package/lib/dom-dataset-BqoJhJXt.cjs +0 -1
  162. package/lib/dom-dataset-CIEeltF6.js +0 -47
  163. package/lib/events.constant-Bke62qxm.cjs +0 -1
  164. package/lib/events.constant-CSWD3-ho.js +0 -72
  165. package/lib/file-i7e4nQY2.cjs +0 -1
  166. package/lib/file-jDdkhyj7.js +0 -43
  167. package/lib/index-BXh8X1ch.cjs +0 -1
  168. package/lib/index-jMN4V2hr.js +0 -2763
  169. package/lib/input-C_J-pfTx.js +0 -21
  170. package/lib/input-DwLo4r7V.cjs +0 -1
  171. package/lib/isNumber-BTYSVlKo.cjs +0 -1
  172. package/lib/isNumber-WaBzl_0s.js +0 -15
  173. package/lib/label-BgIVynq3.cjs +0 -1
  174. package/lib/label-ClsOg9Hr.js +0 -11
  175. package/lib/separator-D6ruF682.cjs +0 -1
  176. package/lib/tabs-D1J1iB7B.js +0 -46
  177. package/lib/tabs-IEbMQmNX.cjs +0 -1
  178. package/lib/throttle-CRNq0z-O.js +0 -249
  179. package/lib/throttle-gTTvqDTW.cjs +0 -1
  180. package/lib/toggle-C9tcMm1r.cjs +0 -1
  181. package/lib/toggle-CaSwYCk4.js +0 -89
  182. package/lib/use-toast-C6zPo25l.cjs +0 -1
  183. package/lib/use-toast-CEOqhXfx.js +0 -97
  184. package/lib/useButtonProps-D-ruygH7.js +0 -165
  185. package/lib/useButtonProps-D9ndBdmA.cjs +0 -1
package/lib/index.js CHANGED
@@ -1,38 +1,24 @@
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,
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 x from "react";
4
+ import { useEffect as l, useId as z } from "react";
5
+ import { c as u, P as H, r as L, Q, R as _, S as I, U as K } from "./index-CelRl0mr.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, themeActions as B } from "./theme.js";
9
+ const F = c.Provider, T = x.forwardRef(({ className: t, ...r }, e) => /* @__PURE__ */ i(
10
+ c.Viewport,
25
11
  {
26
- ref: t,
27
- className: k(
12
+ ref: e,
13
+ className: u(
28
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]",
29
- e
15
+ t
30
16
  ),
31
- ...i
17
+ ...r
32
18
  }
33
19
  ));
34
- ae.displayName = g.Viewport.displayName;
35
- const _e = Le(
20
+ T.displayName = c.Viewport.displayName;
21
+ const U = H(
36
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",
37
23
  {
38
24
  variants: {
@@ -45,373 +31,74 @@ const _e = Le(
45
31
  variant: "default"
46
32
  }
47
33
  }
48
- ), ce = I.forwardRef(({ className: e, variant: i, ...t }, s) => /* @__PURE__ */ r(
49
- g.Root,
34
+ ), R = x.forwardRef(({ className: t, variant: r, ...e }, n) => /* @__PURE__ */ i(
35
+ c.Root,
50
36
  {
51
- ref: s,
52
- className: k(_e({ variant: i }), e),
53
- ...t
37
+ ref: n,
38
+ className: u(U({ variant: r }), t),
39
+ ...e
54
40
  }
55
41
  ));
56
- ce.displayName = g.Root.displayName;
57
- const ze = I.forwardRef(({ className: e, ...i }, t) => /* @__PURE__ */ r(
58
- g.Action,
42
+ R.displayName = c.Root.displayName;
43
+ const W = x.forwardRef(({ className: t, ...r }, e) => /* @__PURE__ */ i(
44
+ c.Action,
59
45
  {
60
- ref: t,
61
- className: k(
46
+ ref: e,
47
+ className: u(
62
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",
63
- e
49
+ t
64
50
  ),
65
- ...i
51
+ ...r
66
52
  }
67
53
  ));
68
- ze.displayName = g.Action.displayName;
69
- const se = I.forwardRef(({ className: e, ...i }, t) => /* @__PURE__ */ r(
70
- g.Close,
54
+ W.displayName = c.Action.displayName;
55
+ const E = x.forwardRef(({ className: t, ...r }, e) => /* @__PURE__ */ i(
56
+ c.Close,
71
57
  {
72
- ref: t,
73
- className: k(
58
+ ref: e,
59
+ className: u(
74
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",
75
- e
61
+ t
76
62
  ),
77
63
  "toast-close": "",
78
- ...i,
79
- 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" })
80
66
  }
81
67
  ));
82
- se.displayName = g.Close.displayName;
83
- const le = I.forwardRef(({ className: e, ...i }, t) => /* @__PURE__ */ r(
84
- g.Title,
68
+ E.displayName = c.Close.displayName;
69
+ const S = x.forwardRef(({ className: t, ...r }, e) => /* @__PURE__ */ i(
70
+ c.Title,
85
71
  {
86
- ref: t,
87
- className: k("richtext-text-sm richtext-font-semibold", e),
88
- ...i
72
+ ref: e,
73
+ className: u("richtext-text-sm richtext-font-semibold", t),
74
+ ...r
89
75
  }
90
76
  ));
91
- le.displayName = g.Title.displayName;
92
- const de = I.forwardRef(({ className: e, ...i }, t) => /* @__PURE__ */ r(
93
- g.Description,
77
+ S.displayName = c.Title.displayName;
78
+ const C = x.forwardRef(({ className: t, ...r }, e) => /* @__PURE__ */ i(
79
+ c.Description,
94
80
  {
95
- ref: t,
96
- className: k("richtext-text-sm richtext-opacity-90", e),
97
- ...i
81
+ ref: e,
82
+ className: u("richtext-text-sm richtext-opacity-90", t),
83
+ ...r
98
84
  }
99
85
  ));
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 })
86
+ C.displayName = c.Description.displayName;
87
+ function X() {
88
+ const { toasts: t } = L();
89
+ return /* @__PURE__ */ f(F, { 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 })
407
94
  ] }),
408
- l,
409
- /* @__PURE__ */ r(se, {})
410
- ] }, i)),
411
- /* @__PURE__ */ r(ae, {})
95
+ o,
96
+ /* @__PURE__ */ i(E, {})
97
+ ] }, r)),
98
+ /* @__PURE__ */ i(T, {})
412
99
  ] });
413
100
  }
414
- const qe = `
101
+ const G = `
415
102
  .remarkablejames-editor {
416
103
  button,
417
104
  input:where([type=button]),
@@ -519,106 +206,106 @@ const qe = `
519
206
  }
520
207
  }
521
208
  `;
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);
209
+ function J({ editor: t }) {
210
+ const r = Q();
211
+ l(() => {
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);
529
216
  };
530
- return D(() => (e && e.on("update", t), () => {
531
- e && e.off("update", t);
532
- }), [e]), /* @__PURE__ */ r(E, {});
217
+ return l(() => (t && t.on("update", e), () => {
218
+ t && t.off("update", e);
219
+ }), [t]), /* @__PURE__ */ i(m, {});
533
220
  }
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)
221
+ const w = "data-rc-order", N = "data-rc-priority", Z = "rc-util-key", p = /* @__PURE__ */ new Map();
222
+ function tt(t, r) {
223
+ if (!t)
537
224
  return !1;
538
- if (e.contains)
539
- return e.contains(i);
540
- let t = i;
541
- for (; t; ) {
542
- if (t === e)
225
+ if (t.contains)
226
+ return t.contains(r);
227
+ let e = r;
228
+ for (; e; ) {
229
+ if (e === t)
543
230
  return !0;
544
- t = t.parentNode;
231
+ e = e.parentNode;
545
232
  }
546
233
  return !1;
547
234
  }
548
- function he({ mark: e } = {}) {
549
- return e ? e.startsWith("data-") ? e : `data-${e}` : Qe;
235
+ function j({ mark: t } = {}) {
236
+ return t ? t.startsWith("data-") ? t : `data-${t}` : Z;
550
237
  }
551
- function K(e) {
552
- 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;
553
240
  }
554
- function Ke(e) {
555
- return e === "queue" ? "prependQueue" : e ? "prepend" : "append";
241
+ function et(t) {
242
+ return t === "queue" ? "prependQueue" : t ? "prepend" : "append";
556
243
  }
557
- function fe(e) {
558
- return [...(U.get(e) || e).children].filter(
559
- (i) => i.tagName === "STYLE"
244
+ function P(t) {
245
+ return [...(p.get(t) || t).children].filter(
246
+ (r) => r.tagName === "STYLE"
560
247
  );
561
248
  }
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)))
249
+ function A(t, r = {}) {
250
+ const { csp: e, prepend: n, priority: o = 0 } = r, s = et(n), h = s === "prependQueue", a = document.createElement("style");
251
+ a.setAttribute(w, s), h && o && a.setAttribute(N, `${o}`), e != null && e.nonce && (a.nonce = e == null ? void 0 : e.nonce), a.innerHTML = t;
252
+ const d = g(r), { firstChild: V } = d;
253
+ if (n) {
254
+ if (h) {
255
+ const b = P(d).filter((v) => {
256
+ if (!["prepend", "prependQueue"].includes(v.getAttribute(w)))
570
257
  return !1;
571
- const o = Number(v.getAttribute(te) || 0);
572
- return l >= o;
258
+ const $ = Number(v.getAttribute(N) || 0);
259
+ return o >= $;
573
260
  });
574
- if (p.length > 0)
575
- return m.insertBefore(a, p.at(-1).nextSibling), a;
261
+ if (b.length > 0)
262
+ return d.insertBefore(a, b.at(-1).nextSibling), a;
576
263
  }
577
- b.before(a);
264
+ V.before(a);
578
265
  } else
579
- m.append(a);
266
+ d.append(a);
580
267
  return a;
581
268
  }
582
- function pe(e, i = {}) {
583
- const t = K(i);
584
- return fe(t).find((s) => s.getAttribute(he(i)) === e);
269
+ function M(t, r = {}) {
270
+ const e = g(r);
271
+ return P(e).find((n) => n.getAttribute(j(r)) === t);
585
272
  }
586
- function xe(e, i = {}) {
587
- const t = pe(e, i);
588
- t && t.remove();
273
+ function k(t, r = {}) {
274
+ const e = M(t, r);
275
+ e && e.remove();
589
276
  }
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();
277
+ function rt(t, r) {
278
+ const e = p.get(t);
279
+ if (!e || !tt(document, e)) {
280
+ const n = A("", r), { parentNode: o } = n;
281
+ p.set(t, o), n.remove();
595
282
  }
596
283
  }
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;
284
+ function D(t, r, e = {}) {
285
+ var h, a, d;
286
+ const n = g(e);
287
+ rt(n, e);
288
+ const o = M(r, e);
289
+ if (o)
290
+ return (h = e.csp) != null && h.nonce && o.nonce !== ((a = e.csp) == null ? void 0 : a.nonce) && (o.nonce = (d = e.csp) == null ? void 0 : d.nonce), o.innerHTML !== t && (o.innerHTML = t), o;
291
+ const s = A(t, e);
292
+ return s.setAttribute(j(e), r), s;
606
293
  }
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;
294
+ function it() {
295
+ const { theme: t, color: r, borderRadius: e } = q();
296
+ return l(() => {
297
+ const n = t || "light", o = r || "default";
298
+ let s = y[n][o];
299
+ if (!s) {
300
+ s = y.light.default;
614
301
  return;
615
302
  }
616
- return ge(
303
+ return D(
617
304
  `
618
305
  .remarkablejames-editor, .remarkablejames-editor *,
619
306
  .remarkablejames-editor-theme, .remarkablejames-editor-theme *,
620
307
  div[data-richtext-portal], div[data-richtext-portal] * {
621
- ${Object.entries(d).map(([f, a]) => typeof t == "string" && f === "radius" ? `--${f}: ${t};` : `--${f}: ${a};`).join(`
308
+ ${Object.entries(s).map(([h, a]) => typeof e == "string" && h === "radius" ? `--${h}: ${e};` : `--${h}: ${a};`).join(`
622
309
  `)}
623
310
  }
624
311
  `,
@@ -627,27 +314,27 @@ function We() {
627
314
  priority: 50
628
315
  }
629
316
  ), () => {
630
- xe("richtext-theme");
317
+ k("richtext-theme");
631
318
  };
632
- }, [e, i, t]), /* @__PURE__ */ r(E, {});
319
+ }, [t, r, e]), /* @__PURE__ */ i(m, {});
633
320
  }
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, {});
321
+ function dt({ editor: t, children: r, dark: e }) {
322
+ const n = z();
323
+ return l(() => (D(G, "react-tiptap-reset"), () => {
324
+ k("react-tiptap-reset");
325
+ }), []), l(() => {
326
+ t && (t.id = n);
327
+ }, [n, t]), l(() => {
328
+ typeof e == "boolean" && B.setTheme(e ? "dark" : "light");
329
+ }, [e]), t ? /* @__PURE__ */ i("div", { className: u("remarkablejames-editor", e && "dark"), children: /* @__PURE__ */ i(_, { children: /* @__PURE__ */ f(O.Provider, { value: { editor: t }, children: [
330
+ /* @__PURE__ */ i(I, { delayDuration: 0, disableHoverableContent: !0, children: r }),
331
+ /* @__PURE__ */ i(J, { editor: t }),
332
+ /* @__PURE__ */ i(K, {}),
333
+ /* @__PURE__ */ i(it, {}),
334
+ /* @__PURE__ */ i(X, {})
335
+ ] }) }) }) : /* @__PURE__ */ i(m, {});
649
336
  }
650
337
  export {
651
- gt as RichTextProvider,
652
- Ce as TooltipProvider
338
+ dt as RichTextProvider,
339
+ I as TooltipProvider
653
340
  };