Skip to content

Commit

Permalink
fix(webui): search for collection/readlist in the "add to" dialog sho…
Browse files Browse the repository at this point in the history
…uld ignore accents

Closes: #944
  • Loading branch information
gotson committed Aug 11, 2022
1 parent 834ed0e commit ac67924
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
3 changes: 2 additions & 1 deletion komga-webui/src/components/dialogs/CollectionAddToDialog.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down Expand Up @@ -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: {
Expand Down
3 changes: 2 additions & 1 deletion komga-webui/src/components/dialogs/ReadListAddToDialog.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down Expand Up @@ -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: {
Expand Down
3 changes: 3 additions & 0 deletions komga-webui/src/functions/string.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export function stripAccents(s: string): string {
return s.normalize('NFD').replace(/\p{Diacritic}/gu, '')
}

0 comments on commit ac67924

Please sign in to comment.