Skip to content

πŸ”₯ πŸ”₯ πŸ”₯ A Free & Self-hostable Airtable Alternative

fix(nc-gui): drop in attachment cell multiple time issue

Ramesh Mane3b1638905b4f
diff --git a/packages/nc-gui/components/cell/attachment/index.vue b/packages/nc-gui/components/cell/attachment/index.vue
index e574de7738..0198749b28 100644
--- a/packages/nc-gui/components/cell/attachment/index.vue
+++ b/packages/nc-gui/components/cell/attachment/index.vue
@@ -407,7 +407,6 @@ onUnmounted(() => {
data-rec="true"
class="nc-attachment-cell-dropzone text-white text-lg bg-gray-600/75 flex text-sm items-center justify-center gap-2"
>
- <MaterialSymbolsFileCopyOutline />
{{ $t('labels.dropHere') }}
</general-overlay>
</template>
diff --git a/packages/nc-gui/components/smartsheet/grid/canvas/cells/index.ts b/packages/nc-gui/components/smartsheet/grid/canvas/cells/index.ts
index 0f5e73c8bd..db3ddd4e55 100644
--- a/packages/nc-gui/components/smartsheet/grid/canvas/cells/index.ts
+++ b/packages/nc-gui/components/smartsheet/grid/canvas/cells/index.ts
@@ -335,20 +335,21 @@ export function useGridCellHandler(params: {
params.attachmentCellDropOver.value?.rowIndex === rowMeta.rowIndex
) {
roundedRect(ctx, x, y, width, height, 0, {
- backgroundColor: themeV3Colors.gray['200'],
+ backgroundColor: '#4A5268BF', // gray-600/75
borderColor: themeV3Colors.gray['200'],
borderWidth: 0.4,
})
renderSingleLineText(ctx, {
- x: x + width / 2 - 10,
+ x: x + width / 2,
y,
textAlign: 'center',
- text: 'Drap Here',
+ text: t('labels.dropHere'),
maxWidth: width - 10 * 2,
- fontFamily: `${pv ? 600 : 500} 13px Inter`,
- fillStyle: '#3366FF',
+ fontFamily: `${pv ? 600 : 500} 18px Inter`,
+ fillStyle: '#FFFFFF',
height,
+ isTagLabel: true, // to render label center of cell
})
}
diff --git a/packages/nc-gui/components/smartsheet/grid/canvas/index.vue b/packages/nc-gui/components/smartsheet/grid/canvas/index.vue
index af5267ad7c..747985fed2 100644
--- a/packages/nc-gui/components/smartsheet/grid/canvas/index.vue
+++ b/packages/nc-gui/components/smartsheet/grid/canvas/index.vue
@@ -2630,7 +2630,9 @@ const resetAttachmentCellDropOver = () => {
}
const onDrop = (files: File[] | null, event: DragEvent) => {
- if (!attachmentCellDropOver.value || attachmentCellDropOver.value.rowIndex === -1) return
+ if (!attachmentCellDropOver.value || attachmentCellDropOver.value.rowIndex === -1 || !attachmentCellDropOver.value.columnId) {
+ return
+ }
const dataCache = getDataCache(attachmentCellDropOver.value.path)
@@ -2649,20 +2651,25 @@ const onDrop = (files: File[] | null, event: DragEvent) => {
const column = columns.value[columnIndex]!
selection.value.clear()
+ editEnabled.value = null
activeCell.value = {
row: attachmentCellDropOver.value.rowIndex,
column: columnIndex,
path: attachmentCellDropOver.value.path,
}
+ resetRowSelection()
+ onActiveCellChanged()
- handleCellDrop({
- files,
- e: event,
- row,
- column,
- })
-
- resetAttachmentCellDropOver()
+ try {
+ handleCellDrop({
+ files,
+ e: event,
+ row,
+ column,
+ })
+ } finally {
+ resetAttachmentCellDropOver()
+ }
}
const onOver = (files: File[] | null, e: DragEvent) => {