@alfadocs/ui-kit 0.67.1 → 0.68.0
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.
- package/dist/_chunks/{editable-currency-cell-renderer-D1ewvJKO.js → editable-currency-cell-renderer-DHOspPee.js} +875 -857
- package/dist/_chunks/rich-text-editor-VawKN1FI.js +2053 -0
- package/dist/agent-catalog.json +1 -1
- package/dist/components/data-table/data-table.d.ts +1 -1
- package/dist/components/data-table/filters/date-range-filter.d.ts +1 -1
- package/dist/components/data-table/index.js +1 -1
- package/dist/components/data-table/toolbar.d.ts +4 -1
- package/dist/components/rich-text-editor/index.js +1 -1
- package/dist/components/rich-text-editor/rich-text-editor.d.ts +15 -0
- package/dist/i18n/locales/ar.d.ts +2 -0
- package/dist/i18n/locales/ar.js +3 -1
- package/dist/i18n/locales/de.d.ts +2 -0
- package/dist/i18n/locales/de.js +3 -1
- package/dist/i18n/locales/el.d.ts +2 -0
- package/dist/i18n/locales/el.js +3 -1
- package/dist/i18n/locales/en.d.ts +2 -0
- package/dist/i18n/locales/en.js +3 -1
- package/dist/i18n/locales/es.d.ts +2 -0
- package/dist/i18n/locales/es.js +3 -1
- package/dist/i18n/locales/fr.d.ts +2 -0
- package/dist/i18n/locales/fr.js +3 -1
- package/dist/i18n/locales/hi.d.ts +2 -0
- package/dist/i18n/locales/hi.js +3 -1
- package/dist/i18n/locales/it.d.ts +2 -0
- package/dist/i18n/locales/it.js +3 -1
- package/dist/i18n/locales/ja.d.ts +2 -0
- package/dist/i18n/locales/ja.js +3 -1
- package/dist/i18n/locales/nl.d.ts +2 -0
- package/dist/i18n/locales/nl.js +3 -1
- package/dist/i18n/locales/pl.d.ts +2 -0
- package/dist/i18n/locales/pl.js +3 -1
- package/dist/i18n/locales/pt.d.ts +2 -0
- package/dist/i18n/locales/pt.js +3 -1
- package/dist/i18n/locales/ro.d.ts +2 -0
- package/dist/i18n/locales/ro.js +3 -1
- package/dist/i18n/locales/ru.d.ts +2 -0
- package/dist/i18n/locales/ru.js +3 -1
- package/dist/i18n/locales/sq.d.ts +2 -0
- package/dist/i18n/locales/sq.js +3 -1
- package/dist/i18n/locales/sv.d.ts +2 -0
- package/dist/i18n/locales/sv.js +3 -1
- package/dist/i18n/locales/tr.d.ts +2 -0
- package/dist/i18n/locales/tr.js +3 -1
- package/dist/i18n/locales/zh.d.ts +2 -0
- package/dist/i18n/locales/zh.js +3 -1
- package/dist/index.js +2 -2
- package/dist/locales/ar.json +3 -1
- package/dist/locales/de.json +3 -1
- package/dist/locales/el.json +3 -1
- package/dist/locales/en.json +3 -1
- package/dist/locales/es.json +3 -1
- package/dist/locales/fr.json +3 -1
- package/dist/locales/hi.json +3 -1
- package/dist/locales/it.json +3 -1
- package/dist/locales/ja.json +3 -1
- package/dist/locales/nl.json +3 -1
- package/dist/locales/pl.json +3 -1
- package/dist/locales/pt.json +3 -1
- package/dist/locales/ro.json +3 -1
- package/dist/locales/ru.json +3 -1
- package/dist/locales/sq.json +3 -1
- package/dist/locales/sv.json +3 -1
- package/dist/locales/tr.json +3 -1
- package/dist/locales/zh.json +3 -1
- package/dist/tokens.css +1 -1
- package/package.json +1 -1
- package/dist/_chunks/rich-text-editor-DAeCXiQG.js +0 -1973
|
@@ -0,0 +1,2053 @@
|
|
|
1
|
+
import { jsx as e, jsxs as y, Fragment as Oe } from "react/jsx-runtime";
|
|
2
|
+
import { useId as le, useState as z, useRef as L, useCallback as C, useEffect as K, Fragment as nt, forwardRef as Nt, useMemo as Je, useImperativeHandle as zt } from "react";
|
|
3
|
+
import { c as De } from "./index-D2ZczOXr.js";
|
|
4
|
+
import { useTranslation as Z } from "react-i18next";
|
|
5
|
+
import { SafeHtml as Tt, sanitiseHtml as _t } from "../safe-html/index.js";
|
|
6
|
+
import { u as Mt } from "./registry-nPAVE19X.js";
|
|
7
|
+
import { S as Le } from "./spinner-hbwuKwMf.js";
|
|
8
|
+
import { I as P } from "./icon-button-LqoiKcUN.js";
|
|
9
|
+
import { T as Rt } from "./text-area-BIx0tZ05.js";
|
|
10
|
+
import { E as St } from "./editor-overlay-wYm22wZK.js";
|
|
11
|
+
import { X as Ke } from "./x-CCcI3eJp.js";
|
|
12
|
+
import { R as At } from "./rotate-ccw-BWANpitO.js";
|
|
13
|
+
import { C as Et } from "./check-DPdL_Sm7.js";
|
|
14
|
+
import { S as ot } from "./square-CZoGU14v.js";
|
|
15
|
+
import { M as at } from "./mic-B4Gog3Gi.js";
|
|
16
|
+
import { S as Ht } from "./send-CySZIRPJ.js";
|
|
17
|
+
import { B as ne } from "./button-DD_0Xdmr.js";
|
|
18
|
+
import { a as $t } from "./tooltip-DvmfrNvB.js";
|
|
19
|
+
import { P as B } from "./popover-DTbfAuR0.js";
|
|
20
|
+
import { D as ze } from "./dropdown-menu-DwwPovMZ.js";
|
|
21
|
+
import { D as j } from "./dialog-DMGnSelc.js";
|
|
22
|
+
import { C as qe } from "./color-picker-FXpItIaF.js";
|
|
23
|
+
import { T as _e } from "./text-input-BaClJL8Y.js";
|
|
24
|
+
import { C as It } from "./checkbox-DRcOdmXv.js";
|
|
25
|
+
import { F as Lt } from "./file-upload-BosbPDb1.js";
|
|
26
|
+
import { c as _ } from "./createLucideIcon-CrFbzy84.js";
|
|
27
|
+
import { C as Ot } from "./chevron-down-BX_NP2Yh.js";
|
|
28
|
+
import { I as Dt } from "./image-C6RM5hfF.js";
|
|
29
|
+
import { C as qt } from "./columns-2-BTOBZbep.js";
|
|
30
|
+
import { T as jt } from "./trash-2-rPAKaRgB.js";
|
|
31
|
+
import { S as Pt } from "./sparkles-CuYXqQLg.js";
|
|
32
|
+
/**
|
|
33
|
+
* @license lucide-react v1.8.0 - ISC
|
|
34
|
+
*
|
|
35
|
+
* This source code is licensed under the ISC license.
|
|
36
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
37
|
+
*/
|
|
38
|
+
const Bt = [
|
|
39
|
+
["rect", { width: "13", height: "7", x: "3", y: "3", rx: "1", key: "11xb64" }],
|
|
40
|
+
["path", { d: "m22 15-3-3 3-3", key: "26chmm" }],
|
|
41
|
+
["rect", { width: "13", height: "7", x: "3", y: "14", rx: "1", key: "k6ky7n" }]
|
|
42
|
+
], Ft = _("between-horizontal-end", Bt);
|
|
43
|
+
/**
|
|
44
|
+
* @license lucide-react v1.8.0 - ISC
|
|
45
|
+
*
|
|
46
|
+
* This source code is licensed under the ISC license.
|
|
47
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
48
|
+
*/
|
|
49
|
+
const Vt = [
|
|
50
|
+
["rect", { width: "13", height: "7", x: "8", y: "3", rx: "1", key: "pkso9a" }],
|
|
51
|
+
["path", { d: "m2 9 3 3-3 3", key: "1agib5" }],
|
|
52
|
+
["rect", { width: "13", height: "7", x: "8", y: "14", rx: "1", key: "1q5fc1" }]
|
|
53
|
+
], Gt = _("between-horizontal-start", Vt);
|
|
54
|
+
/**
|
|
55
|
+
* @license lucide-react v1.8.0 - ISC
|
|
56
|
+
*
|
|
57
|
+
* This source code is licensed under the ISC license.
|
|
58
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
59
|
+
*/
|
|
60
|
+
const Wt = [
|
|
61
|
+
["rect", { width: "7", height: "13", x: "3", y: "3", rx: "1", key: "1fdu0f" }],
|
|
62
|
+
["path", { d: "m9 22 3-3 3 3", key: "17z65a" }],
|
|
63
|
+
["rect", { width: "7", height: "13", x: "14", y: "3", rx: "1", key: "1squn4" }]
|
|
64
|
+
], Xt = _("between-vertical-end", Wt);
|
|
65
|
+
/**
|
|
66
|
+
* @license lucide-react v1.8.0 - ISC
|
|
67
|
+
*
|
|
68
|
+
* This source code is licensed under the ISC license.
|
|
69
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
70
|
+
*/
|
|
71
|
+
const Ut = [
|
|
72
|
+
["rect", { width: "7", height: "13", x: "3", y: "8", rx: "1", key: "1fjrkv" }],
|
|
73
|
+
["path", { d: "m15 2-3 3-3-3", key: "1uh6eb" }],
|
|
74
|
+
["rect", { width: "7", height: "13", x: "14", y: "8", rx: "1", key: "w3fjg8" }]
|
|
75
|
+
], Qt = _("between-vertical-start", Ut);
|
|
76
|
+
/**
|
|
77
|
+
* @license lucide-react v1.8.0 - ISC
|
|
78
|
+
*
|
|
79
|
+
* This source code is licensed under the ISC license.
|
|
80
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
81
|
+
*/
|
|
82
|
+
const Zt = [
|
|
83
|
+
[
|
|
84
|
+
"path",
|
|
85
|
+
{ d: "M6 12h9a4 4 0 0 1 0 8H7a1 1 0 0 1-1-1V5a1 1 0 0 1 1-1h7a4 4 0 0 1 0 8", key: "mg9rjx" }
|
|
86
|
+
]
|
|
87
|
+
], Yt = _("bold", Zt);
|
|
88
|
+
/**
|
|
89
|
+
* @license lucide-react v1.8.0 - ISC
|
|
90
|
+
*
|
|
91
|
+
* This source code is licensed under the ISC license.
|
|
92
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
93
|
+
*/
|
|
94
|
+
const Jt = [
|
|
95
|
+
["path", { d: "M4 12h8", key: "17cfdx" }],
|
|
96
|
+
["path", { d: "M4 18V6", key: "1rz3zl" }],
|
|
97
|
+
["path", { d: "M12 18V6", key: "zqpxq5" }],
|
|
98
|
+
["path", { d: "M21 18h-4c0-4 4-3 4-6 0-1.5-2-2.5-4-1", key: "9jr5yi" }]
|
|
99
|
+
], Kt = _("heading-2", Jt);
|
|
100
|
+
/**
|
|
101
|
+
* @license lucide-react v1.8.0 - ISC
|
|
102
|
+
*
|
|
103
|
+
* This source code is licensed under the ISC license.
|
|
104
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
105
|
+
*/
|
|
106
|
+
const er = [
|
|
107
|
+
["path", { d: "M4 12h8", key: "17cfdx" }],
|
|
108
|
+
["path", { d: "M4 18V6", key: "1rz3zl" }],
|
|
109
|
+
["path", { d: "M12 18V6", key: "zqpxq5" }],
|
|
110
|
+
["path", { d: "M17.5 10.5c1.7-1 3.5 0 3.5 1.5a2 2 0 0 1-2 2", key: "68ncm8" }],
|
|
111
|
+
["path", { d: "M17 17.5c2 1.5 4 .3 4-1.5a2 2 0 0 0-2-2", key: "1ejuhz" }]
|
|
112
|
+
], tr = _("heading-3", er);
|
|
113
|
+
/**
|
|
114
|
+
* @license lucide-react v1.8.0 - ISC
|
|
115
|
+
*
|
|
116
|
+
* This source code is licensed under the ISC license.
|
|
117
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
118
|
+
*/
|
|
119
|
+
const rr = [
|
|
120
|
+
["path", { d: "m9 11-6 6v3h9l3-3", key: "1a3l36" }],
|
|
121
|
+
["path", { d: "m22 12-4.6 4.6a2 2 0 0 1-2.8 0l-5.2-5.2a2 2 0 0 1 0-2.8L14 4", key: "14a9rk" }]
|
|
122
|
+
], nr = _("highlighter", rr);
|
|
123
|
+
/**
|
|
124
|
+
* @license lucide-react v1.8.0 - ISC
|
|
125
|
+
*
|
|
126
|
+
* This source code is licensed under the ISC license.
|
|
127
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
128
|
+
*/
|
|
129
|
+
const or = [
|
|
130
|
+
["line", { x1: "19", x2: "10", y1: "4", y2: "4", key: "15jd3p" }],
|
|
131
|
+
["line", { x1: "14", x2: "5", y1: "20", y2: "20", key: "bu0au3" }],
|
|
132
|
+
["line", { x1: "15", x2: "9", y1: "4", y2: "20", key: "uljnxc" }]
|
|
133
|
+
], ar = _("italic", or);
|
|
134
|
+
/**
|
|
135
|
+
* @license lucide-react v1.8.0 - ISC
|
|
136
|
+
*
|
|
137
|
+
* This source code is licensed under the ISC license.
|
|
138
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
139
|
+
*/
|
|
140
|
+
const ir = [
|
|
141
|
+
["path", { d: "M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71", key: "1cjeqo" }],
|
|
142
|
+
["path", { d: "M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71", key: "19qd67" }]
|
|
143
|
+
], lr = _("link", ir);
|
|
144
|
+
/**
|
|
145
|
+
* @license lucide-react v1.8.0 - ISC
|
|
146
|
+
*
|
|
147
|
+
* This source code is licensed under the ISC license.
|
|
148
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
149
|
+
*/
|
|
150
|
+
const sr = [
|
|
151
|
+
["path", { d: "M11 5h10", key: "1cz7ny" }],
|
|
152
|
+
["path", { d: "M11 12h10", key: "1438ji" }],
|
|
153
|
+
["path", { d: "M11 19h10", key: "11t30w" }],
|
|
154
|
+
["path", { d: "M4 4h1v5", key: "10yrso" }],
|
|
155
|
+
["path", { d: "M4 9h2", key: "r1h2o0" }],
|
|
156
|
+
["path", { d: "M6.5 20H3.4c0-1 2.6-1.925 2.6-3.5a1.5 1.5 0 0 0-2.6-1.02", key: "xtkcd5" }]
|
|
157
|
+
], dr = _("list-ordered", sr);
|
|
158
|
+
/**
|
|
159
|
+
* @license lucide-react v1.8.0 - ISC
|
|
160
|
+
*
|
|
161
|
+
* This source code is licensed under the ISC license.
|
|
162
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
163
|
+
*/
|
|
164
|
+
const cr = [
|
|
165
|
+
["path", { d: "M3 5h.01", key: "18ugdj" }],
|
|
166
|
+
["path", { d: "M3 12h.01", key: "nlz23k" }],
|
|
167
|
+
["path", { d: "M3 19h.01", key: "noohij" }],
|
|
168
|
+
["path", { d: "M8 5h13", key: "1pao27" }],
|
|
169
|
+
["path", { d: "M8 12h13", key: "1za7za" }],
|
|
170
|
+
["path", { d: "M8 19h13", key: "m83p4d" }]
|
|
171
|
+
], ur = _("list", cr);
|
|
172
|
+
/**
|
|
173
|
+
* @license lucide-react v1.8.0 - ISC
|
|
174
|
+
*
|
|
175
|
+
* This source code is licensed under the ISC license.
|
|
176
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
177
|
+
*/
|
|
178
|
+
const mr = [
|
|
179
|
+
["path", { d: "M11 7 6 2", key: "1jwth8" }],
|
|
180
|
+
["path", { d: "M18.992 12H2.041", key: "xw1gg" }],
|
|
181
|
+
[
|
|
182
|
+
"path",
|
|
183
|
+
{
|
|
184
|
+
d: "M21.145 18.38A3.34 3.34 0 0 1 20 16.5a3.3 3.3 0 0 1-1.145 1.88c-.575.46-.855 1.02-.855 1.595A2 2 0 0 0 20 22a2 2 0 0 0 2-2.025c0-.58-.285-1.13-.855-1.595",
|
|
185
|
+
key: "1nkol4"
|
|
186
|
+
}
|
|
187
|
+
],
|
|
188
|
+
[
|
|
189
|
+
"path",
|
|
190
|
+
{
|
|
191
|
+
d: "m8.5 4.5 2.148-2.148a1.205 1.205 0 0 1 1.704 0l7.296 7.296a1.205 1.205 0 0 1 0 1.704l-7.592 7.592a3.615 3.615 0 0 1-5.112 0l-3.888-3.888a3.615 3.615 0 0 1 0-5.112L5.67 7.33",
|
|
192
|
+
key: "1nk1rd"
|
|
193
|
+
}
|
|
194
|
+
]
|
|
195
|
+
], hr = _("paint-bucket", mr);
|
|
196
|
+
/**
|
|
197
|
+
* @license lucide-react v1.8.0 - ISC
|
|
198
|
+
*
|
|
199
|
+
* This source code is licensed under the ISC license.
|
|
200
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
201
|
+
*/
|
|
202
|
+
const fr = [
|
|
203
|
+
["rect", { width: "16", height: "6", x: "2", y: "2", rx: "2", key: "jcyz7m" }],
|
|
204
|
+
["path", { d: "M10 16v-2a2 2 0 0 1 2-2h8a2 2 0 0 0 2-2V7a2 2 0 0 0-2-2h-2", key: "1b9h7c" }],
|
|
205
|
+
["rect", { width: "4", height: "6", x: "8", y: "16", rx: "1", key: "d6e7yl" }]
|
|
206
|
+
], gr = _("paint-roller", fr);
|
|
207
|
+
/**
|
|
208
|
+
* @license lucide-react v1.8.0 - ISC
|
|
209
|
+
*
|
|
210
|
+
* This source code is licensed under the ISC license.
|
|
211
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
212
|
+
*/
|
|
213
|
+
const pr = [
|
|
214
|
+
[
|
|
215
|
+
"path",
|
|
216
|
+
{
|
|
217
|
+
d: "M12 22a1 1 0 0 1 0-20 10 9 0 0 1 10 9 5 5 0 0 1-5 5h-2.25a1.75 1.75 0 0 0-1.4 2.8l.3.4a1.75 1.75 0 0 1-1.4 2.8z",
|
|
218
|
+
key: "e79jfc"
|
|
219
|
+
}
|
|
220
|
+
],
|
|
221
|
+
["circle", { cx: "13.5", cy: "6.5", r: ".5", fill: "currentColor", key: "1okk4w" }],
|
|
222
|
+
["circle", { cx: "17.5", cy: "10.5", r: ".5", fill: "currentColor", key: "f64h9f" }],
|
|
223
|
+
["circle", { cx: "6.5", cy: "12.5", r: ".5", fill: "currentColor", key: "qy21gx" }],
|
|
224
|
+
["circle", { cx: "8.5", cy: "7.5", r: ".5", fill: "currentColor", key: "fotxhn" }]
|
|
225
|
+
], br = _("palette", pr);
|
|
226
|
+
/**
|
|
227
|
+
* @license lucide-react v1.8.0 - ISC
|
|
228
|
+
*
|
|
229
|
+
* This source code is licensed under the ISC license.
|
|
230
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
231
|
+
*/
|
|
232
|
+
const yr = [
|
|
233
|
+
["rect", { width: "18", height: "18", x: "3", y: "3", rx: "2", key: "afitv7" }],
|
|
234
|
+
["path", { d: "M14 9h1", key: "l0svgy" }],
|
|
235
|
+
["path", { d: "M19 9h2", key: "te2zfg" }],
|
|
236
|
+
["path", { d: "M3 9h2", key: "1h4ldw" }],
|
|
237
|
+
["path", { d: "M9 9h1", key: "15jzuz" }]
|
|
238
|
+
], vr = _("panel-top-dashed", yr);
|
|
239
|
+
/**
|
|
240
|
+
* @license lucide-react v1.8.0 - ISC
|
|
241
|
+
*
|
|
242
|
+
* This source code is licensed under the ISC license.
|
|
243
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
244
|
+
*/
|
|
245
|
+
const kr = [
|
|
246
|
+
["rect", { width: "18", height: "18", x: "3", y: "3", rx: "2", key: "afitv7" }],
|
|
247
|
+
["path", { d: "M3 9h18", key: "1pudct" }]
|
|
248
|
+
], wr = _("panel-top", kr);
|
|
249
|
+
/**
|
|
250
|
+
* @license lucide-react v1.8.0 - ISC
|
|
251
|
+
*
|
|
252
|
+
* This source code is licensed under the ISC license.
|
|
253
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
254
|
+
*/
|
|
255
|
+
const xr = [
|
|
256
|
+
["path", { d: "M13 4v16", key: "8vvj80" }],
|
|
257
|
+
["path", { d: "M17 4v16", key: "7dpous" }],
|
|
258
|
+
["path", { d: "M19 4H9.5a4.5 4.5 0 0 0 0 9H13", key: "sh4n9v" }]
|
|
259
|
+
], Cr = _("pilcrow", xr);
|
|
260
|
+
/**
|
|
261
|
+
* @license lucide-react v1.8.0 - ISC
|
|
262
|
+
*
|
|
263
|
+
* This source code is licensed under the ISC license.
|
|
264
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
265
|
+
*/
|
|
266
|
+
const Nr = [
|
|
267
|
+
[
|
|
268
|
+
"path",
|
|
269
|
+
{
|
|
270
|
+
d: "M16 3a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2 1 1 0 0 1 1 1v1a2 2 0 0 1-2 2 1 1 0 0 0-1 1v2a1 1 0 0 0 1 1 6 6 0 0 0 6-6V5a2 2 0 0 0-2-2z",
|
|
271
|
+
key: "rib7q0"
|
|
272
|
+
}
|
|
273
|
+
],
|
|
274
|
+
[
|
|
275
|
+
"path",
|
|
276
|
+
{
|
|
277
|
+
d: "M5 3a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2 1 1 0 0 1 1 1v1a2 2 0 0 1-2 2 1 1 0 0 0-1 1v2a1 1 0 0 0 1 1 6 6 0 0 0 6-6V5a2 2 0 0 0-2-2z",
|
|
278
|
+
key: "1ymkrd"
|
|
279
|
+
}
|
|
280
|
+
]
|
|
281
|
+
], zr = _("quote", Nr);
|
|
282
|
+
/**
|
|
283
|
+
* @license lucide-react v1.8.0 - ISC
|
|
284
|
+
*
|
|
285
|
+
* This source code is licensed under the ISC license.
|
|
286
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
287
|
+
*/
|
|
288
|
+
const Tr = [
|
|
289
|
+
["rect", { width: "18", height: "18", x: "3", y: "3", rx: "2", key: "afitv7" }],
|
|
290
|
+
["path", { d: "M3 12h18", key: "1i2n21" }]
|
|
291
|
+
], _r = _("rows-2", Tr);
|
|
292
|
+
/**
|
|
293
|
+
* @license lucide-react v1.8.0 - ISC
|
|
294
|
+
*
|
|
295
|
+
* This source code is licensed under the ISC license.
|
|
296
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
297
|
+
*/
|
|
298
|
+
const Mr = [
|
|
299
|
+
["path", { d: "m6 16 6-12 6 12", key: "1b4byz" }],
|
|
300
|
+
["path", { d: "M8 12h8", key: "1wcyev" }],
|
|
301
|
+
["path", { d: "m16 20 2 2 4-4", key: "13tcca" }]
|
|
302
|
+
], Rr = _("spell-check", Mr);
|
|
303
|
+
/**
|
|
304
|
+
* @license lucide-react v1.8.0 - ISC
|
|
305
|
+
*
|
|
306
|
+
* This source code is licensed under the ISC license.
|
|
307
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
308
|
+
*/
|
|
309
|
+
const Sr = [
|
|
310
|
+
["path", { d: "M16 4H9a3 3 0 0 0-2.83 4", key: "43sutm" }],
|
|
311
|
+
["path", { d: "M14 12a4 4 0 0 1 0 8H6", key: "nlfj13" }],
|
|
312
|
+
["line", { x1: "4", x2: "20", y1: "12", y2: "12", key: "1e0a9i" }]
|
|
313
|
+
], Ar = _("strikethrough", Sr);
|
|
314
|
+
/**
|
|
315
|
+
* @license lucide-react v1.8.0 - ISC
|
|
316
|
+
*
|
|
317
|
+
* This source code is licensed under the ISC license.
|
|
318
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
319
|
+
*/
|
|
320
|
+
const Er = [
|
|
321
|
+
["path", { d: "M12 3v18", key: "108xh3" }],
|
|
322
|
+
["rect", { width: "18", height: "18", x: "3", y: "3", rx: "2", key: "afitv7" }],
|
|
323
|
+
["path", { d: "M3 9h18", key: "1pudct" }],
|
|
324
|
+
["path", { d: "M3 15h18", key: "5xshup" }]
|
|
325
|
+
], Hr = _("table", Er);
|
|
326
|
+
/**
|
|
327
|
+
* @license lucide-react v1.8.0 - ISC
|
|
328
|
+
*
|
|
329
|
+
* This source code is licensed under the ISC license.
|
|
330
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
331
|
+
*/
|
|
332
|
+
const $r = [
|
|
333
|
+
["path", { d: "M6 4v6a6 6 0 0 0 12 0V4", key: "9kb039" }],
|
|
334
|
+
["line", { x1: "4", x2: "20", y1: "20", y2: "20", key: "nun2al" }]
|
|
335
|
+
], Ir = _("underline", $r);
|
|
336
|
+
/**
|
|
337
|
+
* @license lucide-react v1.8.0 - ISC
|
|
338
|
+
*
|
|
339
|
+
* This source code is licensed under the ISC license.
|
|
340
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
341
|
+
*/
|
|
342
|
+
const Lr = [
|
|
343
|
+
[
|
|
344
|
+
"path",
|
|
345
|
+
{
|
|
346
|
+
d: "m21.64 3.64-1.28-1.28a1.21 1.21 0 0 0-1.72 0L2.36 18.64a1.21 1.21 0 0 0 0 1.72l1.28 1.28a1.2 1.2 0 0 0 1.72 0L21.64 5.36a1.2 1.2 0 0 0 0-1.72",
|
|
347
|
+
key: "ul74o6"
|
|
348
|
+
}
|
|
349
|
+
],
|
|
350
|
+
["path", { d: "m14 7 3 3", key: "1r5n42" }],
|
|
351
|
+
["path", { d: "M5 6v4", key: "ilb8ba" }],
|
|
352
|
+
["path", { d: "M19 14v4", key: "blhpug" }],
|
|
353
|
+
["path", { d: "M10 2v2", key: "7u0qdc" }],
|
|
354
|
+
["path", { d: "M7 8H3", key: "zfb6yr" }],
|
|
355
|
+
["path", { d: "M21 16h-4", key: "1cnmox" }],
|
|
356
|
+
["path", { d: "M11 3H9", key: "1obp7u" }]
|
|
357
|
+
], Or = _("wand-sparkles", Lr);
|
|
358
|
+
/**
|
|
359
|
+
* @license lucide-react v1.8.0 - ISC
|
|
360
|
+
*
|
|
361
|
+
* This source code is licensed under the ISC license.
|
|
362
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
363
|
+
*/
|
|
364
|
+
const Dr = [
|
|
365
|
+
[
|
|
366
|
+
"path",
|
|
367
|
+
{
|
|
368
|
+
d: "M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.106-3.105c.32-.322.863-.22.983.218a6 6 0 0 1-8.259 7.057l-7.91 7.91a1 1 0 0 1-2.999-3l7.91-7.91a6 6 0 0 1 7.057-8.259c.438.12.54.662.219.984z",
|
|
369
|
+
key: "1ngwbx"
|
|
370
|
+
}
|
|
371
|
+
]
|
|
372
|
+
], qr = _("wrench", Dr), jr = {
|
|
373
|
+
id: "rich-text-editor",
|
|
374
|
+
capabilities: ["edit_inline"],
|
|
375
|
+
state: {
|
|
376
|
+
html: {
|
|
377
|
+
type: "string",
|
|
378
|
+
description: "Sanitised HTML representation of the editor content.",
|
|
379
|
+
read: (o) => o.getHTML()
|
|
380
|
+
},
|
|
381
|
+
text: {
|
|
382
|
+
type: "string",
|
|
383
|
+
description: "Plain-text content of the editor (tags stripped).",
|
|
384
|
+
read: (o) => o.getText()
|
|
385
|
+
},
|
|
386
|
+
markdown: {
|
|
387
|
+
type: "string",
|
|
388
|
+
description: "Markdown representation of the editor content. The Redactor engine has no native Markdown serialiser, so this is always empty — read `html` instead.",
|
|
389
|
+
read: (o) => o.getMarkdown()
|
|
390
|
+
}
|
|
391
|
+
},
|
|
392
|
+
actions: {
|
|
393
|
+
set_content: {
|
|
394
|
+
safety: "destructive",
|
|
395
|
+
argsType: "{ html: string }",
|
|
396
|
+
description: "Replace the editor content. Loses unsaved input.",
|
|
397
|
+
invoke: (o, a) => {
|
|
398
|
+
o.setContent(a.html);
|
|
399
|
+
}
|
|
400
|
+
},
|
|
401
|
+
insert_at_cursor: {
|
|
402
|
+
safety: "destructive",
|
|
403
|
+
argsType: "{ content: string; asHtml?: boolean }",
|
|
404
|
+
description: "Insert content at the caret (replacing any selection). HTML is sanitised; pass asHtml:false for plain text. Seam for merge/template variables and AI-generated drafts.",
|
|
405
|
+
invoke: (o, a) => {
|
|
406
|
+
o.insertAtCursor(a.content, { asHtml: a.asHtml });
|
|
407
|
+
}
|
|
408
|
+
},
|
|
409
|
+
apply_format: {
|
|
410
|
+
safety: "destructive",
|
|
411
|
+
argsType: "{ format: 'bold' | 'italic' | 'strikethrough' | 'bulletedList' | 'numberedList' | 'heading' | 'quote' | 'paragraph' }",
|
|
412
|
+
description: "Toggle/apply a block or inline format on the current selection (bold, italic, strikethrough, bulleted/numbered list, heading, quote, paragraph).",
|
|
413
|
+
invoke: (o, a) => {
|
|
414
|
+
o.applyFormat(a.format);
|
|
415
|
+
}
|
|
416
|
+
},
|
|
417
|
+
clear: {
|
|
418
|
+
safety: "destructive",
|
|
419
|
+
description: "Empty the editor. Loses unsaved input.",
|
|
420
|
+
invoke: (o) => {
|
|
421
|
+
o.clear();
|
|
422
|
+
}
|
|
423
|
+
},
|
|
424
|
+
focus: {
|
|
425
|
+
safety: "read",
|
|
426
|
+
description: "Move keyboard focus to the editor surface.",
|
|
427
|
+
invoke: (o) => {
|
|
428
|
+
o.focus();
|
|
429
|
+
}
|
|
430
|
+
}
|
|
431
|
+
},
|
|
432
|
+
domHooks: {
|
|
433
|
+
root: { attr: "data-component", value: "rich-text-editor" },
|
|
434
|
+
instanceId: {
|
|
435
|
+
attr: "data-component-id",
|
|
436
|
+
sourceProp: "id",
|
|
437
|
+
description: "Sourced from the id prop."
|
|
438
|
+
}
|
|
439
|
+
}
|
|
440
|
+
}, Pr = "ds:aria-pressed:!bg-[var(--destructive)] ds:aria-pressed:!text-[var(--destructive-foreground)]", ie = "ds:!size-[var(--min-target-size)]", Br = "ds:text-[length:var(--font-size-sm)] ds:text-[color:var(--muted-foreground)]", Fr = "ds:text-[length:var(--font-size-sm)] ds:text-[color:var(--destructive)]", et = [
|
|
441
|
+
"ds:rounded-[var(--radius-md)] ds:border ds:border-[color:var(--border)]",
|
|
442
|
+
"ds:bg-[color-mix(in_srgb,var(--background)_70%,transparent)]",
|
|
443
|
+
"ds:p-[var(--spacing-sm)] ds:[max-block-size:10rem] ds:overflow-y-auto",
|
|
444
|
+
"ds:text-[length:var(--font-size-sm)] ds:text-[color:var(--foreground)]"
|
|
445
|
+
].join(" ");
|
|
446
|
+
function tt(o, a) {
|
|
447
|
+
return a ? o ? /\s$/.test(o) ? `${o}${a}` : `${o} ${a}` : a : o;
|
|
448
|
+
}
|
|
449
|
+
function Vr({
|
|
450
|
+
open: o,
|
|
451
|
+
onClose: a,
|
|
452
|
+
onRequestAiDraft: c,
|
|
453
|
+
onInsert: l,
|
|
454
|
+
previewAsHtml: s = !0,
|
|
455
|
+
privacyNotice: f,
|
|
456
|
+
onDictate: g
|
|
457
|
+
}) {
|
|
458
|
+
const { t: i } = Z(), p = le(), v = le(), [T, H] = z(""), [S, w] = z(!1), [O, u] = z(!1), [h, k] = z(null), A = L(null), [M, E] = z(!1), [Y, $] = z(""), [D, I] = z(""), J = L(null), ee = C(() => {
|
|
459
|
+
var x;
|
|
460
|
+
(x = J.current) == null || x.abort();
|
|
461
|
+
}, []), de = C(() => {
|
|
462
|
+
if (!g) return;
|
|
463
|
+
const x = new AbortController();
|
|
464
|
+
J.current = x, E(!0), $(""), I(i("editor.ai.listening")), g({
|
|
465
|
+
signal: x.signal,
|
|
466
|
+
onPartialTranscript: (q) => {
|
|
467
|
+
x.signal.aborted || $(q);
|
|
468
|
+
},
|
|
469
|
+
onFinalTranscript: (q) => {
|
|
470
|
+
if (x.signal.aborted) return;
|
|
471
|
+
const F = q.trim();
|
|
472
|
+
$(""), F && (H((X) => tt(X, F)), I(F));
|
|
473
|
+
}
|
|
474
|
+
}).catch(() => {
|
|
475
|
+
}).finally(() => {
|
|
476
|
+
$(""), J.current === x && (J.current = null, E(!1), I(""));
|
|
477
|
+
});
|
|
478
|
+
}, [g, i]), R = C(() => {
|
|
479
|
+
M ? ee() : de();
|
|
480
|
+
}, [M, de, ee]);
|
|
481
|
+
K(() => {
|
|
482
|
+
var x, q;
|
|
483
|
+
o ? (H(""), w(!1), u(!1), k(null), $(""), I("")) : ((x = A.current) == null || x.abort(), A.current = null, (q = J.current) == null || q.abort());
|
|
484
|
+
}, [o]), K(
|
|
485
|
+
() => () => {
|
|
486
|
+
var x, q;
|
|
487
|
+
(x = A.current) == null || x.abort(), (q = J.current) == null || q.abort();
|
|
488
|
+
},
|
|
489
|
+
[]
|
|
490
|
+
);
|
|
491
|
+
const W = C(() => {
|
|
492
|
+
var F;
|
|
493
|
+
const x = T.trim();
|
|
494
|
+
if (!x || S) return;
|
|
495
|
+
ee(), (F = A.current) == null || F.abort();
|
|
496
|
+
const q = new AbortController();
|
|
497
|
+
A.current = q, u(!1), w(!0), c({ prompt: x, signal: q.signal }).then((X) => {
|
|
498
|
+
q.signal.aborted || (k(X), w(!1));
|
|
499
|
+
}).catch((X) => {
|
|
500
|
+
q.signal.aborted || X && typeof X == "object" && "name" in X && X.name === "AbortError" || (u(!0), w(!1));
|
|
501
|
+
});
|
|
502
|
+
}, [T, S, c, ee]), G = C(() => {
|
|
503
|
+
h != null && (l(h), a());
|
|
504
|
+
}, [h, l, a]), ce = h != null, ye = M ? tt(T, Y) : T;
|
|
505
|
+
return /* @__PURE__ */ e(
|
|
506
|
+
St,
|
|
507
|
+
{
|
|
508
|
+
open: o,
|
|
509
|
+
onClose: a,
|
|
510
|
+
ariaLabel: i("editor.ai.dialogTitle"),
|
|
511
|
+
children: ce ? /* @__PURE__ */ y("div", { className: "ds:flex ds:items-end ds:gap-[var(--spacing-sm)]", children: [
|
|
512
|
+
/* @__PURE__ */ e(
|
|
513
|
+
P,
|
|
514
|
+
{
|
|
515
|
+
size: "md",
|
|
516
|
+
intent: "outline",
|
|
517
|
+
className: ie,
|
|
518
|
+
icon: /* @__PURE__ */ e(Ke, {}),
|
|
519
|
+
"aria-label": i("common.close"),
|
|
520
|
+
onClick: a
|
|
521
|
+
}
|
|
522
|
+
),
|
|
523
|
+
/* @__PURE__ */ e("div", { className: "ds:min-w-0 ds:flex-1", children: s ? /* @__PURE__ */ e(
|
|
524
|
+
Tt,
|
|
525
|
+
{
|
|
526
|
+
html: h,
|
|
527
|
+
profile: "rich-text",
|
|
528
|
+
className: et,
|
|
529
|
+
tabIndex: 0,
|
|
530
|
+
"aria-label": i("editor.ai.dialogTitle")
|
|
531
|
+
}
|
|
532
|
+
) : (
|
|
533
|
+
// Focusable so a keyboard user can scroll a long draft preview
|
|
534
|
+
// (mirrors the SafeHtml preview branch above). The lint rule's
|
|
535
|
+
// tabIndex allowlist doesn't cover a scrollable, non-interactive
|
|
536
|
+
// text region.
|
|
537
|
+
// eslint-disable-next-line jsx-a11y/no-noninteractive-tabindex
|
|
538
|
+
/* @__PURE__ */ e("p", { className: et, tabIndex: 0, children: h })
|
|
539
|
+
) }),
|
|
540
|
+
/* @__PURE__ */ e(
|
|
541
|
+
P,
|
|
542
|
+
{
|
|
543
|
+
size: "md",
|
|
544
|
+
intent: "outline",
|
|
545
|
+
className: `${ie} ds:rounded-full`,
|
|
546
|
+
icon: /* @__PURE__ */ e(At, {}),
|
|
547
|
+
"aria-label": i("editor.ai.retry"),
|
|
548
|
+
onClick: () => k(null)
|
|
549
|
+
}
|
|
550
|
+
),
|
|
551
|
+
/* @__PURE__ */ e(
|
|
552
|
+
P,
|
|
553
|
+
{
|
|
554
|
+
size: "md",
|
|
555
|
+
intent: "primary",
|
|
556
|
+
className: `${ie} ds:bg-[image:var(--gradient-brand)] ds:rounded-full`,
|
|
557
|
+
icon: /* @__PURE__ */ e(Et, {}),
|
|
558
|
+
"aria-label": i("common.confirm"),
|
|
559
|
+
onClick: G
|
|
560
|
+
}
|
|
561
|
+
)
|
|
562
|
+
] }) : /* @__PURE__ */ y(Oe, { children: [
|
|
563
|
+
/* @__PURE__ */ y("div", { className: "ds:flex ds:items-end ds:gap-[var(--spacing-sm)]", children: [
|
|
564
|
+
/* @__PURE__ */ e(
|
|
565
|
+
P,
|
|
566
|
+
{
|
|
567
|
+
size: "md",
|
|
568
|
+
intent: "outline",
|
|
569
|
+
className: ie,
|
|
570
|
+
icon: /* @__PURE__ */ e(Ke, {}),
|
|
571
|
+
"aria-label": i("common.close"),
|
|
572
|
+
onClick: a
|
|
573
|
+
}
|
|
574
|
+
),
|
|
575
|
+
/* @__PURE__ */ e("div", { className: "ds:min-w-0 ds:flex-1", children: /* @__PURE__ */ e(
|
|
576
|
+
Rt,
|
|
577
|
+
{
|
|
578
|
+
id: p,
|
|
579
|
+
size: "md",
|
|
580
|
+
className: "ds:content-center",
|
|
581
|
+
value: ye,
|
|
582
|
+
onChange: (x) => H(x.target.value),
|
|
583
|
+
placeholder: i("editor.ai.promptPlaceholder"),
|
|
584
|
+
"aria-label": i("editor.ai.promptLabel"),
|
|
585
|
+
autoResize: !0,
|
|
586
|
+
minRows: 1,
|
|
587
|
+
maxRows: 3,
|
|
588
|
+
readOnly: M,
|
|
589
|
+
tone: O ? "error" : "default",
|
|
590
|
+
"aria-describedby": O ? v : void 0
|
|
591
|
+
}
|
|
592
|
+
) }),
|
|
593
|
+
g ? /* @__PURE__ */ e(
|
|
594
|
+
P,
|
|
595
|
+
{
|
|
596
|
+
size: "md",
|
|
597
|
+
intent: "outline",
|
|
598
|
+
className: M ? `${ie} ${Pr}` : ie,
|
|
599
|
+
icon: M ? /* @__PURE__ */ e(ot, { className: "ds:fill-current" }) : /* @__PURE__ */ e(at, {}),
|
|
600
|
+
"aria-pressed": M,
|
|
601
|
+
"aria-label": i(M ? "editor.ai.dictateStop" : "editor.ai.dictateStart"),
|
|
602
|
+
onClick: R
|
|
603
|
+
}
|
|
604
|
+
) : null,
|
|
605
|
+
/* @__PURE__ */ e(
|
|
606
|
+
P,
|
|
607
|
+
{
|
|
608
|
+
size: "md",
|
|
609
|
+
intent: "primary",
|
|
610
|
+
icon: S ? /* @__PURE__ */ e(Le, { size: "sm", variant: "pulse" }) : /* @__PURE__ */ e(Ht, {}),
|
|
611
|
+
className: `${ie} ds:bg-[image:var(--gradient-brand)] ds:rounded-full`,
|
|
612
|
+
disabled: S || !T.trim(),
|
|
613
|
+
"aria-busy": S || void 0,
|
|
614
|
+
"aria-label": i("editor.ai.generate"),
|
|
615
|
+
onClick: W
|
|
616
|
+
}
|
|
617
|
+
)
|
|
618
|
+
] }),
|
|
619
|
+
g ? /* @__PURE__ */ e("p", { className: "ds:sr-only", role: "status", "aria-live": "polite", children: D }) : null,
|
|
620
|
+
O ? /* @__PURE__ */ e("p", { id: v, role: "alert", className: Fr, children: i("editor.ai.error") }) : f ? /* @__PURE__ */ e("p", { className: Br, children: f }) : null
|
|
621
|
+
] })
|
|
622
|
+
}
|
|
623
|
+
);
|
|
624
|
+
}
|
|
625
|
+
const Gr = {
|
|
626
|
+
bold: {
|
|
627
|
+
id: "bold",
|
|
628
|
+
icon: /* @__PURE__ */ e(Yt, {}),
|
|
629
|
+
label: ["editor.bold", "Bold"],
|
|
630
|
+
command: ["module.inline.format", { tag: "b" }],
|
|
631
|
+
toggle: "bold"
|
|
632
|
+
},
|
|
633
|
+
italic: {
|
|
634
|
+
id: "italic",
|
|
635
|
+
icon: /* @__PURE__ */ e(ar, {}),
|
|
636
|
+
label: ["editor.italic", "Italic"],
|
|
637
|
+
command: ["module.inline.format", { tag: "i" }],
|
|
638
|
+
toggle: "italic"
|
|
639
|
+
},
|
|
640
|
+
underline: {
|
|
641
|
+
id: "underline",
|
|
642
|
+
icon: /* @__PURE__ */ e(Ir, {}),
|
|
643
|
+
label: ["editor.underline", "Underline"],
|
|
644
|
+
command: ["module.inline.format", { tag: "u" }],
|
|
645
|
+
toggle: "underline"
|
|
646
|
+
},
|
|
647
|
+
strike: {
|
|
648
|
+
id: "strike",
|
|
649
|
+
icon: /* @__PURE__ */ e(Ar, {}),
|
|
650
|
+
label: ["editor.strike", "Strikethrough"],
|
|
651
|
+
command: ["module.inline.format", { tag: "del" }],
|
|
652
|
+
toggle: "strike"
|
|
653
|
+
},
|
|
654
|
+
ul: {
|
|
655
|
+
id: "ul",
|
|
656
|
+
icon: /* @__PURE__ */ e(ur, {}),
|
|
657
|
+
label: ["editor.list.bullet", "Bulleted list"],
|
|
658
|
+
command: ["module.list.toggle", "ul"],
|
|
659
|
+
toggle: "ul"
|
|
660
|
+
},
|
|
661
|
+
ol: {
|
|
662
|
+
id: "ol",
|
|
663
|
+
icon: /* @__PURE__ */ e(dr, {}),
|
|
664
|
+
label: ["editor.list.ordered", "Numbered list"],
|
|
665
|
+
command: ["module.list.toggle", "ol"],
|
|
666
|
+
toggle: "ol"
|
|
667
|
+
}
|
|
668
|
+
}, $e = [
|
|
669
|
+
{
|
|
670
|
+
id: "paragraph",
|
|
671
|
+
tag: "p",
|
|
672
|
+
icon: /* @__PURE__ */ e(Cr, {}),
|
|
673
|
+
label: ["editor.paragraph", "Paragraph"]
|
|
674
|
+
},
|
|
675
|
+
{
|
|
676
|
+
id: "h2",
|
|
677
|
+
tag: "h2",
|
|
678
|
+
icon: /* @__PURE__ */ e(Kt, {}),
|
|
679
|
+
label: ["editor.heading2", "Heading 2"]
|
|
680
|
+
},
|
|
681
|
+
{
|
|
682
|
+
id: "h3",
|
|
683
|
+
tag: "h3",
|
|
684
|
+
icon: /* @__PURE__ */ e(tr, {}),
|
|
685
|
+
label: ["editor.heading3", "Heading 3"]
|
|
686
|
+
},
|
|
687
|
+
{
|
|
688
|
+
id: "quote",
|
|
689
|
+
tag: "blockquote",
|
|
690
|
+
icon: /* @__PURE__ */ e(zr, {}),
|
|
691
|
+
label: ["editor.quote", "Quote"]
|
|
692
|
+
}
|
|
693
|
+
], Wr = {
|
|
694
|
+
minimal: ["bold", "italic", "link"],
|
|
695
|
+
standard: [
|
|
696
|
+
"format",
|
|
697
|
+
"bold",
|
|
698
|
+
"italic",
|
|
699
|
+
"underline",
|
|
700
|
+
"strike",
|
|
701
|
+
"ul",
|
|
702
|
+
"ol",
|
|
703
|
+
"link"
|
|
704
|
+
],
|
|
705
|
+
full: ["format", "bold", "italic", "underline", "strike", "ul", "ol", "link"]
|
|
706
|
+
}, it = [
|
|
707
|
+
{
|
|
708
|
+
id: "rowAbove",
|
|
709
|
+
command: "plugin.table.addRowAbove",
|
|
710
|
+
icon: /* @__PURE__ */ e(Gt, {}),
|
|
711
|
+
label: ["editor.table.rowAbove", "Add row above"]
|
|
712
|
+
},
|
|
713
|
+
{
|
|
714
|
+
id: "rowBelow",
|
|
715
|
+
command: "plugin.table.addRowBelow",
|
|
716
|
+
icon: /* @__PURE__ */ e(Ft, {}),
|
|
717
|
+
label: ["editor.table.rowBelow", "Add row below"]
|
|
718
|
+
},
|
|
719
|
+
{
|
|
720
|
+
id: "colLeft",
|
|
721
|
+
command: "plugin.table.addColumnLeft",
|
|
722
|
+
icon: /* @__PURE__ */ e(Qt, {}),
|
|
723
|
+
label: ["editor.table.columnLeft", "Add column left"]
|
|
724
|
+
},
|
|
725
|
+
{
|
|
726
|
+
id: "colRight",
|
|
727
|
+
command: "plugin.table.addColumnRight",
|
|
728
|
+
icon: /* @__PURE__ */ e(Xt, {}),
|
|
729
|
+
label: ["editor.table.columnRight", "Add column right"]
|
|
730
|
+
},
|
|
731
|
+
{
|
|
732
|
+
id: "addHead",
|
|
733
|
+
command: "plugin.table.addHead",
|
|
734
|
+
icon: /* @__PURE__ */ e(wr, {}),
|
|
735
|
+
label: ["editor.table.addHeader", "Add header row"]
|
|
736
|
+
},
|
|
737
|
+
{
|
|
738
|
+
id: "deleteHead",
|
|
739
|
+
command: "plugin.table.deleteHead",
|
|
740
|
+
icon: /* @__PURE__ */ e(vr, {}),
|
|
741
|
+
label: ["editor.table.deleteHeader", "Remove header row"]
|
|
742
|
+
},
|
|
743
|
+
{
|
|
744
|
+
id: "deleteRow",
|
|
745
|
+
command: "plugin.table.deleteRow",
|
|
746
|
+
icon: /* @__PURE__ */ e(_r, {}),
|
|
747
|
+
label: ["editor.table.deleteRow", "Delete row"]
|
|
748
|
+
},
|
|
749
|
+
{
|
|
750
|
+
id: "deleteColumn",
|
|
751
|
+
command: "plugin.table.deleteColumn",
|
|
752
|
+
icon: /* @__PURE__ */ e(qt, {}),
|
|
753
|
+
label: ["editor.table.deleteColumn", "Delete column"]
|
|
754
|
+
},
|
|
755
|
+
{
|
|
756
|
+
id: "deleteTable",
|
|
757
|
+
command: "plugin.table.deleteTable",
|
|
758
|
+
icon: /* @__PURE__ */ e(jt, {}),
|
|
759
|
+
label: ["editor.table.deleteTable", "Delete table"]
|
|
760
|
+
}
|
|
761
|
+
], Te = 6, Xr = De(
|
|
762
|
+
[
|
|
763
|
+
"ds:flex ds:flex-wrap ds:items-center ds:gap-[var(--spacing-xs)]",
|
|
764
|
+
"ds:rounded-[var(--radius-md)] ds:border ds:border-[color:var(--border)]",
|
|
765
|
+
"ds:bg-[var(--background)] ds:p-[var(--spacing-xs)]",
|
|
766
|
+
"ds:shadow-[var(--shadow-md)]"
|
|
767
|
+
].join(" ")
|
|
768
|
+
), lt = "ds:self-stretch ds:[inline-size:var(--border-width-sm)] ds:bg-[var(--border)] ds:[margin-inline:var(--spacing-2xs)]", be = "ds:text-[length:var(--font-size-sm)] ds:font-medium ds:text-[color:var(--foreground)]";
|
|
769
|
+
function Me(o) {
|
|
770
|
+
return o.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """);
|
|
771
|
+
}
|
|
772
|
+
function Ur({
|
|
773
|
+
run: o,
|
|
774
|
+
active: a,
|
|
775
|
+
onTriggerDown: c
|
|
776
|
+
}) {
|
|
777
|
+
const { t: l } = Z(), s = $e.find((f) => a.has(f.id)) ?? $e[0];
|
|
778
|
+
return /* @__PURE__ */ y(ze.Root, { children: [
|
|
779
|
+
/* @__PURE__ */ e(ze.Trigger, { asChild: !0, children: /* @__PURE__ */ e(
|
|
780
|
+
ne,
|
|
781
|
+
{
|
|
782
|
+
size: "sm",
|
|
783
|
+
intent: "ghost",
|
|
784
|
+
startIcon: s.icon,
|
|
785
|
+
endIcon: /* @__PURE__ */ e(Ot, {}),
|
|
786
|
+
"aria-label": l("editor.format", "Paragraph style"),
|
|
787
|
+
onMouseDown: c,
|
|
788
|
+
children: l(s.label[0], s.label[1])
|
|
789
|
+
}
|
|
790
|
+
) }),
|
|
791
|
+
/* @__PURE__ */ e(ze.Content, { align: "start", children: $e.map((f) => /* @__PURE__ */ e(
|
|
792
|
+
ze.Item,
|
|
793
|
+
{
|
|
794
|
+
startIcon: f.icon,
|
|
795
|
+
onSelect: () => o("module.block.format", { tag: f.tag }),
|
|
796
|
+
children: l(f.label[0], f.label[1])
|
|
797
|
+
},
|
|
798
|
+
f.id
|
|
799
|
+
)) })
|
|
800
|
+
] });
|
|
801
|
+
}
|
|
802
|
+
function Qr({
|
|
803
|
+
insertHtml: o,
|
|
804
|
+
saveSelection: a,
|
|
805
|
+
restoreSelection: c,
|
|
806
|
+
getSelectedText: l
|
|
807
|
+
}) {
|
|
808
|
+
const { t: s } = Z(), [f, g] = z(!1), [i, p] = z(""), [v, T] = z(""), [H, S] = z(!1), w = le(), O = le(), u = () => {
|
|
809
|
+
p(""), T(""), S(!1);
|
|
810
|
+
}, h = () => {
|
|
811
|
+
const k = i.trim();
|
|
812
|
+
if (!k) return;
|
|
813
|
+
const A = v.trim() || k, M = H ? ' target="_blank" rel="noopener noreferrer"' : "", E = `<a href="${Me(k)}"${M}>${Me(A)}</a>`;
|
|
814
|
+
g(!1), u(), window.requestAnimationFrame(() => {
|
|
815
|
+
c(), o(E);
|
|
816
|
+
});
|
|
817
|
+
};
|
|
818
|
+
return /* @__PURE__ */ y(j.Root, { open: f, onOpenChange: g, children: [
|
|
819
|
+
/* @__PURE__ */ e(j.Trigger, { asChild: !0, children: /* @__PURE__ */ e(
|
|
820
|
+
P,
|
|
821
|
+
{
|
|
822
|
+
size: "sm",
|
|
823
|
+
intent: "ghost",
|
|
824
|
+
icon: /* @__PURE__ */ e(lr, {}),
|
|
825
|
+
"aria-label": s("editor.link.insert", "Insert link"),
|
|
826
|
+
onMouseDown: () => {
|
|
827
|
+
a(), T(l());
|
|
828
|
+
}
|
|
829
|
+
}
|
|
830
|
+
) }),
|
|
831
|
+
/* @__PURE__ */ y(j.Content, { children: [
|
|
832
|
+
/* @__PURE__ */ e(j.Header, { children: /* @__PURE__ */ e(j.Title, { children: s("editor.link.insert", "Insert link") }) }),
|
|
833
|
+
/* @__PURE__ */ y(j.Body, { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-md)]", children: [
|
|
834
|
+
/* @__PURE__ */ y("div", { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-xs)]", children: [
|
|
835
|
+
/* @__PURE__ */ e("label", { htmlFor: w, className: be, children: s("editor.link.url", "URL") }),
|
|
836
|
+
/* @__PURE__ */ e(
|
|
837
|
+
_e,
|
|
838
|
+
{
|
|
839
|
+
id: w,
|
|
840
|
+
type: "url",
|
|
841
|
+
value: i,
|
|
842
|
+
onChange: (k) => p(k.target.value),
|
|
843
|
+
placeholder: "https://…"
|
|
844
|
+
}
|
|
845
|
+
)
|
|
846
|
+
] }),
|
|
847
|
+
/* @__PURE__ */ y("div", { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-xs)]", children: [
|
|
848
|
+
/* @__PURE__ */ e("label", { htmlFor: O, className: be, children: s("editor.link.text", "Text to display") }),
|
|
849
|
+
/* @__PURE__ */ e(
|
|
850
|
+
_e,
|
|
851
|
+
{
|
|
852
|
+
id: O,
|
|
853
|
+
value: v,
|
|
854
|
+
onChange: (k) => T(k.target.value),
|
|
855
|
+
placeholder: s("editor.link.textPlaceholder", "Link text")
|
|
856
|
+
}
|
|
857
|
+
)
|
|
858
|
+
] }),
|
|
859
|
+
/* @__PURE__ */ e(
|
|
860
|
+
It,
|
|
861
|
+
{
|
|
862
|
+
checked: H,
|
|
863
|
+
onCheckedChange: (k) => S(k === !0),
|
|
864
|
+
label: s("editor.link.newTab", "Open in new tab")
|
|
865
|
+
}
|
|
866
|
+
)
|
|
867
|
+
] }),
|
|
868
|
+
/* @__PURE__ */ y(j.Footer, { children: [
|
|
869
|
+
/* @__PURE__ */ e(j.Close, { asChild: !0, children: /* @__PURE__ */ e(ne, { intent: "secondary", children: s("common.cancel") }) }),
|
|
870
|
+
/* @__PURE__ */ e(ne, { onClick: h, disabled: !i.trim(), children: s("editor.link.insertAction", "Insert") })
|
|
871
|
+
] })
|
|
872
|
+
] })
|
|
873
|
+
] });
|
|
874
|
+
}
|
|
875
|
+
function Zr({
|
|
876
|
+
insertHtml: o,
|
|
877
|
+
saveSelection: a,
|
|
878
|
+
restoreSelection: c,
|
|
879
|
+
uploadImage: l
|
|
880
|
+
}) {
|
|
881
|
+
const { t: s } = Z(), [f, g] = z(!1), [i, p] = z(""), [v, T] = z(""), H = le(), S = le(), w = (u, h) => {
|
|
882
|
+
const k = `<img src="${Me(u)}" alt="${Me(h)}" loading="lazy">`;
|
|
883
|
+
g(!1), p(""), T(""), window.requestAnimationFrame(() => {
|
|
884
|
+
c(), o(k);
|
|
885
|
+
});
|
|
886
|
+
}, O = () => {
|
|
887
|
+
const u = i.trim();
|
|
888
|
+
u && w(u, v.trim());
|
|
889
|
+
};
|
|
890
|
+
return /* @__PURE__ */ y(j.Root, { open: f, onOpenChange: g, children: [
|
|
891
|
+
/* @__PURE__ */ e(j.Trigger, { asChild: !0, children: /* @__PURE__ */ e(
|
|
892
|
+
P,
|
|
893
|
+
{
|
|
894
|
+
size: "sm",
|
|
895
|
+
intent: "ghost",
|
|
896
|
+
icon: /* @__PURE__ */ e(Dt, {}),
|
|
897
|
+
"aria-label": s("editor.image.insert", "Insert image"),
|
|
898
|
+
onMouseDown: () => a()
|
|
899
|
+
}
|
|
900
|
+
) }),
|
|
901
|
+
/* @__PURE__ */ y(j.Content, { children: [
|
|
902
|
+
/* @__PURE__ */ e(j.Header, { children: /* @__PURE__ */ e(j.Title, { children: s("editor.image.insert", "Insert image") }) }),
|
|
903
|
+
/* @__PURE__ */ y(j.Body, { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-md)]", children: [
|
|
904
|
+
l ? /* @__PURE__ */ y("div", { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-xs)]", children: [
|
|
905
|
+
/* @__PURE__ */ e("span", { className: be, children: s("editor.image.upload", "Upload") }),
|
|
906
|
+
/* @__PURE__ */ e(
|
|
907
|
+
Lt,
|
|
908
|
+
{
|
|
909
|
+
variant: "dropzone",
|
|
910
|
+
accept: {
|
|
911
|
+
"image/*": [".png", ".jpg", ".jpeg", ".gif", ".webp", ".svg"]
|
|
912
|
+
},
|
|
913
|
+
maxFiles: 1,
|
|
914
|
+
onUpload: async (u, { signal: h }) => {
|
|
915
|
+
const k = await l(u, h);
|
|
916
|
+
w(k, u.name);
|
|
917
|
+
}
|
|
918
|
+
}
|
|
919
|
+
),
|
|
920
|
+
/* @__PURE__ */ e("span", { className: "ds:text-[length:var(--font-size-sm)] ds:text-[color:var(--muted-foreground)]", children: s("editor.image.orUrl", "Or paste an image URL") })
|
|
921
|
+
] }) : null,
|
|
922
|
+
/* @__PURE__ */ y("div", { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-xs)]", children: [
|
|
923
|
+
/* @__PURE__ */ e("label", { htmlFor: H, className: be, children: s("editor.image.url", "Image URL") }),
|
|
924
|
+
/* @__PURE__ */ e(
|
|
925
|
+
_e,
|
|
926
|
+
{
|
|
927
|
+
id: H,
|
|
928
|
+
type: "url",
|
|
929
|
+
value: i,
|
|
930
|
+
onChange: (u) => p(u.target.value),
|
|
931
|
+
placeholder: "https://…"
|
|
932
|
+
}
|
|
933
|
+
)
|
|
934
|
+
] }),
|
|
935
|
+
/* @__PURE__ */ y("div", { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-xs)]", children: [
|
|
936
|
+
/* @__PURE__ */ e("label", { htmlFor: S, className: be, children: s("editor.image.alt", "Alt text") }),
|
|
937
|
+
/* @__PURE__ */ e(
|
|
938
|
+
_e,
|
|
939
|
+
{
|
|
940
|
+
id: S,
|
|
941
|
+
value: v,
|
|
942
|
+
onChange: (u) => T(u.target.value),
|
|
943
|
+
placeholder: s(
|
|
944
|
+
"editor.image.altPlaceholder",
|
|
945
|
+
"Describe the image"
|
|
946
|
+
)
|
|
947
|
+
}
|
|
948
|
+
)
|
|
949
|
+
] })
|
|
950
|
+
] }),
|
|
951
|
+
/* @__PURE__ */ y(j.Footer, { children: [
|
|
952
|
+
/* @__PURE__ */ e(j.Close, { asChild: !0, children: /* @__PURE__ */ e(ne, { intent: "secondary", children: s("common.cancel") }) }),
|
|
953
|
+
/* @__PURE__ */ e(ne, { onClick: O, disabled: !i.trim(), children: s("editor.image.insertAction", "Insert") })
|
|
954
|
+
] })
|
|
955
|
+
] })
|
|
956
|
+
] });
|
|
957
|
+
}
|
|
958
|
+
function Yr({
|
|
959
|
+
run: o,
|
|
960
|
+
saveSelection: a,
|
|
961
|
+
restoreSelection: c
|
|
962
|
+
}) {
|
|
963
|
+
const { t: l } = Z(), [s, f] = z("#1f2a5c"), g = (p) => {
|
|
964
|
+
f(p), c(), o("module.inline.format", {
|
|
965
|
+
tag: "span",
|
|
966
|
+
style: { color: p },
|
|
967
|
+
type: "toggle"
|
|
968
|
+
});
|
|
969
|
+
}, i = () => {
|
|
970
|
+
c(), o("module.inline.remove", { style: "color" });
|
|
971
|
+
};
|
|
972
|
+
return /* @__PURE__ */ y(B, { onOpenChange: (p) => p && a(), children: [
|
|
973
|
+
/* @__PURE__ */ e(B.Trigger, { asChild: !0, children: /* @__PURE__ */ e(
|
|
974
|
+
P,
|
|
975
|
+
{
|
|
976
|
+
size: "sm",
|
|
977
|
+
intent: "ghost",
|
|
978
|
+
icon: /* @__PURE__ */ e(br, {}),
|
|
979
|
+
"aria-label": l("editor.textColor", "Text colour"),
|
|
980
|
+
onMouseDown: (p) => {
|
|
981
|
+
p.preventDefault(), a();
|
|
982
|
+
}
|
|
983
|
+
}
|
|
984
|
+
) }),
|
|
985
|
+
/* @__PURE__ */ y(B.Content, { side: "bottom", align: "start", children: [
|
|
986
|
+
/* @__PURE__ */ e(B.Heading, { children: l("editor.textColor", "Text colour") }),
|
|
987
|
+
/* @__PURE__ */ e("div", { className: "ds:pt-[var(--spacing-sm)]", children: /* @__PURE__ */ e(
|
|
988
|
+
qe,
|
|
989
|
+
{
|
|
990
|
+
variant: "inline",
|
|
991
|
+
size: "sm",
|
|
992
|
+
value: s,
|
|
993
|
+
onChange: g
|
|
994
|
+
}
|
|
995
|
+
) }),
|
|
996
|
+
/* @__PURE__ */ e("div", { className: "ds:mt-[var(--spacing-sm)] ds:flex ds:items-center ds:justify-end", children: /* @__PURE__ */ e(ne, { size: "sm", intent: "secondary", onClick: i, children: l("editor.color.remove", "Remove colour") }) })
|
|
997
|
+
] })
|
|
998
|
+
] });
|
|
999
|
+
}
|
|
1000
|
+
function Jr({
|
|
1001
|
+
run: o,
|
|
1002
|
+
saveSelection: a,
|
|
1003
|
+
restoreSelection: c
|
|
1004
|
+
}) {
|
|
1005
|
+
const { t: l } = Z(), [s, f] = z("#fff3a3"), g = (p) => {
|
|
1006
|
+
f(p), c(), o("module.inline.format", {
|
|
1007
|
+
tag: "span",
|
|
1008
|
+
style: { "background-color": p },
|
|
1009
|
+
type: "toggle"
|
|
1010
|
+
});
|
|
1011
|
+
}, i = () => {
|
|
1012
|
+
c(), o("module.inline.remove", { style: "background-color" });
|
|
1013
|
+
};
|
|
1014
|
+
return /* @__PURE__ */ y(B, { onOpenChange: (p) => p && a(), children: [
|
|
1015
|
+
/* @__PURE__ */ e(B.Trigger, { asChild: !0, children: /* @__PURE__ */ e(
|
|
1016
|
+
P,
|
|
1017
|
+
{
|
|
1018
|
+
size: "sm",
|
|
1019
|
+
intent: "ghost",
|
|
1020
|
+
icon: /* @__PURE__ */ e(nr, {}),
|
|
1021
|
+
"aria-label": l("editor.highlightColor", "Highlight"),
|
|
1022
|
+
onMouseDown: (p) => {
|
|
1023
|
+
p.preventDefault(), a();
|
|
1024
|
+
}
|
|
1025
|
+
}
|
|
1026
|
+
) }),
|
|
1027
|
+
/* @__PURE__ */ y(B.Content, { side: "bottom", align: "start", children: [
|
|
1028
|
+
/* @__PURE__ */ e(B.Heading, { children: l("editor.highlightColor", "Highlight") }),
|
|
1029
|
+
/* @__PURE__ */ e("div", { className: "ds:pt-[var(--spacing-sm)]", children: /* @__PURE__ */ e(
|
|
1030
|
+
qe,
|
|
1031
|
+
{
|
|
1032
|
+
variant: "inline",
|
|
1033
|
+
size: "sm",
|
|
1034
|
+
value: s,
|
|
1035
|
+
onChange: g
|
|
1036
|
+
}
|
|
1037
|
+
) }),
|
|
1038
|
+
/* @__PURE__ */ e("div", { className: "ds:mt-[var(--spacing-sm)] ds:flex ds:items-center ds:justify-end", children: /* @__PURE__ */ e(ne, { size: "sm", intent: "secondary", onClick: i, children: l("editor.highlight.remove", "Remove highlight") }) })
|
|
1039
|
+
] })
|
|
1040
|
+
] });
|
|
1041
|
+
}
|
|
1042
|
+
function Kr(o, a) {
|
|
1043
|
+
const c = Array.from({ length: a }, () => "<td><br></td>").join("");
|
|
1044
|
+
return `<table><tbody>${Array.from({ length: o }, () => `<tr>${c}</tr>`).join("")}</tbody></table>`;
|
|
1045
|
+
}
|
|
1046
|
+
function en({
|
|
1047
|
+
run: o,
|
|
1048
|
+
insertTable: a,
|
|
1049
|
+
active: c
|
|
1050
|
+
}) {
|
|
1051
|
+
const { t: l } = Z(), [s, f] = z({ r: 0, c: 0 }), g = c.has("table");
|
|
1052
|
+
return /* @__PURE__ */ y(B, { onOpenChange: (i) => !i && f({ r: 0, c: 0 }), children: [
|
|
1053
|
+
/* @__PURE__ */ e(B.Trigger, { asChild: !0, children: /* @__PURE__ */ e(
|
|
1054
|
+
P,
|
|
1055
|
+
{
|
|
1056
|
+
size: "sm",
|
|
1057
|
+
intent: "ghost",
|
|
1058
|
+
icon: /* @__PURE__ */ e(Hr, {}),
|
|
1059
|
+
"aria-label": l("editor.table.insert", "Insert table"),
|
|
1060
|
+
onMouseDown: (i) => i.preventDefault()
|
|
1061
|
+
}
|
|
1062
|
+
) }),
|
|
1063
|
+
/* @__PURE__ */ e(B.Content, { side: "bottom", align: "start", children: g ? (
|
|
1064
|
+
// Caret is already inside a table — offer the manage ops only, never
|
|
1065
|
+
// a nested-table insert (mirrors Redactor's native dropdown, which
|
|
1066
|
+
// disables "insert table" while the caret is in a table).
|
|
1067
|
+
/* @__PURE__ */ e("div", { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-2xs)]", children: it.map((i) => /* @__PURE__ */ y(
|
|
1068
|
+
"button",
|
|
1069
|
+
{
|
|
1070
|
+
type: "button",
|
|
1071
|
+
onClick: () => o(i.command),
|
|
1072
|
+
className: "ds:flex ds:items-center ds:gap-[var(--spacing-sm)] ds:rounded-[var(--radius-sm)] ds:px-[var(--spacing-sm)] ds:py-[var(--spacing-2xs)] ds:text-start ds:text-[length:var(--font-size-sm)] ds:text-[color:var(--foreground)] ds:hover:bg-[var(--muted)]",
|
|
1073
|
+
children: [
|
|
1074
|
+
/* @__PURE__ */ e(
|
|
1075
|
+
"span",
|
|
1076
|
+
{
|
|
1077
|
+
"aria-hidden": "true",
|
|
1078
|
+
className: "ds:inline-flex ds:size-4 ds:shrink-0 ds:items-center ds:justify-center ds:text-[color:var(--muted-foreground)]",
|
|
1079
|
+
children: i.icon
|
|
1080
|
+
}
|
|
1081
|
+
),
|
|
1082
|
+
l(i.label[0], i.label[1])
|
|
1083
|
+
]
|
|
1084
|
+
},
|
|
1085
|
+
i.id
|
|
1086
|
+
)) })
|
|
1087
|
+
) : /* @__PURE__ */ y(Oe, { children: [
|
|
1088
|
+
/* @__PURE__ */ e(B.Heading, { children: l("editor.table.insert", "Insert table") }),
|
|
1089
|
+
/* @__PURE__ */ e(
|
|
1090
|
+
"div",
|
|
1091
|
+
{
|
|
1092
|
+
role: "group",
|
|
1093
|
+
"aria-label": l("editor.table.sizePicker", "Table size"),
|
|
1094
|
+
className: "ds:mt-[var(--spacing-sm)] ds:grid ds:w-fit ds:grid-cols-6 ds:gap-[var(--spacing-2xs)]",
|
|
1095
|
+
onMouseLeave: () => f({ r: 0, c: 0 }),
|
|
1096
|
+
children: Array.from({ length: Te * Te }, (i, p) => {
|
|
1097
|
+
const v = Math.floor(p / Te) + 1, T = p % Te + 1, H = v <= s.r && T <= s.c;
|
|
1098
|
+
return /* @__PURE__ */ e(
|
|
1099
|
+
"button",
|
|
1100
|
+
{
|
|
1101
|
+
type: "button",
|
|
1102
|
+
"aria-label": l("editor.table.sizeCell", "{{r}}×{{c}}", {
|
|
1103
|
+
r: v,
|
|
1104
|
+
c: T
|
|
1105
|
+
}),
|
|
1106
|
+
onMouseEnter: () => f({ r: v, c: T }),
|
|
1107
|
+
onClick: () => a(Kr(v, T)),
|
|
1108
|
+
className: `ds:size-5 ds:rounded-[var(--radius-sm)] ds:border ds:border-[color:var(--border)] ${H ? "ds:bg-[var(--primary)]" : "ds:bg-[var(--muted)]"}`
|
|
1109
|
+
},
|
|
1110
|
+
p
|
|
1111
|
+
);
|
|
1112
|
+
})
|
|
1113
|
+
}
|
|
1114
|
+
),
|
|
1115
|
+
/* @__PURE__ */ e("p", { className: "ds:mt-[var(--spacing-xs)] ds:text-[length:var(--font-size-sm)] ds:text-[color:var(--muted-foreground)]", children: s.r > 0 ? l("editor.table.sizeCell", "{{r}}×{{c}}", {
|
|
1116
|
+
r: s.r,
|
|
1117
|
+
c: s.c
|
|
1118
|
+
}) : l("editor.table.sizeHint", "Pick a size") })
|
|
1119
|
+
] }) })
|
|
1120
|
+
] });
|
|
1121
|
+
}
|
|
1122
|
+
const tn = Object.fromEntries(it.map((o) => [o.id, o])), rn = [
|
|
1123
|
+
"ds:absolute ds:z-20 ds:flex ds:items-center ds:gap-[var(--spacing-2xs)]",
|
|
1124
|
+
"ds:[inset-block-start:var(--rte-tt-top)] ds:[inset-inline-start:var(--rte-tt-start)]",
|
|
1125
|
+
"ds:rounded-[var(--radius-md)] ds:border ds:border-[color:var(--border)]",
|
|
1126
|
+
"ds:bg-[var(--popover)] ds:p-[var(--spacing-2xs)] ds:shadow-[var(--shadow-lg)]"
|
|
1127
|
+
].join(" "), nn = "#fde68a";
|
|
1128
|
+
function rt({
|
|
1129
|
+
scope: o,
|
|
1130
|
+
icon: a,
|
|
1131
|
+
label: c,
|
|
1132
|
+
onOpenChange: l,
|
|
1133
|
+
saveTableCell: s,
|
|
1134
|
+
applyTableBackground: f
|
|
1135
|
+
}) {
|
|
1136
|
+
const { t: g } = Z(), [i, p] = z(nn);
|
|
1137
|
+
return /* @__PURE__ */ y(
|
|
1138
|
+
B,
|
|
1139
|
+
{
|
|
1140
|
+
onOpenChange: (v) => {
|
|
1141
|
+
l(v), v && s();
|
|
1142
|
+
},
|
|
1143
|
+
children: [
|
|
1144
|
+
/* @__PURE__ */ e(B.Trigger, { asChild: !0, children: /* @__PURE__ */ e(
|
|
1145
|
+
P,
|
|
1146
|
+
{
|
|
1147
|
+
size: "sm",
|
|
1148
|
+
intent: "ghost",
|
|
1149
|
+
icon: a,
|
|
1150
|
+
tooltip: c,
|
|
1151
|
+
onMouseDown: (v) => v.preventDefault()
|
|
1152
|
+
}
|
|
1153
|
+
) }),
|
|
1154
|
+
/* @__PURE__ */ y(B.Content, { side: "bottom", align: "center", children: [
|
|
1155
|
+
/* @__PURE__ */ e(
|
|
1156
|
+
qe,
|
|
1157
|
+
{
|
|
1158
|
+
variant: "inline",
|
|
1159
|
+
size: "sm",
|
|
1160
|
+
value: i,
|
|
1161
|
+
onChange: (v) => {
|
|
1162
|
+
p(v), f(o, v);
|
|
1163
|
+
}
|
|
1164
|
+
}
|
|
1165
|
+
),
|
|
1166
|
+
/* @__PURE__ */ e(
|
|
1167
|
+
ne,
|
|
1168
|
+
{
|
|
1169
|
+
size: "sm",
|
|
1170
|
+
intent: "ghost",
|
|
1171
|
+
className: "ds:mt-[var(--spacing-xs)] ds:w-full",
|
|
1172
|
+
onClick: () => f(o, null),
|
|
1173
|
+
children: g("editor.table.clearColor", "Clear colour")
|
|
1174
|
+
}
|
|
1175
|
+
)
|
|
1176
|
+
] })
|
|
1177
|
+
]
|
|
1178
|
+
}
|
|
1179
|
+
);
|
|
1180
|
+
}
|
|
1181
|
+
function on({
|
|
1182
|
+
active: o,
|
|
1183
|
+
run: a,
|
|
1184
|
+
areaRef: c,
|
|
1185
|
+
getActiveTableEl: l,
|
|
1186
|
+
enableColor: s = !1,
|
|
1187
|
+
saveTableCell: f,
|
|
1188
|
+
applyTableBackground: g
|
|
1189
|
+
}) {
|
|
1190
|
+
const { t: i } = Z(), p = o.has("table"), [v, T] = z(null), H = L(0), [S, w] = z(!1), O = C((h) => {
|
|
1191
|
+
H.current = Math.max(
|
|
1192
|
+
0,
|
|
1193
|
+
H.current + (h ? 1 : -1)
|
|
1194
|
+
), w(H.current > 0);
|
|
1195
|
+
}, []);
|
|
1196
|
+
if (K(() => {
|
|
1197
|
+
if (S) return;
|
|
1198
|
+
if (!p || typeof window > "u") {
|
|
1199
|
+
T(null);
|
|
1200
|
+
return;
|
|
1201
|
+
}
|
|
1202
|
+
const h = () => {
|
|
1203
|
+
const E = c.current, Y = l();
|
|
1204
|
+
if (!E || !Y) {
|
|
1205
|
+
T(null);
|
|
1206
|
+
return;
|
|
1207
|
+
}
|
|
1208
|
+
const $ = E.getBoundingClientRect(), D = Y.getBoundingClientRect(), I = getComputedStyle(E).direction === "rtl", J = Math.max(0, D.top - $.top - 44), ee = I ? $.right - D.right + D.width / 2 : D.left - $.left + D.width / 2;
|
|
1209
|
+
T({ top: J, start: Math.max(0, ee), rtl: I });
|
|
1210
|
+
};
|
|
1211
|
+
h();
|
|
1212
|
+
const k = new ResizeObserver(h), A = c.current, M = l();
|
|
1213
|
+
return A && k.observe(A), M && k.observe(M), window.addEventListener("scroll", h, !0), window.addEventListener("resize", h), () => {
|
|
1214
|
+
k.disconnect(), window.removeEventListener("scroll", h, !0), window.removeEventListener("resize", h);
|
|
1215
|
+
};
|
|
1216
|
+
}, [p, S, c, l]), !p && !S || !v) return null;
|
|
1217
|
+
const u = [
|
|
1218
|
+
["rowAbove", "rowBelow"],
|
|
1219
|
+
["colLeft", "colRight"],
|
|
1220
|
+
["addHead"],
|
|
1221
|
+
...s ? ["colour"] : [],
|
|
1222
|
+
["deleteRow", "deleteColumn"],
|
|
1223
|
+
["deleteTable"]
|
|
1224
|
+
];
|
|
1225
|
+
return (
|
|
1226
|
+
// Tooltips disambiguate the icon-only ops on hover (and provide each
|
|
1227
|
+
// button's accessible name via IconButton's `tooltip` prop). Radix Tooltip
|
|
1228
|
+
// needs a provider ancestor, so scope one to the bar.
|
|
1229
|
+
/* @__PURE__ */ e($t, { children: /* @__PURE__ */ e(
|
|
1230
|
+
"div",
|
|
1231
|
+
{
|
|
1232
|
+
role: "group",
|
|
1233
|
+
"aria-label": i("editor.table.toolbar", "Table tools"),
|
|
1234
|
+
className: `${rn} ${v.rtl ? "ds:translate-x-1/2" : "ds:-translate-x-1/2"}`,
|
|
1235
|
+
style: {
|
|
1236
|
+
"--rte-tt-top": `${v.top}px`,
|
|
1237
|
+
"--rte-tt-start": `${v.start}px`
|
|
1238
|
+
},
|
|
1239
|
+
children: u.map((h, k) => /* @__PURE__ */ y(nt, { children: [
|
|
1240
|
+
k > 0 ? /* @__PURE__ */ e("span", { "aria-hidden": "true", className: lt }) : null,
|
|
1241
|
+
h === "colour" ? /* @__PURE__ */ y(Oe, { children: [
|
|
1242
|
+
/* @__PURE__ */ e(
|
|
1243
|
+
rt,
|
|
1244
|
+
{
|
|
1245
|
+
scope: "cell",
|
|
1246
|
+
icon: /* @__PURE__ */ e(hr, {}),
|
|
1247
|
+
label: i("editor.table.cellColor", "Cell colour"),
|
|
1248
|
+
onOpenChange: O,
|
|
1249
|
+
saveTableCell: f,
|
|
1250
|
+
applyTableBackground: g
|
|
1251
|
+
}
|
|
1252
|
+
),
|
|
1253
|
+
/* @__PURE__ */ e(
|
|
1254
|
+
rt,
|
|
1255
|
+
{
|
|
1256
|
+
scope: "row",
|
|
1257
|
+
icon: /* @__PURE__ */ e(gr, {}),
|
|
1258
|
+
label: i("editor.table.rowColor", "Row colour"),
|
|
1259
|
+
onOpenChange: O,
|
|
1260
|
+
saveTableCell: f,
|
|
1261
|
+
applyTableBackground: g
|
|
1262
|
+
}
|
|
1263
|
+
)
|
|
1264
|
+
] }) : h.map((A) => {
|
|
1265
|
+
const M = tn[A];
|
|
1266
|
+
return /* @__PURE__ */ e(
|
|
1267
|
+
P,
|
|
1268
|
+
{
|
|
1269
|
+
size: "sm",
|
|
1270
|
+
intent: "ghost",
|
|
1271
|
+
icon: M.icon,
|
|
1272
|
+
tooltip: i(M.label[0], M.label[1]),
|
|
1273
|
+
onMouseDown: (E) => E.preventDefault(),
|
|
1274
|
+
onClick: () => a(M.command)
|
|
1275
|
+
},
|
|
1276
|
+
A
|
|
1277
|
+
);
|
|
1278
|
+
})
|
|
1279
|
+
] }, h === "colour" ? "colour" : h[0]))
|
|
1280
|
+
}
|
|
1281
|
+
) })
|
|
1282
|
+
);
|
|
1283
|
+
}
|
|
1284
|
+
function an({
|
|
1285
|
+
run: o,
|
|
1286
|
+
active: a,
|
|
1287
|
+
preset: c,
|
|
1288
|
+
insertHtml: l,
|
|
1289
|
+
insertTable: s,
|
|
1290
|
+
saveSelection: f,
|
|
1291
|
+
restoreSelection: g,
|
|
1292
|
+
getSelectedText: i,
|
|
1293
|
+
uploadImage: p,
|
|
1294
|
+
enableColor: v = !1,
|
|
1295
|
+
enableImage: T = !1,
|
|
1296
|
+
enableTable: H = !1,
|
|
1297
|
+
showExtensions: S = !1
|
|
1298
|
+
}) {
|
|
1299
|
+
const { t: w } = Z(), O = ($) => $.preventDefault(), u = ($) => Wr[c].includes($), h = ($) => {
|
|
1300
|
+
if (!u($)) return null;
|
|
1301
|
+
const D = Gr[$];
|
|
1302
|
+
return /* @__PURE__ */ e(
|
|
1303
|
+
P,
|
|
1304
|
+
{
|
|
1305
|
+
size: "sm",
|
|
1306
|
+
intent: "ghost",
|
|
1307
|
+
icon: D.icon,
|
|
1308
|
+
"aria-label": w(D.label[0], D.label[1]),
|
|
1309
|
+
"aria-pressed": D.toggle ? a.has(D.toggle) : void 0,
|
|
1310
|
+
onMouseDown: O,
|
|
1311
|
+
onClick: () => o(...D.command)
|
|
1312
|
+
},
|
|
1313
|
+
D.id
|
|
1314
|
+
);
|
|
1315
|
+
}, k = () => /* @__PURE__ */ e("span", { "aria-hidden": "true", className: lt }), A = u("format"), M = u("bold") || u("italic") || u("underline") || u("strike") || v, E = u("ul") || u("ol"), Y = u("link") || T || H;
|
|
1316
|
+
return /* @__PURE__ */ y(
|
|
1317
|
+
"div",
|
|
1318
|
+
{
|
|
1319
|
+
role: "group",
|
|
1320
|
+
"aria-label": w("editor.toolbarLabel"),
|
|
1321
|
+
className: Xr(),
|
|
1322
|
+
"data-component": "editor-toolbar",
|
|
1323
|
+
children: [
|
|
1324
|
+
A ? /* @__PURE__ */ e(Ur, { run: o, active: a, onTriggerDown: O }) : null,
|
|
1325
|
+
A && M ? /* @__PURE__ */ e(k, {}) : null,
|
|
1326
|
+
h("bold"),
|
|
1327
|
+
h("italic"),
|
|
1328
|
+
h("underline"),
|
|
1329
|
+
h("strike"),
|
|
1330
|
+
v ? /* @__PURE__ */ e(
|
|
1331
|
+
Yr,
|
|
1332
|
+
{
|
|
1333
|
+
run: o,
|
|
1334
|
+
saveSelection: f,
|
|
1335
|
+
restoreSelection: g
|
|
1336
|
+
}
|
|
1337
|
+
) : null,
|
|
1338
|
+
v ? /* @__PURE__ */ e(
|
|
1339
|
+
Jr,
|
|
1340
|
+
{
|
|
1341
|
+
run: o,
|
|
1342
|
+
saveSelection: f,
|
|
1343
|
+
restoreSelection: g
|
|
1344
|
+
}
|
|
1345
|
+
) : null,
|
|
1346
|
+
(A || M) && E ? /* @__PURE__ */ e(k, {}) : null,
|
|
1347
|
+
h("ul"),
|
|
1348
|
+
h("ol"),
|
|
1349
|
+
(A || M || E) && Y ? /* @__PURE__ */ e(k, {}) : null,
|
|
1350
|
+
u("link") ? /* @__PURE__ */ e(
|
|
1351
|
+
Qr,
|
|
1352
|
+
{
|
|
1353
|
+
insertHtml: l,
|
|
1354
|
+
saveSelection: f,
|
|
1355
|
+
restoreSelection: g,
|
|
1356
|
+
getSelectedText: i
|
|
1357
|
+
}
|
|
1358
|
+
) : null,
|
|
1359
|
+
T ? /* @__PURE__ */ e(
|
|
1360
|
+
Zr,
|
|
1361
|
+
{
|
|
1362
|
+
insertHtml: l,
|
|
1363
|
+
saveSelection: f,
|
|
1364
|
+
restoreSelection: g,
|
|
1365
|
+
uploadImage: p
|
|
1366
|
+
}
|
|
1367
|
+
) : null,
|
|
1368
|
+
H ? /* @__PURE__ */ e(en, { run: o, insertTable: s, active: a }) : null,
|
|
1369
|
+
S && (A || M || E || Y) ? /* @__PURE__ */ e(k, {}) : null,
|
|
1370
|
+
S ? /* @__PURE__ */ e(
|
|
1371
|
+
P,
|
|
1372
|
+
{
|
|
1373
|
+
size: "sm",
|
|
1374
|
+
intent: "ghost",
|
|
1375
|
+
icon: /* @__PURE__ */ e(qr, {}),
|
|
1376
|
+
"aria-label": w("editor.extensions", "Editor extensions"),
|
|
1377
|
+
disabled: !0,
|
|
1378
|
+
onMouseDown: O
|
|
1379
|
+
}
|
|
1380
|
+
) : null
|
|
1381
|
+
]
|
|
1382
|
+
}
|
|
1383
|
+
);
|
|
1384
|
+
}
|
|
1385
|
+
function te(o) {
|
|
1386
|
+
return _t(o, "rich-text");
|
|
1387
|
+
}
|
|
1388
|
+
function Ie(o = "") {
|
|
1389
|
+
const a = String(o).trim();
|
|
1390
|
+
if (a === "" || a === "<p><br></p>" || a === "<p> </p>")
|
|
1391
|
+
return "";
|
|
1392
|
+
const c = a.replace(/<br\s*\/?>/gi, "").replace(/ /gi, "").replace(/<[^>]+>/g, "").trim();
|
|
1393
|
+
return c === "" && /<img\b[^>]*>/i.test(a) ? a : c === "" ? "" : a;
|
|
1394
|
+
}
|
|
1395
|
+
function ln(o) {
|
|
1396
|
+
return o.replace(
|
|
1397
|
+
/<img(?![^>]*\sloading=)([^>]*)>/gi,
|
|
1398
|
+
'<img loading="lazy"$1>'
|
|
1399
|
+
);
|
|
1400
|
+
}
|
|
1401
|
+
function sn(o) {
|
|
1402
|
+
if (!o || typeof o != "object") return;
|
|
1403
|
+
const a = o, c = (l) => {
|
|
1404
|
+
if (l && typeof l == "object" && "url" in l) {
|
|
1405
|
+
const s = l.url;
|
|
1406
|
+
return typeof s == "string" ? s : void 0;
|
|
1407
|
+
}
|
|
1408
|
+
};
|
|
1409
|
+
return typeof a.url == "string" ? a.url : c(a.file) ?? c(a.data) ?? Object.values(a).map(c).find(Boolean);
|
|
1410
|
+
}
|
|
1411
|
+
function dn(o) {
|
|
1412
|
+
if (o) return o;
|
|
1413
|
+
if (typeof window > "u") return null;
|
|
1414
|
+
const a = window;
|
|
1415
|
+
return a.$R ?? a.Redactor ?? null;
|
|
1416
|
+
}
|
|
1417
|
+
const cn = {
|
|
1418
|
+
bold: ["module.inline.format", { tag: "b" }],
|
|
1419
|
+
italic: ["module.inline.format", { tag: "i" }],
|
|
1420
|
+
strikethrough: ["module.inline.format", { tag: "del" }],
|
|
1421
|
+
bulletedList: ["module.list.toggle", "ul"],
|
|
1422
|
+
numberedList: ["module.list.toggle", "ol"],
|
|
1423
|
+
heading: ["module.block.format", { tag: "h2" }],
|
|
1424
|
+
quote: ["module.block.format", { tag: "blockquote" }],
|
|
1425
|
+
paragraph: ["module.block.format", { tag: "p" }]
|
|
1426
|
+
}, un = {
|
|
1427
|
+
zh: "zh_cn",
|
|
1428
|
+
pt: "pt_br"
|
|
1429
|
+
};
|
|
1430
|
+
function mn(o) {
|
|
1431
|
+
const a = o.split("-")[0];
|
|
1432
|
+
return un[a] ?? a ?? "en";
|
|
1433
|
+
}
|
|
1434
|
+
const hn = De(
|
|
1435
|
+
"redactor-theme-alfadocs ds:flex ds:flex-col ds:gap-[var(--spacing-sm)]"
|
|
1436
|
+
), fn = De(
|
|
1437
|
+
[
|
|
1438
|
+
"ds:block ds:[inline-size:100%]",
|
|
1439
|
+
"ds:rounded-[var(--radius-md)] ds:border ds:border-[color:var(--border)]",
|
|
1440
|
+
"ds:bg-[var(--background)] ds:text-[var(--foreground)]",
|
|
1441
|
+
"ds:shadow-[var(--shadow-md)]",
|
|
1442
|
+
"ds:font-[family-name:var(--font-sans)] ds:text-[length:var(--font-size-base)]",
|
|
1443
|
+
"ds:p-[var(--spacing-md)] ds:[min-block-size:var(--rich-text-editor-min-block-size)]",
|
|
1444
|
+
"ds:focus-visible:outline-[length:var(--focus-ring-width)]",
|
|
1445
|
+
"ds:focus-visible:outline-solid",
|
|
1446
|
+
"ds:focus-visible:outline-[var(--ring)]",
|
|
1447
|
+
"ds:focus-visible:outline-offset-[length:var(--focus-ring-offset)]",
|
|
1448
|
+
"ds:forced-colors:focus-visible:outline-[CanvasText]"
|
|
1449
|
+
].join(" ")
|
|
1450
|
+
), st = [
|
|
1451
|
+
"ds:inline-flex ds:items-center ds:justify-center",
|
|
1452
|
+
"ds:[min-block-size:var(--min-target-size)] ds:[min-inline-size:var(--min-target-size)]",
|
|
1453
|
+
"ds:text-[color:var(--primary-foreground)]",
|
|
1454
|
+
"ds:transition-colors",
|
|
1455
|
+
"ds:focus-visible:outline-[length:var(--focus-ring-width)]",
|
|
1456
|
+
"ds:focus-visible:outline-solid",
|
|
1457
|
+
"ds:focus-visible:outline-[var(--primary-foreground)]",
|
|
1458
|
+
"ds:focus-visible:[outline-offset:calc(var(--focus-ring-width)*-1)]"
|
|
1459
|
+
].join(" "), gn = `${st} ds:hover:bg-[color-mix(in_srgb,var(--primary-foreground)_15%,transparent)]`, pn = `${st} ds:bg-[var(--destructive)] ds:hover:bg-[color-mix(in_srgb,var(--destructive)_88%,var(--primary-foreground))]`, bn = Nt(
|
|
1460
|
+
({
|
|
1461
|
+
id: o,
|
|
1462
|
+
defaultValue: a,
|
|
1463
|
+
value: c,
|
|
1464
|
+
onChange: l,
|
|
1465
|
+
toolbar: s = "standard",
|
|
1466
|
+
placeholder: f,
|
|
1467
|
+
readOnly: g = !1,
|
|
1468
|
+
ariaLabel: i,
|
|
1469
|
+
minHeight: p,
|
|
1470
|
+
showExtensions: v,
|
|
1471
|
+
className: T,
|
|
1472
|
+
redactor: H,
|
|
1473
|
+
options: S,
|
|
1474
|
+
plugins: w,
|
|
1475
|
+
lang: O,
|
|
1476
|
+
imageUploadUrl: u,
|
|
1477
|
+
onKeyDown: h,
|
|
1478
|
+
onRequestAiDraft: k,
|
|
1479
|
+
aiDraftFormat: A = "html",
|
|
1480
|
+
aiPrivacyNotice: M,
|
|
1481
|
+
onDictate: E,
|
|
1482
|
+
onProofread: Y,
|
|
1483
|
+
onAutoFormat: $
|
|
1484
|
+
}, D) => {
|
|
1485
|
+
const { t: I, i18n: J } = Z(), ee = le(), de = Je(
|
|
1486
|
+
() => `rte-${ee.replace(/[^a-zA-Z0-9-_]/g, "")}`,
|
|
1487
|
+
[ee]
|
|
1488
|
+
), R = `#${de}`, W = L(null), G = L(null), ce = L(!1), ye = L(g), x = L(null), q = L(null), [F, X] = z(!1), [dt, je] = z(!1), [Pe, ct] = z(
|
|
1489
|
+
() => /* @__PURE__ */ new Set()
|
|
1490
|
+
), ue = L(null), V = L(l), ve = L(h);
|
|
1491
|
+
K(() => {
|
|
1492
|
+
V.current = l, ve.current = h;
|
|
1493
|
+
}, [l, h]);
|
|
1494
|
+
const ut = L(
|
|
1495
|
+
(() => {
|
|
1496
|
+
const t = c ?? a ?? "";
|
|
1497
|
+
return t ? te(t) : "";
|
|
1498
|
+
})()
|
|
1499
|
+
), oe = C(() => {
|
|
1500
|
+
var r;
|
|
1501
|
+
const t = G.current;
|
|
1502
|
+
if (t)
|
|
1503
|
+
try {
|
|
1504
|
+
const n = t(R, "source.getCode");
|
|
1505
|
+
if (typeof n == "string") return n;
|
|
1506
|
+
} catch {
|
|
1507
|
+
}
|
|
1508
|
+
return ((r = W.current) == null ? void 0 : r.value) ?? "";
|
|
1509
|
+
}, [R]), U = C(
|
|
1510
|
+
(t, ...r) => {
|
|
1511
|
+
const n = G.current;
|
|
1512
|
+
if (!n) return !1;
|
|
1513
|
+
const d = ye.current;
|
|
1514
|
+
if (d)
|
|
1515
|
+
try {
|
|
1516
|
+
n(R, "disableReadOnly");
|
|
1517
|
+
} catch {
|
|
1518
|
+
}
|
|
1519
|
+
try {
|
|
1520
|
+
return n(R, t, ...r), !0;
|
|
1521
|
+
} catch {
|
|
1522
|
+
return !1;
|
|
1523
|
+
} finally {
|
|
1524
|
+
if (d)
|
|
1525
|
+
try {
|
|
1526
|
+
n(R, "enableReadOnly");
|
|
1527
|
+
} catch {
|
|
1528
|
+
}
|
|
1529
|
+
}
|
|
1530
|
+
},
|
|
1531
|
+
[R]
|
|
1532
|
+
), ae = C(
|
|
1533
|
+
(t, r) => {
|
|
1534
|
+
var pe;
|
|
1535
|
+
const n = (r == null ? void 0 : r.asHtml) ?? !0, d = n ? te(t) : t;
|
|
1536
|
+
if (U(n ? "insertion.insertHtml" : "insertion.insertText", d)) return;
|
|
1537
|
+
const b = W.current;
|
|
1538
|
+
if (!b) return;
|
|
1539
|
+
const N = b.selectionStart ?? b.value.length, Q = b.selectionEnd ?? b.value.length;
|
|
1540
|
+
b.value = b.value.slice(0, N) + d + b.value.slice(Q);
|
|
1541
|
+
const Ne = N + d.length;
|
|
1542
|
+
try {
|
|
1543
|
+
b.setSelectionRange(Ne, Ne);
|
|
1544
|
+
} catch {
|
|
1545
|
+
}
|
|
1546
|
+
(pe = V.current) == null || pe.call(V, { html: te(b.value), markdown: "" });
|
|
1547
|
+
},
|
|
1548
|
+
[U]
|
|
1549
|
+
), Re = L(null), re = C(() => {
|
|
1550
|
+
var d;
|
|
1551
|
+
const t = (d = x.current) == null ? void 0 : d.querySelector(".redactor-in"), r = typeof window < "u" ? window.getSelection() : null, n = /* @__PURE__ */ new Set();
|
|
1552
|
+
if (t && r && r.anchorNode && t.contains(r.anchorNode) && typeof document.queryCommandState == "function") {
|
|
1553
|
+
r.rangeCount > 0 && (Re.current = r.getRangeAt(0).cloneRange());
|
|
1554
|
+
try {
|
|
1555
|
+
document.queryCommandState("bold") && n.add("bold"), document.queryCommandState("italic") && n.add("italic"), document.queryCommandState("underline") && n.add("underline"), document.queryCommandState("strikeThrough") && n.add("strike"), document.queryCommandState("insertUnorderedList") && n.add("ul"), document.queryCommandState("insertOrderedList") && n.add("ol");
|
|
1556
|
+
const m = String(
|
|
1557
|
+
document.queryCommandValue("formatBlock") || ""
|
|
1558
|
+
).toLowerCase();
|
|
1559
|
+
/^h[1-6]$/.test(m) ? (n.add("heading"), n.add(m)) : m === "blockquote" ? n.add("quote") : n.add("paragraph");
|
|
1560
|
+
const b = r.anchorNode.nodeType === Node.TEXT_NODE ? r.anchorNode.parentElement : r.anchorNode;
|
|
1561
|
+
b && t.contains(b) && b.closest("table") && n.add("table");
|
|
1562
|
+
} catch {
|
|
1563
|
+
}
|
|
1564
|
+
}
|
|
1565
|
+
ct(
|
|
1566
|
+
(m) => m.size === n.size && [...n].every((b) => m.has(b)) ? m : n
|
|
1567
|
+
);
|
|
1568
|
+
}, []), ke = C(
|
|
1569
|
+
(t, ...r) => {
|
|
1570
|
+
U(t, ...r), typeof window < "u" ? window.requestAnimationFrame(() => re()) : re();
|
|
1571
|
+
},
|
|
1572
|
+
[U, re]
|
|
1573
|
+
), Se = C(
|
|
1574
|
+
(t) => {
|
|
1575
|
+
ae(t, { asHtml: !0 }), typeof window < "u" && window.requestAnimationFrame(() => re());
|
|
1576
|
+
},
|
|
1577
|
+
[ae, re]
|
|
1578
|
+
), Be = C(() => {
|
|
1579
|
+
var r;
|
|
1580
|
+
if (typeof window < "u") {
|
|
1581
|
+
const n = (r = x.current) == null ? void 0 : r.querySelector(".redactor-in"), d = window.getSelection();
|
|
1582
|
+
n && d && d.rangeCount > 0 && d.anchorNode && n.contains(d.anchorNode) && (Re.current = d.getRangeAt(0).cloneRange());
|
|
1583
|
+
}
|
|
1584
|
+
const t = G.current;
|
|
1585
|
+
if (t)
|
|
1586
|
+
try {
|
|
1587
|
+
t(R, "selection.save");
|
|
1588
|
+
} catch {
|
|
1589
|
+
}
|
|
1590
|
+
}, [R]), Fe = C(() => {
|
|
1591
|
+
const t = G.current;
|
|
1592
|
+
if (!t) return;
|
|
1593
|
+
const r = Re.current;
|
|
1594
|
+
try {
|
|
1595
|
+
t(R, "editor.focus");
|
|
1596
|
+
} catch {
|
|
1597
|
+
}
|
|
1598
|
+
if (r && typeof window < "u") {
|
|
1599
|
+
const n = window.getSelection();
|
|
1600
|
+
if (n)
|
|
1601
|
+
try {
|
|
1602
|
+
n.removeAllRanges(), n.addRange(r);
|
|
1603
|
+
return;
|
|
1604
|
+
} catch {
|
|
1605
|
+
}
|
|
1606
|
+
}
|
|
1607
|
+
try {
|
|
1608
|
+
t(R, "selection.restore");
|
|
1609
|
+
} catch {
|
|
1610
|
+
}
|
|
1611
|
+
}, [R]), mt = C(() => {
|
|
1612
|
+
var n;
|
|
1613
|
+
if (typeof window > "u") return "";
|
|
1614
|
+
const t = (n = x.current) == null ? void 0 : n.querySelector(".redactor-in"), r = window.getSelection();
|
|
1615
|
+
return !t || !r || !r.anchorNode || !t.contains(r.anchorNode) ? "" : r.toString();
|
|
1616
|
+
}, []), ht = C(() => {
|
|
1617
|
+
var m;
|
|
1618
|
+
if (typeof window > "u") return null;
|
|
1619
|
+
const t = (m = x.current) == null ? void 0 : m.querySelector(".redactor-in"), r = window.getSelection();
|
|
1620
|
+
if (!t || !r || r.rangeCount === 0) return null;
|
|
1621
|
+
const n = r.anchorNode, d = n && n.nodeType === Node.TEXT_NODE ? n.parentElement : n;
|
|
1622
|
+
return !d || !t.contains(d) ? null : d.closest("table");
|
|
1623
|
+
}, []), Ve = L(null), we = C(() => {
|
|
1624
|
+
var m;
|
|
1625
|
+
if (typeof window > "u") return null;
|
|
1626
|
+
const t = (m = x.current) == null ? void 0 : m.querySelector(".redactor-in"), r = window.getSelection();
|
|
1627
|
+
if (!t || !r || r.rangeCount === 0) return null;
|
|
1628
|
+
const n = r.anchorNode, d = n && n.nodeType === Node.TEXT_NODE ? n.parentElement : n;
|
|
1629
|
+
return !d || !t.contains(d) ? null : d.closest("td,th");
|
|
1630
|
+
}, []), ft = C(() => {
|
|
1631
|
+
Ve.current = we();
|
|
1632
|
+
}, [we]), gt = C(
|
|
1633
|
+
(t, r) => {
|
|
1634
|
+
var b;
|
|
1635
|
+
const n = Ve.current ?? we();
|
|
1636
|
+
if (!n) return;
|
|
1637
|
+
const d = t === "row" ? Array.from(((b = n.closest("tr")) == null ? void 0 : b.children) ?? [n]).filter(
|
|
1638
|
+
(N) => N instanceof HTMLElement && (N.tagName === "TD" || N.tagName === "TH")
|
|
1639
|
+
) : [n], m = G.current;
|
|
1640
|
+
if (m)
|
|
1641
|
+
try {
|
|
1642
|
+
m(R, "module.buffer.trigger");
|
|
1643
|
+
} catch {
|
|
1644
|
+
}
|
|
1645
|
+
for (const N of d)
|
|
1646
|
+
r ? N.style.setProperty("background-color", r) : N.style.removeProperty("background-color");
|
|
1647
|
+
if (m)
|
|
1648
|
+
try {
|
|
1649
|
+
m(R, "broadcast", "hardsync");
|
|
1650
|
+
} catch {
|
|
1651
|
+
}
|
|
1652
|
+
typeof window < "u" && window.requestAnimationFrame(() => re());
|
|
1653
|
+
},
|
|
1654
|
+
[we, R, re]
|
|
1655
|
+
), pt = C(
|
|
1656
|
+
(t) => {
|
|
1657
|
+
var n;
|
|
1658
|
+
const r = G.current;
|
|
1659
|
+
if (r && typeof window < "u") {
|
|
1660
|
+
const d = (n = x.current) == null ? void 0 : n.querySelector(".redactor-in"), m = window.getSelection(), b = m == null ? void 0 : m.anchorNode, N = b && b.nodeType === Node.TEXT_NODE ? b.parentElement : b, Q = N && (d != null && d.contains(N)) ? N.closest("ul,ol") : null;
|
|
1661
|
+
if (Q)
|
|
1662
|
+
try {
|
|
1663
|
+
r(R, "caret.setAfter", Q);
|
|
1664
|
+
} catch {
|
|
1665
|
+
}
|
|
1666
|
+
}
|
|
1667
|
+
Se(t), typeof window < "u" && window.requestAnimationFrame(() => {
|
|
1668
|
+
var m;
|
|
1669
|
+
const d = (m = x.current) == null ? void 0 : m.querySelector(".redactor-in");
|
|
1670
|
+
d == null || d.querySelectorAll("table td, table th").forEach((b) => {
|
|
1671
|
+
let N = b.lastChild;
|
|
1672
|
+
for (; N && N.nodeType === Node.TEXT_NODE && !(N.textContent ?? "").trim(); ) {
|
|
1673
|
+
const Q = N.previousSibling;
|
|
1674
|
+
b.removeChild(N), N = Q;
|
|
1675
|
+
}
|
|
1676
|
+
});
|
|
1677
|
+
});
|
|
1678
|
+
},
|
|
1679
|
+
[Se, R]
|
|
1680
|
+
), bt = C(
|
|
1681
|
+
async (t, r) => {
|
|
1682
|
+
if (!u) throw new Error("No image upload URL configured.");
|
|
1683
|
+
const n = new FormData();
|
|
1684
|
+
n.append("file", t);
|
|
1685
|
+
const d = await fetch(u, {
|
|
1686
|
+
method: "POST",
|
|
1687
|
+
body: n,
|
|
1688
|
+
credentials: "same-origin",
|
|
1689
|
+
signal: r
|
|
1690
|
+
});
|
|
1691
|
+
if (!d.ok) throw new Error(`Image upload failed (${d.status}).`);
|
|
1692
|
+
const m = sn(await d.json());
|
|
1693
|
+
if (!m) throw new Error("Image upload response contained no URL.");
|
|
1694
|
+
return m;
|
|
1695
|
+
},
|
|
1696
|
+
[u]
|
|
1697
|
+
), me = L(null), xe = L(null), [he, Ge] = z(!1), [yt, We] = z(!1), [vt, Ae] = z(""), Ce = C(() => {
|
|
1698
|
+
const t = xe.current;
|
|
1699
|
+
t != null && t.parentNode && t.parentNode.removeChild(t), xe.current = null;
|
|
1700
|
+
}, []), Xe = C((t) => {
|
|
1701
|
+
var d;
|
|
1702
|
+
const r = (d = x.current) == null ? void 0 : d.querySelector(
|
|
1703
|
+
".redactor-in"
|
|
1704
|
+
);
|
|
1705
|
+
if (!r) return;
|
|
1706
|
+
let n = xe.current;
|
|
1707
|
+
if (!n || !r.contains(n)) {
|
|
1708
|
+
n = document.createElement("span"), n.setAttribute("data-rte-interim", ""), n.setAttribute("contenteditable", "false");
|
|
1709
|
+
const m = window.getSelection();
|
|
1710
|
+
if (m && m.rangeCount > 0 && r.contains(m.anchorNode)) {
|
|
1711
|
+
const b = m.getRangeAt(0);
|
|
1712
|
+
b.collapse(!1), b.insertNode(n);
|
|
1713
|
+
} else
|
|
1714
|
+
r.appendChild(n);
|
|
1715
|
+
xe.current = n;
|
|
1716
|
+
}
|
|
1717
|
+
n.textContent = t;
|
|
1718
|
+
}, []), Ue = C(() => {
|
|
1719
|
+
var t;
|
|
1720
|
+
(t = me.current) == null || t.abort();
|
|
1721
|
+
}, []), Qe = C(() => {
|
|
1722
|
+
if (!E) return;
|
|
1723
|
+
const t = new AbortController();
|
|
1724
|
+
me.current = t, We(!1), Ge(!0), Ae(I("editor.ai.listening")), Ce(), E({
|
|
1725
|
+
signal: t.signal,
|
|
1726
|
+
// Interim text shows live in the editor (grey + caret); each final
|
|
1727
|
+
// replaces it with committed text at the caret.
|
|
1728
|
+
onPartialTranscript: (r) => {
|
|
1729
|
+
t.signal.aborted || Xe(r);
|
|
1730
|
+
},
|
|
1731
|
+
onFinalTranscript: (r) => {
|
|
1732
|
+
if (t.signal.aborted) return;
|
|
1733
|
+
Ce();
|
|
1734
|
+
const n = r.trim();
|
|
1735
|
+
n && (ae(`${n} `, { asHtml: !1 }), Ae(n));
|
|
1736
|
+
}
|
|
1737
|
+
}).catch((r) => {
|
|
1738
|
+
t.signal.aborted || r && typeof r == "object" && "name" in r && r.name === "AbortError" || We(!0);
|
|
1739
|
+
}).finally(() => {
|
|
1740
|
+
Ce(), me.current === t && (me.current = null, Ge(!1), Ae(""));
|
|
1741
|
+
});
|
|
1742
|
+
}, [E, ae, Ce, Xe, I]), kt = C(() => {
|
|
1743
|
+
he ? Ue() : Qe();
|
|
1744
|
+
}, [he, Qe, Ue]);
|
|
1745
|
+
K(() => () => {
|
|
1746
|
+
var t;
|
|
1747
|
+
return (t = me.current) == null ? void 0 : t.abort();
|
|
1748
|
+
}, []);
|
|
1749
|
+
const [fe, Ze] = z(null), ge = L(null), Ye = C(
|
|
1750
|
+
(t, r) => {
|
|
1751
|
+
if (ge.current) return;
|
|
1752
|
+
const n = new AbortController();
|
|
1753
|
+
ge.current = n, Ze(t);
|
|
1754
|
+
const d = oe();
|
|
1755
|
+
Promise.resolve(r({ html: d, signal: n.signal })).then((m) => {
|
|
1756
|
+
var N;
|
|
1757
|
+
if (n.signal.aborted) return;
|
|
1758
|
+
const b = te(String(m ?? ""));
|
|
1759
|
+
U("source.setCode", b), (N = V.current) == null || N.call(V, { html: b, markdown: "" });
|
|
1760
|
+
}).catch(() => {
|
|
1761
|
+
}).finally(() => {
|
|
1762
|
+
ge.current === n && (ge.current = null, Ze(null));
|
|
1763
|
+
});
|
|
1764
|
+
},
|
|
1765
|
+
[oe, U]
|
|
1766
|
+
);
|
|
1767
|
+
K(() => () => {
|
|
1768
|
+
var t;
|
|
1769
|
+
return (t = ge.current) == null ? void 0 : t.abort();
|
|
1770
|
+
}, []), K(() => {
|
|
1771
|
+
const t = W.current;
|
|
1772
|
+
if (!t) return;
|
|
1773
|
+
t.value = ut.current;
|
|
1774
|
+
const r = dn(H);
|
|
1775
|
+
if (!r) {
|
|
1776
|
+
X(!0);
|
|
1777
|
+
return;
|
|
1778
|
+
}
|
|
1779
|
+
G.current = r;
|
|
1780
|
+
const n = {
|
|
1781
|
+
lang: O ?? mn(J.language || "en"),
|
|
1782
|
+
// The kit renders its OWN toolbar (EditorToolbar) and drives Redactor
|
|
1783
|
+
// via the command API, so Redactor's native toolbar is suppressed.
|
|
1784
|
+
toolbar: !1,
|
|
1785
|
+
plugins: w ?? [],
|
|
1786
|
+
placeholder: f ?? I("editor.placeholder"),
|
|
1787
|
+
toolbarFixed: !1,
|
|
1788
|
+
// Platform parity (RedactorWysiwyg.js:84): no inline shortcode expansion.
|
|
1789
|
+
shortcodes: !1,
|
|
1790
|
+
imageEditable: !1,
|
|
1791
|
+
imageResizable: !0
|
|
1792
|
+
}, d = u ? { imageUpload: u } : {}, m = (S == null ? void 0 : S.callbacks) ?? {}, b = {
|
|
1793
|
+
...n,
|
|
1794
|
+
...d,
|
|
1795
|
+
...S ?? {},
|
|
1796
|
+
// Re-pin safety-critical keys LAST so consumer `options` can't override
|
|
1797
|
+
// the sanitising change handler, re-enable image editing, or turn off
|
|
1798
|
+
// drag-resize (platform re-pins both image flags — RedactorWysiwyg.js:115-116).
|
|
1799
|
+
imageEditable: !1,
|
|
1800
|
+
imageResizable: !0,
|
|
1801
|
+
callbacks: {
|
|
1802
|
+
...m,
|
|
1803
|
+
changed(N) {
|
|
1804
|
+
const Q = Ie(ln(N)), Ne = te(Q);
|
|
1805
|
+
ce.current = !0, V.current && (ue.current && clearTimeout(ue.current), ue.current = setTimeout(() => {
|
|
1806
|
+
var pe;
|
|
1807
|
+
(pe = V.current) == null || pe.call(V, { html: Ne, markdown: "" });
|
|
1808
|
+
}, 100));
|
|
1809
|
+
},
|
|
1810
|
+
keydown(N) {
|
|
1811
|
+
var Q;
|
|
1812
|
+
(Q = ve.current) == null || Q.call(ve, N);
|
|
1813
|
+
},
|
|
1814
|
+
observe() {
|
|
1815
|
+
re();
|
|
1816
|
+
}
|
|
1817
|
+
}
|
|
1818
|
+
};
|
|
1819
|
+
try {
|
|
1820
|
+
if (r(R, b), g)
|
|
1821
|
+
try {
|
|
1822
|
+
r(R, "enableReadOnly");
|
|
1823
|
+
} catch {
|
|
1824
|
+
}
|
|
1825
|
+
} catch {
|
|
1826
|
+
X(!0);
|
|
1827
|
+
}
|
|
1828
|
+
return () => {
|
|
1829
|
+
ue.current && clearTimeout(ue.current);
|
|
1830
|
+
try {
|
|
1831
|
+
r(R, "destroy");
|
|
1832
|
+
} catch {
|
|
1833
|
+
}
|
|
1834
|
+
G.current = null;
|
|
1835
|
+
};
|
|
1836
|
+
}, []), K(() => {
|
|
1837
|
+
if (!G.current || c === void 0) return;
|
|
1838
|
+
if (ce.current) {
|
|
1839
|
+
ce.current = !1;
|
|
1840
|
+
return;
|
|
1841
|
+
}
|
|
1842
|
+
const t = te(Ie(c));
|
|
1843
|
+
Ie(oe()) !== t && U("source.setCode", t);
|
|
1844
|
+
}, [c, oe, U]), K(() => {
|
|
1845
|
+
ye.current = g;
|
|
1846
|
+
const t = G.current;
|
|
1847
|
+
if (t)
|
|
1848
|
+
try {
|
|
1849
|
+
t(R, g ? "enableReadOnly" : "disableReadOnly");
|
|
1850
|
+
} catch {
|
|
1851
|
+
}
|
|
1852
|
+
}, [g, R]), K(() => {
|
|
1853
|
+
if (!F || c === void 0) return;
|
|
1854
|
+
const t = W.current;
|
|
1855
|
+
if (!t) return;
|
|
1856
|
+
const r = te(c);
|
|
1857
|
+
t.value !== r && document.activeElement !== t && (t.value = r);
|
|
1858
|
+
}, [F, c]);
|
|
1859
|
+
const Ee = Je(
|
|
1860
|
+
() => ({
|
|
1861
|
+
getHTML() {
|
|
1862
|
+
return oe();
|
|
1863
|
+
},
|
|
1864
|
+
getText() {
|
|
1865
|
+
return oe().replace(/<[^>]*>/g, " ").replace(/ /gi, " ").replace(/\s+/g, " ").trim();
|
|
1866
|
+
},
|
|
1867
|
+
getMarkdown() {
|
|
1868
|
+
return "";
|
|
1869
|
+
},
|
|
1870
|
+
setContent(t) {
|
|
1871
|
+
const r = te(t);
|
|
1872
|
+
U("source.setCode", r) || W.current && (W.current.value = r);
|
|
1873
|
+
},
|
|
1874
|
+
insertAtCursor: ae,
|
|
1875
|
+
applyFormat(t) {
|
|
1876
|
+
const r = cn[t];
|
|
1877
|
+
r && ke(...r);
|
|
1878
|
+
},
|
|
1879
|
+
focus() {
|
|
1880
|
+
var r;
|
|
1881
|
+
const t = G.current;
|
|
1882
|
+
if (t)
|
|
1883
|
+
try {
|
|
1884
|
+
t(R, "editor.focus");
|
|
1885
|
+
return;
|
|
1886
|
+
} catch {
|
|
1887
|
+
}
|
|
1888
|
+
(r = W.current) == null || r.focus();
|
|
1889
|
+
},
|
|
1890
|
+
clear() {
|
|
1891
|
+
U("source.setCode", "") || W.current && (W.current.value = "");
|
|
1892
|
+
}
|
|
1893
|
+
}),
|
|
1894
|
+
[R, oe, U, ae, ke]
|
|
1895
|
+
);
|
|
1896
|
+
zt(D, () => Ee, [Ee]), Mt(jr, Ee, o);
|
|
1897
|
+
const wt = C(
|
|
1898
|
+
(t) => {
|
|
1899
|
+
var r;
|
|
1900
|
+
(r = V.current) == null || r.call(V, {
|
|
1901
|
+
html: te(t.target.value),
|
|
1902
|
+
markdown: ""
|
|
1903
|
+
});
|
|
1904
|
+
},
|
|
1905
|
+
[]
|
|
1906
|
+
), xt = i ?? I("editor.regionLabel"), Ct = f ?? I("editor.placeholder"), He = fe !== null, se = [];
|
|
1907
|
+
return E && se.push({
|
|
1908
|
+
key: "dictate",
|
|
1909
|
+
icon: he ? /* @__PURE__ */ e(ot, { "aria-hidden": "true", className: "ds:size-5 ds:fill-current" }) : /* @__PURE__ */ e(at, { "aria-hidden": "true", className: "ds:size-5" }),
|
|
1910
|
+
label: I(he ? "editor.ai.dictateStop" : "editor.ai.dictateStart"),
|
|
1911
|
+
onClick: kt,
|
|
1912
|
+
recording: he
|
|
1913
|
+
}), Y && se.push({
|
|
1914
|
+
key: "proofread",
|
|
1915
|
+
icon: fe === "proofread" ? /* @__PURE__ */ e(Le, { size: "sm", variant: "pulse" }) : /* @__PURE__ */ e(Rr, { "aria-hidden": "true", className: "ds:size-5" }),
|
|
1916
|
+
label: I("editor.ai.proofread", "Check spelling & grammar"),
|
|
1917
|
+
onClick: () => Ye("proofread", Y),
|
|
1918
|
+
running: fe === "proofread"
|
|
1919
|
+
}), $ && se.push({
|
|
1920
|
+
key: "format",
|
|
1921
|
+
icon: fe === "format" ? /* @__PURE__ */ e(Le, { size: "sm", variant: "pulse" }) : /* @__PURE__ */ e(Or, { "aria-hidden": "true", className: "ds:size-5" }),
|
|
1922
|
+
label: I("editor.ai.autoFormat", "Auto-format document"),
|
|
1923
|
+
onClick: () => Ye("format", $),
|
|
1924
|
+
running: fe === "format"
|
|
1925
|
+
}), k && se.push({
|
|
1926
|
+
key: "write",
|
|
1927
|
+
icon: /* @__PURE__ */ e(Pt, { "aria-hidden": "true", className: "ds:size-5" }),
|
|
1928
|
+
label: I("editor.ai.helpMeWrite"),
|
|
1929
|
+
onClick: () => {
|
|
1930
|
+
Be(), je(!0);
|
|
1931
|
+
}
|
|
1932
|
+
}), /* @__PURE__ */ y(
|
|
1933
|
+
"div",
|
|
1934
|
+
{
|
|
1935
|
+
ref: x,
|
|
1936
|
+
className: [hn(), T].filter(Boolean).join(" "),
|
|
1937
|
+
"data-component": "rich-text-editor",
|
|
1938
|
+
"data-component-id": o,
|
|
1939
|
+
"data-min-height": p,
|
|
1940
|
+
children: [
|
|
1941
|
+
!F && !g ? /* @__PURE__ */ e(
|
|
1942
|
+
an,
|
|
1943
|
+
{
|
|
1944
|
+
run: ke,
|
|
1945
|
+
active: Pe,
|
|
1946
|
+
preset: s,
|
|
1947
|
+
insertHtml: Se,
|
|
1948
|
+
insertTable: pt,
|
|
1949
|
+
saveSelection: Be,
|
|
1950
|
+
restoreSelection: Fe,
|
|
1951
|
+
getSelectedText: mt,
|
|
1952
|
+
uploadImage: u ? bt : void 0,
|
|
1953
|
+
enableColor: (w == null ? void 0 : w.includes("fontcolor")) ?? !1,
|
|
1954
|
+
enableImage: !!u,
|
|
1955
|
+
enableTable: (w == null ? void 0 : w.includes("table")) ?? !1,
|
|
1956
|
+
showExtensions: v
|
|
1957
|
+
}
|
|
1958
|
+
) : null,
|
|
1959
|
+
/* @__PURE__ */ y("div", { className: "ds:relative", ref: q, children: [
|
|
1960
|
+
/* @__PURE__ */ e(
|
|
1961
|
+
"textarea",
|
|
1962
|
+
{
|
|
1963
|
+
ref: W,
|
|
1964
|
+
id: de,
|
|
1965
|
+
"aria-label": xt,
|
|
1966
|
+
"aria-multiline": "true",
|
|
1967
|
+
"aria-busy": He || void 0,
|
|
1968
|
+
placeholder: Ct,
|
|
1969
|
+
onChange: F ? wt : void 0,
|
|
1970
|
+
readOnly: F ? g : void 0,
|
|
1971
|
+
className: F ? fn() : void 0
|
|
1972
|
+
}
|
|
1973
|
+
),
|
|
1974
|
+
He ? /* @__PURE__ */ e(
|
|
1975
|
+
"div",
|
|
1976
|
+
{
|
|
1977
|
+
"aria-hidden": "true",
|
|
1978
|
+
className: "ds:absolute ds:inset-0 ds:z-[5] ds:cursor-wait ds:rounded-[var(--radius-md)] ds:bg-[color-mix(in_srgb,var(--background)_40%,transparent)]"
|
|
1979
|
+
}
|
|
1980
|
+
) : null,
|
|
1981
|
+
/* @__PURE__ */ y("div", { className: "ds:sticky ds:bottom-0 ds:z-10", children: [
|
|
1982
|
+
se.length > 0 ? /* @__PURE__ */ e("div", { className: "ds:absolute ds:[inset-block-end:var(--spacing-md)] ds:[inset-inline-end:var(--spacing-md)] ds:z-10 ds:flex ds:items-center ds:overflow-hidden ds:rounded-full ds:bg-[var(--primary)] ds:bg-[image:var(--gradient-brand)] ds:shadow-[0_8px_24px_color-mix(in_srgb,var(--primary)_35%,transparent)]", children: se.map((t, r) => /* @__PURE__ */ y(nt, { children: [
|
|
1983
|
+
r > 0 ? /* @__PURE__ */ e(
|
|
1984
|
+
"span",
|
|
1985
|
+
{
|
|
1986
|
+
"aria-hidden": "true",
|
|
1987
|
+
className: "ds:self-stretch ds:[inline-size:var(--border-width-sm)] ds:bg-[color-mix(in_srgb,var(--primary-foreground)_35%,transparent)]"
|
|
1988
|
+
}
|
|
1989
|
+
) : null,
|
|
1990
|
+
/* @__PURE__ */ e(
|
|
1991
|
+
"button",
|
|
1992
|
+
{
|
|
1993
|
+
type: "button",
|
|
1994
|
+
onClick: t.onClick,
|
|
1995
|
+
"aria-pressed": t.recording || void 0,
|
|
1996
|
+
"aria-busy": t.running || void 0,
|
|
1997
|
+
disabled: He && !t.running || void 0,
|
|
1998
|
+
"aria-label": t.label,
|
|
1999
|
+
title: t.label,
|
|
2000
|
+
className: t.recording ? pn : gn,
|
|
2001
|
+
children: t.icon
|
|
2002
|
+
}
|
|
2003
|
+
)
|
|
2004
|
+
] }, t.key)) }) : null,
|
|
2005
|
+
k ? /* @__PURE__ */ e(
|
|
2006
|
+
Vr,
|
|
2007
|
+
{
|
|
2008
|
+
open: dt,
|
|
2009
|
+
onClose: () => je(!1),
|
|
2010
|
+
onRequestAiDraft: k,
|
|
2011
|
+
onInsert: (t) => {
|
|
2012
|
+
Fe(), ae(t, { asHtml: A !== "text" });
|
|
2013
|
+
},
|
|
2014
|
+
previewAsHtml: A !== "text",
|
|
2015
|
+
privacyNotice: M,
|
|
2016
|
+
onDictate: E
|
|
2017
|
+
}
|
|
2018
|
+
) : null
|
|
2019
|
+
] }),
|
|
2020
|
+
!F && !g && ((w == null ? void 0 : w.includes("table")) ?? !1) ? /* @__PURE__ */ e(
|
|
2021
|
+
on,
|
|
2022
|
+
{
|
|
2023
|
+
active: Pe,
|
|
2024
|
+
run: ke,
|
|
2025
|
+
areaRef: q,
|
|
2026
|
+
getActiveTableEl: ht,
|
|
2027
|
+
enableColor: (w == null ? void 0 : w.includes("fontcolor")) ?? !1,
|
|
2028
|
+
saveTableCell: ft,
|
|
2029
|
+
applyTableBackground: gt
|
|
2030
|
+
}
|
|
2031
|
+
) : null
|
|
2032
|
+
] }),
|
|
2033
|
+
E ? /* @__PURE__ */ e("p", { className: "ds:sr-only", role: "status", "aria-live": "polite", children: vt }) : null,
|
|
2034
|
+
E && yt ? /* @__PURE__ */ e(
|
|
2035
|
+
"p",
|
|
2036
|
+
{
|
|
2037
|
+
role: "alert",
|
|
2038
|
+
className: "ds:text-[length:var(--font-size-sm)] ds:text-[color:var(--destructive)]",
|
|
2039
|
+
children: I("editor.ai.dictationError")
|
|
2040
|
+
}
|
|
2041
|
+
) : null
|
|
2042
|
+
]
|
|
2043
|
+
}
|
|
2044
|
+
);
|
|
2045
|
+
}
|
|
2046
|
+
);
|
|
2047
|
+
bn.displayName = "RichTextEditor";
|
|
2048
|
+
export {
|
|
2049
|
+
bn as R,
|
|
2050
|
+
jr as r,
|
|
2051
|
+
hn as w
|
|
2052
|
+
};
|
|
2053
|
+
//# sourceMappingURL=rich-text-editor-VawKN1FI.js.map
|