file preview fix

This commit is contained in:
Čarodej
2022-03-15 08:35:16 +01:00
parent a51dece5ee
commit 3f4263393e
7 changed files with 100 additions and 107 deletions

View File

@@ -178,12 +178,15 @@ const mutations = {
if (el.data.id && el.data.id === id) el.data.attributes.items++
})
},
REMOVE_ITEM_FROM_CLIPBOARD(state, item) {
state.clipboard = state.clipboard.filter((element) => element.data.id !== item.data.id)
REMOVE_ITEM_FROM_CLIPBOARD(state, id) {
state.clipboard = state.clipboard.filter((element) => element.data.id !== id)
},
ADD_ALL_ITEMS_TO_CLIPBOARD(state) {
state.clipboard = state.entries
},
CLIPBOARD_REPLACE(state, item) {
state.clipboard = [item]
},
ADD_ITEM_TO_CLIPBOARD(state, item) {
let selectedItem = state.entries.find((el) => el.data.id === item.data.id)

View File

@@ -311,6 +311,8 @@ const actions = {
// Remove file
commit('REMOVE_ITEM', data.data.id)
commit('REMOVE_ITEM_FROM_CLIPBOARD', data.data.id)
events.$emit('file:deleted', data.data.id)
// Remove item from sidebar
if (! ['Public', 'RequestUpload'].includes(router.currentRoute.name)) {
@@ -318,11 +320,6 @@ const actions = {
}
})
// Remove file preview
if (!noSelectedItem) {
commit('CLIPBOARD_CLEAR')
}
// Get route
let route = {
RequestUpload: `/api/upload-request/${router.currentRoute.params.token}/remove`,