@mobilon-dev/chotto 0.3.103 → 0.3.105
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/chotto.css +1 -1
- package/dist/components/2_feed_elements/AudioMessage/AudioMessage.vue.js +3 -3
- package/dist/components/2_feed_elements/AudioMessage/AudioMessage.vue2.js +164 -160
- package/dist/components/2_feed_elements/FileMessage/FileMessage.vue.js +2 -2
- package/dist/components/2_feed_elements/FileMessage/FileMessage.vue2.js +106 -102
- package/dist/components/2_feed_elements/ImageMessage/ImageMessage.vue.js +3 -3
- package/dist/components/2_feed_elements/ImageMessage/ImageMessage.vue2.js +121 -116
- package/dist/components/2_feed_elements/StickerMessage/StickerMessage.vue.js +3 -3
- package/dist/components/2_feed_elements/StickerMessage/StickerMessage.vue2.js +116 -111
- package/dist/components/2_feed_elements/TextMessage/TextMessage.vue.js +1 -1
- package/dist/components/2_feed_elements/TextMessage/TextMessage.vue2.js +153 -149
- package/dist/components/2_feed_elements/VideoMessage/VideoMessage.vue.js +3 -3
- package/dist/components/2_feed_elements/VideoMessage/VideoMessage.vue2.js +131 -126
- package/dist/components/3_compounds/ChatInput/ChatInput.vue.js +2 -2
- package/dist/components/3_compounds/ChatInput/ChatInput.vue2.js +189 -161
- package/dist/components/3_compounds/Feed/Feed.vue.js +2 -2
- package/dist/components/3_compounds/Feed/Feed.vue2.js +174 -170
- package/dist/components/3_compounds/Feed/composables/useFeedReply.js +10 -10
- package/dist/functions/isSmsChannel.js +19 -0
- package/dist/hooks/messages/canStartEditLastSent.js +16 -0
- package/dist/hooks/messages/useMessageHoverActions.js +13 -0
- package/dist/index.js +112 -103
- package/dist/types/components/3_compounds/ChatInput/ChatInput.vue.d.ts +13 -0
- package/dist/types/components/3_compounds/Feed/composables/useFeedReply.d.ts +2 -1
- package/dist/types/functions/index.d.ts +1 -0
- package/dist/types/functions/isSmsChannel.d.ts +8 -0
- package/dist/types/hooks/messages/canStartEditLastSent.d.ts +22 -0
- package/dist/types/hooks/messages/index.d.ts +2 -0
- package/dist/types/hooks/messages/useMessageHoverActions.d.ts +9 -0
- package/package.json +1 -1
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { useImmediateDebouncedRef as
|
|
3
|
-
import { MAX_ATTACHED_FILES as ie, useMessageDraft as
|
|
1
|
+
import { defineComponent as Ne, inject as je, watch as p, ref as S, computed as _, provide as $e, nextTick as b, unref as r, onMounted as Ge, onUnmounted as Oe, createElementBlock as C, openBlock as x, createElementVNode as f, createVNode as q, normalizeClass as O, toDisplayString as U, createCommentVNode as V, Fragment as Ue, renderList as Ve, createBlock as Ye, renderSlot as le, withDirectives as Xe, withKeys as Je, vModelText as Qe } from "vue";
|
|
2
|
+
import { useImmediateDebouncedRef as Ze } from "../../../hooks/useImmediateDebouncedRef.js";
|
|
3
|
+
import { MAX_ATTACHED_FILES as ie, useMessageDraft as et, getDraftFiles as tt, commitChatDraftToList as nt } from "../../../hooks/useMessageDraft.js";
|
|
4
4
|
import "../../../hooks/useSearchModel.js";
|
|
5
5
|
import "../../../hooks/useTheme.js";
|
|
6
|
-
import { useEmojiNative as
|
|
6
|
+
import { useEmojiNative as lt } from "../../../hooks/useEmojiNative.js";
|
|
7
7
|
/* empty css */
|
|
8
8
|
/* empty css */
|
|
9
9
|
import { t as h } from "../../../locale/useLocale.js";
|
|
@@ -11,19 +11,21 @@ import { t as h } from "../../../locale/useLocale.js";
|
|
|
11
11
|
import "../../../node_modules/linkifyjs/dist/linkify.js";
|
|
12
12
|
import "../../../node_modules/linkify-string/dist/linkify-string.js";
|
|
13
13
|
import "../../../functions/parseMarkdown.js";
|
|
14
|
-
import { textToAppleEmojiHtml as
|
|
15
|
-
import { hideEditPreview as
|
|
16
|
-
import
|
|
14
|
+
import { textToAppleEmojiHtml as it, textContainsEmoji as ot, previousGraphemeIndex as oe, nextGraphemeIndex as se, snapIndexToGrapheme as ae } from "../../../functions/renderAppleEmojis.js";
|
|
15
|
+
import { useStartEdit as st, hideEditPreview as at } from "../../../hooks/messages/useStartEdit.js";
|
|
16
|
+
import { canStartEditLastSent as rt, isEditableLastSentCandidate as ut } from "../../../hooks/messages/canStartEditLastSent.js";
|
|
17
|
+
import { buildEditPayload as ct } from "../../../hooks/messages/buildEditPayload.js";
|
|
18
|
+
import dt from "./icons/SendIcon.vue.js";
|
|
17
19
|
import re from "./icons/ArrowIcon.vue.js";
|
|
18
|
-
import
|
|
19
|
-
import
|
|
20
|
-
const
|
|
20
|
+
import ft from "../../2_chatinput_elements/TextFormatToolbar/TextFormatToolbar.vue.js";
|
|
21
|
+
import pt from "../../2_chatinput_elements/FilePreview/FilePreview.vue.js";
|
|
22
|
+
const ht = { class: "chat-input__container" }, mt = ["id"], vt = ["id"], gt = { class: "chat-input__file-counter" }, yt = { class: "chat-input__file-chips-wrap" }, St = ["aria-label"], _t = ["aria-label"], xt = { class: "chat-input__inline-buttons" }, It = {
|
|
21
23
|
key: 0,
|
|
22
24
|
class: "chat-input__input chat-input__disabled-placeholder"
|
|
23
|
-
},
|
|
25
|
+
}, bt = {
|
|
24
26
|
key: 1,
|
|
25
27
|
class: "chat-input__input-wrap"
|
|
26
|
-
},
|
|
28
|
+
}, Ct = ["innerHTML"], Ft = ["disabled", "placeholder"], Tt = ["disabled"], Et = { class: "" }, At = { class: "chat-input__third-line" }, Y = 40, Jt = /* @__PURE__ */ Ne({
|
|
27
29
|
__name: "ChatInput",
|
|
28
30
|
props: {
|
|
29
31
|
state: {
|
|
@@ -54,11 +56,16 @@ const rt = { class: "chat-input__container" }, ut = ["id"], ct = ["id"], dt = {
|
|
|
54
56
|
type: Number,
|
|
55
57
|
required: !1,
|
|
56
58
|
default: ie
|
|
59
|
+
},
|
|
60
|
+
resolveEditLastSentMessage: {
|
|
61
|
+
type: Function,
|
|
62
|
+
required: !1,
|
|
63
|
+
default: null
|
|
57
64
|
}
|
|
58
65
|
},
|
|
59
66
|
emits: ["send", "typing"],
|
|
60
|
-
setup(
|
|
61
|
-
const H = ue,
|
|
67
|
+
setup(M, { emit: ue }) {
|
|
68
|
+
const H = ue, F = je("chatAppId"), { resetMessage: ce, getMessage: o, setMessageText: D, setForceSendMessage: de, resetEdit: fe, removeMessageFile: pe } = et(F), { startEdit: he } = st(F), { isNative: me, emojiSrc: ve } = lt(F);
|
|
62
69
|
let X = o().id;
|
|
63
70
|
p(
|
|
64
71
|
() => o().id,
|
|
@@ -66,36 +73,36 @@ const rt = { class: "chat-input__container" }, ut = ["id"], ct = ["id"], dt = {
|
|
|
66
73
|
X = e;
|
|
67
74
|
}
|
|
68
75
|
);
|
|
69
|
-
const l =
|
|
76
|
+
const l = S(), T = S(), L = S(), E = S(null), R = S(!1), ge = Ze("", 2e3), z = S(!1), B = S(!1);
|
|
70
77
|
let m = null;
|
|
71
|
-
const v =
|
|
72
|
-
function
|
|
73
|
-
const e =
|
|
78
|
+
const v = _(() => tt(o()));
|
|
79
|
+
function K() {
|
|
80
|
+
const e = L.value;
|
|
74
81
|
if (!e) {
|
|
75
|
-
|
|
82
|
+
z.value = !1, B.value = !1;
|
|
76
83
|
return;
|
|
77
84
|
}
|
|
78
85
|
const t = e.scrollWidth - e.clientWidth;
|
|
79
|
-
|
|
86
|
+
z.value = e.scrollLeft > 1, B.value = t - e.scrollLeft > 1;
|
|
80
87
|
}
|
|
81
|
-
function
|
|
88
|
+
function ye(e) {
|
|
82
89
|
const t = e.firstElementChild;
|
|
83
90
|
if (!t) return e.clientWidth;
|
|
84
91
|
const n = parseFloat(getComputedStyle(e).gap) || 8;
|
|
85
92
|
return t.offsetWidth + n;
|
|
86
93
|
}
|
|
87
94
|
function J(e) {
|
|
88
|
-
const t =
|
|
95
|
+
const t = L.value;
|
|
89
96
|
if (!t) return;
|
|
90
|
-
const n =
|
|
97
|
+
const n = ye(t);
|
|
91
98
|
t.scrollBy({ left: e === "right" ? n : -n, behavior: "smooth" });
|
|
92
99
|
}
|
|
93
100
|
function Q() {
|
|
94
101
|
m == null || m.disconnect();
|
|
95
|
-
const e =
|
|
96
|
-
e && (m = new ResizeObserver(() =>
|
|
102
|
+
const e = L.value;
|
|
103
|
+
e && (m = new ResizeObserver(() => K()), m.observe(e));
|
|
97
104
|
}
|
|
98
|
-
function
|
|
105
|
+
function Se(e) {
|
|
99
106
|
return e.preview ?? {
|
|
100
107
|
isImage: !1,
|
|
101
108
|
isVideo: !1,
|
|
@@ -104,18 +111,18 @@ const rt = { class: "chat-input__container" }, ut = ["id"], ct = ["id"], dt = {
|
|
|
104
111
|
fileSize: ""
|
|
105
112
|
};
|
|
106
113
|
}
|
|
107
|
-
const _e =
|
|
108
|
-
() =>
|
|
109
|
-
), A =
|
|
110
|
-
() => !
|
|
114
|
+
const _e = _(
|
|
115
|
+
() => it(o().text || "", E.value, ve.value)
|
|
116
|
+
), A = _(
|
|
117
|
+
() => !me.value && ot(o().text || "")
|
|
111
118
|
), g = () => {
|
|
112
|
-
if (!
|
|
113
|
-
const e = l.value, t =
|
|
119
|
+
if (!T.value || !l.value) return;
|
|
120
|
+
const e = l.value, t = T.value, n = Math.max(0, e.offsetWidth - e.clientWidth);
|
|
114
121
|
t.style.right = n > 0 ? `${n}px` : "", t.scrollTop = e.scrollTop;
|
|
115
122
|
};
|
|
116
123
|
let w = 0;
|
|
117
|
-
function
|
|
118
|
-
|
|
124
|
+
function N() {
|
|
125
|
+
E.value = null;
|
|
119
126
|
}
|
|
120
127
|
function xe(e = "nearest") {
|
|
121
128
|
const t = l.value;
|
|
@@ -123,99 +130,120 @@ const rt = { class: "chat-input__container" }, ut = ["id"], ct = ["id"], dt = {
|
|
|
123
130
|
const n = t.value, i = ae(n, t.selectionStart, e), s = ae(n, t.selectionEnd, e);
|
|
124
131
|
(i !== t.selectionStart || s !== t.selectionEnd) && t.setSelectionRange(i, s);
|
|
125
132
|
}
|
|
126
|
-
function
|
|
133
|
+
function j() {
|
|
127
134
|
xe("nearest"), I();
|
|
128
135
|
}
|
|
129
|
-
function
|
|
130
|
-
|
|
136
|
+
function Ie(e) {
|
|
137
|
+
var s, u, c;
|
|
138
|
+
const t = o(), n = l.value;
|
|
139
|
+
if (!rt({
|
|
140
|
+
key: e.key,
|
|
141
|
+
altKey: e.altKey,
|
|
142
|
+
metaKey: e.metaKey,
|
|
143
|
+
ctrlKey: e.ctrlKey,
|
|
144
|
+
shiftKey: e.shiftKey,
|
|
145
|
+
hasResolver: typeof a.resolveEditLastSentMessage == "function",
|
|
146
|
+
disabled: a.state === "disabled",
|
|
147
|
+
isRecording: t.isRecording,
|
|
148
|
+
draftText: t.text ?? "",
|
|
149
|
+
replyMessageId: (s = t.reply) == null ? void 0 : s.messageId,
|
|
150
|
+
editMessageId: (u = t.edit) == null ? void 0 : u.messageId,
|
|
151
|
+
textareaText: (n == null ? void 0 : n.value) ?? t.text ?? "",
|
|
152
|
+
selectionStart: (n == null ? void 0 : n.selectionStart) ?? 0
|
|
153
|
+
})) return !1;
|
|
154
|
+
const i = (c = a.resolveEditLastSentMessage) == null ? void 0 : c.call(a);
|
|
155
|
+
return ut(i) ? (e.preventDefault(), he(ct(i)), !0) : !1;
|
|
156
|
+
}
|
|
157
|
+
function be(e) {
|
|
158
|
+
if (Ie(e) || !A.value || e.key !== "ArrowLeft" && e.key !== "ArrowRight" || e.altKey || e.metaKey || e.ctrlKey) return;
|
|
131
159
|
const t = l.value;
|
|
132
160
|
if (!t) return;
|
|
133
161
|
const n = t.value, i = t.selectionStart !== t.selectionEnd;
|
|
134
162
|
if (e.shiftKey) {
|
|
135
|
-
requestAnimationFrame(() =>
|
|
163
|
+
requestAnimationFrame(() => j());
|
|
136
164
|
return;
|
|
137
165
|
}
|
|
138
166
|
if (i) {
|
|
139
167
|
e.preventDefault();
|
|
140
|
-
const
|
|
168
|
+
const c = e.key === "ArrowLeft" ? t.selectionStart : t.selectionEnd, y = e.key === "ArrowLeft" ? oe(n, c) : se(n, c);
|
|
141
169
|
t.setSelectionRange(y, y), I();
|
|
142
170
|
return;
|
|
143
171
|
}
|
|
144
172
|
e.preventDefault();
|
|
145
|
-
const s = t.selectionStart,
|
|
146
|
-
t.setSelectionRange(
|
|
173
|
+
const s = t.selectionStart, u = e.key === "ArrowLeft" ? oe(n, s) : se(n, s);
|
|
174
|
+
t.setSelectionRange(u, u), I();
|
|
147
175
|
}
|
|
148
176
|
function I() {
|
|
149
177
|
if (!A.value) {
|
|
150
|
-
|
|
178
|
+
N();
|
|
151
179
|
return;
|
|
152
180
|
}
|
|
153
181
|
w && cancelAnimationFrame(w), w = requestAnimationFrame(() => {
|
|
154
|
-
var
|
|
182
|
+
var u;
|
|
155
183
|
w = 0;
|
|
156
184
|
const e = l.value;
|
|
157
185
|
if (!e) {
|
|
158
|
-
|
|
186
|
+
N();
|
|
159
187
|
return;
|
|
160
188
|
}
|
|
161
189
|
const t = e.selectionStart, n = e.selectionEnd;
|
|
162
190
|
if (t === n) {
|
|
163
|
-
|
|
191
|
+
E.value !== null && (E.value = null, b(g));
|
|
164
192
|
return;
|
|
165
193
|
}
|
|
166
|
-
const i =
|
|
194
|
+
const i = E.value;
|
|
167
195
|
if (i && i.start === t && i.end === n) return;
|
|
168
|
-
const s = ((
|
|
169
|
-
|
|
170
|
-
|
|
196
|
+
const s = ((u = T.value) == null ? void 0 : u.scrollTop) ?? 0;
|
|
197
|
+
E.value = { start: t, end: n }, b(() => {
|
|
198
|
+
T.value && (T.value.scrollTop = s), g();
|
|
171
199
|
});
|
|
172
200
|
});
|
|
173
201
|
}
|
|
174
|
-
function
|
|
202
|
+
function Ce(e) {
|
|
175
203
|
e.buttons && I();
|
|
176
204
|
}
|
|
177
205
|
function Z() {
|
|
178
206
|
document.activeElement === l.value && I();
|
|
179
207
|
}
|
|
180
|
-
const
|
|
181
|
-
const e = Number(
|
|
208
|
+
const a = M, ee = _(() => {
|
|
209
|
+
const e = Number(a.maxAttachedFiles);
|
|
182
210
|
return Number.isFinite(e) && e > 0 ? Math.floor(e) : ie;
|
|
183
211
|
});
|
|
184
|
-
|
|
185
|
-
const
|
|
212
|
+
$e("maxAttachedFiles", ee);
|
|
213
|
+
const Fe = _(
|
|
186
214
|
() => h("component.ChatInput.FilesSelectedCount").replace("{count}", String(v.value.length)).replace("{max}", String(ee.value))
|
|
187
|
-
),
|
|
215
|
+
), Te = _(() => !!(a.state == "disabled" || o().text == "" && !v.value.length || o().isRecording)), Ee = _(() => {
|
|
188
216
|
var t;
|
|
189
|
-
if (
|
|
190
|
-
return
|
|
191
|
-
if (!((t =
|
|
217
|
+
if (a.inputButtonColor)
|
|
218
|
+
return a.inputButtonColor;
|
|
219
|
+
if (!((t = a.selectedChannel) != null && t.channelId))
|
|
192
220
|
return "#25D366";
|
|
193
|
-
const e =
|
|
221
|
+
const e = a.selectedChannel.channelId.toLowerCase();
|
|
194
222
|
return e.includes("whatsapp") || e.includes("waba") ? "#25D366" : e.includes("telegram") ? "#37AFE2" : e.includes("sms") ? "#6C757D" : e.includes("max") ? "#4B0082" : "#25D366";
|
|
195
|
-
}),
|
|
223
|
+
}), Ae = _(() => {
|
|
196
224
|
var t;
|
|
197
|
-
if (!((t =
|
|
225
|
+
if (!((t = a.selectedChannel) != null && t.channelId))
|
|
198
226
|
return h("component.ChatInput.InputPlaceholder");
|
|
199
|
-
const e =
|
|
227
|
+
const e = a.selectedChannel.channelId.toLowerCase();
|
|
200
228
|
return e.includes("whatsapp") || e.includes("waba") ? h("component.ChatInput.WhatsappInputPlaceholder") : e.includes("telegram") ? h("component.ChatInput.TelegramInputPlaceholder") : e.includes("sms") ? h("component.ChatInput.SmsInputPlaceholder") : e.includes("max") ? h("component.ChatInput.MaxInputPlaceholder") : h("component.ChatInput.InputPlaceholder");
|
|
201
229
|
});
|
|
202
230
|
p(
|
|
203
|
-
() =>
|
|
231
|
+
() => ge.value,
|
|
204
232
|
() => {
|
|
205
233
|
H("typing");
|
|
206
234
|
}
|
|
207
235
|
);
|
|
208
236
|
function te(e = !1) {
|
|
209
237
|
b(() => {
|
|
210
|
-
if (e && !
|
|
238
|
+
if (e && !R.value) return;
|
|
211
239
|
const t = l.value;
|
|
212
|
-
t && (
|
|
240
|
+
t && (k(t), e && (R.value = !1), P(t), requestAnimationFrame(() => P(t)));
|
|
213
241
|
});
|
|
214
242
|
}
|
|
215
243
|
p(
|
|
216
244
|
() => o().edit,
|
|
217
245
|
(e) => {
|
|
218
|
-
(e == null ? void 0 : e.messageId) != null && (
|
|
246
|
+
(e == null ? void 0 : e.messageId) != null && (R.value = !0, te(!0));
|
|
219
247
|
}
|
|
220
248
|
), p(
|
|
221
249
|
() => o().reply,
|
|
@@ -223,10 +251,10 @@ const rt = { class: "chat-input__container" }, ut = ["id"], ct = ["id"], dt = {
|
|
|
223
251
|
(e == null ? void 0 : e.messageId) != null && te();
|
|
224
252
|
}
|
|
225
253
|
), p(
|
|
226
|
-
() =>
|
|
254
|
+
() => a.focusOnInputArea,
|
|
227
255
|
() => {
|
|
228
|
-
|
|
229
|
-
const e =
|
|
256
|
+
a.focusOnInputArea && b(() => {
|
|
257
|
+
const e = r(l);
|
|
230
258
|
e == null || e.focus();
|
|
231
259
|
});
|
|
232
260
|
},
|
|
@@ -235,16 +263,16 @@ const rt = { class: "chat-input__container" }, ut = ["id"], ct = ["id"], dt = {
|
|
|
235
263
|
() => o().text,
|
|
236
264
|
() => {
|
|
237
265
|
const e = l.value;
|
|
238
|
-
e && (
|
|
266
|
+
e && (k(e), R.value && (R.value = !1, P(e), requestAnimationFrame(() => P(e))));
|
|
239
267
|
},
|
|
240
268
|
{ immediate: !0, flush: "post" }
|
|
241
269
|
), p(
|
|
242
270
|
() => o().id,
|
|
243
271
|
() => {
|
|
244
272
|
const e = l.value;
|
|
245
|
-
e && (
|
|
273
|
+
e && (W(e), requestAnimationFrame(() => {
|
|
246
274
|
const t = l.value;
|
|
247
|
-
t &&
|
|
275
|
+
t && k(t);
|
|
248
276
|
}));
|
|
249
277
|
}
|
|
250
278
|
), p(A, (e) => {
|
|
@@ -252,39 +280,39 @@ const rt = { class: "chat-input__container" }, ut = ["id"], ct = ["id"], dt = {
|
|
|
252
280
|
const t = l.value;
|
|
253
281
|
if (!t) return;
|
|
254
282
|
const n = t.scrollTop;
|
|
255
|
-
|
|
283
|
+
k(t), t.scrollTop = n, g(), requestAnimationFrame(g);
|
|
256
284
|
});
|
|
257
285
|
});
|
|
258
|
-
function
|
|
286
|
+
function W(e) {
|
|
259
287
|
const t = o().inputHeight;
|
|
260
288
|
e.style.height = (t || Y) + "px", (!t || t <= Y) && (e.style.overflowY = "hidden");
|
|
261
289
|
}
|
|
262
|
-
function
|
|
290
|
+
function we(e) {
|
|
263
291
|
const t = parseFloat(e.style.height);
|
|
264
292
|
Number.isFinite(t) && (o().inputHeight = t);
|
|
265
293
|
}
|
|
266
|
-
function
|
|
294
|
+
function k(e) {
|
|
267
295
|
const t = o().text || "";
|
|
268
296
|
if (e.value !== t || e.clientWidth === 0) {
|
|
269
|
-
|
|
297
|
+
W(e);
|
|
270
298
|
return;
|
|
271
299
|
}
|
|
272
300
|
const n = e.scrollTop;
|
|
273
301
|
e.style.height = "auto";
|
|
274
|
-
const i = getComputedStyle(e), s = parseFloat(i.fontSize) || 16,
|
|
275
|
-
`).length > 1,
|
|
276
|
-
|
|
277
|
-
const
|
|
278
|
-
document.body.removeChild(
|
|
279
|
-
const
|
|
280
|
-
if (ne && G <=
|
|
281
|
-
|
|
302
|
+
const i = getComputedStyle(e), s = parseFloat(i.fontSize) || 16, u = parseFloat(i.lineHeight) || s * 1.4, c = Y, y = u * 11, G = e.scrollHeight, Ke = t.split(`
|
|
303
|
+
`).length > 1, d = document.createElement("div");
|
|
304
|
+
d.style.position = "absolute", d.style.visibility = "hidden", d.style.whiteSpace = "nowrap", d.style.font = i.font, d.style.fontSize = i.fontSize, d.style.fontFamily = i.fontFamily, d.style.fontWeight = i.fontWeight, d.style.letterSpacing = i.letterSpacing, d.textContent = t, document.body.appendChild(d);
|
|
305
|
+
const We = d.offsetWidth;
|
|
306
|
+
document.body.removeChild(d);
|
|
307
|
+
const Pe = parseFloat(i.paddingLeft) || 0, qe = parseFloat(i.paddingRight) || 0, ze = e.clientWidth - Pe - qe, Be = We > ze, ne = Ke || Be;
|
|
308
|
+
if (ne && G <= c + 1) {
|
|
309
|
+
W(e);
|
|
282
310
|
return;
|
|
283
311
|
}
|
|
284
|
-
t.trim() && ne ? G <= y ? (e.style.height = G + "px", e.style.overflowY = "hidden") : (e.style.height = y + "px", e.style.overflowY = "auto", e.scrollTop = n) : (e.style.height =
|
|
312
|
+
t.trim() && ne ? G <= y ? (e.style.height = G + "px", e.style.overflowY = "hidden") : (e.style.height = y + "px", e.style.overflowY = "auto", e.scrollTop = n) : (e.style.height = c + "px", e.style.overflowY = "hidden"), we(e), g(), requestAnimationFrame(g);
|
|
285
313
|
}
|
|
286
|
-
function
|
|
287
|
-
if (
|
|
314
|
+
function P(e) {
|
|
315
|
+
if (a.state === "disabled" || o().isRecording) return;
|
|
288
316
|
const t = e.value.length;
|
|
289
317
|
e.focus(), e.setSelectionRange(t, t), e.scrollTop = e.scrollHeight, g();
|
|
290
318
|
}
|
|
@@ -294,7 +322,7 @@ const rt = { class: "chat-input__container" }, ut = ["id"], ct = ["id"], dt = {
|
|
|
294
322
|
o().forceSend && ($(), de(!1));
|
|
295
323
|
}
|
|
296
324
|
);
|
|
297
|
-
const
|
|
325
|
+
const Me = (e) => {
|
|
298
326
|
const t = e.target;
|
|
299
327
|
H("typing", t.value), I();
|
|
300
328
|
};
|
|
@@ -302,19 +330,19 @@ const rt = { class: "chat-input__container" }, ut = ["id"], ct = ["id"], dt = {
|
|
|
302
330
|
v,
|
|
303
331
|
(e, t) => {
|
|
304
332
|
b(() => {
|
|
305
|
-
Q(),
|
|
306
|
-
const n =
|
|
333
|
+
Q(), K();
|
|
334
|
+
const n = L.value;
|
|
307
335
|
n && e.length > ((t == null ? void 0 : t.length) ?? 0) && n.scrollTo({ left: n.scrollWidth, behavior: "smooth" });
|
|
308
336
|
});
|
|
309
337
|
},
|
|
310
338
|
{ flush: "post" }
|
|
311
|
-
),
|
|
339
|
+
), Ge(() => {
|
|
312
340
|
const e = l.value;
|
|
313
|
-
e && (
|
|
314
|
-
}),
|
|
315
|
-
|
|
341
|
+
e && (W(e), k(e)), Q(), K(), document.addEventListener("selectionchange", Z);
|
|
342
|
+
}), Oe(() => {
|
|
343
|
+
nt(X), document.removeEventListener("selectionchange", Z), m == null || m.disconnect(), w && cancelAnimationFrame(w);
|
|
316
344
|
});
|
|
317
|
-
const
|
|
345
|
+
const Le = (e) => {
|
|
318
346
|
if (e.shiftKey) {
|
|
319
347
|
if (l.value instanceof HTMLTextAreaElement) {
|
|
320
348
|
let t = l.value.selectionStart;
|
|
@@ -331,7 +359,7 @@ const rt = { class: "chat-input__container" }, ut = ["id"], ct = ["id"], dt = {
|
|
|
331
359
|
e.preventDefault();
|
|
332
360
|
} else
|
|
333
361
|
e.preventDefault(), $();
|
|
334
|
-
},
|
|
362
|
+
}, Re = (e) => {
|
|
335
363
|
if (l.value) {
|
|
336
364
|
const t = l.value.value;
|
|
337
365
|
l.value.value = e.newText;
|
|
@@ -341,20 +369,20 @@ const rt = { class: "chat-input__container" }, ut = ["id"], ct = ["id"], dt = {
|
|
|
341
369
|
});
|
|
342
370
|
}
|
|
343
371
|
};
|
|
344
|
-
function
|
|
372
|
+
function ke(e) {
|
|
345
373
|
pe(e);
|
|
346
374
|
}
|
|
347
|
-
function
|
|
348
|
-
fe(), D(""),
|
|
375
|
+
function He() {
|
|
376
|
+
fe(), D(""), at(F), l.value && l.value.focus();
|
|
349
377
|
}
|
|
350
|
-
function
|
|
378
|
+
function De() {
|
|
351
379
|
const e = o();
|
|
352
380
|
return e.edit ? (e.text ?? "").trim() === (e.edit.text ?? "").trim() : !1;
|
|
353
381
|
}
|
|
354
382
|
const $ = () => {
|
|
355
|
-
const e =
|
|
356
|
-
if (e.value.edit &&
|
|
357
|
-
|
|
383
|
+
const e = S(o());
|
|
384
|
+
if (e.value.edit && De() && !v.value.length) {
|
|
385
|
+
He();
|
|
358
386
|
return;
|
|
359
387
|
}
|
|
360
388
|
if (e.value.text != "" || v.value.length) {
|
|
@@ -368,122 +396,122 @@ const rt = { class: "chat-input__container" }, ut = ["id"], ct = ["id"], dt = {
|
|
|
368
396
|
}, n = v.value;
|
|
369
397
|
if (n.length) {
|
|
370
398
|
const i = e.value.text.trim();
|
|
371
|
-
n.forEach((s,
|
|
399
|
+
n.forEach((s, u) => {
|
|
372
400
|
var y;
|
|
373
|
-
const
|
|
401
|
+
const c = {
|
|
374
402
|
type: "message." + s.type,
|
|
375
403
|
url: s.url,
|
|
376
404
|
filename: s.name,
|
|
377
405
|
size: (y = s.size) == null ? void 0 : y.toString(),
|
|
378
|
-
text:
|
|
406
|
+
text: u === 0 ? i : ""
|
|
379
407
|
};
|
|
380
|
-
|
|
408
|
+
u === 0 && (e.value.reply && (c.reply = e.value.reply), e.value.edit && (c.edit = e.value.edit)), H("send", c);
|
|
381
409
|
});
|
|
382
410
|
} else
|
|
383
411
|
t.type = "message.text", t.text = e.value.text.trim(), e.value.reply && (t.reply = e.value.reply), e.value.edit && (t.edit = e.value.edit), H("send", t);
|
|
384
412
|
ce(), l.value && l.value.focus();
|
|
385
413
|
}
|
|
386
414
|
};
|
|
387
|
-
return (e, t) => (
|
|
388
|
-
|
|
389
|
-
id: "chat-input-reply-line-" +
|
|
415
|
+
return (e, t) => (x(), C("div", ht, [
|
|
416
|
+
f("div", {
|
|
417
|
+
id: "chat-input-reply-line-" + r(F),
|
|
390
418
|
class: "chat-input__reply-line"
|
|
391
|
-
}, null, 8,
|
|
392
|
-
|
|
393
|
-
id: "chat-input-file-line-" +
|
|
419
|
+
}, null, 8, mt),
|
|
420
|
+
f("div", {
|
|
421
|
+
id: "chat-input-file-line-" + r(F),
|
|
394
422
|
class: O(["chat-input__file-line", { "chat-input__file-line--visible": v.value.length > 0 }])
|
|
395
423
|
}, [
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
424
|
+
f("span", gt, [
|
|
425
|
+
f("span", null, U(r(h)("component.ChatInput.FilesSelected")), 1),
|
|
426
|
+
f("span", null, U(Fe.value), 1)
|
|
399
427
|
]),
|
|
400
|
-
|
|
401
|
-
|
|
428
|
+
f("div", yt, [
|
|
429
|
+
z.value ? (x(), C("button", {
|
|
402
430
|
key: 0,
|
|
403
431
|
type: "button",
|
|
404
432
|
class: "chat-input__file-scroll chat-input__file-scroll--left",
|
|
405
|
-
"aria-label":
|
|
433
|
+
"aria-label": r(h)("component.ChatInput.FilesScrollLeft"),
|
|
406
434
|
onClick: t[0] || (t[0] = (n) => J("left"))
|
|
407
435
|
}, [
|
|
408
|
-
|
|
409
|
-
], 8,
|
|
410
|
-
|
|
436
|
+
q(r(re))
|
|
437
|
+
], 8, St)) : V("", !0),
|
|
438
|
+
f("div", {
|
|
411
439
|
ref_key: "refFileChips",
|
|
412
|
-
ref:
|
|
440
|
+
ref: L,
|
|
413
441
|
class: "chat-input__file-chips",
|
|
414
|
-
onScroll:
|
|
442
|
+
onScroll: K
|
|
415
443
|
}, [
|
|
416
|
-
(
|
|
444
|
+
(x(!0), C(Ue, null, Ve(v.value, (n, i) => (x(), Ye(pt, {
|
|
417
445
|
key: (n.url || n.name || "") + "-" + i,
|
|
418
|
-
"file-info":
|
|
419
|
-
onReset: (s) =>
|
|
446
|
+
"file-info": Se(n),
|
|
447
|
+
onReset: (s) => ke(i)
|
|
420
448
|
}, null, 8, ["file-info", "onReset"]))), 128))
|
|
421
449
|
], 544),
|
|
422
|
-
|
|
450
|
+
B.value ? (x(), C("button", {
|
|
423
451
|
key: 1,
|
|
424
452
|
type: "button",
|
|
425
453
|
class: "chat-input__file-scroll chat-input__file-scroll--right",
|
|
426
|
-
"aria-label":
|
|
454
|
+
"aria-label": r(h)("component.ChatInput.FilesScrollRight"),
|
|
427
455
|
onClick: t[1] || (t[1] = (n) => J("right"))
|
|
428
456
|
}, [
|
|
429
|
-
|
|
430
|
-
], 8,
|
|
457
|
+
q(r(re))
|
|
458
|
+
], 8, _t)) : V("", !0)
|
|
431
459
|
])
|
|
432
|
-
], 10,
|
|
433
|
-
|
|
460
|
+
], 10, vt),
|
|
461
|
+
f("div", xt, [
|
|
434
462
|
le(e.$slots, "inline-buttons", {}, void 0, !0)
|
|
435
463
|
]),
|
|
436
|
-
|
|
437
|
-
A.value ? (
|
|
464
|
+
M.disabledPlaceholder && (M.state == "disabled" || r(o)().isRecording) ? (x(), C("div", It, U(M.disabledPlaceholder), 1)) : (x(), C("div", bt, [
|
|
465
|
+
A.value ? (x(), C("div", {
|
|
438
466
|
key: 0,
|
|
439
467
|
ref_key: "refMirror",
|
|
440
|
-
ref:
|
|
468
|
+
ref: T,
|
|
441
469
|
class: "chat-input__input-mirror",
|
|
442
470
|
"aria-hidden": "true",
|
|
443
471
|
innerHTML: _e.value
|
|
444
|
-
}, null, 8,
|
|
445
|
-
|
|
472
|
+
}, null, 8, Ct)) : V("", !0),
|
|
473
|
+
Xe(f("textarea", {
|
|
446
474
|
ref_key: "refInput",
|
|
447
475
|
ref: l,
|
|
448
|
-
"onUpdate:modelValue": t[2] || (t[2] = (n) =>
|
|
476
|
+
"onUpdate:modelValue": t[2] || (t[2] = (n) => r(o)().text = n),
|
|
449
477
|
rows: "1",
|
|
450
|
-
disabled:
|
|
478
|
+
disabled: M.state == "disabled" || r(o)().isRecording,
|
|
451
479
|
class: O(["chat-input__input", { "chat-input__input--emoji-images": A.value }]),
|
|
452
|
-
placeholder:
|
|
480
|
+
placeholder: Ae.value,
|
|
453
481
|
onKeydown: [
|
|
454
|
-
|
|
455
|
-
|
|
482
|
+
be,
|
|
483
|
+
Je(Le, ["enter"])
|
|
456
484
|
],
|
|
457
|
-
onInput:
|
|
485
|
+
onInput: Me,
|
|
458
486
|
onScroll: g,
|
|
459
487
|
onSelect: I,
|
|
460
|
-
onMouseup:
|
|
461
|
-
onKeyup:
|
|
462
|
-
onMousemove:
|
|
463
|
-
onBlur:
|
|
464
|
-
}, null, 42,
|
|
465
|
-
[
|
|
488
|
+
onMouseup: j,
|
|
489
|
+
onKeyup: j,
|
|
490
|
+
onMousemove: Ce,
|
|
491
|
+
onBlur: N
|
|
492
|
+
}, null, 42, Ft), [
|
|
493
|
+
[Qe, r(o)().text]
|
|
466
494
|
])
|
|
467
495
|
])),
|
|
468
|
-
|
|
496
|
+
q(ft, {
|
|
469
497
|
textarea: l.value,
|
|
470
|
-
onFormatApplied:
|
|
498
|
+
onFormatApplied: Re
|
|
471
499
|
}, null, 8, ["textarea"]),
|
|
472
|
-
|
|
473
|
-
class: O(["chat-input__button", { "chat-input__button-disabled":
|
|
474
|
-
disabled:
|
|
500
|
+
f("button", {
|
|
501
|
+
class: O(["chat-input__button", { "chat-input__button-disabled": Te.value }]),
|
|
502
|
+
disabled: r(o)().isRecording,
|
|
475
503
|
onClick: $
|
|
476
504
|
}, [
|
|
477
|
-
|
|
478
|
-
|
|
505
|
+
f("span", Et, [
|
|
506
|
+
q(r(dt), { color: Ee.value }, null, 8, ["color"])
|
|
479
507
|
])
|
|
480
|
-
], 10,
|
|
481
|
-
|
|
508
|
+
], 10, Tt),
|
|
509
|
+
f("div", At, [
|
|
482
510
|
le(e.$slots, "buttons", {}, void 0, !0)
|
|
483
511
|
])
|
|
484
512
|
]));
|
|
485
513
|
}
|
|
486
514
|
});
|
|
487
515
|
export {
|
|
488
|
-
|
|
516
|
+
Jt as default
|
|
489
517
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import o from "./Feed.vue2.js";
|
|
2
2
|
/* empty css */
|
|
3
3
|
import t from "../../../_virtual/_plugin-vue_export-helper.js";
|
|
4
|
-
const
|
|
4
|
+
const m = /* @__PURE__ */ t(o, [["__scopeId", "data-v-6d2c83c5"]]);
|
|
5
5
|
export {
|
|
6
|
-
|
|
6
|
+
m as default
|
|
7
7
|
};
|