@opentiny/tiny-robot 0.3.0-alpha.30 → 0.3.0-alpha.32
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/attachments/index.js +216 -216
- package/dist/bubble/index.js +327 -318
- package/dist/drag-overlay/index.js +15 -15
- package/dist/index.d.ts +8 -0
- package/dist/index4.js +16 -16
- package/dist/mcp-server-picker/index.js +149 -149
- package/dist/sender/index.js +711 -708
- package/dist/style.css +1 -1
- package/dist/suggestion-pills/index.js +38 -38
- package/dist/suggestion-popover/index.js +13 -13
- package/package.json +3 -3
package/dist/sender/index.js
CHANGED
|
@@ -1,35 +1,35 @@
|
|
|
1
|
-
import { ref as
|
|
2
|
-
import { TinyTooltip as
|
|
1
|
+
import { ref as A, watch as ne, reactive as ot, computed as B, defineComponent as xe, createElementBlock as I, openBlock as m, createCommentVNode as N, normalizeStyle as Je, createBlock as Y, unref as _, withCtx as he, createElementVNode as q, createVNode as Q, normalizeClass as oe, toDisplayString as ce, useAttrs as st, resolveComponent as at, mergeProps as we, Fragment as ve, renderList as Se, mergeModels as lt, useModel as it, onMounted as rt, onUnmounted as ct, nextTick as te, Transition as Ve, withModifiers as ut, useSlots as dt, renderSlot as re, isRef as ft, createTextVNode as Ge } from "vue";
|
|
2
|
+
import { TinyTooltip as Fe, TinyInput as pt } from "@opentiny/vue";
|
|
3
3
|
import { e as ht } from "../index3.js";
|
|
4
|
-
import { IconUpload as vt, IconVoice as yt, IconLoadingSpeech as gt, IconClear as mt, IconSend as bt, IconStop as wt, IconAssociate as
|
|
5
|
-
import { _ as
|
|
6
|
-
import { t as
|
|
7
|
-
function
|
|
8
|
-
const
|
|
4
|
+
import { IconUpload as vt, IconVoice as yt, IconLoadingSpeech as gt, IconClear as mt, IconSend as bt, IconStop as wt, IconAssociate as St } from "@opentiny/tiny-robot-svgs";
|
|
5
|
+
import { _ as _e } from "../_plugin-vue_export-helper.js";
|
|
6
|
+
import { t as xt } from "../utils.js";
|
|
7
|
+
function _t(t, u) {
|
|
8
|
+
const a = A(t.modelValue || t.defaultValue || ""), c = A(null);
|
|
9
9
|
ne(
|
|
10
|
-
() =>
|
|
10
|
+
() => t.modelValue,
|
|
11
11
|
(h) => {
|
|
12
|
-
h !== void 0 && h !==
|
|
12
|
+
h !== void 0 && h !== a.value && (a.value = h);
|
|
13
13
|
}
|
|
14
14
|
), ne(
|
|
15
|
-
() =>
|
|
15
|
+
() => a.value,
|
|
16
16
|
(h) => {
|
|
17
|
-
|
|
17
|
+
u("update:modelValue", h);
|
|
18
18
|
}
|
|
19
19
|
);
|
|
20
20
|
const y = (h) => {
|
|
21
|
-
|
|
21
|
+
a.value = h, u("update:modelValue", h);
|
|
22
22
|
}, S = (h) => {
|
|
23
23
|
h == null || h.preventDefault();
|
|
24
|
-
const
|
|
25
|
-
!
|
|
24
|
+
const b = a.value;
|
|
25
|
+
!t.disabled && !t.loading && b.trim() && u("submit", b);
|
|
26
26
|
}, l = () => {
|
|
27
|
-
|
|
28
|
-
},
|
|
27
|
+
a.value = "", u("update:modelValue", ""), u("clear");
|
|
28
|
+
}, f = A(!1);
|
|
29
29
|
return {
|
|
30
|
-
inputValue:
|
|
31
|
-
inputWrapper:
|
|
32
|
-
isComposing:
|
|
30
|
+
inputValue: a,
|
|
31
|
+
inputWrapper: c,
|
|
32
|
+
isComposing: f,
|
|
33
33
|
handleChange: y,
|
|
34
34
|
handleSubmit: S,
|
|
35
35
|
handleClear: l,
|
|
@@ -38,186 +38,186 @@ function Ct(a, c) {
|
|
|
38
38
|
}
|
|
39
39
|
};
|
|
40
40
|
}
|
|
41
|
-
function
|
|
41
|
+
function Ct(t, u, a, c, y, S, l, f, C, h, b, v, K, V, F, M) {
|
|
42
42
|
const T = () => {
|
|
43
|
-
v.value && (
|
|
44
|
-
},
|
|
45
|
-
if (!(
|
|
46
|
-
switch (
|
|
43
|
+
v.value && (F != null && F.value && (M == null || M()), u("submit", a.value.trim()));
|
|
44
|
+
}, H = (d, P) => {
|
|
45
|
+
if (!(d.key === "Enter")) return !1;
|
|
46
|
+
switch (P) {
|
|
47
47
|
case "enter":
|
|
48
|
-
return !
|
|
48
|
+
return !d.shiftKey && !d.ctrlKey && !d.metaKey;
|
|
49
49
|
case "ctrlEnter":
|
|
50
|
-
return (
|
|
50
|
+
return (d.ctrlKey || d.metaKey) && !d.shiftKey;
|
|
51
51
|
case "shiftEnter":
|
|
52
|
-
return
|
|
52
|
+
return d.shiftKey && !d.ctrlKey && !d.metaKey;
|
|
53
53
|
default:
|
|
54
54
|
return !1;
|
|
55
55
|
}
|
|
56
56
|
};
|
|
57
57
|
return {
|
|
58
|
-
handleKeyPress: (
|
|
59
|
-
if (
|
|
60
|
-
if (
|
|
61
|
-
|
|
62
|
-
const
|
|
63
|
-
|
|
64
|
-
` + ee.substring(
|
|
65
|
-
|
|
58
|
+
handleKeyPress: (d) => {
|
|
59
|
+
if (c.value) return;
|
|
60
|
+
if (d.key === "Enter" && d.shiftKey && (K == null ? void 0 : K.value) === "single" && V) {
|
|
61
|
+
d.preventDefault(), V();
|
|
62
|
+
const O = d.target, z = O.selectionStart, ee = a.value;
|
|
63
|
+
a.value = ee.substring(0, z) + `
|
|
64
|
+
` + ee.substring(z), setTimeout(() => {
|
|
65
|
+
O.selectionStart = O.selectionEnd = z + 1;
|
|
66
66
|
}, 0);
|
|
67
67
|
return;
|
|
68
68
|
}
|
|
69
69
|
if (S.value) {
|
|
70
|
-
if (
|
|
71
|
-
|
|
70
|
+
if (d.key === "ArrowDown") {
|
|
71
|
+
d.preventDefault(), h("down");
|
|
72
72
|
return;
|
|
73
73
|
}
|
|
74
|
-
if (
|
|
75
|
-
|
|
74
|
+
if (d.key === "ArrowUp") {
|
|
75
|
+
d.preventDefault(), h("up");
|
|
76
76
|
return;
|
|
77
77
|
}
|
|
78
|
-
if (l.value && (
|
|
79
|
-
|
|
78
|
+
if (l.value && (t.activeSuggestionKeys || ["Enter", "Tab"]).includes(d.key)) {
|
|
79
|
+
d.preventDefault(), f();
|
|
80
80
|
return;
|
|
81
81
|
}
|
|
82
82
|
}
|
|
83
|
-
if (
|
|
84
|
-
S.value ? (
|
|
83
|
+
if (d.key === "Escape") {
|
|
84
|
+
S.value ? (C(), d.preventDefault()) : y.isRecording && (b(), d.preventDefault()), u("escape-press");
|
|
85
85
|
return;
|
|
86
86
|
}
|
|
87
|
-
|
|
87
|
+
H(d, t.submitType) && (d.preventDefault(), v.value && T());
|
|
88
88
|
},
|
|
89
89
|
triggerSubmit: T
|
|
90
90
|
};
|
|
91
91
|
}
|
|
92
|
-
function kt(
|
|
93
|
-
const
|
|
92
|
+
function kt(t) {
|
|
93
|
+
const u = ot({
|
|
94
94
|
isRecording: !1,
|
|
95
95
|
isSupported: typeof window < "u" && "webkitSpeechRecognition" in window || "SpeechRecognition" in window,
|
|
96
96
|
error: void 0
|
|
97
|
-
}),
|
|
98
|
-
|
|
97
|
+
}), a = u.isSupported ? new (window.webkitSpeechRecognition || window.SpeechRecognition)() : void 0;
|
|
98
|
+
a !== void 0 && (a.continuous = t.continuous ?? !1, a.interimResults = t.interimResults ?? !0, a.lang = t.lang ?? navigator.language, a.onstart = () => {
|
|
99
99
|
var l;
|
|
100
|
-
|
|
101
|
-
},
|
|
100
|
+
u.isRecording = !0, u.error = void 0, (l = t.onStart) == null || l.call(t);
|
|
101
|
+
}, a.onend = () => {
|
|
102
102
|
var l;
|
|
103
|
-
|
|
104
|
-
},
|
|
105
|
-
var
|
|
106
|
-
const
|
|
107
|
-
l.results[0].isFinal ? (
|
|
108
|
-
},
|
|
109
|
-
var
|
|
110
|
-
|
|
103
|
+
u.isRecording = !1, (l = t.onEnd) == null || l.call(t);
|
|
104
|
+
}, a.onresult = (l) => {
|
|
105
|
+
var C, h;
|
|
106
|
+
const f = Array.from(l.results).map((b) => b[0].transcript).join("");
|
|
107
|
+
l.results[0].isFinal ? (C = t.onFinal) == null || C.call(t, f) : (h = t.onInterim) == null || h.call(t, f);
|
|
108
|
+
}, a.onerror = (l) => {
|
|
109
|
+
var f;
|
|
110
|
+
u.error = new Error(l.error), u.isRecording = !1, (f = t.onError) == null || f.call(t, u.error);
|
|
111
111
|
});
|
|
112
|
-
const
|
|
112
|
+
const c = () => {
|
|
113
113
|
var l;
|
|
114
|
-
if (!
|
|
115
|
-
const
|
|
116
|
-
|
|
114
|
+
if (!a) {
|
|
115
|
+
const f = new Error("浏览器不支持语音识别");
|
|
116
|
+
u.error = f, (l = t.onError) == null || l.call(t, f);
|
|
117
117
|
return;
|
|
118
118
|
}
|
|
119
|
-
if (
|
|
119
|
+
if (u.isRecording) {
|
|
120
120
|
try {
|
|
121
|
-
|
|
121
|
+
a.stop(), setTimeout(() => {
|
|
122
122
|
try {
|
|
123
|
-
|
|
124
|
-
} catch (
|
|
125
|
-
S(
|
|
123
|
+
a.start();
|
|
124
|
+
} catch (f) {
|
|
125
|
+
S(f);
|
|
126
126
|
}
|
|
127
127
|
}, 100);
|
|
128
|
-
} catch (
|
|
129
|
-
S(
|
|
128
|
+
} catch (f) {
|
|
129
|
+
S(f);
|
|
130
130
|
}
|
|
131
131
|
return;
|
|
132
132
|
}
|
|
133
133
|
try {
|
|
134
|
-
|
|
135
|
-
} catch (
|
|
136
|
-
S(
|
|
134
|
+
a.start();
|
|
135
|
+
} catch (f) {
|
|
136
|
+
S(f);
|
|
137
137
|
}
|
|
138
138
|
}, y = () => {
|
|
139
|
-
if (
|
|
139
|
+
if (a && u.isRecording)
|
|
140
140
|
try {
|
|
141
|
-
|
|
141
|
+
a.stop();
|
|
142
142
|
} catch (l) {
|
|
143
143
|
S(l);
|
|
144
144
|
}
|
|
145
145
|
}, S = (l) => {
|
|
146
|
-
var
|
|
147
|
-
|
|
146
|
+
var f;
|
|
147
|
+
u.error = l instanceof Error ? l : new Error("语音识别操作失败"), u.isRecording = !1, (f = t.onError) == null || f.call(t, u.error);
|
|
148
148
|
};
|
|
149
149
|
return {
|
|
150
|
-
speechState:
|
|
151
|
-
start:
|
|
150
|
+
speechState: u,
|
|
151
|
+
start: c,
|
|
152
152
|
stop: y
|
|
153
153
|
};
|
|
154
154
|
}
|
|
155
|
-
function It(
|
|
156
|
-
const l =
|
|
157
|
-
var
|
|
158
|
-
if (!((
|
|
159
|
-
const k = h.value === "mouse" ?
|
|
160
|
-
return ((
|
|
155
|
+
function It(t, u, a, c, y, S) {
|
|
156
|
+
const l = A(!1), f = A(-1), C = A(-1), h = A(null), b = A(""), v = A(!1), K = B(() => {
|
|
157
|
+
var J, X;
|
|
158
|
+
if (!((J = t.value) != null && J.length)) return "";
|
|
159
|
+
const k = h.value === "mouse" ? C.value : f.value;
|
|
160
|
+
return ((X = t.value[k]) == null ? void 0 : X.content) || "";
|
|
161
161
|
}), V = (k) => {
|
|
162
|
-
|
|
163
|
-
},
|
|
164
|
-
|
|
165
|
-
},
|
|
166
|
-
const
|
|
167
|
-
if (!
|
|
168
|
-
|
|
162
|
+
b.value = k, v.value = !0;
|
|
163
|
+
}, F = () => {
|
|
164
|
+
b.value = "", v.value = !1;
|
|
165
|
+
}, M = (k) => {
|
|
166
|
+
const J = k || K.value;
|
|
167
|
+
if (!J || !u.value) {
|
|
168
|
+
F();
|
|
169
169
|
return;
|
|
170
170
|
}
|
|
171
|
-
const
|
|
172
|
-
|
|
171
|
+
const X = J.substring(u.value.length);
|
|
172
|
+
J.toLowerCase().startsWith(u.value.toLowerCase()) && X ? V(X) : F();
|
|
173
173
|
}, T = () => {
|
|
174
|
-
|
|
175
|
-
},
|
|
176
|
-
l.value = !0,
|
|
177
|
-
},
|
|
178
|
-
l.value = !1, T(),
|
|
179
|
-
},
|
|
174
|
+
f.value = -1, C.value = -1, h.value = null;
|
|
175
|
+
}, H = () => {
|
|
176
|
+
l.value = !0, M();
|
|
177
|
+
}, x = () => {
|
|
178
|
+
l.value = !1, T(), F();
|
|
179
|
+
}, d = B(() => {
|
|
180
180
|
var k;
|
|
181
|
-
return
|
|
182
|
-
}),
|
|
183
|
-
|
|
184
|
-
},
|
|
185
|
-
|
|
186
|
-
},
|
|
187
|
-
!l.value || !
|
|
181
|
+
return a.value ? !0 : !!(u.value && ((k = t.value) == null ? void 0 : k.length) > 0 && !c.value);
|
|
182
|
+
}), P = (k) => {
|
|
183
|
+
x(), u.value = k, y(k), S(k);
|
|
184
|
+
}, O = () => {
|
|
185
|
+
K.value && P(K.value);
|
|
186
|
+
}, z = (k) => {
|
|
187
|
+
!l.value || !t.value || (h.value = "keyboard", f.value === -1 ? f.value = k === "down" ? 0 : t.value.length - 1 : k === "down" ? f.value = (f.value + 1) % t.value.length : f.value = (f.value - 1 + t.value.length) % t.value.length, M());
|
|
188
188
|
}, ee = (k) => {
|
|
189
|
-
|
|
190
|
-
},
|
|
191
|
-
|
|
189
|
+
t.value && (h.value = "mouse", C.value = k, M());
|
|
190
|
+
}, U = () => {
|
|
191
|
+
t.value && (C.value = -1, f.value !== -1 ? h.value = "keyboard" : h.value = null, M());
|
|
192
192
|
};
|
|
193
|
-
return ne(
|
|
194
|
-
k ? l.value ||
|
|
193
|
+
return ne(d, (k) => {
|
|
194
|
+
k ? l.value || H() : l.value && x();
|
|
195
195
|
}), {
|
|
196
196
|
// 弹窗控制
|
|
197
197
|
isPopupVisible: l,
|
|
198
|
-
openPopup:
|
|
199
|
-
closePopup:
|
|
198
|
+
openPopup: H,
|
|
199
|
+
closePopup: x,
|
|
200
200
|
// 自动完成占位符
|
|
201
|
-
autoCompleteText:
|
|
201
|
+
autoCompleteText: b,
|
|
202
202
|
showTabIndicator: v,
|
|
203
|
-
syncAutoComplete:
|
|
203
|
+
syncAutoComplete: M,
|
|
204
204
|
// 选中控制层
|
|
205
|
-
activeSuggestion:
|
|
206
|
-
activeKeyboardIndex:
|
|
207
|
-
activeMouseIndex:
|
|
205
|
+
activeSuggestion: K,
|
|
206
|
+
activeKeyboardIndex: f,
|
|
207
|
+
activeMouseIndex: C,
|
|
208
208
|
// 交互处理
|
|
209
|
-
navigateWithKeyboard:
|
|
209
|
+
navigateWithKeyboard: z,
|
|
210
210
|
handleMouseEnter: ee,
|
|
211
|
-
handleMouseLeave:
|
|
211
|
+
handleMouseLeave: U,
|
|
212
212
|
// 业务操作
|
|
213
|
-
applySuggestion:
|
|
214
|
-
confirmSelection:
|
|
213
|
+
applySuggestion: P,
|
|
214
|
+
confirmSelection: O
|
|
215
215
|
};
|
|
216
216
|
}
|
|
217
217
|
const Tt = { class: "action-buttons" }, Rt = { class: "action-buttons__submit-content" }, Ot = {
|
|
218
218
|
key: 0,
|
|
219
219
|
class: "action-buttons__cancel-text"
|
|
220
|
-
}, Et = /* @__PURE__ */
|
|
220
|
+
}, Et = /* @__PURE__ */ xe({
|
|
221
221
|
__name: "ActionButtons",
|
|
222
222
|
props: {
|
|
223
223
|
loading: { type: Boolean, default: !1 },
|
|
@@ -237,116 +237,119 @@ const Tt = { class: "action-buttons" }, Rt = { class: "action-buttons__submit-co
|
|
|
237
237
|
stopText: { default: void 0 }
|
|
238
238
|
},
|
|
239
239
|
emits: ["clear", "toggle-speech", "submit", "cancel", "trigger-select"],
|
|
240
|
-
setup(
|
|
241
|
-
const
|
|
242
|
-
var
|
|
243
|
-
const
|
|
244
|
-
if (typeof
|
|
245
|
-
return () =>
|
|
246
|
-
if (typeof
|
|
247
|
-
return
|
|
248
|
-
}), S =
|
|
249
|
-
var
|
|
250
|
-
const
|
|
251
|
-
if (typeof
|
|
252
|
-
return () =>
|
|
253
|
-
if (typeof
|
|
254
|
-
return
|
|
255
|
-
}), l =
|
|
256
|
-
var
|
|
257
|
-
return
|
|
258
|
-
}),
|
|
259
|
-
|
|
260
|
-
},
|
|
261
|
-
if (!
|
|
262
|
-
const
|
|
263
|
-
|
|
240
|
+
setup(t, { emit: u }) {
|
|
241
|
+
const a = t, c = u, y = B(() => {
|
|
242
|
+
var d, P;
|
|
243
|
+
const x = (P = (d = a.buttonGroup) == null ? void 0 : d.file) == null ? void 0 : P.tooltips;
|
|
244
|
+
if (typeof x == "string" && x)
|
|
245
|
+
return () => x;
|
|
246
|
+
if (typeof x == "function")
|
|
247
|
+
return x;
|
|
248
|
+
}), S = B(() => {
|
|
249
|
+
var d, P;
|
|
250
|
+
const x = (P = (d = a.buttonGroup) == null ? void 0 : d.submit) == null ? void 0 : P.tooltips;
|
|
251
|
+
if (typeof x == "string" && x)
|
|
252
|
+
return () => x;
|
|
253
|
+
if (typeof x == "function")
|
|
254
|
+
return x;
|
|
255
|
+
}), l = B(() => a.allowSpeech), f = B(() => a.speechStatus.isRecording), C = B(() => a.disabled), h = B(() => {
|
|
256
|
+
var x, d;
|
|
257
|
+
return C.value || a.isOverLimit || ((d = (x = a.buttonGroup) == null ? void 0 : x.submit) == null ? void 0 : d.disabled);
|
|
258
|
+
}), b = B(() => a.allowFiles || a.allowSpeech || a.showClear), v = () => {
|
|
259
|
+
C.value || c("clear");
|
|
260
|
+
}, K = () => {
|
|
261
|
+
if (!C.value) {
|
|
262
|
+
const x = !a.speechStatus.isRecording;
|
|
263
|
+
c("toggle-speech", x);
|
|
264
264
|
}
|
|
265
265
|
}, V = () => {
|
|
266
|
-
h.value ||
|
|
267
|
-
},
|
|
268
|
-
|
|
269
|
-
},
|
|
270
|
-
var
|
|
271
|
-
return
|
|
266
|
+
h.value || c("submit");
|
|
267
|
+
}, F = () => {
|
|
268
|
+
C.value || c("cancel");
|
|
269
|
+
}, M = B(() => {
|
|
270
|
+
var x, d;
|
|
271
|
+
return C.value || ((d = (x = a.buttonGroup) == null ? void 0 : x.file) == null ? void 0 : d.disabled);
|
|
272
272
|
}), T = () => {
|
|
273
|
-
|
|
274
|
-
}
|
|
275
|
-
|
|
276
|
-
|
|
273
|
+
M.value || c("trigger-select");
|
|
274
|
+
}, H = B(() => {
|
|
275
|
+
var x, d;
|
|
276
|
+
return ((d = (x = a.buttonGroup) == null ? void 0 : x.file) == null ? void 0 : d.tooltipPlacement) || "top";
|
|
277
|
+
});
|
|
278
|
+
return (x, d) => (m(), I("div", Tt, [
|
|
279
|
+
b.value ? (m(), I("div", {
|
|
277
280
|
key: 0,
|
|
278
281
|
class: "action-buttons__utility",
|
|
279
|
-
style: Je({ "padding-right":
|
|
282
|
+
style: Je({ "padding-right": t.hasContent || t.loading ? "0" : "6px" })
|
|
280
283
|
}, [
|
|
281
|
-
|
|
284
|
+
t.allowFiles && !t.loading ? (m(), Y(_(Fe), {
|
|
282
285
|
key: 0,
|
|
283
286
|
effect: "light",
|
|
284
|
-
placement:
|
|
287
|
+
placement: H.value,
|
|
285
288
|
"render-content": y.value,
|
|
286
289
|
"visible-arrow": !1,
|
|
287
290
|
"popper-class": "tr-sender-actions-upload-button-popper"
|
|
288
291
|
}, {
|
|
289
292
|
default: he(() => [
|
|
290
|
-
|
|
293
|
+
q("div", {
|
|
291
294
|
class: "action-buttons__button",
|
|
292
295
|
onClick: T,
|
|
293
|
-
onFocusCapture:
|
|
296
|
+
onFocusCapture: d[0] || (d[0] = (P) => P.stopPropagation())
|
|
294
297
|
}, [
|
|
295
|
-
|
|
296
|
-
class: oe(["action-buttons__icon", { "is-disabled":
|
|
298
|
+
Q(_(vt), {
|
|
299
|
+
class: oe(["action-buttons__icon", { "is-disabled": M.value }]),
|
|
297
300
|
alt: "上传文件"
|
|
298
301
|
}, null, 8, ["class"])
|
|
299
302
|
], 32)
|
|
300
303
|
]),
|
|
301
304
|
_: 1
|
|
302
|
-
}, 8, ["render-content"])) : N("", !0),
|
|
303
|
-
l.value && !
|
|
305
|
+
}, 8, ["placement", "render-content"])) : N("", !0),
|
|
306
|
+
l.value && !t.loading ? (m(), I("div", {
|
|
304
307
|
key: 1,
|
|
305
|
-
class: oe(["action-buttons__button", { "is-recording":
|
|
306
|
-
onClick:
|
|
308
|
+
class: oe(["action-buttons__button", { "is-recording": f.value }]),
|
|
309
|
+
onClick: K
|
|
307
310
|
}, [
|
|
308
|
-
|
|
311
|
+
f.value ? (m(), Y(_(gt), {
|
|
309
312
|
key: 1,
|
|
310
313
|
class: "action-buttons__icon action-buttons__icon--recording",
|
|
311
314
|
alt: "语音中"
|
|
312
|
-
})) : (
|
|
315
|
+
})) : (m(), Y(_(yt), {
|
|
313
316
|
key: 0,
|
|
314
317
|
class: "action-buttons__icon",
|
|
315
318
|
alt: "录音"
|
|
316
319
|
}))
|
|
317
320
|
], 2)) : N("", !0),
|
|
318
|
-
|
|
321
|
+
t.showClear ? (m(), Y(_(Fe), {
|
|
319
322
|
key: 2,
|
|
320
323
|
content: "清空内容",
|
|
321
324
|
placement: "top"
|
|
322
325
|
}, {
|
|
323
326
|
default: he(() => [
|
|
324
|
-
|
|
327
|
+
q("div", {
|
|
325
328
|
class: "action-buttons__button",
|
|
326
329
|
onClick: v
|
|
327
330
|
}, [
|
|
328
|
-
|
|
331
|
+
Q(_(mt), { class: "action-buttons__icon" })
|
|
329
332
|
])
|
|
330
333
|
]),
|
|
331
334
|
_: 1
|
|
332
335
|
})) : N("", !0)
|
|
333
336
|
], 4)) : N("", !0),
|
|
334
|
-
|
|
337
|
+
t.hasContent || t.loading ? (m(), I("div", {
|
|
335
338
|
key: 1,
|
|
336
339
|
class: "action-buttons__button action-buttons__submit",
|
|
337
|
-
onClick:
|
|
340
|
+
onClick: d[1] || (d[1] = (P) => t.loading ? F() : V())
|
|
338
341
|
}, [
|
|
339
|
-
|
|
340
|
-
|
|
342
|
+
q("div", Rt, [
|
|
343
|
+
t.loading ? (m(), I("div", {
|
|
341
344
|
key: 1,
|
|
342
|
-
class: oe(["action-buttons__cancel", { "action-buttons__cancel--icon-only": !
|
|
345
|
+
class: oe(["action-buttons__cancel", { "action-buttons__cancel--icon-only": !t.stopText }])
|
|
343
346
|
}, [
|
|
344
|
-
|
|
347
|
+
Q(_(wt), {
|
|
345
348
|
class: "action-buttons__icon action-buttons__icon--cancel",
|
|
346
349
|
alt: "停止"
|
|
347
350
|
}),
|
|
348
|
-
|
|
349
|
-
], 2)) : (
|
|
351
|
+
t.stopText ? (m(), I("span", Ot, ce(t.stopText), 1)) : N("", !0)
|
|
352
|
+
], 2)) : (m(), Y(_(Fe), {
|
|
350
353
|
key: 0,
|
|
351
354
|
effect: "light",
|
|
352
355
|
placement: "top",
|
|
@@ -354,7 +357,7 @@ const Tt = { class: "action-buttons" }, Rt = { class: "action-buttons__submit-co
|
|
|
354
357
|
"visible-arrow": !1
|
|
355
358
|
}, {
|
|
356
359
|
default: he(() => [
|
|
357
|
-
|
|
360
|
+
Q(_(bt), {
|
|
358
361
|
class: oe(["action-buttons__icon", "action-buttons__icon--send", { "is-disabled": h.value }]),
|
|
359
362
|
alt: "发送"
|
|
360
363
|
}, null, 8, ["class"])
|
|
@@ -365,18 +368,18 @@ const Tt = { class: "action-buttons" }, Rt = { class: "action-buttons__submit-co
|
|
|
365
368
|
])) : N("", !0)
|
|
366
369
|
]));
|
|
367
370
|
}
|
|
368
|
-
}), je = /* @__PURE__ */
|
|
369
|
-
function $t(
|
|
370
|
-
let
|
|
371
|
-
return { commit: (
|
|
371
|
+
}), je = /* @__PURE__ */ _e(Et, [["__scopeId", "data-v-687a8616"]]);
|
|
372
|
+
function $t(t, u = {}) {
|
|
373
|
+
let a = [], c = [], y = t;
|
|
374
|
+
return { commit: (b) => {
|
|
372
375
|
var v;
|
|
373
|
-
|
|
374
|
-
}, undo: () =>
|
|
375
|
-
var
|
|
376
|
-
|
|
376
|
+
a.push(y), y = b, c.length && ((v = u.onRemoveHistory) == null || v.call(u, c)), c = [];
|
|
377
|
+
}, undo: () => a.length ? (c.push(y), y = a.pop(), y) : null, redo: () => c.length ? (a.push(y), y = c.pop(), y) : null, clear: () => {
|
|
378
|
+
var b, v;
|
|
379
|
+
a.length && ((b = u.onRemoveHistory) == null || b.call(u, a)), c.length && ((v = u.onRemoveHistory) == null || v.call(u, c)), a = [], c = [];
|
|
377
380
|
}, get: () => y };
|
|
378
381
|
}
|
|
379
|
-
const Bt = ["data-id", "data-type"], Lt = ["data-id", "data-type"], Dt = /* @__PURE__ */
|
|
382
|
+
const Bt = ["data-id", "data-type"], Lt = ["data-id", "data-type"], Dt = /* @__PURE__ */ xe({
|
|
380
383
|
inheritAttrs: !1,
|
|
381
384
|
__name: "Block",
|
|
382
385
|
props: {
|
|
@@ -386,63 +389,63 @@ const Bt = ["data-id", "data-type"], Lt = ["data-id", "data-type"], Dt = /* @__P
|
|
|
386
389
|
readonly: { type: Boolean },
|
|
387
390
|
asChild: { type: Boolean }
|
|
388
391
|
},
|
|
389
|
-
setup(
|
|
390
|
-
const
|
|
391
|
-
return (
|
|
392
|
+
setup(t) {
|
|
393
|
+
const u = t, a = st();
|
|
394
|
+
return (c, y) => {
|
|
392
395
|
const S = at("Block", !0);
|
|
393
|
-
return
|
|
396
|
+
return u.type !== "block" ? (m(), I("span", we({
|
|
394
397
|
key: 0,
|
|
395
|
-
"data-id":
|
|
396
|
-
"data-type":
|
|
397
|
-
},
|
|
398
|
-
|
|
398
|
+
"data-id": u.id,
|
|
399
|
+
"data-type": u.type
|
|
400
|
+
}, _(a)), ce(u.content), 17, Bt)) : (m(), I(ve, { key: 1 }, [
|
|
401
|
+
u.asChild ? (m(!0), I(ve, { key: 0 }, Se(u.content, (l) => (m(), Y(S, we({
|
|
399
402
|
key: `${l.id}-${l.type}`
|
|
400
|
-
}, { ref_for: !0 }, l), null, 16))), 128)) : (
|
|
403
|
+
}, { ref_for: !0 }, l), null, 16))), 128)) : (m(), I("span", we({
|
|
401
404
|
key: 1,
|
|
402
|
-
"data-id":
|
|
403
|
-
"data-type":
|
|
404
|
-
},
|
|
405
|
-
(
|
|
405
|
+
"data-id": u.id,
|
|
406
|
+
"data-type": u.type
|
|
407
|
+
}, _(a)), [
|
|
408
|
+
(m(!0), I(ve, null, Se(u.content, (l) => (m(), Y(S, we({
|
|
406
409
|
key: `${l.id}-${l.type}`
|
|
407
410
|
}, { ref_for: !0 }, l), null, 16))), 128))
|
|
408
411
|
], 16, Lt))
|
|
409
412
|
], 64));
|
|
410
413
|
};
|
|
411
414
|
}
|
|
412
|
-
}), Kt = /* @__PURE__ */
|
|
415
|
+
}), Kt = /* @__PURE__ */ _e(Dt, [["__scopeId", "data-v-13862606"]]), At = { class: "editor-container" }, Me = "", Pt = /* @__PURE__ */ xe({
|
|
413
416
|
__name: "TemplateEditor",
|
|
414
417
|
props: {
|
|
415
418
|
modelValue: { default: () => [] },
|
|
416
419
|
modelModifiers: {}
|
|
417
420
|
},
|
|
418
421
|
emits: /* @__PURE__ */ lt(["submit"], ["update:modelValue"]),
|
|
419
|
-
setup(
|
|
420
|
-
const
|
|
422
|
+
setup(t, { expose: u, emit: a }) {
|
|
423
|
+
const c = typeof window.ShadowRoot.prototype.getSelection == "function", y = typeof window.Selection.prototype.getComposedRanges == "function";
|
|
421
424
|
function S() {
|
|
422
425
|
const e = navigator.userAgent;
|
|
423
426
|
return e.includes("Safari") && !e.includes("Chrome") && !e.includes("Chromium") && !e.includes("CriOS");
|
|
424
427
|
}
|
|
425
|
-
const l = S(),
|
|
426
|
-
id:
|
|
427
|
-
...
|
|
428
|
-
})),
|
|
428
|
+
const l = S(), f = () => Math.random().toString(36).substring(2, 15), C = Me, h = Me, b = Me, v = it(t, "modelValue"), K = a, V = A(0), F = (e) => e.map((n) => ({
|
|
429
|
+
id: n.id || f(),
|
|
430
|
+
...n.type === "template" ? { ...n, prefix: h, suffix: b } : n
|
|
431
|
+
})), M = (e) => e.map((n) => ({ id: n.id, type: n.type, content: n.content })), T = A(F(v.value || [])), H = (e) => {
|
|
429
432
|
T.value = e;
|
|
430
|
-
},
|
|
431
|
-
const e = [],
|
|
432
|
-
if (
|
|
433
|
-
const
|
|
434
|
-
|
|
435
|
-
const
|
|
436
|
-
|
|
433
|
+
}, x = B(() => {
|
|
434
|
+
const e = [], n = [], o = T.value;
|
|
435
|
+
if (o.length >= 2) {
|
|
436
|
+
const i = o[0], p = o[1];
|
|
437
|
+
i.type === "text" && i.content.length === 0 && p.type === "template" && e.push({ ...i, content: C });
|
|
438
|
+
const w = o[o.length - 1], E = o[o.length - 2];
|
|
439
|
+
w.type === "text" && w.content.length === 0 && E.type === "template" && n.push({ ...w, content: C });
|
|
437
440
|
}
|
|
438
|
-
|
|
439
|
-
const
|
|
440
|
-
return
|
|
441
|
-
}),
|
|
441
|
+
o.length > 0 && o[0].type === "template" && e.push({ type: "text", content: C, id: f() }), o.length > 0 && o[o.length - 1].type === "template" && n.push({ type: "text", content: C, id: f() });
|
|
442
|
+
const r = new RegExp(C, "g");
|
|
443
|
+
return o.length > 0 && (o[0].content !== C && (o[0].content = o[0].content.replace(r, "")), o[o.length - 1].content !== C && (o[o.length - 1].content = o[o.length - 1].content.replace(r, ""))), e.concat(o).concat(n);
|
|
444
|
+
}), d = B(() => T.value.map((e) => e.type === "template" ? [
|
|
442
445
|
{ id: e.id, type: "prefix", content: e.prefix },
|
|
443
446
|
{ id: e.id, type: "template", content: e.content },
|
|
444
447
|
{ id: e.id, type: "suffix", content: e.suffix }
|
|
445
|
-
] : [e]).flat()),
|
|
448
|
+
] : [e]).flat()), P = B(() => x.value.map((e) => e.type === "text" ? e : l ? {
|
|
446
449
|
id: e.id,
|
|
447
450
|
type: "block",
|
|
448
451
|
asChild: !0,
|
|
@@ -472,95 +475,95 @@ const Bt = ["data-id", "data-type"], Lt = ["data-id", "data-type"], Dt = /* @__P
|
|
|
472
475
|
},
|
|
473
476
|
{ id: e.id, type: "suffix", content: e.suffix }
|
|
474
477
|
]
|
|
475
|
-
})),
|
|
476
|
-
const
|
|
477
|
-
return `${
|
|
478
|
+
})), O = A(null), z = (e) => {
|
|
479
|
+
const n = Date.now(), o = JSON.stringify(e);
|
|
480
|
+
return `${n}:${o}`;
|
|
478
481
|
}, ee = (e) => {
|
|
479
|
-
const
|
|
482
|
+
const n = parseInt(e.slice(0, 13)), o = JSON.parse(e.slice(14));
|
|
480
483
|
return {
|
|
481
|
-
timestamp:
|
|
482
|
-
data:
|
|
484
|
+
timestamp: n,
|
|
485
|
+
data: o
|
|
483
486
|
};
|
|
484
|
-
},
|
|
487
|
+
}, U = /* @__PURE__ */ new Map(), k = $t(z(T.value), {
|
|
485
488
|
onRemoveHistory: (e) => {
|
|
486
|
-
for (const
|
|
487
|
-
|
|
489
|
+
for (const n of e)
|
|
490
|
+
U.delete(n);
|
|
488
491
|
}
|
|
489
492
|
});
|
|
490
493
|
ne(
|
|
491
494
|
() => v.value,
|
|
492
495
|
(e) => {
|
|
493
|
-
const
|
|
494
|
-
if (JSON.stringify(
|
|
495
|
-
if (
|
|
496
|
-
const
|
|
497
|
-
|
|
496
|
+
const n = F(e || []);
|
|
497
|
+
if (JSON.stringify(n) !== JSON.stringify(T.value)) {
|
|
498
|
+
if (O.value) {
|
|
499
|
+
const r = le(O.value);
|
|
500
|
+
r && U.set(k.get(), Z(r));
|
|
498
501
|
}
|
|
499
|
-
|
|
502
|
+
H(n), k.commit(z(T.value));
|
|
500
503
|
}
|
|
501
504
|
},
|
|
502
505
|
{ deep: !0 }
|
|
503
506
|
);
|
|
504
|
-
const
|
|
505
|
-
const
|
|
506
|
-
if (!
|
|
507
|
+
const J = (e, n = document.body) => n.contains(e) ? e instanceof HTMLElement && e.dataset.id ? e : e.parentElement ? J(e.parentElement, n) : null : null, X = (e) => e === O.value, le = (e) => {
|
|
508
|
+
const n = window.getSelection();
|
|
509
|
+
if (!n)
|
|
507
510
|
return null;
|
|
508
|
-
const
|
|
509
|
-
if (!(
|
|
510
|
-
return
|
|
511
|
+
const o = n.rangeCount > 0 ? n.getRangeAt(0) : null, r = e.getRootNode();
|
|
512
|
+
if (!(r instanceof ShadowRoot))
|
|
513
|
+
return o;
|
|
511
514
|
if (y) {
|
|
512
|
-
const
|
|
513
|
-
return (
|
|
515
|
+
const i = n.getComposedRanges(l ? r : { shadowRoots: [r] });
|
|
516
|
+
return (i == null ? void 0 : i[0]) ?? null;
|
|
514
517
|
}
|
|
515
|
-
if (
|
|
516
|
-
const
|
|
517
|
-
return
|
|
518
|
+
if (c) {
|
|
519
|
+
const i = r.getSelection();
|
|
520
|
+
return i.rangeCount > 0 ? i.getRangeAt(0) : null;
|
|
518
521
|
}
|
|
519
|
-
return
|
|
520
|
-
}, W = (e,
|
|
521
|
-
var
|
|
522
|
+
return o;
|
|
523
|
+
}, W = (e, n) => {
|
|
524
|
+
var r;
|
|
522
525
|
if (!e.firstChild || e.firstChild.nodeType !== Node.TEXT_NODE)
|
|
523
526
|
return { node: e, offset: 0 };
|
|
524
|
-
const
|
|
525
|
-
return { node: e.firstChild, offset: Math.min(
|
|
526
|
-
},
|
|
527
|
-
const
|
|
528
|
-
if (!
|
|
527
|
+
const o = ((r = e.firstChild.textContent) == null ? void 0 : r.length) ?? 0;
|
|
528
|
+
return { node: e.firstChild, offset: Math.min(n, o) };
|
|
529
|
+
}, G = (e, n, o, r) => {
|
|
530
|
+
const i = window.getSelection();
|
|
531
|
+
if (!i)
|
|
529
532
|
return;
|
|
530
|
-
const { node:
|
|
531
|
-
if (!
|
|
532
|
-
|
|
533
|
+
const { node: p, offset: w } = W(e, n);
|
|
534
|
+
if (!o) {
|
|
535
|
+
i.setBaseAndExtent(p, w, p, w);
|
|
533
536
|
return;
|
|
534
537
|
}
|
|
535
|
-
const { node:
|
|
536
|
-
|
|
537
|
-
}, ye = (e,
|
|
538
|
-
const
|
|
539
|
-
if (
|
|
540
|
-
const
|
|
541
|
-
|
|
542
|
-
T.value.slice(0,
|
|
543
|
-
), k.commit(
|
|
538
|
+
const { node: E, offset: j } = W(o, r ?? 0);
|
|
539
|
+
i.setBaseAndExtent(p, w, E, j);
|
|
540
|
+
}, ye = (e, n) => {
|
|
541
|
+
const o = f(), r = { id: o, type: "text", content: e };
|
|
542
|
+
if (n) {
|
|
543
|
+
const i = T.value.findIndex((p) => p.id === n);
|
|
544
|
+
i !== -1 ? (H(
|
|
545
|
+
T.value.slice(0, i + 1).concat(r).concat(T.value.slice(i + 1))
|
|
546
|
+
), k.commit(z(T.value))) : console.warn(`can not find item with id: ${n}`);
|
|
544
547
|
} else
|
|
545
|
-
|
|
548
|
+
H([r].concat(T.value)), k.commit(z(T.value));
|
|
546
549
|
te(() => {
|
|
547
|
-
var
|
|
548
|
-
const
|
|
549
|
-
|
|
550
|
-
}), v.value =
|
|
551
|
-
}, se =
|
|
550
|
+
var p;
|
|
551
|
+
const i = (p = O.value) == null ? void 0 : p.querySelector(`[data-id="${o}"][data-type="text"]`);
|
|
552
|
+
i && G(i, e.length);
|
|
553
|
+
}), v.value = M(T.value);
|
|
554
|
+
}, se = A({
|
|
552
555
|
hasStarted: !1,
|
|
553
556
|
range: null
|
|
554
|
-
}),
|
|
555
|
-
var
|
|
556
|
-
const
|
|
557
|
+
}), Ce = (e) => {
|
|
558
|
+
var E;
|
|
559
|
+
const n = e;
|
|
557
560
|
e.preventDefault();
|
|
558
|
-
const { inputType:
|
|
559
|
-
if (!
|
|
560
|
-
console.warn("range is null",
|
|
561
|
+
const { inputType: o } = n, r = (n.data || ((E = n.dataTransfer) == null ? void 0 : E.getData("text/plain")) || "").replace(h, "").replace(b, ""), i = n.getTargetRanges()[0];
|
|
562
|
+
if (!i) {
|
|
563
|
+
console.warn("range is null", i);
|
|
561
564
|
return;
|
|
562
565
|
}
|
|
563
|
-
const
|
|
566
|
+
const p = [
|
|
564
567
|
"insertText",
|
|
565
568
|
"insertFromPaste",
|
|
566
569
|
"insertReplacementText",
|
|
@@ -571,323 +574,323 @@ const Bt = ["data-id", "data-type"], Lt = ["data-id", "data-type"], Dt = /* @__P
|
|
|
571
574
|
"deleteSoftLineBackward",
|
|
572
575
|
"deleteSoftLineForward",
|
|
573
576
|
"deleteByCut"
|
|
574
|
-
],
|
|
575
|
-
if (
|
|
576
|
-
if (
|
|
577
|
-
|
|
577
|
+
], w = le(O.value);
|
|
578
|
+
if (p.includes(o)) {
|
|
579
|
+
if (r && X(i.startContainer) && X(i.endContainer)) {
|
|
580
|
+
w && U.set(k.get(), Z(w)), ye(r);
|
|
578
581
|
return;
|
|
579
582
|
}
|
|
580
|
-
const
|
|
581
|
-
|
|
582
|
-
} else
|
|
583
|
-
},
|
|
584
|
-
const
|
|
583
|
+
const j = Z(i);
|
|
584
|
+
j.startId && j.endId ? (w && U.set(k.get(), Z(w)), ue(j, o, r)) : console.warn("range is not valid, range:", j);
|
|
585
|
+
} else o === "insertCompositionText" && se.value.hasStarted && (se.value = { hasStarted: !1, range: Z(i) });
|
|
586
|
+
}, Z = (e) => {
|
|
587
|
+
const n = J(e.startContainer, O.value), o = J(e.endContainer, O.value);
|
|
585
588
|
return {
|
|
586
589
|
collapsed: e.collapsed,
|
|
587
590
|
endContainer: e.endContainer,
|
|
588
|
-
endId:
|
|
589
|
-
endEl:
|
|
591
|
+
endId: o == null ? void 0 : o.dataset.id,
|
|
592
|
+
endEl: o,
|
|
590
593
|
endOffset: e.endOffset,
|
|
591
|
-
endType:
|
|
594
|
+
endType: o == null ? void 0 : o.dataset.type,
|
|
592
595
|
startContainer: e.startContainer,
|
|
593
|
-
startId:
|
|
594
|
-
startEl:
|
|
596
|
+
startId: n == null ? void 0 : n.dataset.id,
|
|
597
|
+
startEl: n,
|
|
595
598
|
startOffset: e.startOffset,
|
|
596
|
-
startType:
|
|
599
|
+
startType: n == null ? void 0 : n.dataset.type
|
|
597
600
|
};
|
|
598
|
-
}, ke = (e,
|
|
599
|
-
const
|
|
600
|
-
if (!Array.isArray(
|
|
601
|
+
}, ke = (e, n, o, r) => e.slice(0, o) + n + e.slice(r), ue = (e, n, o) => {
|
|
602
|
+
const r = Le(e);
|
|
603
|
+
if (!Array.isArray(r) || r.length === 0)
|
|
601
604
|
return;
|
|
602
|
-
const
|
|
603
|
-
if (
|
|
604
|
-
const { afterId:
|
|
605
|
-
ye(
|
|
605
|
+
const i = De(r, e, n, o);
|
|
606
|
+
if (i.some((R) => R.tag === "new")) {
|
|
607
|
+
const { afterId: R, content: $ } = i[0];
|
|
608
|
+
ye($, R);
|
|
606
609
|
return;
|
|
607
610
|
}
|
|
608
|
-
const
|
|
609
|
-
for (const [
|
|
610
|
-
const
|
|
611
|
-
|
|
611
|
+
const p = i, w = [];
|
|
612
|
+
for (const [R, $] of p.entries()) {
|
|
613
|
+
const L = T.value.find((g) => g.id === $.id), s = R === 0 ? o : "";
|
|
614
|
+
L ? L.type === "text" ? L.content = ke(L.content, s, $.startOffset, $.endOffset) : L.type === "template" ? $.type === "prefix" || $.type === "suffix" ? $.startOffset === 0 && $.endOffset === 1 && s.length === 0 ? L[$.type] = "" : console.warn(`${$.type} can not be inserted text. it only can be deleted`, $) : $.startOffset < 0 || $.endOffset > L.content.length ? w.push(L.id) : L.content = ke(L.content, s, $.startOffset, $.endOffset) : console.warn("dataItem.type is not text or template", L) : console.warn("can not find dataItem", $);
|
|
612
615
|
}
|
|
613
|
-
let
|
|
614
|
-
|
|
615
|
-
const
|
|
616
|
-
|
|
617
|
-
if (
|
|
618
|
-
if (
|
|
619
|
-
const
|
|
620
|
-
if (
|
|
616
|
+
let E = T.value.filter((R) => !w.includes(R.id));
|
|
617
|
+
E = E.filter((R) => !(R.type === "template" && [R.prefix, R.suffix, R.content].join("").length === 0));
|
|
618
|
+
const j = /* @__PURE__ */ new Set();
|
|
619
|
+
E.forEach((R, $, L) => {
|
|
620
|
+
if (L.length >= 2) {
|
|
621
|
+
if ($ === 0 || $ === 1) {
|
|
622
|
+
const s = L[0], g = L[1];
|
|
623
|
+
if (s.type === "text" && s.content.length === 0 && g.type === "template")
|
|
621
624
|
return;
|
|
622
625
|
}
|
|
623
|
-
if (
|
|
624
|
-
const
|
|
625
|
-
if (
|
|
626
|
+
if ($ === L.length - 2 || $ === L.length - 1) {
|
|
627
|
+
const s = L[L.length - 1], g = L[L.length - 2];
|
|
628
|
+
if (s.type === "text" && s.content.length === 0 && g.type === "template")
|
|
626
629
|
return;
|
|
627
630
|
}
|
|
628
631
|
}
|
|
629
|
-
|
|
630
|
-
}),
|
|
631
|
-
for (const
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
}, ge = (e,
|
|
635
|
-
const
|
|
632
|
+
R.type === "text" && R.content.length === 0 && j.add(R.id);
|
|
633
|
+
}), E = E.filter((R) => !j.has(R.id));
|
|
634
|
+
for (const R of E.filter(($) => $.type === "template"))
|
|
635
|
+
R.prefix.length === 0 && (R.prefix = h), R.suffix.length === 0 && (R.suffix = b);
|
|
636
|
+
H(E), k.commit(z(T.value)), p.length > 0 && ge(p, o), v.value = M(T.value);
|
|
637
|
+
}, ge = (e, n) => {
|
|
638
|
+
const o = e[0], r = `[data-id="${o.id}"][data-type="${o.type}"]`, i = e.slice(1).map((p) => `[data-id="${p.id}"][data-type="${p.type}"]`);
|
|
636
639
|
te(() => {
|
|
637
|
-
var
|
|
638
|
-
const
|
|
639
|
-
if (
|
|
640
|
-
|
|
641
|
-
else if (
|
|
642
|
-
for (const
|
|
643
|
-
const
|
|
644
|
-
if (
|
|
645
|
-
|
|
640
|
+
var w, E;
|
|
641
|
+
const p = (w = O.value) == null ? void 0 : w.querySelector(r);
|
|
642
|
+
if (p)
|
|
643
|
+
G(p, o.startOffset + n.length);
|
|
644
|
+
else if (n.length === 0)
|
|
645
|
+
for (const j of i) {
|
|
646
|
+
const R = (E = O.value) == null ? void 0 : E.querySelector(j);
|
|
647
|
+
if (R) {
|
|
648
|
+
G(R, 0);
|
|
646
649
|
break;
|
|
647
650
|
}
|
|
648
651
|
}
|
|
649
652
|
else
|
|
650
|
-
console.warn(`can not find el with selector: ${
|
|
653
|
+
console.warn(`can not find el with selector: ${r}`);
|
|
651
654
|
});
|
|
652
655
|
}, Le = (e) => {
|
|
653
|
-
const
|
|
654
|
-
if (
|
|
656
|
+
const n = d.value.findIndex((w) => w.id === e.startId && w.type === e.startType), o = d.value.findIndex((w) => w.id === e.endId && w.type === e.endType);
|
|
657
|
+
if (n === -1 || o === -1 || n > o)
|
|
655
658
|
return console.warn("startIndex or endIndex is -1, or startIndex > endIndex. ", { range: e }), null;
|
|
656
|
-
const
|
|
657
|
-
if (
|
|
659
|
+
const r = d.value[n], i = d.value[o];
|
|
660
|
+
if (n === o)
|
|
658
661
|
return [
|
|
659
662
|
{
|
|
660
|
-
id:
|
|
661
|
-
type:
|
|
663
|
+
id: r.id,
|
|
664
|
+
type: r.type,
|
|
662
665
|
startOffset: e.startOffset,
|
|
663
666
|
endOffset: e.endOffset
|
|
664
667
|
}
|
|
665
668
|
];
|
|
666
|
-
const
|
|
669
|
+
const p = [
|
|
667
670
|
{
|
|
668
|
-
id:
|
|
669
|
-
type:
|
|
671
|
+
id: r.id,
|
|
672
|
+
type: r.type,
|
|
670
673
|
startOffset: e.startOffset,
|
|
671
|
-
endOffset:
|
|
674
|
+
endOffset: r.content.length
|
|
672
675
|
}
|
|
673
676
|
];
|
|
674
|
-
for (let
|
|
675
|
-
const
|
|
676
|
-
|
|
677
|
-
id:
|
|
678
|
-
type:
|
|
677
|
+
for (let w = n + 1; w < o; w++) {
|
|
678
|
+
const E = d.value[w];
|
|
679
|
+
p.push({
|
|
680
|
+
id: E.id,
|
|
681
|
+
type: E.type,
|
|
679
682
|
startOffset: 0,
|
|
680
|
-
endOffset:
|
|
683
|
+
endOffset: E.content.length
|
|
681
684
|
});
|
|
682
685
|
}
|
|
683
|
-
return
|
|
684
|
-
id:
|
|
685
|
-
type:
|
|
686
|
+
return p.push({
|
|
687
|
+
id: i.id,
|
|
688
|
+
type: i.type,
|
|
686
689
|
startOffset: 0,
|
|
687
690
|
endOffset: e.endOffset
|
|
688
|
-
}),
|
|
689
|
-
}, De = (e,
|
|
690
|
-
const
|
|
691
|
-
if (
|
|
691
|
+
}), p;
|
|
692
|
+
}, De = (e, n, o, r) => {
|
|
693
|
+
const i = e[0];
|
|
694
|
+
if (i.type !== "prefix" && i.type !== "suffix")
|
|
692
695
|
return e;
|
|
693
696
|
if (e.length === 1) {
|
|
694
|
-
if (
|
|
695
|
-
if (
|
|
696
|
-
const
|
|
697
|
-
return
|
|
697
|
+
if (n.collapsed)
|
|
698
|
+
if (n.startOffset === 0) {
|
|
699
|
+
const p = ae(i, r);
|
|
700
|
+
return p ? [p] : [];
|
|
698
701
|
} else {
|
|
699
|
-
const
|
|
700
|
-
return
|
|
702
|
+
const p = de(i, r);
|
|
703
|
+
return p ? [p] : [];
|
|
701
704
|
}
|
|
702
|
-
if (
|
|
705
|
+
if (o.startsWith("insert"))
|
|
703
706
|
if (l) {
|
|
704
|
-
const
|
|
705
|
-
return
|
|
707
|
+
const p = ae(i, r);
|
|
708
|
+
return p ? [p] : [];
|
|
706
709
|
} else {
|
|
707
|
-
const
|
|
708
|
-
return
|
|
710
|
+
const p = de(i, r);
|
|
711
|
+
return p ? [p] : [];
|
|
709
712
|
}
|
|
710
|
-
if (
|
|
711
|
-
if (
|
|
712
|
-
const
|
|
713
|
-
return
|
|
714
|
-
} else if (
|
|
715
|
-
const
|
|
716
|
-
return
|
|
713
|
+
if (o.startsWith("delete")) {
|
|
714
|
+
if (o.includes("Backward")) {
|
|
715
|
+
const p = ae(i, r, 1);
|
|
716
|
+
return p ? [p] : [];
|
|
717
|
+
} else if (o.includes("Forward")) {
|
|
718
|
+
const p = de(i, r, 1);
|
|
719
|
+
return p ? [p] : [];
|
|
717
720
|
}
|
|
718
721
|
}
|
|
719
722
|
}
|
|
720
|
-
return
|
|
721
|
-
}, ae = (e,
|
|
722
|
-
const
|
|
723
|
-
if (
|
|
724
|
-
const
|
|
725
|
-
if (
|
|
723
|
+
return r.length > 0 ? e.slice(1) : e;
|
|
724
|
+
}, ae = (e, n, o = 0) => {
|
|
725
|
+
const r = d.value.findIndex((i) => i.id === e.id && i.type === e.type);
|
|
726
|
+
if (r > 0) {
|
|
727
|
+
const i = d.value[r - 1], { id: p, type: w, content: E } = i;
|
|
728
|
+
if (w === "text" || w === "template")
|
|
726
729
|
return {
|
|
727
|
-
id:
|
|
728
|
-
type:
|
|
729
|
-
startOffset:
|
|
730
|
-
endOffset:
|
|
730
|
+
id: p,
|
|
731
|
+
type: w,
|
|
732
|
+
startOffset: E.length - o,
|
|
733
|
+
endOffset: E.length
|
|
731
734
|
};
|
|
732
|
-
if (
|
|
733
|
-
return { tag: "new", afterId:
|
|
734
|
-
if (console.warn("the previous item is not text or template", { current: e, previous:
|
|
735
|
+
if (n.length > 0)
|
|
736
|
+
return { tag: "new", afterId: p, type: "text", content: n };
|
|
737
|
+
if (console.warn("the previous item is not text or template", { current: e, previous: i }), o === 1)
|
|
735
738
|
return { ...e, endOffset: e.startOffset };
|
|
736
|
-
} else return
|
|
739
|
+
} else return n.length > 0 ? { tag: "new", type: "text", content: n } : (console.warn("the previous item of current is not found", { current: e }), null);
|
|
737
740
|
return e;
|
|
738
|
-
}, de = (e,
|
|
739
|
-
const
|
|
740
|
-
if (
|
|
741
|
-
const
|
|
742
|
-
if (
|
|
741
|
+
}, de = (e, n, o = 0) => {
|
|
742
|
+
const r = d.value.findIndex((i) => i.id === e.id && i.type === e.type);
|
|
743
|
+
if (r < d.value.length - 1) {
|
|
744
|
+
const i = d.value[r + 1], { id: p, type: w } = i;
|
|
745
|
+
if (w === "text" || w === "template")
|
|
743
746
|
return {
|
|
744
|
-
id:
|
|
745
|
-
type:
|
|
747
|
+
id: p,
|
|
748
|
+
type: w,
|
|
746
749
|
startOffset: 0,
|
|
747
|
-
endOffset: 0 +
|
|
750
|
+
endOffset: 0 + o
|
|
748
751
|
};
|
|
749
|
-
if (
|
|
750
|
-
return { tag: "new", afterId: e.id, type: "text", content:
|
|
751
|
-
if (console.warn("the next item is not text or template", { current: e, next:
|
|
752
|
+
if (n.length > 0)
|
|
753
|
+
return { tag: "new", afterId: e.id, type: "text", content: n };
|
|
754
|
+
if (console.warn("the next item is not text or template", { current: e, next: i }), o === 1)
|
|
752
755
|
return { ...e, startOffset: e.endOffset };
|
|
753
|
-
} else return
|
|
756
|
+
} else return n.length > 0 ? { tag: "new", afterId: e.id, type: "text", content: n } : (console.warn("the next item of current is not found", { current: e }), null);
|
|
754
757
|
return e;
|
|
755
758
|
}, Ie = () => {
|
|
756
759
|
se.value = { hasStarted: !0, range: null };
|
|
757
760
|
}, me = (e) => {
|
|
758
|
-
const
|
|
759
|
-
|
|
761
|
+
const n = se.value.range;
|
|
762
|
+
n ? (e.data && X(n.startContainer) && X(n.endContainer) ? (U.set(k.get(), Z(n)), ye(e.data)) : n.startId && n.endId ? (U.set(k.get(), Z(n)), ue(n, "insertCompositionText", e.data)) : console.warn("range is not valid, range:", n), V.value++) : console.warn("range is null, compositionEnd:", e), se.value = { hasStarted: !1, range: null };
|
|
760
763
|
}, fe = (() => {
|
|
761
764
|
const e = navigator.userAgent.toLowerCase();
|
|
762
765
|
return /macintosh|mac os x|iphone|ipad|ipod/.test(e);
|
|
763
766
|
})(), pe = (e) => {
|
|
764
|
-
const
|
|
765
|
-
!fe && e.ctrlKey && !e.shiftKey && e.key.toLowerCase() === "z",
|
|
766
|
-
!fe && e.ctrlKey && (e.key.toLowerCase() === "y" || e.shiftKey && e.key.toLowerCase() === "z"),
|
|
767
|
-
if (
|
|
767
|
+
const n = fe && e.metaKey && !e.shiftKey && e.key.toLowerCase() === "z" || // Cmd+Z
|
|
768
|
+
!fe && e.ctrlKey && !e.shiftKey && e.key.toLowerCase() === "z", o = fe && e.metaKey && e.shiftKey && e.key.toLowerCase() === "z" || // Cmd+Shift+z
|
|
769
|
+
!fe && e.ctrlKey && (e.key.toLowerCase() === "y" || e.shiftKey && e.key.toLowerCase() === "z"), r = e.key.toLowerCase() === "enter";
|
|
770
|
+
if (n) {
|
|
768
771
|
e.preventDefault();
|
|
769
|
-
const
|
|
770
|
-
|
|
771
|
-
const
|
|
772
|
-
|
|
772
|
+
const i = le(O.value);
|
|
773
|
+
i && U.set(k.get(), Z(i));
|
|
774
|
+
const p = k.undo();
|
|
775
|
+
p && Te(p);
|
|
773
776
|
}
|
|
774
|
-
if (
|
|
777
|
+
if (o) {
|
|
775
778
|
e.preventDefault();
|
|
776
|
-
const
|
|
777
|
-
|
|
779
|
+
const i = k.redo();
|
|
780
|
+
i && Te(i);
|
|
778
781
|
}
|
|
779
|
-
|
|
782
|
+
r && (e.preventDefault(), K("submit"));
|
|
780
783
|
}, Te = (e) => {
|
|
781
|
-
const { data:
|
|
782
|
-
if (
|
|
783
|
-
const
|
|
784
|
+
const { data: n } = ee(e);
|
|
785
|
+
if (H(n), U.has(e)) {
|
|
786
|
+
const o = U.get(e);
|
|
784
787
|
te(() => {
|
|
785
|
-
const
|
|
786
|
-
|
|
788
|
+
const r = O.value.querySelector(`[data-id="${o.startId}"][data-type="${o.startType}"]`), i = O.value.querySelector(`[data-id="${o.endId}"][data-type="${o.endType}"]`);
|
|
789
|
+
r && G(r, o.startOffset, i, o.endOffset);
|
|
787
790
|
});
|
|
788
791
|
}
|
|
789
|
-
v.value =
|
|
790
|
-
}, Re = (e,
|
|
791
|
-
var
|
|
792
|
-
const
|
|
793
|
-
if (!
|
|
794
|
-
const
|
|
795
|
-
|
|
792
|
+
v.value = M(T.value);
|
|
793
|
+
}, Re = (e, n) => {
|
|
794
|
+
var i, p;
|
|
795
|
+
const o = (i = O.value) == null ? void 0 : i.querySelector(`[data-id="${e}"][data-type="${n}"]`);
|
|
796
|
+
if (!o) return;
|
|
797
|
+
const r = ((p = o.textContent) == null ? void 0 : p.length) || 0;
|
|
798
|
+
G(o, r);
|
|
796
799
|
}, Ke = () => {
|
|
797
|
-
|
|
798
|
-
const e = T.value,
|
|
799
|
-
|
|
800
|
+
O.value && te(() => {
|
|
801
|
+
const e = T.value, n = e.find((r) => r.type === "template");
|
|
802
|
+
n && Re(n.id, "template"), e.every((r) => r.type === "text") && e.length === 1 && Re(e[0].id, "text");
|
|
800
803
|
});
|
|
801
804
|
}, Ae = () => {
|
|
802
|
-
k.clear(),
|
|
805
|
+
k.clear(), U.clear();
|
|
803
806
|
}, Oe = () => {
|
|
804
|
-
if (!
|
|
807
|
+
if (!O.value || se.value.range)
|
|
805
808
|
return;
|
|
806
|
-
const e = le(
|
|
807
|
-
if (e != null && e.collapsed &&
|
|
808
|
-
const
|
|
809
|
-
if (
|
|
810
|
-
|
|
809
|
+
const e = le(O.value);
|
|
810
|
+
if (e != null && e.collapsed && x.value.length > 0) {
|
|
811
|
+
const n = Z(e), o = x.value[0];
|
|
812
|
+
if (n.startEl && n.startId === o.id && n.startOffset === 0 && o.content === C && o.type === "text") {
|
|
813
|
+
G(n.startEl, 1);
|
|
811
814
|
return;
|
|
812
815
|
}
|
|
813
|
-
const
|
|
814
|
-
if (
|
|
815
|
-
|
|
816
|
+
const r = x.value[x.value.length - 1];
|
|
817
|
+
if (n.endEl && n.endId === r.id && n.endOffset === 1 && r.content === C && r.type === "text") {
|
|
818
|
+
G(n.endEl, 0);
|
|
816
819
|
return;
|
|
817
820
|
}
|
|
818
821
|
}
|
|
819
822
|
};
|
|
820
|
-
return
|
|
823
|
+
return rt(() => {
|
|
821
824
|
document.addEventListener("selectionchange", Oe);
|
|
822
|
-
}),
|
|
825
|
+
}), ct(() => {
|
|
823
826
|
document.removeEventListener("selectionchange", Oe);
|
|
824
|
-
}),
|
|
827
|
+
}), u({
|
|
825
828
|
clearHistory: Ae,
|
|
826
829
|
activateFirstField: Ke
|
|
827
|
-
}), (e,
|
|
828
|
-
(
|
|
830
|
+
}), (e, n) => (m(), I("div", At, [
|
|
831
|
+
(m(), I("div", {
|
|
829
832
|
contenteditable: "true",
|
|
830
833
|
ref_key: "editorRef",
|
|
831
|
-
ref:
|
|
834
|
+
ref: O,
|
|
832
835
|
key: V.value,
|
|
833
836
|
class: "editor",
|
|
834
|
-
onBeforeinput:
|
|
837
|
+
onBeforeinput: Ce,
|
|
835
838
|
onCompositionstart: Ie,
|
|
836
839
|
onCompositionend: me,
|
|
837
840
|
onKeydown: pe
|
|
838
841
|
}, [
|
|
839
|
-
(
|
|
840
|
-
key: `${
|
|
841
|
-
}, { ref_for: !0 },
|
|
842
|
+
(m(!0), I(ve, null, Se(P.value, (o) => (m(), Y(Kt, we({
|
|
843
|
+
key: `${o.id}-${o.type}`
|
|
844
|
+
}, { ref_for: !0 }, o), null, 16))), 128))
|
|
842
845
|
], 32))
|
|
843
846
|
]));
|
|
844
847
|
}
|
|
845
|
-
}),
|
|
846
|
-
if (!
|
|
847
|
-
return [{ text:
|
|
848
|
-
const
|
|
849
|
-
for (const l of
|
|
848
|
+
}), Ft = /* @__PURE__ */ _e(Pt, [["__scopeId", "data-v-5fda773e"]]), Xe = (t, u) => {
|
|
849
|
+
if (!u.length)
|
|
850
|
+
return [{ text: t, isMatch: !1 }];
|
|
851
|
+
const a = [];
|
|
852
|
+
for (const l of u) {
|
|
850
853
|
if (!l) continue;
|
|
851
|
-
let
|
|
852
|
-
const
|
|
854
|
+
let f = 0;
|
|
855
|
+
const C = t.toLowerCase(), h = l.toLowerCase();
|
|
853
856
|
for (; ; ) {
|
|
854
|
-
const
|
|
855
|
-
if (
|
|
856
|
-
|
|
857
|
-
start:
|
|
858
|
-
end:
|
|
859
|
-
}),
|
|
857
|
+
const b = C.indexOf(h, f);
|
|
858
|
+
if (b === -1) break;
|
|
859
|
+
a.push({
|
|
860
|
+
start: b,
|
|
861
|
+
end: b + l.length
|
|
862
|
+
}), f = b + 1;
|
|
860
863
|
}
|
|
861
864
|
}
|
|
862
|
-
if (
|
|
863
|
-
return [{ text:
|
|
864
|
-
|
|
865
|
-
const
|
|
866
|
-
for (const l of
|
|
867
|
-
if (
|
|
868
|
-
|
|
865
|
+
if (a.length === 0)
|
|
866
|
+
return [{ text: t, isMatch: !1 }];
|
|
867
|
+
a.sort((l, f) => l.start - f.start);
|
|
868
|
+
const c = [];
|
|
869
|
+
for (const l of a)
|
|
870
|
+
if (c.length === 0)
|
|
871
|
+
c.push(l);
|
|
869
872
|
else {
|
|
870
|
-
const
|
|
871
|
-
l.start <=
|
|
873
|
+
const f = c[c.length - 1];
|
|
874
|
+
l.start <= f.end ? f.end = Math.max(f.end, l.end) : c.push(l);
|
|
872
875
|
}
|
|
873
876
|
const y = [];
|
|
874
877
|
let S = 0;
|
|
875
|
-
for (const l of
|
|
878
|
+
for (const l of c)
|
|
876
879
|
S < l.start && y.push({
|
|
877
|
-
text:
|
|
880
|
+
text: t.substring(S, l.start),
|
|
878
881
|
isMatch: !1
|
|
879
882
|
}), y.push({
|
|
880
|
-
text:
|
|
883
|
+
text: t.substring(l.start, l.end),
|
|
881
884
|
isMatch: !0
|
|
882
885
|
}), S = l.end;
|
|
883
|
-
return S <
|
|
884
|
-
text:
|
|
886
|
+
return S < t.length && y.push({
|
|
887
|
+
text: t.substring(S),
|
|
885
888
|
isMatch: !1
|
|
886
889
|
}), y;
|
|
887
|
-
},
|
|
888
|
-
const { content:
|
|
889
|
-
return typeof
|
|
890
|
-
}, Wt = ["onMouseenter", "onMousedown"], Nt = { class: "suggestion-list__text" }, Ht = /* @__PURE__ */
|
|
890
|
+
}, Mt = (t, u) => !u || !t ? [{ text: t, isMatch: !1 }] : Xe(t, [u]), Vt = (t, u) => {
|
|
891
|
+
const { content: a, highlights: c } = t;
|
|
892
|
+
return typeof c == "function" ? c(a, u) : Array.isArray(c) ? Xe(a, c) : Mt(a, u);
|
|
893
|
+
}, Wt = ["onMouseenter", "onMousedown"], Nt = { class: "suggestion-list__text" }, Ht = /* @__PURE__ */ xe({
|
|
891
894
|
__name: "SuggestionList",
|
|
892
895
|
props: {
|
|
893
896
|
show: { type: Boolean },
|
|
@@ -898,47 +901,47 @@ const Bt = ["data-id", "data-type"], Lt = ["data-id", "data-type"], Dt = /* @__P
|
|
|
898
901
|
inputValue: {}
|
|
899
902
|
},
|
|
900
903
|
emits: ["select", "mouse-enter", "mouse-leave"],
|
|
901
|
-
setup(
|
|
902
|
-
const
|
|
903
|
-
|
|
904
|
-
},
|
|
905
|
-
|
|
906
|
-
},
|
|
907
|
-
|
|
904
|
+
setup(t, { emit: u }) {
|
|
905
|
+
const a = t, c = u, y = A(null), S = (h) => h === a.activeKeyboardIndex || h === a.activeMouseIndex, l = (h) => {
|
|
906
|
+
c("mouse-enter", h);
|
|
907
|
+
}, f = () => {
|
|
908
|
+
c("mouse-leave");
|
|
909
|
+
}, C = (h) => {
|
|
910
|
+
c("select", h);
|
|
908
911
|
};
|
|
909
912
|
return ne(
|
|
910
|
-
() =>
|
|
913
|
+
() => a.activeKeyboardIndex,
|
|
911
914
|
(h) => {
|
|
912
915
|
if (h !== -1 && y.value) {
|
|
913
|
-
const
|
|
914
|
-
|
|
916
|
+
const b = y.value.children[h];
|
|
917
|
+
b && b.scrollIntoView({ block: "nearest" });
|
|
915
918
|
}
|
|
916
919
|
}
|
|
917
|
-
), (h,
|
|
920
|
+
), (h, b) => (m(), Y(Ve, { name: "tiny-sender-slide-up" }, {
|
|
918
921
|
default: he(() => [
|
|
919
|
-
|
|
922
|
+
a.show && a.suggestions.length ? (m(), I("div", {
|
|
920
923
|
key: 0,
|
|
921
924
|
ref_key: "suggestionsListRef",
|
|
922
925
|
ref: y,
|
|
923
926
|
class: "suggestion-list",
|
|
924
|
-
style: Je(
|
|
927
|
+
style: Je(a.popupStyle)
|
|
925
928
|
}, [
|
|
926
|
-
(
|
|
927
|
-
key:
|
|
928
|
-
class: oe(["suggestion-list__item", { highlighted: S(
|
|
929
|
-
onMouseenter: (V) => l(
|
|
930
|
-
onMouseleave:
|
|
931
|
-
onMousedown:
|
|
929
|
+
(m(!0), I(ve, null, Se(a.suggestions, (v, K) => (m(), I("div", {
|
|
930
|
+
key: K,
|
|
931
|
+
class: oe(["suggestion-list__item", { highlighted: S(K) }]),
|
|
932
|
+
onMouseenter: (V) => l(K),
|
|
933
|
+
onMouseleave: f,
|
|
934
|
+
onMousedown: ut((V) => C(v.content), ["prevent"])
|
|
932
935
|
}, [
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
(
|
|
936
|
-
key:
|
|
936
|
+
Q(_(St), { class: "suggestion-list__icon" }),
|
|
937
|
+
q("span", Nt, [
|
|
938
|
+
(m(!0), I(ve, null, Se(_(Vt)(v, a.inputValue), (V, F) => (m(), I("span", {
|
|
939
|
+
key: F,
|
|
937
940
|
class: oe({
|
|
938
941
|
"suggestion-list__text--match": V.isMatch,
|
|
939
942
|
"suggestion-list__text--normal": !V.isMatch
|
|
940
943
|
})
|
|
941
|
-
},
|
|
944
|
+
}, ce(V.text), 3))), 128))
|
|
942
945
|
])
|
|
943
946
|
], 42, Wt))), 128))
|
|
944
947
|
], 4)) : N("", !0)
|
|
@@ -946,7 +949,7 @@ const Bt = ["data-id", "data-type"], Lt = ["data-id", "data-type"], Dt = /* @__P
|
|
|
946
949
|
_: 1
|
|
947
950
|
}));
|
|
948
951
|
}
|
|
949
|
-
}), Ut = /* @__PURE__ */
|
|
952
|
+
}), Ut = /* @__PURE__ */ _e(Ht, [["__scopeId", "data-v-e0ec9fe3"]]), qt = ["data-theme"], zt = { class: "tiny-sender__container" }, Gt = {
|
|
950
953
|
key: 0,
|
|
951
954
|
class: "tiny-sender__header-slot"
|
|
952
955
|
}, jt = {
|
|
@@ -973,10 +976,10 @@ const Bt = ["data-id", "data-type"], Lt = ["data-id", "data-type"], Dt = /* @__P
|
|
|
973
976
|
}, on = { class: "tiny-sender__footer-left" }, sn = { class: "tiny-sender__footer-right" }, an = { class: "real-word-length" }, ln = {
|
|
974
977
|
key: 1,
|
|
975
978
|
class: "tiny-sender__toolbar"
|
|
976
|
-
}, rn = { class: "tiny-sender__buttons-container" },
|
|
979
|
+
}, rn = { class: "tiny-sender__buttons-container" }, cn = {
|
|
977
980
|
key: 1,
|
|
978
981
|
class: "tiny-sender__footer-slot"
|
|
979
|
-
},
|
|
982
|
+
}, un = /* @__PURE__ */ xe({
|
|
980
983
|
__name: "index",
|
|
981
984
|
props: {
|
|
982
985
|
autofocus: { type: Boolean, default: !1 },
|
|
@@ -1003,65 +1006,65 @@ const Bt = ["data-id", "data-type"], Lt = ["data-id", "data-type"], Dt = /* @__P
|
|
|
1003
1006
|
stopText: { default: "" }
|
|
1004
1007
|
},
|
|
1005
1008
|
emits: ["update:modelValue", "update:templateData", "submit", "clear", "speech-start", "speech-end", "speech-interim", "speech-error", "suggestion-select", "focus", "blur", "escape-press", "cancel", "reset-template", "files-selected"],
|
|
1006
|
-
setup(
|
|
1007
|
-
var
|
|
1008
|
-
const
|
|
1009
|
-
var
|
|
1010
|
-
return !(
|
|
1009
|
+
setup(t, { expose: u, emit: a }) {
|
|
1010
|
+
var L;
|
|
1011
|
+
const c = t, y = a, S = A(null), l = A(null), f = A(null), C = A(null), h = A(null), b = B(() => c.templateData && c.templateData.length > 0), { inputValue: v, isComposing: K, clearInput: V } = _t(c, y), F = B(() => !!v.value.trim()), M = B(() => {
|
|
1012
|
+
var s, g;
|
|
1013
|
+
return !(c.disabled || c.loading || !F.value || be.value || (g = (s = c.buttonGroup) == null ? void 0 : s.submit) != null && g.disabled);
|
|
1011
1014
|
}), {
|
|
1012
1015
|
isPopupVisible: T,
|
|
1013
|
-
activeSuggestion:
|
|
1014
|
-
activeKeyboardIndex:
|
|
1015
|
-
activeMouseIndex:
|
|
1016
|
-
autoCompleteText:
|
|
1017
|
-
showTabIndicator:
|
|
1018
|
-
syncAutoComplete:
|
|
1016
|
+
activeSuggestion: H,
|
|
1017
|
+
activeKeyboardIndex: x,
|
|
1018
|
+
activeMouseIndex: d,
|
|
1019
|
+
autoCompleteText: P,
|
|
1020
|
+
showTabIndicator: O,
|
|
1021
|
+
syncAutoComplete: z,
|
|
1019
1022
|
closePopup: ee,
|
|
1020
|
-
applySuggestion:
|
|
1023
|
+
applySuggestion: U,
|
|
1021
1024
|
confirmSelection: k,
|
|
1022
|
-
navigateWithKeyboard:
|
|
1023
|
-
handleMouseEnter:
|
|
1025
|
+
navigateWithKeyboard: J,
|
|
1026
|
+
handleMouseEnter: X,
|
|
1024
1027
|
handleMouseLeave: le
|
|
1025
1028
|
} = It(
|
|
1026
|
-
|
|
1029
|
+
B(() => c.suggestions),
|
|
1027
1030
|
v,
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
(
|
|
1031
|
-
(
|
|
1032
|
-
), W =
|
|
1031
|
+
K,
|
|
1032
|
+
b,
|
|
1033
|
+
(s) => y("update:modelValue", s),
|
|
1034
|
+
(s) => y("suggestion-select", s)
|
|
1035
|
+
), W = A(c.mode), G = A(!1), ye = () => {
|
|
1033
1036
|
W.value === "single" && (W.value = "multiple", te(() => {
|
|
1034
1037
|
setTimeout(() => {
|
|
1035
|
-
const
|
|
1036
|
-
if (
|
|
1037
|
-
|
|
1038
|
-
const
|
|
1039
|
-
|
|
1038
|
+
const s = document.querySelector(".tiny-textarea__inner");
|
|
1039
|
+
if (s) {
|
|
1040
|
+
s.style.whiteSpace = "pre-wrap";
|
|
1041
|
+
const g = v.value.length;
|
|
1042
|
+
s.focus(), s.setSelectionRange(g, g);
|
|
1040
1043
|
}
|
|
1041
1044
|
}, 50);
|
|
1042
1045
|
}));
|
|
1043
|
-
}, se = (
|
|
1044
|
-
const
|
|
1045
|
-
|
|
1046
|
-
const
|
|
1047
|
-
return document.body.removeChild(
|
|
1048
|
-
},
|
|
1046
|
+
}, se = (s, g) => {
|
|
1047
|
+
const D = document.createElement("span");
|
|
1048
|
+
D.style.visibility = "hidden", D.style.position = "absolute", D.style.whiteSpace = "nowrap", D.style.font = g, D.textContent = s, document.body.appendChild(D);
|
|
1049
|
+
const ie = D.offsetWidth;
|
|
1050
|
+
return document.body.removeChild(D), ie;
|
|
1051
|
+
}, Ce = () => {
|
|
1049
1052
|
var Ee, He, Ue;
|
|
1050
|
-
if (
|
|
1051
|
-
const
|
|
1052
|
-
if (!
|
|
1053
|
-
const
|
|
1054
|
-
if (!
|
|
1053
|
+
if (c.mode !== "single" || !S.value || G.value || !l.value || !C.value) return;
|
|
1054
|
+
const s = l.value.querySelector(".tiny-sender__content-area");
|
|
1055
|
+
if (!s) return;
|
|
1056
|
+
const g = ((He = (Ee = S.value) == null ? void 0 : Ee.querySelector) == null ? void 0 : He.call(Ee, ".tiny-input__inner")) || s.querySelector(".tiny-input__inner"), D = h.value || l.value.querySelector(".tiny-sender__buttons-container");
|
|
1057
|
+
if (!g) {
|
|
1055
1058
|
console.warn("Cannot find input element for overflow check");
|
|
1056
1059
|
return;
|
|
1057
1060
|
}
|
|
1058
|
-
const
|
|
1059
|
-
if (
|
|
1060
|
-
setTimeout(() =>
|
|
1061
|
+
const ie = g.getBoundingClientRect(), Pe = D == null ? void 0 : D.getBoundingClientRect();
|
|
1062
|
+
if (ie.width === 0) {
|
|
1063
|
+
setTimeout(() => Ce(), 50);
|
|
1061
1064
|
return;
|
|
1062
1065
|
}
|
|
1063
|
-
const Ze = window.getComputedStyle(
|
|
1064
|
-
Qe > Ne && Ne > nt && W.value === "single" && (
|
|
1066
|
+
const Ze = window.getComputedStyle(g).font, Qe = se(v.value, Ze), We = (Ue = l.value) == null ? void 0 : Ue.classList.contains("tr-sender-compact"), Ye = We ? 12 : 20, et = ie.width, tt = (Pe == null ? void 0 : Pe.width) || 0, Ne = et - tt - Ye, nt = We ? 50 : 80;
|
|
1067
|
+
Qe > Ne && Ne > nt && W.value === "single" && (G.value = !0, W.value = "multiple", te(() => {
|
|
1065
1068
|
S.value ? setTimeout(() => {
|
|
1066
1069
|
var qe;
|
|
1067
1070
|
const $e = (qe = l.value) == null ? void 0 : qe.querySelector(".tiny-textarea__inner");
|
|
@@ -1070,280 +1073,280 @@ const Bt = ["data-id", "data-type"], Lt = ["data-id", "data-type"], Dt = /* @__P
|
|
|
1070
1073
|
const ze = v.value.length;
|
|
1071
1074
|
$e.focus(), $e.setSelectionRange(ze, ze);
|
|
1072
1075
|
}
|
|
1073
|
-
|
|
1074
|
-
}, 300) :
|
|
1076
|
+
G.value = !1;
|
|
1077
|
+
}, 300) : G.value = !1;
|
|
1075
1078
|
}));
|
|
1076
|
-
},
|
|
1077
|
-
if (
|
|
1078
|
-
|
|
1079
|
+
}, Z = () => {
|
|
1080
|
+
if (b.value && f.value)
|
|
1081
|
+
p();
|
|
1079
1082
|
else if (S.value)
|
|
1080
1083
|
S.value.focus();
|
|
1081
1084
|
else {
|
|
1082
|
-
const
|
|
1083
|
-
|
|
1085
|
+
const s = document.querySelector(".tiny-input__inner");
|
|
1086
|
+
s == null || s.focus();
|
|
1084
1087
|
}
|
|
1085
1088
|
}, ke = () => {
|
|
1086
1089
|
if (S.value)
|
|
1087
1090
|
S.value.blur();
|
|
1088
1091
|
else {
|
|
1089
|
-
const
|
|
1090
|
-
|
|
1092
|
+
const s = document.querySelector(".tiny-input__inner");
|
|
1093
|
+
s == null || s.blur();
|
|
1091
1094
|
}
|
|
1092
|
-
},
|
|
1093
|
-
var
|
|
1094
|
-
y("update:templateData", []), (
|
|
1095
|
-
v.value === "" && (W.value =
|
|
1096
|
-
|
|
1095
|
+
}, ue = () => {
|
|
1096
|
+
var s;
|
|
1097
|
+
y("update:templateData", []), (s = f.value) == null || s.clearHistory(), te(() => {
|
|
1098
|
+
v.value === "" && (W.value = c.mode || "single"), setTimeout(() => {
|
|
1099
|
+
Z();
|
|
1097
1100
|
}, 50);
|
|
1098
1101
|
});
|
|
1099
1102
|
}, ge = () => {
|
|
1100
|
-
var
|
|
1101
|
-
V(),
|
|
1102
|
-
v.value === "" && (W.value =
|
|
1103
|
+
var s;
|
|
1104
|
+
V(), b.value ? ue() : (s = l.value) == null || s.focus(), te(() => {
|
|
1105
|
+
v.value === "" && (W.value = c.mode || "single");
|
|
1103
1106
|
});
|
|
1104
|
-
}, Le = (
|
|
1105
|
-
const
|
|
1106
|
-
if (
|
|
1107
|
-
|
|
1107
|
+
}, Le = (s) => {
|
|
1108
|
+
const g = (ie) => ie.type === "text" && ie.content === "";
|
|
1109
|
+
if (s.length === 0 || s.every(g)) {
|
|
1110
|
+
ue();
|
|
1108
1111
|
return;
|
|
1109
1112
|
}
|
|
1110
|
-
y("update:templateData",
|
|
1113
|
+
y("update:templateData", s);
|
|
1111
1114
|
};
|
|
1112
1115
|
ne(
|
|
1113
|
-
() =>
|
|
1116
|
+
() => c.templateData,
|
|
1114
1117
|
() => {
|
|
1115
|
-
v.value =
|
|
1118
|
+
v.value = c.templateData.map((s) => s.content).join("");
|
|
1116
1119
|
},
|
|
1117
1120
|
{ deep: !0 }
|
|
1118
1121
|
);
|
|
1119
|
-
const De =
|
|
1120
|
-
const
|
|
1122
|
+
const De = B(() => {
|
|
1123
|
+
const s = typeof c.speech == "object" ? c.speech : {};
|
|
1121
1124
|
return {
|
|
1122
|
-
...
|
|
1125
|
+
...s,
|
|
1123
1126
|
onStart: () => y("speech-start"),
|
|
1124
|
-
onEnd: (
|
|
1125
|
-
onInterim: (
|
|
1126
|
-
onFinal: (
|
|
1127
|
-
if (
|
|
1128
|
-
v.value =
|
|
1127
|
+
onEnd: (g) => y("speech-end", g),
|
|
1128
|
+
onInterim: (g) => y("speech-interim", g),
|
|
1129
|
+
onFinal: (g) => {
|
|
1130
|
+
if (s.autoReplace)
|
|
1131
|
+
v.value = g;
|
|
1129
1132
|
else {
|
|
1130
|
-
const
|
|
1131
|
-
|
|
1133
|
+
const D = v.value;
|
|
1134
|
+
D && g && !D.endsWith(" ") && !g.startsWith(" ") && D.length > 0 ? v.value = D + " " + g : v.value = D + g;
|
|
1132
1135
|
}
|
|
1133
|
-
y("speech-end",
|
|
1136
|
+
y("speech-end", g);
|
|
1134
1137
|
},
|
|
1135
|
-
onError: (
|
|
1136
|
-
y("speech-error",
|
|
1138
|
+
onError: (g) => {
|
|
1139
|
+
y("speech-error", g);
|
|
1137
1140
|
}
|
|
1138
1141
|
};
|
|
1139
1142
|
}), { speechState: ae, start: de, stop: Ie } = kt(De.value), me = () => {
|
|
1140
1143
|
ae.isRecording ? Ie() : de();
|
|
1141
|
-
}, be =
|
|
1142
|
-
|
|
1144
|
+
}, be = B(() => c.maxLength !== 1 / 0 && v.value.length > c.maxLength), { handleKeyPress: fe, triggerSubmit: pe } = Ct(
|
|
1145
|
+
c,
|
|
1143
1146
|
y,
|
|
1144
1147
|
v,
|
|
1145
|
-
|
|
1148
|
+
K,
|
|
1146
1149
|
ae,
|
|
1147
1150
|
T,
|
|
1148
|
-
|
|
1151
|
+
H,
|
|
1149
1152
|
k,
|
|
1150
1153
|
ee,
|
|
1151
|
-
|
|
1154
|
+
J,
|
|
1152
1155
|
me,
|
|
1153
|
-
|
|
1156
|
+
M,
|
|
1154
1157
|
W,
|
|
1155
1158
|
ye,
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
), Te = (
|
|
1159
|
-
y("focus",
|
|
1160
|
-
}, Re = (
|
|
1161
|
-
y("blur",
|
|
1162
|
-
}, Ke =
|
|
1159
|
+
b,
|
|
1160
|
+
ue
|
|
1161
|
+
), Te = (s) => {
|
|
1162
|
+
y("focus", s), v.value && !b.value && (T.value = !0);
|
|
1163
|
+
}, Re = (s) => {
|
|
1164
|
+
y("blur", s), ee();
|
|
1165
|
+
}, Ke = B(() => W.value === "multiple" ? "textarea" : "text"), Ae = dt(), Oe = B(() => !!Ae.decorativeContent), e = B(() => c.disabled || Oe.value), n = B(() => c.loading), o = B(() => ({
|
|
1163
1166
|
"is-disabled": e.value,
|
|
1164
|
-
"is-loading":
|
|
1165
|
-
"is-auto-switching":
|
|
1166
|
-
})),
|
|
1167
|
-
width:
|
|
1167
|
+
"is-loading": n.value,
|
|
1168
|
+
"is-auto-switching": G.value
|
|
1169
|
+
})), r = B(() => ({
|
|
1170
|
+
width: xt(c.suggestionPopupWidth),
|
|
1168
1171
|
maxWidth: "100%"
|
|
1169
1172
|
// 确保不超出父容器宽度
|
|
1170
|
-
})),
|
|
1171
|
-
|
|
1173
|
+
})), i = () => {
|
|
1174
|
+
K.value = !1;
|
|
1172
1175
|
};
|
|
1173
1176
|
ne(v, () => {
|
|
1174
|
-
te(
|
|
1177
|
+
te(Ce), v.value === "" && c.mode === "single" && (W.value = "single"), z();
|
|
1175
1178
|
}), ne(
|
|
1176
|
-
() =>
|
|
1177
|
-
(
|
|
1178
|
-
|
|
1179
|
+
() => b.value,
|
|
1180
|
+
(s) => {
|
|
1181
|
+
s && (W.value = "multiple");
|
|
1179
1182
|
}
|
|
1180
1183
|
);
|
|
1181
|
-
const
|
|
1182
|
-
|
|
1183
|
-
}, { accept:
|
|
1184
|
-
return ne(
|
|
1185
|
-
|
|
1186
|
-
}),
|
|
1187
|
-
focus:
|
|
1184
|
+
const p = () => {
|
|
1185
|
+
f.value && f.value.activateFirstField();
|
|
1186
|
+
}, { accept: w = "*", multiple: E = !0, reset: j = !0 } = ((L = c.buttonGroup) == null ? void 0 : L.file) || {}, { open: R, files: $ } = ht({ accept: w, multiple: E, reset: j });
|
|
1187
|
+
return ne($, (s) => {
|
|
1188
|
+
s && s.length > 0 && y("files-selected", Array.from(s));
|
|
1189
|
+
}), u({
|
|
1190
|
+
focus: Z,
|
|
1188
1191
|
blur: ke,
|
|
1189
1192
|
clear: ge,
|
|
1190
1193
|
submit: pe,
|
|
1191
1194
|
startSpeech: de,
|
|
1192
1195
|
stopSpeech: Ie,
|
|
1193
|
-
activateTemplateFirstField:
|
|
1194
|
-
}), (
|
|
1196
|
+
activateTemplateFirstField: p
|
|
1197
|
+
}), (s, g) => (m(), I("div", {
|
|
1195
1198
|
ref_key: "senderRef",
|
|
1196
1199
|
ref: l,
|
|
1197
|
-
class: oe(["tiny-sender", [
|
|
1198
|
-
"data-theme":
|
|
1200
|
+
class: oe(["tiny-sender", [o.value, `theme-${t.theme}`, `mode-${W.value}`]]),
|
|
1201
|
+
"data-theme": t.theme
|
|
1199
1202
|
}, [
|
|
1200
|
-
|
|
1201
|
-
|
|
1203
|
+
q("div", zt, [
|
|
1204
|
+
q("div", {
|
|
1202
1205
|
class: "tiny-sender__input-wrapper",
|
|
1203
1206
|
ref_key: "inputWrapperRef",
|
|
1204
|
-
ref:
|
|
1207
|
+
ref: C
|
|
1205
1208
|
}, [
|
|
1206
|
-
|
|
1209
|
+
Q(Ve, { name: "tiny-sender-slide-down" }, {
|
|
1207
1210
|
default: he(() => [
|
|
1208
|
-
|
|
1209
|
-
|
|
1211
|
+
s.$slots.header ? (m(), I("div", Gt, [
|
|
1212
|
+
re(s.$slots, "header", {}, void 0, !0)
|
|
1210
1213
|
])) : N("", !0)
|
|
1211
1214
|
]),
|
|
1212
1215
|
_: 3
|
|
1213
1216
|
}),
|
|
1214
|
-
|
|
1215
|
-
class: oe(["tiny-sender__input-row", { "has-prefix":
|
|
1217
|
+
q("div", {
|
|
1218
|
+
class: oe(["tiny-sender__input-row", { "has-prefix": s.$slots.prefix, "has-header": s.$slots.header }])
|
|
1216
1219
|
}, [
|
|
1217
|
-
|
|
1218
|
-
|
|
1220
|
+
s.$slots.prefix ? (m(), I("div", jt, [
|
|
1221
|
+
re(s.$slots, "prefix", {}, void 0, !0)
|
|
1219
1222
|
])) : N("", !0),
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
+
q("div", Jt, [
|
|
1224
|
+
s.$slots.decorativeContent ? (m(), I("div", Xt, [
|
|
1225
|
+
re(s.$slots, "decorativeContent", {}, void 0, !0)
|
|
1223
1226
|
])) : N("", !0),
|
|
1224
|
-
|
|
1227
|
+
b.value ? (m(), Y(Ft, {
|
|
1225
1228
|
key: 1,
|
|
1226
1229
|
ref_key: "templateEditorRef",
|
|
1227
|
-
ref:
|
|
1228
|
-
"model-value":
|
|
1230
|
+
ref: f,
|
|
1231
|
+
"model-value": c.templateData,
|
|
1229
1232
|
"onUpdate:modelValue": Le,
|
|
1230
|
-
onSubmit:
|
|
1231
|
-
}, null, 8, ["model-value", "onSubmit"])) : (
|
|
1232
|
-
|
|
1233
|
+
onSubmit: _(pe)
|
|
1234
|
+
}, null, 8, ["model-value", "onSubmit"])) : (m(), I("div", Zt, [
|
|
1235
|
+
Q(_(pt), {
|
|
1233
1236
|
ref_key: "inputRef",
|
|
1234
1237
|
ref: S,
|
|
1235
|
-
autosize:
|
|
1238
|
+
autosize: t.autoSize,
|
|
1236
1239
|
type: Ke.value,
|
|
1237
1240
|
resize: "none",
|
|
1238
|
-
modelValue:
|
|
1239
|
-
"onUpdate:modelValue":
|
|
1241
|
+
modelValue: _(v),
|
|
1242
|
+
"onUpdate:modelValue": g[0] || (g[0] = (D) => ft(v) ? v.value = D : null),
|
|
1240
1243
|
disabled: e.value,
|
|
1241
|
-
placeholder:
|
|
1242
|
-
autofocus:
|
|
1243
|
-
onKeydown:
|
|
1244
|
-
onCompositionstart:
|
|
1245
|
-
onCompositionend:
|
|
1244
|
+
placeholder: t.placeholder,
|
|
1245
|
+
autofocus: t.autofocus,
|
|
1246
|
+
onKeydown: _(fe),
|
|
1247
|
+
onCompositionstart: g[1] || (g[1] = (D) => K.value = !0),
|
|
1248
|
+
onCompositionend: i,
|
|
1246
1249
|
onFocus: Te,
|
|
1247
1250
|
onBlur: Re
|
|
1248
1251
|
}, null, 8, ["autosize", "type", "modelValue", "disabled", "placeholder", "autofocus", "onKeydown"]),
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
Ge(
|
|
1252
|
-
|
|
1252
|
+
_(P) && !_(K) ? (m(), I("div", Qt, [
|
|
1253
|
+
q("span", Yt, ce(_(v)), 1),
|
|
1254
|
+
Ge(ce(_(P)) + " ", 1),
|
|
1255
|
+
_(O) ? (m(), I("div", en, "TAB")) : N("", !0)
|
|
1253
1256
|
])) : N("", !0)
|
|
1254
1257
|
]))
|
|
1255
1258
|
]),
|
|
1256
|
-
W.value === "single" ? (
|
|
1257
|
-
|
|
1259
|
+
W.value === "single" ? (m(), I("div", tn, [
|
|
1260
|
+
q("div", {
|
|
1258
1261
|
class: "tiny-sender__buttons-container",
|
|
1259
1262
|
ref_key: "buttonsContainerRef",
|
|
1260
1263
|
ref: h
|
|
1261
1264
|
}, [
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
"allow-speech":
|
|
1265
|
-
"allow-files":
|
|
1266
|
-
loading:
|
|
1265
|
+
re(s.$slots, "actions", {}, void 0, !0),
|
|
1266
|
+
Q(je, {
|
|
1267
|
+
"allow-speech": t.allowSpeech,
|
|
1268
|
+
"allow-files": t.allowFiles,
|
|
1269
|
+
loading: t.loading,
|
|
1267
1270
|
disabled: e.value,
|
|
1268
|
-
"show-clear":
|
|
1269
|
-
"has-content":
|
|
1270
|
-
"speech-status":
|
|
1271
|
-
"button-group":
|
|
1272
|
-
"submit-type":
|
|
1271
|
+
"show-clear": t.clearable,
|
|
1272
|
+
"has-content": F.value,
|
|
1273
|
+
"speech-status": _(ae),
|
|
1274
|
+
"button-group": t.buttonGroup,
|
|
1275
|
+
"submit-type": t.submitType,
|
|
1273
1276
|
"is-over-limit": be.value,
|
|
1274
|
-
"stop-text":
|
|
1277
|
+
"stop-text": t.stopText,
|
|
1275
1278
|
onClear: ge,
|
|
1276
1279
|
onToggleSpeech: me,
|
|
1277
|
-
onSubmit:
|
|
1278
|
-
onCancel:
|
|
1279
|
-
onTriggerSelect:
|
|
1280
|
+
onSubmit: _(pe),
|
|
1281
|
+
onCancel: g[2] || (g[2] = (D) => s.$emit("cancel")),
|
|
1282
|
+
onTriggerSelect: _(R)
|
|
1280
1283
|
}, null, 8, ["allow-speech", "allow-files", "loading", "disabled", "show-clear", "has-content", "speech-status", "button-group", "submit-type", "is-over-limit", "stop-text", "onSubmit", "onTriggerSelect"])
|
|
1281
1284
|
], 512)
|
|
1282
1285
|
])) : N("", !0)
|
|
1283
1286
|
], 2),
|
|
1284
|
-
|
|
1287
|
+
Q(Ve, { name: "tiny-sender-slide-up" }, {
|
|
1285
1288
|
default: he(() => [
|
|
1286
|
-
W.value === "multiple" ? (
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
+
W.value === "multiple" ? (m(), I("div", nn, [
|
|
1290
|
+
q("div", on, [
|
|
1291
|
+
re(s.$slots, "footer-left", {}, void 0, !0)
|
|
1289
1292
|
]),
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
+
q("div", sn, [
|
|
1294
|
+
re(s.$slots, "footer-right", {}, void 0, !0),
|
|
1295
|
+
t.showWordLimit && t.maxLength !== 1 / 0 ? (m(), I("div", {
|
|
1293
1296
|
key: 0,
|
|
1294
1297
|
class: oe(["tiny-sender__word-limit", { "is-over-limit": be.value }])
|
|
1295
1298
|
}, [
|
|
1296
|
-
|
|
1297
|
-
Ge("/" +
|
|
1299
|
+
q("span", an, ce(_(v).length), 1),
|
|
1300
|
+
Ge("/" + ce(t.maxLength), 1)
|
|
1298
1301
|
], 2)) : N("", !0),
|
|
1299
|
-
W.value === "multiple" ? (
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
"allow-speech":
|
|
1303
|
-
"allow-files":
|
|
1304
|
-
loading:
|
|
1302
|
+
W.value === "multiple" ? (m(), I("div", ln, [
|
|
1303
|
+
q("div", rn, [
|
|
1304
|
+
Q(je, {
|
|
1305
|
+
"allow-speech": t.allowSpeech,
|
|
1306
|
+
"allow-files": t.allowFiles,
|
|
1307
|
+
loading: t.loading,
|
|
1305
1308
|
disabled: e.value,
|
|
1306
|
-
"show-clear":
|
|
1307
|
-
"has-content":
|
|
1308
|
-
"speech-status":
|
|
1309
|
-
"button-group":
|
|
1310
|
-
"submit-type":
|
|
1309
|
+
"show-clear": t.clearable,
|
|
1310
|
+
"has-content": F.value,
|
|
1311
|
+
"speech-status": _(ae),
|
|
1312
|
+
"button-group": t.buttonGroup,
|
|
1313
|
+
"submit-type": t.submitType,
|
|
1311
1314
|
"is-over-limit": be.value,
|
|
1312
|
-
"stop-text":
|
|
1315
|
+
"stop-text": t.stopText,
|
|
1313
1316
|
onClear: ge,
|
|
1314
1317
|
onToggleSpeech: me,
|
|
1315
|
-
onSubmit:
|
|
1316
|
-
onCancel:
|
|
1317
|
-
onTriggerSelect:
|
|
1318
|
+
onSubmit: _(pe),
|
|
1319
|
+
onCancel: g[3] || (g[3] = (D) => s.$emit("cancel")),
|
|
1320
|
+
onTriggerSelect: _(R)
|
|
1318
1321
|
}, null, 8, ["allow-speech", "allow-files", "loading", "disabled", "show-clear", "has-content", "speech-status", "button-group", "submit-type", "is-over-limit", "stop-text", "onSubmit", "onTriggerSelect"])
|
|
1319
1322
|
])
|
|
1320
1323
|
])) : N("", !0)
|
|
1321
1324
|
])
|
|
1322
|
-
])) :
|
|
1323
|
-
|
|
1325
|
+
])) : s.$slots.footer ? (m(), I("div", cn, [
|
|
1326
|
+
re(s.$slots, "footer", {}, void 0, !0)
|
|
1324
1327
|
])) : N("", !0)
|
|
1325
1328
|
]),
|
|
1326
1329
|
_: 3
|
|
1327
1330
|
})
|
|
1328
1331
|
], 512)
|
|
1329
1332
|
]),
|
|
1330
|
-
|
|
1331
|
-
show:
|
|
1332
|
-
suggestions:
|
|
1333
|
-
"popup-style":
|
|
1334
|
-
"active-keyboard-index":
|
|
1335
|
-
"active-mouse-index":
|
|
1336
|
-
"input-value":
|
|
1337
|
-
onSelect:
|
|
1338
|
-
onMouseEnter:
|
|
1339
|
-
onMouseLeave:
|
|
1333
|
+
Q(Ut, {
|
|
1334
|
+
show: _(T),
|
|
1335
|
+
suggestions: t.suggestions,
|
|
1336
|
+
"popup-style": r.value,
|
|
1337
|
+
"active-keyboard-index": _(x),
|
|
1338
|
+
"active-mouse-index": _(d),
|
|
1339
|
+
"input-value": _(v),
|
|
1340
|
+
onSelect: _(U),
|
|
1341
|
+
onMouseEnter: _(X),
|
|
1342
|
+
onMouseLeave: _(le)
|
|
1340
1343
|
}, null, 8, ["show", "suggestions", "popup-style", "active-keyboard-index", "active-mouse-index", "input-value", "onSelect", "onMouseEnter", "onMouseLeave"])
|
|
1341
1344
|
], 10, qt));
|
|
1342
1345
|
}
|
|
1343
|
-
}), Be = /* @__PURE__ */
|
|
1346
|
+
}), Be = /* @__PURE__ */ _e(un, [["__scopeId", "data-v-ed19a136"]]);
|
|
1344
1347
|
Be.name = "TrSender";
|
|
1345
|
-
const dn = function(
|
|
1346
|
-
|
|
1348
|
+
const dn = function(t) {
|
|
1349
|
+
t.component(Be.name, Be);
|
|
1347
1350
|
};
|
|
1348
1351
|
Be.install = dn;
|
|
1349
1352
|
export {
|