1
0
mirror of https://github.com/hotomoe/hotomoe synced 2024-11-24 23:26:17 +09:00

fix(client): fix lint issues in autocomplete (#8548)

This commit is contained in:
Andreas Nedbal 2022-04-28 03:56:18 +02:00 committed by GitHub
parent a99cd645bb
commit d0443f9de1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -131,8 +131,8 @@ const props = defineProps<{
}>();
const emit = defineEmits<{
(e: 'done', v: { type: string; value: any }): void;
(e: 'closed'): void;
(event: 'done', value: { type: string; value: any }): void;
(event: 'closed'): void;
}>();
const suggests = ref<Element>();
@ -152,7 +152,7 @@ function complete(type: string, value: any) {
emit('closed');
if (type === 'emoji') {
let recents = defaultStore.state.recentlyUsedEmojis;
recents = recents.filter((e: any) => e !== value);
recents = recents.filter((emoji: any) => emoji !== value);
recents.unshift(value);
defaultStore.set('recentlyUsedEmojis', recents.splice(0, 32));
}
@ -232,7 +232,7 @@ function exec() {
} else if (props.type === 'emoji') {
if (!props.q || props.q === '') {
// 使
emojis.value = defaultStore.state.recentlyUsedEmojis.map(emoji => emojiDb.find(e => e.emoji === emoji)).filter(x => x) as EmojiDef[];
emojis.value = defaultStore.state.recentlyUsedEmojis.map(emoji => emojiDb.find(dbEmoji => dbEmoji.emoji === emoji)).filter(x => x) as EmojiDef[];
return;
}
@ -269,17 +269,17 @@ function exec() {
}
}
function onMousedown(e: Event) {
if (!contains(rootEl.value, e.target) && (rootEl.value !== e.target)) props.close();
function onMousedown(event: Event) {
if (!contains(rootEl.value, event.target) && (rootEl.value !== event.target)) props.close();
}
function onKeydown(e: KeyboardEvent) {
function onKeydown(event: KeyboardEvent) {
const cancel = () => {
e.preventDefault();
e.stopPropagation();
event.preventDefault();
event.stopPropagation();
};
switch (e.key) {
switch (event.key) {
case 'Enter':
if (select.value !== -1) {
cancel();
@ -310,7 +310,7 @@ function onKeydown(e: KeyboardEvent) {
break;
default:
e.stopPropagation();
event.stopPropagation();
props.textarea.focus();
}
}