@opengis/form 0.1.19 → 0.1.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index-B1zV9Aax.js +1958 -0
- package/dist/index-B3op5uFx.js +68 -0
- package/dist/index-BIES3-my.js +3085 -0
- package/dist/index-CkUvn8lm.js +153 -0
- package/dist/index-D49VHc9h.js +237 -0
- package/dist/{index-KLLTGFuE.js → index-DOZ5utw7.js} +2 -2
- package/dist/index-DZ7xh8lh.js +50 -0
- package/dist/index-MfTTOwHR.js +89 -0
- package/dist/index-RwV1hx3A.js +47 -0
- package/dist/index-W4UOw8lU.js +1159 -0
- package/dist/index-ietpNeqa.js +2843 -0
- package/dist/index-pYkcVgEL.js +12134 -0
- package/dist/index-qhd_7MCX.js +41 -0
- package/dist/index-sFkGqyu8.js +41 -0
- package/dist/index.js +1 -1
- package/dist/index.umd.cjs +185 -26
- package/dist/src/composables/useInputOptions.d.ts.map +1 -1
- package/dist/{vs-richtext-CZk9qSac.js → vs-richtext-_ShEE562.js} +863 -881
- package/package.json +18 -5
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { ref as
|
|
2
|
-
import { r as
|
|
3
|
-
import { Quote as
|
|
4
|
-
import { notify as
|
|
5
|
-
function
|
|
6
|
-
const t =
|
|
1
|
+
import { ref as _, getCurrentInstance as rt, resolveComponent as Y, createElementBlock as w, openBlock as h, normalizeClass as E, createVNode as C, createElementVNode as d, unref as L, createBlock as W, Teleport as Ue, createCommentVNode as U, Transition as qe, withCtx as q, toDisplayString as G, renderSlot as ge, defineComponent as ot, withDirectives as le, mergeProps as lt, vModelDynamic as at, Fragment as J, vModelCheckbox as nt, nextTick as ne, watch as de, onMounted as ue, onBeforeUnmount as We, normalizeStyle as te, vShow as me, computed as N, renderList as re, onUnmounted as _e, resolveDynamicComponent as Fe, vModelText as st, withModifiers as it, createStaticVNode as ct, mergeModels as dt, useModel as ut, shallowRef as ft, markRaw as pt } from "vue";
|
|
2
|
+
import { r as Me, _ as Q, a as gt, b as ht } from "./index-DOZ5utw7.js";
|
|
3
|
+
import { Quote as vt, List as mt, ListOrdered as yt, CodeXml as bt, Bold as xt, Italic as wt, Underline as kt, Strikethrough as _t, X as Le, Mail as $t, Search as Ct, Link2 as At, ExternalLink as Ft, Trash2 as St, Table2 as Lt, AlignJustify as Tt, AlignRight as Bt, AlignCenter as Et, AlignLeft as It, Check as he, Eraser as jt, PaintBucket as Mt, Highlighter as Pt, ChevronDown as Te, ALargeSmall as Ht, Superscript as Nt, Subscript as zt, RemoveFormatting as Vt, Image as Dt, Undo2 as Ot, Redo2 as Rt, CircleHelp as Ut, Minus as qt, Maximize as Wt } from "lucide-vue-next";
|
|
4
|
+
import { notify as we } from "@opengis/core";
|
|
5
|
+
function Xt() {
|
|
6
|
+
const t = _(!1);
|
|
7
7
|
return {
|
|
8
8
|
isFullscreen: t,
|
|
9
9
|
toggleFullscreen: () => {
|
|
@@ -11,52 +11,35 @@ function Jt() {
|
|
|
11
11
|
}
|
|
12
12
|
};
|
|
13
13
|
}
|
|
14
|
-
const
|
|
15
|
-
core: te(`@tiptap/core@${le}`),
|
|
16
|
-
starterKit: te(`@tiptap/starter-kit@${le}`),
|
|
17
|
-
textStyle: te(`@tiptap/extension-text-style@${le}`),
|
|
18
|
-
table: te(`@tiptap/extension-table@${le}`),
|
|
19
|
-
highlight: te(`@tiptap/extension-highlight@${le}`),
|
|
20
|
-
subscript: te(`@tiptap/extension-subscript@${le}`),
|
|
21
|
-
superscript: te(`@tiptap/extension-superscript@${le}`),
|
|
22
|
-
link: te(`@tiptap/extension-link@${le}`),
|
|
23
|
-
image: te(`@tiptap/extension-image@${le}`),
|
|
24
|
-
textAlign: te(`@tiptap/extension-text-align@${le}`),
|
|
25
|
-
heading: te(`@tiptap/extension-heading@${le}`),
|
|
26
|
-
paragraph: te(`@tiptap/extension-paragraph@${le}`),
|
|
27
|
-
pmModel: te(`@tiptap/pm@${Ze}/model`)
|
|
28
|
-
}, be = "__vs_form_tiptap_loader__", oe = (t) => import(
|
|
29
|
-
/* @vite-ignore */
|
|
30
|
-
t
|
|
31
|
-
), K = (t, e) => t?.[e] || t?.default?.[e] || t?.default?.default?.[e] || t?.default || t, rr = (t) => t && t.split(";").map((a) => a.trim()).filter((a) => a && !/^text-align\s*:/i.test(a)).join("; ") || null, or = (t) => t.style ? { style: String(t.style).replace(/;\s*$/, "") } : {}, Je = ({ stripTextAlign: t = !1 } = {}) => ({
|
|
14
|
+
const fe = "__vs_form_tiptap_loader__", Kt = (t) => t && t.split(";").map((a) => a.trim()).filter((a) => a && !/^text-align\s*:/i.test(a)).join("; ") || null, Gt = (t) => t.style ? { style: String(t.style).replace(/;\s*$/, "") } : {}, Xe = ({ stripTextAlign: t = !1 } = {}) => ({
|
|
32
15
|
default: null,
|
|
33
16
|
parseHTML: (e) => {
|
|
34
17
|
const a = e.getAttribute("style");
|
|
35
|
-
return t ?
|
|
18
|
+
return t ? Kt(a) : a || null;
|
|
36
19
|
},
|
|
37
|
-
renderHTML: (e) =>
|
|
38
|
-
}),
|
|
20
|
+
renderHTML: (e) => Gt(e)
|
|
21
|
+
}), Qt = (t) => t.extend({
|
|
39
22
|
addAttributes() {
|
|
40
23
|
return {
|
|
41
24
|
...this.parent?.(),
|
|
42
|
-
style:
|
|
25
|
+
style: Xe({ stripTextAlign: !0 })
|
|
43
26
|
};
|
|
44
27
|
}
|
|
45
|
-
}),
|
|
28
|
+
}), Yt = (t) => t.extend({
|
|
46
29
|
addAttributes() {
|
|
47
30
|
return {
|
|
48
31
|
...this.parent?.(),
|
|
49
|
-
style:
|
|
32
|
+
style: Xe()
|
|
50
33
|
};
|
|
51
34
|
}
|
|
52
|
-
}),
|
|
35
|
+
}), Zt = (t) => t.extend({
|
|
53
36
|
addOptions() {
|
|
54
37
|
return {
|
|
55
38
|
...this.parent?.(),
|
|
56
39
|
levels: [1, 2, 3, 4, 5, 6]
|
|
57
40
|
};
|
|
58
41
|
}
|
|
59
|
-
}),
|
|
42
|
+
}), Jt = (t, e, a, n, s) => {
|
|
60
43
|
const o = e.extend({
|
|
61
44
|
addAttributes() {
|
|
62
45
|
return {
|
|
@@ -107,12 +90,12 @@ const er = "https://esm.sh", le = "3.7.2", Ze = "3.7.2", tr = `?deps=@tiptap/cor
|
|
|
107
90
|
resizable: !0
|
|
108
91
|
}),
|
|
109
92
|
a,
|
|
110
|
-
|
|
111
|
-
|
|
93
|
+
n,
|
|
94
|
+
s
|
|
112
95
|
];
|
|
113
96
|
}
|
|
114
97
|
});
|
|
115
|
-
},
|
|
98
|
+
}, er = (t) => t.extend({
|
|
116
99
|
addAttributes() {
|
|
117
100
|
return {
|
|
118
101
|
...this.parent?.(),
|
|
@@ -158,7 +141,7 @@ const er = "https://esm.sh", le = "3.7.2", Ze = "3.7.2", tr = `?deps=@tiptap/cor
|
|
|
158
141
|
unsetBackgroundColor: () => ({ chain: e }) => e().setMark("textStyle", { backgroundColor: null }).removeEmptyTextStyle().run()
|
|
159
142
|
};
|
|
160
143
|
}
|
|
161
|
-
}),
|
|
144
|
+
}), tr = (t) => t.create({
|
|
162
145
|
name: "iframe",
|
|
163
146
|
group: "block",
|
|
164
147
|
inline: !1,
|
|
@@ -186,216 +169,215 @@ const er = "https://esm.sh", le = "3.7.2", Ze = "3.7.2", tr = `?deps=@tiptap/cor
|
|
|
186
169
|
return ["iframe", e];
|
|
187
170
|
}
|
|
188
171
|
});
|
|
189
|
-
async function
|
|
172
|
+
async function rr() {
|
|
190
173
|
if (typeof window > "u") return null;
|
|
191
174
|
const t = window;
|
|
192
|
-
return t[
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
175
|
+
return t[fe] || (t[fe] = Promise.all([
|
|
176
|
+
import("./index-pYkcVgEL.js").then((e) => e.Q),
|
|
177
|
+
import("./index-BIES3-my.js"),
|
|
178
|
+
import("./index-D49VHc9h.js"),
|
|
179
|
+
import("./index-B1zV9Aax.js"),
|
|
180
|
+
import("./index-MfTTOwHR.js"),
|
|
181
|
+
import("./index-sFkGqyu8.js"),
|
|
182
|
+
import("./index-qhd_7MCX.js"),
|
|
183
|
+
import("./index-W4UOw8lU.js"),
|
|
184
|
+
import("./index-CkUvn8lm.js"),
|
|
185
|
+
import("./index-RwV1hx3A.js"),
|
|
186
|
+
import("./index-B3op5uFx.js"),
|
|
187
|
+
import("./index-DZ7xh8lh.js"),
|
|
188
|
+
import("./index-ietpNeqa.js")
|
|
206
189
|
]).then(([
|
|
207
|
-
e,
|
|
208
|
-
|
|
209
|
-
s,
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
190
|
+
{ Editor: e, Node: a },
|
|
191
|
+
{ StarterKit: n },
|
|
192
|
+
{ TextStyle: s },
|
|
193
|
+
{ TableKit: o, Table: l, TableRow: c, TableCell: r, TableHeader: i },
|
|
194
|
+
{ Highlight: x },
|
|
195
|
+
{ Subscript: v },
|
|
196
|
+
{ Superscript: f },
|
|
197
|
+
{ Link: p },
|
|
198
|
+
{ Image: I },
|
|
199
|
+
{ TextAlign: D },
|
|
200
|
+
{ Heading: O },
|
|
201
|
+
{ Paragraph: R },
|
|
202
|
+
{ DOMParser: Z }
|
|
220
203
|
]) => {
|
|
221
|
-
|
|
222
|
-
if (!I || !V || !O || !R || !J || !M || !ee || !ne || !pe || !ge || !m || !k || !u || !_ || !b || !T || !h || !F)
|
|
204
|
+
if (!e || !a || !n || !s || !o || !l || !c || !r || !i || !x || !v || !f || !p || !I || !D || !O || !R || !Z)
|
|
223
205
|
throw new Error("Failed to resolve one or more Tiptap modules");
|
|
224
206
|
return {
|
|
225
|
-
Editor:
|
|
226
|
-
ProseMirrorDOMParser:
|
|
227
|
-
StarterKit:
|
|
228
|
-
ExtendedTextStyle:
|
|
229
|
-
Highlight:
|
|
230
|
-
Subscript:
|
|
231
|
-
Superscript:
|
|
232
|
-
CustomLink:
|
|
233
|
-
Image:
|
|
234
|
-
TextAlign:
|
|
235
|
-
CustomHeading:
|
|
236
|
-
CustomParagraph:
|
|
237
|
-
CustomTableKit:
|
|
238
|
-
Iframe:
|
|
207
|
+
Editor: e,
|
|
208
|
+
ProseMirrorDOMParser: Z,
|
|
209
|
+
StarterKit: n,
|
|
210
|
+
ExtendedTextStyle: er(s),
|
|
211
|
+
Highlight: x,
|
|
212
|
+
Subscript: v,
|
|
213
|
+
Superscript: f,
|
|
214
|
+
CustomLink: Yt(p),
|
|
215
|
+
Image: I,
|
|
216
|
+
TextAlign: D,
|
|
217
|
+
CustomHeading: Zt(O),
|
|
218
|
+
CustomParagraph: Qt(R),
|
|
219
|
+
CustomTableKit: Jt(o, l, c, r, i),
|
|
220
|
+
Iframe: tr(a)
|
|
239
221
|
};
|
|
240
222
|
}).catch((e) => {
|
|
241
|
-
throw delete t[
|
|
242
|
-
})), t[
|
|
223
|
+
throw delete t[fe], e;
|
|
224
|
+
})), t[fe];
|
|
243
225
|
}
|
|
244
|
-
const
|
|
245
|
-
let e =
|
|
246
|
-
return e = e.replace(/!\[([^\]]*)]\(([^)\s]+)(?:\s+"([^"]+)")?\)/g, (a,
|
|
247
|
-
const l = o ? ` title="${
|
|
248
|
-
return `<img src="${
|
|
249
|
-
}), e = e.replace(/\[([^\]]+)]\(([^)\s]+)(?:\s+"([^"]+)")?\)/g, (a,
|
|
250
|
-
const l = o ? ` title="${
|
|
251
|
-
return `<a href="${
|
|
226
|
+
const oe = (t) => t.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'"), ye = (t) => {
|
|
227
|
+
let e = oe(t || "");
|
|
228
|
+
return e = e.replace(/!\[([^\]]*)]\(([^)\s]+)(?:\s+"([^"]+)")?\)/g, (a, n, s, o) => {
|
|
229
|
+
const l = o ? ` title="${oe(o)}"` : "";
|
|
230
|
+
return `<img src="${oe(s)}" alt="${oe(n)}"${l}>`;
|
|
231
|
+
}), e = e.replace(/\[([^\]]+)]\(([^)\s]+)(?:\s+"([^"]+)")?\)/g, (a, n, s, o) => {
|
|
232
|
+
const l = o ? ` title="${oe(o)}"` : "";
|
|
233
|
+
return `<a href="${oe(s)}"${l} target="_blank" rel="noopener noreferrer">${n}</a>`;
|
|
252
234
|
}), e = e.replace(/`([^`]+)`/g, "<code>$1</code>"), e = e.replace(/\*\*([^*]+)\*\*/g, "<strong>$1</strong>"), e = e.replace(/__([^_]+)__/g, "<strong>$1</strong>"), e = e.replace(/~~([^~]+)~~/g, "<del>$1</del>"), e = e.replace(/\*([^*\n]+)\*/g, "<em>$1</em>"), e = e.replace(/_([^_\n]+)_/g, "<em>$1</em>"), e;
|
|
253
|
-
},
|
|
254
|
-
const a = t[e],
|
|
255
|
-
if (!a || !
|
|
235
|
+
}, ve = (t) => /^\s*\d+\.\s+/.test(t), Be = (t) => /^\s*[-*+]\s+/.test(t), Ke = (t) => /^\s*[-*+]\s+\[[ xX]\]\s+/.test(t), Se = (t) => /^\s*>\s?/.test(t), Ee = (t) => /^\s*\|?(?:\s*:?-{3,}:?\s*\|)+\s*:?-{3,}:?\s*\|?\s*$/.test(t), Pe = (t) => t.trim().replace(/^\|/, "").replace(/\|$/, "").split("|").map((e) => ye(e.trim())), or = (t, e) => {
|
|
236
|
+
const a = t[e], n = t[e + 1];
|
|
237
|
+
if (!a || !n || !a.includes("|") || !Ee(n))
|
|
256
238
|
return null;
|
|
257
|
-
const
|
|
239
|
+
const s = Pe(a), o = [];
|
|
258
240
|
let l = e + 2;
|
|
259
241
|
for (; l < t.length && t[l].includes("|") && t[l].trim() !== ""; ) {
|
|
260
|
-
const i =
|
|
242
|
+
const i = Pe(t[l]);
|
|
261
243
|
o.push(`<tr>${i.map((x) => `<td>${x}</td>`).join("")}</tr>`), l += 1;
|
|
262
244
|
}
|
|
263
|
-
const c = `<thead><tr>${
|
|
245
|
+
const c = `<thead><tr>${s.map((i) => `<th>${i}</th>`).join("")}</tr></thead>`, r = o.length ? `<tbody>${o.join("")}</tbody>` : "";
|
|
264
246
|
return {
|
|
265
247
|
html: `<table>${c}${r}</table>`,
|
|
266
248
|
nextIndex: l
|
|
267
249
|
};
|
|
268
|
-
},
|
|
269
|
-
const a =
|
|
250
|
+
}, lr = (t, e) => {
|
|
251
|
+
const a = ve(t[e]), n = a ? "ol" : "ul", s = [];
|
|
270
252
|
let o = e;
|
|
271
253
|
for (; o < t.length; ) {
|
|
272
254
|
const l = t[o];
|
|
273
|
-
if (l.trim() === "" || !(a ?
|
|
255
|
+
if (l.trim() === "" || !(a ? ve(l) : (Be(l) || Ke(l)) && !ve(l))) break;
|
|
274
256
|
const r = l.match(/^\s*[-*+]\s+\[([ xX])\]\s+(.*)$/);
|
|
275
257
|
if (r) {
|
|
276
258
|
const i = r[1].toLowerCase() === "x";
|
|
277
|
-
|
|
259
|
+
s.push(`<li><input type="checkbox" disabled${i ? " checked" : ""}> ${ye(r[2])}</li>`);
|
|
278
260
|
} else {
|
|
279
261
|
const i = l.replace(/^\s*(?:[-*+]|\d+\.)\s+/, "");
|
|
280
|
-
|
|
262
|
+
s.push(`<li>${ye(i)}</li>`);
|
|
281
263
|
}
|
|
282
264
|
o += 1;
|
|
283
265
|
}
|
|
284
266
|
return {
|
|
285
|
-
html: `<${
|
|
267
|
+
html: `<${n}>${s.join("")}</${n}>`,
|
|
286
268
|
nextIndex: o
|
|
287
269
|
};
|
|
288
|
-
},
|
|
289
|
-
const
|
|
270
|
+
}, ar = (t, e) => {
|
|
271
|
+
const n = t[e].replace(/^```/, "").trim(), s = [];
|
|
290
272
|
let o = e + 1;
|
|
291
273
|
for (; o < t.length && !t[o].startsWith("```"); )
|
|
292
|
-
|
|
274
|
+
s.push(t[o]), o += 1;
|
|
293
275
|
return {
|
|
294
|
-
html: `<pre><code${
|
|
276
|
+
html: `<pre><code${n ? ` class="language-${oe(n)}"` : ""}>${oe(s.join(`
|
|
295
277
|
`))}</code></pre>`,
|
|
296
278
|
nextIndex: o < t.length ? o + 1 : o
|
|
297
279
|
};
|
|
298
|
-
},
|
|
280
|
+
}, nr = (t, e) => {
|
|
299
281
|
const a = [];
|
|
300
|
-
let
|
|
301
|
-
for (;
|
|
302
|
-
const
|
|
303
|
-
if (
|
|
282
|
+
let n = e;
|
|
283
|
+
for (; n < t.length; ) {
|
|
284
|
+
const s = t[n];
|
|
285
|
+
if (s.trim() === "" || s.startsWith("```") || /^#{1,6}\s+/.test(s) || /^---+$/.test(s.trim()) || /^\*\*\*+$/.test(s.trim()) || Se(s) || ve(s) || Be(s) || n + 1 < t.length && s.includes("|") && Ee(t[n + 1]))
|
|
304
286
|
break;
|
|
305
|
-
a.push(
|
|
287
|
+
a.push(s.trim()), n += 1;
|
|
306
288
|
}
|
|
307
289
|
return {
|
|
308
|
-
html: `<p>${
|
|
309
|
-
nextIndex:
|
|
290
|
+
html: `<p>${ye(a.join(" "))}</p>`,
|
|
291
|
+
nextIndex: n
|
|
310
292
|
};
|
|
311
|
-
},
|
|
293
|
+
}, Ge = (t) => {
|
|
312
294
|
const a = (t || "").replace(/\r\n/g, `
|
|
313
295
|
`).split(`
|
|
314
|
-
`),
|
|
315
|
-
let
|
|
316
|
-
for (;
|
|
317
|
-
const o = a[
|
|
296
|
+
`), n = [];
|
|
297
|
+
let s = 0;
|
|
298
|
+
for (; s < a.length; ) {
|
|
299
|
+
const o = a[s], l = o.trim();
|
|
318
300
|
if (!l) {
|
|
319
|
-
|
|
301
|
+
s += 1;
|
|
320
302
|
continue;
|
|
321
303
|
}
|
|
322
304
|
if (o.startsWith("```")) {
|
|
323
|
-
const i =
|
|
324
|
-
|
|
305
|
+
const i = ar(a, s);
|
|
306
|
+
n.push(i.html), s = i.nextIndex;
|
|
325
307
|
continue;
|
|
326
308
|
}
|
|
327
309
|
const c = o.match(/^(#{1,6})\s+(.*)$/);
|
|
328
310
|
if (c) {
|
|
329
311
|
const i = c[1].length;
|
|
330
|
-
|
|
312
|
+
n.push(`<h${i}>${ye(c[2])}</h${i}>`), s += 1;
|
|
331
313
|
continue;
|
|
332
314
|
}
|
|
333
315
|
if (/^---+$/.test(l) || /^\*\*\*+$/.test(l)) {
|
|
334
|
-
|
|
316
|
+
n.push("<hr>"), s += 1;
|
|
335
317
|
continue;
|
|
336
318
|
}
|
|
337
|
-
if (o.includes("|") &&
|
|
338
|
-
const i =
|
|
319
|
+
if (o.includes("|") && s + 1 < a.length && Ee(a[s + 1])) {
|
|
320
|
+
const i = or(a, s);
|
|
339
321
|
if (i) {
|
|
340
|
-
|
|
322
|
+
n.push(i.html), s = i.nextIndex;
|
|
341
323
|
continue;
|
|
342
324
|
}
|
|
343
325
|
}
|
|
344
|
-
if (
|
|
326
|
+
if (Se(o)) {
|
|
345
327
|
const i = [];
|
|
346
|
-
for (;
|
|
347
|
-
i.push(a[
|
|
348
|
-
|
|
328
|
+
for (; s < a.length && Se(a[s]); )
|
|
329
|
+
i.push(a[s].replace(/^\s*>\s?/, "")), s += 1;
|
|
330
|
+
n.push(`<blockquote>${Ge(i.join(`
|
|
349
331
|
`))}</blockquote>`);
|
|
350
332
|
continue;
|
|
351
333
|
}
|
|
352
|
-
if (
|
|
353
|
-
const i =
|
|
354
|
-
|
|
334
|
+
if (ve(o) || Be(o) || Ke(o)) {
|
|
335
|
+
const i = lr(a, s);
|
|
336
|
+
n.push(i.html), s = i.nextIndex;
|
|
355
337
|
continue;
|
|
356
338
|
}
|
|
357
|
-
const r =
|
|
358
|
-
|
|
339
|
+
const r = nr(a, s);
|
|
340
|
+
n.push(r.html), s = r.nextIndex;
|
|
359
341
|
}
|
|
360
|
-
return
|
|
361
|
-
},
|
|
342
|
+
return n.join("");
|
|
343
|
+
}, Ae = (t) => (t.textContent || "").replace(/\u00a0/g, " "), Qe = (t) => Array.from(t.childNodes).map((e) => Ie(e)).join(""), sr = (t) => {
|
|
362
344
|
const e = Array.from(t.querySelectorAll("tr"));
|
|
363
345
|
if (!e.length) return "";
|
|
364
|
-
const a = (c) => `| ${Array.from(c.children).map((i) =>
|
|
365
|
-
return [a(
|
|
346
|
+
const a = (c) => `| ${Array.from(c.children).map((i) => Qe(i).trim()).join(" | ")} |`, n = e[0], s = n ? Array.from(n.children).length : 0, o = `| ${Array(Math.max(s, 1)).fill("---").join(" | ")} |`, l = e.slice(1).map((c) => a(c));
|
|
347
|
+
return [a(n), o, ...l].join(`
|
|
366
348
|
`);
|
|
367
|
-
},
|
|
368
|
-
const
|
|
369
|
-
return o ? `- [${o.checked ? "x" : " "}] ${l}` : e ? `${
|
|
349
|
+
}, He = (t, e = !1) => Array.from(t.children).filter((a) => a.nodeType === Node.ELEMENT_NODE).map((a, n) => {
|
|
350
|
+
const s = a, o = s.querySelector('input[type="checkbox"]'), l = Array.from(s.childNodes).filter((c) => !(c instanceof HTMLInputElement)).map((c) => Ie(c)).join("").trim();
|
|
351
|
+
return o ? `- [${o.checked ? "x" : " "}] ${l}` : e ? `${n + 1}. ${l}` : `- ${l}`;
|
|
370
352
|
}).join(`
|
|
371
353
|
`);
|
|
372
|
-
function
|
|
354
|
+
function Ie(t) {
|
|
373
355
|
if (t.nodeType === Node.TEXT_NODE)
|
|
374
|
-
return
|
|
356
|
+
return Ae(t);
|
|
375
357
|
if (t.nodeType !== Node.ELEMENT_NODE)
|
|
376
358
|
return "";
|
|
377
|
-
const e = t, a = e.tagName.toLowerCase(),
|
|
359
|
+
const e = t, a = e.tagName.toLowerCase(), n = Qe(e);
|
|
378
360
|
switch (a) {
|
|
379
361
|
case "br":
|
|
380
362
|
return `
|
|
381
363
|
`;
|
|
382
364
|
case "p":
|
|
383
|
-
return `${
|
|
365
|
+
return `${n.trim()}
|
|
384
366
|
|
|
385
367
|
`;
|
|
386
368
|
case "strong":
|
|
387
369
|
case "b":
|
|
388
|
-
return `**${
|
|
370
|
+
return `**${n}**`;
|
|
389
371
|
case "em":
|
|
390
372
|
case "i":
|
|
391
|
-
return `*${
|
|
373
|
+
return `*${n}*`;
|
|
392
374
|
case "del":
|
|
393
375
|
case "s":
|
|
394
|
-
return `~~${
|
|
376
|
+
return `~~${n}~~`;
|
|
395
377
|
case "code":
|
|
396
|
-
return e.parentElement?.tagName.toLowerCase() === "pre" ?
|
|
378
|
+
return e.parentElement?.tagName.toLowerCase() === "pre" ? n : `\`${n}\``;
|
|
397
379
|
case "pre": {
|
|
398
|
-
const
|
|
380
|
+
const s = e.querySelector("code"), c = (s?.className || "").match(/language-([a-z0-9_-]+)/i)?.[1] || "", r = Ae(s || e);
|
|
399
381
|
return `\`\`\`${c}
|
|
400
382
|
${r}
|
|
401
383
|
\`\`\`
|
|
@@ -403,8 +385,8 @@ ${r}
|
|
|
403
385
|
`;
|
|
404
386
|
}
|
|
405
387
|
case "blockquote":
|
|
406
|
-
return `${
|
|
407
|
-
`).map((
|
|
388
|
+
return `${n.trim().split(`
|
|
389
|
+
`).map((s) => `> ${s}`).join(`
|
|
408
390
|
`)}
|
|
409
391
|
|
|
410
392
|
`;
|
|
@@ -414,48 +396,48 @@ ${r}
|
|
|
414
396
|
case "h4":
|
|
415
397
|
case "h5":
|
|
416
398
|
case "h6": {
|
|
417
|
-
const
|
|
418
|
-
return `${"#".repeat(
|
|
399
|
+
const s = Number(a[1]);
|
|
400
|
+
return `${"#".repeat(s)} ${n.trim()}
|
|
419
401
|
|
|
420
402
|
`;
|
|
421
403
|
}
|
|
422
404
|
case "ul":
|
|
423
|
-
return `${
|
|
405
|
+
return `${He(e, !1)}
|
|
424
406
|
|
|
425
407
|
`;
|
|
426
408
|
case "ol":
|
|
427
|
-
return `${
|
|
409
|
+
return `${He(e, !0)}
|
|
428
410
|
|
|
429
411
|
`;
|
|
430
412
|
case "a": {
|
|
431
|
-
const
|
|
432
|
-
return `[${
|
|
413
|
+
const s = e.getAttribute("href") || "";
|
|
414
|
+
return `[${n || s}](${s})`;
|
|
433
415
|
}
|
|
434
416
|
case "img": {
|
|
435
|
-
const
|
|
436
|
-
return o ? `` : "";
|
|
437
419
|
}
|
|
438
420
|
case "hr":
|
|
439
421
|
return `---
|
|
440
422
|
|
|
441
423
|
`;
|
|
442
424
|
case "table":
|
|
443
|
-
return `${
|
|
425
|
+
return `${sr(e)}
|
|
444
426
|
|
|
445
427
|
`;
|
|
446
428
|
default:
|
|
447
|
-
return
|
|
429
|
+
return n;
|
|
448
430
|
}
|
|
449
431
|
}
|
|
450
|
-
const
|
|
432
|
+
const Ye = (t) => {
|
|
451
433
|
if (!t) return "";
|
|
452
434
|
if (typeof window > "u" || typeof DOMParser > "u")
|
|
453
435
|
return t;
|
|
454
436
|
const a = new DOMParser().parseFromString(t, "text/html");
|
|
455
|
-
return Array.from(a.body.childNodes).map((
|
|
437
|
+
return Array.from(a.body.childNodes).map((n) => Ie(n)).join("").replace(/\n{3,}/g, `
|
|
456
438
|
|
|
457
439
|
`).trim();
|
|
458
|
-
},
|
|
440
|
+
}, ir = /* @__PURE__ */ new Set([
|
|
459
441
|
"area",
|
|
460
442
|
"base",
|
|
461
443
|
"br",
|
|
@@ -470,65 +452,65 @@ const ot = (t) => {
|
|
|
470
452
|
"source",
|
|
471
453
|
"track",
|
|
472
454
|
"wbr"
|
|
473
|
-
]),
|
|
455
|
+
]), cr = (t) => {
|
|
474
456
|
if (!t) return "";
|
|
475
457
|
if (typeof window > "u" || typeof DOMParser > "u")
|
|
476
458
|
return t;
|
|
477
|
-
const a = new DOMParser().parseFromString(t, "text/html"),
|
|
459
|
+
const a = new DOMParser().parseFromString(t, "text/html"), n = " ", s = (o, l) => {
|
|
478
460
|
if (o.nodeType === Node.TEXT_NODE) {
|
|
479
461
|
const p = (o.textContent || "").replace(/\s+/g, " ").trim();
|
|
480
|
-
return p ? [`${
|
|
462
|
+
return p ? [`${n.repeat(l)}${p}`] : [];
|
|
481
463
|
}
|
|
482
464
|
if (o.nodeType !== Node.ELEMENT_NODE)
|
|
483
465
|
return [];
|
|
484
|
-
const c = o, r = c.tagName.toLowerCase(), i = Array.from(c.attributes).map((p) => `${p.name}="${p.value}"`).join(" "), x = i ? `<${r} ${i}>` : `<${r}>`,
|
|
485
|
-
if (
|
|
486
|
-
return [`${
|
|
487
|
-
const f = Array.from(c.childNodes).flatMap((p) =>
|
|
466
|
+
const c = o, r = c.tagName.toLowerCase(), i = Array.from(c.attributes).map((p) => `${p.name}="${p.value}"`).join(" "), x = i ? `<${r} ${i}>` : `<${r}>`, v = `</${r}>`;
|
|
467
|
+
if (ir.has(r))
|
|
468
|
+
return [`${n.repeat(l)}${x}`];
|
|
469
|
+
const f = Array.from(c.childNodes).flatMap((p) => s(p, l + 1));
|
|
488
470
|
if (!f.length)
|
|
489
|
-
return [`${
|
|
471
|
+
return [`${n.repeat(l)}${x}${v}`];
|
|
490
472
|
if (c.childNodes.length === 1 && c.firstChild?.nodeType === Node.TEXT_NODE && f.length === 1) {
|
|
491
473
|
const p = f[0].trim();
|
|
492
|
-
return [`${
|
|
474
|
+
return [`${n.repeat(l)}${x}${p}${v}`];
|
|
493
475
|
}
|
|
494
476
|
return [
|
|
495
|
-
`${
|
|
477
|
+
`${n.repeat(l)}${x}`,
|
|
496
478
|
...f,
|
|
497
|
-
`${
|
|
479
|
+
`${n.repeat(l)}${v}`
|
|
498
480
|
];
|
|
499
481
|
};
|
|
500
|
-
return Array.from(a.body.childNodes).flatMap((o) =>
|
|
482
|
+
return Array.from(a.body.childNodes).flatMap((o) => s(o, 0)).join(`
|
|
501
483
|
`);
|
|
502
|
-
},
|
|
484
|
+
}, dr = (t) => t.replace(/&/g, "&").replace(/"/g, """).replace(/</g, "<").replace(/>/g, ">"), ke = (t) => {
|
|
503
485
|
if (!t) return "";
|
|
504
486
|
if (typeof window > "u" || typeof DOMParser > "u")
|
|
505
487
|
return t.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi, "");
|
|
506
488
|
const a = new DOMParser().parseFromString(t, "text/html");
|
|
507
|
-
return a.querySelectorAll("script").forEach((
|
|
508
|
-
},
|
|
489
|
+
return a.querySelectorAll("script").forEach((n) => n.remove()), a.body.innerHTML;
|
|
490
|
+
}, Ne = (t) => {
|
|
509
491
|
if (!t)
|
|
510
492
|
return { wrapper: null, bodyHtml: "" };
|
|
511
493
|
if (typeof window > "u" || typeof DOMParser > "u")
|
|
512
494
|
return { wrapper: null, bodyHtml: t };
|
|
513
|
-
const a = new DOMParser().parseFromString(t, "text/html"), { body:
|
|
514
|
-
if (
|
|
495
|
+
const a = new DOMParser().parseFromString(t, "text/html"), { body: n } = a;
|
|
496
|
+
if (n.childElementCount !== 1)
|
|
515
497
|
return { wrapper: null, bodyHtml: t };
|
|
516
|
-
const
|
|
517
|
-
return !
|
|
498
|
+
const s = n.firstElementChild;
|
|
499
|
+
return !s || s.tagName.toLowerCase() !== "div" ? { wrapper: null, bodyHtml: t } : {
|
|
518
500
|
wrapper: {
|
|
519
|
-
tag:
|
|
520
|
-
attributes: Array.from(
|
|
501
|
+
tag: s.tagName.toLowerCase(),
|
|
502
|
+
attributes: Array.from(s.attributes).map((o) => ({
|
|
521
503
|
name: o.name,
|
|
522
504
|
value: o.value
|
|
523
505
|
}))
|
|
524
506
|
},
|
|
525
|
-
bodyHtml:
|
|
507
|
+
bodyHtml: s.innerHTML
|
|
526
508
|
};
|
|
527
|
-
},
|
|
509
|
+
}, ze = (t, e) => {
|
|
528
510
|
if (!e) return t || "";
|
|
529
|
-
const a = (e.attributes || []).map(({ name:
|
|
511
|
+
const a = (e.attributes || []).map(({ name: s, value: o }) => `${s}="${dr(o)}"`).join(" ");
|
|
530
512
|
return `${a ? `<${e.tag} ${a}>` : `<${e.tag}>`}${t || ""}</${e.tag}>`;
|
|
531
|
-
},
|
|
513
|
+
}, Ve = async (t, e) => e !== "md" ? t || "" : Ge(t || ""), De = async (t, e) => e !== "md" ? cr(t || "") : Ye(t || ""), ur = async (t, e) => e !== "md" ? t || "" : Ye(t || ""), fr = async (t) => {
|
|
532
514
|
try {
|
|
533
515
|
const e = new FormData();
|
|
534
516
|
return e.append("unique", "true"), e.append("file", t), (await (await fetch("/file/upload/uploads?id=&form=&table=", {
|
|
@@ -538,55 +520,55 @@ const ot = (t) => {
|
|
|
538
520
|
} catch (e) {
|
|
539
521
|
console.error(e);
|
|
540
522
|
}
|
|
541
|
-
},
|
|
542
|
-
const
|
|
543
|
-
if (
|
|
544
|
-
const
|
|
545
|
-
if (
|
|
546
|
-
const { state: l, dispatch: c } = t, { tr: r } = l, i = a.fromSchema(t.state.schema), x = new DOMParser().parseFromString(
|
|
523
|
+
}, pr = async (t, e, a) => {
|
|
524
|
+
const n = e.clipboardData?.items;
|
|
525
|
+
if (n) {
|
|
526
|
+
const s = e.clipboardData?.getData("text/html"), o = e.clipboardData?.getData("text/plain");
|
|
527
|
+
if (s) {
|
|
528
|
+
const { state: l, dispatch: c } = t, { tr: r } = l, i = a.fromSchema(t.state.schema), x = new DOMParser().parseFromString(s, "text/html").body, v = i.parse(x), f = r.replaceSelectionWith(v);
|
|
547
529
|
return c(f), e.preventDefault(), !0;
|
|
548
530
|
}
|
|
549
531
|
if (o) {
|
|
550
532
|
const { state: l, dispatch: c } = t, { tr: r } = l, i = r.insertText(o, l.selection.from, l.selection.to);
|
|
551
533
|
return c(i), e.preventDefault(), !0;
|
|
552
534
|
}
|
|
553
|
-
for (let l = 0; l <
|
|
554
|
-
const c =
|
|
535
|
+
for (let l = 0; l < n.length; l++) {
|
|
536
|
+
const c = n[l];
|
|
555
537
|
if (c.type.startsWith("image/")) {
|
|
556
538
|
const r = c.getAsFile();
|
|
557
539
|
if (r) {
|
|
558
|
-
const i = await
|
|
540
|
+
const i = await fr(r), { schema: x } = t.state, v = x.nodes.image.create({
|
|
559
541
|
src: i?.file_path
|
|
560
|
-
}), f = t.state.tr.replaceSelectionWith(
|
|
542
|
+
}), f = t.state.tr.replaceSelectionWith(v);
|
|
561
543
|
return t.dispatch(f), e.preventDefault(), !0;
|
|
562
544
|
}
|
|
563
545
|
}
|
|
564
546
|
}
|
|
565
547
|
}
|
|
566
548
|
return !1;
|
|
567
|
-
},
|
|
549
|
+
}, gr = (t) => String(t).trim().toLowerCase().split("-")[0], hr = () => typeof window > "u" ? "uk" : gr(
|
|
568
550
|
localStorage.getItem("language") || localStorage.getItem("locale") || navigator.language || "uk"
|
|
569
|
-
),
|
|
551
|
+
), vr = (t, e) => {
|
|
570
552
|
const a = e.replace(/^form\.richtext\./, "");
|
|
571
|
-
return
|
|
572
|
-
},
|
|
573
|
-
function
|
|
574
|
-
const e =
|
|
575
|
-
return { t: (
|
|
553
|
+
return Me?.[t]?.form?.richtext?.[a] || Me?.uk?.form?.richtext?.[a] || e;
|
|
554
|
+
}, Oe = (t) => t.startsWith("form.richtext.") ? t : `form.richtext.${t}`;
|
|
555
|
+
function je() {
|
|
556
|
+
const e = rt()?.appContext?.config?.globalProperties, a = e?.$i18n;
|
|
557
|
+
return { t: (s) => {
|
|
576
558
|
const o = e?.$t, l = e?.$te, c = typeof a?.te == "function" ? a.te.bind(a) : null;
|
|
577
559
|
if (typeof o == "function") {
|
|
578
|
-
const r =
|
|
560
|
+
const r = Oe(s);
|
|
579
561
|
if ((typeof l == "function" ? l(r) : typeof c == "function" ? c(r) : null) !== !1) {
|
|
580
562
|
const x = o(r);
|
|
581
563
|
if (x && x !== r)
|
|
582
564
|
return x;
|
|
583
565
|
}
|
|
584
566
|
}
|
|
585
|
-
return
|
|
567
|
+
return vr(hr(), Oe(s));
|
|
586
568
|
} };
|
|
587
569
|
}
|
|
588
|
-
const
|
|
589
|
-
components: { Quote:
|
|
570
|
+
const mr = {
|
|
571
|
+
components: { Quote: vt },
|
|
590
572
|
props: { editor: Object },
|
|
591
573
|
methods: {
|
|
592
574
|
toggleBlockquote() {
|
|
@@ -594,9 +576,9 @@ const Cr = {
|
|
|
594
576
|
}
|
|
595
577
|
}
|
|
596
578
|
};
|
|
597
|
-
function
|
|
598
|
-
const l =
|
|
599
|
-
return
|
|
579
|
+
function yr(t, e, a, n, s, o) {
|
|
580
|
+
const l = Y("Quote");
|
|
581
|
+
return h(), w("button", {
|
|
600
582
|
title: "Blockquote",
|
|
601
583
|
onClick: e[0] || (e[0] = (...c) => o.toggleBlockquote && o.toggleBlockquote(...c)),
|
|
602
584
|
class: E(["text-gray-500 w-[30px] h-[30px] flex items-center justify-center rounded-full hover:text-gray-900 hover:bg-gray-100 focus:outline-none", { "bg-gray-100 text-gray-900": a.editor?.isActive("blockquote") }])
|
|
@@ -604,8 +586,8 @@ function Ar(t, e, a, s, n, o) {
|
|
|
604
586
|
C(l, { class: "h-4 w-4" })
|
|
605
587
|
], 2);
|
|
606
588
|
}
|
|
607
|
-
const
|
|
608
|
-
components: { List:
|
|
589
|
+
const br = /* @__PURE__ */ Q(mr, [["render", yr]]), xr = {
|
|
590
|
+
components: { List: mt },
|
|
609
591
|
props: { editor: Object },
|
|
610
592
|
methods: {
|
|
611
593
|
toggleBulletList() {
|
|
@@ -613,9 +595,9 @@ const Sr = /* @__PURE__ */ Q(Cr, [["render", Ar]]), Fr = {
|
|
|
613
595
|
}
|
|
614
596
|
}
|
|
615
597
|
};
|
|
616
|
-
function
|
|
617
|
-
const l =
|
|
618
|
-
return
|
|
598
|
+
function wr(t, e, a, n, s, o) {
|
|
599
|
+
const l = Y("List");
|
|
600
|
+
return h(), w("button", {
|
|
619
601
|
title: "Bullet List",
|
|
620
602
|
onClick: e[0] || (e[0] = (...c) => o.toggleBulletList && o.toggleBulletList(...c)),
|
|
621
603
|
class: E(["text-gray-500 w-[30px] h-[30px] flex items-center justify-center rounded-full hover:text-gray-900 hover:bg-gray-100", { "bg-gray-100 text-gray-900": a.editor?.isActive("bulletList") }])
|
|
@@ -623,8 +605,8 @@ function Tr(t, e, a, s, n, o) {
|
|
|
623
605
|
C(l, { class: "h-4 w-4" })
|
|
624
606
|
], 2);
|
|
625
607
|
}
|
|
626
|
-
const
|
|
627
|
-
components: { ListOrdered:
|
|
608
|
+
const kr = /* @__PURE__ */ Q(xr, [["render", wr]]), _r = {
|
|
609
|
+
components: { ListOrdered: yt },
|
|
628
610
|
props: { editor: Object },
|
|
629
611
|
methods: {
|
|
630
612
|
toggleOrderedList() {
|
|
@@ -632,9 +614,9 @@ const Lr = /* @__PURE__ */ Q(Fr, [["render", Tr]]), Br = {
|
|
|
632
614
|
}
|
|
633
615
|
}
|
|
634
616
|
};
|
|
635
|
-
function
|
|
636
|
-
const l =
|
|
637
|
-
return
|
|
617
|
+
function $r(t, e, a, n, s, o) {
|
|
618
|
+
const l = Y("ListOrdered");
|
|
619
|
+
return h(), w("button", {
|
|
638
620
|
title: "Ordered List",
|
|
639
621
|
onClick: e[0] || (e[0] = (...c) => o.toggleOrderedList && o.toggleOrderedList(...c)),
|
|
640
622
|
class: E(["text-gray-500 w-[30px] h-[30px] flex items-center justify-center rounded-full hover:text-gray-900 hover:bg-gray-100", { "bg-gray-100 text-gray-900": a.editor?.isActive("orderedList") }])
|
|
@@ -642,8 +624,8 @@ function Er(t, e, a, s, n, o) {
|
|
|
642
624
|
C(l, { class: "h-4 w-4" })
|
|
643
625
|
], 2);
|
|
644
626
|
}
|
|
645
|
-
const
|
|
646
|
-
components: { CodeXml:
|
|
627
|
+
const Cr = /* @__PURE__ */ Q(_r, [["render", $r]]), Ar = {
|
|
628
|
+
components: { CodeXml: bt },
|
|
647
629
|
props: { editor: Object },
|
|
648
630
|
methods: {
|
|
649
631
|
toggleCodeBlock() {
|
|
@@ -651,9 +633,9 @@ const Ir = /* @__PURE__ */ Q(Br, [["render", Er]]), Mr = {
|
|
|
651
633
|
}
|
|
652
634
|
}
|
|
653
635
|
};
|
|
654
|
-
function
|
|
655
|
-
const l =
|
|
656
|
-
return
|
|
636
|
+
function Fr(t, e, a, n, s, o) {
|
|
637
|
+
const l = Y("CodeXml");
|
|
638
|
+
return h(), w("button", {
|
|
657
639
|
title: "Code Block",
|
|
658
640
|
onClick: e[0] || (e[0] = (...c) => o.toggleCodeBlock && o.toggleCodeBlock(...c)),
|
|
659
641
|
class: E(["text-gray-500 w-[30px] h-[30px] flex items-center justify-center rounded-full hover:text-gray-900 hover:bg-gray-100", { "bg-gray-100 text-gray-900": a.editor?.isActive("codeBlock") }])
|
|
@@ -661,8 +643,8 @@ function Pr(t, e, a, s, n, o) {
|
|
|
661
643
|
C(l, { class: "h-4 w-4" })
|
|
662
644
|
], 2);
|
|
663
645
|
}
|
|
664
|
-
const
|
|
665
|
-
components: { Bold:
|
|
646
|
+
const Sr = /* @__PURE__ */ Q(Ar, [["render", Fr]]), Lr = {
|
|
647
|
+
components: { Bold: xt },
|
|
666
648
|
props: {
|
|
667
649
|
editor: Object
|
|
668
650
|
},
|
|
@@ -672,9 +654,9 @@ const jr = /* @__PURE__ */ Q(Mr, [["render", Pr]]), Hr = {
|
|
|
672
654
|
}
|
|
673
655
|
}
|
|
674
656
|
};
|
|
675
|
-
function
|
|
676
|
-
const l =
|
|
677
|
-
return
|
|
657
|
+
function Tr(t, e, a, n, s, o) {
|
|
658
|
+
const l = Y("Bold");
|
|
659
|
+
return h(), w("button", {
|
|
678
660
|
title: "Bold Text",
|
|
679
661
|
onClick: e[0] || (e[0] = (...c) => o.toggleBold && o.toggleBold(...c)),
|
|
680
662
|
class: E(["h-[30px] w-[30px] flex items-center justify-center text-gray-500 rounded-full cursor-pointer hover:text-gray-900 hover:bg-gray-100", { "bg-gray-100 text-gray-900": a.editor?.isActive("bold") }])
|
|
@@ -683,8 +665,8 @@ function Nr(t, e, a, s, n, o) {
|
|
|
683
665
|
e[1] || (e[1] = d("span", { class: "sr-only" }, "Bold", -1))
|
|
684
666
|
], 2);
|
|
685
667
|
}
|
|
686
|
-
const
|
|
687
|
-
components: { Italic:
|
|
668
|
+
const Br = /* @__PURE__ */ Q(Lr, [["render", Tr]]), Er = {
|
|
669
|
+
components: { Italic: wt },
|
|
688
670
|
props: {
|
|
689
671
|
editor: Object
|
|
690
672
|
},
|
|
@@ -694,9 +676,9 @@ const zr = /* @__PURE__ */ Q(Hr, [["render", Nr]]), Dr = {
|
|
|
694
676
|
}
|
|
695
677
|
}
|
|
696
678
|
};
|
|
697
|
-
function
|
|
698
|
-
const l =
|
|
699
|
-
return
|
|
679
|
+
function Ir(t, e, a, n, s, o) {
|
|
680
|
+
const l = Y("Italic");
|
|
681
|
+
return h(), w("button", {
|
|
700
682
|
title: "Italic Text",
|
|
701
683
|
onClick: e[0] || (e[0] = (...c) => o.toggleItalic && o.toggleItalic(...c)),
|
|
702
684
|
class: E(["h-[30px] w-[30px] flex items-center justify-center text-gray-500 rounded-full cursor-pointer hover:text-gray-900 hover:bg-gray-100", { "bg-gray-100 text-gray-900": a.editor?.isActive("italic") }])
|
|
@@ -705,42 +687,42 @@ function Vr(t, e, a, s, n, o) {
|
|
|
705
687
|
e[1] || (e[1] = d("span", { class: "sr-only" }, "Italic", -1))
|
|
706
688
|
], 2);
|
|
707
689
|
}
|
|
708
|
-
const
|
|
690
|
+
const jr = /* @__PURE__ */ Q(Er, [["render", Ir]]), Mr = {
|
|
709
691
|
__name: "vs-editor-underline",
|
|
710
692
|
props: { editor: Object },
|
|
711
693
|
setup(t) {
|
|
712
694
|
const e = t, a = () => {
|
|
713
695
|
e.editor && e.editor.chain().focus().toggleUnderline().run();
|
|
714
696
|
};
|
|
715
|
-
return (
|
|
697
|
+
return (n, s) => (h(), w("button", {
|
|
716
698
|
title: "Underline",
|
|
717
699
|
onClick: a,
|
|
718
700
|
class: E(["w-[30px] h-[30px] flex items-center justify-center rounded-full hover:text-gray-900 hover:bg-gray-100", [
|
|
719
701
|
t.editor?.isActive("underline") ? "bg-gray-100 text-gray-900" : "text-gray-500"
|
|
720
702
|
]])
|
|
721
703
|
}, [
|
|
722
|
-
C(L(
|
|
704
|
+
C(L(kt), { class: "h-4 w-4" })
|
|
723
705
|
], 2));
|
|
724
706
|
}
|
|
725
|
-
},
|
|
707
|
+
}, Pr = {
|
|
726
708
|
__name: "vs-editor-strike",
|
|
727
709
|
props: { editor: Object },
|
|
728
710
|
setup(t) {
|
|
729
711
|
const e = t, a = () => {
|
|
730
712
|
e.editor && e.editor.chain().focus().toggleStrike().run();
|
|
731
713
|
};
|
|
732
|
-
return (
|
|
714
|
+
return (n, s) => (h(), w("button", {
|
|
733
715
|
title: "Strikethrough",
|
|
734
716
|
onClick: a,
|
|
735
717
|
class: E(["w-[30px] h-[30px] flex items-center justify-center rounded-full hover:text-gray-900 hover:bg-gray-100", [
|
|
736
718
|
t.editor?.isActive("strike") ? "bg-gray-100 text-gray-900" : "text-gray-500"
|
|
737
719
|
]])
|
|
738
720
|
}, [
|
|
739
|
-
C(L(
|
|
721
|
+
C(L(_t), { class: "h-4 w-4" })
|
|
740
722
|
], 2));
|
|
741
723
|
}
|
|
742
|
-
},
|
|
743
|
-
components: { X:
|
|
724
|
+
}, Hr = {
|
|
725
|
+
components: { X: Le },
|
|
744
726
|
props: {
|
|
745
727
|
visible: { type: Boolean, default: () => !1 },
|
|
746
728
|
modelValue: { type: Boolean, default: () => !1 },
|
|
@@ -782,22 +764,22 @@ const Or = /* @__PURE__ */ Q(Dr, [["render", Vr]]), Rr = {
|
|
|
782
764
|
e && t.target.classList.contains("vs-dialog-overlay") && this.handleClose();
|
|
783
765
|
}
|
|
784
766
|
}
|
|
785
|
-
},
|
|
767
|
+
}, Nr = {
|
|
786
768
|
key: 0,
|
|
787
769
|
class: "vsTailwind ui-dialog__wrapper"
|
|
788
|
-
},
|
|
770
|
+
}, zr = { class: "py-2.5 px-4 flex justify-between items-center border-0 border-b border-solid border-gray-200 dark:border-b-[#454545]" }, Vr = { class: "font-medium text-gray-800 dark:text-[#ffffff]" }, Dr = { class: "ui-dialog__content p-4" }, Or = {
|
|
789
771
|
key: 0,
|
|
790
772
|
class: "flex justify-end gap-x-2"
|
|
791
773
|
};
|
|
792
|
-
function
|
|
793
|
-
const l =
|
|
794
|
-
return
|
|
795
|
-
a.visible || a.modelValue ? (
|
|
774
|
+
function Rr(t, e, a, n, s, o) {
|
|
775
|
+
const l = Y("X");
|
|
776
|
+
return h(), W(Ue, { to: "body" }, [
|
|
777
|
+
a.visible || a.modelValue ? (h(), w("div", Nr, [
|
|
796
778
|
d("div", {
|
|
797
779
|
onMousedown: e[1] || (e[1] = (c) => o.closeByClickBack(c, a.closeClickBack)),
|
|
798
780
|
class: "vs-dialog-overlay vs-dialog w-full h-full fixed top-0 start-0 z-[100001] bg-black bg-opacity-50"
|
|
799
781
|
}, [
|
|
800
|
-
C(
|
|
782
|
+
C(qe, {
|
|
801
783
|
name: "content",
|
|
802
784
|
appear: ""
|
|
803
785
|
}, {
|
|
@@ -805,8 +787,8 @@ function Qr(t, e, a, s, n, o) {
|
|
|
805
787
|
d("div", {
|
|
806
788
|
class: E(["ui-dialog__modal opacity-1 flex flex-col bg-white dark:bg-[#1A1A1A] border dark:border-[#454545] pointer-events-auto shadow-[0_10px_40px_10px_rgba(0,0,0,0.08)] rounded-xl", [o.checkSize]])
|
|
807
789
|
}, [
|
|
808
|
-
d("div",
|
|
809
|
-
d("h3",
|
|
790
|
+
d("div", zr, [
|
|
791
|
+
d("h3", Vr, G(a.title), 1),
|
|
810
792
|
d("button", {
|
|
811
793
|
type: "button",
|
|
812
794
|
class: "size-8 inline-flex justify-center items-center gap-x-2 rounded-full border border-transparent bg-gray-100 text-gray-800 hover:bg-gray-200 focus:outline-none focus:bg-gray-200 disabled:opacity-50 disabled:pointer-events-none dark:bg-neutral-700 dark:hover:bg-neutral-600 dark:text-neutral-400 dark:focus:bg-neutral-600",
|
|
@@ -816,11 +798,11 @@ function Qr(t, e, a, s, n, o) {
|
|
|
816
798
|
C(l, { class: "h-4 w-4 flex-shrink-0" })
|
|
817
799
|
])
|
|
818
800
|
]),
|
|
819
|
-
d("div",
|
|
820
|
-
|
|
801
|
+
d("div", Dr, [
|
|
802
|
+
ge(t.$slots, "default", {}, void 0, !0)
|
|
821
803
|
]),
|
|
822
|
-
o.hasSlot ? (
|
|
823
|
-
|
|
804
|
+
o.hasSlot ? (h(), w("div", Or, [
|
|
805
|
+
ge(t.$slots, "footer", {
|
|
824
806
|
handleClose: o.handleClose,
|
|
825
807
|
handleConfirm: o.handleConfirm,
|
|
826
808
|
handleCancel: o.handleCancel
|
|
@@ -834,11 +816,11 @@ function Qr(t, e, a, s, n, o) {
|
|
|
834
816
|
])) : U("", !0)
|
|
835
817
|
]);
|
|
836
818
|
}
|
|
837
|
-
const
|
|
819
|
+
const Ze = /* @__PURE__ */ Q(Hr, [["render", Rr], ["__scopeId", "data-v-56ad9010"]]), Ur = ot({
|
|
838
820
|
components: {
|
|
839
|
-
IconClose:
|
|
840
|
-
IconSearch:
|
|
841
|
-
IconEmail:
|
|
821
|
+
IconClose: Le,
|
|
822
|
+
IconSearch: Ct,
|
|
823
|
+
IconEmail: $t
|
|
842
824
|
},
|
|
843
825
|
inheritAttrs: !1,
|
|
844
826
|
props: {
|
|
@@ -917,39 +899,39 @@ const lt = /* @__PURE__ */ Q(qr, [["render", Qr], ["__scopeId", "data-v-56ad9010
|
|
|
917
899
|
await this.$refs.vsText?.focus();
|
|
918
900
|
}
|
|
919
901
|
}
|
|
920
|
-
}),
|
|
902
|
+
}), qr = { class: "vs-form-text relative bg-white rounded-lg" }, Wr = {
|
|
921
903
|
key: 2,
|
|
922
904
|
class: "absolute bottom-2/4 translate-y-2/4 left-[10px] cursor-pointer"
|
|
923
|
-
},
|
|
924
|
-
function
|
|
925
|
-
const l =
|
|
926
|
-
return
|
|
927
|
-
t.clearable && t.value ? (
|
|
905
|
+
}, Xr = ["disabled", "type", "placeholder"];
|
|
906
|
+
function Kr(t, e, a, n, s, o) {
|
|
907
|
+
const l = Y("IconClose"), c = Y("IconSearch"), r = Y("IconEmail");
|
|
908
|
+
return h(), w("div", qr, [
|
|
909
|
+
t.clearable && t.value ? (h(), w("div", {
|
|
928
910
|
key: 0,
|
|
929
911
|
class: "absolute bottom-2/4 translate-y-2/4 right-3 cursor-pointer",
|
|
930
912
|
onClick: e[0] || (e[0] = (...i) => t.clearInput && t.clearInput(...i))
|
|
931
913
|
}, [
|
|
932
914
|
C(l, { class: "h-4 w-4 stroke-gray-500 transition-all hover:stroke-red-500" })
|
|
933
915
|
])) : U("", !0),
|
|
934
|
-
t.icon && t.icon === "search" ? (
|
|
916
|
+
t.icon && t.icon === "search" ? (h(), w("div", {
|
|
935
917
|
key: 1,
|
|
936
918
|
class: E(["absolute bottom-2/4 translate-y-2/4 cursor-pointer", t.iconStylePosition])
|
|
937
919
|
}, [
|
|
938
920
|
C(c, { class: "h-4 w-4 stroke-gray-500 transition-all" })
|
|
939
|
-
], 2)) : t.icon && t.icon === "email" ? (
|
|
921
|
+
], 2)) : t.icon && t.icon === "email" ? (h(), w("div", Wr, [
|
|
940
922
|
C(r, { class: "h-4 w-4 stroke-gray-500 transition-all" })
|
|
941
|
-
])) : (
|
|
923
|
+
])) : (h(), w("i", {
|
|
942
924
|
key: 3,
|
|
943
925
|
class: E(["absolute bottom-2/4 translate-y-2/4 text-gray-500 cursor-pointer", ["ti " + t.icon, t.iconStylePosition]])
|
|
944
926
|
}, null, 2)),
|
|
945
|
-
t.clearable && t.value ? (
|
|
927
|
+
t.clearable && t.value ? (h(), w("div", {
|
|
946
928
|
key: 4,
|
|
947
929
|
class: "absolute bottom-2/4 translate-y-2/4 right-3 cursor-pointer",
|
|
948
930
|
onClick: e[1] || (e[1] = (...i) => t.clearInput && t.clearInput(...i))
|
|
949
931
|
}, [
|
|
950
932
|
C(l, { class: "h-4 w-4 stroke-gray-500 transition-all hover:stroke-red-500" })
|
|
951
933
|
])) : U("", !0),
|
|
952
|
-
|
|
934
|
+
le(d("input", lt({
|
|
953
935
|
ref: "vsText",
|
|
954
936
|
disabled: t.disabled,
|
|
955
937
|
type: t.type,
|
|
@@ -960,109 +942,109 @@ function ro(t, e, a, s, n, o) {
|
|
|
960
942
|
onFocus: e[4] || (e[4] = (...i) => t.handleFocus && t.handleFocus(...i)),
|
|
961
943
|
onBlur: e[5] || (e[5] = (...i) => t.handleBlur && t.handleBlur(...i)),
|
|
962
944
|
class: [[t.inputStyle, t.checkSize], "py-2 px-3 block w-full border border-solid placeholder:text-nowrap border-stone-200 rounded-lg text-sm text-stone-800 placeholder:text-stone-400 focus:outline focus:z-10 focus:border-blue-500 focus:ring-blue-500 focus:outline-blue-500"]
|
|
963
|
-
}), null, 16,
|
|
964
|
-
[
|
|
945
|
+
}), null, 16, Xr), [
|
|
946
|
+
[at, t.value]
|
|
965
947
|
])
|
|
966
948
|
]);
|
|
967
949
|
}
|
|
968
|
-
const
|
|
950
|
+
const Je = /* @__PURE__ */ Q(Ur, [["render", Kr], ["__scopeId", "data-v-eb21a54f"]]), Gr = ["title"], Qr = { class: "flex flex-col gap-3 p-[20px]" }, Yr = { class: "relative flex items-center gap-2" }, Zr = { class: "flex-1" }, Jr = {
|
|
969
951
|
key: 0,
|
|
970
952
|
class: "flex items-center gap-2 flex-shrink-0"
|
|
971
|
-
},
|
|
953
|
+
}, eo = ["title"], to = ["title"], ro = { class: "flex items-center gap-2" }, oo = {
|
|
972
954
|
for: "openInNewTab",
|
|
973
955
|
class: "text-sm text-gray-700 cursor-pointer"
|
|
974
|
-
},
|
|
956
|
+
}, lo = { class: "flex justify-end p-[20px] gap-[10px] border-t w-full" }, ao = /* @__PURE__ */ Object.assign({
|
|
975
957
|
inheritAttrs: !1
|
|
976
958
|
}, {
|
|
977
959
|
__name: "vs-editor-link",
|
|
978
960
|
props: { editor: Object },
|
|
979
961
|
setup(t) {
|
|
980
|
-
const { t: e } =
|
|
962
|
+
const { t: e } = je(), a = t, n = _(!1), s = _(""), o = _(!1), l = _(!1), c = () => {
|
|
981
963
|
if (!a.editor) return;
|
|
982
964
|
a.editor.chain().focus().extendMarkRange("link").run();
|
|
983
965
|
const f = a.editor.getAttributes("link");
|
|
984
|
-
f.href ? (o.value = !0,
|
|
966
|
+
f.href ? (o.value = !0, s.value = f.href, l.value = f.target === "_blank") : (o.value = !1, s.value = "", l.value = !1), n.value = !0;
|
|
985
967
|
}, r = () => {
|
|
986
|
-
|
|
968
|
+
n.value = !1, s.value = "", o.value = !1, l.value = !1;
|
|
987
969
|
}, i = () => {
|
|
988
|
-
if (!a.editor || !
|
|
989
|
-
let f =
|
|
970
|
+
if (!a.editor || !s.value.trim()) return;
|
|
971
|
+
let f = s.value.trim();
|
|
990
972
|
f.match(/^https?:\/\//i) || (f = "https://" + f), a.editor.chain().focus().setLink({
|
|
991
973
|
href: f,
|
|
992
974
|
target: l.value ? "_blank" : null
|
|
993
975
|
}).run(), r();
|
|
994
976
|
}, x = () => {
|
|
995
977
|
a.editor && (a.editor.chain().focus().unsetLink().run(), r());
|
|
996
|
-
},
|
|
997
|
-
if (!
|
|
998
|
-
let f =
|
|
978
|
+
}, v = () => {
|
|
979
|
+
if (!s.value) return;
|
|
980
|
+
let f = s.value.trim();
|
|
999
981
|
f.match(/^https?:\/\//i) || (f = "https://" + f), window.open(f, "_blank", "noopener,noreferrer");
|
|
1000
982
|
};
|
|
1001
|
-
return (f, p) => (
|
|
983
|
+
return (f, p) => (h(), w(J, null, [
|
|
1002
984
|
d("button", {
|
|
1003
985
|
title: L(e)("form.richtext.link") || "Посилання",
|
|
1004
986
|
onClick: c,
|
|
1005
987
|
class: E(["text-gray-500 w-[30px] h-[30px] flex items-center justify-center rounded-full hover:text-gray-900 hover:bg-gray-100 focus:outline-none", { "bg-gray-100 text-gray-900": t.editor?.isActive("link") }])
|
|
1006
988
|
}, [
|
|
1007
|
-
C(L(
|
|
1008
|
-
], 10,
|
|
1009
|
-
C(
|
|
989
|
+
C(L(At), { class: "h-4 w-4" })
|
|
990
|
+
], 10, Gr),
|
|
991
|
+
C(Ze, {
|
|
1010
992
|
title: o.value ? L(e)("form.richtext.editLink") || "Редагувати посилання" : L(e)("form.richtext.linkTitle") || "Додати посилання",
|
|
1011
|
-
visible:
|
|
1012
|
-
"onUpdate:visible": p[2] || (p[2] = (I) =>
|
|
993
|
+
visible: n.value,
|
|
994
|
+
"onUpdate:visible": p[2] || (p[2] = (I) => n.value = I),
|
|
1013
995
|
size: "small"
|
|
1014
996
|
}, {
|
|
1015
997
|
footer: q(() => [
|
|
1016
|
-
d("div",
|
|
998
|
+
d("div", lo, [
|
|
1017
999
|
d("button", {
|
|
1018
1000
|
style: { border: "1px solid #000" },
|
|
1019
1001
|
onClick: r,
|
|
1020
1002
|
class: "py-2 px-3 inline-flex items-center gap-x-2 text-sm whitespace-nowrap text-black border-gray-200 rounded-lg !border-gray-200 hover:bg-gray-100 duration-300"
|
|
1021
|
-
},
|
|
1003
|
+
}, G(L(e)("form.richtext.cancel") || "Скасувати"), 1),
|
|
1022
1004
|
d("button", {
|
|
1023
1005
|
onClick: i,
|
|
1024
1006
|
class: "py-2 px-3 inline-flex items-center gap-x-2 text-[14px] font-[400] whitespace-nowrap text-white bg-blue-500 rounded-lg !border-gray-200 hover:bg-blue-700 duration-300"
|
|
1025
|
-
},
|
|
1007
|
+
}, G(o.value ? L(e)("form.richtext.update") || "Оновити" : L(e)("form.richtext.create") || "Створити"), 1)
|
|
1026
1008
|
])
|
|
1027
1009
|
]),
|
|
1028
1010
|
default: q(() => [
|
|
1029
|
-
d("div",
|
|
1030
|
-
d("div",
|
|
1031
|
-
d("div",
|
|
1032
|
-
C(
|
|
1033
|
-
modelValue:
|
|
1034
|
-
"onUpdate:modelValue": p[0] || (p[0] = (I) =>
|
|
1011
|
+
d("div", Qr, [
|
|
1012
|
+
d("div", Yr, [
|
|
1013
|
+
d("div", Zr, [
|
|
1014
|
+
C(Je, {
|
|
1015
|
+
modelValue: s.value,
|
|
1016
|
+
"onUpdate:modelValue": p[0] || (p[0] = (I) => s.value = I),
|
|
1035
1017
|
placeholder: L(e)("form.richtext.linkUrl") || "Введіть URL",
|
|
1036
1018
|
class: "w-full"
|
|
1037
1019
|
}, null, 8, ["modelValue", "placeholder"])
|
|
1038
1020
|
]),
|
|
1039
|
-
o.value ? (
|
|
1021
|
+
o.value ? (h(), w("div", Jr, [
|
|
1040
1022
|
d("button", {
|
|
1041
|
-
onClick:
|
|
1023
|
+
onClick: v,
|
|
1042
1024
|
class: "text-gray-500 w-[30px] h-[30px] flex items-center justify-center rounded-full hover:text-gray-900 hover:bg-gray-100 focus:outline-none transition-colors",
|
|
1043
1025
|
title: L(e)("form.richtext.openLink") || "Відкрити посилання"
|
|
1044
1026
|
}, [
|
|
1045
|
-
C(L(
|
|
1046
|
-
], 8,
|
|
1027
|
+
C(L(Ft), { class: "h-4 w-4" })
|
|
1028
|
+
], 8, eo),
|
|
1047
1029
|
d("button", {
|
|
1048
1030
|
onClick: x,
|
|
1049
1031
|
class: "text-gray-500 w-[30px] h-[30px] flex items-center justify-center rounded-full hover:text-red-600 hover:bg-red-50 focus:outline-none transition-colors",
|
|
1050
1032
|
title: L(e)("form.richtext.removeLink") || "Видалити посилання"
|
|
1051
1033
|
}, [
|
|
1052
|
-
C(L(
|
|
1053
|
-
], 8,
|
|
1034
|
+
C(L(St), { class: "h-4 w-4" })
|
|
1035
|
+
], 8, to)
|
|
1054
1036
|
])) : U("", !0)
|
|
1055
1037
|
]),
|
|
1056
|
-
d("div",
|
|
1057
|
-
|
|
1038
|
+
d("div", ro, [
|
|
1039
|
+
le(d("input", {
|
|
1058
1040
|
type: "checkbox",
|
|
1059
1041
|
id: "openInNewTab",
|
|
1060
1042
|
"onUpdate:modelValue": p[1] || (p[1] = (I) => l.value = I),
|
|
1061
1043
|
class: "w-4 h-4 text-blue-600 bg-gray-100 border-gray-300 rounded focus:ring-blue-500"
|
|
1062
1044
|
}, null, 512), [
|
|
1063
|
-
[
|
|
1045
|
+
[nt, l.value]
|
|
1064
1046
|
]),
|
|
1065
|
-
d("label",
|
|
1047
|
+
d("label", oo, G(L(e)("form.richtext.openInNewTab") || "Відкривати в новій вкладці"), 1)
|
|
1066
1048
|
])
|
|
1067
1049
|
])
|
|
1068
1050
|
]),
|
|
@@ -1070,48 +1052,48 @@ const at = /* @__PURE__ */ Q(Zr, [["render", ro], ["__scopeId", "data-v-eb21a54f
|
|
|
1070
1052
|
}, 8, ["title", "visible"])
|
|
1071
1053
|
], 64));
|
|
1072
1054
|
}
|
|
1073
|
-
}),
|
|
1055
|
+
}), pe = async (t, e, a, n = 10) => {
|
|
1074
1056
|
if (!e || !a) return;
|
|
1075
|
-
await
|
|
1076
|
-
const
|
|
1077
|
-
if (!o || !
|
|
1078
|
-
const l = await parseInt(e?.getBoundingClientRect()?.height), c = await parseInt(e?.getBoundingClientRect()?.width), r = await parseInt(a?.getBoundingClientRect()?.height), i = await parseInt(a?.getBoundingClientRect()?.width), x = await window.innerHeight,
|
|
1057
|
+
await ne();
|
|
1058
|
+
const s = await a?.getBoundingClientRect(), o = await e?.getBoundingClientRect();
|
|
1059
|
+
if (!o || !s) return;
|
|
1060
|
+
const l = await parseInt(e?.getBoundingClientRect()?.height), c = await parseInt(e?.getBoundingClientRect()?.width), r = await parseInt(a?.getBoundingClientRect()?.height), i = await parseInt(a?.getBoundingClientRect()?.width), x = await window.innerHeight, v = await window.innerWidth;
|
|
1079
1061
|
let f = 0, p = 0;
|
|
1080
|
-
const I = o.bottom +
|
|
1062
|
+
const I = o.bottom + n + r;
|
|
1081
1063
|
switch (t) {
|
|
1082
1064
|
case "top":
|
|
1083
|
-
o.top -
|
|
1065
|
+
o.top - s.height - n < 0 ? f = o.top - s.height + n + r + l : f = o.top - s.height - n, v > i + o.right + 30 ? p = o.left - s.width / 2 + o.width / 2 : p = v - 30 - i;
|
|
1084
1066
|
break;
|
|
1085
1067
|
case "bottom":
|
|
1086
|
-
x > I ? f = o.bottom +
|
|
1068
|
+
x > I ? f = o.bottom + n : f = o.bottom - n - r - l, p = o.left - s.width / 2 + o.width / 2;
|
|
1087
1069
|
break;
|
|
1088
1070
|
case "left":
|
|
1089
|
-
f = o.top -
|
|
1071
|
+
f = o.top - s.height / 2 + o.height / 2, o.left - s.width - n > 0 ? p = o.left - s.width - n : p = 10;
|
|
1090
1072
|
break;
|
|
1091
1073
|
case "right":
|
|
1092
|
-
f = o.top -
|
|
1074
|
+
f = o.top - s.height / 2 + o.height / 2, v - c > i ? p = o.right + n : p = v - 30 - i;
|
|
1093
1075
|
break;
|
|
1094
1076
|
case "top-right":
|
|
1095
|
-
o.top -
|
|
1077
|
+
o.top - s.height - n < 0 ? f = o.top - s.height + n + r + l : f = o.top - s.height - n, v - c > i ? p = o.right + n : p = v - 30 - i;
|
|
1096
1078
|
break;
|
|
1097
1079
|
case "top-left":
|
|
1098
|
-
o.top -
|
|
1080
|
+
o.top - s.height - n < 0 ? f = o.top - s.height + n + r + l : f = o.top - s.height - n, o.left - s.width - n > 0 ? p = o.left - s.width - n : p = 10;
|
|
1099
1081
|
break;
|
|
1100
1082
|
case "top-start":
|
|
1101
|
-
o.top -
|
|
1083
|
+
o.top - s.height - n < 0 ? f = o.top - s.height + n + r + l : f = o.top - s.height - n, o.left > 0 ? p = o.left : p = 10;
|
|
1102
1084
|
break;
|
|
1103
1085
|
case "bottom-right":
|
|
1104
|
-
x > I ? f = o.bottom +
|
|
1086
|
+
x > I ? f = o.bottom + n : f = o.bottom - n - r - l, v - c > i ? p = o.left : p = v - 30 - i;
|
|
1105
1087
|
break;
|
|
1106
1088
|
case "bottom-left":
|
|
1107
|
-
x > I ? f = o.bottom +
|
|
1089
|
+
x > I ? f = o.bottom + n : f = o.bottom - n - r - l, o.left > 0 ? p = o.right - i : p = 10;
|
|
1108
1090
|
break;
|
|
1109
1091
|
case "bottom-start":
|
|
1110
|
-
x > I ? f = o.bottom +
|
|
1092
|
+
x > I ? f = o.bottom + n : f = o.bottom - n - r - l, o.left > 0 ? p = o.left : p = 10;
|
|
1111
1093
|
break;
|
|
1112
1094
|
}
|
|
1113
|
-
f + r > x ? f = x - r -
|
|
1114
|
-
},
|
|
1095
|
+
f + r > x ? f = x - r - n : f < 0 && (f = n), p + i > v ? p = v - i - n : p < 0 && (p = n), a instanceof HTMLElement && (a.style.top = `${f}px`, a.style.left = `${p}px`, a.style.position = "fixed");
|
|
1096
|
+
}, no = { class: "text-center" }, so = { class: "py-2 px-4 w-full text-sm text-stone-800 bg-white shadow-[0_10px_40px_10px_rgba(0,0,0,0.08)] rounded-lg focus:outline-none focus:bg-stone-100 dark:bg-neutral-900 dark:text-neutral-200 dark:focus:bg-neutral-800 after:h-4 after:absolute after:-bottom-4 after:start-0 after:w-full before:h-4 before:absolute before:-top-4 before:start-0 before:w-full" }, se = /* @__PURE__ */ Object.assign({
|
|
1115
1097
|
inheritAttrs: !1
|
|
1116
1098
|
}, {
|
|
1117
1099
|
__name: "vs-popover",
|
|
@@ -1126,36 +1108,36 @@ const at = /* @__PURE__ */ Q(Zr, [["render", ro], ["__scopeId", "data-v-eb21a54f
|
|
|
1126
1108
|
},
|
|
1127
1109
|
emits: ["isvisible"],
|
|
1128
1110
|
setup(t, { expose: e, emit: a }) {
|
|
1129
|
-
const
|
|
1130
|
-
|
|
1111
|
+
const n = t, s = a, o = _(!1), l = _([]), c = _(null), r = _(null), i = _(null);
|
|
1112
|
+
de(o, (M) => {
|
|
1131
1113
|
M ? (x(), window.addEventListener(
|
|
1132
1114
|
"resize",
|
|
1133
|
-
() =>
|
|
1134
|
-
),
|
|
1115
|
+
() => pe(n.placement, r.value, i.value)
|
|
1116
|
+
), pe(n.placement, r.value, i.value)) : window.removeEventListener(
|
|
1135
1117
|
"resize",
|
|
1136
|
-
() =>
|
|
1137
|
-
),
|
|
1138
|
-
}),
|
|
1139
|
-
window.addEventListener("click", O), window.addEventListener("popstate", R), window.addEventListener("scroll",
|
|
1140
|
-
}),
|
|
1141
|
-
window.removeEventListener("click", O), window.removeEventListener("popstate", R),
|
|
1118
|
+
() => pe(n.placement, r.value, i.value)
|
|
1119
|
+
), s("isvisible", M);
|
|
1120
|
+
}), ue(() => {
|
|
1121
|
+
window.addEventListener("click", O), window.addEventListener("popstate", R), window.addEventListener("scroll", Z, !0), x();
|
|
1122
|
+
}), We(() => {
|
|
1123
|
+
window.removeEventListener("click", O), window.removeEventListener("popstate", R), v();
|
|
1142
1124
|
});
|
|
1143
1125
|
const x = () => {
|
|
1144
1126
|
let M = c.value;
|
|
1145
1127
|
for (; M && M !== document.body; )
|
|
1146
|
-
(M.scrollHeight > M.clientHeight || M.scrollWidth > M.clientWidth) && (M.addEventListener("scroll",
|
|
1147
|
-
document.body && (document.body.addEventListener("scroll",
|
|
1148
|
-
},
|
|
1128
|
+
(M.scrollHeight > M.clientHeight || M.scrollWidth > M.clientWidth) && (M.addEventListener("scroll", D), l.value.push(M)), M = M.parentElement;
|
|
1129
|
+
document.body && (document.body.addEventListener("scroll", D), l.value.push(document.body));
|
|
1130
|
+
}, v = () => {
|
|
1149
1131
|
l.value.forEach((M) => {
|
|
1150
|
-
M.removeEventListener("scroll",
|
|
1132
|
+
M.removeEventListener("scroll", D);
|
|
1151
1133
|
}), l.value = [];
|
|
1152
1134
|
}, f = () => {
|
|
1153
|
-
o.value = !0,
|
|
1135
|
+
o.value = !0, pe(n.placement, r.value, i.value);
|
|
1154
1136
|
}, p = () => {
|
|
1155
1137
|
o.value = !1;
|
|
1156
1138
|
}, I = async () => {
|
|
1157
|
-
await
|
|
1158
|
-
},
|
|
1139
|
+
await pe(n.placement, r.value, i.value), o.value = !o.value;
|
|
1140
|
+
}, D = () => {
|
|
1159
1141
|
o.value = !1;
|
|
1160
1142
|
}, O = (M) => {
|
|
1161
1143
|
if (!M) {
|
|
@@ -1165,29 +1147,29 @@ const at = /* @__PURE__ */ Q(Zr, [["render", ro], ["__scopeId", "data-v-eb21a54f
|
|
|
1165
1147
|
r.value?.contains(M.target) || i.value?.contains(M.target) || (o.value = !1);
|
|
1166
1148
|
}, R = () => {
|
|
1167
1149
|
o.value && (o.value = !1);
|
|
1168
|
-
},
|
|
1150
|
+
}, Z = (M) => {
|
|
1169
1151
|
o.value && i.value && !i.value.contains(M.target) && (o.value = !1);
|
|
1170
1152
|
};
|
|
1171
1153
|
return e({
|
|
1172
1154
|
togglePopover: I
|
|
1173
|
-
}), (M, ee) => (
|
|
1155
|
+
}), (M, ee) => (h(), w("div", {
|
|
1174
1156
|
ref_key: "popover",
|
|
1175
1157
|
ref: c,
|
|
1176
1158
|
class: "vs-popover inline-block"
|
|
1177
1159
|
}, [
|
|
1178
|
-
d("div",
|
|
1179
|
-
t.trigger === "click" ? (
|
|
1160
|
+
d("div", no, [
|
|
1161
|
+
t.trigger === "click" ? (h(), w("div", {
|
|
1180
1162
|
key: 0,
|
|
1181
1163
|
ref_key: "popoverRef",
|
|
1182
1164
|
ref: r,
|
|
1183
1165
|
onClick: I,
|
|
1184
1166
|
class: E({ "pointer-events-none": t.disabled })
|
|
1185
1167
|
}, [
|
|
1186
|
-
|
|
1168
|
+
ge(M.$slots, "reference", {}, () => [
|
|
1187
1169
|
ee[0] || (ee[0] = d("button", null, "Click me!", -1))
|
|
1188
1170
|
])
|
|
1189
1171
|
], 2)) : U("", !0),
|
|
1190
|
-
t.trigger === "hover" ? (
|
|
1172
|
+
t.trigger === "hover" ? (h(), w("div", {
|
|
1191
1173
|
key: 1,
|
|
1192
1174
|
ref_key: "popoverRef",
|
|
1193
1175
|
ref: r,
|
|
@@ -1195,29 +1177,29 @@ const at = /* @__PURE__ */ Q(Zr, [["render", ro], ["__scopeId", "data-v-eb21a54f
|
|
|
1195
1177
|
onMouseleave: p,
|
|
1196
1178
|
class: E({ "pointer-events-none": t.disabled })
|
|
1197
1179
|
}, [
|
|
1198
|
-
|
|
1180
|
+
ge(M.$slots, "reference", {}, () => [
|
|
1199
1181
|
ee[1] || (ee[1] = d("button", null, "Click me!", -1))
|
|
1200
1182
|
])
|
|
1201
1183
|
], 34)) : U("", !0),
|
|
1202
|
-
(
|
|
1203
|
-
C(
|
|
1184
|
+
(h(), W(Ue, { to: t.teleport }, [
|
|
1185
|
+
C(qe, { name: "fade" }, {
|
|
1204
1186
|
default: q(() => [
|
|
1205
|
-
|
|
1187
|
+
le(d("div", {
|
|
1206
1188
|
class: E(["vsTailwind vs-popover__content", t.placement]),
|
|
1207
1189
|
ref_key: "contentPop",
|
|
1208
1190
|
ref: i,
|
|
1209
|
-
style:
|
|
1191
|
+
style: te({
|
|
1210
1192
|
width: t.width ? t.width + "px" : "fit-content",
|
|
1211
1193
|
zIndex: 100001
|
|
1212
1194
|
})
|
|
1213
1195
|
}, [
|
|
1214
|
-
d("div",
|
|
1215
|
-
|
|
1196
|
+
d("div", so, [
|
|
1197
|
+
ge(M.$slots, "default", {}, () => [
|
|
1216
1198
|
ee[2] || (ee[2] = d("span", null, "Popover content", -1))
|
|
1217
1199
|
])
|
|
1218
1200
|
])
|
|
1219
1201
|
], 6), [
|
|
1220
|
-
[
|
|
1202
|
+
[me, o.value]
|
|
1221
1203
|
])
|
|
1222
1204
|
]),
|
|
1223
1205
|
_: 3
|
|
@@ -1226,26 +1208,26 @@ const at = /* @__PURE__ */ Q(Zr, [["render", ro], ["__scopeId", "data-v-eb21a54f
|
|
|
1226
1208
|
])
|
|
1227
1209
|
], 512));
|
|
1228
1210
|
}
|
|
1229
|
-
}),
|
|
1211
|
+
}), io = { class: "flex flex-col gap-[2px] p-[2px]" }, co = ["onClick"], uo = {
|
|
1230
1212
|
__name: "vs-editor-table",
|
|
1231
1213
|
props: { editor: Object },
|
|
1232
1214
|
setup(t) {
|
|
1233
|
-
const { t: e } =
|
|
1234
|
-
a.editor && (a.editor.chain().focus().insertTable({ rows: 3, cols: 3, withHeaderRow: !0 }).run(),
|
|
1215
|
+
const { t: e } = je(), a = t, n = _(!1), s = _("popover"), o = () => {
|
|
1216
|
+
a.editor && (a.editor.chain().focus().insertTable({ rows: 3, cols: 3, withHeaderRow: !0 }).run(), s.value.togglePopover());
|
|
1235
1217
|
}, l = () => {
|
|
1236
|
-
a.editor && (a.editor.chain().focus().addColumnAfter().run(),
|
|
1218
|
+
a.editor && (a.editor.chain().focus().addColumnAfter().run(), s.value.togglePopover());
|
|
1237
1219
|
}, c = () => {
|
|
1238
|
-
a.editor && (a.editor.chain().focus().addRowAfter().run(),
|
|
1220
|
+
a.editor && (a.editor.chain().focus().addRowAfter().run(), s.value.togglePopover());
|
|
1239
1221
|
}, r = () => {
|
|
1240
|
-
a.editor && (a.editor.chain().focus().deleteColumn().run(),
|
|
1222
|
+
a.editor && (a.editor.chain().focus().deleteColumn().run(), s.value.togglePopover());
|
|
1241
1223
|
}, i = () => {
|
|
1242
|
-
a.editor && (a.editor.chain().focus().deleteRow().run(),
|
|
1224
|
+
a.editor && (a.editor.chain().focus().deleteRow().run(), s.value.togglePopover());
|
|
1243
1225
|
}, x = () => {
|
|
1244
|
-
a.editor && (a.editor.chain().focus().deleteTable().run(),
|
|
1245
|
-
},
|
|
1246
|
-
a.editor && (a.editor.chain().focus().mergeCells().run(),
|
|
1226
|
+
a.editor && (a.editor.chain().focus().deleteTable().run(), s.value.togglePopover());
|
|
1227
|
+
}, v = () => {
|
|
1228
|
+
a.editor && (a.editor.chain().focus().mergeCells().run(), s.value.togglePopover());
|
|
1247
1229
|
}, f = () => {
|
|
1248
|
-
a.editor && (a.editor.chain().focus().splitCell().run(),
|
|
1230
|
+
a.editor && (a.editor.chain().focus().splitCell().run(), s.value.togglePopover());
|
|
1249
1231
|
}, p = N(() => [
|
|
1250
1232
|
{ text: e("form.richtext.createTable"), function: o },
|
|
1251
1233
|
{ text: e("form.richtext.addColumn"), function: l },
|
|
@@ -1253,99 +1235,99 @@ const at = /* @__PURE__ */ Q(Zr, [["render", ro], ["__scopeId", "data-v-eb21a54f
|
|
|
1253
1235
|
{ text: e("form.richtext.deleteColumn"), function: r },
|
|
1254
1236
|
{ text: e("form.richtext.deleteRow"), function: i },
|
|
1255
1237
|
{ text: e("form.richtext.deleteTable"), function: x },
|
|
1256
|
-
{ text: e("form.richtext.mergeCells"), function:
|
|
1238
|
+
{ text: e("form.richtext.mergeCells"), function: v },
|
|
1257
1239
|
{ text: e("form.richtext.splitCells"), function: f }
|
|
1258
1240
|
]);
|
|
1259
|
-
return (I,
|
|
1241
|
+
return (I, D) => (h(), W(se, {
|
|
1260
1242
|
ref_key: "popover",
|
|
1261
|
-
ref:
|
|
1243
|
+
ref: s,
|
|
1262
1244
|
placement: "bottom",
|
|
1263
|
-
onIsvisible:
|
|
1245
|
+
onIsvisible: D[0] || (D[0] = (O) => n.value = O)
|
|
1264
1246
|
}, {
|
|
1265
1247
|
reference: q(() => [
|
|
1266
1248
|
d("button", {
|
|
1267
1249
|
title: "Table",
|
|
1268
|
-
class: E(["w-[30px] h-[30px] flex items-center justify-center text-gray-500 rounded-full hover:text-gray-900 hover:bg-gray-100", [
|
|
1250
|
+
class: E(["w-[30px] h-[30px] flex items-center justify-center text-gray-500 rounded-full hover:text-gray-900 hover:bg-gray-100", [n.value ? "bg-gray-100 text-gray-900" : "text-gray-500"]])
|
|
1269
1251
|
}, [
|
|
1270
|
-
C(L(
|
|
1252
|
+
C(L(Lt), { class: "h-4 w-4" })
|
|
1271
1253
|
], 2)
|
|
1272
1254
|
]),
|
|
1273
1255
|
default: q(() => [
|
|
1274
|
-
d("div",
|
|
1275
|
-
(
|
|
1256
|
+
d("div", io, [
|
|
1257
|
+
(h(!0), w(J, null, re(p.value, (O, R) => (h(), w("button", {
|
|
1276
1258
|
key: R,
|
|
1277
1259
|
onClick: O?.function,
|
|
1278
1260
|
class: "px-2 py-1 text-gray-500 text-start hover:text-gray-900 hover:bg-gray-100 rounded"
|
|
1279
|
-
},
|
|
1261
|
+
}, G(O.text), 9, co))), 128))
|
|
1280
1262
|
])
|
|
1281
1263
|
]),
|
|
1282
1264
|
_: 1
|
|
1283
1265
|
}, 512));
|
|
1284
1266
|
}
|
|
1285
|
-
},
|
|
1267
|
+
}, fo = { class: "flex gap-[4px] p-1" }, po = ["title", "onClick"], go = {
|
|
1286
1268
|
__name: "vs-editor-align",
|
|
1287
1269
|
props: { editor: Object },
|
|
1288
1270
|
setup(t) {
|
|
1289
1271
|
const e = t, a = {
|
|
1290
|
-
left:
|
|
1291
|
-
center:
|
|
1292
|
-
right:
|
|
1293
|
-
justify:
|
|
1294
|
-
},
|
|
1272
|
+
left: It,
|
|
1273
|
+
center: Et,
|
|
1274
|
+
right: Bt,
|
|
1275
|
+
justify: Tt
|
|
1276
|
+
}, n = _(!1), s = _("popover"), o = _("left"), l = N(() => e.editor ? e.editor.isActive("paragraph", { textAlign: "left" }) || e.editor.isActive("heading", { textAlign: "left" }) : !1), c = N(() => e.editor ? e.editor.isActive("paragraph", { textAlign: "right" }) || e.editor.isActive("heading", { textAlign: "right" }) : !1), r = N(() => e.editor ? e.editor.isActive("paragraph", { textAlign: "center" }) || e.editor.isActive("heading", { textAlign: "center" }) : !1), i = N(() => e.editor ? e.editor.isActive("paragraph", { textAlign: "justify" }) || e.editor.isActive("heading", { textAlign: "justify" }) : !1), x = N(() => l.value || c.value || r.value || i.value), v = () => {
|
|
1295
1277
|
c.value ? o.value = "right" : r.value ? o.value = "center" : i.value ? o.value = "justify" : o.value = "left";
|
|
1296
1278
|
};
|
|
1297
|
-
|
|
1298
|
-
|
|
1299
|
-
}, { immediate: !0 }),
|
|
1300
|
-
e.editor && (e.editor.on("selectionUpdate",
|
|
1301
|
-
}),
|
|
1302
|
-
e.editor && (e.editor.off("selectionUpdate",
|
|
1279
|
+
de([l, c, r, i], () => {
|
|
1280
|
+
v();
|
|
1281
|
+
}, { immediate: !0 }), ue(() => {
|
|
1282
|
+
e.editor && (e.editor.on("selectionUpdate", v), e.editor.on("update", v));
|
|
1283
|
+
}), _e(() => {
|
|
1284
|
+
e.editor && (e.editor.off("selectionUpdate", v), e.editor.off("update", v));
|
|
1303
1285
|
});
|
|
1304
1286
|
const f = (I) => {
|
|
1305
1287
|
e.editor && (e.editor.chain().focus().setTextAlign(I).run(), o.value = I);
|
|
1306
|
-
}, p =
|
|
1288
|
+
}, p = _([
|
|
1307
1289
|
{ id: "left", isActive: l },
|
|
1308
1290
|
{ id: "center", isActive: r },
|
|
1309
1291
|
{ id: "right", isActive: c },
|
|
1310
1292
|
{ id: "justify", isActive: i }
|
|
1311
1293
|
]);
|
|
1312
|
-
return (I,
|
|
1294
|
+
return (I, D) => (h(), W(se, {
|
|
1313
1295
|
ref_key: "popover",
|
|
1314
|
-
ref:
|
|
1296
|
+
ref: s,
|
|
1315
1297
|
placement: "bottom",
|
|
1316
|
-
onIsvisible:
|
|
1298
|
+
onIsvisible: D[0] || (D[0] = (O) => n.value = O)
|
|
1317
1299
|
}, {
|
|
1318
1300
|
reference: q(() => [
|
|
1319
1301
|
d("button", {
|
|
1320
1302
|
title: "Text Align",
|
|
1321
1303
|
class: E(["w-[30px] h-[30px] flex items-center justify-center text-gray-500 rounded-full hover:text-gray-900 hover:bg-gray-100", [x.value ? "bg-gray-100 text-gray-900" : "text-gray-500"]])
|
|
1322
1304
|
}, [
|
|
1323
|
-
(
|
|
1305
|
+
(h(), W(Fe(a[o.value]), {
|
|
1324
1306
|
height: "16",
|
|
1325
1307
|
width: "16"
|
|
1326
1308
|
}))
|
|
1327
1309
|
], 2)
|
|
1328
1310
|
]),
|
|
1329
1311
|
default: q(() => [
|
|
1330
|
-
d("div",
|
|
1331
|
-
(
|
|
1312
|
+
d("div", fo, [
|
|
1313
|
+
(h(!0), w(J, null, re(p.value, (O) => (h(), w("button", {
|
|
1332
1314
|
title: "Text align " + O?.id,
|
|
1333
1315
|
class: E(["w-[30px] h-[30px] flex items-center justify-center text-gray-500 rounded hover:text-gray-900 hover:bg-gray-100", { "bg-gray-100 text-gray-900": O?.isActive }]),
|
|
1334
1316
|
key: O?.id,
|
|
1335
1317
|
onClick: (R) => f(O?.id)
|
|
1336
1318
|
}, [
|
|
1337
|
-
(
|
|
1319
|
+
(h(), W(Fe(a[O?.id]), {
|
|
1338
1320
|
height: "16",
|
|
1339
1321
|
width: "16"
|
|
1340
1322
|
}))
|
|
1341
|
-
], 10,
|
|
1323
|
+
], 10, po))), 128))
|
|
1342
1324
|
])
|
|
1343
1325
|
]),
|
|
1344
1326
|
_: 1
|
|
1345
1327
|
}, 512));
|
|
1346
1328
|
}
|
|
1347
|
-
},
|
|
1348
|
-
components: { VsText:
|
|
1329
|
+
}, ho = {
|
|
1330
|
+
components: { VsText: Je },
|
|
1349
1331
|
inheritAttrs: !1,
|
|
1350
1332
|
events: ["update:modelValue"],
|
|
1351
1333
|
props: {
|
|
@@ -1364,19 +1346,19 @@ const at = /* @__PURE__ */ Q(Zr, [["render", ro], ["__scopeId", "data-v-eb21a54f
|
|
|
1364
1346
|
}
|
|
1365
1347
|
}
|
|
1366
1348
|
}
|
|
1367
|
-
},
|
|
1368
|
-
function
|
|
1369
|
-
const l =
|
|
1370
|
-
return
|
|
1371
|
-
|
|
1349
|
+
}, vo = { class: "flex items-center w-full max-w-[182px]" }, mo = ["disabled"];
|
|
1350
|
+
function yo(t, e, a, n, s, o) {
|
|
1351
|
+
const l = Y("vs-text");
|
|
1352
|
+
return h(), w("div", vo, [
|
|
1353
|
+
le(d("input", {
|
|
1372
1354
|
"onUpdate:modelValue": e[0] || (e[0] = (c) => o.value = c),
|
|
1373
1355
|
type: "color",
|
|
1374
1356
|
class: E(["w-[38px] h-[38px] min-h-[38px] min-w-[38px] py-[2px] px-[3px] -ml-1 dark:bg-neutral-800 border dark:border-neutral-700 border-stone-200 rounded-lg", a.disabled ? "cursor-not-allowed" : "cursor-pointer"]),
|
|
1375
1357
|
disabled: a.disabled
|
|
1376
|
-
}, null, 10,
|
|
1377
|
-
[
|
|
1358
|
+
}, null, 10, mo), [
|
|
1359
|
+
[st, o.value]
|
|
1378
1360
|
]),
|
|
1379
|
-
a.isTextInputShown ? (
|
|
1361
|
+
a.isTextInputShown ? (h(), W(l, {
|
|
1380
1362
|
key: 0,
|
|
1381
1363
|
modelValue: o.value,
|
|
1382
1364
|
"onUpdate:modelValue": e[1] || (e[1] = (c) => o.value = c),
|
|
@@ -1386,21 +1368,21 @@ function Ao(t, e, a, s, n, o) {
|
|
|
1386
1368
|
}, null, 8, ["modelValue", "disabled", "clearable"])) : U("", !0)
|
|
1387
1369
|
]);
|
|
1388
1370
|
}
|
|
1389
|
-
const
|
|
1371
|
+
const et = /* @__PURE__ */ Q(ho, [["render", yo]]), bo = { class: "flex gap-[4px] mb-[8px]" }, xo = { class: "grid grid-rows-3 grid-cols-7" }, wo = { class: "w-full h-full rounded border border-gray-300 overflow-hidden" }, ko = ["onClick", "title"], _o = {
|
|
1390
1372
|
__name: "vs-editor-color",
|
|
1391
1373
|
props: {
|
|
1392
1374
|
editor: Object
|
|
1393
1375
|
},
|
|
1394
1376
|
setup(t) {
|
|
1395
|
-
const e = t, a =
|
|
1396
|
-
e.editor && (
|
|
1377
|
+
const e = t, a = _(null), n = _("#000000"), s = N(() => e.editor && e.editor.getAttributes("textStyle").color || "#000000"), o = N(() => s.value !== "#000000"), l = () => {
|
|
1378
|
+
e.editor && (n.value = s.value);
|
|
1397
1379
|
};
|
|
1398
|
-
|
|
1380
|
+
ue(() => {
|
|
1399
1381
|
e.editor && (e.editor.on("selectionUpdate", l), e.editor.on("update", l), l());
|
|
1400
|
-
}),
|
|
1382
|
+
}), _e(() => {
|
|
1401
1383
|
e.editor && (e.editor.off("selectionUpdate", l), e.editor.off("update", l));
|
|
1402
1384
|
});
|
|
1403
|
-
const c =
|
|
1385
|
+
const c = _([
|
|
1404
1386
|
"#172B4D",
|
|
1405
1387
|
"#0747A6",
|
|
1406
1388
|
"#008DA6",
|
|
@@ -1422,11 +1404,11 @@ const nt = /* @__PURE__ */ Q(_o, [["render", Ao]]), So = { class: "flex gap-[4px
|
|
|
1422
1404
|
"#FFF0B3",
|
|
1423
1405
|
"#FFBDAD",
|
|
1424
1406
|
"#EAE6FF"
|
|
1425
|
-
]), r = (
|
|
1426
|
-
e.editor && (e.editor.chain().focus().setColor(
|
|
1407
|
+
]), r = (v) => {
|
|
1408
|
+
e.editor && (e.editor.chain().focus().setColor(v).run(), n.value = v, a.value && a.value.togglePopover());
|
|
1427
1409
|
}, i = () => {
|
|
1428
|
-
r(
|
|
1429
|
-
}, x = (
|
|
1410
|
+
r(n.value);
|
|
1411
|
+
}, x = (v) => ({
|
|
1430
1412
|
"#172B4D": "Default",
|
|
1431
1413
|
"#0747A6": "Bright blue",
|
|
1432
1414
|
"#008DA6": "Bright blue-green",
|
|
@@ -1448,8 +1430,8 @@ const nt = /* @__PURE__ */ Q(_o, [["render", Ao]]), So = { class: "flex gap-[4px
|
|
|
1448
1430
|
"#FFF0B3": "Bright yellow",
|
|
1449
1431
|
"#FFBDAD": "Bright red",
|
|
1450
1432
|
"#EAE6FF": "Bright purple"
|
|
1451
|
-
})[
|
|
1452
|
-
return (
|
|
1433
|
+
})[v] || v;
|
|
1434
|
+
return (v, f) => (h(), W(se, {
|
|
1453
1435
|
ref_key: "popover",
|
|
1454
1436
|
ref: a,
|
|
1455
1437
|
placement: "bottom"
|
|
@@ -1462,41 +1444,41 @@ const nt = /* @__PURE__ */ Q(_o, [["render", Ao]]), So = { class: "flex gap-[4px
|
|
|
1462
1444
|
f[1] || (f[1] = d("span", { class: "leading-none" }, "A", -1)),
|
|
1463
1445
|
d("span", {
|
|
1464
1446
|
class: "block h-1 w-5",
|
|
1465
|
-
style:
|
|
1447
|
+
style: te({ backgroundColor: n.value })
|
|
1466
1448
|
}, null, 4)
|
|
1467
1449
|
], 2)
|
|
1468
1450
|
]),
|
|
1469
1451
|
default: q(() => [
|
|
1470
1452
|
d("div", null, [
|
|
1471
|
-
d("div",
|
|
1472
|
-
C(
|
|
1473
|
-
modelValue:
|
|
1474
|
-
"onUpdate:modelValue": f[0] || (f[0] = (p) =>
|
|
1453
|
+
d("div", bo, [
|
|
1454
|
+
C(et, {
|
|
1455
|
+
modelValue: n.value,
|
|
1456
|
+
"onUpdate:modelValue": f[0] || (f[0] = (p) => n.value = p)
|
|
1475
1457
|
}, null, 8, ["modelValue"]),
|
|
1476
1458
|
d("button", {
|
|
1477
1459
|
onClick: i,
|
|
1478
1460
|
class: "h-[38px] w-[38px] bg-blue-500 shrink-0 border rounded-md flex items-center justify-center hover:bg-blue-700 duration-300"
|
|
1479
1461
|
}, [
|
|
1480
|
-
C(L(
|
|
1462
|
+
C(L(he), { class: "h-4 w-4 text-white" })
|
|
1481
1463
|
])
|
|
1482
1464
|
]),
|
|
1483
|
-
d("div",
|
|
1484
|
-
(
|
|
1465
|
+
d("div", xo, [
|
|
1466
|
+
(h(!0), w(J, null, re(c.value, (p) => (h(), w("div", {
|
|
1485
1467
|
key: p,
|
|
1486
1468
|
class: "h-8 w-8 p-0.5 rounded border border-transparent hover:border-gray-200 transition-transform cursor-pointer"
|
|
1487
1469
|
}, [
|
|
1488
|
-
d("div",
|
|
1470
|
+
d("div", wo, [
|
|
1489
1471
|
d("button", {
|
|
1490
1472
|
class: "flex items-center justify-center w-full h-full",
|
|
1491
|
-
style:
|
|
1473
|
+
style: te({ backgroundColor: p }),
|
|
1492
1474
|
onClick: (I) => r(p),
|
|
1493
1475
|
title: x(p)
|
|
1494
1476
|
}, [
|
|
1495
|
-
|
|
1477
|
+
n.value === p ? (h(), W(L(he), {
|
|
1496
1478
|
key: 0,
|
|
1497
1479
|
class: "h-4 w-4 text-gray-500"
|
|
1498
1480
|
})) : U("", !0)
|
|
1499
|
-
], 12,
|
|
1481
|
+
], 12, ko)
|
|
1500
1482
|
])
|
|
1501
1483
|
]))), 128))
|
|
1502
1484
|
])
|
|
@@ -1505,21 +1487,21 @@ const nt = /* @__PURE__ */ Q(_o, [["render", Ao]]), So = { class: "flex gap-[4px
|
|
|
1505
1487
|
_: 1
|
|
1506
1488
|
}, 512));
|
|
1507
1489
|
}
|
|
1508
|
-
},
|
|
1490
|
+
}, $o = { class: "flex gap-[4px] mb-[8px]" }, Co = { class: "grid grid-rows-3 grid-cols-7" }, Ao = { class: "w-full h-full rounded border border-gray-300 overflow-hidden" }, Fo = ["onClick", "title"], So = ["onClick", "title"], Lo = {
|
|
1509
1491
|
__name: "vs-editor-background-color",
|
|
1510
1492
|
props: {
|
|
1511
1493
|
editor: Object
|
|
1512
1494
|
},
|
|
1513
1495
|
setup(t) {
|
|
1514
|
-
const e = t, a =
|
|
1515
|
-
e.editor && (
|
|
1496
|
+
const e = t, a = _(null), n = _("transparent"), s = N(() => e.editor && e.editor.getAttributes("textStyle").backgroundColor || "transparent"), o = N(() => s.value !== "transparent" && s.value !== ""), l = () => {
|
|
1497
|
+
e.editor && (n.value = s.value);
|
|
1516
1498
|
};
|
|
1517
|
-
|
|
1499
|
+
ue(() => {
|
|
1518
1500
|
e.editor && (e.editor.on("selectionUpdate", l), e.editor.on("update", l), l());
|
|
1519
|
-
}),
|
|
1501
|
+
}), _e(() => {
|
|
1520
1502
|
e.editor && (e.editor.off("selectionUpdate", l), e.editor.off("update", l));
|
|
1521
1503
|
});
|
|
1522
|
-
const c =
|
|
1504
|
+
const c = _([
|
|
1523
1505
|
"#172B4D",
|
|
1524
1506
|
"#0747A6",
|
|
1525
1507
|
"#008DA6",
|
|
@@ -1541,11 +1523,11 @@ const nt = /* @__PURE__ */ Q(_o, [["render", Ao]]), So = { class: "flex gap-[4px
|
|
|
1541
1523
|
"#FFF0B3",
|
|
1542
1524
|
"#FFBDAD",
|
|
1543
1525
|
"#EAE6FF"
|
|
1544
|
-
]), r = (
|
|
1545
|
-
e.editor && (e.editor.chain().focus().setBackgroundColor(
|
|
1526
|
+
]), r = (v) => {
|
|
1527
|
+
e.editor && (e.editor.chain().focus().setBackgroundColor(v).run(), n.value = v, a.value && a.value.togglePopover());
|
|
1546
1528
|
}, i = () => {
|
|
1547
|
-
r(
|
|
1548
|
-
}, x = (
|
|
1529
|
+
r(n.value);
|
|
1530
|
+
}, x = (v) => ({
|
|
1549
1531
|
"#172B4D": "Default",
|
|
1550
1532
|
"#0747A6": "Bright blue",
|
|
1551
1533
|
"#008DA6": "Bright blue-green",
|
|
@@ -1567,8 +1549,8 @@ const nt = /* @__PURE__ */ Q(_o, [["render", Ao]]), So = { class: "flex gap-[4px
|
|
|
1567
1549
|
"#FFF0B3": "Bright yellow",
|
|
1568
1550
|
"#FFBDAD": "Bright red",
|
|
1569
1551
|
"#EAE6FF": "Bright purple"
|
|
1570
|
-
})[
|
|
1571
|
-
return (
|
|
1552
|
+
})[v] || v;
|
|
1553
|
+
return (v, f) => (h(), W(se, {
|
|
1572
1554
|
ref_key: "popover",
|
|
1573
1555
|
ref: a,
|
|
1574
1556
|
placement: "bottom"
|
|
@@ -1578,63 +1560,63 @@ const nt = /* @__PURE__ */ Q(_o, [["render", Ao]]), So = { class: "flex gap-[4px
|
|
|
1578
1560
|
title: "Background Color",
|
|
1579
1561
|
class: E(["flex flex-col h-[30px] px-1 rounded-full hover:bg-gray-100 justify-center items-center relative flex", { "bg-gray-100": o.value }])
|
|
1580
1562
|
}, [
|
|
1581
|
-
C(L(
|
|
1563
|
+
C(L(Mt), { class: "h-4 w-4" }),
|
|
1582
1564
|
d("span", {
|
|
1583
1565
|
class: "block h-1 w-5",
|
|
1584
|
-
style:
|
|
1566
|
+
style: te({ backgroundColor: n.value })
|
|
1585
1567
|
}, null, 4)
|
|
1586
1568
|
], 2)
|
|
1587
1569
|
]),
|
|
1588
1570
|
default: q(() => [
|
|
1589
1571
|
d("div", null, [
|
|
1590
|
-
d("div",
|
|
1591
|
-
C(
|
|
1592
|
-
modelValue:
|
|
1593
|
-
"onUpdate:modelValue": f[0] || (f[0] = (p) =>
|
|
1572
|
+
d("div", $o, [
|
|
1573
|
+
C(et, {
|
|
1574
|
+
modelValue: n.value,
|
|
1575
|
+
"onUpdate:modelValue": f[0] || (f[0] = (p) => n.value = p)
|
|
1594
1576
|
}, null, 8, ["modelValue"]),
|
|
1595
1577
|
d("button", {
|
|
1596
1578
|
onClick: i,
|
|
1597
1579
|
class: "h-[38px] w-[38px] bg-blue-500 shrink-0 border rounded-md flex items-center justify-center hover:bg-blue-700 duration-300"
|
|
1598
1580
|
}, [
|
|
1599
|
-
C(L(
|
|
1581
|
+
C(L(he), { class: "h-4 w-4 text-white" })
|
|
1600
1582
|
])
|
|
1601
1583
|
]),
|
|
1602
|
-
d("div",
|
|
1584
|
+
d("div", Co, [
|
|
1603
1585
|
d("button", {
|
|
1604
1586
|
onClick: f[1] || (f[1] = (p) => r("transparent")),
|
|
1605
1587
|
class: "col-span-7 flex items-center justify-center gap-2 bg-gray-100 rounded-md py-1 mb-2 hover:bg-gray-200"
|
|
1606
1588
|
}, [
|
|
1607
|
-
C(L(
|
|
1589
|
+
C(L(jt), { class: "h-4 w-4" }),
|
|
1608
1590
|
f[2] || (f[2] = d("p", null, "no color", -1))
|
|
1609
1591
|
]),
|
|
1610
|
-
(
|
|
1592
|
+
(h(!0), w(J, null, re(c.value, (p) => (h(), w("div", {
|
|
1611
1593
|
key: p,
|
|
1612
1594
|
class: "h-8 w-8 p-0.5 rounded border border-transparent hover:border-gray-200 transition-transform cursor-pointer"
|
|
1613
1595
|
}, [
|
|
1614
|
-
d("div",
|
|
1615
|
-
p !== "transparent" ? (
|
|
1596
|
+
d("div", Ao, [
|
|
1597
|
+
p !== "transparent" ? (h(), w("button", {
|
|
1616
1598
|
key: 0,
|
|
1617
1599
|
class: "flex items-center justify-center w-full h-full",
|
|
1618
|
-
style:
|
|
1600
|
+
style: te({ backgroundColor: p }),
|
|
1619
1601
|
onClick: (I) => r(p),
|
|
1620
1602
|
title: x(p)
|
|
1621
1603
|
}, [
|
|
1622
|
-
|
|
1604
|
+
n.value === p ? (h(), W(L(he), {
|
|
1623
1605
|
key: 0,
|
|
1624
1606
|
class: "h-4 w-4 text-gray-500"
|
|
1625
1607
|
})) : U("", !0)
|
|
1626
|
-
], 12,
|
|
1627
|
-
p === "transparent" ? (
|
|
1608
|
+
], 12, Fo)) : U("", !0),
|
|
1609
|
+
p === "transparent" ? (h(), w("button", {
|
|
1628
1610
|
key: 1,
|
|
1629
1611
|
class: "flex items-center justify-center w-full h-full",
|
|
1630
1612
|
onClick: (I) => r(p),
|
|
1631
1613
|
title: x(p)
|
|
1632
1614
|
}, [
|
|
1633
|
-
|
|
1615
|
+
n.value === p ? (h(), W(L(he), {
|
|
1634
1616
|
key: 0,
|
|
1635
1617
|
class: "h-4 w-4 text-gray-500"
|
|
1636
1618
|
})) : U("", !0)
|
|
1637
|
-
], 8,
|
|
1619
|
+
], 8, So)) : U("", !0)
|
|
1638
1620
|
])
|
|
1639
1621
|
]))), 128))
|
|
1640
1622
|
])
|
|
@@ -1643,30 +1625,30 @@ const nt = /* @__PURE__ */ Q(_o, [["render", Ao]]), So = { class: "flex gap-[4px
|
|
|
1643
1625
|
_: 1
|
|
1644
1626
|
}, 512));
|
|
1645
1627
|
}
|
|
1646
|
-
},
|
|
1628
|
+
}, To = {
|
|
1647
1629
|
__name: "vs-editor-highlight",
|
|
1648
1630
|
props: {
|
|
1649
1631
|
editor: Object
|
|
1650
1632
|
},
|
|
1651
1633
|
setup(t) {
|
|
1652
|
-
const e = t, a = N(() => e.editor?.isActive("highlight")),
|
|
1634
|
+
const e = t, a = N(() => e.editor?.isActive("highlight")), n = () => {
|
|
1653
1635
|
e.editor && e.editor.chain().focus().toggleHighlight().run();
|
|
1654
1636
|
};
|
|
1655
|
-
return (
|
|
1637
|
+
return (s, o) => (h(), w("button", {
|
|
1656
1638
|
title: "Highlight",
|
|
1657
|
-
onClick:
|
|
1639
|
+
onClick: n,
|
|
1658
1640
|
class: E(["flex flex-col h-[30px] px-1 rounded-full hover:bg-gray-100 justify-center items-center relative flex", { "bg-gray-200": a.value }])
|
|
1659
1641
|
}, [
|
|
1660
|
-
C(L(
|
|
1642
|
+
C(L(Pt), { class: "h-4 w-4" })
|
|
1661
1643
|
], 2));
|
|
1662
1644
|
}
|
|
1663
|
-
},
|
|
1645
|
+
}, Bo = { class: "truncate" }, Eo = { class: "w-[200px]" }, Io = { class: "max-h-[200px] overflow-y-auto" }, jo = ["onClick"], Mo = {
|
|
1664
1646
|
__name: "vs-editor-font-family",
|
|
1665
1647
|
props: {
|
|
1666
1648
|
editor: Object
|
|
1667
1649
|
},
|
|
1668
1650
|
setup(t) {
|
|
1669
|
-
const e = t, a =
|
|
1651
|
+
const e = t, a = _("popover"), n = _(!1), s = _([
|
|
1670
1652
|
{ label: "Arial", value: "Arial, sans-serif" },
|
|
1671
1653
|
{ label: "Helvetica", value: "Helvetica, sans-serif" },
|
|
1672
1654
|
{ label: "Times New Roman", value: "Times New Roman, serif" },
|
|
@@ -1679,59 +1661,59 @@ const nt = /* @__PURE__ */ Q(_o, [["render", Ao]]), So = { class: "flex gap-[4px
|
|
|
1679
1661
|
{ label: "Palatino", value: "Palatino, serif" }
|
|
1680
1662
|
]), o = N(() => {
|
|
1681
1663
|
if (!e.editor) return "Arial, sans-serif";
|
|
1682
|
-
for (const i of
|
|
1664
|
+
for (const i of s.value)
|
|
1683
1665
|
if (e.editor.isActive("textStyle", { fontFamily: i.value }))
|
|
1684
1666
|
return i.value;
|
|
1685
1667
|
return "Arial, sans-serif";
|
|
1686
|
-
}), l = N(() =>
|
|
1668
|
+
}), l = N(() => s.value.find((x) => x.value === o.value)?.label || "Arial"), c = (i) => e.editor ? e.editor.isActive("textStyle", { fontFamily: i }) : !1, r = (i) => {
|
|
1687
1669
|
e.editor && (e.editor.chain().focus().setFontFamily(i).run(), a.value && a.value.togglePopover());
|
|
1688
1670
|
};
|
|
1689
|
-
return (i, x) => (
|
|
1671
|
+
return (i, x) => (h(), W(se, {
|
|
1690
1672
|
ref_key: "popover",
|
|
1691
1673
|
ref: a,
|
|
1692
1674
|
placement: "bottom",
|
|
1693
|
-
onIsvisible: x[0] || (x[0] = (
|
|
1675
|
+
onIsvisible: x[0] || (x[0] = (v) => n.value = v)
|
|
1694
1676
|
}, {
|
|
1695
1677
|
reference: q(() => [
|
|
1696
1678
|
d("button", {
|
|
1697
1679
|
title: "Font Family",
|
|
1698
|
-
class: E(["h-[30px] px-2 rounded-full hover:bg-gray-100 justify-center items-center flex text-sm", [
|
|
1699
|
-
style:
|
|
1680
|
+
class: E(["h-[30px] px-2 rounded-full hover:bg-gray-100 justify-center items-center flex text-sm", [n.value ? "bg-gray-100 text-gray-900" : "text-gray-700"]]),
|
|
1681
|
+
style: te({ fontFamily: o.value })
|
|
1700
1682
|
}, [
|
|
1701
|
-
d("span",
|
|
1702
|
-
C(L(
|
|
1683
|
+
d("span", Bo, G(l.value), 1),
|
|
1684
|
+
C(L(Te), { class: "ml-1 h-3 w-3 text-gray-400" })
|
|
1703
1685
|
], 6)
|
|
1704
1686
|
]),
|
|
1705
1687
|
default: q(() => [
|
|
1706
|
-
d("div",
|
|
1707
|
-
d("ul",
|
|
1708
|
-
(
|
|
1709
|
-
key:
|
|
1710
|
-
class: E(["px-3 py-2 hover:bg-gray-100 cursor-pointer text-sm", { "bg-gray-100": c(
|
|
1711
|
-
style:
|
|
1712
|
-
onClick: (f) => r(
|
|
1713
|
-
},
|
|
1688
|
+
d("div", Eo, [
|
|
1689
|
+
d("ul", Io, [
|
|
1690
|
+
(h(!0), w(J, null, re(s.value, (v) => (h(), w("li", {
|
|
1691
|
+
key: v.value,
|
|
1692
|
+
class: E(["px-3 py-2 hover:bg-gray-100 cursor-pointer text-sm", { "bg-gray-100": c(v.value) }]),
|
|
1693
|
+
style: te({ fontFamily: v.value }),
|
|
1694
|
+
onClick: (f) => r(v.value)
|
|
1695
|
+
}, G(v.label), 15, jo))), 128))
|
|
1714
1696
|
])
|
|
1715
1697
|
])
|
|
1716
1698
|
]),
|
|
1717
1699
|
_: 1
|
|
1718
1700
|
}, 512));
|
|
1719
1701
|
}
|
|
1720
|
-
},
|
|
1702
|
+
}, Po = { class: "w-[120px]" }, Ho = { class: "max-h-[200px] overflow-y-auto" }, No = ["onClick"], zo = {
|
|
1721
1703
|
__name: "vs-editor-font-size",
|
|
1722
1704
|
props: {
|
|
1723
1705
|
editor: Object
|
|
1724
1706
|
},
|
|
1725
1707
|
setup(t) {
|
|
1726
|
-
const e = t, a =
|
|
1727
|
-
e.editor && (
|
|
1708
|
+
const e = t, a = _("popover"), n = _("14px"), s = N(() => e.editor && e.editor.getAttributes("textStyle").fontSize || "14px"), o = N(() => s.value !== "14px"), l = () => {
|
|
1709
|
+
e.editor && (n.value = s.value);
|
|
1728
1710
|
};
|
|
1729
|
-
|
|
1711
|
+
ue(() => {
|
|
1730
1712
|
e.editor && (e.editor.on("selectionUpdate", l), e.editor.on("update", l), l());
|
|
1731
|
-
}),
|
|
1713
|
+
}), _e(() => {
|
|
1732
1714
|
e.editor && (e.editor.off("selectionUpdate", l), e.editor.off("update", l));
|
|
1733
1715
|
});
|
|
1734
|
-
const c =
|
|
1716
|
+
const c = _([
|
|
1735
1717
|
{ label: "8px", value: "8px" },
|
|
1736
1718
|
{ label: "9px", value: "9px" },
|
|
1737
1719
|
{ label: "10px", value: "10px" },
|
|
@@ -1748,9 +1730,9 @@ const nt = /* @__PURE__ */ Q(_o, [["render", Ao]]), So = { class: "flex gap-[4px
|
|
|
1748
1730
|
{ label: "48px", value: "48px" },
|
|
1749
1731
|
{ label: "72px", value: "72px" }
|
|
1750
1732
|
]), r = (i) => {
|
|
1751
|
-
e.editor && (e.editor.chain().focus().setFontSize(i).run(),
|
|
1733
|
+
e.editor && (e.editor.chain().focus().setFontSize(i).run(), n.value = i, a.value && a.value.togglePopover());
|
|
1752
1734
|
};
|
|
1753
|
-
return (i, x) => (
|
|
1735
|
+
return (i, x) => (h(), W(se, {
|
|
1754
1736
|
ref_key: "popover",
|
|
1755
1737
|
ref: a,
|
|
1756
1738
|
placement: "bottom"
|
|
@@ -1760,26 +1742,26 @@ const nt = /* @__PURE__ */ Q(_o, [["render", Ao]]), So = { class: "flex gap-[4px
|
|
|
1760
1742
|
title: "Font Size",
|
|
1761
1743
|
class: E(["h-[30px] px-2 min-w-[30px] rounded-full hover:bg-gray-100 justify-center items-center flex text-sm text-gray-700 space-x-1", { "bg-gray-100 text-gray-900": o.value }])
|
|
1762
1744
|
}, [
|
|
1763
|
-
C(L(
|
|
1764
|
-
C(L(
|
|
1745
|
+
C(L(Ht), { class: "h-4 w-4" }),
|
|
1746
|
+
C(L(Te), { class: "h-3 w-3 text-gray-400" })
|
|
1765
1747
|
], 2)
|
|
1766
1748
|
]),
|
|
1767
1749
|
default: q(() => [
|
|
1768
|
-
d("div",
|
|
1769
|
-
d("ul",
|
|
1770
|
-
(
|
|
1771
|
-
key:
|
|
1750
|
+
d("div", Po, [
|
|
1751
|
+
d("ul", Ho, [
|
|
1752
|
+
(h(!0), w(J, null, re(c.value, (v) => (h(), w("li", {
|
|
1753
|
+
key: v.value,
|
|
1772
1754
|
class: "px-3 py-2 hover:bg-gray-100 cursor-pointer",
|
|
1773
|
-
onClick: (f) => r(
|
|
1774
|
-
},
|
|
1755
|
+
onClick: (f) => r(v.value)
|
|
1756
|
+
}, G(v.label), 9, No))), 128))
|
|
1775
1757
|
])
|
|
1776
1758
|
])
|
|
1777
1759
|
]),
|
|
1778
1760
|
_: 1
|
|
1779
1761
|
}, 512));
|
|
1780
1762
|
}
|
|
1781
|
-
},
|
|
1782
|
-
components: { Superscript:
|
|
1763
|
+
}, Vo = {
|
|
1764
|
+
components: { Superscript: Nt },
|
|
1783
1765
|
props: {
|
|
1784
1766
|
editor: Object
|
|
1785
1767
|
},
|
|
@@ -1789,9 +1771,9 @@ const nt = /* @__PURE__ */ Q(_o, [["render", Ao]]), So = { class: "flex gap-[4px
|
|
|
1789
1771
|
}
|
|
1790
1772
|
}
|
|
1791
1773
|
};
|
|
1792
|
-
function
|
|
1793
|
-
const l =
|
|
1794
|
-
return
|
|
1774
|
+
function Do(t, e, a, n, s, o) {
|
|
1775
|
+
const l = Y("Superscript");
|
|
1776
|
+
return h(), w("button", {
|
|
1795
1777
|
title: "Superscript",
|
|
1796
1778
|
onClick: e[0] || (e[0] = (...c) => o.toggleSuperscript && o.toggleSuperscript(...c)),
|
|
1797
1779
|
class: E(["h-[30px] w-[30px] flex items-center justify-center text-gray-500 rounded-full cursor-pointer hover:text-gray-900 hover:bg-gray-100", { "bg-gray-100 text-gray-900": a.editor?.isActive("superscript") }])
|
|
@@ -1800,8 +1782,8 @@ function Go(t, e, a, s, n, o) {
|
|
|
1800
1782
|
e[1] || (e[1] = d("span", { class: "sr-only" }, "Superscript", -1))
|
|
1801
1783
|
], 2);
|
|
1802
1784
|
}
|
|
1803
|
-
const
|
|
1804
|
-
components: { Subscript:
|
|
1785
|
+
const Oo = /* @__PURE__ */ Q(Vo, [["render", Do]]), Ro = {
|
|
1786
|
+
components: { Subscript: zt },
|
|
1805
1787
|
props: {
|
|
1806
1788
|
editor: Object
|
|
1807
1789
|
},
|
|
@@ -1811,9 +1793,9 @@ const Yo = /* @__PURE__ */ Q(Xo, [["render", Go]]), Qo = {
|
|
|
1811
1793
|
}
|
|
1812
1794
|
}
|
|
1813
1795
|
};
|
|
1814
|
-
function
|
|
1815
|
-
const l =
|
|
1816
|
-
return
|
|
1796
|
+
function Uo(t, e, a, n, s, o) {
|
|
1797
|
+
const l = Y("Subscript");
|
|
1798
|
+
return h(), w("button", {
|
|
1817
1799
|
title: "Subscript",
|
|
1818
1800
|
onClick: e[0] || (e[0] = (...c) => o.toggleSubscript && o.toggleSubscript(...c)),
|
|
1819
1801
|
class: E(["h-[30px] w-[30px] flex items-center justify-center text-gray-500 rounded-full cursor-pointer hover:text-gray-900 hover:bg-gray-100", { "bg-gray-100 text-gray-900": a.editor?.isActive("subscript") }])
|
|
@@ -1822,23 +1804,23 @@ function Zo(t, e, a, s, n, o) {
|
|
|
1822
1804
|
e[1] || (e[1] = d("span", { class: "sr-only" }, "Subscript", -1))
|
|
1823
1805
|
], 2);
|
|
1824
1806
|
}
|
|
1825
|
-
const
|
|
1807
|
+
const qo = /* @__PURE__ */ Q(Ro, [["render", Uo]]), Wo = {
|
|
1826
1808
|
title: "Heading",
|
|
1827
1809
|
class: "h-[30px] px-2 rounded-full hover:bg-gray-100 justify-center items-center flex text-sm text-gray-700"
|
|
1828
|
-
},
|
|
1810
|
+
}, Xo = { class: "truncate" }, Ko = { class: "max-h-[200px] overflow-y-auto" }, Go = ["onClick"], Qo = {
|
|
1829
1811
|
__name: "vs-editor-heading",
|
|
1830
1812
|
props: {
|
|
1831
1813
|
editor: Object
|
|
1832
1814
|
},
|
|
1833
1815
|
setup(t) {
|
|
1834
|
-
const e = t, a =
|
|
1816
|
+
const e = t, a = _("popover"), n = _([
|
|
1835
1817
|
{ label: "Heading 1", value: 1 },
|
|
1836
1818
|
{ label: "Heading 2", value: 2 },
|
|
1837
1819
|
{ label: "Heading 3", value: 3 },
|
|
1838
1820
|
{ label: "Heading 4", value: 4 },
|
|
1839
1821
|
{ label: "Heading 5", value: 5 },
|
|
1840
1822
|
{ label: "Heading 6", value: 6 }
|
|
1841
|
-
]),
|
|
1823
|
+
]), s = N(() => {
|
|
1842
1824
|
if (!e.editor) return "Paragraph";
|
|
1843
1825
|
for (let r = 1; r <= 6; r++)
|
|
1844
1826
|
if (e.editor.isActive("heading", { level: r }))
|
|
@@ -1856,26 +1838,26 @@ const Jo = /* @__PURE__ */ Q(Qo, [["render", Zo]]), el = {
|
|
|
1856
1838
|
}, c = () => {
|
|
1857
1839
|
e.editor && (e.editor.chain().focus().setParagraph().run(), a.value && a.value.togglePopover());
|
|
1858
1840
|
};
|
|
1859
|
-
return (r, i) => (
|
|
1841
|
+
return (r, i) => (h(), W(se, {
|
|
1860
1842
|
ref_key: "popover",
|
|
1861
1843
|
ref: a,
|
|
1862
1844
|
placement: "bottom"
|
|
1863
1845
|
}, {
|
|
1864
1846
|
reference: q(() => [
|
|
1865
|
-
d("button",
|
|
1866
|
-
d("span",
|
|
1867
|
-
C(L(
|
|
1847
|
+
d("button", Wo, [
|
|
1848
|
+
d("span", Xo, G(s.value), 1),
|
|
1849
|
+
C(L(Te), { class: "ml-1 h-3 w-3 text-gray-400" })
|
|
1868
1850
|
])
|
|
1869
1851
|
]),
|
|
1870
1852
|
default: q(() => [
|
|
1871
1853
|
d("div", null, [
|
|
1872
|
-
d("ul",
|
|
1873
|
-
(
|
|
1854
|
+
d("ul", Ko, [
|
|
1855
|
+
(h(!0), w(J, null, re(n.value, (x) => (h(), w("li", {
|
|
1874
1856
|
key: x.value,
|
|
1875
1857
|
class: E(["px-3 py-2 hover:bg-gray-100 cursor-pointer text-sm", `heading-level-${x.value}`]),
|
|
1876
|
-
style:
|
|
1877
|
-
onClick: (
|
|
1878
|
-
},
|
|
1858
|
+
style: te(o(x.value)),
|
|
1859
|
+
onClick: (v) => l(x.value)
|
|
1860
|
+
}, G(x.label), 15, Go))), 128)),
|
|
1879
1861
|
d("li", {
|
|
1880
1862
|
class: "px-3 py-2 hover:bg-gray-100 cursor-pointer text-sm border-t border-gray-200 mt-1 pt-2",
|
|
1881
1863
|
onClick: c
|
|
@@ -1886,8 +1868,8 @@ const Jo = /* @__PURE__ */ Q(Qo, [["render", Zo]]), el = {
|
|
|
1886
1868
|
_: 1
|
|
1887
1869
|
}, 512));
|
|
1888
1870
|
}
|
|
1889
|
-
},
|
|
1890
|
-
components: { RemoveFormatting:
|
|
1871
|
+
}, Yo = /* @__PURE__ */ Q(Qo, [["__scopeId", "data-v-96f02f2a"]]), Zo = {
|
|
1872
|
+
components: { RemoveFormatting: Vt },
|
|
1891
1873
|
props: {
|
|
1892
1874
|
editor: Object
|
|
1893
1875
|
},
|
|
@@ -1897,9 +1879,9 @@ const Jo = /* @__PURE__ */ Q(Qo, [["render", Zo]]), el = {
|
|
|
1897
1879
|
}
|
|
1898
1880
|
}
|
|
1899
1881
|
};
|
|
1900
|
-
function
|
|
1901
|
-
const l =
|
|
1902
|
-
return
|
|
1882
|
+
function Jo(t, e, a, n, s, o) {
|
|
1883
|
+
const l = Y("RemoveFormatting");
|
|
1884
|
+
return h(), w("button", {
|
|
1903
1885
|
title: "Clear Formatting",
|
|
1904
1886
|
onClick: e[0] || (e[0] = (...c) => o.clearFormatting && o.clearFormatting(...c)),
|
|
1905
1887
|
class: "h-[30px] w-[30px] flex items-center justify-center text-gray-500 rounded-full cursor-pointer hover:text-gray-900 hover:bg-gray-100"
|
|
@@ -1908,16 +1890,16 @@ function sl(t, e, a, s, n, o) {
|
|
|
1908
1890
|
e[1] || (e[1] = d("span", { class: "sr-only" }, "Clear Formatting", -1))
|
|
1909
1891
|
]);
|
|
1910
1892
|
}
|
|
1911
|
-
const
|
|
1893
|
+
const el = /* @__PURE__ */ Q(Zo, [["render", Jo]]), tl = { class: "relative" }, rl = {
|
|
1912
1894
|
key: 0,
|
|
1913
1895
|
class: "mt-4"
|
|
1914
|
-
},
|
|
1896
|
+
}, ol = ["src", "alt", "title"], ll = {
|
|
1915
1897
|
key: 0,
|
|
1916
1898
|
class: "text-sm text-red-500"
|
|
1917
|
-
},
|
|
1899
|
+
}, al = {
|
|
1918
1900
|
key: 1,
|
|
1919
1901
|
class: "mt-4"
|
|
1920
|
-
},
|
|
1902
|
+
}, nl = { class: "text-sm text-gray-600 mb-2" }, sl = { class: "flex flex-wrap gap-2" }, il = ["src", "alt", "onError"], cl = ["onClick"], dl = { class: "flex justify-end gap-x-2 p-[20px]" }, ul = /* @__PURE__ */ Object.assign({
|
|
1921
1903
|
inheritAttrs: !1
|
|
1922
1904
|
}, {
|
|
1923
1905
|
__name: "vs-editor-image",
|
|
@@ -1928,7 +1910,7 @@ const il = /* @__PURE__ */ Q(nl, [["render", sl]]), cl = { class: "relative" },
|
|
|
1928
1910
|
}
|
|
1929
1911
|
},
|
|
1930
1912
|
setup(t) {
|
|
1931
|
-
const e = t, a =
|
|
1913
|
+
const e = t, a = _(!1), n = _(!1), s = _({}), o = _(!1), l = _([]), c = _(null), r = _({
|
|
1932
1914
|
src: "",
|
|
1933
1915
|
file: [],
|
|
1934
1916
|
// Завжди масив
|
|
@@ -1940,22 +1922,22 @@ const il = /* @__PURE__ */ Q(nl, [["render", sl]]), cl = { class: "relative" },
|
|
|
1940
1922
|
openInNewTab: !1
|
|
1941
1923
|
}), i = N(() => {
|
|
1942
1924
|
if (Array.isArray(r.value.file)) {
|
|
1943
|
-
const
|
|
1944
|
-
return
|
|
1925
|
+
const y = r.value.file.filter(($) => $ instanceof File), k = r.value.file.filter(($) => typeof $ == "string" && $.trim() !== "");
|
|
1926
|
+
return y.length + k.length > 1;
|
|
1945
1927
|
}
|
|
1946
1928
|
return r.value.file instanceof FileList ? r.value.file.length > 1 : !1;
|
|
1947
|
-
}), x = N(() => Array.isArray(r.value.file) ? r.value.file.filter((
|
|
1929
|
+
}), x = N(() => Array.isArray(r.value.file) ? r.value.file.filter((y) => y instanceof File).length === 1 : r.value.file instanceof FileList ? r.value.file.length === 1 : r.value.file instanceof File), v = N(() => {
|
|
1948
1930
|
if (i.value)
|
|
1949
1931
|
return "";
|
|
1950
1932
|
if (r.value.src)
|
|
1951
1933
|
return r.value.src;
|
|
1952
1934
|
if (x.value) {
|
|
1953
|
-
let
|
|
1954
|
-
if (Array.isArray(r.value.file) || r.value.file instanceof FileList ?
|
|
1955
|
-
const k = l.value.find((u) => u.file ===
|
|
1935
|
+
let y = null;
|
|
1936
|
+
if (Array.isArray(r.value.file) || r.value.file instanceof FileList ? y = r.value.file[0] : r.value.file instanceof File && (y = r.value.file), y instanceof File) {
|
|
1937
|
+
const k = l.value.find((u) => u.file === y);
|
|
1956
1938
|
return k ? k.preview : "";
|
|
1957
|
-
} else if (typeof
|
|
1958
|
-
return
|
|
1939
|
+
} else if (typeof y == "string")
|
|
1940
|
+
return y;
|
|
1959
1941
|
}
|
|
1960
1942
|
return "";
|
|
1961
1943
|
}), f = N(() => [
|
|
@@ -2023,17 +2005,17 @@ const il = /* @__PURE__ */ Q(nl, [["render", sl]]), cl = { class: "relative" },
|
|
|
2023
2005
|
]), p = () => {
|
|
2024
2006
|
if (!e.editor) return;
|
|
2025
2007
|
if (e.editor.isActive("image")) {
|
|
2026
|
-
const { state: k } = e.editor, { selection: u } = k, { $from:
|
|
2008
|
+
const { state: k } = e.editor, { selection: u } = k, { $from: $ } = u;
|
|
2027
2009
|
let b = null, T = null;
|
|
2028
|
-
if (
|
|
2029
|
-
b =
|
|
2010
|
+
if ($.parent.type.name === "image")
|
|
2011
|
+
b = $.before($.depth), T = $.parent;
|
|
2030
2012
|
else
|
|
2031
|
-
for (let H =
|
|
2032
|
-
const X =
|
|
2013
|
+
for (let H = $.depth; H > 0; H--) {
|
|
2014
|
+
const X = $.node(H), g = $.before(H);
|
|
2033
2015
|
X.type.name === "paragraph" && X.forEach((A, B) => {
|
|
2034
2016
|
if (A.type.name === "image") {
|
|
2035
|
-
const
|
|
2036
|
-
(b === null || Math.abs(
|
|
2017
|
+
const V = g + B + 1;
|
|
2018
|
+
(b === null || Math.abs(V - u.$from.pos) < Math.abs(b - u.$from.pos)) && (b = V, T = A);
|
|
2037
2019
|
}
|
|
2038
2020
|
});
|
|
2039
2021
|
}
|
|
@@ -2049,22 +2031,22 @@ const il = /* @__PURE__ */ Q(nl, [["render", sl]]), cl = { class: "relative" },
|
|
|
2049
2031
|
const { state: H } = e.editor;
|
|
2050
2032
|
c.value = H.selection.$from.pos;
|
|
2051
2033
|
}
|
|
2052
|
-
const
|
|
2034
|
+
const m = T ? T.attrs : e.editor.getAttributes("image");
|
|
2053
2035
|
o.value = !0;
|
|
2054
|
-
let
|
|
2036
|
+
let S = "", P = !1;
|
|
2055
2037
|
const z = e.editor.getAttributes("link");
|
|
2056
|
-
z && z.href && (
|
|
2057
|
-
const
|
|
2038
|
+
z && z.href && (S = z.href, P = z.target === "_blank");
|
|
2039
|
+
const j = m.src || "", F = j ? [j] : [];
|
|
2058
2040
|
r.value = {
|
|
2059
|
-
src:
|
|
2060
|
-
file:
|
|
2041
|
+
src: j,
|
|
2042
|
+
file: F,
|
|
2061
2043
|
// Масив з поточним зображенням
|
|
2062
|
-
alt:
|
|
2063
|
-
title:
|
|
2064
|
-
width:
|
|
2065
|
-
height:
|
|
2066
|
-
link:
|
|
2067
|
-
openInNewTab:
|
|
2044
|
+
alt: m.alt || "",
|
|
2045
|
+
title: m.title || "",
|
|
2046
|
+
width: m.width || "",
|
|
2047
|
+
height: m.height || "",
|
|
2048
|
+
link: S,
|
|
2049
|
+
openInNewTab: P
|
|
2068
2050
|
};
|
|
2069
2051
|
} else
|
|
2070
2052
|
o.value = !1, r.value = {
|
|
@@ -2078,9 +2060,9 @@ const il = /* @__PURE__ */ Q(nl, [["render", sl]]), cl = { class: "relative" },
|
|
|
2078
2060
|
link: "",
|
|
2079
2061
|
openInNewTab: !1
|
|
2080
2062
|
};
|
|
2081
|
-
|
|
2063
|
+
n.value = !1, a.value = !0;
|
|
2082
2064
|
}, I = () => {
|
|
2083
|
-
a.value = !1,
|
|
2065
|
+
a.value = !1, n.value = !1, o.value = !1, l.value = [], c.value = null, r.value = {
|
|
2084
2066
|
src: "",
|
|
2085
2067
|
file: [],
|
|
2086
2068
|
// Завжди масив
|
|
@@ -2091,40 +2073,40 @@ const il = /* @__PURE__ */ Q(nl, [["render", sl]]), cl = { class: "relative" },
|
|
|
2091
2073
|
link: "",
|
|
2092
2074
|
openInNewTab: !1
|
|
2093
2075
|
};
|
|
2094
|
-
},
|
|
2095
|
-
if (!
|
|
2076
|
+
}, D = async (y) => {
|
|
2077
|
+
if (!y || y.length === 0)
|
|
2096
2078
|
return;
|
|
2097
2079
|
const k = [];
|
|
2098
|
-
for (const u of
|
|
2080
|
+
for (const u of y)
|
|
2099
2081
|
if (u && u.type && u.type.startsWith("image/") && !l.value.some((b) => b.file === u)) {
|
|
2100
|
-
const b = new Promise((T,
|
|
2101
|
-
const
|
|
2102
|
-
|
|
2082
|
+
const b = new Promise((T, m) => {
|
|
2083
|
+
const S = new FileReader();
|
|
2084
|
+
S.onload = (P) => {
|
|
2103
2085
|
l.value.push({
|
|
2104
2086
|
file: u,
|
|
2105
|
-
preview:
|
|
2087
|
+
preview: P.target.result,
|
|
2106
2088
|
error: !1
|
|
2107
2089
|
}), T();
|
|
2108
|
-
},
|
|
2090
|
+
}, S.onerror = m, S.readAsDataURL(u);
|
|
2109
2091
|
});
|
|
2110
2092
|
k.push(b);
|
|
2111
2093
|
}
|
|
2112
2094
|
await Promise.all(k);
|
|
2113
|
-
}, O = (
|
|
2114
|
-
l.value.splice(
|
|
2095
|
+
}, O = (y) => {
|
|
2096
|
+
l.value.splice(y, 1), Array.isArray(r.value.file) && r.value.file.splice(y, 1);
|
|
2115
2097
|
}, R = () => {
|
|
2116
|
-
const
|
|
2117
|
-
return
|
|
2118
|
-
},
|
|
2119
|
-
const
|
|
2120
|
-
const { view:
|
|
2121
|
-
if (!
|
|
2122
|
-
|
|
2098
|
+
const y = r.value.width !== null && r.value.width !== void 0 && r.value.width !== "" && String(r.value.width).trim() !== "" ? String(r.value.width).trim() : "", k = r.value.height !== null && r.value.height !== void 0 && r.value.height !== "" && String(r.value.height).trim() !== "" ? String(r.value.height).trim() : "", u = {};
|
|
2099
|
+
return y && k ? (u.width = y, u.height = k, u.style = `width: ${y}px; height: ${k}px; object-fit: fill;`) : y ? (u.width = y, u.height = void 0) : k ? (u.height = k, u.width = void 0) : (u.width = void 0, u.height = void 0), u;
|
|
2100
|
+
}, Z = (y, k = null, u = 50) => {
|
|
2101
|
+
const $ = () => {
|
|
2102
|
+
const { view: m } = y;
|
|
2103
|
+
if (!m || !m.dom) return;
|
|
2104
|
+
m.dom.querySelectorAll("img.editor-image[width][height]").forEach((z) => {
|
|
2123
2105
|
if (z instanceof HTMLImageElement) {
|
|
2124
|
-
const
|
|
2125
|
-
|
|
2126
|
-
width: ${
|
|
2127
|
-
height: ${
|
|
2106
|
+
const j = z.getAttribute("width"), F = z.getAttribute("height");
|
|
2107
|
+
j && F && j !== "auto" && F !== "auto" && j !== "" && F !== "" && !isNaN(Number(j)) && !isNaN(Number(F)) && (z.style.cssText = `
|
|
2108
|
+
width: ${j}px !important;
|
|
2109
|
+
height: ${F}px !important;
|
|
2128
2110
|
max-width: none !important;
|
|
2129
2111
|
max-height: none !important;
|
|
2130
2112
|
min-width: auto !important;
|
|
@@ -2134,88 +2116,88 @@ const il = /* @__PURE__ */ Q(nl, [["render", sl]]), cl = { class: "relative" },
|
|
|
2134
2116
|
}
|
|
2135
2117
|
});
|
|
2136
2118
|
}, b = r.value.width, T = r.value.height;
|
|
2137
|
-
b && T && b !== "" && T !== "" ? [0, u, u * 2, u * 3, u * 4].forEach((
|
|
2138
|
-
setTimeout(
|
|
2139
|
-
}) : (
|
|
2119
|
+
b && T && b !== "" && T !== "" ? [0, u, u * 2, u * 3, u * 4].forEach((S) => {
|
|
2120
|
+
setTimeout($, S);
|
|
2121
|
+
}) : ($(), setTimeout($, u));
|
|
2140
2122
|
}, M = async () => {
|
|
2141
|
-
let
|
|
2142
|
-
if (Array.isArray(r.value.file) ? (
|
|
2143
|
-
const
|
|
2144
|
-
Array.isArray(
|
|
2123
|
+
let y = [], k = [];
|
|
2124
|
+
if (Array.isArray(r.value.file) ? (y = r.value.file.filter((m) => m instanceof File), k = r.value.file.filter((m) => typeof m == "string" && m.trim() !== "")) : r.value.file instanceof FileList ? y = Array.from(r.value.file) : r.value.file instanceof File ? y = [r.value.file] : typeof r.value.file == "string" && r.value.file.trim() !== "" && (k = [r.value.file]), y.length === 0 && k.length === 0 && s.value && s.value.file) {
|
|
2125
|
+
const m = s.value.file;
|
|
2126
|
+
Array.isArray(m) ? (y = m.filter((S) => S instanceof File), k = m.filter((S) => typeof S == "string" && S.trim() !== "")) : m instanceof FileList ? y = Array.from(m) : m instanceof File ? y = [m] : typeof m == "string" && m.trim() !== "" && (k = [m]);
|
|
2145
2127
|
}
|
|
2146
2128
|
if (k.length > 0 && !o.value) {
|
|
2147
|
-
for (const
|
|
2148
|
-
l.value.some((
|
|
2149
|
-
url:
|
|
2150
|
-
preview:
|
|
2129
|
+
for (const m of k)
|
|
2130
|
+
l.value.some((S) => S.url === m) || l.value.push({
|
|
2131
|
+
url: m,
|
|
2132
|
+
preview: m,
|
|
2151
2133
|
error: !1
|
|
2152
2134
|
});
|
|
2153
|
-
if (
|
|
2154
|
-
await
|
|
2135
|
+
if (y.length === 0 && l.value.length > 0) {
|
|
2136
|
+
await ae();
|
|
2155
2137
|
return;
|
|
2156
2138
|
}
|
|
2157
2139
|
}
|
|
2158
|
-
const u =
|
|
2140
|
+
const u = y.length, $ = u + k.length;
|
|
2159
2141
|
if (!(o.value && u <= 1)) {
|
|
2160
2142
|
if (u > 0) {
|
|
2161
|
-
const
|
|
2162
|
-
(
|
|
2143
|
+
const m = y.filter(
|
|
2144
|
+
(S) => !l.value.some((P) => P.file === S)
|
|
2163
2145
|
);
|
|
2164
|
-
|
|
2146
|
+
m.length > 0 && await D(m);
|
|
2165
2147
|
}
|
|
2166
2148
|
}
|
|
2167
2149
|
if (!o.value) {
|
|
2168
|
-
if (
|
|
2150
|
+
if ($ > 1 || i.value || l.value.length > 1) {
|
|
2169
2151
|
if (l.value.length > 0) {
|
|
2170
|
-
await
|
|
2152
|
+
await ae();
|
|
2171
2153
|
return;
|
|
2172
2154
|
} else if (u > 0) {
|
|
2173
|
-
if (await
|
|
2174
|
-
await
|
|
2155
|
+
if (await D(y), l.value.length > 0) {
|
|
2156
|
+
await ae();
|
|
2175
2157
|
return;
|
|
2176
2158
|
}
|
|
2177
2159
|
} else if (k.length > 0) {
|
|
2178
|
-
await
|
|
2160
|
+
await ae();
|
|
2179
2161
|
return;
|
|
2180
2162
|
}
|
|
2181
2163
|
} else if (l.value.length > 1) {
|
|
2182
|
-
await
|
|
2164
|
+
await ae();
|
|
2183
2165
|
return;
|
|
2184
2166
|
}
|
|
2185
2167
|
}
|
|
2186
2168
|
let b = r.value.src;
|
|
2187
2169
|
if (x.value) {
|
|
2188
|
-
let
|
|
2189
|
-
if (Array.isArray(r.value.file) || r.value.file instanceof FileList ?
|
|
2170
|
+
let m = null;
|
|
2171
|
+
if (Array.isArray(r.value.file) || r.value.file instanceof FileList ? m = r.value.file[0] : (r.value.file instanceof File || typeof r.value.file == "string") && (m = r.value.file), m instanceof File)
|
|
2190
2172
|
try {
|
|
2191
|
-
const
|
|
2192
|
-
|
|
2173
|
+
const S = new FileReader(), P = await new Promise((z, j) => {
|
|
2174
|
+
S.onload = (F) => z(F.target.result), S.onerror = j, S.readAsDataURL(m);
|
|
2193
2175
|
});
|
|
2194
|
-
b =
|
|
2195
|
-
} catch (
|
|
2196
|
-
console.error("Помилка при читанні файлу:",
|
|
2176
|
+
b = P, o.value && (r.value.src = P);
|
|
2177
|
+
} catch (S) {
|
|
2178
|
+
console.error("Помилка при читанні файлу:", S), we({
|
|
2197
2179
|
type: "error",
|
|
2198
2180
|
title: "Помилка",
|
|
2199
2181
|
message: "Не вдалося прочитати файл"
|
|
2200
2182
|
});
|
|
2201
2183
|
return;
|
|
2202
2184
|
}
|
|
2203
|
-
else typeof
|
|
2185
|
+
else typeof m == "string" && m.trim() !== "" && (b = m.trim(), o.value && m.trim() !== r.value.src && (r.value.src = m.trim(), b = m.trim()));
|
|
2204
2186
|
} else if (Array.isArray(r.value.file) && r.value.file.length === 1) {
|
|
2205
|
-
const
|
|
2206
|
-
typeof
|
|
2187
|
+
const m = r.value.file[0];
|
|
2188
|
+
typeof m == "string" && m.trim() !== "" && (b = m.trim(), (!r.value.src || r.value.src !== m.trim()) && (r.value.src = m.trim()));
|
|
2207
2189
|
} else typeof r.value.file == "string" && r.value.file.trim() !== "" && (b = r.value.file.trim(), (!r.value.src || r.value.src !== r.value.file.trim()) && (r.value.src = r.value.file.trim()));
|
|
2208
|
-
const T = b || Array.isArray(r.value.file) && r.value.file.length > 0 && (r.value.file.some((
|
|
2190
|
+
const T = b || Array.isArray(r.value.file) && r.value.file.length > 0 && (r.value.file.some((m) => m instanceof File) || r.value.file.some((m) => typeof m == "string" && m.trim() !== "")) || r.value.file instanceof FileList && r.value.file.length > 0 || typeof r.value.file == "string" && r.value.file.trim() !== "";
|
|
2209
2191
|
if (!b && !T) {
|
|
2210
|
-
|
|
2192
|
+
we({
|
|
2211
2193
|
type: "warning",
|
|
2212
2194
|
title: "Попередження",
|
|
2213
2195
|
message: "Будь ласка, введіть URL зображення або виберіть файл"
|
|
2214
2196
|
});
|
|
2215
2197
|
return;
|
|
2216
2198
|
}
|
|
2217
|
-
if (!i.value && !T && await
|
|
2218
|
-
|
|
2199
|
+
if (!i.value && !T && await s.value.validate()) {
|
|
2200
|
+
we({
|
|
2219
2201
|
type: "warning",
|
|
2220
2202
|
title: "Попередження",
|
|
2221
2203
|
message: "Будь ласка, заповніть всі обов'язкові поля"
|
|
@@ -2224,53 +2206,53 @@ const il = /* @__PURE__ */ Q(nl, [["render", sl]]), cl = { class: "relative" },
|
|
|
2224
2206
|
}
|
|
2225
2207
|
if (e.editor && b)
|
|
2226
2208
|
if (o.value && c.value !== null) {
|
|
2227
|
-
const { state:
|
|
2209
|
+
const { state: m } = e.editor;
|
|
2228
2210
|
try {
|
|
2229
2211
|
e.editor.chain().focus().setNodeSelection(c.value).run();
|
|
2230
2212
|
} catch {
|
|
2231
2213
|
e.editor.chain().focus().setTextSelection(c.value).run();
|
|
2232
2214
|
}
|
|
2233
|
-
const
|
|
2215
|
+
const S = e.editor.getAttributes("link"), P = S && S.href, z = R(), j = {
|
|
2234
2216
|
src: b,
|
|
2235
2217
|
alt: r.value.alt || "",
|
|
2236
2218
|
title: r.value.title || "",
|
|
2237
2219
|
...z
|
|
2238
2220
|
};
|
|
2239
|
-
if ((!r.value.width || r.value.width === "") && (
|
|
2240
|
-
const { view:
|
|
2241
|
-
if (!
|
|
2242
|
-
|
|
2221
|
+
if ((!r.value.width || r.value.width === "") && (j.width = void 0), (!r.value.height || r.value.height === "") && (j.height = void 0), e.editor.chain().focus().updateAttributes("image", j).run(), setTimeout(() => {
|
|
2222
|
+
const { view: F } = e.editor;
|
|
2223
|
+
if (!F || !F.dom) return;
|
|
2224
|
+
F.dom.querySelectorAll("img.editor-image").forEach((g) => {
|
|
2243
2225
|
if (g instanceof HTMLImageElement) {
|
|
2244
2226
|
const A = g.getAttribute("src") || g.src;
|
|
2245
2227
|
(A === b || A.includes(b.split("/").pop())) && (r.value.width && r.value.height ? (g.style.setProperty("width", `${r.value.width}px`, "important"), g.style.setProperty("height", `${r.value.height}px`, "important"), g.style.setProperty("object-fit", "fill", "important"), g.style.setProperty("max-width", "none", "important"), g.style.setProperty("max-height", "none", "important")) : (g.style.removeProperty("width"), g.style.removeProperty("height"), g.style.removeProperty("object-fit"), g.style.removeProperty("max-width"), g.style.removeProperty("max-height")));
|
|
2246
2228
|
}
|
|
2247
2229
|
});
|
|
2248
2230
|
}, 20), r.value.link && r.value.link.trim() !== "") {
|
|
2249
|
-
let
|
|
2250
|
-
|
|
2251
|
-
href:
|
|
2231
|
+
let F = r.value.link.trim();
|
|
2232
|
+
F.match(/^https?:\/\//i) || (F = "https://" + F), P ? e.editor.chain().focus().extendMarkRange("link").setLink({
|
|
2233
|
+
href: F,
|
|
2252
2234
|
target: r.value.openInNewTab ? "_blank" : null
|
|
2253
2235
|
}).run() : e.editor.chain().focus().selectParentNode().setLink({
|
|
2254
|
-
href:
|
|
2236
|
+
href: F,
|
|
2255
2237
|
target: r.value.openInNewTab ? "_blank" : null
|
|
2256
2238
|
}).run();
|
|
2257
|
-
} else
|
|
2239
|
+
} else P && e.editor.chain().focus().extendMarkRange("link").unsetLink().run();
|
|
2258
2240
|
} else {
|
|
2259
|
-
const { state:
|
|
2241
|
+
const { state: m } = e.editor, { selection: S } = m, { $anchor: P } = S;
|
|
2260
2242
|
let z = null;
|
|
2261
|
-
for (let
|
|
2262
|
-
const H =
|
|
2243
|
+
for (let F = P.depth; F > 0; F--) {
|
|
2244
|
+
const H = P.node(F);
|
|
2263
2245
|
if (H && H.type.name === "paragraph") {
|
|
2264
2246
|
z = H;
|
|
2265
2247
|
break;
|
|
2266
2248
|
}
|
|
2267
2249
|
}
|
|
2268
2250
|
if (z && z.content.content.some(
|
|
2269
|
-
(
|
|
2251
|
+
(F) => F.type.name === "image"
|
|
2270
2252
|
)) {
|
|
2271
|
-
const
|
|
2272
|
-
if (
|
|
2273
|
-
const H = R(), X =
|
|
2253
|
+
const F = ee(z, P.before(P.depth));
|
|
2254
|
+
if (F !== null) {
|
|
2255
|
+
const H = R(), X = m.schema.nodes.image.create({
|
|
2274
2256
|
src: b,
|
|
2275
2257
|
alt: r.value.alt || "",
|
|
2276
2258
|
title: r.value.title || "",
|
|
@@ -2279,13 +2261,13 @@ const il = /* @__PURE__ */ Q(nl, [["render", sl]]), cl = { class: "relative" },
|
|
|
2279
2261
|
if (r.value.link && r.value.link.trim() !== "") {
|
|
2280
2262
|
let g = r.value.link.trim();
|
|
2281
2263
|
g.match(/^https?:\/\//i) || (g = "https://" + g);
|
|
2282
|
-
const A =
|
|
2264
|
+
const A = m.schema.marks.link.create({
|
|
2283
2265
|
href: g,
|
|
2284
2266
|
target: r.value.openInNewTab ? "_blank" : null
|
|
2285
2267
|
}), B = X.type.create(X.attrs, X.content, [A]);
|
|
2286
|
-
e.editor.chain().focus().insertContentAt(
|
|
2268
|
+
e.editor.chain().focus().insertContentAt(F + 1, B).run(), Z(e.editor, b);
|
|
2287
2269
|
} else
|
|
2288
|
-
e.editor.chain().focus().insertContentAt(
|
|
2270
|
+
e.editor.chain().focus().insertContentAt(F + 1, X).run(), Z(e.editor, b);
|
|
2289
2271
|
} else if (r.value.link && r.value.link.trim() !== "") {
|
|
2290
2272
|
const H = R();
|
|
2291
2273
|
e.editor.chain().focus().setImage({
|
|
@@ -2298,7 +2280,7 @@ const il = /* @__PURE__ */ Q(nl, [["render", sl]]), cl = { class: "relative" },
|
|
|
2298
2280
|
X.match(/^https?:\/\//i) || (X = "https://" + X), e.editor.chain().focus().selectParentNode().setLink({
|
|
2299
2281
|
href: X,
|
|
2300
2282
|
target: r.value.openInNewTab ? "_blank" : null
|
|
2301
|
-
}).run(),
|
|
2283
|
+
}).run(), Z(e.editor, b, 20);
|
|
2302
2284
|
}, 10);
|
|
2303
2285
|
} else {
|
|
2304
2286
|
const H = R();
|
|
@@ -2307,136 +2289,136 @@ const il = /* @__PURE__ */ Q(nl, [["render", sl]]), cl = { class: "relative" },
|
|
|
2307
2289
|
alt: r.value.alt || "",
|
|
2308
2290
|
title: r.value.title || "",
|
|
2309
2291
|
...H
|
|
2310
|
-
}).run(),
|
|
2292
|
+
}).run(), Z(e.editor, b);
|
|
2311
2293
|
}
|
|
2312
2294
|
} else if (r.value.link && r.value.link.trim() !== "") {
|
|
2313
|
-
const
|
|
2295
|
+
const F = R();
|
|
2314
2296
|
e.editor.chain().focus().setImage({
|
|
2315
2297
|
src: b,
|
|
2316
2298
|
alt: r.value.alt || "",
|
|
2317
2299
|
title: r.value.title || "",
|
|
2318
|
-
...
|
|
2300
|
+
...F
|
|
2319
2301
|
}).run(), setTimeout(() => {
|
|
2320
2302
|
let H = r.value.link.trim();
|
|
2321
2303
|
H.match(/^https?:\/\//i) || (H = "https://" + H), e.editor.chain().focus().selectParentNode().setLink({
|
|
2322
2304
|
href: H,
|
|
2323
2305
|
target: r.value.openInNewTab ? "_blank" : null
|
|
2324
|
-
}).run(),
|
|
2306
|
+
}).run(), Z(e.editor, b, 20);
|
|
2325
2307
|
}, 10);
|
|
2326
2308
|
} else {
|
|
2327
|
-
const
|
|
2309
|
+
const F = R();
|
|
2328
2310
|
e.editor.chain().focus().setImage({
|
|
2329
2311
|
src: b,
|
|
2330
2312
|
alt: r.value.alt || "",
|
|
2331
2313
|
title: r.value.title || "",
|
|
2332
|
-
...
|
|
2333
|
-
}).run(),
|
|
2314
|
+
...F
|
|
2315
|
+
}).run(), Z(e.editor, b);
|
|
2334
2316
|
}
|
|
2335
2317
|
}
|
|
2336
2318
|
I();
|
|
2337
|
-
}, ee = (
|
|
2319
|
+
}, ee = (y, k) => {
|
|
2338
2320
|
let u = null;
|
|
2339
|
-
return
|
|
2340
|
-
|
|
2321
|
+
return y.forEach(($, b) => {
|
|
2322
|
+
$.type.name === "image" && (u = k + b + 1);
|
|
2341
2323
|
}), u;
|
|
2342
|
-
},
|
|
2324
|
+
}, ae = async () => {
|
|
2343
2325
|
if (e.editor) {
|
|
2344
2326
|
if (l.value.length === 0)
|
|
2345
2327
|
if (Array.isArray(r.value.file) && r.value.file.length > 0) {
|
|
2346
|
-
const
|
|
2347
|
-
for (const u of
|
|
2348
|
-
l.value.some((
|
|
2328
|
+
const y = r.value.file.filter((u) => typeof u == "string" && u.trim() !== ""), k = r.value.file.filter((u) => u instanceof File);
|
|
2329
|
+
for (const u of y)
|
|
2330
|
+
l.value.some(($) => $.url === u || $.preview === u) || l.value.push({
|
|
2349
2331
|
url: u,
|
|
2350
2332
|
preview: u,
|
|
2351
2333
|
error: !1
|
|
2352
2334
|
});
|
|
2353
|
-
k.length > 0 && await
|
|
2354
|
-
} else i.value && await
|
|
2335
|
+
k.length > 0 && await D(k);
|
|
2336
|
+
} else i.value && await D(r.value.file);
|
|
2355
2337
|
if (l.value.length !== 0)
|
|
2356
2338
|
try {
|
|
2357
|
-
const
|
|
2339
|
+
const y = [], k = R();
|
|
2358
2340
|
for (const u of l.value) {
|
|
2359
|
-
const
|
|
2360
|
-
if (
|
|
2341
|
+
const $ = u.url || u.preview || "";
|
|
2342
|
+
if (!$) continue;
|
|
2361
2343
|
const b = e.editor.schema.nodes.image.create({
|
|
2362
|
-
src:
|
|
2344
|
+
src: $,
|
|
2363
2345
|
alt: r.value.alt || "",
|
|
2364
2346
|
title: r.value.title || "",
|
|
2365
2347
|
...k
|
|
2366
2348
|
});
|
|
2367
|
-
|
|
2349
|
+
y.push(b);
|
|
2368
2350
|
}
|
|
2369
|
-
|
|
2370
|
-
if (
|
|
2351
|
+
y.length > 0 && (e.editor.chain().focus().command(({ tr: u, dispatch: $ }) => {
|
|
2352
|
+
if ($) {
|
|
2371
2353
|
const { selection: b } = u, { $anchor: T } = b;
|
|
2372
|
-
let
|
|
2373
|
-
for (let
|
|
2374
|
-
const
|
|
2375
|
-
if (
|
|
2376
|
-
|
|
2354
|
+
let m = b.$anchor.pos, S = null, P = null;
|
|
2355
|
+
for (let j = T.depth; j > 0; j--) {
|
|
2356
|
+
const F = T.node(j);
|
|
2357
|
+
if (F && F.type.name === "paragraph") {
|
|
2358
|
+
S = F, P = T.start(j);
|
|
2377
2359
|
break;
|
|
2378
2360
|
}
|
|
2379
2361
|
}
|
|
2380
|
-
if (
|
|
2381
|
-
let
|
|
2382
|
-
|
|
2383
|
-
|
|
2384
|
-
}),
|
|
2362
|
+
if (S) {
|
|
2363
|
+
let j = null;
|
|
2364
|
+
S.forEach((F, H) => {
|
|
2365
|
+
F.type.name === "image" && (j = P + H + 1);
|
|
2366
|
+
}), j !== null ? m = j + 1 : m = P + S.content.size;
|
|
2385
2367
|
}
|
|
2386
|
-
let z =
|
|
2387
|
-
return
|
|
2388
|
-
u.insert(z,
|
|
2368
|
+
let z = m;
|
|
2369
|
+
return y.forEach((j) => {
|
|
2370
|
+
u.insert(z, j), z += j.nodeSize;
|
|
2389
2371
|
}), !0;
|
|
2390
2372
|
}
|
|
2391
2373
|
return !1;
|
|
2392
2374
|
}).run(), r.value.width && r.value.height && setTimeout(() => {
|
|
2393
2375
|
const { view: u } = e.editor;
|
|
2394
2376
|
u && u.dom && u.dom.querySelectorAll("img.editor-image").forEach((T) => {
|
|
2395
|
-
T instanceof HTMLImageElement && Array.from(l.value).some((
|
|
2396
|
-
const
|
|
2397
|
-
return z ===
|
|
2377
|
+
T instanceof HTMLImageElement && Array.from(l.value).some((S) => {
|
|
2378
|
+
const P = S.url || S.preview || "", z = T.src || T.getAttribute("src") || "";
|
|
2379
|
+
return z === P || z.includes(P.split("/").pop());
|
|
2398
2380
|
}) && (T.style.setProperty("width", `${r.value.width}px`, "important"), T.style.setProperty("height", `${r.value.height}px`, "important"), T.style.setProperty("object-fit", "fill", "important"), T.style.setProperty("max-width", "none", "important"), T.style.setProperty("max-height", "none", "important"));
|
|
2399
2381
|
});
|
|
2400
2382
|
}, 50)), I();
|
|
2401
|
-
} catch (
|
|
2402
|
-
console.error("Помилка при додаванні зображень:",
|
|
2383
|
+
} catch (y) {
|
|
2384
|
+
console.error("Помилка при додаванні зображень:", y), we({
|
|
2403
2385
|
type: "error",
|
|
2404
2386
|
title: "Помилка",
|
|
2405
2387
|
message: "Не вдалося додати зображення"
|
|
2406
2388
|
});
|
|
2407
2389
|
}
|
|
2408
2390
|
}
|
|
2409
|
-
},
|
|
2391
|
+
}, $e = async () => {
|
|
2410
2392
|
await M();
|
|
2411
|
-
},
|
|
2393
|
+
}, Ce = () => {
|
|
2412
2394
|
I();
|
|
2413
2395
|
};
|
|
2414
|
-
return
|
|
2415
|
-
if (
|
|
2416
|
-
if (Array.isArray(
|
|
2417
|
-
const u =
|
|
2418
|
-
if (u.length > 0 && (o.value ? o.value && u.length === 1 &&
|
|
2396
|
+
return de(() => r.value.file, async (y, k) => {
|
|
2397
|
+
if (n.value = !1, !(o.value && Array.isArray(y) && y.length === 1 && typeof y[0] == "string" && !y.some(($) => $ instanceof File)))
|
|
2398
|
+
if (Array.isArray(y) && y.length > 0) {
|
|
2399
|
+
const u = y.filter((b) => b instanceof File), $ = y.filter((b) => typeof b == "string" && b.trim() !== "");
|
|
2400
|
+
if (u.length > 0 && (o.value ? o.value && u.length === 1 && $.length === 0 && (l.value = []) : l.value = [], (!o.value || u.length > 1 || $.length > 0) && await D(u), o.value && u.length === 1 && $.length === 0)) {
|
|
2419
2401
|
const b = new FileReader();
|
|
2420
2402
|
b.onload = (T) => {
|
|
2421
2403
|
r.value.src = T.target.result;
|
|
2422
2404
|
}, b.readAsDataURL(u[0]);
|
|
2423
2405
|
}
|
|
2424
|
-
if (
|
|
2406
|
+
if ($.length > 0)
|
|
2425
2407
|
if (o.value)
|
|
2426
|
-
o.value &&
|
|
2408
|
+
o.value && $.length === 1 && u.length === 0 && (r.value.src = $[0]);
|
|
2427
2409
|
else {
|
|
2428
2410
|
u.length === 0 && (l.value = []);
|
|
2429
|
-
for (const b of
|
|
2411
|
+
for (const b of $)
|
|
2430
2412
|
l.value.some((T) => T.url === b || T.preview === b) || l.value.push({
|
|
2431
2413
|
url: b,
|
|
2432
2414
|
preview: b,
|
|
2433
2415
|
error: !1
|
|
2434
2416
|
});
|
|
2435
2417
|
}
|
|
2436
|
-
} else
|
|
2437
|
-
}, { immediate: !1 }),
|
|
2438
|
-
|
|
2439
|
-
}), (
|
|
2418
|
+
} else y && typeof y == "object" && y instanceof FileList ? (o.value || (l.value = []), await D(Array.from(y))) : y && typeof y == "object" && !Array.isArray(y) && y instanceof File ? (o.value || (l.value = []), await D([y])) : o.value || (l.value = []);
|
|
2419
|
+
}, { immediate: !1 }), de(() => r.value.src, () => {
|
|
2420
|
+
n.value = !1;
|
|
2421
|
+
}), (y, k) => (h(), w("div", tl, [
|
|
2440
2422
|
d("button", {
|
|
2441
2423
|
onClick: p,
|
|
2442
2424
|
class: E([
|
|
@@ -2445,70 +2427,70 @@ const il = /* @__PURE__ */ Q(nl, [["render", sl]]), cl = { class: "relative" },
|
|
|
2445
2427
|
]),
|
|
2446
2428
|
title: "Додати зображення"
|
|
2447
2429
|
}, [
|
|
2448
|
-
C(L(
|
|
2430
|
+
C(L(Dt), { class: "h-4 w-4" }),
|
|
2449
2431
|
k[4] || (k[4] = d("span", { class: "sr-only" }, "Додати зображення", -1))
|
|
2450
2432
|
], 2),
|
|
2451
|
-
C(
|
|
2433
|
+
C(Ze, {
|
|
2452
2434
|
modelValue: a.value,
|
|
2453
2435
|
"onUpdate:modelValue": k[3] || (k[3] = (u) => a.value = u),
|
|
2454
2436
|
title: o.value ? "Редагувати зображення" : "Додати зображення"
|
|
2455
2437
|
}, {
|
|
2456
2438
|
footer: q(() => [
|
|
2457
|
-
d("div",
|
|
2439
|
+
d("div", dl, [
|
|
2458
2440
|
d("button", {
|
|
2459
|
-
onClick:
|
|
2441
|
+
onClick: Ce,
|
|
2460
2442
|
type: "button",
|
|
2461
2443
|
class: "px-4 py-2 text-sm font-medium text-gray-700 bg-white border border-gray-300 rounded-md hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-blue-500"
|
|
2462
2444
|
}, " Скасувати "),
|
|
2463
2445
|
d("button", {
|
|
2464
|
-
onClick:
|
|
2446
|
+
onClick: $e,
|
|
2465
2447
|
type: "button",
|
|
2466
2448
|
class: "px-4 py-2 text-sm font-medium text-white bg-blue-600 border border-transparent rounded-md hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-blue-500"
|
|
2467
|
-
},
|
|
2449
|
+
}, G(o.value ? "Оновити зображення" : "Додати зображення"), 1)
|
|
2468
2450
|
])
|
|
2469
2451
|
]),
|
|
2470
2452
|
default: q(() => [
|
|
2471
|
-
C(
|
|
2453
|
+
C(gt, {
|
|
2472
2454
|
modelValue: r.value,
|
|
2473
2455
|
"onUpdate:modelValue": k[0] || (k[0] = (u) => r.value = u),
|
|
2474
2456
|
schema: f.value,
|
|
2475
|
-
form:
|
|
2476
|
-
"onUpdate:form": k[1] || (k[1] = (u) =>
|
|
2457
|
+
form: s.value,
|
|
2458
|
+
"onUpdate:form": k[1] || (k[1] = (u) => s.value = u)
|
|
2477
2459
|
}, null, 8, ["modelValue", "schema", "form"]),
|
|
2478
|
-
|
|
2460
|
+
v.value && !i.value ? (h(), w("div", rl, [
|
|
2479
2461
|
k[5] || (k[5] = d("p", { class: "text-sm text-gray-600 mb-2" }, "Попередній перегляд:", -1)),
|
|
2480
|
-
|
|
2481
|
-
src:
|
|
2462
|
+
le(d("img", {
|
|
2463
|
+
src: v.value,
|
|
2482
2464
|
alt: r.value.alt || "Попередній перегляд зображення",
|
|
2483
2465
|
title: r.value.title,
|
|
2484
2466
|
class: "max-w-full h-auto max-h-32 rounded border",
|
|
2485
|
-
onError: k[2] || (k[2] = (u) =>
|
|
2486
|
-
}, null, 40,
|
|
2487
|
-
[
|
|
2467
|
+
onError: k[2] || (k[2] = (u) => n.value = !0)
|
|
2468
|
+
}, null, 40, ol), [
|
|
2469
|
+
[me, !n.value]
|
|
2488
2470
|
]),
|
|
2489
|
-
|
|
2471
|
+
n.value ? (h(), w("p", ll, " Не вдалося завантажити попередній перегляд зображення ")) : U("", !0)
|
|
2490
2472
|
])) : U("", !0),
|
|
2491
|
-
l.value.length > 0 ? (
|
|
2492
|
-
d("p",
|
|
2473
|
+
l.value.length > 0 ? (h(), w("div", al, [
|
|
2474
|
+
d("p", nl, "Попередній перегляд (" + G(l.value.length) + " зображень):", 1),
|
|
2493
2475
|
k[6] || (k[6] = d("p", { class: "text-xs text-gray-500 mb-2" }, " Зображення будуть розміщені в ряд, якщо вони помістяться по ширині ", -1)),
|
|
2494
|
-
d("div",
|
|
2495
|
-
(
|
|
2496
|
-
key:
|
|
2476
|
+
d("div", sl, [
|
|
2477
|
+
(h(!0), w(J, null, re(l.value, (u, $) => (h(), w("div", {
|
|
2478
|
+
key: $,
|
|
2497
2479
|
class: "relative"
|
|
2498
2480
|
}, [
|
|
2499
|
-
|
|
2481
|
+
le(d("img", {
|
|
2500
2482
|
src: u.preview,
|
|
2501
|
-
alt: `Попередній перегляд ${
|
|
2483
|
+
alt: `Попередній перегляд ${$ + 1}`,
|
|
2502
2484
|
class: "max-w-[100px] max-h-[100px] rounded border object-contain",
|
|
2503
2485
|
onError: (b) => u.error = !0
|
|
2504
|
-
}, null, 40,
|
|
2505
|
-
[
|
|
2486
|
+
}, null, 40, il), [
|
|
2487
|
+
[me, !u.error]
|
|
2506
2488
|
]),
|
|
2507
2489
|
d("button", {
|
|
2508
|
-
onClick: (b) => O(
|
|
2490
|
+
onClick: (b) => O($),
|
|
2509
2491
|
class: "absolute -top-2 -right-2 bg-red-500 text-white rounded-full w-5 h-5 flex items-center justify-center text-xs hover:bg-red-600",
|
|
2510
2492
|
type: "button"
|
|
2511
|
-
}, " × ", 8,
|
|
2493
|
+
}, " × ", 8, cl)
|
|
2512
2494
|
]))), 128))
|
|
2513
2495
|
])
|
|
2514
2496
|
])) : U("", !0)
|
|
@@ -2517,7 +2499,7 @@ const il = /* @__PURE__ */ Q(nl, [["render", sl]]), cl = { class: "relative" },
|
|
|
2517
2499
|
}, 8, ["modelValue", "title"])
|
|
2518
2500
|
]));
|
|
2519
2501
|
}
|
|
2520
|
-
}),
|
|
2502
|
+
}), fl = { class: "flex items-center" }, pl = ["disabled"], gl = ["disabled"], hl = /* @__PURE__ */ Object.assign({
|
|
2521
2503
|
inheritAttrs: !1
|
|
2522
2504
|
}, {
|
|
2523
2505
|
__name: "vs-editor-history",
|
|
@@ -2525,10 +2507,10 @@ const il = /* @__PURE__ */ Q(nl, [["render", sl]]), cl = { class: "relative" },
|
|
|
2525
2507
|
setup(t) {
|
|
2526
2508
|
const e = t, a = () => {
|
|
2527
2509
|
e.editor?.can().undo() && e.editor.chain().focus().undo().run();
|
|
2528
|
-
},
|
|
2510
|
+
}, n = () => {
|
|
2529
2511
|
e.editor?.can().redo() && e.editor.chain().focus().redo().run();
|
|
2530
2512
|
};
|
|
2531
|
-
return (
|
|
2513
|
+
return (s, o) => (h(), w("div", fl, [
|
|
2532
2514
|
d("button", {
|
|
2533
2515
|
onClick: a,
|
|
2534
2516
|
class: E(["w-[30px] h-[30px] flex items-center justify-center rounded-l-full hover:text-gray-900 hover:bg-gray-100 border-r border-gray-200", [
|
|
@@ -2537,68 +2519,68 @@ const il = /* @__PURE__ */ Q(nl, [["render", sl]]), cl = { class: "relative" },
|
|
|
2537
2519
|
disabled: !t.editor?.can().undo(),
|
|
2538
2520
|
title: "Undo (Ctrl+Z)"
|
|
2539
2521
|
}, [
|
|
2540
|
-
C(L(
|
|
2541
|
-
], 10,
|
|
2522
|
+
C(L(Ot), { class: "h-4 w-4" })
|
|
2523
|
+
], 10, pl),
|
|
2542
2524
|
d("button", {
|
|
2543
|
-
onClick:
|
|
2525
|
+
onClick: n,
|
|
2544
2526
|
class: E(["w-[30px] h-[30px] flex items-center justify-center rounded-r-full hover:text-gray-900 hover:bg-gray-100", [
|
|
2545
2527
|
t.editor?.can().redo() ? "text-gray-500" : "text-gray-300 cursor-not-allowed"
|
|
2546
2528
|
]]),
|
|
2547
2529
|
disabled: !t.editor?.can().redo(),
|
|
2548
2530
|
title: "Redo (Ctrl+Y)"
|
|
2549
2531
|
}, [
|
|
2550
|
-
C(L(
|
|
2551
|
-
], 10,
|
|
2532
|
+
C(L(Rt), { class: "h-4 w-4" })
|
|
2533
|
+
], 10, gl)
|
|
2552
2534
|
]));
|
|
2553
2535
|
}
|
|
2554
|
-
}),
|
|
2536
|
+
}), vl = /* @__PURE__ */ Q(hl, [["__scopeId", "data-v-6a87fc55"]]), ml = { class: "relative" }, yl = { class: "p-6" }, bl = { class: "flex justify-between items-center mb-4" }, xl = /* @__PURE__ */ Object.assign({
|
|
2555
2537
|
inheritAttrs: !1
|
|
2556
2538
|
}, {
|
|
2557
2539
|
__name: "vs-editor-help",
|
|
2558
2540
|
props: { editor: Object },
|
|
2559
2541
|
setup(t) {
|
|
2560
|
-
const e =
|
|
2542
|
+
const e = _(!1), a = _(null), n = () => {
|
|
2561
2543
|
e.value = !e.value;
|
|
2562
|
-
},
|
|
2544
|
+
}, s = () => {
|
|
2563
2545
|
e.value = !1;
|
|
2564
2546
|
};
|
|
2565
|
-
return (o, l) => (
|
|
2547
|
+
return (o, l) => (h(), w("div", ml, [
|
|
2566
2548
|
d("button", {
|
|
2567
2549
|
ref_key: "helpButton",
|
|
2568
2550
|
ref: a,
|
|
2569
|
-
onClick:
|
|
2551
|
+
onClick: n,
|
|
2570
2552
|
class: E(["w-[30px] h-[30px] flex items-center justify-center rounded-full hover:text-gray-900 hover:bg-gray-100 text-gray-500", [e.value ? "bg-gray-100 text-gray-900" : "text-gray-500"]]),
|
|
2571
2553
|
title: "Markdown Shortcuts Help"
|
|
2572
2554
|
}, [
|
|
2573
|
-
C(L(
|
|
2555
|
+
C(L(Ut), { class: "h-4 w-4" })
|
|
2574
2556
|
], 2),
|
|
2575
|
-
e.value ? (
|
|
2557
|
+
e.value ? (h(), w("div", {
|
|
2576
2558
|
key: 0,
|
|
2577
2559
|
class: "fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-[100001]",
|
|
2578
|
-
onClick:
|
|
2560
|
+
onClick: s
|
|
2579
2561
|
}, [
|
|
2580
2562
|
d("div", {
|
|
2581
2563
|
class: "bg-white rounded-lg shadow-xl max-w-2xl w-full mx-4 max-h-[80vh] overflow-y-auto",
|
|
2582
|
-
onClick: l[0] || (l[0] =
|
|
2564
|
+
onClick: l[0] || (l[0] = it(() => {
|
|
2583
2565
|
}, ["stop"]))
|
|
2584
2566
|
}, [
|
|
2585
|
-
d("div",
|
|
2586
|
-
d("div",
|
|
2567
|
+
d("div", yl, [
|
|
2568
|
+
d("div", bl, [
|
|
2587
2569
|
l[1] || (l[1] = d("h2", { class: "text-xl font-semibold text-gray-900" }, "Common Markdown Syntax & Shortcuts", -1)),
|
|
2588
2570
|
d("button", {
|
|
2589
|
-
onClick:
|
|
2571
|
+
onClick: s,
|
|
2590
2572
|
class: "text-gray-400 hover:text-gray-600 transition-colors"
|
|
2591
2573
|
}, [
|
|
2592
|
-
C(L(
|
|
2574
|
+
C(L(Le), { class: "h-6 w-6" })
|
|
2593
2575
|
])
|
|
2594
2576
|
]),
|
|
2595
|
-
l[2] || (l[2] =
|
|
2577
|
+
l[2] || (l[2] = ct('<div class="space-y-6" data-v-92c21275><div data-v-92c21275><h3 class="text-lg font-medium text-gray-800 mb-3" data-v-92c21275>Markdown Syntax</h3><div class="overflow-x-auto" data-v-92c21275><table class="w-full border-collapse" data-v-92c21275><thead data-v-92c21275><tr class="bg-gray-50" data-v-92c21275><th class="border border-gray-200 px-3 py-2 text-left font-medium text-gray-700" data-v-92c21275>Element</th><th class="border border-gray-200 px-3 py-2 text-left font-medium text-gray-700" data-v-92c21275>Example</th></tr></thead><tbody class="text-sm" data-v-92c21275><tr data-v-92c21275><td class="border border-gray-200 px-3 py-2 font-medium" data-v-92c21275>Bold</td><td class="border border-gray-200 px-3 py-2" data-v-92c21275><code class="bg-gray-100 px-2 py-1 rounded" data-v-92c21275>**bold text**</code> or <code class="bg-gray-100 px-2 py-1 rounded" data-v-92c21275>__bold text__</code></td></tr><tr class="bg-gray-25" data-v-92c21275><td class="border border-gray-200 px-3 py-2 font-medium" data-v-92c21275>Italics</td><td class="border border-gray-200 px-3 py-2" data-v-92c21275><code class="bg-gray-100 px-2 py-1 rounded" data-v-92c21275>*italic text*</code> or <code class="bg-gray-100 px-2 py-1 rounded" data-v-92c21275>_italic text_</code></td></tr><tr data-v-92c21275><td class="border border-gray-200 px-3 py-2 font-medium" data-v-92c21275>Strikethrough</td><td class="border border-gray-200 px-3 py-2" data-v-92c21275><code class="bg-gray-100 px-2 py-1 rounded" data-v-92c21275>~strikethrough text~</code></td></tr><tr class="bg-gray-25" data-v-92c21275><td class="border border-gray-200 px-3 py-2 font-medium" data-v-92c21275>Headings</td><td class="border border-gray-200 px-3 py-2" data-v-92c21275><code class="bg-gray-100 px-2 py-1 rounded" data-v-92c21275># Heading 1</code>, <code class="bg-gray-100 px-2 py-1 rounded" data-v-92c21275>## Heading 2</code>, etc., up to <code class="bg-gray-100 px-2 py-1 rounded" data-v-92c21275>###### Heading 6</code></td></tr><tr data-v-92c21275><td class="border border-gray-200 px-3 py-2 font-medium" data-v-92c21275>Unordered Lists</td><td class="border border-gray-200 px-3 py-2" data-v-92c21275> Use an asterisk (*), dash (-), or plus sign (+) followed by a space. </td></tr><tr class="bg-gray-25" data-v-92c21275><td class="border border-gray-200 px-3 py-2 font-medium" data-v-92c21275>Ordered Lists</td><td class="border border-gray-200 px-3 py-2" data-v-92c21275> Use a number followed by a period and a space (e.g., <code class="bg-gray-100 px-2 py-1 rounded" data-v-92c21275>1. First item</code>). </td></tr><tr data-v-92c21275><td class="border border-gray-200 px-3 py-2 font-medium" data-v-92c21275>Blockquotes</td><td class="border border-gray-200 px-3 py-2" data-v-92c21275> Start with a greater-than sign (>) followed by a space. </td></tr><tr class="bg-gray-25" data-v-92c21275><td class="border border-gray-200 px-3 py-2 font-medium" data-v-92c21275>Inline Code</td><td class="border border-gray-200 px-3 py-2" data-v-92c21275> Surround with backticks (<code class="bg-gray-100 px-2 py-1 rounded" data-v-92c21275>`</code>). </td></tr><tr data-v-92c21275><td class="border border-gray-200 px-3 py-2 font-medium" data-v-92c21275>Code Blocks</td><td class="border border-gray-200 px-3 py-2" data-v-92c21275> Enclose with three backticks (<code class="bg-gray-100 px-2 py-1 rounded" data-v-92c21275>```</code>) before and after the code. </td></tr><tr class="bg-gray-25" data-v-92c21275><td class="border border-gray-200 px-3 py-2 font-medium" data-v-92c21275>Images</td><td class="border border-gray-200 px-3 py-2" data-v-92c21275> Use <code class="bg-gray-100 px-2 py-1 rounded" data-v-92c21275></code> syntax. </td></tr><tr data-v-92c21275><td class="border border-gray-200 px-3 py-2 font-medium" data-v-92c21275>Links</td><td class="border border-gray-200 px-3 py-2" data-v-92c21275> Use <code class="bg-gray-100 px-2 py-1 rounded" data-v-92c21275>[Link Text](url)</code> syntax. </td></tr><tr class="bg-gray-25" data-v-92c21275><td class="border border-gray-200 px-3 py-2 font-medium" data-v-92c21275>Checklists</td><td class="border border-gray-200 px-3 py-2" data-v-92c21275> Create a list item with <code class="bg-gray-100 px-2 py-1 rounded" data-v-92c21275>- [ ]</code> for an incomplete task or <code class="bg-gray-100 px-2 py-1 rounded" data-v-92c21275>- [x]</code> for a completed one. </td></tr></tbody></table></div></div><div data-v-92c21275><h3 class="text-lg font-medium text-gray-800 mb-3" data-v-92c21275>Common Editing Shortcuts</h3><div class="overflow-x-auto" data-v-92c21275><table class="w-full border-collapse" data-v-92c21275><thead data-v-92c21275><tr class="bg-gray-50" data-v-92c21275><th class="border border-gray-200 px-3 py-2 text-left font-medium text-gray-700" data-v-92c21275>Shortcut</th><th class="border border-gray-200 px-3 py-2 text-left font-medium text-gray-700" data-v-92c21275>Action</th></tr></thead><tbody class="text-sm" data-v-92c21275><tr data-v-92c21275><td class="border border-gray-200 px-3 py-2 font-medium" data-v-92c21275><code class="bg-gray-100 px-2 py-1 rounded" data-v-92c21275>Ctrl+A</code></td><td class="border border-gray-200 px-3 py-2" data-v-92c21275>Select all text</td></tr><tr class="bg-gray-25" data-v-92c21275><td class="border border-gray-200 px-3 py-2 font-medium" data-v-92c21275><code class="bg-gray-100 px-2 py-1 rounded" data-v-92c21275>Ctrl+B</code></td><td class="border border-gray-200 px-3 py-2" data-v-92c21275>Apply bold formatting</td></tr><tr data-v-92c21275><td class="border border-gray-200 px-3 py-2 font-medium" data-v-92c21275><code class="bg-gray-100 px-2 py-1 rounded" data-v-92c21275>Ctrl+C</code></td><td class="border border-gray-200 px-3 py-2" data-v-92c21275>Copy selected text</td></tr><tr class="bg-gray-25" data-v-92c21275><td class="border border-gray-200 px-3 py-2 font-medium" data-v-92c21275><code class="bg-gray-100 px-2 py-1 rounded" data-v-92c21275>Ctrl+I</code></td><td class="border border-gray-200 px-3 py-2" data-v-92c21275>Apply italic formatting</td></tr><tr data-v-92c21275><td class="border border-gray-200 px-3 py-2 font-medium" data-v-92c21275><code class="bg-gray-100 px-2 py-1 rounded" data-v-92c21275>Ctrl+K</code></td><td class="border border-gray-200 px-3 py-2" data-v-92c21275>Open the insert link dialog</td></tr><tr class="bg-gray-25" data-v-92c21275><td class="border border-gray-200 px-3 py-2 font-medium" data-v-92c21275><code class="bg-gray-100 px-2 py-1 rounded" data-v-92c21275>Ctrl+S</code></td><td class="border border-gray-200 px-3 py-2" data-v-92c21275>Save the current document</td></tr><tr data-v-92c21275><td class="border border-gray-200 px-3 py-2 font-medium" data-v-92c21275><code class="bg-gray-100 px-2 py-1 rounded" data-v-92c21275>Ctrl+V</code></td><td class="border border-gray-200 px-3 py-2" data-v-92c21275>Paste copied text</td></tr><tr class="bg-gray-25" data-v-92c21275><td class="border border-gray-200 px-3 py-2 font-medium" data-v-92c21275><code class="bg-gray-100 px-2 py-1 rounded" data-v-92c21275>Ctrl+X</code></td><td class="border border-gray-200 px-3 py-2" data-v-92c21275>Cut selected text</td></tr><tr data-v-92c21275><td class="border border-gray-200 px-3 py-2 font-medium" data-v-92c21275><code class="bg-gray-100 px-2 py-1 rounded" data-v-92c21275>Ctrl+Y</code></td><td class="border border-gray-200 px-3 py-2" data-v-92c21275>Redo the last action</td></tr><tr class="bg-gray-25" data-v-92c21275><td class="border border-gray-200 px-3 py-2 font-medium" data-v-92c21275><code class="bg-gray-100 px-2 py-1 rounded" data-v-92c21275>Alt+Shift+Backspace</code></td><td class="border border-gray-200 px-3 py-2" data-v-92c21275>Redo the last action</td></tr><tr data-v-92c21275><td class="border border-gray-200 px-3 py-2 font-medium" data-v-92c21275><code class="bg-gray-100 px-2 py-1 rounded" data-v-92c21275>Ctrl+Z</code></td><td class="border border-gray-200 px-3 py-2" data-v-92c21275>Undo the last action</td></tr><tr class="bg-gray-25" data-v-92c21275><td class="border border-gray-200 px-3 py-2 font-medium" data-v-92c21275><code class="bg-gray-100 px-2 py-1 rounded" data-v-92c21275>Alt+Backspace</code></td><td class="border border-gray-200 px-3 py-2" data-v-92c21275>Undo the last action</td></tr></tbody></table></div></div></div>', 1))
|
|
2596
2578
|
])
|
|
2597
2579
|
])
|
|
2598
2580
|
])) : U("", !0)
|
|
2599
2581
|
]));
|
|
2600
2582
|
}
|
|
2601
|
-
}),
|
|
2583
|
+
}), wl = /* @__PURE__ */ Q(xl, [["__scopeId", "data-v-92c21275"]]), kl = {
|
|
2602
2584
|
__name: "vs-editor-horizontal-rule",
|
|
2603
2585
|
props: {
|
|
2604
2586
|
editor: Object
|
|
@@ -2607,59 +2589,59 @@ const il = /* @__PURE__ */ Q(nl, [["render", sl]]), cl = { class: "relative" },
|
|
|
2607
2589
|
const e = t, a = () => {
|
|
2608
2590
|
e.editor && e.editor.chain().focus().setHorizontalRule().run();
|
|
2609
2591
|
};
|
|
2610
|
-
return (
|
|
2592
|
+
return (n, s) => (h(), w("button", {
|
|
2611
2593
|
title: "Horizontal Rule",
|
|
2612
2594
|
onClick: a,
|
|
2613
2595
|
class: "flex flex-col h-[30px] px-1 rounded-full hover:bg-gray-100 justify-center items-center relative flex"
|
|
2614
2596
|
}, [
|
|
2615
|
-
C(L(
|
|
2597
|
+
C(L(qt), { class: "h-4 w-4" })
|
|
2616
2598
|
]));
|
|
2617
2599
|
}
|
|
2618
|
-
},
|
|
2600
|
+
}, _l = {
|
|
2619
2601
|
__name: "vs-editor-fullscreen",
|
|
2620
2602
|
props: {
|
|
2621
2603
|
editor: Object
|
|
2622
2604
|
},
|
|
2623
2605
|
emits: ["toggle-fullscreen"],
|
|
2624
2606
|
setup(t, { emit: e }) {
|
|
2625
|
-
const a = e,
|
|
2607
|
+
const a = e, n = () => {
|
|
2626
2608
|
a("toggle-fullscreen");
|
|
2627
2609
|
};
|
|
2628
|
-
return (
|
|
2610
|
+
return (s, o) => (h(), w("button", {
|
|
2629
2611
|
title: "Fullscreen",
|
|
2630
|
-
onClick:
|
|
2612
|
+
onClick: n,
|
|
2631
2613
|
class: "w-[30px] h-[30px] flex items-center justify-center text-gray-500 rounded-full hover:text-gray-900 hover:bg-gray-100"
|
|
2632
2614
|
}, [
|
|
2633
|
-
C(L(
|
|
2615
|
+
C(L(Wt), { class: "h-4 w-4" })
|
|
2634
2616
|
]));
|
|
2635
2617
|
}
|
|
2636
|
-
},
|
|
2637
|
-
bold:
|
|
2638
|
-
italic:
|
|
2639
|
-
color:
|
|
2640
|
-
background_color:
|
|
2641
|
-
highlight:
|
|
2642
|
-
bullet_list:
|
|
2643
|
-
ordered_list:
|
|
2644
|
-
blockquote:
|
|
2645
|
-
codeblock:
|
|
2646
|
-
underline:
|
|
2647
|
-
strike:
|
|
2648
|
-
link:
|
|
2649
|
-
table:
|
|
2650
|
-
text_align:
|
|
2651
|
-
font_family:
|
|
2652
|
-
font_size:
|
|
2653
|
-
superscript:
|
|
2654
|
-
subscript:
|
|
2655
|
-
heading:
|
|
2656
|
-
clear_formatting:
|
|
2657
|
-
image:
|
|
2658
|
-
history:
|
|
2659
|
-
help:
|
|
2660
|
-
horizontal_rule:
|
|
2661
|
-
fullscreen:
|
|
2662
|
-
},
|
|
2618
|
+
}, $l = {
|
|
2619
|
+
bold: Br,
|
|
2620
|
+
italic: jr,
|
|
2621
|
+
color: _o,
|
|
2622
|
+
background_color: Lo,
|
|
2623
|
+
highlight: To,
|
|
2624
|
+
bullet_list: kr,
|
|
2625
|
+
ordered_list: Cr,
|
|
2626
|
+
blockquote: br,
|
|
2627
|
+
codeblock: Sr,
|
|
2628
|
+
underline: Mr,
|
|
2629
|
+
strike: Pr,
|
|
2630
|
+
link: ao,
|
|
2631
|
+
table: uo,
|
|
2632
|
+
text_align: go,
|
|
2633
|
+
font_family: Mo,
|
|
2634
|
+
font_size: zo,
|
|
2635
|
+
superscript: Oo,
|
|
2636
|
+
subscript: qo,
|
|
2637
|
+
heading: Yo,
|
|
2638
|
+
clear_formatting: el,
|
|
2639
|
+
image: ul,
|
|
2640
|
+
history: vl,
|
|
2641
|
+
help: wl,
|
|
2642
|
+
horizontal_rule: kl,
|
|
2643
|
+
fullscreen: _l
|
|
2644
|
+
}, Re = {
|
|
2663
2645
|
// Базовий набір - мінімальний функціонал
|
|
2664
2646
|
basic: [
|
|
2665
2647
|
"history",
|
|
@@ -2733,17 +2715,17 @@ const il = /* @__PURE__ */ Q(nl, [["render", sl]]), cl = { class: "relative" },
|
|
|
2733
2715
|
"fullscreen",
|
|
2734
2716
|
"help"
|
|
2735
2717
|
]
|
|
2736
|
-
},
|
|
2718
|
+
}, Cl = { class: "flex align-middle gap-x-0.5 border-b flex-wrap border-b-gray-200 px-[10px] py-[6px] border-solid border-transparent" }, Al = { class: "editor-body" }, Fl = {
|
|
2737
2719
|
key: 0,
|
|
2738
2720
|
class: "richtext-loading text-sm text-gray-500"
|
|
2739
|
-
},
|
|
2721
|
+
}, Sl = {
|
|
2740
2722
|
key: 1,
|
|
2741
2723
|
class: "richtext-error text-sm text-red-600"
|
|
2742
|
-
},
|
|
2724
|
+
}, Ll = { class: "html-source-editor" }, Tl = { class: "flex justify-end border-t border-[#e5e7eb] bg-[#f8fafc] px-4 min-h-[38px] items-start overflow-visible" }, Bl = { class: "inline-flex items-stretch -mt-px" }, Pl = /* @__PURE__ */ Object.assign({
|
|
2743
2725
|
inheritAttrs: !1
|
|
2744
2726
|
}, {
|
|
2745
2727
|
__name: "vs-richtext",
|
|
2746
|
-
props: /* @__PURE__ */
|
|
2728
|
+
props: /* @__PURE__ */ dt({
|
|
2747
2729
|
modelValue: { type: String, default: () => "" },
|
|
2748
2730
|
height: { type: String, default: () => "300px" },
|
|
2749
2731
|
format: { type: String, default: () => "html" },
|
|
@@ -2757,28 +2739,28 @@ const il = /* @__PURE__ */ Q(nl, [["render", sl]]), cl = { class: "relative" },
|
|
|
2757
2739
|
}),
|
|
2758
2740
|
emits: ["update:modelValue"],
|
|
2759
2741
|
setup(t) {
|
|
2760
|
-
const e = t, a =
|
|
2742
|
+
const e = t, a = ut(t, "modelValue"), n = _(null), s = _(null), o = ft(null), l = _(!1), c = _(""), r = _(!1), i = _(null), x = _(""), v = _(""), f = _(null), p = _(!1), I = _(!1), { isFullscreen: D, toggleFullscreen: O } = Xt(), { t: R } = je(), Z = N(() => e.format === "md" ? "markdown" : "html"), M = N(
|
|
2761
2743
|
() => e.format === "md" ? R("form.richtext.markdown") : R("form.richtext.html")
|
|
2762
|
-
), ee = N(() => o.value || null),
|
|
2763
|
-
const A = (i.value?.attributes || []).find((
|
|
2764
|
-
return A.split(";").forEach((
|
|
2765
|
-
const [
|
|
2766
|
-
!
|
|
2744
|
+
), ee = N(() => o.value || null), ae = N(() => typeof e.toolbar == "string" ? Re[e.toolbar] || Re.default : e.toolbar), $e = N(() => ae.value.map((g) => $l[g]).filter(Boolean)), Ce = N(() => (i.value?.attributes || []).find((A) => A.name === "class")?.value || ""), y = N(() => {
|
|
2745
|
+
const A = (i.value?.attributes || []).find((V) => V.name === "style")?.value || "", B = {};
|
|
2746
|
+
return A.split(";").forEach((V) => {
|
|
2747
|
+
const [K, ...be] = V.split(":"), ie = K?.trim(), ce = be.join(":").trim();
|
|
2748
|
+
!ie || !ce || ie !== "height" && (B[ie.replace(/-([a-z])/g, (xe, tt) => tt.toUpperCase())] = ce);
|
|
2767
2749
|
}), B;
|
|
2768
2750
|
}), k = (g) => {
|
|
2769
2751
|
const A = (g || "").trim();
|
|
2770
2752
|
return A ? /^<p(?:\s+[^>]*)?>(?:\s|<br[^>]*>)*<\/p>$/i.test(A) : !0;
|
|
2771
|
-
}, u = (g) => k(g) ? "" : g || "",
|
|
2753
|
+
}, u = (g) => k(g) ? "" : g || "", $ = (g) => {
|
|
2772
2754
|
const A = g || "";
|
|
2773
2755
|
f.value = A, a.value = A;
|
|
2774
2756
|
}, b = (g) => {
|
|
2775
2757
|
if (!g || !g.view || !g.view.dom) return;
|
|
2776
2758
|
g.view.dom.querySelectorAll("img.editor-image[width][height]").forEach((B) => {
|
|
2777
2759
|
if (B instanceof HTMLImageElement) {
|
|
2778
|
-
const
|
|
2779
|
-
|
|
2780
|
-
width: ${
|
|
2781
|
-
height: ${
|
|
2760
|
+
const V = B.getAttribute("width"), K = B.getAttribute("height");
|
|
2761
|
+
V && K && V !== "auto" && K !== "auto" && V !== "" && K !== "" && !isNaN(Number(V)) && !isNaN(Number(K)) && (B.style.cssText = `
|
|
2762
|
+
width: ${V}px !important;
|
|
2763
|
+
height: ${K}px !important;
|
|
2782
2764
|
max-width: none !important;
|
|
2783
2765
|
max-height: none !important;
|
|
2784
2766
|
min-width: auto !important;
|
|
@@ -2789,62 +2771,62 @@ const il = /* @__PURE__ */ Q(nl, [["render", sl]]), cl = { class: "relative" },
|
|
|
2789
2771
|
});
|
|
2790
2772
|
}, T = async (g, { force: A = !1 } = {}) => {
|
|
2791
2773
|
if (x.value = g || "", !o.value || r.value && !A) return;
|
|
2792
|
-
u(o.value.getHTML()) !== (g || "") && (o.value.commands.setContent(g || "", !1),
|
|
2774
|
+
u(o.value.getHTML()) !== (g || "") && (o.value.commands.setContent(g || "", !1), ne(() => {
|
|
2793
2775
|
b(o.value);
|
|
2794
2776
|
}));
|
|
2795
|
-
},
|
|
2796
|
-
I.value = !0,
|
|
2797
|
-
},
|
|
2798
|
-
const g = await
|
|
2799
|
-
g !== (a.value || "") ?
|
|
2777
|
+
}, m = async (g) => {
|
|
2778
|
+
I.value = !0, v.value = g || "", await ne(), I.value = !1;
|
|
2779
|
+
}, S = async (g) => e.format === "html" ? ke(g || "") : g || "", P = async () => {
|
|
2780
|
+
const g = await S(v.value);
|
|
2781
|
+
g !== (a.value || "") ? $(g) : f.value = g;
|
|
2800
2782
|
}, z = async (g) => {
|
|
2801
2783
|
const A = g || "";
|
|
2802
2784
|
if (e.format === "html") {
|
|
2803
|
-
const B =
|
|
2804
|
-
i.value =
|
|
2785
|
+
const B = ke(A), V = Ne(B);
|
|
2786
|
+
i.value = V.wrapper, await T(V.bodyHtml || ""), f.value = B;
|
|
2805
2787
|
return;
|
|
2806
2788
|
} else {
|
|
2807
2789
|
i.value = null;
|
|
2808
|
-
const B = await
|
|
2809
|
-
await T(B || ""), r.value && await
|
|
2790
|
+
const B = await Ve(A, e.format);
|
|
2791
|
+
await T(B || ""), r.value && await m(A);
|
|
2810
2792
|
}
|
|
2811
2793
|
f.value = A;
|
|
2812
|
-
},
|
|
2794
|
+
}, j = async () => {
|
|
2813
2795
|
if (e.format === "html") {
|
|
2814
|
-
const A = u(o.value?.getHTML() || x.value || ""), B =
|
|
2815
|
-
return
|
|
2796
|
+
const A = u(o.value?.getHTML() || x.value || ""), B = ze(A, i.value);
|
|
2797
|
+
return De(ke(B), "html");
|
|
2816
2798
|
}
|
|
2817
2799
|
const g = u(o.value?.getHTML() || x.value || "");
|
|
2818
|
-
return
|
|
2819
|
-
},
|
|
2800
|
+
return De(g, e.format);
|
|
2801
|
+
}, F = async (g) => {
|
|
2820
2802
|
if (r.value !== g) {
|
|
2821
2803
|
if (g) {
|
|
2822
|
-
p.value = !0, r.value = !0, await
|
|
2823
|
-
|
|
2804
|
+
p.value = !0, r.value = !0, await m(await j()), ne(() => {
|
|
2805
|
+
s.value?.focus?.();
|
|
2824
2806
|
});
|
|
2825
2807
|
return;
|
|
2826
2808
|
}
|
|
2827
|
-
if (await
|
|
2828
|
-
const A =
|
|
2809
|
+
if (await P(), e.format === "html") {
|
|
2810
|
+
const A = ke(v.value || ""), B = Ne(A);
|
|
2829
2811
|
i.value = B.wrapper, await T(B.bodyHtml || "", { force: !0 });
|
|
2830
2812
|
} else {
|
|
2831
|
-
const A = await
|
|
2813
|
+
const A = await Ve(v.value || "", e.format);
|
|
2832
2814
|
await T(A || "", { force: !0 });
|
|
2833
2815
|
}
|
|
2834
|
-
r.value = !1, p.value = !1,
|
|
2816
|
+
r.value = !1, p.value = !1, ne(() => {
|
|
2835
2817
|
o.value?.commands?.focus?.();
|
|
2836
2818
|
});
|
|
2837
2819
|
}
|
|
2838
2820
|
}, H = () => {
|
|
2839
2821
|
r.value || o.value?.commands?.focus?.();
|
|
2840
2822
|
}, X = async () => {
|
|
2841
|
-
if (!
|
|
2823
|
+
if (!n.value) return null;
|
|
2842
2824
|
l.value = !0, c.value = "";
|
|
2843
2825
|
try {
|
|
2844
|
-
const g = await
|
|
2826
|
+
const g = await rr();
|
|
2845
2827
|
if (!g) return null;
|
|
2846
2828
|
const A = new g.Editor({
|
|
2847
|
-
element:
|
|
2829
|
+
element: n.value,
|
|
2848
2830
|
content: x.value || "",
|
|
2849
2831
|
extensions: [
|
|
2850
2832
|
g.StarterKit.configure({
|
|
@@ -2893,38 +2875,38 @@ const il = /* @__PURE__ */ Q(nl, [["render", sl]]), cl = { class: "relative" },
|
|
|
2893
2875
|
g.Iframe
|
|
2894
2876
|
],
|
|
2895
2877
|
editorProps: {
|
|
2896
|
-
handlePaste: (B,
|
|
2897
|
-
handleKeyDown: (B,
|
|
2898
|
-
if (
|
|
2899
|
-
const
|
|
2900
|
-
let
|
|
2901
|
-
for (let
|
|
2902
|
-
const
|
|
2903
|
-
if (
|
|
2904
|
-
|
|
2878
|
+
handlePaste: (B, V) => pr(B, V, g.ProseMirrorDOMParser),
|
|
2879
|
+
handleKeyDown: (B, V) => {
|
|
2880
|
+
if (V.key === "Tab") {
|
|
2881
|
+
const K = B.state, { $anchor: be } = K.selection;
|
|
2882
|
+
let ie = !1;
|
|
2883
|
+
for (let ce = be.depth; ce > 0; ce--) {
|
|
2884
|
+
const xe = be.node(ce);
|
|
2885
|
+
if (xe && (xe.type.name === "bulletList" || xe.type.name === "orderedList")) {
|
|
2886
|
+
ie = !0;
|
|
2905
2887
|
break;
|
|
2906
2888
|
}
|
|
2907
2889
|
}
|
|
2908
|
-
return
|
|
2890
|
+
return ie ? !1 : (V.preventDefault(), !0);
|
|
2909
2891
|
}
|
|
2910
2892
|
return !1;
|
|
2911
2893
|
}
|
|
2912
2894
|
}
|
|
2913
2895
|
});
|
|
2914
|
-
return o.value =
|
|
2896
|
+
return o.value = pt(A), o.value.on("update", async ({ editor: B }) => {
|
|
2915
2897
|
if (r.value) return;
|
|
2916
|
-
const
|
|
2917
|
-
if (x.value =
|
|
2918
|
-
const
|
|
2919
|
-
|
|
2898
|
+
const V = u(B.getHTML());
|
|
2899
|
+
if (x.value = V, e.format === "html") {
|
|
2900
|
+
const K = ze(V, i.value);
|
|
2901
|
+
K !== a.value && $(K);
|
|
2920
2902
|
} else {
|
|
2921
|
-
const
|
|
2922
|
-
|
|
2903
|
+
const K = await ur(V, e.format);
|
|
2904
|
+
K !== a.value && $(K);
|
|
2923
2905
|
}
|
|
2924
2906
|
setTimeout(() => {
|
|
2925
2907
|
b(B);
|
|
2926
2908
|
}, 10);
|
|
2927
|
-
}),
|
|
2909
|
+
}), ne(() => {
|
|
2928
2910
|
b(o.value);
|
|
2929
2911
|
}), A;
|
|
2930
2912
|
} catch (g) {
|
|
@@ -2933,7 +2915,7 @@ const il = /* @__PURE__ */ Q(nl, [["render", sl]]), cl = { class: "relative" },
|
|
|
2933
2915
|
l.value = !1;
|
|
2934
2916
|
}
|
|
2935
2917
|
};
|
|
2936
|
-
return
|
|
2918
|
+
return de(
|
|
2937
2919
|
() => e.modelValue,
|
|
2938
2920
|
async (g) => {
|
|
2939
2921
|
if (p.value) return;
|
|
@@ -2941,22 +2923,22 @@ const il = /* @__PURE__ */ Q(nl, [["render", sl]]), cl = { class: "relative" },
|
|
|
2941
2923
|
A !== f.value && await z(A);
|
|
2942
2924
|
},
|
|
2943
2925
|
{ immediate: !0 }
|
|
2944
|
-
),
|
|
2945
|
-
!r.value || !p.value || I.value || await
|
|
2946
|
-
}),
|
|
2947
|
-
await X(),
|
|
2926
|
+
), de(v, async () => {
|
|
2927
|
+
!r.value || !p.value || I.value || await P();
|
|
2928
|
+
}), ue(async () => {
|
|
2929
|
+
await X(), ne(() => {
|
|
2948
2930
|
o.value && setTimeout(() => {
|
|
2949
2931
|
b(o.value);
|
|
2950
2932
|
}, 100);
|
|
2951
2933
|
});
|
|
2952
|
-
}),
|
|
2953
|
-
r.value && p.value && await
|
|
2954
|
-
}), (g, A) => (
|
|
2955
|
-
class: E(["bg-white rounded-md w-full", { "fixed left-0 right-0 top-0 bottom-0 z-[100000]": L(
|
|
2934
|
+
}), We(async () => {
|
|
2935
|
+
r.value && p.value && await P(), o.value?.destroy?.(), o.value = null;
|
|
2936
|
+
}), (g, A) => (h(), w("div", {
|
|
2937
|
+
class: E(["bg-white rounded-md w-full", { "fixed left-0 right-0 top-0 bottom-0 z-[100000]": L(D) }])
|
|
2956
2938
|
}, [
|
|
2957
|
-
d("div",
|
|
2958
|
-
(
|
|
2959
|
-
o.value ? (
|
|
2939
|
+
d("div", Cl, [
|
|
2940
|
+
(h(!0), w(J, null, re($e.value, (B) => (h(), w(J, { key: B }, [
|
|
2941
|
+
o.value ? (h(), W(Fe(B), {
|
|
2960
2942
|
key: 0,
|
|
2961
2943
|
editor: ee.value,
|
|
2962
2944
|
onToggleFullscreen: L(O)
|
|
@@ -2966,61 +2948,61 @@ const il = /* @__PURE__ */ Q(nl, [["render", sl]]), cl = { class: "relative" },
|
|
|
2966
2948
|
d("div", {
|
|
2967
2949
|
onClick: H,
|
|
2968
2950
|
class: "relative w-full px-4 py-2 bg-white rounded-b-lg editor-content",
|
|
2969
|
-
style:
|
|
2951
|
+
style: te({ height: L(D) ? "calc(95vh - 44px)" : t.height })
|
|
2970
2952
|
}, [
|
|
2971
|
-
d("div",
|
|
2972
|
-
|
|
2973
|
-
class: E(["rich-text-scroll-wrapper",
|
|
2974
|
-
style:
|
|
2953
|
+
d("div", Al, [
|
|
2954
|
+
le(d("div", {
|
|
2955
|
+
class: E(["rich-text-scroll-wrapper", Ce.value]),
|
|
2956
|
+
style: te(y.value)
|
|
2975
2957
|
}, [
|
|
2976
2958
|
d("div", {
|
|
2977
2959
|
ref_key: "editorElement",
|
|
2978
|
-
ref:
|
|
2960
|
+
ref: n,
|
|
2979
2961
|
class: "relative w-full"
|
|
2980
2962
|
}, null, 512),
|
|
2981
|
-
l.value ? (
|
|
2982
|
-
c.value ? (
|
|
2963
|
+
l.value ? (h(), w("div", Fl, "Loading editor...")) : U("", !0),
|
|
2964
|
+
c.value ? (h(), w("div", Sl, G(c.value), 1)) : U("", !0)
|
|
2983
2965
|
], 6), [
|
|
2984
|
-
[
|
|
2966
|
+
[me, !r.value]
|
|
2985
2967
|
]),
|
|
2986
|
-
|
|
2987
|
-
C(
|
|
2968
|
+
le(d("div", Ll, [
|
|
2969
|
+
C(ht, {
|
|
2988
2970
|
ref_key: "htmlTextarea",
|
|
2989
|
-
ref:
|
|
2990
|
-
modelValue:
|
|
2991
|
-
"onUpdate:modelValue": A[0] || (A[0] = (B) =>
|
|
2971
|
+
ref: s,
|
|
2972
|
+
modelValue: v.value,
|
|
2973
|
+
"onUpdate:modelValue": A[0] || (A[0] = (B) => v.value = B),
|
|
2992
2974
|
height: "100%",
|
|
2993
|
-
syntax:
|
|
2975
|
+
syntax: Z.value,
|
|
2994
2976
|
theme: "vs-light"
|
|
2995
2977
|
}, null, 8, ["modelValue", "syntax"])
|
|
2996
2978
|
], 512), [
|
|
2997
|
-
[
|
|
2979
|
+
[me, r.value]
|
|
2998
2980
|
])
|
|
2999
2981
|
])
|
|
3000
2982
|
], 4),
|
|
3001
|
-
d("div",
|
|
3002
|
-
d("div",
|
|
2983
|
+
d("div", Tl, [
|
|
2984
|
+
d("div", Bl, [
|
|
3003
2985
|
d("button", {
|
|
3004
2986
|
type: "button",
|
|
3005
2987
|
class: E([
|
|
3006
2988
|
"min-w-[96px] h-[30px] px-[14px] border border-[#cfd6e0] bg-[#f3f5f8] text-[8px] font-bold uppercase tracking-[0.06em] leading-none cursor-pointer transition-colors duration-200 border-b-[1px] border-b-[#cfd6e0] rounded-none rounded-bl-[8px] hover:bg-[#eef1f5] hover:text-[#667284]",
|
|
3007
2989
|
r.value ? "text-[#8f99aa]" : "!bg-white text-[#49556a] border-[#cfd6e0] border-t-transparent relative z-[1]"
|
|
3008
2990
|
]),
|
|
3009
|
-
onClick: A[1] || (A[1] = (B) =>
|
|
3010
|
-
},
|
|
2991
|
+
onClick: A[1] || (A[1] = (B) => F(!1))
|
|
2992
|
+
}, G(L(R)("form.richtext.editor")), 3),
|
|
3011
2993
|
d("button", {
|
|
3012
2994
|
type: "button",
|
|
3013
2995
|
class: E([
|
|
3014
2996
|
"min-w-[96px] h-[30px] px-[14px] border border-[#cfd6e0] border-l-0 bg-[#f3f5f8] text-[8px] font-bold uppercase tracking-[0.06em] leading-none cursor-pointer transition-colors duration-200 border-b-[1px] border-b-[#cfd6e0] rounded-none rounded-br-[8px] hover:bg-[#eef1f5] hover:text-[#667284]",
|
|
3015
2997
|
r.value ? "!bg-white text-[#49556a] border-[#cfd6e0] border-t-transparent relative z-[1]" : "text-[#8f99aa]"
|
|
3016
2998
|
]),
|
|
3017
|
-
onClick: A[2] || (A[2] = (B) =>
|
|
3018
|
-
},
|
|
2999
|
+
onClick: A[2] || (A[2] = (B) => F(!0))
|
|
3000
|
+
}, G(M.value), 3)
|
|
3019
3001
|
])
|
|
3020
3002
|
])
|
|
3021
3003
|
], 2));
|
|
3022
3004
|
}
|
|
3023
3005
|
});
|
|
3024
3006
|
export {
|
|
3025
|
-
|
|
3007
|
+
Pl as default
|
|
3026
3008
|
};
|