vlite3 1.3.10 → 1.4.1
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/Accordion/Accordion.vue.d.ts +2 -2
- package/components/Accordion/AccordionItem.vue.d.ts +1 -1
- package/components/Accordion/AccordionItem.vue.js +11 -7
- package/components/Accordion/AccordionTrigger.vue.d.ts +1 -1
- package/components/AsyncSelect/createAsyncSelect.d.ts +44 -3
- package/components/AsyncSelect/createAsyncSelect.js +107 -76
- package/components/CategoryManager/CategoryManager.vue2.js +35 -31
- package/components/Dropdown/DropdownBooleanItem.vue.js +6 -6
- package/components/Dropdown/DropdownItem.vue.js +17 -17
- package/components/Dropdown/DropdownMenu.vue.js +2 -2
- package/components/Dropdown/{DropdownMenu.vue3.js → DropdownMenu.vue2.js} +23 -23
- package/components/Form/Form.vue.d.ts +17 -5
- package/components/Form/Form.vue.js +1 -1
- package/components/Form/Form.vue2.js +347 -285
- package/components/Form/FormField.vue.js +108 -82
- package/components/Form/FormFields.vue.js +2 -2
- package/components/Form/FormFields.vue2.js +7 -6
- package/components/Form/composables/useForm.js +100 -95
- package/components/Form/types.d.ts +33 -5
- package/components/NavbarCommandPalette.vue.d.ts +1 -1
- package/components/NumberInput.vue.js +1 -1
- package/components/NumberInput.vue2.js +47 -45
- package/components/RichTextEditor/RichTextEditor.vue.js +43 -48
- package/components/RichTextEditor/RichTextLinkPopover.vue3.js +2 -2
- package/components/RichTextEditor/RichTextToolbar.vue.d.ts +12 -3
- package/components/RichTextEditor/{RichTextToolbar.vue.js → RichTextToolbar.vue2.js} +157 -121
- package/components/RichTextEditor/RichTextToolbar.vue3.js +2 -2
- package/components/RichTextEditor/index.d.ts +2 -0
- package/components/RichTextEditor/types.d.ts +38 -0
- package/components/RichTextEditor/types.js +52 -0
- package/components/Screen/ScreenFilter.vue.js +15 -11
- package/components/SidebarMenu/SidebarMenu.vue.d.ts +2 -2
- package/components/Tabes/Tabes.vue.js +2 -2
- package/components/Tabes/Tabes.vue2.js +73 -71
- package/components/Workbook/Sheet.vue.d.ts +1 -1
- package/index.js +298 -295
- package/package.json +1 -1
- package/style.css +37 -1
- /package/components/RichTextEditor/{RichTextLinkPopover.vue.js → RichTextLinkPopover.vue2.js} +0 -0
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { defineComponent as
|
|
1
|
+
import { defineComponent as W, ref as k, watch as q, computed as r, onBeforeUnmount as L, openBlock as f, createElementBlock as y, normalizeClass as i, withModifiers as u, createVNode as h, createCommentVNode as P, createElementVNode as g, withKeys as z } from "vue";
|
|
2
2
|
import w from "./Icon.vue.js";
|
|
3
|
-
const
|
|
3
|
+
const M = ["disabled", "data-testid"], U = ["value", "placeholder", "disabled", "readonly", "onKeydown", "data-testid"], p = ["disabled", "data-testid"], A = {
|
|
4
4
|
key: 2,
|
|
5
5
|
class: "flex flex-col justify-center h-full py-[3px] pr-[3px]"
|
|
6
|
-
},
|
|
6
|
+
}, D = { class: "flex flex-col h-full w-6 scale-80" }, G = ["disabled", "data-testid"], H = ["disabled", "data-testid"], Q = /* @__PURE__ */ W({
|
|
7
7
|
__name: "NumberInput",
|
|
8
8
|
props: {
|
|
9
9
|
modelValue: { default: void 0 },
|
|
@@ -23,13 +23,13 @@ const L = ["disabled", "data-testid"], M = ["value", "placeholder", "disabled",
|
|
|
23
23
|
emits: ["update:modelValue", "change", "focus", "blur"],
|
|
24
24
|
setup(e, { emit: V }) {
|
|
25
25
|
const n = e, m = V, a = k(n.modelValue ?? "");
|
|
26
|
-
|
|
26
|
+
q(
|
|
27
27
|
() => n.modelValue,
|
|
28
28
|
(d) => {
|
|
29
29
|
d !== void 0 && (a.value = d);
|
|
30
30
|
}
|
|
31
31
|
);
|
|
32
|
-
const B = k(null), c =
|
|
32
|
+
const B = k(null), c = r(() => {
|
|
33
33
|
const d = {
|
|
34
34
|
xs: { h: "h-7", text: "text-xs", px: "px-2", icon: "w-3 h-3" },
|
|
35
35
|
sm: { h: "h-8", text: "text-xs", px: "px-2", icon: "w-3.5 h-3.5" },
|
|
@@ -38,7 +38,7 @@ const L = ["disabled", "data-testid"], M = ["value", "placeholder", "disabled",
|
|
|
38
38
|
xl: { h: "h-12", text: "text-lg", px: "px-5", icon: "w-6 h-6" }
|
|
39
39
|
};
|
|
40
40
|
return d[n.size] || d.md;
|
|
41
|
-
}), I =
|
|
41
|
+
}), I = r(() => ({
|
|
42
42
|
none: "rounded-none",
|
|
43
43
|
sm: "rounded-sm",
|
|
44
44
|
md: "rounded-md",
|
|
@@ -46,7 +46,7 @@ const L = ["disabled", "data-testid"], M = ["value", "placeholder", "disabled",
|
|
|
46
46
|
xl: "rounded-xl",
|
|
47
47
|
"2xl": "rounded-2xl",
|
|
48
48
|
full: "rounded-full"
|
|
49
|
-
})[n.rounded] || "rounded-md"), j =
|
|
49
|
+
})[n.rounded] || "rounded-md"), j = r(() => ({
|
|
50
50
|
none: "rounded-l-none",
|
|
51
51
|
sm: "rounded-l-sm",
|
|
52
52
|
md: "rounded-l-md",
|
|
@@ -54,7 +54,7 @@ const L = ["disabled", "data-testid"], M = ["value", "placeholder", "disabled",
|
|
|
54
54
|
xl: "rounded-l-xl",
|
|
55
55
|
"2xl": "rounded-l-2xl",
|
|
56
56
|
full: "rounded-l-full"
|
|
57
|
-
})[n.rounded] || "rounded-l-md"), S =
|
|
57
|
+
})[n.rounded] || "rounded-l-md"), S = r(() => ({
|
|
58
58
|
none: "rounded-r-none",
|
|
59
59
|
sm: "rounded-r-sm",
|
|
60
60
|
md: "rounded-r-md",
|
|
@@ -62,7 +62,7 @@ const L = ["disabled", "data-testid"], M = ["value", "placeholder", "disabled",
|
|
|
62
62
|
xl: "rounded-r-xl",
|
|
63
63
|
"2xl": "rounded-r-2xl",
|
|
64
64
|
full: "rounded-r-full"
|
|
65
|
-
})[n.rounded] || "rounded-r-md"),
|
|
65
|
+
})[n.rounded] || "rounded-r-md"), E = r(() => [
|
|
66
66
|
"flex items-center w-full relative transition-all duration-200",
|
|
67
67
|
n.disabled ? "opacity-50 cursor-not-allowed" : "",
|
|
68
68
|
n.mode === "solid" ? "bg-muted" : "",
|
|
@@ -70,13 +70,13 @@ const L = ["disabled", "data-testid"], M = ["value", "placeholder", "disabled",
|
|
|
70
70
|
n.mode === "ghost" ? "bg-transparent" : "",
|
|
71
71
|
c.value.h,
|
|
72
72
|
I.value
|
|
73
|
-
]),
|
|
73
|
+
]), F = r(() => [
|
|
74
74
|
"flex-1 w-full bg-transparent focus:outline-none appearance-none",
|
|
75
75
|
n.variant === "split" ? "text-center" : "text-left pl-3 pr-2",
|
|
76
76
|
"placeholder:text-muted-foreground/50",
|
|
77
77
|
c.value.text,
|
|
78
78
|
n.disabled ? "cursor-not-allowed" : ""
|
|
79
|
-
]), C =
|
|
79
|
+
]), C = r(() => {
|
|
80
80
|
const d = "flex items-center justify-center transition-colors active:scale-95 shrink-0 select-none", t = n.disabled ? "" : "hover:text-primary hover:bg-muted/50";
|
|
81
81
|
return n.size === "xs" || n.size, n.variant === "split" ? n.mode === "solid" ? [
|
|
82
82
|
d,
|
|
@@ -111,22 +111,25 @@ const L = ["disabled", "data-testid"], M = ["value", "placeholder", "disabled",
|
|
|
111
111
|
d === "inc" ? $() : N();
|
|
112
112
|
}, 50);
|
|
113
113
|
}, 400));
|
|
114
|
-
},
|
|
114
|
+
}, K = (d) => {
|
|
115
115
|
const t = d.target, o = parseFloat(t.value);
|
|
116
116
|
if (isNaN(o)) {
|
|
117
117
|
a.value = t.value;
|
|
118
118
|
return;
|
|
119
119
|
}
|
|
120
120
|
s(o);
|
|
121
|
-
},
|
|
121
|
+
}, R = (d) => {
|
|
122
122
|
m("blur", d);
|
|
123
123
|
const t = parseFloat(String(a.value));
|
|
124
124
|
isNaN(t) ? s(n.min || 0) : s(t);
|
|
125
|
+
}, T = (d) => {
|
|
126
|
+
const t = d.target;
|
|
127
|
+
document.activeElement === t && t.blur();
|
|
125
128
|
};
|
|
126
|
-
return
|
|
129
|
+
return L(() => {
|
|
127
130
|
l();
|
|
128
131
|
}), (d, t) => (f(), y("div", {
|
|
129
|
-
class: i([
|
|
132
|
+
class: i([E.value, "overflow-hidden"])
|
|
130
133
|
}, [
|
|
131
134
|
e.variant === "split" && !e.disabled && !e.readonly ? (f(), y("button", {
|
|
132
135
|
key: 0,
|
|
@@ -142,16 +145,16 @@ const L = ["disabled", "data-testid"], M = ["value", "placeholder", "disabled",
|
|
|
142
145
|
onPointerup: l,
|
|
143
146
|
onPointerleave: l,
|
|
144
147
|
onPointercancel: l,
|
|
145
|
-
onContextmenu: t[1] || (t[1] =
|
|
148
|
+
onContextmenu: t[1] || (t[1] = u(() => {
|
|
146
149
|
}, ["prevent"])),
|
|
147
150
|
"data-testid": d.$attrs["data-testid"] ? `${d.$attrs["data-testid"]}-dec` : e.name ? `number-${e.name}-dec` : e.id ? `number-${e.id}-dec` : "number-input-dec"
|
|
148
151
|
}, [
|
|
149
|
-
|
|
152
|
+
h(w, {
|
|
150
153
|
icon: "lucide:minus",
|
|
151
154
|
class: i(c.value.icon)
|
|
152
155
|
}, null, 8, ["class"])
|
|
153
|
-
], 42,
|
|
154
|
-
|
|
156
|
+
], 42, M)) : P("", !0),
|
|
157
|
+
g("input", {
|
|
155
158
|
ref_key: "inputRef",
|
|
156
159
|
ref: B,
|
|
157
160
|
type: "number",
|
|
@@ -159,20 +162,19 @@ const L = ["disabled", "data-testid"], M = ["value", "placeholder", "disabled",
|
|
|
159
162
|
placeholder: e.placeholder,
|
|
160
163
|
disabled: e.disabled,
|
|
161
164
|
readonly: e.readonly,
|
|
162
|
-
class: i(
|
|
163
|
-
onInput:
|
|
165
|
+
class: i(F.value),
|
|
166
|
+
onInput: K,
|
|
164
167
|
onFocus: t[2] || (t[2] = (o) => m("focus", o)),
|
|
165
|
-
onBlur:
|
|
168
|
+
onBlur: R,
|
|
166
169
|
onKeydown: [
|
|
167
|
-
z(
|
|
168
|
-
z(
|
|
170
|
+
z(u($, ["prevent"]), ["up"]),
|
|
171
|
+
z(u(N, ["prevent"]), ["down"])
|
|
169
172
|
],
|
|
170
|
-
onWheel:
|
|
171
|
-
|
|
172
|
-
onInvalid: t[4] || (t[4] = r(() => {
|
|
173
|
+
onWheel: T,
|
|
174
|
+
onInvalid: t[3] || (t[3] = u(() => {
|
|
173
175
|
}, ["prevent"])),
|
|
174
176
|
"data-testid": d.$attrs["data-testid"] || (e.name ? `number-${e.name}` : e.id ? `number-${e.id}` : "number-input")
|
|
175
|
-
}, null, 42,
|
|
177
|
+
}, null, 42, U),
|
|
176
178
|
e.variant === "split" && !e.disabled && !e.readonly ? (f(), y("button", {
|
|
177
179
|
key: 1,
|
|
178
180
|
tabindex: "-1",
|
|
@@ -183,62 +185,62 @@ const L = ["disabled", "data-testid"], M = ["value", "placeholder", "disabled",
|
|
|
183
185
|
e.variant === "split" && e.mode !== "solid" ? S.value : ""
|
|
184
186
|
]),
|
|
185
187
|
disabled: e.disabled || e.max !== void 0 && Number(a.value) >= e.max,
|
|
186
|
-
onPointerdown: t[
|
|
188
|
+
onPointerdown: t[4] || (t[4] = (o) => v("inc", o)),
|
|
187
189
|
onPointerup: l,
|
|
188
190
|
onPointerleave: l,
|
|
189
191
|
onPointercancel: l,
|
|
190
|
-
onContextmenu: t[
|
|
192
|
+
onContextmenu: t[5] || (t[5] = u(() => {
|
|
191
193
|
}, ["prevent"])),
|
|
192
194
|
"data-testid": d.$attrs["data-testid"] ? `${d.$attrs["data-testid"]}-inc` : e.name ? `number-${e.name}-inc` : e.id ? `number-${e.id}-inc` : "number-input-inc"
|
|
193
195
|
}, [
|
|
194
|
-
|
|
196
|
+
h(w, {
|
|
195
197
|
icon: "lucide:plus",
|
|
196
198
|
class: i(c.value.icon)
|
|
197
199
|
}, null, 8, ["class"])
|
|
198
|
-
], 42,
|
|
199
|
-
e.variant === "stacked" && !e.disabled && !e.readonly ? (f(), y("div",
|
|
200
|
-
|
|
201
|
-
|
|
200
|
+
], 42, p)) : P("", !0),
|
|
201
|
+
e.variant === "stacked" && !e.disabled && !e.readonly ? (f(), y("div", A, [
|
|
202
|
+
g("div", D, [
|
|
203
|
+
g("button", {
|
|
202
204
|
tabindex: "-1",
|
|
203
205
|
type: "button",
|
|
204
206
|
class: "flex-1 flex items-center justify-center bg-gray-100 hover:bg-gray-200 text-muted-foreground hover:text-foreground rounded-t-[3px] border-b border-gray-300 transition-colors disabled:cursor-not-allowed",
|
|
205
207
|
disabled: e.disabled || e.max !== void 0 && Number(a.value) >= e.max,
|
|
206
|
-
onPointerdown: t[
|
|
208
|
+
onPointerdown: t[6] || (t[6] = (o) => v("inc", o)),
|
|
207
209
|
onPointerup: l,
|
|
208
210
|
onPointerleave: l,
|
|
209
211
|
onPointercancel: l,
|
|
210
|
-
onContextmenu: t[
|
|
212
|
+
onContextmenu: t[7] || (t[7] = u(() => {
|
|
211
213
|
}, ["prevent"])),
|
|
212
214
|
"data-testid": d.$attrs["data-testid"] ? `${d.$attrs["data-testid"]}-inc` : e.name ? `number-${e.name}-inc` : e.id ? `number-${e.id}-inc` : "number-input-inc"
|
|
213
215
|
}, [
|
|
214
|
-
|
|
216
|
+
h(w, {
|
|
215
217
|
class: i(["text-gray-700/85!", e.size === "xs" || e.size === "sm" ? "w-3 h-3" : "w-3.5 h-3.5"]),
|
|
216
218
|
icon: "mynaui:chevron-up-solid"
|
|
217
219
|
}, null, 8, ["class"])
|
|
218
|
-
], 40,
|
|
219
|
-
|
|
220
|
+
], 40, G),
|
|
221
|
+
g("button", {
|
|
220
222
|
tabindex: "-1",
|
|
221
223
|
type: "button",
|
|
222
224
|
class: "flex-1 flex items-center justify-center bg-gray-100 hover:bg-gray-200 text-muted-foreground hover:text-foreground rounded-b-[3px] transition-colors disabled:cursor-not-allowed",
|
|
223
225
|
disabled: e.disabled || e.min !== void 0 && Number(a.value) <= e.min,
|
|
224
|
-
onPointerdown: t[
|
|
226
|
+
onPointerdown: t[8] || (t[8] = (o) => v("dec", o)),
|
|
225
227
|
onPointerup: l,
|
|
226
228
|
onPointerleave: l,
|
|
227
229
|
onPointercancel: l,
|
|
228
|
-
onContextmenu: t[
|
|
230
|
+
onContextmenu: t[9] || (t[9] = u(() => {
|
|
229
231
|
}, ["prevent"])),
|
|
230
232
|
"data-testid": d.$attrs["data-testid"] ? `${d.$attrs["data-testid"]}-dec` : e.name ? `number-${e.name}-dec` : e.id ? `number-${e.id}-dec` : "number-input-dec"
|
|
231
233
|
}, [
|
|
232
|
-
|
|
234
|
+
h(w, {
|
|
233
235
|
class: i(["text-gray-700/85!", e.size === "xs" || e.size === "sm" ? "w-3 h-3" : "w-3.5 h-3.5"]),
|
|
234
236
|
icon: "mynaui:chevron-down-solid"
|
|
235
237
|
}, null, 8, ["class"])
|
|
236
|
-
], 40,
|
|
238
|
+
], 40, H)
|
|
237
239
|
])
|
|
238
240
|
])) : P("", !0)
|
|
239
241
|
], 2));
|
|
240
242
|
}
|
|
241
243
|
});
|
|
242
244
|
export {
|
|
243
|
-
|
|
245
|
+
Q as default
|
|
244
246
|
};
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { defineComponent as te, ref as v, shallowRef as ne, watch as oe, computed as h, onMounted as le, onUnmounted as ae, openBlock as C, createElementBlock as L, normalizeClass as re, toDisplayString as I, createCommentVNode as U, createElementVNode as w, createVNode as q, unref as a, normalizeStyle as ie } from "vue";
|
|
2
2
|
/* empty css */
|
|
3
|
-
import
|
|
4
|
-
/* empty css
|
|
5
|
-
import
|
|
6
|
-
/* empty css
|
|
3
|
+
import se from "./RichTextToolbar.vue2.js";
|
|
4
|
+
/* empty css */
|
|
5
|
+
import de from "./RichTextLinkPopover.vue2.js";
|
|
6
|
+
/* empty css */
|
|
7
7
|
import { useRichTextImageUpload as ue } from "./composables/useRichTextImageUpload.js";
|
|
8
8
|
import { useRichTextLinks as ce } from "./composables/useRichTextLinks.js";
|
|
9
|
-
const fe = ["aria-labelledby", "aria-describedby"], me = ["id", "for"], ve = { class: "rte-wrapper" },
|
|
9
|
+
const fe = ["aria-labelledby", "aria-describedby"], me = ["id", "for"], ve = { class: "rte-wrapper" }, ye = { class: "rte-body-wrap" }, ge = ["id", "contenteditable", "aria-label", "aria-readonly", "aria-disabled", "aria-invalid"], be = ["id"], Se = /* @__PURE__ */ te({
|
|
10
10
|
__name: "RichTextEditor",
|
|
11
11
|
props: {
|
|
12
12
|
modelValue: { default: "" },
|
|
@@ -17,7 +17,8 @@ const fe = ["aria-labelledby", "aria-describedby"], me = ["id", "for"], ve = { c
|
|
|
17
17
|
label: {},
|
|
18
18
|
error: {},
|
|
19
19
|
id: {},
|
|
20
|
-
readonly: { type: Boolean, default: !1 }
|
|
20
|
+
readonly: { type: Boolean, default: !1 },
|
|
21
|
+
tools: {}
|
|
21
22
|
},
|
|
22
23
|
emits: ["update:modelValue", "focus", "blur", "image-removed"],
|
|
23
24
|
setup(o, { emit: N }) {
|
|
@@ -33,7 +34,7 @@ const fe = ["aria-labelledby", "aria-describedby"], me = ["id", "for"], ve = { c
|
|
|
33
34
|
justifyRight: !1
|
|
34
35
|
}), S = v("");
|
|
35
36
|
let u = null, c = null, p = !1;
|
|
36
|
-
function
|
|
37
|
+
function y() {
|
|
37
38
|
if (p) return;
|
|
38
39
|
const e = window.getSelection();
|
|
39
40
|
if (e && e.rangeCount > 0)
|
|
@@ -43,7 +44,7 @@ const fe = ["aria-labelledby", "aria-describedby"], me = ["id", "for"], ve = { c
|
|
|
43
44
|
u = null;
|
|
44
45
|
}
|
|
45
46
|
}
|
|
46
|
-
function
|
|
47
|
+
function g() {
|
|
47
48
|
if (!(!u || p))
|
|
48
49
|
try {
|
|
49
50
|
const e = window.getSelection();
|
|
@@ -73,19 +74,12 @@ const fe = ["aria-labelledby", "aria-describedby"], me = ["id", "for"], ve = { c
|
|
|
73
74
|
H = t;
|
|
74
75
|
}
|
|
75
76
|
const $ = {
|
|
76
|
-
saveSelection:
|
|
77
|
-
restoreSelection:
|
|
77
|
+
saveSelection: y,
|
|
78
|
+
restoreSelection: g,
|
|
78
79
|
onInput: f
|
|
79
80
|
};
|
|
80
81
|
h(() => r.value);
|
|
81
|
-
const {
|
|
82
|
-
imageInputRef: z,
|
|
83
|
-
isUploadingImage: W,
|
|
84
|
-
triggerImageUpload: Y,
|
|
85
|
-
onImageFileChange: D,
|
|
86
|
-
onPaste: j,
|
|
87
|
-
onDrop: V
|
|
88
|
-
} = ue(r, $), l = ce({
|
|
82
|
+
const { imageInputRef: z, isUploadingImage: W, triggerImageUpload: Y, onImageFileChange: D, onPaste: j, onDrop: V } = ue(r, $), l = ce({
|
|
89
83
|
editorRef: r,
|
|
90
84
|
rootRef: A,
|
|
91
85
|
linkPopoverElRef: x,
|
|
@@ -104,41 +98,41 @@ const fe = ["aria-labelledby", "aria-describedby"], me = ["id", "for"], ve = { c
|
|
|
104
98
|
T.value = t === "" && !e.querySelector("img");
|
|
105
99
|
}
|
|
106
100
|
function f() {
|
|
107
|
-
E(), b("update:modelValue", r.value?.innerHTML ?? ""), P(),
|
|
101
|
+
E(), b("update:modelValue", r.value?.innerHTML ?? ""), P(), d();
|
|
108
102
|
}
|
|
109
103
|
function k(e, t) {
|
|
110
104
|
if (!(i.disabled || i.readonly)) {
|
|
111
|
-
|
|
105
|
+
g(), r.value?.focus();
|
|
112
106
|
try {
|
|
113
107
|
document.execCommand(e, !1, t ?? void 0);
|
|
114
108
|
} catch {
|
|
115
109
|
}
|
|
116
|
-
|
|
110
|
+
d(), f();
|
|
117
111
|
}
|
|
118
112
|
}
|
|
119
113
|
function G(e) {
|
|
120
114
|
if (!(i.disabled || i.readonly)) {
|
|
121
|
-
|
|
115
|
+
g(), r.value?.focus();
|
|
122
116
|
try {
|
|
123
117
|
document.execCommand("formatBlock", !1, e);
|
|
124
118
|
} catch {
|
|
125
119
|
}
|
|
126
|
-
|
|
120
|
+
d(), f();
|
|
127
121
|
}
|
|
128
122
|
}
|
|
129
123
|
function J() {
|
|
130
124
|
if (!(i.disabled || i.readonly)) {
|
|
131
|
-
|
|
125
|
+
g(), r.value?.focus();
|
|
132
126
|
try {
|
|
133
127
|
document.execCommand("removeFormat", !1, void 0), document.execCommand("formatBlock", !1, "div");
|
|
134
128
|
} catch {
|
|
135
129
|
}
|
|
136
|
-
|
|
130
|
+
d(), f();
|
|
137
131
|
}
|
|
138
132
|
}
|
|
139
133
|
function Q() {
|
|
140
134
|
if (i.disabled || i.readonly) return;
|
|
141
|
-
|
|
135
|
+
g(), r.value?.focus();
|
|
142
136
|
const e = window.getSelection();
|
|
143
137
|
if (!e || e.rangeCount === 0 || e.isCollapsed) return;
|
|
144
138
|
const t = e.getRangeAt(0);
|
|
@@ -149,14 +143,14 @@ const fe = ["aria-labelledby", "aria-describedby"], me = ["id", "for"], ve = { c
|
|
|
149
143
|
const n = t.extractContents(), O = document.createElement("code");
|
|
150
144
|
O.appendChild(n), t.insertNode(O), e.removeAllRanges();
|
|
151
145
|
}
|
|
152
|
-
|
|
146
|
+
d(), f();
|
|
153
147
|
}
|
|
154
|
-
function
|
|
148
|
+
function d() {
|
|
155
149
|
c !== null && cancelAnimationFrame(c), c = requestAnimationFrame(() => {
|
|
156
150
|
c = null, X();
|
|
157
151
|
});
|
|
158
152
|
}
|
|
159
|
-
function
|
|
153
|
+
function s(e) {
|
|
160
154
|
try {
|
|
161
155
|
return document.queryCommandState(e);
|
|
162
156
|
} catch {
|
|
@@ -166,15 +160,15 @@ const fe = ["aria-labelledby", "aria-describedby"], me = ["id", "for"], ve = { c
|
|
|
166
160
|
function X() {
|
|
167
161
|
if (!p) {
|
|
168
162
|
B.value = {
|
|
169
|
-
bold:
|
|
170
|
-
italic:
|
|
171
|
-
underline:
|
|
172
|
-
strikeThrough:
|
|
173
|
-
insertOrderedList:
|
|
174
|
-
insertUnorderedList:
|
|
175
|
-
justifyLeft:
|
|
176
|
-
justifyCenter:
|
|
177
|
-
justifyRight:
|
|
163
|
+
bold: s("bold"),
|
|
164
|
+
italic: s("italic"),
|
|
165
|
+
underline: s("underline"),
|
|
166
|
+
strikeThrough: s("strikeThrough"),
|
|
167
|
+
insertOrderedList: s("insertOrderedList"),
|
|
168
|
+
insertUnorderedList: s("insertUnorderedList"),
|
|
169
|
+
justifyLeft: s("justifyLeft"),
|
|
170
|
+
justifyCenter: s("justifyCenter"),
|
|
171
|
+
justifyRight: s("justifyRight")
|
|
178
172
|
};
|
|
179
173
|
try {
|
|
180
174
|
S.value = document.queryCommandValue("formatBlock").toLowerCase();
|
|
@@ -188,7 +182,7 @@ const fe = ["aria-labelledby", "aria-describedby"], me = ["id", "for"], ve = { c
|
|
|
188
182
|
const e = r.value;
|
|
189
183
|
if (!e) return;
|
|
190
184
|
const t = document.activeElement;
|
|
191
|
-
t !== e && !e.contains(t) || (
|
|
185
|
+
t !== e && !e.contains(t) || (y(), d());
|
|
192
186
|
}
|
|
193
187
|
function Z(e) {
|
|
194
188
|
if (e.ctrlKey || e.metaKey)
|
|
@@ -241,26 +235,27 @@ const fe = ["aria-labelledby", "aria-describedby"], me = ["id", "for"], ve = { c
|
|
|
241
235
|
class: "rte-label"
|
|
242
236
|
}, I(o.label), 9, me)) : U("", !0),
|
|
243
237
|
w("div", ve, [
|
|
244
|
-
q(
|
|
238
|
+
q(se, {
|
|
245
239
|
toolbarState: B.value,
|
|
246
240
|
activeBlock: S.value,
|
|
247
241
|
disabled: o.disabled,
|
|
248
242
|
readonly: o.readonly,
|
|
249
243
|
isUploadingImage: a(W),
|
|
250
244
|
label: o.label,
|
|
245
|
+
tools: o.tools,
|
|
251
246
|
onCommand: k,
|
|
252
247
|
onSetBlock: G,
|
|
253
248
|
onInsertCode: Q,
|
|
254
249
|
onTriggerImageUpload: t[0] || (t[0] = (n) => a(Y)(!(!o.disabled && !o.readonly))),
|
|
255
250
|
onOpenLinkPopover: a(l).openLinkPopover,
|
|
256
251
|
onClearFormat: J
|
|
257
|
-
}, null, 8, ["toolbarState", "activeBlock", "disabled", "readonly", "isUploadingImage", "label", "onOpenLinkPopover"]),
|
|
258
|
-
w("div",
|
|
252
|
+
}, null, 8, ["toolbarState", "activeBlock", "disabled", "readonly", "isUploadingImage", "label", "tools", "onOpenLinkPopover"]),
|
|
253
|
+
w("div", ye, [
|
|
259
254
|
w("div", {
|
|
260
255
|
id: m.value,
|
|
261
256
|
ref_key: "editorRef",
|
|
262
257
|
ref: r,
|
|
263
|
-
class: "rte-editor",
|
|
258
|
+
class: "rte-editor scrollbar-thin always-scroll",
|
|
264
259
|
style: ie(_.value),
|
|
265
260
|
contenteditable: !o.disabled && !o.readonly ? "true" : "false",
|
|
266
261
|
role: "textbox",
|
|
@@ -272,19 +267,19 @@ const fe = ["aria-labelledby", "aria-describedby"], me = ["id", "for"], ve = { c
|
|
|
272
267
|
spellcheck: "true",
|
|
273
268
|
onInputPassive: f,
|
|
274
269
|
onFocus: t[1] || (t[1] = (n) => {
|
|
275
|
-
R.value = !0,
|
|
270
|
+
R.value = !0, y(), d(), b("focus", n);
|
|
276
271
|
}),
|
|
277
272
|
onBlur: t[2] || (t[2] = (n) => {
|
|
278
273
|
R.value = !1, b("blur", n);
|
|
279
274
|
}),
|
|
280
275
|
onKeydown: Z,
|
|
281
|
-
onKeyupPassive:
|
|
282
|
-
onMouseupPassive:
|
|
276
|
+
onKeyupPassive: y,
|
|
277
|
+
onMouseupPassive: y,
|
|
283
278
|
onPaste: t[3] || (t[3] = //@ts-ignore
|
|
284
279
|
(...n) => a(j) && a(j)(...n)),
|
|
285
280
|
onDrop: t[4] || (t[4] = //@ts-ignore
|
|
286
281
|
(...n) => a(V) && a(V)(...n))
|
|
287
|
-
}, null, 44,
|
|
282
|
+
}, null, 44, ge),
|
|
288
283
|
w("input", {
|
|
289
284
|
ref_key: "imageInputRef",
|
|
290
285
|
ref: z,
|
|
@@ -303,7 +298,7 @@ const fe = ["aria-labelledby", "aria-describedby"], me = ["id", "for"], ve = { c
|
|
|
303
298
|
"aria-hidden": "true",
|
|
304
299
|
onClick: t[6] || (t[6] = (n) => r.value?.focus())
|
|
305
300
|
}, I(o.placeholder), 1)) : U("", !0),
|
|
306
|
-
q(
|
|
301
|
+
q(de, {
|
|
307
302
|
ref_key: "linkPopoverCompRef",
|
|
308
303
|
ref: x,
|
|
309
304
|
visible: a(l).linkPopover.value.visible,
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { RichTextTools } from './types';
|
|
1
2
|
interface Props {
|
|
2
3
|
toolbarState: Record<string, boolean>;
|
|
3
4
|
activeBlock: string;
|
|
@@ -5,20 +6,28 @@ interface Props {
|
|
|
5
6
|
readonly?: boolean;
|
|
6
7
|
isUploadingImage: boolean;
|
|
7
8
|
label?: string;
|
|
9
|
+
/**
|
|
10
|
+
* Toolbar contents. Pass an array of tool IDs to show only those buttons,
|
|
11
|
+
* a preset ('minimal' | 'basic' | 'standard' | 'all'), or omit to show
|
|
12
|
+
* the full default toolbar.
|
|
13
|
+
*/
|
|
14
|
+
tools?: RichTextTools;
|
|
8
15
|
}
|
|
9
16
|
declare const _default: import('vue').DefineComponent<Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
|
|
17
|
+
clearFormat: () => any;
|
|
10
18
|
command: (cmd: string, val?: string) => any;
|
|
11
19
|
setBlock: (tag: string) => any;
|
|
12
20
|
insertCode: () => any;
|
|
13
21
|
triggerImageUpload: () => any;
|
|
14
22
|
openLinkPopover: () => any;
|
|
15
|
-
clearFormat: () => any;
|
|
16
23
|
}, string, import('vue').PublicProps, Readonly<Props> & Readonly<{
|
|
24
|
+
onClearFormat?: () => any;
|
|
17
25
|
onCommand?: (cmd: string, val?: string) => any;
|
|
18
26
|
onSetBlock?: (tag: string) => any;
|
|
19
27
|
onInsertCode?: () => any;
|
|
20
28
|
onTriggerImageUpload?: () => any;
|
|
21
29
|
onOpenLinkPopover?: () => any;
|
|
22
|
-
|
|
23
|
-
|
|
30
|
+
}>, {
|
|
31
|
+
tools: RichTextTools;
|
|
32
|
+
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
|
|
24
33
|
export default _default;
|