diff --git a/packages/nc-gui/components/cell/attachment/index.vue b/packages/nc-gui/components/cell/attachment/index.vue index e87821c12f..bde68d7a05 100644 --- a/packages/nc-gui/components/cell/attachment/index.vue +++ b/packages/nc-gui/components/cell/attachment/index.vue @@ -75,6 +75,7 @@ const { selectedImage, isReadonly, storedFiles, + removeFile, } = useProvideAttachmentCell(updateModelValue) const { dragging } = useSortable(sortableRef, visibleItems, updateModelValue, isReadonly) @@ -194,6 +195,26 @@ const keydownSpace = (e: KeyboardEvent) => { e.stopPropagation() } } + +const { isUIAllowed } = useRoles() +const isConfirmModalOpen = ref(false) +const filetoDelete = reactive({ + title: '', + i: 0, +}) + +function onRemoveFileClick(title: any, i: number) { + isConfirmModalOpen.value = true + filetoDelete.i = i + filetoDelete.title = title +} + +const handleFileDelete = (i: number) => { + removeFile(i) + isConfirmModalOpen.value = false + filetoDelete.i = 0 + filetoDelete.title = '' +} + + + + @@ -354,5 +413,16 @@ const keydownSpace = (e: KeyboardEvent) => { } } } + .nc-attachment-item { + @apply relative; + + .nc-attachment-remove { + @apply absolute -right-2 -top-2 rounded-full hidden; + } + + &:hover .nc-attachment-remove { + @apply block; + } + } }