@revolist/ui 4.0.4-rc → 4.0.5-rc
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/OWNERSHIP.md +1 -1
- package/README.md +16 -0
- package/_chunks/arrow-up-Cw8hW9vp.js +4 -0
- package/_chunks/badge.view-D30pMUfi.js +14 -0
- package/_chunks/calculator-CDWOuAcp.js +4 -0
- package/_chunks/{calendar-xpZ0v3xf.js → calendar-DsXIhybL.js} +19 -19
- package/_chunks/chart-frame-CuZABXVI.js +141 -0
- package/_chunks/check-BwI7iCAm.js +4 -0
- package/_chunks/choice-chips-BhP8MZjs.js +126 -0
- package/_chunks/{color-palette-D8vyPfld.js → color-palette-DMJUChWC.js} +20 -22
- package/_chunks/color-picker-B4TQvxxB.js +143 -0
- package/_chunks/{component-C_T2VN5u.js → component-qKctqdzk.js} +281 -265
- package/_chunks/configurator-actions-C19O1rda.js +155 -0
- package/_chunks/configurator-field-icon-CmcM_sPs.js +53 -0
- package/_chunks/{control-AHKXD5Eu.js → control-BkWukVt9.js} +13 -13
- package/_chunks/{controls-DsNi8V8I.js → controls-BLQnWEd7.js} +147 -155
- package/_chunks/{date-control-DrVFX13g.js → date-control-Cgw5PwlZ.js} +1 -1
- package/_chunks/date-time-B8rK5gpC.js +784 -0
- package/_chunks/{dialog.parts-CKGkC5zP.js → dialog.parts-BSbvnEwX.js} +21 -21
- package/_chunks/{duration-CL68Em0o.js → duration-DwFXonEV.js} +1 -4
- package/_chunks/editor-popup-BaaxL89T.js +81 -0
- package/_chunks/field-configurator-1eQP0tKy.js +223 -0
- package/_chunks/icon-toolbar-xbqa0hu9.js +128 -0
- package/_chunks/magnifying-glass-CvrTDSkB.js +4 -0
- package/_chunks/minus-BOAR3A1C.js +4 -0
- package/_chunks/mount-D1i5DLRn.js +266 -0
- package/_chunks/native-control-DO0d1kgx.js +636 -0
- package/_chunks/{number-input-BKwA5FnM.js → number-input-s9ddPwX6.js} +7 -7
- package/_chunks/{picker-h1P5RUgp.js → picker-AY05b41W.js} +2 -2
- package/_chunks/plus-CbGRkIGl.js +4 -0
- package/_chunks/popover-controller-D-AvKQ7B.js +102 -0
- package/_chunks/{popup-CT2uD3go.js → popup-UXGCiv3n.js} +97 -97
- package/_chunks/{rating-choice-DZgmaic0.js → rating-choice-BEs_QFZC.js} +1 -1
- package/_chunks/{reorder-list-CSlqAGHw.js → reorder-list-A49l172e.js} +1 -1
- package/_chunks/request-trail-DCOfa5zw.js +753 -0
- package/_chunks/rich-text-xfMWadGi.js +842 -0
- package/_chunks/rotate-left-BF6G883o.js +4 -0
- package/_chunks/title-tooltip-Cw6LOZhb.js +11 -0
- package/_chunks/tooltip-D4xkio5G.js +54 -0
- package/_chunks/tooltip-owner-DjdvqKzz.js +19 -0
- package/_chunks/tooltip-session-B6X6x8G_.js +110 -0
- package/_chunks/tooltip-text-BXsUEmBH.js +12 -0
- package/_chunks/top-layer-popup-CNSDdfJV.js +59 -0
- package/ai/_chat.scss +28 -3
- package/ai/_style.scss +55 -2
- package/ai/chat.d.ts +3 -1
- package/ai/components.d.ts +13 -2
- package/ai/index.d.ts +1 -0
- package/ai/index.js +3 -3
- package/ai/mount.d.ts +17 -1
- package/ai/results/_style.scss +80 -0
- package/ai/results/index.d.ts +11 -0
- package/ai/results/metrics.d.ts +5 -0
- package/ai/results/table.d.ts +5 -0
- package/ai/results/text.d.ts +5 -0
- package/ai/results/types.d.ts +29 -0
- package/ai/transcript.d.ts +2 -0
- package/ai/translations.d.ts +1 -1
- package/assignee/index.js +2 -2
- package/avatar/index.js +32 -31
- package/badge.view.d.ts +8 -0
- package/brush-range/component.js +28 -27
- package/buttons/svg-button.d.ts +1 -1
- package/buttons/svg-button.js +16 -16
- package/calendar/_calendar.scss +2 -2
- package/calendar/calendar.js +1 -1
- package/calendar/index.js +2 -2
- package/choice-chips/index.d.ts +3 -1
- package/choice-chips/index.js +1 -1
- package/color-palette/color-palette.js +1 -1
- package/color-palette/color-palette.style.scss +1 -1
- package/color-palette/color-picker.js +2 -2
- package/component-catalog.d.ts +6 -1
- package/configurator-actions.d.ts +67 -0
- package/configurator-actions.js +1 -0
- package/configurator-aggregation-list.d.ts +14 -0
- package/configurator-aggregation-list.js +61 -0
- package/configurator-drop-zone.d.ts +38 -0
- package/configurator-drop-zone.js +64 -0
- package/configurator-field-icon.d.ts +10 -0
- package/configurator-field-icon.js +1 -0
- package/configurator-focus.d.ts +4 -0
- package/configurator-focus.js +39 -0
- package/configurator-sections.d.ts +42 -0
- package/configurator-sections.js +71 -0
- package/control-presentation.js +24 -19
- package/controls.d.ts +1 -2
- package/controls.js +4 -3
- package/core/editor-popup.js +1 -1
- package/core/popover-controller.d.ts +35 -0
- package/core/popup-ownership.d.ts +2 -0
- package/core/title-tooltip.d.ts +2 -0
- package/core/tooltip-session.d.ts +29 -0
- package/core/tooltip-surface.d.ts +13 -0
- package/core/tooltip-text.d.ts +6 -0
- package/core/tooltip.d.ts +35 -0
- package/core/top-layer-popup.d.ts +4 -0
- package/core/top-layer-popup.js +1 -23
- package/date-time/index.js +1 -1
- package/date-time/style.scss +50 -7
- package/date-time/time-selection.d.ts +3 -1
- package/dialog/dialog.dom.js +8 -8
- package/dialog/dialog.parts.js +1 -1
- package/distribution-chart/_distribution-chart.scss +1 -57
- package/distribution-chart/area-chart.js +1 -1
- package/distribution-chart/bar-chart.js +1 -1
- package/distribution-chart/line-chart.js +1 -1
- package/dropdown/content.js +1 -1
- package/dropdown/control.js +1 -1
- package/dropdown/index.js +2 -2
- package/dropdown/lookup-field.js +2 -1
- package/dropdown/popup.d.ts +2 -2
- package/dropdown/popup.js +1 -1
- package/duration/index.js +1 -1
- package/editor-actions.js +1 -1
- package/field-configurator.d.ts +19 -0
- package/field-configurator.js +4 -170
- package/field-expansion.d.ts +9 -0
- package/filter/filters/slider/_slider.scss +0 -17
- package/filter/filters/slider/control.js +2 -0
- package/filter/filters/slider/runtime.js +49 -22
- package/filter/filters/slider/single.js +1 -1
- package/filter-badge.js +1 -1
- package/filter-controls.js +1 -1
- package/form-controls/index.js +6 -6
- package/form-controls/presentation.js +12 -12
- package/formatting/control-tooltip.d.ts +2 -27
- package/formatting/index.js +22 -21
- package/formatting/styles.scss +2 -47
- package/framework.js +215 -208
- package/history-controls.js +27 -1
- package/icon-toolbar.d.ts +58 -0
- package/icon-toolbar.js +1 -0
- package/masked-input/index.js +1 -1
- package/native-control.d.ts +1 -2
- package/native-control.js +1 -1
- package/native-styles.css +1 -1
- package/native.js +45 -42
- package/number-input/index.js +1 -1
- package/package.json +36 -1
- package/pagination.js +1 -1
- package/pdf-viewer/index.js +1 -1
- package/pickers.d.ts +5 -1
- package/preact-mount.js +1 -1
- package/preact.d.ts +7 -0
- package/preact.js +68 -61
- package/rating-choice.js +1 -1
- package/react.d.ts +5 -0
- package/react.js +67 -65
- package/reorder-list.js +1 -1
- package/resource-picker/resource-picker-popup.js +1 -1
- package/resource-picker/resource-picker.js +4 -4
- package/rich-text/engine.d.ts +1 -0
- package/rich-text/format-html.d.ts +2 -0
- package/rich-text/index.d.ts +4 -0
- package/rich-text/index.js +1 -1
- package/rich-text/model.d.ts +2 -0
- package/rich-text/style.scss +165 -70
- package/rich-text/syntax.d.ts +5 -0
- package/rich-text/translations.d.ts +2 -0
- package/select.d.ts +3 -1
- package/select.js +1 -1
- package/status-feedback/exit-snapshot.js +4 -4
- package/status-feedback/popover.js +4 -4
- package/styles/_compositions.scss +3 -3
- package/styles/_field-configurator.scss +146 -0
- package/styles/_fields-grid.scss +35 -0
- package/styles/_primitives.scss +25 -18
- package/styles/configurator-actions.scss +141 -0
- package/styles/legacy-pagination.css +19 -2
- package/styles.css +1 -1
- package/surfaces.d.ts +3 -0
- package/surfaces.js +34 -131
- package/surfaces.view.d.ts +4 -34
- package/svelte.js +1 -1
- package/switch/index.js +15 -14
- package/time-grid.js +37 -36
- package/timeline-track/index.js +2 -2
- package/ui.css +1 -1
- package/vue.d.ts +24 -9
- package/vue.js +118 -116
- package/_chunks/chart-frame-Cmc7xU1i.js +0 -130
- package/_chunks/choice-chips-CHQTUdLs.js +0 -110
- package/_chunks/color-picker-CudqPYZo.js +0 -138
- package/_chunks/control-tooltip-uscKfAnV.js +0 -100
- package/_chunks/date-time-qIhp5vaX.js +0 -768
- package/_chunks/editor-popup-WDdtVDNA.js +0 -81
- package/_chunks/history-controls-B3u3INEK.js +0 -27
- package/_chunks/mount-DQ1cpppK.js +0 -257
- package/_chunks/native-control-C_yok8_-.js +0 -605
- package/_chunks/request-trail-DSlFix6i.js +0 -618
- package/_chunks/rich-text-CH7gIqOS.js +0 -636
|
@@ -0,0 +1,842 @@
|
|
|
1
|
+
import { i as e } from "./preact.module-BBM36DnO.js";
|
|
2
|
+
import { c as t, i as n, n as r, r as i, t as a } from "./hooks.module-CG3gN83z.js";
|
|
3
|
+
import { t as o } from "./jsxRuntime.module-F6UFnpT-.js";
|
|
4
|
+
import { createControlId as s } from "../core/control-id.js";
|
|
5
|
+
import { n as c } from "./native-control-DO0d1kgx.js";
|
|
6
|
+
import { t as l } from "./controls-BLQnWEd7.js";
|
|
7
|
+
import { SegmentedSwitch as u } from "../segmented-switch/index.js";
|
|
8
|
+
import { n as d } from "./icon-toolbar-xbqa0hu9.js";
|
|
9
|
+
import { HighlightedTextInput as f } from "../filter-controls.js";
|
|
10
|
+
import { n as p } from "./editor-commit-Bq3wSgvr.js";
|
|
11
|
+
import { EditorActions as m } from "../editor-actions.js";
|
|
12
|
+
//#region src/rich-text/syntax.tsx
|
|
13
|
+
function h({ code: e }) {
|
|
14
|
+
let t = [], n = /<!--[\s\S]*?(?:-->|$)|<\/?[A-Za-z][\w:-]*(?:[^"'<>]|"[^"]*"|'[^']*')*>?/g, r = 0;
|
|
15
|
+
for (let i of e.matchAll(n)) {
|
|
16
|
+
t.push({ text: e.slice(r, i.index) });
|
|
17
|
+
let n = i[0];
|
|
18
|
+
if (n.startsWith("<!--")) t.push({
|
|
19
|
+
text: n,
|
|
20
|
+
kind: "comment"
|
|
21
|
+
});
|
|
22
|
+
else for (let e of n.split(/("[^"]*"|'[^']*'|^<\/?[\w:-]+|\/?>$|[\w:-]+(?=\s*=))/g)) t.push({
|
|
23
|
+
text: e,
|
|
24
|
+
kind: /^["']/.test(e) ? "string" : /^<|^\/?>$/.test(e) ? "tag" : /^[\w:-]+$/.test(e) ? "attribute" : void 0
|
|
25
|
+
});
|
|
26
|
+
r = i.index + n.length;
|
|
27
|
+
}
|
|
28
|
+
return t.push({ text: e.slice(r) }), /* @__PURE__ */ o("code", {
|
|
29
|
+
class: "rv-html-syntax",
|
|
30
|
+
children: t.map((e, t) => /* @__PURE__ */ o("span", {
|
|
31
|
+
class: e.kind ? `rv-html-syntax__${e.kind}` : void 0,
|
|
32
|
+
children: e.text
|
|
33
|
+
}, t))
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
//#endregion
|
|
37
|
+
//#region src/rich-text/model.ts
|
|
38
|
+
var g = /* @__PURE__ */ new Set([
|
|
39
|
+
"p",
|
|
40
|
+
"br",
|
|
41
|
+
"strong",
|
|
42
|
+
"em",
|
|
43
|
+
"s",
|
|
44
|
+
"code",
|
|
45
|
+
"pre",
|
|
46
|
+
"blockquote",
|
|
47
|
+
"ul",
|
|
48
|
+
"ol",
|
|
49
|
+
"li",
|
|
50
|
+
"a",
|
|
51
|
+
"h1",
|
|
52
|
+
"h2",
|
|
53
|
+
"h3",
|
|
54
|
+
"h4",
|
|
55
|
+
"h5",
|
|
56
|
+
"h6"
|
|
57
|
+
]), _ = /* @__PURE__ */ new Set([
|
|
58
|
+
"script",
|
|
59
|
+
"style",
|
|
60
|
+
"iframe",
|
|
61
|
+
"object",
|
|
62
|
+
"embed",
|
|
63
|
+
"svg",
|
|
64
|
+
"math",
|
|
65
|
+
"template",
|
|
66
|
+
"noscript",
|
|
67
|
+
"head",
|
|
68
|
+
"link",
|
|
69
|
+
"meta",
|
|
70
|
+
"base",
|
|
71
|
+
"input",
|
|
72
|
+
"button",
|
|
73
|
+
"textarea",
|
|
74
|
+
"select"
|
|
75
|
+
]), v = {
|
|
76
|
+
b: "strong",
|
|
77
|
+
i: "em",
|
|
78
|
+
strike: "s",
|
|
79
|
+
del: "s",
|
|
80
|
+
div: "p"
|
|
81
|
+
}, y = /* @__PURE__ */ new Set([
|
|
82
|
+
"p",
|
|
83
|
+
"pre",
|
|
84
|
+
"blockquote",
|
|
85
|
+
"ul",
|
|
86
|
+
"ol",
|
|
87
|
+
"li",
|
|
88
|
+
"h1",
|
|
89
|
+
"h2",
|
|
90
|
+
"h3",
|
|
91
|
+
"h4",
|
|
92
|
+
"h5",
|
|
93
|
+
"h6"
|
|
94
|
+
]);
|
|
95
|
+
function b(e) {
|
|
96
|
+
if (!e || /[\u0000-\u0020\u007f]/.test(e)) return !1;
|
|
97
|
+
try {
|
|
98
|
+
return [
|
|
99
|
+
"http:",
|
|
100
|
+
"https:",
|
|
101
|
+
"mailto:"
|
|
102
|
+
].includes(new URL(e, "https://editor.invalid/").protocol);
|
|
103
|
+
} catch {
|
|
104
|
+
return !1;
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
function x(e) {
|
|
108
|
+
for (let t of [...e.children]) t.localName === "br" ? t.replaceWith(t.hasAttribute("data-rv-placeholder") ? "" : "\n") : (x(t), y.has(t.localName) && t.nextSibling && t.after("\n"), t.replaceWith(...t.childNodes));
|
|
109
|
+
}
|
|
110
|
+
function S(e, t = document) {
|
|
111
|
+
let n = t.createElement("template");
|
|
112
|
+
n.innerHTML = e;
|
|
113
|
+
let r = t.createDocumentFragment(), i = (e, n) => {
|
|
114
|
+
if (e.nodeType === 3) {
|
|
115
|
+
if (!e.textContent?.trim() && [
|
|
116
|
+
"ul",
|
|
117
|
+
"ol",
|
|
118
|
+
"blockquote"
|
|
119
|
+
].includes(e.parentElement?.localName ?? "")) return;
|
|
120
|
+
e.textContent && n.appendChild(t.createTextNode(e.textContent));
|
|
121
|
+
return;
|
|
122
|
+
}
|
|
123
|
+
if (e.nodeType !== 1) return;
|
|
124
|
+
let r = e, a = r.localName.toLowerCase();
|
|
125
|
+
if (a === "br" && r.hasAttribute("data-rv-placeholder") || r.namespaceURI !== "http://www.w3.org/1999/xhtml" || _.has(a)) return;
|
|
126
|
+
let o = v[a] ?? a;
|
|
127
|
+
if (!g.has(o) || o === "a" && !b(r.getAttribute("href") ?? "") || o === "p" && [...r.children].some((e) => y.has(v[e.localName] ?? e.localName))) {
|
|
128
|
+
for (let e of r.childNodes) i(e, n);
|
|
129
|
+
return;
|
|
130
|
+
}
|
|
131
|
+
let s = t.createElement(o);
|
|
132
|
+
o === "a" && (s.setAttribute("href", r.getAttribute("href")), s.setAttribute("rel", "noopener noreferrer")), o === "ol" && /^\d{1,9}$/.test(r.getAttribute("start") ?? "") && s.setAttribute("start", r.getAttribute("start"));
|
|
133
|
+
for (let e of r.childNodes) i(e, s);
|
|
134
|
+
if (o === "pre" && x(s), !y.has(o) && o !== "br" && !s.textContent && !s.querySelector("br")) return;
|
|
135
|
+
let c = n.lastChild;
|
|
136
|
+
if ([
|
|
137
|
+
"strong",
|
|
138
|
+
"em",
|
|
139
|
+
"s",
|
|
140
|
+
"code",
|
|
141
|
+
"a"
|
|
142
|
+
].includes(o) && c?.nodeType === 1 && c.cloneNode(!1).isEqualNode(s.cloneNode(!1))) for (; s.firstChild;) c.appendChild(s.firstChild);
|
|
143
|
+
else n.appendChild(s);
|
|
144
|
+
};
|
|
145
|
+
for (let e of n.content.childNodes) i(e, r);
|
|
146
|
+
let a, o = [...r.children].some((e) => y.has(e.localName));
|
|
147
|
+
for (let e of [...r.childNodes]) o && !a && e.nodeType === 3 && !e.textContent?.trim() ? e.remove() : e.nodeType === 1 && y.has(e.localName) ? a = void 0 : (a || (a = t.createElement("p"), r.insertBefore(a, e)), a.appendChild(e));
|
|
148
|
+
return r;
|
|
149
|
+
}
|
|
150
|
+
function C(e, t = document) {
|
|
151
|
+
let n = t.createElement("div");
|
|
152
|
+
return n.appendChild(S(e, t)), n.textContent?.replace(/\u00a0/g, " ").trim() ? n.innerHTML : "";
|
|
153
|
+
}
|
|
154
|
+
//#endregion
|
|
155
|
+
//#region src/rich-text/engine.ts
|
|
156
|
+
var w = {
|
|
157
|
+
formats: [],
|
|
158
|
+
block: null,
|
|
159
|
+
link: !1
|
|
160
|
+
}, T = {
|
|
161
|
+
bold: "strong",
|
|
162
|
+
italic: "em",
|
|
163
|
+
strikethrough: "s",
|
|
164
|
+
code: "code"
|
|
165
|
+
}, E = "p,h1,h2,h3,h4,h5,h6,li,pre";
|
|
166
|
+
function D(e, t, n, r = () => {}) {
|
|
167
|
+
let i = e.ownerDocument, a, o, s = !1, c = [], l = -1, u = 0, d = (e) => e.nodeType === 1 ? e : e.parentElement, f = (e) => {
|
|
168
|
+
let t = d(e)?.closest(E);
|
|
169
|
+
return t?.localName === "p" ? t.closest("li") ?? t : t;
|
|
170
|
+
}, p = (t) => e.contains(t.startContainer) && e.contains(t.endContainer), m = () => {
|
|
171
|
+
let t = i.getSelection();
|
|
172
|
+
if (t?.rangeCount && p(t.getRangeAt(0))) return t.getRangeAt(0).cloneRange();
|
|
173
|
+
if (a && p(a)) return a.cloneRange();
|
|
174
|
+
let n = i.createRange();
|
|
175
|
+
return n.selectNodeContents(e), n.collapse(!1), n;
|
|
176
|
+
}, h = (t) => {
|
|
177
|
+
e.focus({ preventScroll: !0 });
|
|
178
|
+
let n = i.getSelection();
|
|
179
|
+
n?.removeAllRanges(), n?.addRange(t), a = t.cloneRange();
|
|
180
|
+
}, g = (t) => {
|
|
181
|
+
let n = [];
|
|
182
|
+
for (; t !== e && t.parentNode;) n.unshift([...t.parentNode.childNodes].indexOf(t)), t = t.parentNode;
|
|
183
|
+
return n;
|
|
184
|
+
}, _ = () => {
|
|
185
|
+
let e = m();
|
|
186
|
+
return {
|
|
187
|
+
start: {
|
|
188
|
+
path: g(e.startContainer),
|
|
189
|
+
offset: e.startOffset
|
|
190
|
+
},
|
|
191
|
+
end: {
|
|
192
|
+
path: g(e.endContainer),
|
|
193
|
+
offset: e.endOffset
|
|
194
|
+
}
|
|
195
|
+
};
|
|
196
|
+
}, v = (t) => {
|
|
197
|
+
let n = (t) => {
|
|
198
|
+
let n = e;
|
|
199
|
+
for (let e of t.path) {
|
|
200
|
+
if (!n.childNodes[e]) break;
|
|
201
|
+
n = n.childNodes[e];
|
|
202
|
+
}
|
|
203
|
+
return {
|
|
204
|
+
node: n,
|
|
205
|
+
offset: Math.min(t.offset, n.nodeType === 3 ? n.textContent?.length ?? 0 : n.childNodes.length)
|
|
206
|
+
};
|
|
207
|
+
}, r = i.createRange();
|
|
208
|
+
if (t) {
|
|
209
|
+
let e = n(t.start), i = n(t.end);
|
|
210
|
+
r.setStart(e.node, e.offset), r.setEnd(i.node, i.offset);
|
|
211
|
+
} else r.selectNodeContents(e), r.collapse(!1);
|
|
212
|
+
h(r);
|
|
213
|
+
}, y = () => ({
|
|
214
|
+
html: e.innerHTML,
|
|
215
|
+
selection: _()
|
|
216
|
+
}), w = () => {
|
|
217
|
+
let t = m(), n = d(t.startContainer), i = n?.closest("pre,li,h1,h2,h3,h4,h5,h6,blockquote"), a = i?.localName, s = a === "pre" ? "code" : a === "li" ? i.parentElement?.localName === "ol" ? "ordered" : "bullet" : a === "h1" ? "h1" : a?.startsWith("h") ? "h2" : a === "blockquote" || n?.closest("blockquote") ? "quote" : "paragraph";
|
|
218
|
+
r({
|
|
219
|
+
formats: a === "pre" ? [] : o ? [...o] : Object.keys(T).filter((r) => {
|
|
220
|
+
let i = n?.closest(T[r]);
|
|
221
|
+
return !!i && e.contains(i) && (t.collapsed || i.contains(t.endContainer));
|
|
222
|
+
}),
|
|
223
|
+
block: s,
|
|
224
|
+
link: !!n?.closest("a") && e.contains(n.closest("a"))
|
|
225
|
+
});
|
|
226
|
+
}, D = (t = !1) => {
|
|
227
|
+
let r = y(), a = Date.now();
|
|
228
|
+
c[l]?.html === r.html ? c[l] && (c[l].selection = r.selection) : (c = c.slice(0, l + 1), t && a - u < 500 && l > 0 ? c[l] = r : (c.push(r), c.length > 100 && c.shift(), l = c.length - 1)), u = t ? a : 0, n(C(e.innerHTML, i)), w();
|
|
229
|
+
}, O = () => {
|
|
230
|
+
c[l]?.html === e.innerHTML && (c[l].selection = _());
|
|
231
|
+
}, k = () => {
|
|
232
|
+
if (!e.firstChild) {
|
|
233
|
+
let t = i.createElement("p");
|
|
234
|
+
t.appendChild(i.createElement("br")), e.appendChild(t);
|
|
235
|
+
}
|
|
236
|
+
}, A = (t) => {
|
|
237
|
+
e.replaceChildren(S(t, i)), k(), a = void 0, o = void 0, c = [{ html: e.innerHTML }], l = 0, u = 0, w();
|
|
238
|
+
}, j = (t) => {
|
|
239
|
+
let r = l + t;
|
|
240
|
+
if (r < 0 || r >= c.length) return;
|
|
241
|
+
l = r;
|
|
242
|
+
let a = c[r];
|
|
243
|
+
e.replaceChildren(S(a.html, i)), k(), o = void 0, v(a.selection), u = 0, n(C(e.innerHTML, i)), w();
|
|
244
|
+
}, M = (t) => {
|
|
245
|
+
for (; t.parentElement && t.parentElement !== e && !t.parentElement.matches(E + ",blockquote,ul,ol");) {
|
|
246
|
+
let e = t.parentElement, n = e.cloneNode(!1);
|
|
247
|
+
for (; t.nextSibling;) n.appendChild(t.nextSibling);
|
|
248
|
+
e.after(t, n), e.hasChildNodes() || e.remove(), n.hasChildNodes() || n.parentNode?.removeChild(n);
|
|
249
|
+
}
|
|
250
|
+
}, N = (e, t) => {
|
|
251
|
+
let n = i.createComment("end"), r = i.createComment("start"), a = e.cloneRange();
|
|
252
|
+
a.collapse(!1), a.insertNode(n), e.collapse(!0), e.insertNode(r), M(r), M(n);
|
|
253
|
+
let o = i.createRange();
|
|
254
|
+
o.setStartAfter(r), o.setEndBefore(n), t(o);
|
|
255
|
+
let s = i.createRange();
|
|
256
|
+
s.setStartAfter(r), s.setEndBefore(n), r.remove(), n.remove(), h(s);
|
|
257
|
+
}, P = (e) => e.replaceWith(...e.childNodes), F = (e) => {
|
|
258
|
+
let t = e.parentElement, n = t.cloneNode(!1);
|
|
259
|
+
for (; e.nextSibling;) n.appendChild(e.nextSibling);
|
|
260
|
+
t.after(e, n), t.hasChildNodes() || t.remove(), n.hasChildNodes() || n.parentNode?.removeChild(n);
|
|
261
|
+
}, I = (t, n, r, a) => {
|
|
262
|
+
N(t, (t) => {
|
|
263
|
+
for (let r of [...e.querySelectorAll(n)]) t.intersectsNode(r) && !r.closest("pre") && P(r);
|
|
264
|
+
if (!r) {
|
|
265
|
+
let r = i.createTreeWalker(e, NodeFilter.SHOW_TEXT), o = [], s;
|
|
266
|
+
for (; s = r.nextNode();) s.textContent && t.intersectsNode(s) && !s.parentElement?.closest("pre") && o.push(s);
|
|
267
|
+
for (let e of o) {
|
|
268
|
+
let t = i.createElement(n);
|
|
269
|
+
for (let [e, n] of Object.entries(a ?? {})) t.setAttribute(e, n);
|
|
270
|
+
e.replaceWith(t), t.appendChild(e);
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
});
|
|
274
|
+
}, L = (t) => {
|
|
275
|
+
if (!(t in T) || d(m().startContainer)?.closest("pre")) return;
|
|
276
|
+
O(), u = 0;
|
|
277
|
+
let n = m();
|
|
278
|
+
if (n.collapsed) {
|
|
279
|
+
o ||= new Set(Object.keys(T).filter((e) => d(n.startContainer)?.closest(T[e]))), o.has(t) ? o.delete(t) : o.add(t), a = n.cloneRange(), e.focus({ preventScroll: !0 }), w();
|
|
280
|
+
return;
|
|
281
|
+
}
|
|
282
|
+
let r = !!d(n.startContainer)?.closest(T[t]) && !!d(n.endContainer)?.closest(T[t]);
|
|
283
|
+
o = void 0, I(n, T[t], r), D();
|
|
284
|
+
}, R = (t) => {
|
|
285
|
+
O(), o = void 0;
|
|
286
|
+
let n = m(), r = n.collapsed, a = [...e.querySelectorAll(E)].filter((e) => n.intersectsNode(e)), s = a.filter((e) => !a.some((t) => t !== e && (e.contains(t) && t.contains(n.startContainer) && t.contains(n.endContainer) || t.contains(e) && !(e.contains(n.startContainer) && e.contains(n.endContainer)))));
|
|
287
|
+
if (n.collapsed) {
|
|
288
|
+
let t = f(n.startContainer);
|
|
289
|
+
s = t && e.contains(t) ? [t] : [];
|
|
290
|
+
}
|
|
291
|
+
if (!s.length) {
|
|
292
|
+
let e = i.createElement("p");
|
|
293
|
+
e.appendChild(i.createElement("br")), n.insertNode(e), s = [e];
|
|
294
|
+
}
|
|
295
|
+
let c = i.createComment("block-start"), l = i.createComment("block-end"), u = n.cloneRange();
|
|
296
|
+
u.collapse(!1), u.insertNode(l), n.collapse(!0), n.insertNode(c);
|
|
297
|
+
let d, p;
|
|
298
|
+
for (let e of s) if (e.isConnected) {
|
|
299
|
+
if (t === "bullet" || t === "ordered") {
|
|
300
|
+
let n = t === "bullet" ? "ul" : "ol";
|
|
301
|
+
if (e.localName === "li") {
|
|
302
|
+
let t = e.parentElement;
|
|
303
|
+
if (t.localName !== n) {
|
|
304
|
+
let e = i.createElement(n);
|
|
305
|
+
e.append(...t.childNodes), t.replaceWith(e), d = e;
|
|
306
|
+
} else d = t;
|
|
307
|
+
} else {
|
|
308
|
+
d?.nextSibling !== e && (d = i.createElement(n), e.before(d));
|
|
309
|
+
let t = i.createElement("li");
|
|
310
|
+
t.append(...e.childNodes), d.appendChild(t), e.remove();
|
|
311
|
+
}
|
|
312
|
+
} else {
|
|
313
|
+
let n = i.createElement(t === "h1" || t === "h2" ? t : t === "code" ? "pre" : "p");
|
|
314
|
+
if (n.append(...e.childNodes), t === "code") x(n);
|
|
315
|
+
else for (let e of [...n.children]) e.localName === "p" && (e.nextSibling && e.after(i.createElement("br")), P(e));
|
|
316
|
+
if (e.localName === "li" && F(e), e.replaceWith(n), t === "quote") {
|
|
317
|
+
let e = i.createElement("blockquote");
|
|
318
|
+
n.replaceWith(e), e.appendChild(n);
|
|
319
|
+
} else n.parentElement?.localName === "blockquote" && F(n);
|
|
320
|
+
t === "code" && (p?.nextSibling === n ? (p.append("\n", ...n.childNodes), n.remove()) : p = n);
|
|
321
|
+
}
|
|
322
|
+
}
|
|
323
|
+
let g = i.createRange();
|
|
324
|
+
g.setStartBefore(c), g.setEndBefore(l), c.remove(), l.remove(), r && g.collapse(!0), h(g), D();
|
|
325
|
+
}, z = (t, n = !1) => {
|
|
326
|
+
O();
|
|
327
|
+
let r = m();
|
|
328
|
+
r.deleteContents();
|
|
329
|
+
let a = o ? d(r.startContainer)?.closest("a") : void 0, s = a && e.contains(a) ? a.cloneNode(!1) : void 0, c = i.createComment("caret");
|
|
330
|
+
r.insertNode(c), o && M(c);
|
|
331
|
+
let l = i.createDocumentFragment(), u = !!d(c)?.closest("pre"), f = u ? [t.replace(/\r\n?/g, "\n")] : t.replace(/\r\n?/g, "\n").split("\n"), p;
|
|
332
|
+
for (let e = 0; e < f.length; e++) {
|
|
333
|
+
if (e && (p = i.createElement("br"), l.appendChild(p)), !f[e]) continue;
|
|
334
|
+
let t = i.createTextNode(f[e]), n = t;
|
|
335
|
+
for (let e of o ?? []) {
|
|
336
|
+
let t = i.createElement(T[e]);
|
|
337
|
+
t.appendChild(n), n = t;
|
|
338
|
+
}
|
|
339
|
+
if (s) {
|
|
340
|
+
let e = s.cloneNode(!1);
|
|
341
|
+
e.appendChild(n), n = e;
|
|
342
|
+
}
|
|
343
|
+
l.appendChild(n), p = t;
|
|
344
|
+
}
|
|
345
|
+
c.before(l);
|
|
346
|
+
let g = c.nextSibling;
|
|
347
|
+
for (; g?.nodeType === 3 && !g.textContent;) g = g.nextSibling;
|
|
348
|
+
if ((p?.nodeName === "BR" || u && t.endsWith("\n")) && !g) {
|
|
349
|
+
let e = i.createElement("br");
|
|
350
|
+
e.setAttribute("data-rv-placeholder", ""), c.after(e);
|
|
351
|
+
}
|
|
352
|
+
let _ = i.createRange();
|
|
353
|
+
p ? (_.setStartAfter(p), _.collapse(!0)) : (_.setStartBefore(c), _.collapse(!0)), c.remove(), h(_), D(n);
|
|
354
|
+
}, B = (e, t, n = !1) => {
|
|
355
|
+
let r = n ? t ? e.previousElementSibling : e.nextElementSibling : null;
|
|
356
|
+
r || (r = i.createElement("p"), r.appendChild(i.createElement("br")), t ? e.before(r) : e.after(r));
|
|
357
|
+
let a = i.createRange();
|
|
358
|
+
a.selectNodeContents(r), a.collapse(!t), h(a);
|
|
359
|
+
}, V = (e, t, n) => {
|
|
360
|
+
if (!e.collapsed) return !1;
|
|
361
|
+
let r = e.cloneRange();
|
|
362
|
+
return r.selectNodeContents(t), n ? r.setEnd(e.startContainer, e.startOffset) : r.setStart(e.endContainer, e.endOffset), !r.toString();
|
|
363
|
+
}, H = (e) => {
|
|
364
|
+
O();
|
|
365
|
+
let t = m();
|
|
366
|
+
t.deleteContents();
|
|
367
|
+
let n = f(t.startContainer);
|
|
368
|
+
if (n?.localName === "pre") {
|
|
369
|
+
let r = t.cloneRange();
|
|
370
|
+
r.selectNodeContents(n), r.setEnd(t.startContainer, t.startOffset);
|
|
371
|
+
let i = t.cloneRange();
|
|
372
|
+
if (i.setEnd(n, n.childNodes.length), !e && !i.toString() && r.toString().endsWith("\n\n")) {
|
|
373
|
+
let e = r.toString().length;
|
|
374
|
+
n.textContent = r.toString().slice(0, e - 2), o = void 0, B(n, !1), D();
|
|
375
|
+
return;
|
|
376
|
+
}
|
|
377
|
+
o = void 0, z("\n");
|
|
378
|
+
return;
|
|
379
|
+
}
|
|
380
|
+
if (e) {
|
|
381
|
+
z("\n");
|
|
382
|
+
return;
|
|
383
|
+
}
|
|
384
|
+
if (!n) {
|
|
385
|
+
let e = i.createElement("p");
|
|
386
|
+
e.appendChild(i.createElement("br")), t.insertNode(e), t.selectNodeContents(e), t.collapse(!0), h(t), D();
|
|
387
|
+
return;
|
|
388
|
+
}
|
|
389
|
+
if (!n.textContent?.trim()) {
|
|
390
|
+
if (n.localName === "li") {
|
|
391
|
+
U(!0);
|
|
392
|
+
return;
|
|
393
|
+
}
|
|
394
|
+
if (n.closest("blockquote")) {
|
|
395
|
+
R("paragraph");
|
|
396
|
+
return;
|
|
397
|
+
}
|
|
398
|
+
}
|
|
399
|
+
o = void 0;
|
|
400
|
+
let r = t.cloneRange();
|
|
401
|
+
r.setEnd(n, n.childNodes.length);
|
|
402
|
+
let a = /^h[1-6]$/.test(n.localName) && !r.toString() ? "p" : n.localName, s = i.createElement(a);
|
|
403
|
+
s.appendChild(r.extractContents()), !n.textContent && !n.querySelector("br") && n.appendChild(i.createElement("br")), !s.textContent && !s.querySelector("br") && s.appendChild(i.createElement("br")), n.after(s);
|
|
404
|
+
let c = i.createRange();
|
|
405
|
+
c.selectNodeContents(s), c.collapse(!0), h(c), D();
|
|
406
|
+
}, U = (t) => {
|
|
407
|
+
let n = m(), r = d(n.startContainer)?.closest("li");
|
|
408
|
+
if (!r || !e.contains(r)) return !1;
|
|
409
|
+
O();
|
|
410
|
+
let a = r.parentElement, o = {
|
|
411
|
+
node: n.startContainer,
|
|
412
|
+
offset: n.startOffset
|
|
413
|
+
}, s = {
|
|
414
|
+
node: n.endContainer,
|
|
415
|
+
offset: n.endOffset
|
|
416
|
+
};
|
|
417
|
+
if (t) {
|
|
418
|
+
let e = a.parentElement;
|
|
419
|
+
if (e?.localName !== "li") return R("paragraph"), !0;
|
|
420
|
+
let t = a.cloneNode(!1);
|
|
421
|
+
for (; r.nextSibling;) t.appendChild(r.nextSibling);
|
|
422
|
+
t.hasChildNodes() && r.appendChild(t), e.after(r), a.children.length || a.remove();
|
|
423
|
+
} else {
|
|
424
|
+
let e = r.previousElementSibling;
|
|
425
|
+
if (!e) return !1;
|
|
426
|
+
let t = e.lastElementChild;
|
|
427
|
+
t?.localName !== a.localName && (t = i.createElement(a.localName), e.appendChild(t)), t.appendChild(r);
|
|
428
|
+
}
|
|
429
|
+
let c = i.createRange();
|
|
430
|
+
return c.setStart(o.node, o.offset), c.setEnd(s.node, s.offset), h(c), D(), !0;
|
|
431
|
+
}, W = (e) => {
|
|
432
|
+
if (e.isComposing || s) return;
|
|
433
|
+
let t = e.ctrlKey || e.metaKey;
|
|
434
|
+
if (t && !e.altKey) {
|
|
435
|
+
let t = e.key.toLowerCase();
|
|
436
|
+
if (t === "z" || t === "y") {
|
|
437
|
+
e.preventDefault(), e.stopPropagation(), j(t === "y" || e.shiftKey ? 1 : -1);
|
|
438
|
+
return;
|
|
439
|
+
}
|
|
440
|
+
let n = t === "b" ? "bold" : t === "i" ? "italic" : t === "`" ? "code" : t === "x" && e.shiftKey ? "strikethrough" : void 0;
|
|
441
|
+
if (n) {
|
|
442
|
+
e.preventDefault(), e.stopPropagation(), L(n);
|
|
443
|
+
return;
|
|
444
|
+
}
|
|
445
|
+
}
|
|
446
|
+
let n = m(), r = d(n.startContainer), i = r?.closest("pre");
|
|
447
|
+
if (!t && !e.altKey && !e.shiftKey && i && (e.key === "ArrowDown" && V(n, i, !1) || e.key === "ArrowUp" && V(n, i, !0))) e.preventDefault(), e.stopPropagation(), O(), o = void 0, B(i, e.key === "ArrowUp", !0), D();
|
|
448
|
+
else {
|
|
449
|
+
if (!t && !e.altKey && !e.shiftKey && e.key === "ArrowRight" && !i) {
|
|
450
|
+
let t = r?.closest("a,code");
|
|
451
|
+
if (t && V(n, t, !1)) {
|
|
452
|
+
e.preventDefault(), e.stopPropagation(), n.setStartAfter(t), n.collapse(!0), h(n), o = new Set(Object.keys(T).filter((e) => e !== "code" && d(n.startContainer)?.closest(T[e]))), w();
|
|
453
|
+
return;
|
|
454
|
+
}
|
|
455
|
+
}
|
|
456
|
+
if (!t && !e.altKey && e.key === "Backspace") {
|
|
457
|
+
let t = f(n.startContainer);
|
|
458
|
+
if (t && V(n, t, !0) && (t.matches("pre,li,h1,h2,h3,h4,h5,h6") || t.closest("blockquote"))) {
|
|
459
|
+
e.preventDefault(), e.stopPropagation(), t.localName === "li" ? U(!0) : R("paragraph");
|
|
460
|
+
return;
|
|
461
|
+
}
|
|
462
|
+
}
|
|
463
|
+
e.key === "Enter" && !t && !e.altKey && (e.preventDefault(), e.stopPropagation(), H(e.shiftKey)), e.key === "Tab" && !t && !e.altKey && U(e.shiftKey) && (e.preventDefault(), e.stopPropagation()), /^(Arrow|Home|End)/.test(e.key) && (o = void 0, u = 0);
|
|
464
|
+
}
|
|
465
|
+
}, G = (e) => {
|
|
466
|
+
if (!(s || e.isComposing)) {
|
|
467
|
+
if (O(), e.inputType === "historyUndo" || e.inputType === "historyRedo") e.preventDefault(), j(e.inputType === "historyUndo" ? -1 : 1);
|
|
468
|
+
else if (e.inputType.startsWith("format")) {
|
|
469
|
+
e.preventDefault();
|
|
470
|
+
let t = {
|
|
471
|
+
formatBold: "bold",
|
|
472
|
+
formatItalic: "italic",
|
|
473
|
+
formatStrikeThrough: "strikethrough"
|
|
474
|
+
}[e.inputType];
|
|
475
|
+
t && L(t);
|
|
476
|
+
} else e.inputType === "insertParagraph" || e.inputType === "insertLineBreak" ? (e.preventDefault(), H(e.inputType === "insertLineBreak")) : e.inputType === "insertText" && o && e.data && (e.preventDefault(), z(e.data, !0));
|
|
477
|
+
}
|
|
478
|
+
}, K = () => {
|
|
479
|
+
s || (k(), D(!0));
|
|
480
|
+
}, q = () => {
|
|
481
|
+
let t = i.getSelection();
|
|
482
|
+
t?.rangeCount && p(t.getRangeAt(0)) && (a = t.getRangeAt(0).cloneRange(), c[l]?.html === e.innerHTML && (c[l].selection = _()), w());
|
|
483
|
+
}, J = {
|
|
484
|
+
keydown: W,
|
|
485
|
+
beforeinput: G,
|
|
486
|
+
input: K,
|
|
487
|
+
pointerdown: () => {
|
|
488
|
+
o = void 0, u = 0;
|
|
489
|
+
},
|
|
490
|
+
paste: (e) => {
|
|
491
|
+
e.preventDefault(), e.stopPropagation(), o = void 0;
|
|
492
|
+
let t = e.clipboardData?.getData("text/plain");
|
|
493
|
+
t && z(t);
|
|
494
|
+
},
|
|
495
|
+
drop: (e) => {
|
|
496
|
+
e.preventDefault(), o = void 0;
|
|
497
|
+
let t = e.dataTransfer?.getData("text/plain");
|
|
498
|
+
t && z(t);
|
|
499
|
+
},
|
|
500
|
+
compositionstart: () => {
|
|
501
|
+
O(), s = !0;
|
|
502
|
+
},
|
|
503
|
+
compositionend: () => {
|
|
504
|
+
s = !1, k(), D();
|
|
505
|
+
}
|
|
506
|
+
};
|
|
507
|
+
for (let [t, n] of Object.entries(J)) e.addEventListener(t, n);
|
|
508
|
+
return i.addEventListener("selectionchange", q), A(t), {
|
|
509
|
+
setHtml: A,
|
|
510
|
+
format: L,
|
|
511
|
+
block: R,
|
|
512
|
+
focus: () => h(m()),
|
|
513
|
+
captureSelection: () => {
|
|
514
|
+
a = m();
|
|
515
|
+
},
|
|
516
|
+
link: (t) => {
|
|
517
|
+
if (!b(t) || d(m().startContainer)?.closest("pre")) return !1;
|
|
518
|
+
O();
|
|
519
|
+
let n = m();
|
|
520
|
+
if (o = void 0, n.collapsed) {
|
|
521
|
+
let r = d(n.startContainer)?.closest("a");
|
|
522
|
+
if (r && e.contains(r)) r.setAttribute("href", t);
|
|
523
|
+
else {
|
|
524
|
+
let e = i.createElement("a");
|
|
525
|
+
e.setAttribute("href", t), e.setAttribute("rel", "noopener noreferrer"), e.textContent = t, n.insertNode(e), n.selectNodeContents(e), n.collapse(!1), h(n);
|
|
526
|
+
}
|
|
527
|
+
} else I(n, "a", !1, {
|
|
528
|
+
href: t,
|
|
529
|
+
rel: "noopener noreferrer"
|
|
530
|
+
});
|
|
531
|
+
return D(), !0;
|
|
532
|
+
},
|
|
533
|
+
destroy: () => {
|
|
534
|
+
for (let [t, n] of Object.entries(J)) e.removeEventListener(t, n);
|
|
535
|
+
i.removeEventListener("selectionchange", q), a = void 0, c = [];
|
|
536
|
+
}
|
|
537
|
+
};
|
|
538
|
+
}
|
|
539
|
+
//#endregion
|
|
540
|
+
//#region ../../node_modules/.pnpm/@fortawesome+fontawesome-free@7.3.1/node_modules/@fortawesome/fontawesome-free/svgs/solid/bold.svg?raw
|
|
541
|
+
var O = "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 384 512\"><!--! Font Awesome Free 7.3.1 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) Copyright 2026 Fonticons, Inc. --><path fill=\"currentColor\" d=\"M32 32C14.3 32 0 46.3 0 64S14.3 96 32 96l32 0 0 320-32 0c-17.7 0-32 14.3-32 32s14.3 32 32 32l224 0c70.7 0 128-57.3 128-128 0-46.5-24.8-87.3-62-109.7 18.7-22.3 30-51 30-82.3 0-70.7-57.3-128-128-128L32 32zM288 160c0 35.3-28.7 64-64 64l-96 0 0-128 96 0c35.3 0 64 28.7 64 64zM128 416l0-128 128 0c35.3 0 64 28.7 64 64s-28.7 64-64 64l-128 0z\"/></svg>", k = "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 384 512\"><!--! Font Awesome Free 7.3.1 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) Copyright 2026 Fonticons, Inc. --><path fill=\"currentColor\" d=\"M128 64c0-17.7 14.3-32 32-32l192 0c17.7 0 32 14.3 32 32s-14.3 32-32 32l-58.7 0-133.3 320 64 0c17.7 0 32 14.3 32 32s-14.3 32-32 32L32 480c-17.7 0-32-14.3-32-32s14.3-32 32-32l58.7 0 133.3-320-64 0c-17.7 0-32-14.3-32-32z\"/></svg>", A = "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 512 512\"><!--! Font Awesome Free 7.3.1 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) Copyright 2026 Fonticons, Inc. --><path fill=\"currentColor\" d=\"M96 157.5C96 88.2 152.2 32 221.5 32L368 32c17.7 0 32 14.3 32 32s-14.3 32-32 32L221.5 96c-34 0-61.5 27.5-61.5 61.5 0 31 23.1 57.2 53.9 61l44.1 5.5 222 0c17.7 0 32 14.3 32 32s-14.3 32-32 32L32 288c-17.7 0-32-14.3-32-32s14.3-32 32-32l83.1 0C103 204.6 96 181.8 96 157.5zM349.2 336l65.5 0c.9 6.1 1.4 12.2 1.4 18.5 0 69.3-56.2 125.5-125.5 125.5L144 480c-17.7 0-32-14.3-32-32s14.3-32 32-32l146.5 0c34 0 61.5-27.5 61.5-61.5 0-6.4-1-12.7-2.8-18.5z\"/></svg>", j = "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 576 512\"><!--! Font Awesome Free 7.3.1 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) Copyright 2026 Fonticons, Inc. --><path fill=\"currentColor\" d=\"M360.8 1.2c-17-4.9-34.7 5-39.6 22l-128 448c-4.9 17 5 34.7 22 39.6s34.7-5 39.6-22l128-448c4.9-17-5-34.7-22-39.6zm64.6 136.1c-12.5 12.5-12.5 32.8 0 45.3l73.4 73.4-73.4 73.4c-12.5 12.5-12.5 32.8 0 45.3s32.8 12.5 45.3 0l96-96c12.5-12.5 12.5-32.8 0-45.3l-96-96c-12.5-12.5-32.8-12.5-45.3 0zm-274.7 0c-12.5-12.5-32.8-12.5-45.3 0l-96 96c-12.5 12.5-12.5 32.8 0 45.3l96 96c12.5 12.5 32.8 12.5 45.3 0s12.5-32.8 0-45.3L77.3 256 150.6 182.6c12.5-12.5 12.5-32.8 0-45.3z\"/></svg>", M = "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 448 512\"><!--! Font Awesome Free 7.3.1 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) Copyright 2026 Fonticons, Inc. --><path fill=\"currentColor\" d=\"M0 64C0 46.3 14.3 32 32 32l96 0c17.7 0 32 14.3 32 32s-14.3 32-32 32l-16 0 0 112 224 0 0-112-16 0c-17.7 0-32-14.3-32-32s14.3-32 32-32l96 0c17.7 0 32 14.3 32 32s-14.3 32-32 32l-16 0 0 320 16 0c17.7 0 32 14.3 32 32s-14.3 32-32 32l-96 0c-17.7 0-32-14.3-32-32s14.3-32 32-32l16 0 0-144-224 0 0 144 16 0c17.7 0 32 14.3 32 32s-14.3 32-32 32l-96 0c-17.7 0-32-14.3-32-32s14.3-32 32-32l16 0 0-320-16 0C14.3 96 0 81.7 0 64z\"/></svg>", N = "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 256 512\"><!--! Font Awesome Free 7.3.1 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) Copyright 2026 Fonticons, Inc. --><path fill=\"currentColor\" d=\"M32 32C14.3 32 0 46.3 0 64S14.3 96 32 96l64 0 0 320-64 0c-17.7 0-32 14.3-32 32s14.3 32 32 32l192 0c17.7 0 32-14.3 32-32s-14.3-32-32-32l-64 0 0-352c0-17.7-14.3-32-32-32L32 32z\"/></svg>", P = "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 384 512\"><!--! Font Awesome Free 7.3.1 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) Copyright 2026 Fonticons, Inc. --><path fill=\"currentColor\" d=\"M48 64c0-17.7 14.3-32 32-32l171 0c60.2 0 109 48.8 109 109 0 43.8-26.2 83.3-66.4 100.4l-139.1 59C119 315.4 96 350.2 96 388.7l0 27.3 224 0c17.7 0 32 14.3 32 32s-14.3 32-32 32L64 480c-17.7 0-32-14.3-32-32l0-59.3c0-64.2 38.4-122.2 97.5-147.3l139.1-59c16.6-7.1 27.4-23.4 27.4-41.4 0-24.9-20.2-45-45-45L80 96C62.3 96 48 81.7 48 64z\"/></svg>", F = "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 512 512\"><!--! Font Awesome Free 7.3.1 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) Copyright 2026 Fonticons, Inc. --><path fill=\"currentColor\" d=\"M48 144a48 48 0 1 0 0-96 48 48 0 1 0 0 96zM192 64c-17.7 0-32 14.3-32 32s14.3 32 32 32l288 0c17.7 0 32-14.3 32-32s-14.3-32-32-32L192 64zm0 160c-17.7 0-32 14.3-32 32s14.3 32 32 32l288 0c17.7 0 32-14.3 32-32s-14.3-32-32-32l-288 0zm0 160c-17.7 0-32 14.3-32 32s14.3 32 32 32l288 0c17.7 0 32-14.3 32-32s-14.3-32-32-32l-288 0zM48 464a48 48 0 1 0 0-96 48 48 0 1 0 0 96zM96 256a48 48 0 1 0 -96 0 48 48 0 1 0 96 0z\"/></svg>", I = "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 512 512\"><!--! Font Awesome Free 7.3.1 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) Copyright 2026 Fonticons, Inc. --><path fill=\"currentColor\" d=\"M0 72C0 58.8 10.7 48 24 48l48 0c13.3 0 24 10.7 24 24l0 104 24 0c13.3 0 24 10.7 24 24s-10.7 24-24 24l-96 0c-13.3 0-24-10.7-24-24s10.7-24 24-24l24 0 0-80-24 0C10.7 96 0 85.3 0 72zM30.4 301.2C41.8 292.6 55.7 288 70 288l4.9 0c33.7 0 61.1 27.4 61.1 61.1 0 19.6-9.4 37.9-25.2 49.4l-24 17.5 33.2 0c13.3 0 24 10.7 24 24s-10.7 24-24 24l-90.7 0C13.1 464 0 450.9 0 434.7 0 425.3 4.5 416.5 12.1 411l70.5-51.3c3.4-2.5 5.4-6.4 5.4-10.6 0-7.2-5.9-13.1-13.1-13.1L70 336c-3.9 0-7.7 1.3-10.8 3.6L38.4 355.2c-10.6 8-25.6 5.8-33.6-4.8S-1 324.8 9.6 316.8l20.8-15.6zM224 64l256 0c17.7 0 32 14.3 32 32s-14.3 32-32 32l-256 0c-17.7 0-32-14.3-32-32s14.3-32 32-32zm0 160l256 0c17.7 0 32 14.3 32 32s-14.3 32-32 32l-256 0c-17.7 0-32-14.3-32-32s14.3-32 32-32zm0 160l256 0c17.7 0 32 14.3 32 32s-14.3 32-32 32l-256 0c-17.7 0-32-14.3-32-32s14.3-32 32-32z\"/></svg>", L = "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 448 512\"><!--! Font Awesome Free 7.3.1 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) Copyright 2026 Fonticons, Inc. --><path fill=\"currentColor\" d=\"M0 216C0 149.7 53.7 96 120 96l8 0c17.7 0 32 14.3 32 32s-14.3 32-32 32l-8 0c-30.9 0-56 25.1-56 56l0 8 64 0c35.3 0 64 28.7 64 64l0 64c0 35.3-28.7 64-64 64l-64 0c-35.3 0-64-28.7-64-64L0 216zm256 0c0-66.3 53.7-120 120-120l8 0c17.7 0 32 14.3 32 32s-14.3 32-32 32l-8 0c-30.9 0-56 25.1-56 56l0 8 64 0c35.3 0 64 28.7 64 64l0 64c0 35.3-28.7 64-64 64l-64 0c-35.3 0-64-28.7-64-64l0-136z\"/></svg>", R = "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 384 512\"><!--! Font Awesome Free 7.3.1 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) Copyright 2026 Fonticons, Inc. --><path fill=\"currentColor\" d=\"M0 64C0 28.7 28.7 0 64 0L213.5 0c17 0 33.3 6.7 45.3 18.7L365.3 125.3c12 12 18.7 28.3 18.7 45.3L384 448c0 35.3-28.7 64-64 64L64 512c-35.3 0-64-28.7-64-64L0 64zm208-5.5l0 93.5c0 13.3 10.7 24 24 24L325.5 176 208 58.5zM154.2 295.6c8.6-10.1 7.5-25.2-2.6-33.8s-25.2-7.5-33.8 2.6l-48 56c-7.7 9-7.7 22.2 0 31.2l48 56c8.6 10.1 23.8 11.2 33.8 2.6s11.2-23.8 2.6-33.8l-34.6-40.4 34.6-40.4zm112-31.2c-8.6-10.1-23.8-11.2-33.8-2.6s-11.2 23.8-2.6 33.8l34.6 40.4-34.6 40.4c-8.6 10.1-7.5 25.2 2.6 33.8s25.2 7.5 33.8-2.6l48-56c7.7-9 7.7-22.2 0-31.2l-48-56z\"/></svg>", z = "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 576 512\"><!--! Font Awesome Free 7.3.1 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) Copyright 2026 Fonticons, Inc. --><path fill=\"currentColor\" d=\"M419.5 96c-16.6 0-32.7 4.5-46.8 12.7-15.8-16-34.2-29.4-54.5-39.5 28.2-24 64.1-37.2 101.3-37.2 86.4 0 156.5 70 156.5 156.5 0 41.5-16.5 81.3-45.8 110.6l-71.1 71.1c-29.3 29.3-69.1 45.8-110.6 45.8-86.4 0-156.5-70-156.5-156.5 0-1.5 0-3 .1-4.5 .5-17.7 15.2-31.6 32.9-31.1s31.6 15.2 31.1 32.9c0 .9 0 1.8 0 2.6 0 51.1 41.4 92.5 92.5 92.5 24.5 0 48-9.7 65.4-27.1l71.1-71.1c17.3-17.3 27.1-40.9 27.1-65.4 0-51.1-41.4-92.5-92.5-92.5zM275.2 173.3c-1.9-.8-3.8-1.9-5.5-3.1-12.6-6.5-27-10.2-42.1-10.2-24.5 0-48 9.7-65.4 27.1L91.1 258.2c-17.3 17.3-27.1 40.9-27.1 65.4 0 51.1 41.4 92.5 92.5 92.5 16.5 0 32.6-4.4 46.7-12.6 15.8 16 34.2 29.4 54.6 39.5-28.2 23.9-64 37.2-101.3 37.2-86.4 0-156.5-70-156.5-156.5 0-41.5 16.5-81.3 45.8-110.6l71.1-71.1c29.3-29.3 69.1-45.8 110.6-45.8 86.6 0 156.5 70.6 156.5 156.9 0 1.3 0 2.6 0 3.9-.4 17.7-15.1 31.6-32.8 31.2s-31.6-15.1-31.2-32.8c0-.8 0-1.5 0-2.3 0-33.7-18-63.3-44.8-79.6z\"/></svg>";
|
|
542
|
+
//#endregion
|
|
543
|
+
//#region src/rich-text/toolbar.tsx
|
|
544
|
+
function B({ engine: e, selection: t, text: n, showLink: r, onLink: s }) {
|
|
545
|
+
let c = a(null), l = a(null), u = () => [...c.current?.querySelectorAll("[role=\"button\"]:not([aria-disabled=\"true\"])") ?? []], f = (e) => {
|
|
546
|
+
l.current = e.getAttribute("aria-label");
|
|
547
|
+
for (let t of u()) t.setAttribute("tabindex", t === e ? "0" : "-1");
|
|
548
|
+
};
|
|
549
|
+
i(() => {
|
|
550
|
+
let e = u(), t = e.find((e) => e.getAttribute("aria-label") === l.current) ?? e[0];
|
|
551
|
+
t && f(t);
|
|
552
|
+
});
|
|
553
|
+
let p = (n, r, i) => ({
|
|
554
|
+
id: n,
|
|
555
|
+
label: r,
|
|
556
|
+
icon: i,
|
|
557
|
+
pressed: t.formats.includes(n),
|
|
558
|
+
disabled: t.block === "code",
|
|
559
|
+
run: () => e()?.format(n)
|
|
560
|
+
}), m = (n, r, i, a) => ({
|
|
561
|
+
id: n,
|
|
562
|
+
label: r,
|
|
563
|
+
icon: i,
|
|
564
|
+
suffixIcon: a,
|
|
565
|
+
pressed: t.block === n,
|
|
566
|
+
run: () => e()?.block(t.block === n ? "paragraph" : n)
|
|
567
|
+
}), h = [
|
|
568
|
+
{
|
|
569
|
+
label: n.inlineFormatting,
|
|
570
|
+
actions: [
|
|
571
|
+
p("bold", n.bold, O),
|
|
572
|
+
p("italic", n.italic, k),
|
|
573
|
+
p("strikethrough", n.strike, A),
|
|
574
|
+
p("code", n.code, j)
|
|
575
|
+
]
|
|
576
|
+
},
|
|
577
|
+
{
|
|
578
|
+
label: n.headings,
|
|
579
|
+
actions: [m("h1", n.heading1, M, N), m("h2", n.heading2, M, P)]
|
|
580
|
+
},
|
|
581
|
+
{
|
|
582
|
+
label: n.structure,
|
|
583
|
+
actions: [
|
|
584
|
+
m("bullet", n.bullets, F),
|
|
585
|
+
m("ordered", n.numberedList, I),
|
|
586
|
+
m("quote", n.quote, L),
|
|
587
|
+
m("code", n.codeBlock, R)
|
|
588
|
+
]
|
|
589
|
+
},
|
|
590
|
+
{
|
|
591
|
+
label: n.links,
|
|
592
|
+
actions: [{
|
|
593
|
+
id: "link",
|
|
594
|
+
label: n.link,
|
|
595
|
+
icon: z,
|
|
596
|
+
pressed: r || t.link,
|
|
597
|
+
disabled: t.block === "code",
|
|
598
|
+
run: s
|
|
599
|
+
}]
|
|
600
|
+
}
|
|
601
|
+
];
|
|
602
|
+
return /* @__PURE__ */ o("div", {
|
|
603
|
+
ref: c,
|
|
604
|
+
class: "rv-rich-text-editor__toolbar",
|
|
605
|
+
role: "toolbar",
|
|
606
|
+
"aria-label": n.formatting,
|
|
607
|
+
onMouseDown: (e) => {
|
|
608
|
+
e.target.closest("[role=\"button\"]") && e.preventDefault();
|
|
609
|
+
},
|
|
610
|
+
onFocusCapture: (e) => {
|
|
611
|
+
e.target instanceof SVGElement && e.target.matches("[role=\"button\"]") && f(e.target);
|
|
612
|
+
},
|
|
613
|
+
onKeyDown: (t) => {
|
|
614
|
+
if (t.key === "Escape") {
|
|
615
|
+
t.preventDefault(), t.stopPropagation(), e()?.focus();
|
|
616
|
+
return;
|
|
617
|
+
}
|
|
618
|
+
if (![
|
|
619
|
+
"ArrowLeft",
|
|
620
|
+
"ArrowRight",
|
|
621
|
+
"Home",
|
|
622
|
+
"End"
|
|
623
|
+
].includes(t.key) || t.altKey || t.ctrlKey || t.metaKey) return;
|
|
624
|
+
let n = u(), r = n.indexOf(t.target);
|
|
625
|
+
if (r < 0 || !n.length) return;
|
|
626
|
+
t.preventDefault(), t.stopPropagation();
|
|
627
|
+
let i = getComputedStyle(c.current).direction === "rtl", a = t.key === "ArrowRight" === i ? -1 : 1;
|
|
628
|
+
(t.key === "Home" ? n[0] : t.key === "End" ? n.at(-1) : n[(r + a + n.length) % n.length]).focus();
|
|
629
|
+
},
|
|
630
|
+
children: h.map((t) => /* @__PURE__ */ o(d, {
|
|
631
|
+
label: t.label,
|
|
632
|
+
actions: t.actions,
|
|
633
|
+
onEscape: () => e()?.focus(),
|
|
634
|
+
onAction: (e) => t.actions.find((t) => t.id === e)?.run()
|
|
635
|
+
}, t.label))
|
|
636
|
+
});
|
|
637
|
+
}
|
|
638
|
+
//#endregion
|
|
639
|
+
//#region src/rich-text/format-html.ts
|
|
640
|
+
function V(e, t = document) {
|
|
641
|
+
if (!e) return "";
|
|
642
|
+
let n = t.createElement("template");
|
|
643
|
+
n.innerHTML = e;
|
|
644
|
+
let r = /* @__PURE__ */ new Set([
|
|
645
|
+
"p",
|
|
646
|
+
"h1",
|
|
647
|
+
"h2",
|
|
648
|
+
"h3",
|
|
649
|
+
"h4",
|
|
650
|
+
"h5",
|
|
651
|
+
"h6",
|
|
652
|
+
"blockquote",
|
|
653
|
+
"ul",
|
|
654
|
+
"ol",
|
|
655
|
+
"li",
|
|
656
|
+
"pre"
|
|
657
|
+
]), i = (e) => {
|
|
658
|
+
let n = t.createElement("div");
|
|
659
|
+
return n.append(e.cloneNode(!0)), n.innerHTML;
|
|
660
|
+
}, a = (e, t) => {
|
|
661
|
+
let n = [], o = " ".repeat(t), s = "", c = () => {
|
|
662
|
+
s.trim() && n.push(o + s), s = "";
|
|
663
|
+
};
|
|
664
|
+
for (let l of e) {
|
|
665
|
+
if (l.nodeType !== 1 || !r.has(l.localName)) {
|
|
666
|
+
s += i(l);
|
|
667
|
+
continue;
|
|
668
|
+
}
|
|
669
|
+
c();
|
|
670
|
+
let e = l, u = [...e.childNodes].every((e) => e.nodeType === 1 ? r.has(e.localName) : e.nodeType === 3 && !e.textContent?.trim());
|
|
671
|
+
if (e.localName !== "pre" && e.children.length && u) {
|
|
672
|
+
let r = e.cloneNode(!1), i = r.outerHTML.slice(0, r.outerHTML.indexOf(">") + 1);
|
|
673
|
+
n.push(o + i, ...a([...e.childNodes], t + 1), `${o}</${e.localName}>`);
|
|
674
|
+
} else n.push(o + e.outerHTML);
|
|
675
|
+
}
|
|
676
|
+
return c(), n;
|
|
677
|
+
};
|
|
678
|
+
return a([...n.content.childNodes], 0).join("\n");
|
|
679
|
+
}
|
|
680
|
+
//#endregion
|
|
681
|
+
//#region src/rich-text/translations.ts
|
|
682
|
+
var H = {
|
|
683
|
+
keyboardHelp: "Shift+Enter for a line break. Alt+F10 for formatting; Esc returns to text.",
|
|
684
|
+
codeHelp: "Code: Enter for a new line. Press Enter three times or ↓ at the end to continue outside.",
|
|
685
|
+
visual: "Visual",
|
|
686
|
+
source: "HTML",
|
|
687
|
+
label: "Rich text",
|
|
688
|
+
unsafeLink: "Use an HTTP, HTTPS, mailto or relative link.",
|
|
689
|
+
requiredValue: "Enter a value.",
|
|
690
|
+
tooLong: "The value exceeds the maximum length.",
|
|
691
|
+
link: "Add link",
|
|
692
|
+
linkUrl: "Link URL",
|
|
693
|
+
popupLabel: "Edit rich text",
|
|
694
|
+
formatting: "Text formatting",
|
|
695
|
+
inlineFormatting: "Inline formatting",
|
|
696
|
+
headings: "Headings",
|
|
697
|
+
structure: "Lists and blocks",
|
|
698
|
+
links: "Links",
|
|
699
|
+
bold: "Bold",
|
|
700
|
+
italic: "Italic",
|
|
701
|
+
strike: "Strike",
|
|
702
|
+
code: "Code",
|
|
703
|
+
heading1: "H1",
|
|
704
|
+
heading2: "H2",
|
|
705
|
+
bullets: "Bullets",
|
|
706
|
+
numberedList: "Numbered list",
|
|
707
|
+
quote: "Quote",
|
|
708
|
+
codeBlock: "Code block"
|
|
709
|
+
}, U = /* @__PURE__ */ new Map();
|
|
710
|
+
function W(e) {
|
|
711
|
+
let t = U.get(e);
|
|
712
|
+
if (t) return t;
|
|
713
|
+
let n = (e) => e.nodeType === 3 ? { text: e.textContent ?? "" } : {
|
|
714
|
+
tag: e.localName,
|
|
715
|
+
attrs: Object.fromEntries([...e.attributes].map((e) => [e.name, e.value])),
|
|
716
|
+
children: [...e.childNodes].map(n)
|
|
717
|
+
}, r = [...S(e).childNodes].map(n);
|
|
718
|
+
return e.length <= 5e4 && (U.size >= 100 && U.delete(U.keys().next().value), U.set(e, r)), r;
|
|
719
|
+
}
|
|
720
|
+
//#endregion
|
|
721
|
+
//#region src/rich-text/index.tsx
|
|
722
|
+
function G(i) {
|
|
723
|
+
let [d] = n(() => s("rv-rich-text-help")), g = a(i.value), _ = {
|
|
724
|
+
...H,
|
|
725
|
+
...i.text
|
|
726
|
+
}, v = r(() => C(i.value), [i.value]), [y, b] = n(v), x = r(() => C(y), [y]), [S, T] = n("visual"), [E, O] = n(""), [k, A] = n(w), [j, M] = n(""), [N, P] = n(!1), F = a(!1), I = a(null), L = a(), R = a(y);
|
|
727
|
+
R.current = y, t(() => {
|
|
728
|
+
if (I.current) return L.current = D(I.current, R.current, (e) => {
|
|
729
|
+
F.current = !0, R.current = e, b(e), O("");
|
|
730
|
+
}, A), () => {
|
|
731
|
+
L.current?.destroy(), L.current = void 0;
|
|
732
|
+
};
|
|
733
|
+
}, []), t(() => {
|
|
734
|
+
g.current !== i.value && (g.current = i.value, F.current = !1, R.current = S === "source" ? (i.formatSource ?? V)(v) : v, b(R.current), O(""), P(!1), L.current?.setHtml(v));
|
|
735
|
+
}, [i.value, v]);
|
|
736
|
+
let z = (e) => i.required && !e ? "requiredValue" : i.maxLength !== void 0 && e.length > i.maxLength ? "tooLong" : void 0, U = () => {
|
|
737
|
+
let e = C(R.current), t = z(e);
|
|
738
|
+
return t ? (O(_[t]), !1) : (i.onApply(e), !0);
|
|
739
|
+
};
|
|
740
|
+
p(() => !F.current || R.current === v || U(), i.autoApply !== !1);
|
|
741
|
+
let W = !!z(x);
|
|
742
|
+
return /* @__PURE__ */ o("div", {
|
|
743
|
+
class: "rv-rich-text-editor",
|
|
744
|
+
onKeyDown: (e) => {
|
|
745
|
+
e.altKey && e.key === "F10" && S === "visual" && (e.preventDefault(), e.stopPropagation(), L.current?.captureSelection(), e.currentTarget.querySelector("[role=\"toolbar\"] [role=\"button\"][tabindex=\"0\"]")?.focus()), (e.ctrlKey || e.metaKey) && e.key === "Enter" && !e.isComposing && (e.preventDefault(), e.stopPropagation(), U());
|
|
746
|
+
},
|
|
747
|
+
children: [
|
|
748
|
+
/* @__PURE__ */ o(u, {
|
|
749
|
+
value: S,
|
|
750
|
+
ariaLabel: _.label,
|
|
751
|
+
options: [{
|
|
752
|
+
value: "visual",
|
|
753
|
+
label: _.visual
|
|
754
|
+
}, {
|
|
755
|
+
value: "source",
|
|
756
|
+
label: _.source
|
|
757
|
+
}],
|
|
758
|
+
onChange: (e) => {
|
|
759
|
+
if (e === "visual") {
|
|
760
|
+
let e = C(R.current);
|
|
761
|
+
R.current = e, b(e), L.current?.setHtml(e);
|
|
762
|
+
} else {
|
|
763
|
+
L.current?.captureSelection();
|
|
764
|
+
let e = (i.formatSource ?? V)(R.current);
|
|
765
|
+
R.current = e, b(e);
|
|
766
|
+
}
|
|
767
|
+
T(e), O("");
|
|
768
|
+
}
|
|
769
|
+
}),
|
|
770
|
+
S === "visual" && /* @__PURE__ */ o(B, {
|
|
771
|
+
engine: () => L.current,
|
|
772
|
+
selection: k,
|
|
773
|
+
text: _,
|
|
774
|
+
showLink: N,
|
|
775
|
+
onLink: () => {
|
|
776
|
+
L.current?.captureSelection(), P(!N);
|
|
777
|
+
}
|
|
778
|
+
}),
|
|
779
|
+
N && S === "visual" && /* @__PURE__ */ o("div", {
|
|
780
|
+
class: "rv-rich-text-editor__link",
|
|
781
|
+
children: [/* @__PURE__ */ o(c, {
|
|
782
|
+
"aria-label": _.linkUrl,
|
|
783
|
+
value: j,
|
|
784
|
+
onInput: (e) => M(e.currentTarget.value)
|
|
785
|
+
}), /* @__PURE__ */ o(l, {
|
|
786
|
+
onMouseDown: (e) => e.preventDefault(),
|
|
787
|
+
onClick: () => {
|
|
788
|
+
L.current?.link(j) ? (P(!1), O("")) : O(_.unsafeLink);
|
|
789
|
+
},
|
|
790
|
+
children: _.link
|
|
791
|
+
})]
|
|
792
|
+
}),
|
|
793
|
+
/* @__PURE__ */ o("div", {
|
|
794
|
+
ref: I,
|
|
795
|
+
hidden: S !== "visual",
|
|
796
|
+
class: "rv-rich-text-editor__visual",
|
|
797
|
+
role: "textbox",
|
|
798
|
+
"aria-label": _.label,
|
|
799
|
+
"aria-multiline": "true",
|
|
800
|
+
"aria-describedby": d,
|
|
801
|
+
"aria-invalid": W || void 0,
|
|
802
|
+
contentEditable: !0,
|
|
803
|
+
onClick: (e) => {
|
|
804
|
+
e.target.closest("a") && e.preventDefault();
|
|
805
|
+
}
|
|
806
|
+
}),
|
|
807
|
+
S === "visual" && /* @__PURE__ */ o("p", {
|
|
808
|
+
id: d,
|
|
809
|
+
class: "rv-rich-text-editor__help",
|
|
810
|
+
children: k.block === "code" ? _.codeHelp : _.keyboardHelp
|
|
811
|
+
}),
|
|
812
|
+
S === "source" && /* @__PURE__ */ o(f, {
|
|
813
|
+
className: "rv-rich-text-editor__source",
|
|
814
|
+
"aria-label": _.source,
|
|
815
|
+
"aria-invalid": W || void 0,
|
|
816
|
+
value: y,
|
|
817
|
+
wrap: "off",
|
|
818
|
+
highlight: /* @__PURE__ */ o(e, { children: [/* @__PURE__ */ o(h, { code: y }), y.endsWith("\n") ? " " : ""] }),
|
|
819
|
+
onInput: (e) => {
|
|
820
|
+
F.current = !0, R.current = e.currentTarget.value, b(e.currentTarget.value), O("");
|
|
821
|
+
}
|
|
822
|
+
}),
|
|
823
|
+
E && /* @__PURE__ */ o("p", {
|
|
824
|
+
class: "rv-editor-error",
|
|
825
|
+
role: "alert",
|
|
826
|
+
children: E
|
|
827
|
+
}),
|
|
828
|
+
/* @__PURE__ */ o(m, {
|
|
829
|
+
showConfirm: i.showActions ?? i.autoApply === !1,
|
|
830
|
+
text: i.actions,
|
|
831
|
+
disabled: W,
|
|
832
|
+
cancel: i.onCancel,
|
|
833
|
+
apply: U,
|
|
834
|
+
clear: i.required ? void 0 : () => {
|
|
835
|
+
F.current = !0, R.current = "", b(""), L.current?.setHtml(""), O(""), i.autoApply !== !1 && U();
|
|
836
|
+
}
|
|
837
|
+
})
|
|
838
|
+
]
|
|
839
|
+
});
|
|
840
|
+
}
|
|
841
|
+
//#endregion
|
|
842
|
+
export { b as a, V as i, W as n, C as o, H as r, h as s, G as t };
|