diff --git a/packages/nc-gui/components/cell/attachment/index.vue b/packages/nc-gui/components/cell/attachment/index.vue index 7c785e32d6..b8d7a271d9 100644 --- a/packages/nc-gui/components/cell/attachment/index.vue +++ b/packages/nc-gui/components/cell/attachment/index.vue @@ -115,36 +115,45 @@ watch( attachments.value = [] } } + } else { + if (isPublic.value && isForm.value) { + storedFiles.value = [] + } else { + attachments.value = [] + } } }, - { immediate: true }, -) - -/** updates attachments array for autosave */ -function updateModelValue(data: string | Record[]) { - emits('update:modelValue', data) -} - -/** Close modal on escape press, disable dropzone as well */ -onKeyDown('Escape', () => { - modalVisible.value = false - isOverDropZone.value = false -}) + { + immediate: true + } + , + ) -/** sync storedFiles state with row state */ -watch( - () => storedFiles.value.length || 0, - () => { - rowState.value[column.value!.title!] = storedFiles.value - }, -) + /** updates attachments array for autosave */ + function updateModelValue(data: string | Record[]) { + emits('update:modelValue', data) + } -useSelectedCellKeyupListener(inject(ActiveCellInj, ref(false)), (e) => { - if (e.key === 'Enter' && !isReadonly.value) { - e.stopPropagation() - modalVisible.value = true - } -}) + /** Close modal on escape press, disable dropzone as well */ + onKeyDown('Escape', () => { + modalVisible.value = false + isOverDropZone.value = false + }) + + /** sync storedFiles state with row state */ + watch( + () => storedFiles.value.length || 0, + () => { + rowState.value[column.value!.title!] = storedFiles.value + }, + ) + + useSelectedCellKeyupListener(inject(ActiveCellInj, ref(false)), (e) => { + if (e.key === 'Enter' && !isReadonly.value) { + e.stopPropagation() + modalVisible.value = true + } + })