mirror of
https://github.com/gotson/komga.git
synced 2026-05-08 12:35:30 +02:00
fix(webui): series cover uploads (#729)
This commit is contained in:
parent
9199407644
commit
32f4d7f651
2 changed files with 9 additions and 4 deletions
|
|
@ -1,7 +1,7 @@
|
||||||
<template>
|
<template>
|
||||||
<label class="drop-zone" v-cloak @drop.prevent="dropHandler" @dragover.prevent>
|
<label class="drop-zone" v-cloak @drop.prevent="dropHandler" @dragover.prevent>
|
||||||
<span class="file-input">Choose an image</span> - drag and drop
|
<span class="file-input">Choose an image</span> - drag and drop
|
||||||
<input hidden aria-hidden="true" type="file" accept="image/*" multiple @change="dropHandler" >
|
<input ref="input" hidden aria-hidden="true" type="file" accept="image/*" multiple @change="dropHandler">
|
||||||
</label>
|
</label>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
|
@ -25,6 +25,9 @@ export default Vue.extend({
|
||||||
this.$emit('on-input-change', Array.from(selectedFiles))
|
this.$emit('on-input-change', Array.from(selectedFiles))
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
reset() {
|
||||||
|
(this.$refs.input as HTMLInputElement).value = ''
|
||||||
|
},
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
|
||||||
|
|
@ -323,7 +323,7 @@
|
||||||
<!-- Upload -->
|
<!-- Upload -->
|
||||||
<v-row>
|
<v-row>
|
||||||
<v-col class="pa-1">
|
<v-col class="pa-1">
|
||||||
<drop-zone @on-input-change="addThumbnail" class="pa-8"/>
|
<drop-zone ref="thumbnailsUpload" @on-input-change="addThumbnail" class="pa-8"/>
|
||||||
</v-col>
|
</v-col>
|
||||||
</v-row>
|
</v-row>
|
||||||
|
|
||||||
|
|
@ -665,7 +665,7 @@ export default Vue.extend({
|
||||||
if (this.single && this.poster.uploadQueue.length > 0) {
|
if (this.single && this.poster.uploadQueue.length > 0) {
|
||||||
const series = this.series as SeriesDto
|
const series = this.series as SeriesDto
|
||||||
let hadErrors = false
|
let hadErrors = false
|
||||||
for (const file of this.poster.uploadQueue) {
|
for (const file of this.poster.uploadQueue.slice()) {
|
||||||
try {
|
try {
|
||||||
await this.$komgaSeries.uploadThumbnail(series.id, file, file.name === this.poster.selectedThumbnail)
|
await this.$komgaSeries.uploadThumbnail(series.id, file, file.name === this.poster.selectedThumbnail)
|
||||||
this.deleteThumbnail(file)
|
this.deleteThumbnail(file)
|
||||||
|
|
@ -716,6 +716,8 @@ export default Vue.extend({
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
(this.$refs.thumbnailsUpload as any).reset()
|
||||||
},
|
},
|
||||||
async getThumbnails(series: SeriesDto | SeriesDto[]) {
|
async getThumbnails(series: SeriesDto | SeriesDto[]) {
|
||||||
if (Array.isArray(series)) return
|
if (Array.isArray(series)) return
|
||||||
|
|
@ -752,7 +754,7 @@ export default Vue.extend({
|
||||||
this.poster.uploadQueue.splice(index, 1)
|
this.poster.uploadQueue.splice(index, 1)
|
||||||
}
|
}
|
||||||
if (item.name === this.poster.selectedThumbnail) {
|
if (item.name === this.poster.selectedThumbnail) {
|
||||||
this.selectThumbnail(this.poster.seriesThumbnails.find(x => x.selected))
|
this.poster.selectedThumbnail = ''
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// if thumbnail was marked for deletion, unmark it
|
// if thumbnail was marked for deletion, unmark it
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue