fix(webui): search for collection/readlist in the "add to" dialog should ignore accents

Closes: #944
This commit is contained in:
Gauthier Roebroeck 2022-08-11 11:27:21 +08:00
parent 834ed0e964
commit ac67924fba
3 changed files with 7 additions and 2 deletions

View File

@ -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: {

View File

@ -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: {

View File

@ -0,0 +1,3 @@
export function stripAccents(s: string): string {
return s.normalize('NFD').replace(/\p{Diacritic}/gu, '')
}