vlite3 1.1.8 → 1.1.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/components/Chart/BarChart.vue.js +369 -0
- package/components/Chart/BarChart.vue2.js +4 -0
- package/components/Chart/CircleChart.vue.js +137 -0
- package/components/Chart/CircleChart.vue2.js +4 -0
- package/components/Chart/GaugeChart.vue.js +443 -0
- package/components/Chart/GaugeChart.vue2.js +4 -0
- package/components/Chart/LineChart.vue.js +7 -0
- package/components/Chart/LineChart.vue2.js +313 -0
- package/components/Chart/PieChart.vue.js +203 -0
- package/components/Chart/PieChart.vue2.js +4 -0
- package/components/Chart/utils.js +90 -0
- package/components/Footer/Footer.vue.js +35 -0
- package/components/Footer/Footer.vue2.js +4 -0
- package/components/Footer/Variant1.vue.js +178 -0
- package/components/Footer/Variant1.vue2.js +4 -0
- package/components/Footer/Variant2.vue.js +177 -0
- package/components/Footer/Variant2.vue2.js +4 -0
- package/components/Footer/Variant3.vue.js +82 -0
- package/components/Footer/Variant3.vue2.js +4 -0
- package/components/RichTextEditor/RichTextEditor.vue.js +332 -0
- package/components/RichTextEditor/RichTextEditor.vue3.js +5 -0
- package/components/RichTextEditor/RichTextLinkPopover.vue.js +107 -0
- package/components/RichTextEditor/RichTextLinkPopover.vue3.js +5 -0
- package/components/RichTextEditor/RichTextReader.vue.js +7 -0
- package/components/RichTextEditor/RichTextReader.vue2.js +19 -0
- package/components/RichTextEditor/RichTextToolbar.vue.js +330 -0
- package/components/RichTextEditor/RichTextToolbar.vue3.js +5 -0
- package/components/RichTextEditor/composables/useRichTextImageUpload.js +77 -0
- package/components/RichTextEditor/composables/useRichTextLinks.js +120 -0
- package/core/config.d.ts +2 -2
- package/index.d.ts +3 -0
- package/index.js +332 -315
- package/package.json +1 -1
- package/style.css +1 -1
|
@@ -0,0 +1,330 @@
|
|
|
1
|
+
import { defineComponent as v, openBlock as b, createElementBlock as m, withModifiers as a, createElementVNode as i, createVNode as o, setBlockTracking as s, normalizeClass as r, createBlock as u } from "vue";
|
|
2
|
+
import l from "../Icon.vue.js";
|
|
3
|
+
const y = ["aria-label", "aria-disabled"], g = ["disabled"], k = ["disabled"], B = ["aria-pressed", "disabled"], f = ["aria-pressed", "disabled"], h = ["aria-pressed", "disabled"], w = ["aria-pressed", "disabled"], M = ["aria-pressed", "disabled"], $ = ["aria-pressed", "disabled"], I = ["aria-pressed", "disabled"], S = ["disabled"], C = ["aria-pressed", "disabled"], L = ["aria-pressed", "disabled"], U = ["aria-pressed", "disabled"], x = ["disabled"], R = ["disabled"], j = ["aria-pressed", "disabled"], H = ["aria-pressed", "disabled"], q = ["aria-pressed", "disabled"], A = ["disabled"], T = ["disabled"], E = /* @__PURE__ */ v({
|
|
4
|
+
__name: "RichTextToolbar",
|
|
5
|
+
props: {
|
|
6
|
+
toolbarState: {},
|
|
7
|
+
activeBlock: {},
|
|
8
|
+
disabled: { type: Boolean },
|
|
9
|
+
readonly: { type: Boolean },
|
|
10
|
+
isUploadingImage: { type: Boolean },
|
|
11
|
+
label: {}
|
|
12
|
+
},
|
|
13
|
+
emits: ["command", "setBlock", "insertCode", "triggerImageUpload", "openLinkPopover", "clearFormat"],
|
|
14
|
+
setup(e, { emit: c }) {
|
|
15
|
+
const n = c;
|
|
16
|
+
return (P, t) => (b(), m("div", {
|
|
17
|
+
class: "rte-toolbar",
|
|
18
|
+
role: "toolbar",
|
|
19
|
+
"aria-label": e.label ? `${e.label} formatting toolbar` : "Rich text editor toolbar",
|
|
20
|
+
"aria-disabled": e.disabled || e.readonly || void 0,
|
|
21
|
+
onMousedown: t[25] || (t[25] = a(() => {
|
|
22
|
+
}, ["prevent"]))
|
|
23
|
+
}, [
|
|
24
|
+
i("button", {
|
|
25
|
+
type: "button",
|
|
26
|
+
class: "rte-btn",
|
|
27
|
+
title: "Undo (Ctrl+Z)",
|
|
28
|
+
"aria-label": "Undo",
|
|
29
|
+
disabled: e.disabled || e.readonly,
|
|
30
|
+
onMousedown: t[0] || (t[0] = a((d) => n("command", "undo"), ["prevent"]))
|
|
31
|
+
}, [
|
|
32
|
+
o(l, {
|
|
33
|
+
icon: "lucide:undo-2",
|
|
34
|
+
class: "rte-icon",
|
|
35
|
+
"aria-hidden": "true"
|
|
36
|
+
})
|
|
37
|
+
], 40, g),
|
|
38
|
+
i("button", {
|
|
39
|
+
type: "button",
|
|
40
|
+
class: "rte-btn",
|
|
41
|
+
title: "Redo (Ctrl+Y)",
|
|
42
|
+
"aria-label": "Redo",
|
|
43
|
+
disabled: e.disabled || e.readonly,
|
|
44
|
+
onMousedown: t[1] || (t[1] = a((d) => n("command", "redo"), ["prevent"]))
|
|
45
|
+
}, [
|
|
46
|
+
o(l, {
|
|
47
|
+
icon: "lucide:redo-2",
|
|
48
|
+
class: "rte-icon",
|
|
49
|
+
"aria-hidden": "true"
|
|
50
|
+
})
|
|
51
|
+
], 40, k),
|
|
52
|
+
t[2] || (s(-1, !0), (t[2] = i("div", {
|
|
53
|
+
class: "rte-sep",
|
|
54
|
+
"aria-hidden": "true"
|
|
55
|
+
})).cacheIndex = 2, s(1), t[2]),
|
|
56
|
+
i("button", {
|
|
57
|
+
type: "button",
|
|
58
|
+
class: r(["rte-btn rte-btn--text", { "rte-btn--active": e.activeBlock === "h1" }]),
|
|
59
|
+
title: "Heading 1",
|
|
60
|
+
"aria-label": "Heading 1",
|
|
61
|
+
"aria-pressed": e.activeBlock === "h1",
|
|
62
|
+
disabled: e.disabled || e.readonly,
|
|
63
|
+
onMousedown: t[3] || (t[3] = a((d) => n("setBlock", "h1"), ["prevent"]))
|
|
64
|
+
}, "H1", 42, B),
|
|
65
|
+
i("button", {
|
|
66
|
+
type: "button",
|
|
67
|
+
class: r(["rte-btn rte-btn--text", { "rte-btn--active": e.activeBlock === "h2" }]),
|
|
68
|
+
title: "Heading 2",
|
|
69
|
+
"aria-label": "Heading 2",
|
|
70
|
+
"aria-pressed": e.activeBlock === "h2",
|
|
71
|
+
disabled: e.disabled || e.readonly,
|
|
72
|
+
onMousedown: t[4] || (t[4] = a((d) => n("setBlock", "h2"), ["prevent"]))
|
|
73
|
+
}, "H2", 42, f),
|
|
74
|
+
i("button", {
|
|
75
|
+
type: "button",
|
|
76
|
+
class: r(["rte-btn rte-btn--text", { "rte-btn--active": e.activeBlock === "p" || e.activeBlock === "div" }]),
|
|
77
|
+
title: "Paragraph",
|
|
78
|
+
"aria-label": "Paragraph",
|
|
79
|
+
"aria-pressed": e.activeBlock === "p" || e.activeBlock === "div",
|
|
80
|
+
disabled: e.disabled || e.readonly,
|
|
81
|
+
onMousedown: t[5] || (t[5] = a((d) => n("setBlock", "p"), ["prevent"]))
|
|
82
|
+
}, "P", 42, h),
|
|
83
|
+
t[6] || (s(-1, !0), (t[6] = i("div", {
|
|
84
|
+
class: "rte-sep",
|
|
85
|
+
"aria-hidden": "true"
|
|
86
|
+
})).cacheIndex = 6, s(1), t[6]),
|
|
87
|
+
i("button", {
|
|
88
|
+
type: "button",
|
|
89
|
+
class: r(["rte-btn", { "rte-btn--active": e.toolbarState.bold }]),
|
|
90
|
+
title: "Bold (Ctrl+B)",
|
|
91
|
+
"aria-label": "Bold",
|
|
92
|
+
"aria-pressed": e.toolbarState.bold,
|
|
93
|
+
disabled: e.disabled || e.readonly,
|
|
94
|
+
onMousedown: t[7] || (t[7] = a((d) => n("command", "bold"), ["prevent"]))
|
|
95
|
+
}, [
|
|
96
|
+
o(l, {
|
|
97
|
+
icon: "lucide:bold",
|
|
98
|
+
class: "rte-icon",
|
|
99
|
+
"aria-hidden": "true"
|
|
100
|
+
})
|
|
101
|
+
], 42, w),
|
|
102
|
+
i("button", {
|
|
103
|
+
type: "button",
|
|
104
|
+
class: r(["rte-btn", { "rte-btn--active": e.toolbarState.italic }]),
|
|
105
|
+
title: "Italic (Ctrl+I)",
|
|
106
|
+
"aria-label": "Italic",
|
|
107
|
+
"aria-pressed": e.toolbarState.italic,
|
|
108
|
+
disabled: e.disabled || e.readonly,
|
|
109
|
+
onMousedown: t[8] || (t[8] = a((d) => n("command", "italic"), ["prevent"]))
|
|
110
|
+
}, [
|
|
111
|
+
o(l, {
|
|
112
|
+
icon: "lucide:italic",
|
|
113
|
+
class: "rte-icon",
|
|
114
|
+
"aria-hidden": "true"
|
|
115
|
+
})
|
|
116
|
+
], 42, M),
|
|
117
|
+
i("button", {
|
|
118
|
+
type: "button",
|
|
119
|
+
class: r(["rte-btn", { "rte-btn--active": e.toolbarState.underline }]),
|
|
120
|
+
title: "Underline (Ctrl+U)",
|
|
121
|
+
"aria-label": "Underline",
|
|
122
|
+
"aria-pressed": e.toolbarState.underline,
|
|
123
|
+
disabled: e.disabled || e.readonly,
|
|
124
|
+
onMousedown: t[9] || (t[9] = a((d) => n("command", "underline"), ["prevent"]))
|
|
125
|
+
}, [
|
|
126
|
+
o(l, {
|
|
127
|
+
icon: "lucide:underline",
|
|
128
|
+
class: "rte-icon",
|
|
129
|
+
"aria-hidden": "true"
|
|
130
|
+
})
|
|
131
|
+
], 42, $),
|
|
132
|
+
i("button", {
|
|
133
|
+
type: "button",
|
|
134
|
+
class: r(["rte-btn", { "rte-btn--active": e.toolbarState.strikeThrough }]),
|
|
135
|
+
title: "Strikethrough",
|
|
136
|
+
"aria-label": "Strikethrough",
|
|
137
|
+
"aria-pressed": e.toolbarState.strikeThrough,
|
|
138
|
+
disabled: e.disabled || e.readonly,
|
|
139
|
+
onMousedown: t[10] || (t[10] = a((d) => n("command", "strikeThrough"), ["prevent"]))
|
|
140
|
+
}, [
|
|
141
|
+
o(l, {
|
|
142
|
+
icon: "lucide:strikethrough",
|
|
143
|
+
class: "rte-icon",
|
|
144
|
+
"aria-hidden": "true"
|
|
145
|
+
})
|
|
146
|
+
], 42, I),
|
|
147
|
+
i("button", {
|
|
148
|
+
type: "button",
|
|
149
|
+
class: "rte-btn",
|
|
150
|
+
title: "Inline Code",
|
|
151
|
+
"aria-label": "Inline Code",
|
|
152
|
+
disabled: e.disabled || e.readonly,
|
|
153
|
+
onMousedown: t[11] || (t[11] = a((d) => n("insertCode"), ["prevent"]))
|
|
154
|
+
}, [
|
|
155
|
+
o(l, {
|
|
156
|
+
icon: "lucide:code",
|
|
157
|
+
class: "rte-icon",
|
|
158
|
+
"aria-hidden": "true"
|
|
159
|
+
})
|
|
160
|
+
], 40, S),
|
|
161
|
+
t[12] || (s(-1, !0), (t[12] = i("div", {
|
|
162
|
+
class: "rte-sep",
|
|
163
|
+
"aria-hidden": "true"
|
|
164
|
+
})).cacheIndex = 12, s(1), t[12]),
|
|
165
|
+
i("button", {
|
|
166
|
+
type: "button",
|
|
167
|
+
class: r(["rte-btn", { "rte-btn--active": e.toolbarState.insertUnorderedList }]),
|
|
168
|
+
title: "Bullet List",
|
|
169
|
+
"aria-label": "Bullet list",
|
|
170
|
+
"aria-pressed": e.toolbarState.insertUnorderedList,
|
|
171
|
+
disabled: e.disabled || e.readonly,
|
|
172
|
+
onMousedown: t[13] || (t[13] = a((d) => n("command", "insertUnorderedList"), ["prevent"]))
|
|
173
|
+
}, [
|
|
174
|
+
o(l, {
|
|
175
|
+
icon: "lucide:list",
|
|
176
|
+
class: "rte-icon",
|
|
177
|
+
"aria-hidden": "true"
|
|
178
|
+
})
|
|
179
|
+
], 42, C),
|
|
180
|
+
i("button", {
|
|
181
|
+
type: "button",
|
|
182
|
+
class: r(["rte-btn", { "rte-btn--active": e.toolbarState.insertOrderedList }]),
|
|
183
|
+
title: "Numbered List",
|
|
184
|
+
"aria-label": "Numbered list",
|
|
185
|
+
"aria-pressed": e.toolbarState.insertOrderedList,
|
|
186
|
+
disabled: e.disabled || e.readonly,
|
|
187
|
+
onMousedown: t[14] || (t[14] = a((d) => n("command", "insertOrderedList"), ["prevent"]))
|
|
188
|
+
}, [
|
|
189
|
+
o(l, {
|
|
190
|
+
icon: "lucide:list-ordered",
|
|
191
|
+
class: "rte-icon",
|
|
192
|
+
"aria-hidden": "true"
|
|
193
|
+
})
|
|
194
|
+
], 42, L),
|
|
195
|
+
i("button", {
|
|
196
|
+
type: "button",
|
|
197
|
+
class: r(["rte-btn", { "rte-btn--active": e.activeBlock === "blockquote" }]),
|
|
198
|
+
title: "Blockquote",
|
|
199
|
+
"aria-label": "Blockquote",
|
|
200
|
+
"aria-pressed": e.activeBlock === "blockquote",
|
|
201
|
+
disabled: e.disabled || e.readonly,
|
|
202
|
+
onMousedown: t[15] || (t[15] = a((d) => n("setBlock", "blockquote"), ["prevent"]))
|
|
203
|
+
}, [
|
|
204
|
+
o(l, {
|
|
205
|
+
icon: "lucide:quote",
|
|
206
|
+
class: "rte-icon",
|
|
207
|
+
"aria-hidden": "true"
|
|
208
|
+
})
|
|
209
|
+
], 42, U),
|
|
210
|
+
i("button", {
|
|
211
|
+
type: "button",
|
|
212
|
+
class: "rte-btn",
|
|
213
|
+
title: "Horizontal Rule",
|
|
214
|
+
"aria-label": "Insert horizontal rule",
|
|
215
|
+
disabled: e.disabled || e.readonly,
|
|
216
|
+
onMousedown: t[16] || (t[16] = a((d) => n("command", "insertHorizontalRule"), ["prevent"]))
|
|
217
|
+
}, [
|
|
218
|
+
o(l, {
|
|
219
|
+
icon: "lucide:minus",
|
|
220
|
+
class: "rte-icon",
|
|
221
|
+
"aria-hidden": "true"
|
|
222
|
+
})
|
|
223
|
+
], 40, x),
|
|
224
|
+
i("button", {
|
|
225
|
+
type: "button",
|
|
226
|
+
class: "rte-btn",
|
|
227
|
+
title: "Insert Image",
|
|
228
|
+
"aria-label": "Insert image",
|
|
229
|
+
disabled: e.disabled || e.readonly || e.isUploadingImage,
|
|
230
|
+
onMousedown: t[17] || (t[17] = a((d) => n("triggerImageUpload"), ["prevent"]))
|
|
231
|
+
}, [
|
|
232
|
+
e.isUploadingImage ? (b(), u(l, {
|
|
233
|
+
key: 0,
|
|
234
|
+
icon: "lucide:loader-2",
|
|
235
|
+
class: "rte-icon animate-spin",
|
|
236
|
+
"aria-hidden": "true"
|
|
237
|
+
})) : (b(), u(l, {
|
|
238
|
+
key: 1,
|
|
239
|
+
icon: "lucide:image",
|
|
240
|
+
class: "rte-icon",
|
|
241
|
+
"aria-hidden": "true"
|
|
242
|
+
}))
|
|
243
|
+
], 40, R),
|
|
244
|
+
t[18] || (s(-1, !0), (t[18] = i("div", {
|
|
245
|
+
class: "rte-sep",
|
|
246
|
+
"aria-hidden": "true"
|
|
247
|
+
})).cacheIndex = 18, s(1), t[18]),
|
|
248
|
+
i("button", {
|
|
249
|
+
type: "button",
|
|
250
|
+
class: r(["rte-btn", { "rte-btn--active": e.toolbarState.justifyLeft }]),
|
|
251
|
+
title: "Align Left",
|
|
252
|
+
"aria-label": "Align left",
|
|
253
|
+
"aria-pressed": e.toolbarState.justifyLeft,
|
|
254
|
+
disabled: e.disabled || e.readonly,
|
|
255
|
+
onMousedown: t[19] || (t[19] = a((d) => n("command", "justifyLeft"), ["prevent"]))
|
|
256
|
+
}, [
|
|
257
|
+
o(l, {
|
|
258
|
+
icon: "lucide:align-left",
|
|
259
|
+
class: "rte-icon",
|
|
260
|
+
"aria-hidden": "true"
|
|
261
|
+
})
|
|
262
|
+
], 42, j),
|
|
263
|
+
i("button", {
|
|
264
|
+
type: "button",
|
|
265
|
+
class: r(["rte-btn", { "rte-btn--active": e.toolbarState.justifyCenter }]),
|
|
266
|
+
title: "Align Center",
|
|
267
|
+
"aria-label": "Align center",
|
|
268
|
+
"aria-pressed": e.toolbarState.justifyCenter,
|
|
269
|
+
disabled: e.disabled || e.readonly,
|
|
270
|
+
onMousedown: t[20] || (t[20] = a((d) => n("command", "justifyCenter"), ["prevent"]))
|
|
271
|
+
}, [
|
|
272
|
+
o(l, {
|
|
273
|
+
icon: "lucide:align-center",
|
|
274
|
+
class: "rte-icon",
|
|
275
|
+
"aria-hidden": "true"
|
|
276
|
+
})
|
|
277
|
+
], 42, H),
|
|
278
|
+
i("button", {
|
|
279
|
+
type: "button",
|
|
280
|
+
class: r(["rte-btn", { "rte-btn--active": e.toolbarState.justifyRight }]),
|
|
281
|
+
title: "Align Right",
|
|
282
|
+
"aria-label": "Align right",
|
|
283
|
+
"aria-pressed": e.toolbarState.justifyRight,
|
|
284
|
+
disabled: e.disabled || e.readonly,
|
|
285
|
+
onMousedown: t[21] || (t[21] = a((d) => n("command", "justifyRight"), ["prevent"]))
|
|
286
|
+
}, [
|
|
287
|
+
o(l, {
|
|
288
|
+
icon: "lucide:align-right",
|
|
289
|
+
class: "rte-icon",
|
|
290
|
+
"aria-hidden": "true"
|
|
291
|
+
})
|
|
292
|
+
], 42, q),
|
|
293
|
+
t[22] || (s(-1, !0), (t[22] = i("div", {
|
|
294
|
+
class: "rte-sep",
|
|
295
|
+
"aria-hidden": "true"
|
|
296
|
+
})).cacheIndex = 22, s(1), t[22]),
|
|
297
|
+
i("button", {
|
|
298
|
+
type: "button",
|
|
299
|
+
class: "rte-btn",
|
|
300
|
+
title: "Insert / Edit Link (Ctrl+K)",
|
|
301
|
+
"aria-label": "Insert or edit link",
|
|
302
|
+
disabled: e.disabled || e.readonly,
|
|
303
|
+
onMousedown: t[23] || (t[23] = a((d) => n("openLinkPopover"), ["prevent"]))
|
|
304
|
+
}, [
|
|
305
|
+
o(l, {
|
|
306
|
+
icon: "lucide:link",
|
|
307
|
+
class: "rte-icon",
|
|
308
|
+
"aria-hidden": "true"
|
|
309
|
+
})
|
|
310
|
+
], 40, A),
|
|
311
|
+
i("button", {
|
|
312
|
+
type: "button",
|
|
313
|
+
class: "rte-btn",
|
|
314
|
+
title: "Clear Formatting",
|
|
315
|
+
"aria-label": "Clear formatting",
|
|
316
|
+
disabled: e.disabled || e.readonly,
|
|
317
|
+
onMousedown: t[24] || (t[24] = a((d) => n("clearFormat"), ["prevent"]))
|
|
318
|
+
}, [
|
|
319
|
+
o(l, {
|
|
320
|
+
icon: "lucide:remove-formatting",
|
|
321
|
+
class: "rte-icon",
|
|
322
|
+
"aria-hidden": "true"
|
|
323
|
+
})
|
|
324
|
+
], 40, T)
|
|
325
|
+
], 40, y));
|
|
326
|
+
}
|
|
327
|
+
});
|
|
328
|
+
export {
|
|
329
|
+
E as default
|
|
330
|
+
};
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { ref as g, computed as I } from "vue";
|
|
2
|
+
import { useFileUpload as U } from "../../Form/composables/useFileUpload.js";
|
|
3
|
+
function w(a, r) {
|
|
4
|
+
const c = g(0), m = I(() => c.value > 0), s = g(null), { handleUploadFile: f } = U();
|
|
5
|
+
function p(n) {
|
|
6
|
+
n || (r.saveSelection(), s.value?.click());
|
|
7
|
+
}
|
|
8
|
+
async function l(n) {
|
|
9
|
+
if (!n) return;
|
|
10
|
+
const e = URL.createObjectURL(n);
|
|
11
|
+
r.restoreSelection(), a.value?.focus(), document.execCommand("insertImage", !1, e);
|
|
12
|
+
const i = a.value?.querySelector(`img[src="${e}"]`);
|
|
13
|
+
i && i.classList.add("rte-image-uploading"), r.onInput(), c.value++;
|
|
14
|
+
try {
|
|
15
|
+
const o = await f(n);
|
|
16
|
+
if (o) {
|
|
17
|
+
const t = a.value?.querySelector(`img[src="${e}"]`);
|
|
18
|
+
t && (t.src = o, t.classList.remove("rte-image-uploading"), t.loading = "lazy");
|
|
19
|
+
} else {
|
|
20
|
+
const t = a.value?.querySelector(`img[src="${e}"]`);
|
|
21
|
+
t && t.remove();
|
|
22
|
+
}
|
|
23
|
+
} catch (o) {
|
|
24
|
+
console.error("[RichTextEditor] Image upload error:", o);
|
|
25
|
+
const t = a.value?.querySelector(`img[src="${e}"]`);
|
|
26
|
+
t && t.remove();
|
|
27
|
+
} finally {
|
|
28
|
+
c.value--, URL.revokeObjectURL(e), r.onInput();
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
async function d(n) {
|
|
32
|
+
const e = n.target, i = e.files?.[0];
|
|
33
|
+
i && await l(i), e.value = "";
|
|
34
|
+
}
|
|
35
|
+
async function v(n) {
|
|
36
|
+
const e = n.clipboardData?.items;
|
|
37
|
+
if (e)
|
|
38
|
+
for (let i = 0; i < e.length; i++) {
|
|
39
|
+
const o = e[i];
|
|
40
|
+
if (o.type.startsWith("image/")) {
|
|
41
|
+
n.preventDefault();
|
|
42
|
+
const t = o.getAsFile();
|
|
43
|
+
t && (r.saveSelection(), await l(t));
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
async function y(n) {
|
|
49
|
+
const e = n.dataTransfer?.files;
|
|
50
|
+
if (!(!e || e.length === 0))
|
|
51
|
+
for (let i = 0; i < e.length; i++) {
|
|
52
|
+
const o = e[i];
|
|
53
|
+
if (o.type.startsWith("image/")) {
|
|
54
|
+
if (n.preventDefault(), document.caretRangeFromPoint) {
|
|
55
|
+
const t = document.caretRangeFromPoint(n.clientX, n.clientY);
|
|
56
|
+
if (t) {
|
|
57
|
+
const u = window.getSelection();
|
|
58
|
+
u?.removeAllRanges(), u?.addRange(t);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
r.saveSelection(), await l(o);
|
|
62
|
+
return;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
return {
|
|
67
|
+
imageInputRef: s,
|
|
68
|
+
isUploadingImage: m,
|
|
69
|
+
triggerImageUpload: p,
|
|
70
|
+
onImageFileChange: d,
|
|
71
|
+
onPaste: v,
|
|
72
|
+
onDrop: y
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
export {
|
|
76
|
+
w as useRichTextImageUpload
|
|
77
|
+
};
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
import { shallowRef as A, nextTick as N } from "vue";
|
|
2
|
+
function T(l) {
|
|
3
|
+
const o = A({
|
|
4
|
+
visible: !1,
|
|
5
|
+
x: 0,
|
|
6
|
+
y: 0,
|
|
7
|
+
url: "",
|
|
8
|
+
isEditing: !1
|
|
9
|
+
});
|
|
10
|
+
let a = null, d = !1;
|
|
11
|
+
function u(t) {
|
|
12
|
+
const e = window.getSelection();
|
|
13
|
+
if (!e || e.rangeCount === 0) return null;
|
|
14
|
+
const n = e.anchorNode, i = (n instanceof Element ? n : n?.parentElement)?.closest("a");
|
|
15
|
+
return i && l.editorRef.value?.contains(i) ? i : null;
|
|
16
|
+
}
|
|
17
|
+
function m() {
|
|
18
|
+
if (d || !l.editorRef.value?.contains(document.activeElement)) return;
|
|
19
|
+
const t = u();
|
|
20
|
+
if (t) {
|
|
21
|
+
const e = t.href || t.getAttribute("href") || "", n = t.getBoundingClientRect();
|
|
22
|
+
h(e, !0, n);
|
|
23
|
+
} else o.value.visible && o.value.isEditing && c();
|
|
24
|
+
}
|
|
25
|
+
function w(t) {
|
|
26
|
+
const e = l.rootRef.value, n = l.linkPopoverElRef.value?.$el ?? l.linkPopoverElRef.value;
|
|
27
|
+
if (!e || !n) return;
|
|
28
|
+
const r = e.getBoundingClientRect(), i = n.getBoundingClientRect(), p = 8, f = r.width - i.width - 8;
|
|
29
|
+
let g = t.left - r.left + t.width / 2 - i.width / 2;
|
|
30
|
+
g = Math.max(p, Math.min(g, f));
|
|
31
|
+
const R = 8;
|
|
32
|
+
let v = t.bottom - r.top + R;
|
|
33
|
+
r.top + v + i.height > window.innerHeight && (v = t.top - r.top - i.height - R), o.value = { ...o.value, x: g, y: v };
|
|
34
|
+
}
|
|
35
|
+
function h(t, e, n) {
|
|
36
|
+
o.value = {
|
|
37
|
+
visible: !0,
|
|
38
|
+
x: o.value.x,
|
|
39
|
+
y: o.value.y,
|
|
40
|
+
url: t,
|
|
41
|
+
isEditing: e
|
|
42
|
+
}, N(() => w(n));
|
|
43
|
+
}
|
|
44
|
+
function b() {
|
|
45
|
+
if (o.value.visible) return;
|
|
46
|
+
const t = u(), e = window.getSelection();
|
|
47
|
+
if ((!e || e.rangeCount === 0 || e.isCollapsed) && !t)
|
|
48
|
+
return;
|
|
49
|
+
a = e ? e.getRangeAt(0).cloneRange() : null;
|
|
50
|
+
let n;
|
|
51
|
+
t ? n = t.getBoundingClientRect() : n = a.getBoundingClientRect();
|
|
52
|
+
const r = t && (t.href || t.getAttribute("href")) || "";
|
|
53
|
+
h(r, !!t, n);
|
|
54
|
+
}
|
|
55
|
+
function C(t) {
|
|
56
|
+
let e = (t ?? o.value.url).trim();
|
|
57
|
+
if (!e) {
|
|
58
|
+
k();
|
|
59
|
+
return;
|
|
60
|
+
}
|
|
61
|
+
!/^https?:\/\//i.test(e) && !/^(mailto:|tel:|#|\/)/i.test(e) && (e = `https://${e}`);
|
|
62
|
+
const n = u();
|
|
63
|
+
if (n)
|
|
64
|
+
n.href = e, !e.startsWith("#") && !e.startsWith("/") && (n.target = "_blank", n.rel = "noopener noreferrer"), l.callbacks.onInput();
|
|
65
|
+
else if (a) {
|
|
66
|
+
const i = window.getSelection();
|
|
67
|
+
i?.removeAllRanges(), i?.addRange(a), l.editorRef.value?.focus(), document.execCommand("createLink", !1, e);
|
|
68
|
+
const p = document.createTreeWalker(
|
|
69
|
+
l.editorRef.value,
|
|
70
|
+
NodeFilter.SHOW_ELEMENT,
|
|
71
|
+
{ acceptNode: (s) => s.tagName === "A" ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_SKIP }
|
|
72
|
+
);
|
|
73
|
+
let f;
|
|
74
|
+
for (; f = p.nextNode(); ) {
|
|
75
|
+
const s = f;
|
|
76
|
+
(s.href === e || s.getAttribute("href") === e) && (s.target = "_blank", s.rel = "noopener noreferrer");
|
|
77
|
+
}
|
|
78
|
+
l.callbacks.onInput();
|
|
79
|
+
}
|
|
80
|
+
window.getSelection()?.collapseToEnd(), d = !0, c(), setTimeout(() => {
|
|
81
|
+
d = !1;
|
|
82
|
+
}, 200);
|
|
83
|
+
}
|
|
84
|
+
function k() {
|
|
85
|
+
const t = u();
|
|
86
|
+
if (t) {
|
|
87
|
+
const e = document.createRange();
|
|
88
|
+
e.selectNodeContents(t);
|
|
89
|
+
const n = window.getSelection();
|
|
90
|
+
n?.removeAllRanges(), n?.addRange(e);
|
|
91
|
+
} else
|
|
92
|
+
l.callbacks.restoreSelection();
|
|
93
|
+
l.editorRef.value?.focus(), document.execCommand("unlink", !1, void 0), l.callbacks.onInput(), c();
|
|
94
|
+
}
|
|
95
|
+
function E(t) {
|
|
96
|
+
const e = (t ?? o.value.url).trim();
|
|
97
|
+
if (!e) return;
|
|
98
|
+
const n = e.includes("://") ? e : `https://${e}`;
|
|
99
|
+
window.open(n, "_blank", "noopener,noreferrer");
|
|
100
|
+
}
|
|
101
|
+
function c() {
|
|
102
|
+
o.value.visible && (o.value = { ...o.value, visible: !1 }, a = null);
|
|
103
|
+
}
|
|
104
|
+
function L(t) {
|
|
105
|
+
o.value.url = t;
|
|
106
|
+
}
|
|
107
|
+
return {
|
|
108
|
+
linkPopover: o,
|
|
109
|
+
checkLinkAtCursor: m,
|
|
110
|
+
openLinkPopover: b,
|
|
111
|
+
applyLink: C,
|
|
112
|
+
unlinkCurrent: k,
|
|
113
|
+
openLinkInTab: E,
|
|
114
|
+
closeLinkPopover: c,
|
|
115
|
+
updateUrl: L
|
|
116
|
+
};
|
|
117
|
+
}
|
|
118
|
+
export {
|
|
119
|
+
T as useRichTextLinks
|
|
120
|
+
};
|
package/core/config.d.ts
CHANGED
|
@@ -100,7 +100,7 @@ export declare const configState: {
|
|
|
100
100
|
};
|
|
101
101
|
};
|
|
102
102
|
footer?: {
|
|
103
|
-
variant?: import('
|
|
103
|
+
variant?: import('..').FooterVariant;
|
|
104
104
|
labels?: {
|
|
105
105
|
followUs?: string;
|
|
106
106
|
subscribe?: string;
|
|
@@ -210,7 +210,7 @@ export declare function useVLiteConfig(): {
|
|
|
210
210
|
};
|
|
211
211
|
};
|
|
212
212
|
footer?: {
|
|
213
|
-
variant?: import('
|
|
213
|
+
variant?: import('..').FooterVariant;
|
|
214
214
|
labels?: {
|
|
215
215
|
followUs?: string;
|
|
216
216
|
subscribe?: string;
|
package/index.d.ts
CHANGED
|
@@ -17,6 +17,7 @@ export * from './components/Carousel';
|
|
|
17
17
|
export * from './components/Dropdown';
|
|
18
18
|
export * from './components/Breadcrumb';
|
|
19
19
|
export * from './components/FileTree';
|
|
20
|
+
export * from './components/RichTextEditor';
|
|
20
21
|
export * from './components/OTPInput';
|
|
21
22
|
export * from './components/Workbook';
|
|
22
23
|
export * from './components/DataList';
|
|
@@ -27,6 +28,7 @@ export * from './components/Accordion';
|
|
|
27
28
|
export * from './components/ChoiceBox';
|
|
28
29
|
export * from './components/DataTable';
|
|
29
30
|
export * from './components/Splitter';
|
|
31
|
+
export * from './components/Footer';
|
|
30
32
|
export * from './composables/useTheme';
|
|
31
33
|
export * from './components/FilePicker';
|
|
32
34
|
export * from './components/Pagination';
|
|
@@ -52,6 +54,7 @@ export * from './components/ThumbnailSelector';
|
|
|
52
54
|
export * from './components/TagInput';
|
|
53
55
|
export * from './components/Calendar';
|
|
54
56
|
export * from './components/Skeleton';
|
|
57
|
+
export * from './components/Chart';
|
|
55
58
|
export { default as Icon } from './components/Icon.vue';
|
|
56
59
|
export { default as Logo } from './components/Logo.vue';
|
|
57
60
|
export { default as Alert } from './components/Alert.vue';
|