@nice2dev/ui 1.4.0 → 1.4.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +51 -0
- package/dist/NiceCodeEditor-DhdjnDLV.cjs +289 -0
- package/dist/{NiceDataGrid-BT6iCUgP.cjs → NiceDataGrid-CrKDzMM1.cjs} +1 -1
- package/dist/{NiceForm-Bysp66Ef.cjs → NiceForm-CT9hEXpc.cjs} +1 -1
- package/dist/NiceLoginForm-C2-WgRn0.cjs +1 -0
- package/dist/NiceMention-BZEHqPrf.cjs +432 -0
- package/dist/NiceModuleLifecyclePanel-DKlqKPy2.cjs +1 -0
- package/dist/{NiceSavedQueryPanel-BbznsXFd.cjs → NiceSavedQueryPanel-C5Ab_NWx.cjs} +1 -1
- package/dist/NiceScheduler-BZQAKEVF.cjs +5 -0
- package/dist/{NiceWindow-pgR4c-kQ.cjs → NiceWindow-BklnkBpu.cjs} +1 -1
- package/dist/charts/NiceLinearGauge.mjs +96 -83
- package/dist/charts/NicePolarChart.mjs +47 -47
- package/dist/charts-BzlvCCg9.cjs +768 -0
- package/dist/charts.cjs +1 -1
- package/dist/{core-lazy-CL4ZIxF-.cjs → core-lazy-VTd5zfoZ.cjs} +1 -1
- package/dist/data.cjs +1 -1
- package/dist/display/NiceAvatar.mjs +40 -24
- package/dist/editors/pickers/NiceDateRangeBox.mjs +92 -92
- package/dist/editors/pickers/NiceDateTimePicker.mjs +173 -173
- package/dist/editors/rich/NiceCodeEditor.mjs +645 -584
- package/dist/editors/rich/NiceDocumentEditor.mjs +277 -254
- package/dist/editors.cjs +1 -1
- package/dist/feedback/NiceDrawer.mjs +15 -15
- package/dist/feedback.cjs +1 -1
- package/dist/index.cjs +202 -202
- package/dist/index.d.ts +18 -0
- package/dist/lazy.cjs +1 -1
- package/dist/navigation/NiceNavShell.mjs +646 -593
- package/dist/navigation/NiceSidebarNav.mjs +844 -823
- package/dist/navigation.cjs +1 -1
- package/dist/overlays/NiceWindow.mjs +91 -91
- package/dist/overlays.cjs +1 -1
- package/dist/planning/NiceScheduler.mjs +170 -169
- package/dist/planning/NiceSchedulerViews.mjs +242 -233
- package/dist/style.css +2 -2
- package/dist/utility/intlNames.mjs +26 -16
- package/package.json +4 -4
- package/dist/NiceCodeEditor-D0QZW88r.cjs +0 -268
- package/dist/NiceLoginForm-FGf32sro.cjs +0 -1
- package/dist/NiceMention-sc8W-DwH.cjs +0 -430
- package/dist/NiceModuleLifecyclePanel-DBQPCa_V.cjs +0 -1
- package/dist/NiceScheduler-3Ez0zSQJ.cjs +0 -5
- package/dist/charts-B0tHOpJ7.cjs +0 -768
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { jsxs as u, jsx as i } from "react/jsx-runtime";
|
|
2
|
-
import { useControlId as
|
|
3
|
-
import { forwardRef as
|
|
2
|
+
import { useControlId as tt, useNiceTranslation as ot, createTabEscape as it, useRovingFocus as nt, NiceTutorialButton as rt, resolveTutorial as lt, NiceIcon as p, clickOnActivationKey as B } from "@nice2dev/ui-core";
|
|
3
|
+
import { forwardRef as at, useState as y, useRef as R, useLayoutEffect as dt, useCallback as m, useMemo as ve, useEffect as ye } from "react";
|
|
4
4
|
import { NiceButton as h } from "../../buttons/NiceButton.mjs";
|
|
5
|
-
import { NiceSelect as
|
|
6
|
-
import { NiceTextInput as
|
|
7
|
-
import { NiceColorPicker as
|
|
8
|
-
const
|
|
5
|
+
import { NiceSelect as be } from "../inputs/NiceSelect.mjs";
|
|
6
|
+
import { NiceTextInput as ae } from "../inputs/NiceTextInput.mjs";
|
|
7
|
+
import { NiceColorPicker as Te } from "../pickers/NiceColorPicker.mjs";
|
|
8
|
+
const ct = [
|
|
9
9
|
{
|
|
10
10
|
target: ".nice-doc-editor",
|
|
11
11
|
titleKey: "tutorial.documentEditor.intro.title",
|
|
@@ -15,18 +15,18 @@ const rt = [
|
|
|
15
15
|
placement: "auto"
|
|
16
16
|
}
|
|
17
17
|
];
|
|
18
|
-
let
|
|
19
|
-
function
|
|
20
|
-
return `blk-${++
|
|
18
|
+
let st = 0;
|
|
19
|
+
function xe() {
|
|
20
|
+
return `blk-${++st}-${Date.now().toString(36)}`;
|
|
21
21
|
}
|
|
22
|
-
function
|
|
23
|
-
return { id:
|
|
22
|
+
function Be(l = "") {
|
|
23
|
+
return { id: xe(), type: "paragraph", content: l };
|
|
24
24
|
}
|
|
25
|
-
function
|
|
26
|
-
const d = { id:
|
|
25
|
+
function ut(l, f = "") {
|
|
26
|
+
const d = { id: xe(), type: l, content: f };
|
|
27
27
|
return l === "heading" && (d.level = 2), l === "list" && (d.listType = "unordered"), l === "toggle" && (d.open = !0), d;
|
|
28
28
|
}
|
|
29
|
-
const
|
|
29
|
+
const pt = [
|
|
30
30
|
{ type: "paragraph", label: "Text", icon: "align-left", keywords: "paragraph text" },
|
|
31
31
|
{ type: "heading", label: "Heading", icon: "type", keywords: "heading title" },
|
|
32
32
|
{ type: "list", label: "Bulleted list", icon: "list", keywords: "bullet unordered list" },
|
|
@@ -42,7 +42,12 @@ const dt = [
|
|
|
42
42
|
{ type: "divider", label: "Divider", icon: "minus", keywords: "divider line separator" },
|
|
43
43
|
{ type: "pageBreak", label: "Page Break", icon: "page-break", keywords: "page break" }
|
|
44
44
|
];
|
|
45
|
-
function
|
|
45
|
+
function j(l) {
|
|
46
|
+
return l.type === "toggle" ? l.content.split(`
|
|
47
|
+
`).slice(1).join(`
|
|
48
|
+
`) : l.content;
|
|
49
|
+
}
|
|
50
|
+
function ht(l) {
|
|
46
51
|
const f = [
|
|
47
52
|
l.align ? `text-align:${l.align}` : "",
|
|
48
53
|
l.color ? `color:${l.color}` : "",
|
|
@@ -59,7 +64,7 @@ function ct(l) {
|
|
|
59
64
|
return z("p", l.content || " ");
|
|
60
65
|
case "list": {
|
|
61
66
|
const C = l.listType === "ordered" ? "ol" : "ul", I = l.content.split(`
|
|
62
|
-
`).map((v,
|
|
67
|
+
`).map((v, M) => l.listType === "checklist" ? `<li><input type="checkbox" ${l.checked?.[M] ?? !1 ? "checked" : ""} disabled />${v}</li>` : `<li>${v}</li>`).join("");
|
|
63
68
|
return `<${C}${d}>${I}</${C}>`;
|
|
64
69
|
}
|
|
65
70
|
case "image":
|
|
@@ -88,7 +93,7 @@ function ct(l) {
|
|
|
88
93
|
return z("p", l.content);
|
|
89
94
|
}
|
|
90
95
|
}
|
|
91
|
-
function
|
|
96
|
+
function gt(l) {
|
|
92
97
|
let f = 0, d = 0;
|
|
93
98
|
for (const z of l) {
|
|
94
99
|
const C = z.content ?? "";
|
|
@@ -98,8 +103,8 @@ function st(l) {
|
|
|
98
103
|
}
|
|
99
104
|
return { words: d, chars: f, readingTime: Math.max(1, Math.ceil(d / 200)) };
|
|
100
105
|
}
|
|
101
|
-
const
|
|
102
|
-
/* @__PURE__ */
|
|
106
|
+
const kt = /* @__PURE__ */ Object.assign(
|
|
107
|
+
/* @__PURE__ */ at(
|
|
103
108
|
({
|
|
104
109
|
blocks: l,
|
|
105
110
|
onChange: f,
|
|
@@ -108,118 +113,131 @@ const yt = /* @__PURE__ */ Object.assign(
|
|
|
108
113
|
size: C = "md",
|
|
109
114
|
editorSize: I = "standard",
|
|
110
115
|
placeholder: v,
|
|
111
|
-
onExport:
|
|
112
|
-
onImageUpload:
|
|
113
|
-
maxUndo:
|
|
114
|
-
slashCommands:
|
|
115
|
-
showWordCount:
|
|
116
|
-
showToc:
|
|
117
|
-
showFindReplace:
|
|
118
|
-
tutorial:
|
|
119
|
-
className:
|
|
120
|
-
style:
|
|
121
|
-
id:
|
|
122
|
-
...
|
|
123
|
-
},
|
|
124
|
-
const ke =
|
|
125
|
-
|
|
126
|
-
const [
|
|
127
|
-
() => l ?? [
|
|
128
|
-
), r = l ??
|
|
116
|
+
onExport: M,
|
|
117
|
+
onImageUpload: F,
|
|
118
|
+
maxUndo: Ee = 50,
|
|
119
|
+
slashCommands: q = !0,
|
|
120
|
+
showWordCount: de = !1,
|
|
121
|
+
showToc: ce = !1,
|
|
122
|
+
showFindReplace: se = !0,
|
|
123
|
+
tutorial: Ke,
|
|
124
|
+
className: Le,
|
|
125
|
+
style: Se,
|
|
126
|
+
id: Re,
|
|
127
|
+
...Me
|
|
128
|
+
}, Fe) => {
|
|
129
|
+
const ke = tt(Re), { t: o } = ot(), [Ce] = y(it), U = `${ke}-tab-hint`, we = R(null);
|
|
130
|
+
nt(we, { orientation: "horizontal", itemSelector: "button" });
|
|
131
|
+
const [Ue, P] = y(
|
|
132
|
+
() => l ?? [Be()]
|
|
133
|
+
), r = l ?? Ue, [a, k] = y(0), K = R(/* @__PURE__ */ new Map()), ze = R(null), _e = R(/* @__PURE__ */ new Map()), Q = (e, t) => {
|
|
134
|
+
const n = _e.current.get(e);
|
|
135
|
+
return n !== void 0 ? n : (_e.current.set(e, t), t);
|
|
136
|
+
};
|
|
137
|
+
dt(() => {
|
|
138
|
+
for (const e of r) {
|
|
139
|
+
const t = K.current.get(e.id);
|
|
140
|
+
if (!t || !t.isConnected || t.getAttribute("contenteditable") === null)
|
|
141
|
+
continue;
|
|
142
|
+
const n = j(e);
|
|
143
|
+
t.textContent !== n && (t.textContent = n);
|
|
144
|
+
}
|
|
145
|
+
});
|
|
146
|
+
const [Y, ue] = y(!1), [w, Ae] = y(""), [A, We] = y(""), [b, De] = y([]), [$, pe] = y(0), [He, he] = y(!1), L = R([]), O = R([]), V = m(
|
|
129
147
|
(e) => {
|
|
130
|
-
|
|
148
|
+
L.current.push(
|
|
131
149
|
e.map((t) => ({ ...t, checked: t.checked ? [...t.checked] : void 0 }))
|
|
132
|
-
),
|
|
150
|
+
), L.current.length > Ee && L.current.shift(), O.current = [];
|
|
133
151
|
},
|
|
134
|
-
[
|
|
135
|
-
),
|
|
136
|
-
if (
|
|
152
|
+
[Ee]
|
|
153
|
+
), ge = m(() => {
|
|
154
|
+
if (L.current.length === 0)
|
|
137
155
|
return;
|
|
138
|
-
const e =
|
|
139
|
-
|
|
140
|
-
}, [r, l, f]),
|
|
141
|
-
if (
|
|
156
|
+
const e = L.current.pop();
|
|
157
|
+
O.current.push(r.map((t) => ({ ...t }))), l || P(e), f?.(e);
|
|
158
|
+
}, [r, l, f]), me = m(() => {
|
|
159
|
+
if (O.current.length === 0)
|
|
142
160
|
return;
|
|
143
|
-
const e =
|
|
144
|
-
|
|
145
|
-
}, [r, l, f]), [
|
|
146
|
-
if (
|
|
161
|
+
const e = O.current.pop();
|
|
162
|
+
L.current.push(r.map((t) => ({ ...t }))), l || P(e), f?.(e);
|
|
163
|
+
}, [r, l, f]), [N, Z] = y(!1), [Ie, $e] = y(""), [X, G] = y(0), S = ve(() => {
|
|
164
|
+
if (!N || !q)
|
|
147
165
|
return [];
|
|
148
|
-
const e =
|
|
149
|
-
return
|
|
166
|
+
const e = Ie.toLowerCase();
|
|
167
|
+
return pt.filter(
|
|
150
168
|
(t) => t.label.toLowerCase().includes(e) || t.keywords.includes(e)
|
|
151
169
|
);
|
|
152
|
-
}, [
|
|
170
|
+
}, [N, Ie, q]), [T, J] = y(null), [je, ee] = y(null), x = m(
|
|
153
171
|
(e) => {
|
|
154
|
-
|
|
172
|
+
V(r);
|
|
155
173
|
const t = e(r);
|
|
156
|
-
l ||
|
|
174
|
+
l || P(t), f?.(t);
|
|
157
175
|
},
|
|
158
|
-
[r, l, f,
|
|
159
|
-
), s =
|
|
176
|
+
[r, l, f, V]
|
|
177
|
+
), s = m(
|
|
160
178
|
(e, t) => {
|
|
161
|
-
|
|
179
|
+
x((n) => n.map((c, g) => g === e ? { ...c, ...t } : c));
|
|
162
180
|
},
|
|
163
|
-
[
|
|
164
|
-
), _ =
|
|
181
|
+
[x]
|
|
182
|
+
), _ = m(
|
|
165
183
|
(e, t) => {
|
|
166
|
-
const n = t ??
|
|
167
|
-
|
|
168
|
-
const
|
|
169
|
-
return
|
|
170
|
-
}),
|
|
184
|
+
const n = t ?? Be();
|
|
185
|
+
x((c) => {
|
|
186
|
+
const g = [...c];
|
|
187
|
+
return g.splice(e + 1, 0, n), g;
|
|
188
|
+
}), k(e + 1);
|
|
171
189
|
},
|
|
172
|
-
[
|
|
173
|
-
),
|
|
190
|
+
[x]
|
|
191
|
+
), te = m(
|
|
174
192
|
(e) => {
|
|
175
|
-
const t = { ...r[e], id:
|
|
193
|
+
const t = { ...r[e], id: xe() };
|
|
176
194
|
_(e, t);
|
|
177
195
|
},
|
|
178
196
|
[r, _]
|
|
179
|
-
),
|
|
197
|
+
), oe = m(
|
|
180
198
|
(e) => {
|
|
181
|
-
r.length <= 1 || (
|
|
199
|
+
r.length <= 1 || (x((t) => t.filter((n, c) => c !== e)), k(Math.max(0, e - 1)));
|
|
182
200
|
},
|
|
183
|
-
[r.length,
|
|
184
|
-
), W =
|
|
201
|
+
[r.length, x]
|
|
202
|
+
), W = m(
|
|
185
203
|
(e, t) => {
|
|
186
204
|
const n = e + t;
|
|
187
|
-
n < 0 || n >= r.length || (
|
|
188
|
-
const
|
|
189
|
-
return [
|
|
190
|
-
}),
|
|
205
|
+
n < 0 || n >= r.length || (x((c) => {
|
|
206
|
+
const g = [...c];
|
|
207
|
+
return [g[e], g[n]] = [g[n], g[e]], g;
|
|
208
|
+
}), k(n));
|
|
191
209
|
},
|
|
192
|
-
[r.length,
|
|
193
|
-
),
|
|
210
|
+
[r.length, x]
|
|
211
|
+
), qe = m(
|
|
194
212
|
(e, t) => {
|
|
195
213
|
const n = { type: t };
|
|
196
214
|
t === "heading" && (n.level = 2), t === "list" && (n.listType = "unordered"), t === "toggle" && (n.open = !0), s(e, n);
|
|
197
215
|
},
|
|
198
216
|
[s]
|
|
199
|
-
),
|
|
217
|
+
), fe = m(
|
|
200
218
|
(e) => {
|
|
201
|
-
const t =
|
|
202
|
-
e.type === "list" && e.label.includes("Numbered") && (t.listType = "ordered"), e.type === "list" && e.label.includes("Checklist") && (t.listType = "checklist", t.checked = []), r[a]?.content === "" || r[a]?.content === "/" ?
|
|
203
|
-
(n) => n.map((c,
|
|
204
|
-
) : _(a, t),
|
|
219
|
+
const t = ut(e.type);
|
|
220
|
+
e.type === "list" && e.label.includes("Numbered") && (t.listType = "ordered"), e.type === "list" && e.label.includes("Checklist") && (t.listType = "checklist", t.checked = []), r[a]?.content === "" || r[a]?.content === "/" ? x(
|
|
221
|
+
(n) => n.map((c, g) => g === a ? { ...t, id: c.id } : c)
|
|
222
|
+
) : _(a, t), Z(!1), $e("");
|
|
205
223
|
},
|
|
206
|
-
[r, a,
|
|
207
|
-
),
|
|
224
|
+
[r, a, x, _]
|
|
225
|
+
), ie = m(
|
|
208
226
|
(e, t) => {
|
|
209
|
-
if (
|
|
227
|
+
if (Ce(e) || d)
|
|
210
228
|
return;
|
|
211
229
|
const n = r[t];
|
|
212
230
|
if (!n?.locked) {
|
|
213
231
|
if ((e.ctrlKey || e.metaKey) && e.key === "z" && !e.shiftKey) {
|
|
214
|
-
e.preventDefault(),
|
|
232
|
+
e.preventDefault(), ge();
|
|
215
233
|
return;
|
|
216
234
|
}
|
|
217
235
|
if ((e.ctrlKey || e.metaKey) && (e.key === "y" || e.key === "z" && e.shiftKey)) {
|
|
218
|
-
e.preventDefault(),
|
|
236
|
+
e.preventDefault(), me();
|
|
219
237
|
return;
|
|
220
238
|
}
|
|
221
239
|
if ((e.ctrlKey || e.metaKey) && e.key === "d") {
|
|
222
|
-
e.preventDefault(),
|
|
240
|
+
e.preventDefault(), te(t);
|
|
223
241
|
return;
|
|
224
242
|
}
|
|
225
243
|
if ((e.ctrlKey || e.metaKey) && e.key === "b") {
|
|
@@ -246,151 +264,158 @@ const yt = /* @__PURE__ */ Object.assign(
|
|
|
246
264
|
e.preventDefault(), s(t, { indent: Math.max((n?.indent ?? 0) - 1, 0) });
|
|
247
265
|
return;
|
|
248
266
|
}
|
|
249
|
-
if ((e.ctrlKey || e.metaKey) && e.key === "f" &&
|
|
250
|
-
e.preventDefault(),
|
|
267
|
+
if ((e.ctrlKey || e.metaKey) && e.key === "f" && se) {
|
|
268
|
+
e.preventDefault(), ue((c) => !c);
|
|
251
269
|
return;
|
|
252
270
|
}
|
|
253
|
-
if (
|
|
271
|
+
if (N && S.length > 0) {
|
|
254
272
|
if (e.key === "ArrowDown") {
|
|
255
|
-
e.preventDefault(),
|
|
273
|
+
e.preventDefault(), G((c) => Math.min(c + 1, S.length - 1));
|
|
256
274
|
return;
|
|
257
275
|
}
|
|
258
276
|
if (e.key === "ArrowUp") {
|
|
259
|
-
e.preventDefault(),
|
|
277
|
+
e.preventDefault(), G((c) => Math.max(c - 1, 0));
|
|
260
278
|
return;
|
|
261
279
|
}
|
|
262
280
|
if (e.key === "Enter") {
|
|
263
|
-
e.preventDefault(),
|
|
281
|
+
e.preventDefault(), fe(S[X]);
|
|
264
282
|
return;
|
|
265
283
|
}
|
|
266
284
|
if (e.key === "Escape") {
|
|
267
|
-
|
|
285
|
+
Z(!1);
|
|
268
286
|
return;
|
|
269
287
|
}
|
|
270
288
|
}
|
|
271
|
-
e.key === "Enter" && !e.shiftKey ? (e.preventDefault(), _(t)) : e.key === "Backspace" && r[t].content === "" && r.length > 1 ? (e.preventDefault(),
|
|
289
|
+
e.key === "Enter" && !e.shiftKey ? (e.preventDefault(), _(t)) : e.key === "Backspace" && r[t].content === "" && r.length > 1 ? (e.preventDefault(), oe(t)) : e.key === "ArrowUp" && e.altKey ? (e.preventDefault(), W(t, -1)) : e.key === "ArrowDown" && e.altKey && (e.preventDefault(), W(t, 1));
|
|
272
290
|
}
|
|
273
291
|
},
|
|
274
292
|
[
|
|
275
|
-
|
|
293
|
+
Ce,
|
|
276
294
|
d,
|
|
277
295
|
r,
|
|
278
296
|
_,
|
|
279
|
-
|
|
297
|
+
oe,
|
|
280
298
|
W,
|
|
281
|
-
pe,
|
|
282
|
-
he,
|
|
283
|
-
J,
|
|
284
|
-
s,
|
|
285
|
-
$,
|
|
286
|
-
L,
|
|
287
|
-
Z,
|
|
288
299
|
ge,
|
|
289
|
-
|
|
300
|
+
me,
|
|
301
|
+
te,
|
|
302
|
+
s,
|
|
303
|
+
N,
|
|
304
|
+
S,
|
|
305
|
+
X,
|
|
306
|
+
fe,
|
|
307
|
+
se
|
|
290
308
|
]
|
|
291
|
-
),
|
|
309
|
+
), ne = m(
|
|
292
310
|
(e, t) => {
|
|
293
311
|
const n = e.target.textContent ?? "";
|
|
294
|
-
|
|
295
|
-
const c = r.map(
|
|
296
|
-
|
|
312
|
+
q && n.startsWith("/") ? (Z(!0), $e(n.slice(1)), G(0)) : N && Z(!1), V(r);
|
|
313
|
+
const c = r.map(
|
|
314
|
+
(g, H) => H === t ? {
|
|
315
|
+
...g,
|
|
316
|
+
content: g.type === "toggle" ? `${g.content.split(`
|
|
317
|
+
`)[0]}
|
|
318
|
+
${n}` : n
|
|
319
|
+
} : g
|
|
320
|
+
);
|
|
321
|
+
l || P(c), f?.(c);
|
|
297
322
|
},
|
|
298
|
-
[r, l, f,
|
|
299
|
-
),
|
|
300
|
-
|
|
301
|
-
}, []),
|
|
302
|
-
e.preventDefault(), e.dataTransfer.dropEffect = "move",
|
|
303
|
-
}, []),
|
|
323
|
+
[r, l, f, V, q, N]
|
|
324
|
+
), Pe = m((e, t) => {
|
|
325
|
+
J(t), e.dataTransfer.effectAllowed = "move";
|
|
326
|
+
}, []), Qe = m((e, t) => {
|
|
327
|
+
e.preventDefault(), e.dataTransfer.dropEffect = "move", ee(t);
|
|
328
|
+
}, []), Ye = m(
|
|
304
329
|
(e, t) => {
|
|
305
330
|
if (e.preventDefault(), T === null || T === t) {
|
|
306
|
-
|
|
331
|
+
J(null), ee(null);
|
|
307
332
|
return;
|
|
308
333
|
}
|
|
309
|
-
|
|
310
|
-
const c = [...n], [
|
|
311
|
-
return c.splice(t > T ? t - 1 : t, 0,
|
|
312
|
-
}),
|
|
334
|
+
x((n) => {
|
|
335
|
+
const c = [...n], [g] = c.splice(T, 1);
|
|
336
|
+
return c.splice(t > T ? t - 1 : t, 0, g), c;
|
|
337
|
+
}), k(t > T ? t - 1 : t), J(null), ee(null);
|
|
313
338
|
},
|
|
314
|
-
[T,
|
|
339
|
+
[T, x]
|
|
315
340
|
);
|
|
316
|
-
|
|
317
|
-
if (!
|
|
318
|
-
|
|
341
|
+
ye(() => {
|
|
342
|
+
if (!Y || !w) {
|
|
343
|
+
De([]);
|
|
319
344
|
return;
|
|
320
345
|
}
|
|
321
346
|
const e = w.toLowerCase(), t = [];
|
|
322
347
|
r.forEach((n, c) => {
|
|
323
|
-
const
|
|
324
|
-
let
|
|
325
|
-
for (;
|
|
326
|
-
const
|
|
327
|
-
if (
|
|
348
|
+
const g = (n.content ?? "").toLowerCase();
|
|
349
|
+
let H = 0;
|
|
350
|
+
for (; H < g.length; ) {
|
|
351
|
+
const le = g.indexOf(e, H);
|
|
352
|
+
if (le === -1)
|
|
328
353
|
break;
|
|
329
|
-
t.push({ blockIdx: c, start:
|
|
354
|
+
t.push({ blockIdx: c, start: le, end: le + e.length }), H = le + 1;
|
|
330
355
|
}
|
|
331
|
-
}),
|
|
332
|
-
}, [w,
|
|
333
|
-
const
|
|
356
|
+
}), De(t), pe(0);
|
|
357
|
+
}, [w, Y, r]);
|
|
358
|
+
const Oe = m(() => {
|
|
334
359
|
if (b.length === 0)
|
|
335
360
|
return;
|
|
336
|
-
const e = (
|
|
337
|
-
|
|
338
|
-
}, [b,
|
|
361
|
+
const e = ($ + 1) % b.length;
|
|
362
|
+
pe(e), k(b[e].blockIdx);
|
|
363
|
+
}, [b, $]), Ve = m(() => {
|
|
339
364
|
if (b.length === 0)
|
|
340
365
|
return;
|
|
341
|
-
const e = (
|
|
342
|
-
|
|
343
|
-
}, [b,
|
|
366
|
+
const e = ($ - 1 + b.length) % b.length;
|
|
367
|
+
pe(e), k(b[e].blockIdx);
|
|
368
|
+
}, [b, $]), Ze = m(() => {
|
|
344
369
|
if (b.length === 0 || !w)
|
|
345
370
|
return;
|
|
346
|
-
const e = b[
|
|
347
|
-
s(e.blockIdx, { content: n +
|
|
348
|
-
}, [b,
|
|
371
|
+
const e = b[$], t = r[e.blockIdx], n = t.content.slice(0, e.start), c = t.content.slice(e.end);
|
|
372
|
+
s(e.blockIdx, { content: n + A + c });
|
|
373
|
+
}, [b, $, w, A, r, s]), Xe = m(() => {
|
|
349
374
|
if (!w)
|
|
350
375
|
return;
|
|
351
376
|
const e = w;
|
|
352
|
-
|
|
377
|
+
x(
|
|
353
378
|
(t) => t.map((n) => ({
|
|
354
379
|
...n,
|
|
355
|
-
content: n.content.split(e).join(
|
|
380
|
+
content: n.content.split(e).join(A)
|
|
356
381
|
}))
|
|
357
382
|
);
|
|
358
|
-
}, [w,
|
|
383
|
+
}, [w, A, x]), Ne = ve(() => ce ? r.map(
|
|
359
384
|
(e, t) => e.type === "heading" ? { idx: t, level: e.level ?? 2, text: e.content } : null
|
|
360
|
-
).filter(Boolean) : [], [r,
|
|
385
|
+
).filter(Boolean) : [], [r, ce]), Ge = m(
|
|
361
386
|
async (e) => {
|
|
362
387
|
const t = e.target.files?.[0];
|
|
363
388
|
if (t) {
|
|
364
|
-
if (
|
|
365
|
-
const n = await
|
|
389
|
+
if (F) {
|
|
390
|
+
const n = await F(t);
|
|
366
391
|
s(a, { src: n });
|
|
367
392
|
}
|
|
368
393
|
e.target.value = "";
|
|
369
394
|
}
|
|
370
395
|
},
|
|
371
|
-
[
|
|
396
|
+
[F, a, s]
|
|
372
397
|
);
|
|
373
|
-
|
|
398
|
+
ye(() => {
|
|
374
399
|
const e = r[a];
|
|
375
400
|
if (e) {
|
|
376
|
-
const t =
|
|
401
|
+
const t = K.current.get(e.id);
|
|
377
402
|
t && t.focus();
|
|
378
403
|
}
|
|
379
404
|
}, [a, r]);
|
|
380
|
-
const
|
|
381
|
-
const e = r.map(
|
|
405
|
+
const Je = m(() => {
|
|
406
|
+
const e = r.map(ht).join(`
|
|
382
407
|
`);
|
|
383
|
-
|
|
384
|
-
}, [r,
|
|
385
|
-
() =>
|
|
386
|
-
[r,
|
|
387
|
-
), [E, D] = y(null),
|
|
408
|
+
M?.(e);
|
|
409
|
+
}, [r, M]), re = ve(
|
|
410
|
+
() => de ? gt(r) : null,
|
|
411
|
+
[r, de]
|
|
412
|
+
), [E, D] = y(null), et = m(
|
|
388
413
|
(e, t) => {
|
|
389
414
|
d || (e.preventDefault(), D({ x: e.clientX, y: e.clientY, idx: t }));
|
|
390
415
|
},
|
|
391
416
|
[d]
|
|
392
417
|
);
|
|
393
|
-
return
|
|
418
|
+
return ye(() => {
|
|
394
419
|
if (!E)
|
|
395
420
|
return;
|
|
396
421
|
const e = () => D(null);
|
|
@@ -398,19 +423,19 @@ const yt = /* @__PURE__ */ Object.assign(
|
|
|
398
423
|
}, [E]), /* @__PURE__ */ u(
|
|
399
424
|
"div",
|
|
400
425
|
{
|
|
401
|
-
ref:
|
|
426
|
+
ref: Fe,
|
|
402
427
|
id: ke,
|
|
403
|
-
className: `nice-doc-editor nice-doc-editor--${C} nice-editor--${I} ${d ? "nice-doc-editor--readonly" : ""} ${
|
|
404
|
-
style: { position: "relative", ...
|
|
428
|
+
className: `nice-doc-editor nice-doc-editor--${C} nice-editor--${I} ${d ? "nice-doc-editor--readonly" : ""} ${Le ?? ""}`,
|
|
429
|
+
style: { position: "relative", ...Se },
|
|
405
430
|
role: "application",
|
|
406
431
|
"aria-label": o("docEditor.label", "Document Editor"),
|
|
407
|
-
...
|
|
432
|
+
...Me,
|
|
408
433
|
children: [
|
|
409
|
-
/* @__PURE__ */ i("span", { style: { position: "absolute", top: 6, right: 6, zIndex: 20 }, children: /* @__PURE__ */ i(
|
|
434
|
+
/* @__PURE__ */ i("span", { style: { position: "absolute", top: 6, right: 6, zIndex: 20 }, children: /* @__PURE__ */ i(rt, { steps: lt(Ke, ct) }) }),
|
|
410
435
|
z && !d && /* @__PURE__ */ u(
|
|
411
436
|
"div",
|
|
412
437
|
{
|
|
413
|
-
ref:
|
|
438
|
+
ref: we,
|
|
414
439
|
className: "nice-doc-editor__toolbar",
|
|
415
440
|
role: "toolbar",
|
|
416
441
|
"aria-label": o("docEditor.toolbar", "Formatting"),
|
|
@@ -427,7 +452,7 @@ const yt = /* @__PURE__ */ Object.assign(
|
|
|
427
452
|
{
|
|
428
453
|
size: "sm",
|
|
429
454
|
variant: "ghost",
|
|
430
|
-
onClick:
|
|
455
|
+
onClick: ge,
|
|
431
456
|
title: o("docEditor.undo", "Undo (Ctrl+Z)"),
|
|
432
457
|
ariaLabel: o("docEditor.undo", "Undo (Ctrl+Z)"),
|
|
433
458
|
children: /* @__PURE__ */ i(p, { name: "undo", size: "sm" })
|
|
@@ -438,7 +463,7 @@ const yt = /* @__PURE__ */ Object.assign(
|
|
|
438
463
|
{
|
|
439
464
|
size: "sm",
|
|
440
465
|
variant: "ghost",
|
|
441
|
-
onClick:
|
|
466
|
+
onClick: me,
|
|
442
467
|
title: o("docEditor.redo", "Redo (Ctrl+Y)"),
|
|
443
468
|
ariaLabel: o("docEditor.redo", "Redo (Ctrl+Y)"),
|
|
444
469
|
children: /* @__PURE__ */ i(p, { name: "redo", size: "sm" })
|
|
@@ -446,11 +471,11 @@ const yt = /* @__PURE__ */ Object.assign(
|
|
|
446
471
|
),
|
|
447
472
|
/* @__PURE__ */ i("span", { className: "nice-doc-editor__sep" }),
|
|
448
473
|
/* @__PURE__ */ i(
|
|
449
|
-
|
|
474
|
+
be,
|
|
450
475
|
{
|
|
451
476
|
size: "sm",
|
|
452
477
|
value: r[a]?.type ?? "paragraph",
|
|
453
|
-
onChange: (e) =>
|
|
478
|
+
onChange: (e) => qe(a, e),
|
|
454
479
|
label: "",
|
|
455
480
|
options: [
|
|
456
481
|
{ value: "paragraph", label: o("docEditor.paragraph", "Paragraph") },
|
|
@@ -469,7 +494,7 @@ const yt = /* @__PURE__ */ Object.assign(
|
|
|
469
494
|
}
|
|
470
495
|
),
|
|
471
496
|
r[a]?.type === "heading" && /* @__PURE__ */ i(
|
|
472
|
-
|
|
497
|
+
be,
|
|
473
498
|
{
|
|
474
499
|
size: "sm",
|
|
475
500
|
value: String(r[a]?.level ?? 2),
|
|
@@ -487,7 +512,7 @@ const yt = /* @__PURE__ */ Object.assign(
|
|
|
487
512
|
}
|
|
488
513
|
),
|
|
489
514
|
r[a]?.type === "list" && /* @__PURE__ */ i(
|
|
490
|
-
|
|
515
|
+
be,
|
|
491
516
|
{
|
|
492
517
|
size: "sm",
|
|
493
518
|
value: r[a]?.listType ?? "unordered",
|
|
@@ -605,7 +630,7 @@ const yt = /* @__PURE__ */ Object.assign(
|
|
|
605
630
|
),
|
|
606
631
|
/* @__PURE__ */ i("span", { className: "nice-doc-editor__sep" }),
|
|
607
632
|
/* @__PURE__ */ i(
|
|
608
|
-
|
|
633
|
+
Te,
|
|
609
634
|
{
|
|
610
635
|
size: "sm",
|
|
611
636
|
label: "",
|
|
@@ -615,7 +640,7 @@ const yt = /* @__PURE__ */ Object.assign(
|
|
|
615
640
|
}
|
|
616
641
|
),
|
|
617
642
|
/* @__PURE__ */ i(
|
|
618
|
-
|
|
643
|
+
Te,
|
|
619
644
|
{
|
|
620
645
|
size: "sm",
|
|
621
646
|
label: "",
|
|
@@ -641,7 +666,7 @@ const yt = /* @__PURE__ */ Object.assign(
|
|
|
641
666
|
{
|
|
642
667
|
size: "sm",
|
|
643
668
|
variant: "ghost",
|
|
644
|
-
onClick: () =>
|
|
669
|
+
onClick: () => te(a),
|
|
645
670
|
title: o("docEditor.duplicate", "Duplicate (Ctrl+D)"),
|
|
646
671
|
ariaLabel: o("docEditor.duplicate", "Duplicate (Ctrl+D)"),
|
|
647
672
|
children: /* @__PURE__ */ i(p, { name: "copy", size: "sm" })
|
|
@@ -652,7 +677,7 @@ const yt = /* @__PURE__ */ Object.assign(
|
|
|
652
677
|
{
|
|
653
678
|
size: "sm",
|
|
654
679
|
variant: "ghost",
|
|
655
|
-
onClick: () =>
|
|
680
|
+
onClick: () => oe(a),
|
|
656
681
|
title: o("docEditor.delete", "Delete block"),
|
|
657
682
|
ariaLabel: o("docEditor.delete", "Delete block"),
|
|
658
683
|
children: /* @__PURE__ */ i(p, { name: "trash", size: "sm" })
|
|
@@ -669,12 +694,12 @@ const yt = /* @__PURE__ */ Object.assign(
|
|
|
669
694
|
children: /* @__PURE__ */ i(p, { name: "plus", size: "sm" })
|
|
670
695
|
}
|
|
671
696
|
),
|
|
672
|
-
|
|
697
|
+
se && /* @__PURE__ */ i(
|
|
673
698
|
h,
|
|
674
699
|
{
|
|
675
700
|
size: "sm",
|
|
676
|
-
variant:
|
|
677
|
-
onClick: () =>
|
|
701
|
+
variant: Y ? "primary" : "ghost",
|
|
702
|
+
onClick: () => ue((e) => !e),
|
|
678
703
|
title: o("docEditor.find", "Find & Replace (Ctrl+F)"),
|
|
679
704
|
ariaLabel: o("docEditor.find", "Find & Replace (Ctrl+F)"),
|
|
680
705
|
children: /* @__PURE__ */ i(p, { name: "search", size: "sm" })
|
|
@@ -685,27 +710,27 @@ const yt = /* @__PURE__ */ Object.assign(
|
|
|
685
710
|
{
|
|
686
711
|
size: "sm",
|
|
687
712
|
variant: "ghost",
|
|
688
|
-
onClick: () =>
|
|
713
|
+
onClick: () => he((e) => !e),
|
|
689
714
|
title: o("docEditor.shortcuts", "Keyboard shortcuts"),
|
|
690
715
|
ariaLabel: o("docEditor.shortcuts", "Keyboard shortcuts"),
|
|
691
716
|
children: /* @__PURE__ */ i(p, { name: "keyboard", size: "sm" })
|
|
692
717
|
}
|
|
693
718
|
),
|
|
694
|
-
|
|
719
|
+
M && /* @__PURE__ */ i(h, { size: "sm", variant: "ghost", onClick: Je, children: o("docEditor.export", "Export HTML") })
|
|
695
720
|
]
|
|
696
721
|
}
|
|
697
722
|
),
|
|
698
723
|
/* @__PURE__ */ i(
|
|
699
724
|
"input",
|
|
700
725
|
{
|
|
701
|
-
ref:
|
|
726
|
+
ref: ze,
|
|
702
727
|
type: "file",
|
|
703
728
|
accept: "image/*,video/*",
|
|
704
729
|
style: { display: "none" },
|
|
705
|
-
onChange:
|
|
730
|
+
onChange: Ge
|
|
706
731
|
}
|
|
707
732
|
),
|
|
708
|
-
|
|
733
|
+
Y && /* @__PURE__ */ u(
|
|
709
734
|
"div",
|
|
710
735
|
{
|
|
711
736
|
className: "nice-doc-editor__find-bar",
|
|
@@ -719,22 +744,22 @@ const yt = /* @__PURE__ */ Object.assign(
|
|
|
719
744
|
},
|
|
720
745
|
children: [
|
|
721
746
|
/* @__PURE__ */ i(
|
|
722
|
-
|
|
747
|
+
ae,
|
|
723
748
|
{
|
|
724
749
|
size: "sm",
|
|
725
750
|
placeholder: o("docEditor.findPlaceholder", "Find..."),
|
|
726
751
|
value: w,
|
|
727
|
-
onChange:
|
|
752
|
+
onChange: Ae,
|
|
728
753
|
style: { flex: 1, maxWidth: 200 }
|
|
729
754
|
}
|
|
730
755
|
),
|
|
731
756
|
/* @__PURE__ */ i(
|
|
732
|
-
|
|
757
|
+
ae,
|
|
733
758
|
{
|
|
734
759
|
size: "sm",
|
|
735
760
|
placeholder: o("docEditor.replacePlaceholder", "Replace..."),
|
|
736
|
-
value:
|
|
737
|
-
onChange:
|
|
761
|
+
value: A,
|
|
762
|
+
onChange: We,
|
|
738
763
|
style: { flex: 1, maxWidth: 200 }
|
|
739
764
|
}
|
|
740
765
|
),
|
|
@@ -743,7 +768,7 @@ const yt = /* @__PURE__ */ Object.assign(
|
|
|
743
768
|
{
|
|
744
769
|
size: "sm",
|
|
745
770
|
variant: "ghost",
|
|
746
|
-
onClick:
|
|
771
|
+
onClick: Ve,
|
|
747
772
|
title: o("docEditor.findPrev", "Previous"),
|
|
748
773
|
ariaLabel: o("docEditor.findPrev", "Previous"),
|
|
749
774
|
children: /* @__PURE__ */ i(p, { name: "chevron-up", size: "sm" })
|
|
@@ -754,7 +779,7 @@ const yt = /* @__PURE__ */ Object.assign(
|
|
|
754
779
|
{
|
|
755
780
|
size: "sm",
|
|
756
781
|
variant: "ghost",
|
|
757
|
-
onClick:
|
|
782
|
+
onClick: Oe,
|
|
758
783
|
title: o("docEditor.findNext", "Next"),
|
|
759
784
|
ariaLabel: o("docEditor.findNext", "Next"),
|
|
760
785
|
children: /* @__PURE__ */ i(p, { name: "chevron-down", size: "sm" })
|
|
@@ -765,7 +790,7 @@ const yt = /* @__PURE__ */ Object.assign(
|
|
|
765
790
|
{
|
|
766
791
|
size: "sm",
|
|
767
792
|
variant: "ghost",
|
|
768
|
-
onClick:
|
|
793
|
+
onClick: Ze,
|
|
769
794
|
title: o("docEditor.replaceOne", "Replace"),
|
|
770
795
|
disabled: d,
|
|
771
796
|
children: o("docEditor.replace", "Replace")
|
|
@@ -776,19 +801,19 @@ const yt = /* @__PURE__ */ Object.assign(
|
|
|
776
801
|
{
|
|
777
802
|
size: "sm",
|
|
778
803
|
variant: "ghost",
|
|
779
|
-
onClick:
|
|
804
|
+
onClick: Xe,
|
|
780
805
|
title: o("docEditor.replaceAll", "Replace all"),
|
|
781
806
|
disabled: d,
|
|
782
807
|
children: o("docEditor.replaceAllBtn", "All")
|
|
783
808
|
}
|
|
784
809
|
),
|
|
785
|
-
/* @__PURE__ */ i("span", { style: { fontSize: "0.75em", color: "var(--nice-text-muted, #666)" }, children: b.length > 0 ? `${
|
|
810
|
+
/* @__PURE__ */ i("span", { style: { fontSize: "0.75em", color: "var(--nice-text-muted, #666)" }, children: b.length > 0 ? `${$ + 1}/${b.length}` : "0/0" }),
|
|
786
811
|
/* @__PURE__ */ i(
|
|
787
812
|
h,
|
|
788
813
|
{
|
|
789
814
|
size: "sm",
|
|
790
815
|
variant: "ghost",
|
|
791
|
-
onClick: () =>
|
|
816
|
+
onClick: () => ue(!1),
|
|
792
817
|
title: o("docEditor.closeFind", "Close"),
|
|
793
818
|
ariaLabel: o("docEditor.closeFind", "Close"),
|
|
794
819
|
children: /* @__PURE__ */ i(p, { name: "close", size: "sm" })
|
|
@@ -797,7 +822,7 @@ const yt = /* @__PURE__ */ Object.assign(
|
|
|
797
822
|
]
|
|
798
823
|
}
|
|
799
824
|
),
|
|
800
|
-
|
|
825
|
+
He && /* @__PURE__ */ i(
|
|
801
826
|
"div",
|
|
802
827
|
{
|
|
803
828
|
role: "presentation",
|
|
@@ -811,7 +836,7 @@ const yt = /* @__PURE__ */ Object.assign(
|
|
|
811
836
|
alignItems: "center",
|
|
812
837
|
justifyContent: "center"
|
|
813
838
|
},
|
|
814
|
-
onClick: () =>
|
|
839
|
+
onClick: () => he(!1),
|
|
815
840
|
children: /* @__PURE__ */ u(
|
|
816
841
|
"div",
|
|
817
842
|
{
|
|
@@ -861,14 +886,14 @@ const yt = /* @__PURE__ */ Object.assign(
|
|
|
861
886
|
},
|
|
862
887
|
e
|
|
863
888
|
)) }) }),
|
|
864
|
-
/* @__PURE__ */ i("div", { style: { textAlign: "right", marginTop: 12 }, children: /* @__PURE__ */ i(h, { size: "sm", variant: "ghost", onClick: () =>
|
|
889
|
+
/* @__PURE__ */ i("div", { style: { textAlign: "right", marginTop: 12 }, children: /* @__PURE__ */ i(h, { size: "sm", variant: "ghost", onClick: () => he(!1), children: o("docEditor.close", "Close") }) })
|
|
865
890
|
]
|
|
866
891
|
}
|
|
867
892
|
)
|
|
868
893
|
}
|
|
869
894
|
),
|
|
870
895
|
/* @__PURE__ */ u("div", { style: { display: "flex", gap: 0 }, children: [
|
|
871
|
-
|
|
896
|
+
ce && Ne.length > 0 && /* @__PURE__ */ u(
|
|
872
897
|
"nav",
|
|
873
898
|
{
|
|
874
899
|
className: "nice-doc-editor__toc",
|
|
@@ -895,7 +920,7 @@ const yt = /* @__PURE__ */ Object.assign(
|
|
|
895
920
|
children: o("docEditor.toc", "Contents")
|
|
896
921
|
}
|
|
897
922
|
),
|
|
898
|
-
|
|
923
|
+
Ne.map((e) => /* @__PURE__ */ i(
|
|
899
924
|
"div",
|
|
900
925
|
{
|
|
901
926
|
role: "button",
|
|
@@ -911,7 +936,7 @@ const yt = /* @__PURE__ */ Object.assign(
|
|
|
911
936
|
whiteSpace: "nowrap",
|
|
912
937
|
background: e.idx === a ? "var(--nice-primary-bg, #e8f0fe)" : void 0
|
|
913
938
|
},
|
|
914
|
-
onClick: () =>
|
|
939
|
+
onClick: () => k(e.idx),
|
|
915
940
|
title: e.text,
|
|
916
941
|
children: e.text || o("docEditor.untitled", "Untitled")
|
|
917
942
|
},
|
|
@@ -921,7 +946,7 @@ const yt = /* @__PURE__ */ Object.assign(
|
|
|
921
946
|
}
|
|
922
947
|
),
|
|
923
948
|
/* @__PURE__ */ u("div", { className: "nice-doc-editor__body", style: { flex: 1 }, children: [
|
|
924
|
-
!d && /* @__PURE__ */ i("span", { id:
|
|
949
|
+
!d && /* @__PURE__ */ i("span", { id: U, className: "nice-sr-only", children: o(
|
|
925
950
|
"input.tabEscapeHint",
|
|
926
951
|
"Tab indents. To leave the editor, press Escape, then Tab."
|
|
927
952
|
) }),
|
|
@@ -929,15 +954,15 @@ const yt = /* @__PURE__ */ Object.assign(
|
|
|
929
954
|
"div",
|
|
930
955
|
{
|
|
931
956
|
role: "presentation",
|
|
932
|
-
className: `nice-doc-editor__block nice-doc-editor__block--${e.type} ${t === a ? "nice-doc-editor__block--focused" : ""} ${
|
|
933
|
-
onClick: () =>
|
|
934
|
-
onContextMenu: (n) =>
|
|
957
|
+
className: `nice-doc-editor__block nice-doc-editor__block--${e.type} ${t === a ? "nice-doc-editor__block--focused" : ""} ${je === t ? "nice-doc-editor__block--drop-target" : ""} ${e.locked ? "nice-doc-editor__block--locked" : ""}`,
|
|
958
|
+
onClick: () => k(t),
|
|
959
|
+
onContextMenu: (n) => et(n, t),
|
|
935
960
|
draggable: !d && !e.locked,
|
|
936
|
-
onDragStart: (n) =>
|
|
937
|
-
onDragOver: (n) =>
|
|
938
|
-
onDrop: (n) =>
|
|
961
|
+
onDragStart: (n) => Pe(n, t),
|
|
962
|
+
onDragOver: (n) => Qe(n, t),
|
|
963
|
+
onDrop: (n) => Ye(n, t),
|
|
939
964
|
onDragEnd: () => {
|
|
940
|
-
|
|
965
|
+
J(null), ee(null);
|
|
941
966
|
},
|
|
942
967
|
style: {
|
|
943
968
|
opacity: T === t ? 0.4 : 1,
|
|
@@ -1001,7 +1026,7 @@ const yt = /* @__PURE__ */ Object.assign(
|
|
|
1001
1026
|
}
|
|
1002
1027
|
) : !d && /* @__PURE__ */ u("div", { style: { display: "flex", gap: 4, alignItems: "center" }, children: [
|
|
1003
1028
|
/* @__PURE__ */ i(
|
|
1004
|
-
|
|
1029
|
+
ae,
|
|
1005
1030
|
{
|
|
1006
1031
|
size: "sm",
|
|
1007
1032
|
placeholder: e.type === "image" ? o("docEditor.imageUrl", "Image URL") : o("docEditor.videoUrl", "Video URL"),
|
|
@@ -1009,13 +1034,13 @@ const yt = /* @__PURE__ */ Object.assign(
|
|
|
1009
1034
|
onChange: (n) => s(t, { src: n })
|
|
1010
1035
|
}
|
|
1011
1036
|
),
|
|
1012
|
-
|
|
1037
|
+
F && /* @__PURE__ */ i(
|
|
1013
1038
|
h,
|
|
1014
1039
|
{
|
|
1015
1040
|
size: "sm",
|
|
1016
1041
|
variant: "ghost",
|
|
1017
1042
|
onClick: () => {
|
|
1018
|
-
|
|
1043
|
+
k(t), ze.current?.click();
|
|
1019
1044
|
},
|
|
1020
1045
|
title: o("docEditor.upload", "Upload file"),
|
|
1021
1046
|
ariaLabel: o("docEditor.upload", "Upload file"),
|
|
@@ -1040,20 +1065,20 @@ const yt = /* @__PURE__ */ Object.assign(
|
|
|
1040
1065
|
"div",
|
|
1041
1066
|
{
|
|
1042
1067
|
ref: (n) => {
|
|
1043
|
-
n &&
|
|
1068
|
+
n && K.current.set(e.id, n);
|
|
1044
1069
|
},
|
|
1045
1070
|
className: "nice-doc-editor__content",
|
|
1046
1071
|
contentEditable: !d && !e.locked,
|
|
1047
1072
|
suppressContentEditableWarning: !0,
|
|
1048
|
-
onInput: (n) =>
|
|
1049
|
-
onFocus: () =>
|
|
1050
|
-
onKeyDown: (n) =>
|
|
1073
|
+
onInput: (n) => ne(n, t),
|
|
1074
|
+
onFocus: () => k(t),
|
|
1075
|
+
onKeyDown: (n) => ie(n, t),
|
|
1051
1076
|
"data-placeholder": o("docEditor.calloutPlaceholder", "Callout text..."),
|
|
1052
1077
|
role: "textbox",
|
|
1053
1078
|
"aria-multiline": "true",
|
|
1054
|
-
"aria-describedby": d ? void 0 :
|
|
1079
|
+
"aria-describedby": d ? void 0 : U,
|
|
1055
1080
|
style: { flex: 1, outline: "none" },
|
|
1056
|
-
children: e.
|
|
1081
|
+
children: Q(e.id, j(e))
|
|
1057
1082
|
}
|
|
1058
1083
|
)
|
|
1059
1084
|
]
|
|
@@ -1071,28 +1096,26 @@ const yt = /* @__PURE__ */ Object.assign(
|
|
|
1071
1096
|
"div",
|
|
1072
1097
|
{
|
|
1073
1098
|
ref: (n) => {
|
|
1074
|
-
n &&
|
|
1099
|
+
n && K.current.set(e.id, n);
|
|
1075
1100
|
},
|
|
1076
1101
|
className: "nice-doc-editor__content",
|
|
1077
1102
|
contentEditable: !d && !e.locked,
|
|
1078
1103
|
suppressContentEditableWarning: !0,
|
|
1079
|
-
onInput: (n) =>
|
|
1080
|
-
onFocus: () =>
|
|
1081
|
-
onKeyDown: (n) =>
|
|
1104
|
+
onInput: (n) => ne(n, t),
|
|
1105
|
+
onFocus: () => k(t),
|
|
1106
|
+
onKeyDown: (n) => ie(n, t),
|
|
1082
1107
|
role: "textbox",
|
|
1083
1108
|
"aria-multiline": "true",
|
|
1084
|
-
"aria-describedby": d ? void 0 :
|
|
1109
|
+
"aria-describedby": d ? void 0 : U,
|
|
1085
1110
|
style: { padding: "4px 0" },
|
|
1086
|
-
children: e.
|
|
1087
|
-
`).slice(1).join(`
|
|
1088
|
-
`)
|
|
1111
|
+
children: Q(e.id, j(e))
|
|
1089
1112
|
}
|
|
1090
1113
|
)
|
|
1091
1114
|
]
|
|
1092
1115
|
}
|
|
1093
1116
|
) : e.type === "code" ? /* @__PURE__ */ u("div", { className: "nice-doc-editor__code-block", style: { position: "relative" }, children: [
|
|
1094
1117
|
!d && /* @__PURE__ */ i(
|
|
1095
|
-
|
|
1118
|
+
ae,
|
|
1096
1119
|
{
|
|
1097
1120
|
size: "sm",
|
|
1098
1121
|
value: e.language ?? "",
|
|
@@ -1111,17 +1134,17 @@ const yt = /* @__PURE__ */ Object.assign(
|
|
|
1111
1134
|
"pre",
|
|
1112
1135
|
{
|
|
1113
1136
|
ref: (n) => {
|
|
1114
|
-
n &&
|
|
1137
|
+
n && K.current.set(e.id, n);
|
|
1115
1138
|
},
|
|
1116
1139
|
className: "nice-doc-editor__content",
|
|
1117
1140
|
contentEditable: !d && !e.locked,
|
|
1118
1141
|
suppressContentEditableWarning: !0,
|
|
1119
|
-
onInput: (n) =>
|
|
1120
|
-
onFocus: () =>
|
|
1121
|
-
onKeyDown: (n) =>
|
|
1142
|
+
onInput: (n) => ne(n, t),
|
|
1143
|
+
onFocus: () => k(t),
|
|
1144
|
+
onKeyDown: (n) => ie(n, t),
|
|
1122
1145
|
role: "textbox",
|
|
1123
1146
|
"aria-multiline": "true",
|
|
1124
|
-
"aria-describedby": d ? void 0 :
|
|
1147
|
+
"aria-describedby": d ? void 0 : U,
|
|
1125
1148
|
style: {
|
|
1126
1149
|
fontFamily: "monospace",
|
|
1127
1150
|
background: "var(--nice-bg-elevated, #1e1e1e)",
|
|
@@ -1130,7 +1153,7 @@ const yt = /* @__PURE__ */ Object.assign(
|
|
|
1130
1153
|
borderRadius: 4,
|
|
1131
1154
|
overflow: "auto"
|
|
1132
1155
|
},
|
|
1133
|
-
children: e.
|
|
1156
|
+
children: Q(e.id, j(e))
|
|
1134
1157
|
}
|
|
1135
1158
|
)
|
|
1136
1159
|
] }) : /* @__PURE__ */ u("div", { style: { position: "relative" }, children: [
|
|
@@ -1138,7 +1161,7 @@ const yt = /* @__PURE__ */ Object.assign(
|
|
|
1138
1161
|
"div",
|
|
1139
1162
|
{
|
|
1140
1163
|
ref: (n) => {
|
|
1141
|
-
n &&
|
|
1164
|
+
n && K.current.set(e.id, n);
|
|
1142
1165
|
},
|
|
1143
1166
|
className: "nice-doc-editor__content",
|
|
1144
1167
|
contentEditable: !d && !e.locked,
|
|
@@ -1154,17 +1177,17 @@ const yt = /* @__PURE__ */ Object.assign(
|
|
|
1154
1177
|
color: e.color,
|
|
1155
1178
|
backgroundColor: e.bgColor
|
|
1156
1179
|
},
|
|
1157
|
-
onInput: (n) =>
|
|
1158
|
-
onFocus: () =>
|
|
1159
|
-
onKeyDown: (n) =>
|
|
1180
|
+
onInput: (n) => ne(n, t),
|
|
1181
|
+
onFocus: () => k(t),
|
|
1182
|
+
onKeyDown: (n) => ie(n, t),
|
|
1160
1183
|
"data-placeholder": !e.content && v ? v : void 0,
|
|
1161
1184
|
role: "textbox",
|
|
1162
1185
|
"aria-multiline": "true",
|
|
1163
|
-
"aria-describedby": d ? void 0 :
|
|
1164
|
-
children: e.
|
|
1186
|
+
"aria-describedby": d ? void 0 : U,
|
|
1187
|
+
children: Q(e.id, j(e))
|
|
1165
1188
|
}
|
|
1166
1189
|
),
|
|
1167
|
-
|
|
1190
|
+
N && t === a && S.length > 0 && /* @__PURE__ */ i(
|
|
1168
1191
|
"ul",
|
|
1169
1192
|
{
|
|
1170
1193
|
className: "nice-doc-editor__slash-menu",
|
|
@@ -1184,11 +1207,11 @@ const yt = /* @__PURE__ */ Object.assign(
|
|
|
1184
1207
|
maxHeight: 240,
|
|
1185
1208
|
overflow: "auto"
|
|
1186
1209
|
},
|
|
1187
|
-
children:
|
|
1210
|
+
children: S.map((n, c) => /* @__PURE__ */ u(
|
|
1188
1211
|
"li",
|
|
1189
1212
|
{
|
|
1190
1213
|
role: "presentation",
|
|
1191
|
-
className: c ===
|
|
1214
|
+
className: c === X ? "nice-doc-editor__slash-item--active" : "",
|
|
1192
1215
|
style: {
|
|
1193
1216
|
padding: "6px 10px",
|
|
1194
1217
|
cursor: "pointer",
|
|
@@ -1196,12 +1219,12 @@ const yt = /* @__PURE__ */ Object.assign(
|
|
|
1196
1219
|
display: "flex",
|
|
1197
1220
|
gap: 8,
|
|
1198
1221
|
alignItems: "center",
|
|
1199
|
-
background: c ===
|
|
1222
|
+
background: c === X ? "var(--nice-primary-bg, #e8f0fe)" : void 0
|
|
1200
1223
|
},
|
|
1201
|
-
onMouseDown: (
|
|
1202
|
-
|
|
1224
|
+
onMouseDown: (g) => {
|
|
1225
|
+
g.preventDefault(), fe(n);
|
|
1203
1226
|
},
|
|
1204
|
-
onMouseEnter: () =>
|
|
1227
|
+
onMouseEnter: () => G(c),
|
|
1205
1228
|
children: [
|
|
1206
1229
|
/* @__PURE__ */ i(
|
|
1207
1230
|
"span",
|
|
@@ -1253,7 +1276,7 @@ const yt = /* @__PURE__ */ Object.assign(
|
|
|
1253
1276
|
onKeyDown: B,
|
|
1254
1277
|
style: { padding: "6px 12px", cursor: "pointer" },
|
|
1255
1278
|
onClick: () => {
|
|
1256
|
-
|
|
1279
|
+
te(E.idx), D(null);
|
|
1257
1280
|
},
|
|
1258
1281
|
children: [
|
|
1259
1282
|
/* @__PURE__ */ i(p, { name: "copy", size: "sm" }),
|
|
@@ -1352,7 +1375,7 @@ const yt = /* @__PURE__ */ Object.assign(
|
|
|
1352
1375
|
color: "var(--nice-danger-dark, #d32f2f)"
|
|
1353
1376
|
},
|
|
1354
1377
|
onClick: () => {
|
|
1355
|
-
|
|
1378
|
+
oe(E.idx), D(null);
|
|
1356
1379
|
},
|
|
1357
1380
|
children: [
|
|
1358
1381
|
/* @__PURE__ */ i(p, { name: "trash", size: "sm" }),
|
|
@@ -1364,7 +1387,7 @@ const yt = /* @__PURE__ */ Object.assign(
|
|
|
1364
1387
|
]
|
|
1365
1388
|
}
|
|
1366
1389
|
),
|
|
1367
|
-
|
|
1390
|
+
de && re && /* @__PURE__ */ u(
|
|
1368
1391
|
"div",
|
|
1369
1392
|
{
|
|
1370
1393
|
className: "nice-doc-editor__footer",
|
|
@@ -1378,12 +1401,12 @@ const yt = /* @__PURE__ */ Object.assign(
|
|
|
1378
1401
|
},
|
|
1379
1402
|
children: [
|
|
1380
1403
|
/* @__PURE__ */ u("span", { children: [
|
|
1381
|
-
|
|
1404
|
+
re.words,
|
|
1382
1405
|
" ",
|
|
1383
1406
|
o("docEditor.words", "words")
|
|
1384
1407
|
] }),
|
|
1385
1408
|
/* @__PURE__ */ u("span", { children: [
|
|
1386
|
-
|
|
1409
|
+
re.chars,
|
|
1387
1410
|
" ",
|
|
1388
1411
|
o("docEditor.chars", "characters")
|
|
1389
1412
|
] }),
|
|
@@ -1394,7 +1417,7 @@ const yt = /* @__PURE__ */ Object.assign(
|
|
|
1394
1417
|
] }),
|
|
1395
1418
|
/* @__PURE__ */ u("span", { children: [
|
|
1396
1419
|
"~",
|
|
1397
|
-
|
|
1420
|
+
re.readingTime,
|
|
1398
1421
|
" ",
|
|
1399
1422
|
o("docEditor.readingTime", "min read")
|
|
1400
1423
|
] })
|
|
@@ -1409,5 +1432,5 @@ const yt = /* @__PURE__ */ Object.assign(
|
|
|
1409
1432
|
{ displayName: "NiceDocumentEditor" }
|
|
1410
1433
|
);
|
|
1411
1434
|
export {
|
|
1412
|
-
|
|
1435
|
+
kt as NiceDocumentEditor
|
|
1413
1436
|
};
|