merge: prevent excessive trimming in emoji picker's input box - fix #1165 (!1197)

View MR for information: https://activitypub.software/TransFem-org/Sharkey/-/merge_requests/1197

Closes #1165

Approved-by: Hazelnoot <acomputerdog@gmail.com>
Approved-by: Marie <github@yuugi.dev>
This commit is contained in:
Marie 2025-07-30 18:50:51 +00:00
commit 04d45859e6

View file

@ -218,13 +218,15 @@ parseAndMergeCategories('', customEmojiFolderRoot);
watch(q, () => {
if (emojisEl.value) emojisEl.value.scrollTop = 0;
if (q.value === '') {
const query = q.value.trim();
if (query === '') {
searchResultCustom.value = [];
searchResultUnicode.value = [];
return;
}
const newQ = q.value.replace(/:/g, '').normalize('NFC').toLowerCase();
const newQ = query.replace(/:/g, '').normalize('NFC').toLowerCase();
const searchCustom = () => {
const max = 100;
@ -442,7 +444,7 @@ function input(): void {
// Using custom input event instead of v-model to respond immediately on
// Android, where composition happens on all languages
// (v-model does not update during composition)
q.value = searchEl.value?.value.trim() ?? '';
q.value = searchEl.value?.value ?? '';
}
function paste(event: ClipboardEvent): void {
@ -467,7 +469,7 @@ function onKeydown(ev: KeyboardEvent) {
}
function done(query?: string): boolean | void {
if (query == null) query = q.value;
if (query == null) query = q.value.trim();
if (query == null || typeof query !== 'string') return;
const q2 = query.replace(/:/g, '');