カスタム絵文字の検索を絵文字ピッカー使用できるように (#10335)
* fix( #10013) * add changelog * also in about.emojis.vue * fix changelog --------- Co-authored-by: tamaina <tamaina@hotmail.co.jp>
This commit is contained in:
parent
168fe0e376
commit
9469b26eb2
2 changed files with 20 additions and 6 deletions
|
@ -87,12 +87,18 @@ export default class extends Endpoint<typeof meta, typeof paramDef> {
|
||||||
//const emojis = await q.take(ps.limit).getMany();
|
//const emojis = await q.take(ps.limit).getMany();
|
||||||
|
|
||||||
emojis = await q.getMany();
|
emojis = await q.getMany();
|
||||||
|
const queryarry = ps.query.match(/\:([a-z0-9_]*)\:/g);
|
||||||
|
|
||||||
emojis = emojis.filter(emoji =>
|
if (queryarry) {
|
||||||
emoji.name.includes(ps.query!) ||
|
emojis = emojis.filter(emoji =>
|
||||||
emoji.aliases.some(a => a.includes(ps.query!)) ||
|
queryarry.includes(`:${emoji.name}:`)
|
||||||
emoji.category?.includes(ps.query!));
|
);
|
||||||
|
} else {
|
||||||
|
emojis = emojis.filter(emoji =>
|
||||||
|
emoji.name.includes(ps.query!) ||
|
||||||
|
emoji.aliases.some(a => a.includes(ps.query!)) ||
|
||||||
|
emoji.category?.includes(ps.query!));
|
||||||
|
}
|
||||||
emojis.splice(ps.limit + 1);
|
emojis.splice(ps.limit + 1);
|
||||||
} else {
|
} else {
|
||||||
emojis = await q.take(ps.limit).getMany();
|
emojis = await q.take(ps.limit).getMany();
|
||||||
|
|
|
@ -53,7 +53,15 @@ function search() {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (selectedTags.size === 0) {
|
if (selectedTags.size === 0) {
|
||||||
searchEmojis = customEmojis.value.filter(emoji => emoji.name.includes(q) || emoji.aliases.includes(q));
|
const queryarry = q.match(/\:([a-z0-9_]*)\:/g);
|
||||||
|
|
||||||
|
if (queryarry) {
|
||||||
|
searchEmojis = customEmojis.value.filter(emoji =>
|
||||||
|
queryarry.includes(`:${emoji.name}:`)
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
searchEmojis = customEmojis.value.filter(emoji => emoji.name.includes(q) || emoji.aliases.includes(q));
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
searchEmojis = customEmojis.value.filter(emoji => (emoji.name.includes(q) || emoji.aliases.includes(q)) && [...selectedTags].every(t => emoji.aliases.includes(t)));
|
searchEmojis = customEmojis.value.filter(emoji => (emoji.name.includes(q) || emoji.aliases.includes(q)) && [...selectedTags].every(t => emoji.aliases.includes(t)));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue