@mobilon-dev/chotto 0.3.88 → 0.3.90
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_chatinput_elements/ButtonEmojiPicker/ButtonEmojiPicker.vue.js +2 -2
- package/dist/components/2_chatinput_elements/ButtonEmojiPicker/ButtonEmojiPicker.vue2.js +41 -33
- package/dist/components/2_feed_elements/MessageReactions/MessageReactions.vue.js +2 -2
- package/dist/components/2_feed_elements/MessageReactions/MessageReactions.vue2.js +15 -15
- package/dist/components/2_feed_elements/ReplyTextMessage/ReplyTextMessage.vue.js +4 -4
- package/dist/components/2_feed_elements/ReplyTextMessage/ReplyTextMessage.vue2.js +52 -16
- package/dist/components/3_compounds/ChatInput/ChatInput.vue.js +2 -2
- package/dist/components/3_compounds/ChatInput/ChatInput.vue2.js +165 -96
- package/dist/components/3_compounds/Feed/composables/useFeedScrollTo.js +38 -13
- package/dist/functions/renderAppleEmojis.js +24 -20
- package/dist/hooks/messages/useStartEdit.js +1 -1
- package/dist/themes/dark.css +1 -1
- package/dist/themes/default.css +1 -1
- package/dist/themes/glass.css +1 -1
- package/dist/themes/green.css +1 -1
- package/dist/themes/mobilon1.css +1 -1
- package/dist/types/components/2_chatinput_elements/ButtonEmojiPicker/ButtonEmojiPicker.vue.d.ts +15 -0
- package/dist/types/components/2_feed_elements/BaseReplyMessage/styles/types.d.ts +6 -0
- package/dist/types/components/2_feed_elements/ReplyTextMessage/stories/ReplyTextMessage.stories.d.ts +1 -0
- package/dist/types/components/2_feed_elements/ReplyTextMessage/styles/types.d.ts +22 -0
- package/dist/types/components/2_feed_elements/TextMessage/styles/types.d.ts +18 -0
- package/dist/types/functions/renderAppleEmojis.d.ts +1 -0
- package/package.json +1 -1
|
@@ -1,26 +1,27 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { useImmediateDebouncedRef as
|
|
3
|
-
import { useMessageDraft as
|
|
1
|
+
import { defineComponent as re, inject as ue, ref as f, computed as _, watch as h, nextTick as d, unref as r, onMounted as ce, createElementBlock as C, openBlock as I, createElementVNode as p, createVNode as P, renderSlot as W, toDisplayString as de, createCommentVNode as pe, withDirectives as fe, normalizeClass as H, withKeys as he, vModelText as me } from "vue";
|
|
2
|
+
import { useImmediateDebouncedRef as ve } from "../../../hooks/useImmediateDebouncedRef.js";
|
|
3
|
+
import { useMessageDraft as ge } from "../../../hooks/useMessageDraft.js";
|
|
4
4
|
import "../../../hooks/useSearchModel.js";
|
|
5
5
|
import "../../../hooks/useTheme.js";
|
|
6
|
-
import { useEmojiNative as
|
|
6
|
+
import { useEmojiNative as ye } from "../../../hooks/useEmojiNative.js";
|
|
7
7
|
/* empty css */
|
|
8
8
|
/* empty css */
|
|
9
|
-
import { t as
|
|
9
|
+
import { t as m } from "../../../locale/useLocale.js";
|
|
10
10
|
/* empty css */
|
|
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
|
|
16
|
-
import
|
|
17
|
-
|
|
14
|
+
import { textToAppleEmojiHtml as xe, textContainsEmoji as _e } from "../../../functions/renderAppleEmojis.js";
|
|
15
|
+
import { hideEditPreview as Te } from "../../../hooks/messages/useStartEdit.js";
|
|
16
|
+
import be from "./icons/SendIcon.vue.js";
|
|
17
|
+
import Se from "../../2_chatinput_elements/TextFormatToolbar/TextFormatToolbar.vue.js";
|
|
18
|
+
const Ce = { class: "chat-input__container" }, Ie = ["id"], we = ["id"], Ae = { class: "chat-input__inline-buttons" }, Ee = {
|
|
18
19
|
key: 0,
|
|
19
20
|
class: "chat-input__input chat-input__disabled-placeholder"
|
|
20
|
-
},
|
|
21
|
+
}, Me = {
|
|
21
22
|
key: 1,
|
|
22
23
|
class: "chat-input__input-wrap"
|
|
23
|
-
},
|
|
24
|
+
}, Fe = ["innerHTML"], He = ["disabled", "placeholder"], Re = ["disabled"], ke = { class: "" }, ze = { class: "chat-input__third-line" }, Ze = /* @__PURE__ */ re({
|
|
24
25
|
__name: "ChatInput",
|
|
25
26
|
props: {
|
|
26
27
|
state: {
|
|
@@ -49,103 +50,164 @@ const pe = { class: "chat-input__container" }, fe = ["id"], he = ["id"], me = {
|
|
|
49
50
|
}
|
|
50
51
|
},
|
|
51
52
|
emits: ["send", "typing"],
|
|
52
|
-
setup(
|
|
53
|
-
const
|
|
54
|
-
|
|
55
|
-
|
|
53
|
+
setup(v, { emit: B }) {
|
|
54
|
+
const w = B, g = ue("chatAppId"), { resetMessage: L, getMessage: l, setMessageText: T, setForceSendMessage: j, resetEdit: q } = ge(g), { isNative: K } = ye(g), n = f(), A = f(), u = f(!1), y = f(!1), N = ve("", 2e3), R = f(), O = _(() => xe(l().text || "")), x = _(
|
|
55
|
+
() => !K.value && _e(l().text || "")
|
|
56
|
+
), c = () => {
|
|
57
|
+
if (!A.value || !n.value) return;
|
|
58
|
+
const e = n.value, t = A.value, i = Math.max(0, e.offsetWidth - e.clientWidth);
|
|
59
|
+
t.style.right = i > 0 ? `${i}px` : "", t.scrollTop = e.scrollTop;
|
|
60
|
+
};
|
|
61
|
+
let b = 0;
|
|
62
|
+
function E() {
|
|
63
|
+
if (!x.value) {
|
|
64
|
+
u.value = !1;
|
|
65
|
+
return;
|
|
66
|
+
}
|
|
67
|
+
b && cancelAnimationFrame(b), b = requestAnimationFrame(() => {
|
|
68
|
+
b = 0;
|
|
69
|
+
const e = n.value;
|
|
70
|
+
if (!e) {
|
|
71
|
+
u.value = !1;
|
|
72
|
+
return;
|
|
73
|
+
}
|
|
74
|
+
const t = e.selectionStart !== e.selectionEnd;
|
|
75
|
+
u.value !== t && (u.value = t, t || d(c));
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
const a = v, Y = _(() => !!(a.state == "disabled" || l().text == "" && !l().file || l().isRecording)), $ = _(() => {
|
|
56
79
|
var t;
|
|
57
|
-
if (
|
|
58
|
-
return
|
|
59
|
-
if (!((t =
|
|
80
|
+
if (a.inputButtonColor)
|
|
81
|
+
return a.inputButtonColor;
|
|
82
|
+
if (!((t = a.selectedChannel) != null && t.channelId))
|
|
60
83
|
return "#25D366";
|
|
61
|
-
const e =
|
|
84
|
+
const e = a.selectedChannel.channelId.toLowerCase();
|
|
62
85
|
return e.includes("whatsapp") || e.includes("waba") ? "#25D366" : e.includes("telegram") ? "#37AFE2" : e.includes("sms") ? "#6C757D" : e.includes("max") ? "#4B0082" : "#25D366";
|
|
63
|
-
}),
|
|
86
|
+
}), V = _(() => {
|
|
64
87
|
var t;
|
|
65
|
-
if (!((t =
|
|
66
|
-
return
|
|
67
|
-
const e =
|
|
68
|
-
return e.includes("whatsapp") || e.includes("waba") ?
|
|
88
|
+
if (!((t = a.selectedChannel) != null && t.channelId))
|
|
89
|
+
return m("component.ChatInput.InputPlaceholder");
|
|
90
|
+
const e = a.selectedChannel.channelId.toLowerCase();
|
|
91
|
+
return e.includes("whatsapp") || e.includes("waba") ? m("component.ChatInput.WhatsappInputPlaceholder") : e.includes("telegram") ? m("component.ChatInput.TelegramInputPlaceholder") : e.includes("sms") ? m("component.ChatInput.SmsInputPlaceholder") : e.includes("max") ? m("component.ChatInput.MaxInputPlaceholder") : m("component.ChatInput.InputPlaceholder");
|
|
69
92
|
});
|
|
70
|
-
|
|
71
|
-
() =>
|
|
93
|
+
h(
|
|
94
|
+
() => N.value,
|
|
72
95
|
() => {
|
|
73
|
-
|
|
96
|
+
w("typing");
|
|
74
97
|
}
|
|
75
|
-
),
|
|
76
|
-
() => r.focusOnInputArea,
|
|
98
|
+
), h(
|
|
77
99
|
() => {
|
|
78
|
-
|
|
79
|
-
|
|
100
|
+
var e;
|
|
101
|
+
return (e = l().edit) == null ? void 0 : e.messageId;
|
|
102
|
+
},
|
|
103
|
+
(e, t) => {
|
|
104
|
+
e != null && e !== t && (y.value = !0, d(() => {
|
|
105
|
+
if (!y.value) return;
|
|
106
|
+
const i = n.value;
|
|
107
|
+
i && (M(i), y.value = !1, S(i), requestAnimationFrame(() => S(i)));
|
|
108
|
+
}));
|
|
109
|
+
}
|
|
110
|
+
), h(
|
|
111
|
+
() => a.focusOnInputArea,
|
|
112
|
+
() => {
|
|
113
|
+
a.focusOnInputArea && d(() => {
|
|
114
|
+
const e = r(n);
|
|
80
115
|
e == null || e.focus();
|
|
81
116
|
});
|
|
82
117
|
},
|
|
83
118
|
{ immediate: !0 }
|
|
84
|
-
),
|
|
119
|
+
), h(
|
|
85
120
|
() => l().text,
|
|
86
121
|
() => {
|
|
87
|
-
|
|
122
|
+
d(() => {
|
|
88
123
|
const e = n.value;
|
|
89
|
-
|
|
90
|
-
const t = e.scrollTop;
|
|
91
|
-
e.style.height = "auto";
|
|
92
|
-
const i = getComputedStyle(e), o = parseFloat(i.fontSize) || 16, q = parseFloat(i.lineHeight) || o * 1.4, S = 40, w = q * 11, M = e.scrollHeight, K = l().text.split(`
|
|
93
|
-
`).length > 1, s = document.createElement("div");
|
|
94
|
-
s.style.position = "absolute", s.style.visibility = "hidden", s.style.whiteSpace = "nowrap", s.style.font = i.font, s.style.fontSize = i.fontSize, s.style.fontFamily = i.fontFamily, s.style.fontWeight = i.fontWeight, s.style.letterSpacing = i.letterSpacing, s.textContent = l().text, document.body.appendChild(s);
|
|
95
|
-
const V = s.offsetWidth;
|
|
96
|
-
document.body.removeChild(s);
|
|
97
|
-
const $ = parseFloat(i.paddingLeft) || 0, G = parseFloat(i.paddingRight) || 0, U = e.clientWidth - $ - G, J = V > U, Q = K || J;
|
|
98
|
-
l().text.trim() && Q ? M <= w ? (e.style.height = M + "px", e.style.overflowY = "hidden") : (e.style.height = w + "px", e.style.overflowY = "auto", e.scrollTop = t) : (e.style.height = S + "px", e.style.overflowY = "hidden"), T();
|
|
124
|
+
e && (M(e), y.value && (y.value = !1, S(e), requestAnimationFrame(() => S(e))));
|
|
99
125
|
});
|
|
100
126
|
},
|
|
101
127
|
{ immediate: !0 }
|
|
102
|
-
),
|
|
128
|
+
), h(x, (e) => {
|
|
129
|
+
e && d(() => {
|
|
130
|
+
const t = n.value;
|
|
131
|
+
if (!t) return;
|
|
132
|
+
const i = t.scrollTop;
|
|
133
|
+
M(t), t.scrollTop = i, c(), requestAnimationFrame(c);
|
|
134
|
+
});
|
|
135
|
+
});
|
|
136
|
+
function M(e) {
|
|
137
|
+
const t = e.scrollTop;
|
|
138
|
+
e.style.height = "auto";
|
|
139
|
+
const i = getComputedStyle(e), o = parseFloat(i.fontSize) || 16, ee = parseFloat(i.lineHeight) || o * 1.4, k = 40, z = ee * 11, D = e.scrollHeight, te = l().text.split(`
|
|
140
|
+
`).length > 1, s = document.createElement("div");
|
|
141
|
+
s.style.position = "absolute", s.style.visibility = "hidden", s.style.whiteSpace = "nowrap", s.style.font = i.font, s.style.fontSize = i.fontSize, s.style.fontFamily = i.fontFamily, s.style.fontWeight = i.fontWeight, s.style.letterSpacing = i.letterSpacing, s.textContent = l().text, document.body.appendChild(s);
|
|
142
|
+
const ne = s.offsetWidth;
|
|
143
|
+
document.body.removeChild(s);
|
|
144
|
+
const ie = parseFloat(i.paddingLeft) || 0, le = parseFloat(i.paddingRight) || 0, oe = e.clientWidth - ie - le, se = ne > oe, ae = te || se;
|
|
145
|
+
l().text.trim() && ae ? D <= z ? (e.style.height = D + "px", e.style.overflowY = "hidden") : (e.style.height = z + "px", e.style.overflowY = "auto", e.scrollTop = t) : (e.style.height = k + "px", e.style.overflowY = "hidden"), c(), requestAnimationFrame(c);
|
|
146
|
+
}
|
|
147
|
+
function S(e) {
|
|
148
|
+
if (a.state === "disabled" || l().isRecording) return;
|
|
149
|
+
const t = e.value.length;
|
|
150
|
+
e.focus(), e.setSelectionRange(t, t), e.scrollTop = e.scrollHeight, c();
|
|
151
|
+
}
|
|
152
|
+
h(
|
|
103
153
|
() => l().forceSend,
|
|
104
154
|
() => {
|
|
105
|
-
l().forceSend && (
|
|
155
|
+
l().forceSend && (F(), j(!1));
|
|
106
156
|
}
|
|
107
157
|
);
|
|
108
|
-
const
|
|
158
|
+
const U = (e) => {
|
|
109
159
|
const t = e.target;
|
|
110
|
-
|
|
111
|
-
},
|
|
112
|
-
|
|
160
|
+
w("typing", t.value);
|
|
161
|
+
}, G = () => {
|
|
162
|
+
d(() => {
|
|
113
163
|
const e = n.value;
|
|
114
164
|
e && (e.style.height = "40px", e.style.overflowY = "hidden");
|
|
115
165
|
});
|
|
116
166
|
};
|
|
117
|
-
|
|
118
|
-
|
|
167
|
+
ce(() => {
|
|
168
|
+
G();
|
|
119
169
|
});
|
|
120
|
-
const
|
|
170
|
+
const J = (e) => {
|
|
121
171
|
if (e.shiftKey) {
|
|
122
172
|
if (n.value instanceof HTMLTextAreaElement) {
|
|
123
173
|
let t = n.value.selectionStart;
|
|
124
174
|
t && (n.value.setRangeText(`
|
|
125
|
-
`, t, t, "end"),
|
|
175
|
+
`, t, t, "end"), T(n.value.value));
|
|
126
176
|
}
|
|
127
177
|
e.preventDefault();
|
|
128
178
|
} else if (e.ctrlKey) {
|
|
129
179
|
if (n.value instanceof HTMLTextAreaElement) {
|
|
130
180
|
let t = n.value.selectionStart;
|
|
131
181
|
t && (n.value.setRangeText(`
|
|
132
|
-
`, t, t, "end"),
|
|
182
|
+
`, t, t, "end"), T(n.value.value));
|
|
133
183
|
}
|
|
134
184
|
e.preventDefault();
|
|
135
185
|
} else
|
|
136
|
-
e.preventDefault(),
|
|
137
|
-
},
|
|
186
|
+
e.preventDefault(), F();
|
|
187
|
+
}, Q = (e) => {
|
|
138
188
|
if (n.value) {
|
|
139
189
|
const t = n.value.value;
|
|
140
190
|
n.value.value = e.newText;
|
|
141
191
|
const i = e.newText.length - (t.length - (e.end - e.start)), o = e.start + i;
|
|
142
|
-
|
|
192
|
+
T(e.newText), d(() => {
|
|
143
193
|
n.value && (n.value.setSelectionRange(o, o), n.value.focus());
|
|
144
194
|
});
|
|
145
195
|
}
|
|
146
|
-
}
|
|
196
|
+
};
|
|
197
|
+
function X() {
|
|
198
|
+
q(), T(""), Te(g), R.value = void 0, n.value && n.value.focus();
|
|
199
|
+
}
|
|
200
|
+
function Z() {
|
|
201
|
+
const e = l();
|
|
202
|
+
return e.edit ? (e.text ?? "").trim() === (e.edit.text ?? "").trim() : !1;
|
|
203
|
+
}
|
|
204
|
+
const F = () => {
|
|
147
205
|
var t, i;
|
|
148
206
|
const e = f(l());
|
|
207
|
+
if (e.value.edit && Z()) {
|
|
208
|
+
X();
|
|
209
|
+
return;
|
|
210
|
+
}
|
|
149
211
|
if (e.value.text != "" || e.value.file) {
|
|
150
212
|
const o = {
|
|
151
213
|
type: "",
|
|
@@ -155,63 +217,70 @@ const pe = { class: "chat-input__container" }, fe = ["id"], he = ["id"], me = {
|
|
|
155
217
|
size: "",
|
|
156
218
|
reply: void 0
|
|
157
219
|
};
|
|
158
|
-
e.value.file ? (o.type = "message." + e.value.file.type, o.url = e.value.file.url, o.filename = e.value.file.name, o.size = (t = e.value.file.size) == null ? void 0 : t.toString(), o.text = (i = e == null ? void 0 : e.value) == null ? void 0 : i.text.trim()) : (o.type = "message.text", o.text = e.value.text.trim()), e.value.reply && (o.reply = e.value.reply), e.value.edit && (o.edit = e.value.edit),
|
|
220
|
+
e.value.file ? (o.type = "message." + e.value.file.type, o.url = e.value.file.url, o.filename = e.value.file.name, o.size = (t = e.value.file.size) == null ? void 0 : t.toString(), o.text = (i = e == null ? void 0 : e.value) == null ? void 0 : i.text.trim()) : (o.type = "message.text", o.text = e.value.text.trim()), e.value.reply && (o.reply = e.value.reply), e.value.edit && (o.edit = e.value.edit), w("send", o), L(), R.value = void 0, n.value && n.value.focus();
|
|
159
221
|
}
|
|
160
222
|
};
|
|
161
|
-
return (e, t) => (
|
|
162
|
-
|
|
163
|
-
id: "chat-input-reply-line-" +
|
|
223
|
+
return (e, t) => (I(), C("div", Ce, [
|
|
224
|
+
p("div", {
|
|
225
|
+
id: "chat-input-reply-line-" + r(g),
|
|
164
226
|
class: "chat-input__reply-line"
|
|
165
|
-
}, null, 8,
|
|
166
|
-
|
|
167
|
-
id: "chat-input-file-line-" +
|
|
227
|
+
}, null, 8, Ie),
|
|
228
|
+
p("div", {
|
|
229
|
+
id: "chat-input-file-line-" + r(g),
|
|
168
230
|
class: "chat-input__file-line"
|
|
169
|
-
}, null, 8,
|
|
170
|
-
|
|
171
|
-
|
|
231
|
+
}, null, 8, we),
|
|
232
|
+
p("div", Ae, [
|
|
233
|
+
W(e.$slots, "inline-buttons", {}, void 0, !0)
|
|
172
234
|
]),
|
|
173
|
-
|
|
174
|
-
|
|
235
|
+
v.disabledPlaceholder && (v.state == "disabled" || r(l)().isRecording) ? (I(), C("div", Ee, de(v.disabledPlaceholder), 1)) : (I(), C("div", Me, [
|
|
236
|
+
x.value ? (I(), C("div", {
|
|
175
237
|
key: 0,
|
|
176
238
|
ref_key: "refMirror",
|
|
177
|
-
ref:
|
|
178
|
-
class: "chat-input__input-mirror",
|
|
239
|
+
ref: A,
|
|
240
|
+
class: H(["chat-input__input-mirror", { "chat-input__input-mirror--hidden": u.value }]),
|
|
179
241
|
"aria-hidden": "true",
|
|
180
|
-
innerHTML:
|
|
181
|
-
}, null,
|
|
182
|
-
|
|
242
|
+
innerHTML: O.value
|
|
243
|
+
}, null, 10, Fe)) : pe("", !0),
|
|
244
|
+
fe(p("textarea", {
|
|
183
245
|
ref_key: "refInput",
|
|
184
246
|
ref: n,
|
|
185
|
-
"onUpdate:modelValue": t[0] || (t[0] = (i) =>
|
|
186
|
-
disabled:
|
|
187
|
-
class:
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
247
|
+
"onUpdate:modelValue": t[0] || (t[0] = (i) => r(l)().text = i),
|
|
248
|
+
disabled: v.state == "disabled" || r(l)().isRecording,
|
|
249
|
+
class: H(["chat-input__input", {
|
|
250
|
+
"chat-input__input--emoji-images": x.value && !u.value,
|
|
251
|
+
"chat-input__input--selecting": x.value && u.value
|
|
252
|
+
}]),
|
|
253
|
+
placeholder: V.value,
|
|
254
|
+
onKeydown: he(J, ["enter"]),
|
|
255
|
+
onInput: U,
|
|
256
|
+
onScroll: c,
|
|
257
|
+
onSelect: E,
|
|
258
|
+
onMouseup: E,
|
|
259
|
+
onKeyup: E,
|
|
260
|
+
onBlur: t[1] || (t[1] = (i) => u.value = !1)
|
|
261
|
+
}, null, 42, He), [
|
|
262
|
+
[me, r(l)().text]
|
|
194
263
|
])
|
|
195
264
|
])),
|
|
196
|
-
|
|
265
|
+
P(Se, {
|
|
197
266
|
textarea: n.value,
|
|
198
|
-
onFormatApplied:
|
|
267
|
+
onFormatApplied: Q
|
|
199
268
|
}, null, 8, ["textarea"]),
|
|
200
|
-
|
|
201
|
-
class:
|
|
202
|
-
disabled:
|
|
203
|
-
onClick:
|
|
269
|
+
p("button", {
|
|
270
|
+
class: H(["chat-input__button", { "chat-input__button-disabled": Y.value }]),
|
|
271
|
+
disabled: r(l)().isRecording,
|
|
272
|
+
onClick: F
|
|
204
273
|
}, [
|
|
205
|
-
|
|
206
|
-
|
|
274
|
+
p("span", ke, [
|
|
275
|
+
P(r(be), { color: $.value }, null, 8, ["color"])
|
|
207
276
|
])
|
|
208
|
-
], 10,
|
|
209
|
-
|
|
210
|
-
|
|
277
|
+
], 10, Re),
|
|
278
|
+
p("div", ze, [
|
|
279
|
+
W(e.$slots, "buttons", {}, void 0, !0)
|
|
211
280
|
])
|
|
212
281
|
]));
|
|
213
282
|
}
|
|
214
283
|
});
|
|
215
284
|
export {
|
|
216
|
-
|
|
285
|
+
Ze as default
|
|
217
286
|
};
|
|
@@ -1,18 +1,43 @@
|
|
|
1
|
-
import { watch as
|
|
2
|
-
function
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
}
|
|
1
|
+
import { watch as u, nextTick as f } from "vue";
|
|
2
|
+
function g(r) {
|
|
3
|
+
const e = r.trim();
|
|
4
|
+
if (!e || document.getElementById(e))
|
|
5
|
+
return e;
|
|
6
|
+
const n = e.startsWith("msg-") ? e : `msg-${e}`;
|
|
7
|
+
if (document.getElementById(n))
|
|
8
|
+
return n;
|
|
9
|
+
try {
|
|
10
|
+
const t = JSON.parse(e);
|
|
11
|
+
if ((t == null ? void 0 : t.messageId) != null) {
|
|
12
|
+
const s = `msg-${t.messageId}`;
|
|
13
|
+
if (document.getElementById(s))
|
|
14
|
+
return s;
|
|
15
|
+
}
|
|
16
|
+
} catch {
|
|
17
|
+
}
|
|
18
|
+
return n;
|
|
19
|
+
}
|
|
20
|
+
function T({ targetIdRef: r, feedContainerId: e, focusClass: n = "focused-message" }) {
|
|
21
|
+
u(
|
|
22
|
+
() => r.value,
|
|
23
|
+
(t) => {
|
|
24
|
+
if (!t) return;
|
|
25
|
+
const s = (i = 0) => {
|
|
26
|
+
var l;
|
|
27
|
+
const d = g(t), o = document.getElementById(d), c = document.getElementById(e);
|
|
28
|
+
if (o instanceof HTMLElement && c instanceof HTMLElement) {
|
|
29
|
+
c.scrollTop = o.offsetTop + o.clientHeight / 2 - c.clientHeight / 2, (l = o.children[0]) == null || l.classList.add(n), setTimeout(() => {
|
|
30
|
+
var m;
|
|
31
|
+
(m = o.children[0]) == null || m.classList.remove(n);
|
|
32
|
+
}, 2e3);
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
35
|
+
i < 5 && setTimeout(() => s(i + 1), 50);
|
|
36
|
+
};
|
|
37
|
+
f(() => s());
|
|
13
38
|
}
|
|
14
39
|
);
|
|
15
40
|
}
|
|
16
41
|
export {
|
|
17
|
-
|
|
42
|
+
T as useFeedScrollTo
|
|
18
43
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const f = "https://cdn.jsdelivr.net/npm/emoji-datasource-apple@6.0.1/img/apple/64",
|
|
1
|
+
const f = "https://cdn.jsdelivr.net/npm/emoji-datasource-apple@6.0.1/img/apple/64", s = new RegExp("(?:\\p{Regional_Indicator}{2})|(?:[#*0-9]\\uFE0F?\\u20E3)|(?:\\p{Extended_Pictographic}(?:\\uFE0F|\\uFE0E)?(?:\\u200D(?:\\p{Extended_Pictographic}|\\p{Emoji_Modifier_Base})(?:\\uFE0F|\\uFE0E)?)*)", "gu"), g = "height:1.2em;width:1.2em;margin:0 0.05em;vertical-align:-0.2em;display:inline";
|
|
2
2
|
function u(e, t) {
|
|
3
3
|
const n = [];
|
|
4
4
|
for (const c of e) {
|
|
@@ -21,7 +21,7 @@ function h(e) {
|
|
|
21
21
|
}
|
|
22
22
|
return null;
|
|
23
23
|
}
|
|
24
|
-
function
|
|
24
|
+
function x(e, t) {
|
|
25
25
|
const n = h(t);
|
|
26
26
|
n && e.addEventListener(
|
|
27
27
|
"error",
|
|
@@ -31,7 +31,7 @@ function T(e, t) {
|
|
|
31
31
|
{ once: !0 }
|
|
32
32
|
);
|
|
33
33
|
}
|
|
34
|
-
function
|
|
34
|
+
function T(e) {
|
|
35
35
|
const t = u(e);
|
|
36
36
|
if (!t) return e;
|
|
37
37
|
const n = `${f}/${t}.png`, c = h(e), a = c ? ` data-fallback="${E(c)}" onerror="if(this.dataset.fallback&&this.src!==this.dataset.fallback){this.onerror=null;this.src=this.dataset.fallback}"` : "";
|
|
@@ -40,20 +40,23 @@ function x(e) {
|
|
|
40
40
|
function E(e) {
|
|
41
41
|
return e.replace(/&/g, "&").replace(/"/g, """).replace(/</g, "<").replace(/>/g, ">");
|
|
42
42
|
}
|
|
43
|
-
function
|
|
43
|
+
function I(e) {
|
|
44
44
|
return e.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">");
|
|
45
45
|
}
|
|
46
|
-
function
|
|
47
|
-
return e ?
|
|
46
|
+
function N(e) {
|
|
47
|
+
return e ? I(e).replace(s, (n) => T(n)) : "";
|
|
48
48
|
}
|
|
49
49
|
function $(e) {
|
|
50
|
+
return e ? (s.lastIndex = 0, s.test(e)) : !1;
|
|
51
|
+
}
|
|
52
|
+
function A(e) {
|
|
50
53
|
var m;
|
|
51
54
|
if (!e || typeof document > "u") return e;
|
|
52
55
|
const t = document.createElement("div");
|
|
53
56
|
t.innerHTML = e;
|
|
54
57
|
const n = document.createTreeWalker(t, NodeFilter.SHOW_TEXT, {
|
|
55
|
-
acceptNode: (
|
|
56
|
-
let r =
|
|
58
|
+
acceptNode: (d) => {
|
|
59
|
+
let r = d.parentNode;
|
|
57
60
|
for (; r && r !== t; ) {
|
|
58
61
|
const o = r.nodeName;
|
|
59
62
|
if (o === "SCRIPT" || o === "STYLE" || o === "TEXTAREA")
|
|
@@ -66,27 +69,28 @@ function $(e) {
|
|
|
66
69
|
let a;
|
|
67
70
|
for (; a = n.nextNode(); )
|
|
68
71
|
c.push(a);
|
|
69
|
-
for (const
|
|
70
|
-
const r =
|
|
71
|
-
if (
|
|
72
|
-
|
|
72
|
+
for (const d of c.reverse()) {
|
|
73
|
+
const r = d.textContent || "";
|
|
74
|
+
if (s.lastIndex = 0, !s.test(r)) continue;
|
|
75
|
+
s.lastIndex = 0;
|
|
73
76
|
const o = document.createDocumentFragment();
|
|
74
|
-
let
|
|
75
|
-
for (; i =
|
|
76
|
-
i.index >
|
|
77
|
+
let p = 0, i;
|
|
78
|
+
for (; i = s.exec(r); ) {
|
|
79
|
+
i.index > p && o.appendChild(document.createTextNode(r.slice(p, i.index)));
|
|
77
80
|
const l = document.createElement("img");
|
|
78
|
-
l.className = "chotto-emoji", l.src = F(i[0]), l.alt = i[0], l.draggable = !1, l.setAttribute("style", g),
|
|
81
|
+
l.className = "chotto-emoji", l.src = F(i[0]), l.alt = i[0], l.draggable = !1, l.setAttribute("style", g), x(l, i[0]), o.appendChild(l), p = i.index + i[0].length;
|
|
79
82
|
}
|
|
80
|
-
|
|
83
|
+
p < r.length && o.appendChild(document.createTextNode(r.slice(p))), (m = d.parentNode) == null || m.replaceChild(o, d);
|
|
81
84
|
}
|
|
82
85
|
return t.innerHTML;
|
|
83
86
|
}
|
|
84
87
|
export {
|
|
85
88
|
f as APPLE_EMOJI_CDN,
|
|
86
|
-
|
|
89
|
+
T as createAppleEmojiImgHtml,
|
|
87
90
|
u as emojiToAppleCode,
|
|
88
91
|
h as getAppleEmojiFallbackUrl,
|
|
89
92
|
F as getAppleEmojiUrl,
|
|
90
|
-
|
|
91
|
-
|
|
93
|
+
A as replaceEmojisInHtml,
|
|
94
|
+
$ as textContainsEmoji,
|
|
95
|
+
N as textToAppleEmojiHtml
|
|
92
96
|
};
|
|
@@ -14,7 +14,7 @@ import { hideReplyPreview as s, showReplyPreview as r } from "./useStartReply.js
|
|
|
14
14
|
function R(t) {
|
|
15
15
|
const { setEdit: e, setMessageText: o, resetReply: m } = p(t);
|
|
16
16
|
return { startEdit: (i) => {
|
|
17
|
-
m(), r(t),
|
|
17
|
+
m(), r(t), o(i.text ?? ""), e(i);
|
|
18
18
|
} };
|
|
19
19
|
}
|
|
20
20
|
function g(t) {
|