From ac67924fbaa8163396a779c26be86338624316df Mon Sep 17 00:00:00 2001 From: Gauthier Roebroeck Date: Thu, 11 Aug 2022 11:27:21 +0800 Subject: [PATCH] fix(webui): search for collection/readlist in the "add to" dialog should ignore accents Closes: #944 --- komga-webui/src/components/dialogs/CollectionAddToDialog.vue | 3 ++- komga-webui/src/components/dialogs/ReadListAddToDialog.vue | 3 ++- komga-webui/src/functions/string.ts | 3 +++ 3 files changed, 7 insertions(+), 2 deletions(-) create mode 100644 komga-webui/src/functions/string.ts diff --git a/komga-webui/src/components/dialogs/CollectionAddToDialog.vue b/komga-webui/src/components/dialogs/CollectionAddToDialog.vue index 063f5fd138..eb1fc7081a 100644 --- a/komga-webui/src/components/dialogs/CollectionAddToDialog.vue +++ b/komga-webui/src/components/dialogs/CollectionAddToDialog.vue @@ -76,6 +76,7 @@ import Vue from 'vue' import {SeriesDto} from '@/types/komga-series' import {ERROR} from '@/types/events' +import {stripAccents} from '@/functions/string' export default Vue.extend({ name: 'CollectionAddToDialog', @@ -120,7 +121,7 @@ export default Vue.extend({ } else return '' }, collectionsFiltered(): CollectionDto[] { - return this.collections.filter((x: CollectionDto) => x.name.toLowerCase().includes(this.newCollection.toLowerCase())) + return this.collections.filter((x: CollectionDto) => stripAccents(x.name.toLowerCase()).includes(stripAccents(this.newCollection.toLowerCase()))) }, }, methods: { diff --git a/komga-webui/src/components/dialogs/ReadListAddToDialog.vue b/komga-webui/src/components/dialogs/ReadListAddToDialog.vue index 0a4ee5704c..cbaee8649a 100644 --- a/komga-webui/src/components/dialogs/ReadListAddToDialog.vue +++ b/komga-webui/src/components/dialogs/ReadListAddToDialog.vue @@ -77,6 +77,7 @@ import Vue from 'vue' import {BookDto} from '@/types/komga-books' import {ERROR} from '@/types/events' +import {stripAccents} from '@/functions/string' export default Vue.extend({ name: 'ReadListAddToDialog', @@ -121,7 +122,7 @@ export default Vue.extend({ } else return '' }, readListsFiltered(): ReadListDto[] { - return this.readLists.filter((x: ReadListDto) => x.name.toLowerCase().includes(this.newReadList.toLowerCase())) + return this.readLists.filter((x: ReadListDto) => stripAccents(x.name.toLowerCase()).includes(stripAccents(this.newReadList.toLowerCase()))) }, }, methods: { diff --git a/komga-webui/src/functions/string.ts b/komga-webui/src/functions/string.ts new file mode 100644 index 0000000000..0a0affd3f1 --- /dev/null +++ b/komga-webui/src/functions/string.ts @@ -0,0 +1,3 @@ +export function stripAccents(s: string): string { + return s.normalize('NFD').replace(/\p{Diacritic}/gu, '') +}