mirror of
https://github.com/BookStackApp/BookStack.git
synced 2024-10-01 01:36:00 -04:00
Fixes issue with having to click the delete icon for attachment twice.
Fixes #884 This is happening because - Due to the limitations of modern JavaScript (and the abandonment of Object.observe), Vue cannot detect property addition or deletion. Since Vue performs the getter/setter conversion process during instance initialization, a property must be present in the data object in order for Vue to convert it and make it reactive. Source: https://vuejs.org/v2/guide/reactivity.html Also added padding to the icons in the attachment section. Signed-off-by: Abijeet <abijeetpatro@gmail.com>
This commit is contained in:
parent
b3cc3130f0
commit
7d81a95156
@ -52,7 +52,9 @@ let methods = {
|
|||||||
},
|
},
|
||||||
|
|
||||||
deleteFile(file) {
|
deleteFile(file) {
|
||||||
if (!file.deleting) return file.deleting = true;
|
if (!file.deleting) {
|
||||||
|
return this.$set(file, 'deleting', true);
|
||||||
|
}
|
||||||
|
|
||||||
this.$http.delete(window.baseUrl(`/attachments/${file.id}`)).then(resp => {
|
this.$http.delete(window.baseUrl(`/attachments/${file.id}`)).then(resp => {
|
||||||
this.$events.emit('success', resp.data.message);
|
this.$events.emit('success', resp.data.message);
|
||||||
|
@ -42,8 +42,8 @@
|
|||||||
<span class="text-primary small" @click="file.deleting = false;">{{ trans('common.cancel') }}</span>
|
<span class="text-primary small" @click="file.deleting = false;">{{ trans('common.cancel') }}</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div @click="startEdit(file)" class="drag-card-action text-center text-primary" style="padding: 0;">@icon('edit')</div>
|
<div @click="startEdit(file)" class="drag-card-action text-center text-primary">@icon('edit')</div>
|
||||||
<div @click="deleteFile(file)" class="drag-card-action text-center text-neg" style="padding: 0;">@icon('close')</div>
|
<div @click="deleteFile(file)" class="drag-card-action text-center text-neg">@icon('close')</div>
|
||||||
</div>
|
</div>
|
||||||
</draggable>
|
</draggable>
|
||||||
<p class="small muted" v-if="files.length === 0">
|
<p class="small muted" v-if="files.length === 0">
|
||||||
|
Loading…
Reference in New Issue
Block a user