vlite3 1.5.50 → 1.5.52
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/components/CategoryManager/CategoryManager2.vue.js +2 -2
- package/components/CommandPalette/CommandPaletteContent2.vue.js +1 -1
- package/components/CommandPalette/{CommandPaletteItem2.vue.js → CommandPaletteItem.vue.js} +1 -1
- package/components/Form/Form.vue.d.ts +3 -0
- package/components/Form/Form.vue.js +1 -1
- package/components/Form/Form2.vue.js +292 -276
- package/components/Form/composables/useCustomFieldRows.d.ts +3 -0
- package/components/Form/composables/useCustomFieldRows.js +109 -58
- package/components/Form/composables/useForm.d.ts +4 -1
- package/components/Form/composables/useForm.js +249 -187
- package/components/Form/index.vue.d.ts +2 -0
- package/components/Form/index.vue.js +2 -2
- package/components/Form/index2.vue.js +12 -8
- package/components/Form/types.d.ts +2 -0
- package/components/NavbarCommandPalette.vue.js +1 -1
- package/components/RichTextEditor/RichTextEditor.vue.d.ts +58 -0
- package/components/RichTextEditor/RichTextEditor.vue.js +309 -180
- package/components/RichTextEditor/RichTextLinkPopover.vue.d.ts +3 -8
- package/components/RichTextEditor/RichTextLinkPopover3.vue.js +2 -2
- package/components/RichTextEditor/RichTextToolbar3.vue.js +2 -2
- package/components/RichTextEditor/index.d.ts +1 -1
- package/components/RichTextEditor/types.d.ts +22 -0
- package/components/Screen/ScreenFilter.vue.js +2 -2
- package/components/Screen/components/ScreenToolbar.vue.d.ts +2 -2
- package/directives/ScrollReveal/ScrollRevealPager.js +76 -76
- package/docs/components/rich-text-editor.md +33 -2
- package/docs-manifest.json +3 -3
- package/package.json +1 -1
- package/style.css +1 -1
- /package/components/RichTextEditor/{RichTextLinkPopover2.vue.js → RichTextLinkPopover.vue.js} +0 -0
- /package/components/RichTextEditor/{RichTextToolbar2.vue.js → RichTextToolbar.vue.js} +0 -0
|
@@ -1,15 +1,17 @@
|
|
|
1
|
-
import { defineComponent as
|
|
1
|
+
import { defineComponent as Ie, shallowRef as U, ref as _, computed as D, watch as ee, onMounted as Ne, onUnmounted as Oe, openBlock as F, createElementBlock as V, normalizeClass as Pe, toDisplayString as te, createCommentVNode as ne, createElementVNode as $, createVNode as ve, unref as u, normalizeStyle as Be } from "vue";
|
|
2
2
|
/* empty css */
|
|
3
|
-
import
|
|
4
|
-
/* empty css
|
|
5
|
-
import
|
|
6
|
-
/* empty css
|
|
7
|
-
import { useRichTextImageUpload as
|
|
8
|
-
import { useRichTextLinks as
|
|
9
|
-
|
|
3
|
+
import Ue from "./RichTextToolbar.vue.js";
|
|
4
|
+
/* empty css */
|
|
5
|
+
import De from "./RichTextLinkPopover.vue.js";
|
|
6
|
+
/* empty css */
|
|
7
|
+
import { useRichTextImageUpload as Fe } from "./composables/useRichTextImageUpload.js";
|
|
8
|
+
import { useRichTextLinks as Ve } from "./composables/useRichTextLinks.js";
|
|
9
|
+
import { resolveRichTextTools as $e } from "./types.js";
|
|
10
|
+
const je = ["aria-labelledby", "aria-describedby"], qe = ["id", "for"], Ke = { class: "rte-wrapper" }, We = { class: "rte-body-wrap" }, ze = ["id", "contenteditable", "aria-label", "aria-readonly", "aria-disabled", "aria-invalid"], Xe = ["id"], ot = /* @__PURE__ */ Ie({
|
|
10
11
|
__name: "RichTextEditor",
|
|
11
12
|
props: {
|
|
12
13
|
modelValue: { default: "" },
|
|
14
|
+
documentKey: {},
|
|
13
15
|
placeholder: { default: "Start typing…" },
|
|
14
16
|
disabled: { type: Boolean, default: !1 },
|
|
15
17
|
minHeight: { default: "180px" },
|
|
@@ -21,8 +23,8 @@ const fe = ["aria-labelledby", "aria-describedby"], me = ["id", "for"], ve = { c
|
|
|
21
23
|
tools: {}
|
|
22
24
|
},
|
|
23
25
|
emits: ["update:modelValue", "focus", "blur", "image-removed"],
|
|
24
|
-
setup(o, { emit:
|
|
25
|
-
const i = o,
|
|
26
|
+
setup(o, { emit: ge }) {
|
|
27
|
+
const i = o, I = ge, s = U(null), oe = U(null), j = U(null), q = _(!1), N = _(!0), K = U({
|
|
26
28
|
bold: !1,
|
|
27
29
|
italic: !1,
|
|
28
30
|
underline: !1,
|
|
@@ -32,107 +34,235 @@ const fe = ["aria-labelledby", "aria-describedby"], me = ["id", "for"], ve = { c
|
|
|
32
34
|
justifyLeft: !1,
|
|
33
35
|
justifyCenter: !1,
|
|
34
36
|
justifyRight: !1
|
|
35
|
-
}),
|
|
36
|
-
let
|
|
37
|
-
|
|
38
|
-
|
|
37
|
+
}), W = _("");
|
|
38
|
+
let m = null, M = null, k = !1, g = "", C = !1, L, z = !1;
|
|
39
|
+
const re = D(() => new Set($e(i.tools)));
|
|
40
|
+
function O(e) {
|
|
41
|
+
const t = s.value;
|
|
42
|
+
return !!t && t.contains(e.startContainer) && t.contains(e.endContainer);
|
|
43
|
+
}
|
|
44
|
+
function T() {
|
|
45
|
+
if (k) return;
|
|
39
46
|
const e = window.getSelection();
|
|
40
47
|
if (e && e.rangeCount > 0)
|
|
41
48
|
try {
|
|
42
|
-
|
|
49
|
+
const t = e.getRangeAt(0);
|
|
50
|
+
if (!O(t) || m && m.startContainer === t.startContainer && m.startOffset === t.startOffset && m.endContainer === t.endContainer && m.endOffset === t.endOffset) return;
|
|
51
|
+
m = t.cloneRange();
|
|
43
52
|
} catch {
|
|
44
|
-
|
|
53
|
+
m = null;
|
|
45
54
|
}
|
|
46
55
|
}
|
|
47
|
-
function
|
|
48
|
-
if (
|
|
56
|
+
function x() {
|
|
57
|
+
if (k) return;
|
|
58
|
+
const e = window.getSelection();
|
|
59
|
+
if (!(e?.rangeCount && O(e.getRangeAt(0))) && !(!m || !O(m)))
|
|
49
60
|
try {
|
|
50
|
-
const
|
|
51
|
-
|
|
61
|
+
const t = window.getSelection();
|
|
62
|
+
t?.removeAllRanges(), t?.addRange(m);
|
|
52
63
|
} catch {
|
|
53
|
-
|
|
64
|
+
m = null;
|
|
54
65
|
}
|
|
55
66
|
}
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
(
|
|
59
|
-
|
|
60
|
-
if (!t)
|
|
61
|
-
|
|
62
|
-
|
|
67
|
+
function le(e, t = !1) {
|
|
68
|
+
const n = s.value;
|
|
69
|
+
if (!n) return;
|
|
70
|
+
if (C) {
|
|
71
|
+
if (!t && !L && e !== g) {
|
|
72
|
+
const f = document.createElement("template");
|
|
73
|
+
if (f.innerHTML = e, f.innerHTML === g) return;
|
|
74
|
+
}
|
|
75
|
+
(t || e !== g || L) && (L = { html: e, replace: t || !!L?.replace });
|
|
76
|
+
return;
|
|
77
|
+
}
|
|
78
|
+
if (!t && e === g) return;
|
|
79
|
+
const r = n.innerHTML;
|
|
80
|
+
if (!t && r === e) {
|
|
81
|
+
g = r;
|
|
82
|
+
return;
|
|
83
|
+
}
|
|
84
|
+
const l = document.createElement("template");
|
|
85
|
+
if (l.innerHTML = e, !t && l.innerHTML === r) {
|
|
86
|
+
g = r;
|
|
87
|
+
return;
|
|
88
|
+
}
|
|
89
|
+
if (!t && he(n, r, l)) {
|
|
90
|
+
g = n.innerHTML;
|
|
91
|
+
return;
|
|
92
|
+
}
|
|
93
|
+
const d = window.getSelection(), c = document.activeElement === n && d?.rangeCount && O(d.getRangeAt(0)), h = !t && c && d ? ye(n, d) : null;
|
|
94
|
+
m = null, a.closeLinkPopover(), n.innerHTML = e, g = n.innerHTML, H = !0, X(!t), G(), c && d && document.activeElement === n && (h ? pe(n, d, h) : d.setBaseAndExtent(n, 0, n, 0), T(), y());
|
|
95
|
+
}
|
|
96
|
+
function he(e, t, n) {
|
|
97
|
+
if (!/<img\b/i.test(t) || !/<img\b/i.test(n.innerHTML)) return !1;
|
|
98
|
+
const r = document.createElement("template");
|
|
99
|
+
r.innerHTML = t;
|
|
100
|
+
const l = ["alt", "loading", "data-builto-file-id"], d = r.content.querySelectorAll("img"), c = n.content.querySelectorAll("img");
|
|
101
|
+
if (d.length !== c.length) return !1;
|
|
102
|
+
const h = Array.from(c, (f) => l.map((v) => f.getAttribute(v)));
|
|
103
|
+
for (const f of [...Array.from(d), ...Array.from(c)])
|
|
104
|
+
for (const v of l) f.removeAttribute(v);
|
|
105
|
+
return r.innerHTML !== n.innerHTML ? !1 : (e.querySelectorAll("img").forEach((f, v) => {
|
|
106
|
+
l.forEach((E, Z) => {
|
|
107
|
+
const b = h[v][Z];
|
|
108
|
+
b === null ? f.removeAttribute(E) : f.getAttribute(E) !== b && f.setAttribute(E, b);
|
|
109
|
+
});
|
|
110
|
+
}), !0);
|
|
111
|
+
}
|
|
112
|
+
function ye(e, t) {
|
|
113
|
+
if (!t.anchorNode || !t.focusNode) return null;
|
|
114
|
+
const n = (r, l) => {
|
|
115
|
+
const d = [];
|
|
116
|
+
let c = r;
|
|
117
|
+
for (; c !== e && c.parentNode; )
|
|
118
|
+
d.unshift(Array.prototype.indexOf.call(c.parentNode.childNodes, c)), c = c.parentNode;
|
|
119
|
+
const h = document.createRange();
|
|
120
|
+
return h.selectNodeContents(e), h.setEnd(r, l), { path: d, type: r.nodeType, offset: l, textOffset: h.toString().length };
|
|
121
|
+
};
|
|
122
|
+
return { anchor: n(t.anchorNode, t.anchorOffset), focus: n(t.focusNode, t.focusOffset) };
|
|
123
|
+
}
|
|
124
|
+
function pe(e, t, n) {
|
|
125
|
+
const r = (f) => {
|
|
126
|
+
let v = e;
|
|
127
|
+
for (const A of f.path) v = v?.childNodes[A];
|
|
128
|
+
if (v?.nodeType === f.type) {
|
|
129
|
+
const A = v.nodeType === Node.TEXT_NODE ? v.textContent?.length ?? 0 : v.childNodes.length;
|
|
130
|
+
return [v, Math.min(f.offset, A)];
|
|
131
|
+
}
|
|
132
|
+
let E = f.textOffset;
|
|
133
|
+
const Z = document.createTreeWalker(e, NodeFilter.SHOW_TEXT);
|
|
134
|
+
let b, B = null;
|
|
135
|
+
for (; b = Z.nextNode(); ) {
|
|
136
|
+
const A = b.textContent?.length ?? 0;
|
|
137
|
+
if (E <= A) return [b, E];
|
|
138
|
+
E -= A, B = b;
|
|
139
|
+
}
|
|
140
|
+
return B ? [B, B.textContent?.length ?? 0] : [e, e.childNodes.length];
|
|
141
|
+
}, [l, d] = r(n.anchor), [c, h] = r(n.focus);
|
|
142
|
+
t.setBaseAndExtent(l, d, c, h);
|
|
143
|
+
}
|
|
144
|
+
ee(
|
|
145
|
+
[() => i.modelValue, () => i.documentKey],
|
|
146
|
+
([e, t], [, n]) => {
|
|
147
|
+
le(e ?? "", t !== n);
|
|
63
148
|
}
|
|
64
149
|
);
|
|
65
|
-
let
|
|
66
|
-
function
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
const
|
|
70
|
-
|
|
150
|
+
let ie = /* @__PURE__ */ new Set(), ae = !1, H = !0, S;
|
|
151
|
+
function se(e) {
|
|
152
|
+
if (H) return;
|
|
153
|
+
const t = (n) => n instanceof Element && (n.tagName === "IMG" || !!n.querySelector("img"));
|
|
154
|
+
for (const n of e)
|
|
155
|
+
if (n.type === "attributes" && n.target.tagName === "IMG" || n.type === "childList" && (Array.from(n.addedNodes).some(t) || Array.from(n.removedNodes).some(t))) {
|
|
156
|
+
H = !0;
|
|
157
|
+
return;
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
function X(e = !0) {
|
|
161
|
+
const t = s.value;
|
|
162
|
+
if (!t || (S && se(S.takeRecords()), !H && S)) return;
|
|
163
|
+
H = !1;
|
|
164
|
+
const n = t.querySelectorAll("img");
|
|
165
|
+
ae = n.length > 0;
|
|
166
|
+
const r = new Set(
|
|
167
|
+
Array.from(n).map((l) => l.getAttribute("src") || "").filter((l) => l && !l.startsWith("blob:"))
|
|
71
168
|
);
|
|
72
|
-
for (const
|
|
73
|
-
|
|
74
|
-
|
|
169
|
+
if (e) for (const l of ie)
|
|
170
|
+
r.has(l) || I("image-removed", l);
|
|
171
|
+
ie = r;
|
|
75
172
|
}
|
|
76
|
-
const
|
|
77
|
-
saveSelection:
|
|
78
|
-
restoreSelection:
|
|
79
|
-
onInput:
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
linkPopoverElRef: x,
|
|
86
|
-
callbacks: $
|
|
173
|
+
const ue = {
|
|
174
|
+
saveSelection: T,
|
|
175
|
+
restoreSelection: x,
|
|
176
|
+
onInput: w
|
|
177
|
+
}, { imageInputRef: be, isUploadingImage: ke, triggerImageUpload: Ce, onImageFileChange: de, onPaste: ce, onDrop: fe } = Fe(s, ue), a = Ve({
|
|
178
|
+
editorRef: s,
|
|
179
|
+
rootRef: oe,
|
|
180
|
+
linkPopoverElRef: j,
|
|
181
|
+
callbacks: ue
|
|
87
182
|
});
|
|
88
|
-
|
|
89
|
-
const e =
|
|
90
|
-
e && i.modelValue && (e.innerHTML = i.modelValue),
|
|
91
|
-
}),
|
|
92
|
-
|
|
183
|
+
Ne(() => {
|
|
184
|
+
const e = s.value;
|
|
185
|
+
e && (i.modelValue && (e.innerHTML = i.modelValue), g = e.innerHTML, typeof MutationObserver < "u" && (S = new MutationObserver(se), S.observe(e, { subtree: !0, childList: !0, attributes: !0, attributeFilter: ["src"] }))), X(!1), G();
|
|
186
|
+
}), ee(() => a.linkPopover.value.visible, (e) => {
|
|
187
|
+
e ? (document.addEventListener("mousedown", J, !0), document.addEventListener("keydown", Q, !0)) : (document.removeEventListener("mousedown", J, !0), document.removeEventListener("keydown", Q, !0));
|
|
188
|
+
}), Oe(() => {
|
|
189
|
+
k = !0, S?.disconnect(), m = null, M !== null && cancelAnimationFrame(M), document.removeEventListener("selectionchange", Y), document.removeEventListener("mousedown", J, !0), document.removeEventListener("keydown", Q, !0);
|
|
93
190
|
});
|
|
94
|
-
function
|
|
95
|
-
const e =
|
|
191
|
+
function G() {
|
|
192
|
+
const e = s.value;
|
|
96
193
|
if (!e) return;
|
|
97
|
-
|
|
98
|
-
|
|
194
|
+
if (ae) {
|
|
195
|
+
N.value = !1;
|
|
196
|
+
return;
|
|
197
|
+
}
|
|
198
|
+
const t = document.createTreeWalker(e, NodeFilter.SHOW_TEXT);
|
|
199
|
+
let n;
|
|
200
|
+
for (; n = t.nextNode(); )
|
|
201
|
+
if (n.textContent?.trim()) {
|
|
202
|
+
N.value = !1;
|
|
203
|
+
return;
|
|
204
|
+
}
|
|
205
|
+
N.value = !0;
|
|
206
|
+
}
|
|
207
|
+
function w() {
|
|
208
|
+
const e = s.value;
|
|
209
|
+
if (!e || k || C || z) return;
|
|
210
|
+
const t = e.innerHTML;
|
|
211
|
+
t !== g && (g = t, I("update:modelValue", t), X(), G()), y();
|
|
212
|
+
}
|
|
213
|
+
function Le() {
|
|
214
|
+
C = !0, L = void 0;
|
|
215
|
+
}
|
|
216
|
+
function me() {
|
|
217
|
+
C = !1;
|
|
218
|
+
const e = L;
|
|
219
|
+
if (L = void 0, !e) {
|
|
220
|
+
w();
|
|
221
|
+
return;
|
|
222
|
+
}
|
|
223
|
+
z = !0, queueMicrotask(() => {
|
|
224
|
+
z = !1, k || le(i.modelValue ?? "", e.replace || (i.modelValue ?? "") === g);
|
|
225
|
+
});
|
|
99
226
|
}
|
|
100
|
-
function
|
|
101
|
-
|
|
227
|
+
function we(e) {
|
|
228
|
+
q.value = !0, document.addEventListener("selectionchange", Y), T(), y(), I("focus", e);
|
|
102
229
|
}
|
|
103
|
-
function
|
|
230
|
+
function Ee(e) {
|
|
231
|
+
q.value = !1, document.removeEventListener("selectionchange", Y), C && me(), I("blur", e);
|
|
232
|
+
}
|
|
233
|
+
function P(e, t) {
|
|
104
234
|
if (!(i.disabled || i.readonly)) {
|
|
105
|
-
|
|
235
|
+
x(), s.value?.focus();
|
|
106
236
|
try {
|
|
107
237
|
document.execCommand(e, !1, t ?? void 0);
|
|
108
238
|
} catch {
|
|
109
239
|
}
|
|
110
|
-
|
|
240
|
+
y(), w();
|
|
111
241
|
}
|
|
112
242
|
}
|
|
113
|
-
function
|
|
243
|
+
function Te(e) {
|
|
114
244
|
if (!(i.disabled || i.readonly)) {
|
|
115
|
-
|
|
245
|
+
x(), s.value?.focus();
|
|
116
246
|
try {
|
|
117
247
|
document.execCommand("formatBlock", !1, e);
|
|
118
248
|
} catch {
|
|
119
249
|
}
|
|
120
|
-
|
|
250
|
+
y(), w();
|
|
121
251
|
}
|
|
122
252
|
}
|
|
123
|
-
function
|
|
253
|
+
function Se() {
|
|
124
254
|
if (!(i.disabled || i.readonly)) {
|
|
125
|
-
|
|
255
|
+
x(), s.value?.focus();
|
|
126
256
|
try {
|
|
127
257
|
document.execCommand("removeFormat", !1, void 0), document.execCommand("formatBlock", !1, "div");
|
|
128
258
|
} catch {
|
|
129
259
|
}
|
|
130
|
-
|
|
260
|
+
y(), w();
|
|
131
261
|
}
|
|
132
262
|
}
|
|
133
|
-
function
|
|
263
|
+
function Re() {
|
|
134
264
|
if (i.disabled || i.readonly) return;
|
|
135
|
-
|
|
265
|
+
x(), s.value?.focus();
|
|
136
266
|
const e = window.getSelection();
|
|
137
267
|
if (!e || e.rangeCount === 0 || e.isCollapsed) return;
|
|
138
268
|
const t = e.getRangeAt(0);
|
|
@@ -140,123 +270,124 @@ const fe = ["aria-labelledby", "aria-describedby"], me = ["id", "for"], ve = { c
|
|
|
140
270
|
const n = document.createElement("code");
|
|
141
271
|
t.surroundContents(n), e.removeAllRanges();
|
|
142
272
|
} catch {
|
|
143
|
-
const n = t.extractContents(),
|
|
144
|
-
|
|
273
|
+
const n = t.extractContents(), r = document.createElement("code");
|
|
274
|
+
r.appendChild(n), t.insertNode(r), e.removeAllRanges();
|
|
145
275
|
}
|
|
146
|
-
|
|
276
|
+
y(), w();
|
|
147
277
|
}
|
|
148
|
-
function
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
});
|
|
278
|
+
function y() {
|
|
279
|
+
M !== null || k || (M = requestAnimationFrame(() => {
|
|
280
|
+
M = null, Ae();
|
|
281
|
+
}));
|
|
152
282
|
}
|
|
153
|
-
function
|
|
283
|
+
function p(e) {
|
|
154
284
|
try {
|
|
155
285
|
return document.queryCommandState(e);
|
|
156
286
|
} catch {
|
|
157
287
|
return !1;
|
|
158
288
|
}
|
|
159
289
|
}
|
|
160
|
-
function
|
|
161
|
-
if (
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
l.checkLinkAtCursor();
|
|
290
|
+
function Ae() {
|
|
291
|
+
if (k || C || document.activeElement !== s.value) return;
|
|
292
|
+
const e = re.value, t = {
|
|
293
|
+
bold: e.has("bold") && p("bold"),
|
|
294
|
+
italic: e.has("italic") && p("italic"),
|
|
295
|
+
underline: e.has("underline") && p("underline"),
|
|
296
|
+
strikeThrough: e.has("strikethrough") && p("strikeThrough"),
|
|
297
|
+
insertOrderedList: e.has("orderedList") && p("insertOrderedList"),
|
|
298
|
+
insertUnorderedList: e.has("bulletList") && p("insertUnorderedList"),
|
|
299
|
+
justifyLeft: e.has("alignLeft") && p("justifyLeft"),
|
|
300
|
+
justifyCenter: e.has("alignCenter") && p("justifyCenter"),
|
|
301
|
+
justifyRight: e.has("alignRight") && p("justifyRight")
|
|
302
|
+
};
|
|
303
|
+
Object.keys(t).some((n) => t[n] !== K.value[n]) && (K.value = t);
|
|
304
|
+
try {
|
|
305
|
+
W.value = ["h1", "h2", "p", "blockquote"].some((n) => e.has(n)) ? document.queryCommandValue("formatBlock").toLowerCase() : "";
|
|
306
|
+
} catch {
|
|
307
|
+
W.value = "";
|
|
179
308
|
}
|
|
309
|
+
a.checkLinkAtCursor();
|
|
180
310
|
}
|
|
181
|
-
|
|
182
|
-
|
|
311
|
+
ee(re, y);
|
|
312
|
+
function Y() {
|
|
313
|
+
const e = s.value;
|
|
183
314
|
if (!e) return;
|
|
184
315
|
const t = document.activeElement;
|
|
185
|
-
t !== e && !e.contains(t) || (
|
|
316
|
+
t !== e && !e.contains(t) || (T(), y());
|
|
186
317
|
}
|
|
187
|
-
function
|
|
188
|
-
if (e.ctrlKey || e.metaKey)
|
|
318
|
+
function Me(e) {
|
|
319
|
+
if (!(e.isComposing || C || !(e.ctrlKey || e.metaKey)))
|
|
189
320
|
switch (e.key.toLowerCase()) {
|
|
190
321
|
case "b":
|
|
191
|
-
e.preventDefault(),
|
|
322
|
+
e.preventDefault(), P("bold");
|
|
192
323
|
break;
|
|
193
324
|
case "i":
|
|
194
|
-
e.preventDefault(),
|
|
325
|
+
e.preventDefault(), P("italic");
|
|
195
326
|
break;
|
|
196
327
|
case "u":
|
|
197
|
-
e.preventDefault(),
|
|
328
|
+
e.preventDefault(), P("underline");
|
|
198
329
|
break;
|
|
199
330
|
case "k":
|
|
200
|
-
e.preventDefault(),
|
|
331
|
+
e.preventDefault(), a.openLinkPopover();
|
|
201
332
|
break;
|
|
202
333
|
}
|
|
203
334
|
}
|
|
204
|
-
function
|
|
205
|
-
if (!
|
|
206
|
-
const t =
|
|
207
|
-
t && t.contains(e.target) ||
|
|
335
|
+
function J(e) {
|
|
336
|
+
if (!a.linkPopover.value.visible) return;
|
|
337
|
+
const t = j.value?.$el;
|
|
338
|
+
t && t.contains(e.target) || s.value?.contains(e.target) || a.closeLinkPopover();
|
|
208
339
|
}
|
|
209
|
-
function
|
|
210
|
-
e.key === "Escape" &&
|
|
340
|
+
function Q(e) {
|
|
341
|
+
e.key === "Escape" && a.linkPopover.value.visible && a.closeLinkPopover();
|
|
211
342
|
}
|
|
212
|
-
const
|
|
343
|
+
const xe = D(() => ({
|
|
213
344
|
minHeight: i.minHeight,
|
|
214
345
|
...i.maxHeight ? { maxHeight: i.maxHeight, overflowY: "auto" } : {}
|
|
215
|
-
})),
|
|
216
|
-
transform: `translate(${
|
|
217
|
-
})),
|
|
218
|
-
return (e, t) => (
|
|
346
|
+
})), He = D(() => ({
|
|
347
|
+
transform: `translate(${a.linkPopover.value.x}px, ${a.linkPopover.value.y}px)`
|
|
348
|
+
})), R = D(() => i.id ?? `rte-${Math.random().toString(36).slice(2, 7)}`);
|
|
349
|
+
return (e, t) => (F(), V("div", {
|
|
219
350
|
ref_key: "rootRef",
|
|
220
|
-
ref:
|
|
221
|
-
class:
|
|
351
|
+
ref: oe,
|
|
352
|
+
class: Pe(["rte-root", [
|
|
222
353
|
o.error && "rte-error",
|
|
223
354
|
o.disabled && "rte-disabled",
|
|
224
355
|
o.readonly && "rte-readonly",
|
|
225
|
-
|
|
356
|
+
q.value && "rte-focused"
|
|
226
357
|
]]),
|
|
227
358
|
role: "group",
|
|
228
|
-
"aria-labelledby": o.label ? `${
|
|
229
|
-
"aria-describedby": o.error ? `${
|
|
359
|
+
"aria-labelledby": o.label ? `${R.value}-label` : void 0,
|
|
360
|
+
"aria-describedby": o.error ? `${R.value}-error` : void 0
|
|
230
361
|
}, [
|
|
231
|
-
o.label ? (
|
|
362
|
+
o.label ? (F(), V("label", {
|
|
232
363
|
key: 0,
|
|
233
|
-
id: `${
|
|
234
|
-
for:
|
|
364
|
+
id: `${R.value}-label`,
|
|
365
|
+
for: R.value,
|
|
235
366
|
class: "rte-label"
|
|
236
|
-
},
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
toolbarState:
|
|
240
|
-
activeBlock:
|
|
367
|
+
}, te(o.label), 9, qe)) : ne("", !0),
|
|
368
|
+
$("div", Ke, [
|
|
369
|
+
ve(Ue, {
|
|
370
|
+
toolbarState: K.value,
|
|
371
|
+
activeBlock: W.value,
|
|
241
372
|
disabled: o.disabled,
|
|
242
373
|
readonly: o.readonly,
|
|
243
|
-
isUploadingImage:
|
|
374
|
+
isUploadingImage: u(ke),
|
|
244
375
|
label: o.label,
|
|
245
376
|
tools: o.tools,
|
|
246
|
-
onCommand:
|
|
247
|
-
onSetBlock:
|
|
248
|
-
onInsertCode:
|
|
249
|
-
onTriggerImageUpload: t[0] || (t[0] = (n) =>
|
|
250
|
-
onOpenLinkPopover: a
|
|
251
|
-
onClearFormat:
|
|
377
|
+
onCommand: P,
|
|
378
|
+
onSetBlock: Te,
|
|
379
|
+
onInsertCode: Re,
|
|
380
|
+
onTriggerImageUpload: t[0] || (t[0] = (n) => u(Ce)(!(!o.disabled && !o.readonly))),
|
|
381
|
+
onOpenLinkPopover: u(a).openLinkPopover,
|
|
382
|
+
onClearFormat: Se
|
|
252
383
|
}, null, 8, ["toolbarState", "activeBlock", "disabled", "readonly", "isUploadingImage", "label", "tools", "onOpenLinkPopover"]),
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
id:
|
|
384
|
+
$("div", We, [
|
|
385
|
+
$("div", {
|
|
386
|
+
id: R.value,
|
|
256
387
|
ref_key: "editorRef",
|
|
257
|
-
ref:
|
|
388
|
+
ref: s,
|
|
258
389
|
class: "rte-editor scrollbar-thin always-scroll",
|
|
259
|
-
style:
|
|
390
|
+
style: Be(xe.value),
|
|
260
391
|
contenteditable: !o.disabled && !o.readonly ? "true" : "false",
|
|
261
392
|
role: "textbox",
|
|
262
393
|
"aria-multiline": "true",
|
|
@@ -265,63 +396,61 @@ const fe = ["aria-labelledby", "aria-describedby"], me = ["id", "for"], ve = { c
|
|
|
265
396
|
"aria-disabled": o.disabled || void 0,
|
|
266
397
|
"aria-invalid": !!o.error || void 0,
|
|
267
398
|
spellcheck: "true",
|
|
268
|
-
onInputPassive:
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
onBlur:
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
(...n) =>
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
}, null, 44, ge),
|
|
283
|
-
w("input", {
|
|
399
|
+
onInputPassive: w,
|
|
400
|
+
onCompositionstart: Le,
|
|
401
|
+
onCompositionend: me,
|
|
402
|
+
onFocus: we,
|
|
403
|
+
onBlur: Ee,
|
|
404
|
+
onKeydown: Me,
|
|
405
|
+
onKeyupPassive: T,
|
|
406
|
+
onMouseupPassive: T,
|
|
407
|
+
onPaste: t[1] || (t[1] = //@ts-ignore
|
|
408
|
+
(...n) => u(ce) && u(ce)(...n)),
|
|
409
|
+
onDrop: t[2] || (t[2] = //@ts-ignore
|
|
410
|
+
(...n) => u(fe) && u(fe)(...n))
|
|
411
|
+
}, null, 44, ze),
|
|
412
|
+
$("input", {
|
|
284
413
|
ref_key: "imageInputRef",
|
|
285
|
-
ref:
|
|
414
|
+
ref: be,
|
|
286
415
|
type: "file",
|
|
287
416
|
accept: "image/jpeg,image/png,image/webp,image/gif,image/svg+xml",
|
|
288
417
|
class: "rte-hidden-input",
|
|
289
418
|
style: { display: "none" },
|
|
290
419
|
"aria-hidden": "true",
|
|
291
420
|
tabindex: "-1",
|
|
292
|
-
onChange: t[
|
|
293
|
-
(...n) =>
|
|
421
|
+
onChange: t[3] || (t[3] = //@ts-ignore
|
|
422
|
+
(...n) => u(de) && u(de)(...n))
|
|
294
423
|
}, null, 544),
|
|
295
|
-
|
|
424
|
+
N.value && !o.disabled ? (F(), V("div", {
|
|
296
425
|
key: 0,
|
|
297
426
|
class: "rte-placeholder",
|
|
298
427
|
"aria-hidden": "true",
|
|
299
|
-
onClick: t[
|
|
300
|
-
},
|
|
301
|
-
|
|
428
|
+
onClick: t[4] || (t[4] = (n) => s.value?.focus())
|
|
429
|
+
}, te(o.placeholder), 1)) : ne("", !0),
|
|
430
|
+
ve(De, {
|
|
302
431
|
ref_key: "linkPopoverCompRef",
|
|
303
|
-
ref:
|
|
304
|
-
visible: a
|
|
305
|
-
isEditing: a
|
|
306
|
-
url: a
|
|
307
|
-
popoverStyle:
|
|
308
|
-
"onUpdate:url": a
|
|
309
|
-
onApply: a
|
|
310
|
-
onUnlink: a
|
|
311
|
-
onOpenTab: a
|
|
312
|
-
onClose: a
|
|
432
|
+
ref: j,
|
|
433
|
+
visible: u(a).linkPopover.value.visible,
|
|
434
|
+
isEditing: u(a).linkPopover.value.isEditing,
|
|
435
|
+
url: u(a).linkPopover.value.url,
|
|
436
|
+
popoverStyle: He.value,
|
|
437
|
+
"onUpdate:url": u(a).updateUrl,
|
|
438
|
+
onApply: u(a).applyLink,
|
|
439
|
+
onUnlink: u(a).unlinkCurrent,
|
|
440
|
+
onOpenTab: u(a).openLinkInTab,
|
|
441
|
+
onClose: u(a).closeLinkPopover
|
|
313
442
|
}, null, 8, ["visible", "isEditing", "url", "popoverStyle", "onUpdate:url", "onApply", "onUnlink", "onOpenTab", "onClose"])
|
|
314
443
|
])
|
|
315
444
|
]),
|
|
316
|
-
o.error ? (
|
|
445
|
+
o.error ? (F(), V("p", {
|
|
317
446
|
key: 1,
|
|
318
|
-
id: `${
|
|
447
|
+
id: `${R.value}-error`,
|
|
319
448
|
class: "rte-error-msg",
|
|
320
449
|
"aria-live": "polite"
|
|
321
|
-
},
|
|
322
|
-
], 10,
|
|
450
|
+
}, te(o.error), 9, Xe)) : ne("", !0)
|
|
451
|
+
], 10, je));
|
|
323
452
|
}
|
|
324
453
|
});
|
|
325
454
|
export {
|
|
326
|
-
|
|
455
|
+
ot as default
|
|
327
456
|
};
|
|
@@ -1,11 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
visible: boolean;
|
|
3
|
-
isEditing: boolean;
|
|
4
|
-
url: string;
|
|
5
|
-
popoverStyle?: Record<string, string | number>;
|
|
6
|
-
}
|
|
1
|
+
import { RichTextLinkPopoverProps } from './types';
|
|
7
2
|
declare function focusInput(): void;
|
|
8
|
-
declare const _default: import('vue').DefineComponent<
|
|
3
|
+
declare const _default: import('vue').DefineComponent<RichTextLinkPopoverProps, {
|
|
9
4
|
focusInput: typeof focusInput;
|
|
10
5
|
el: import('vue').Ref<HTMLInputElement, HTMLInputElement>;
|
|
11
6
|
}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
|
|
@@ -14,7 +9,7 @@ declare const _default: import('vue').DefineComponent<Props, {
|
|
|
14
9
|
"update:url": (val: string) => any;
|
|
15
10
|
unlink: () => any;
|
|
16
11
|
openTab: () => any;
|
|
17
|
-
}, string, import('vue').PublicProps, Readonly<
|
|
12
|
+
}, string, import('vue').PublicProps, Readonly<RichTextLinkPopoverProps> & Readonly<{
|
|
18
13
|
onApply?: () => any;
|
|
19
14
|
onClose?: () => any;
|
|
20
15
|
"onUpdate:url"?: (val: string) => any;
|