mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2025-02-19 00:18:56 +01:00
Update:Prevent MultiSelect input from adding items that are whitespace & trim whitespace before adding items
This commit is contained in:
parent
7d8fb3bb10
commit
7f28fbb330
@ -493,9 +493,6 @@ export default {
|
||||
if (match.narrator && !Array.isArray(match.narrator)) {
|
||||
match.narrator = match.narrator.split(',').map((g) => g.trim())
|
||||
}
|
||||
if (match.author && !Array.isArray(match.author)) {
|
||||
match.author = match.author.split(',').map((g) => g.trim())
|
||||
}
|
||||
}
|
||||
|
||||
console.log('Select Match', match)
|
||||
|
@ -302,6 +302,14 @@ export default {
|
||||
this.recalcMenuPos()
|
||||
})
|
||||
},
|
||||
resetInput() {
|
||||
this.textInput = null
|
||||
this.currentSearch = null
|
||||
this.selectedMenuItemIndex = null
|
||||
this.$nextTick(() => {
|
||||
this.blur()
|
||||
})
|
||||
},
|
||||
insertNewItem(item) {
|
||||
this.selected.push(item)
|
||||
this.$emit('input', this.selected)
|
||||
@ -316,15 +324,18 @@ export default {
|
||||
submitForm() {
|
||||
if (!this.textInput) return
|
||||
|
||||
var cleaned = this.textInput.trim()
|
||||
var matchesItem = this.items.find((i) => {
|
||||
return i === cleaned
|
||||
})
|
||||
const cleaned = this.textInput.trim()
|
||||
if (!cleaned) {
|
||||
this.resetInput()
|
||||
} else {
|
||||
const matchesItem = this.items.find((i) => i === cleaned)
|
||||
if (matchesItem) {
|
||||
this.clickedOption(null, matchesItem)
|
||||
} else {
|
||||
this.insertNewItem(this.textInput)
|
||||
this.insertNewItem(cleaned)
|
||||
}
|
||||
}
|
||||
|
||||
if (this.$refs.input) this.$refs.input.style.width = '24px'
|
||||
},
|
||||
scroll() {
|
||||
|
Loading…
Reference in New Issue
Block a user