mirror of
https://github.com/supabase/supabase.git
synced 2026-10-14 05:39:11 +03:00
rename filename with double-click or Enter
This commit is contained in:
1 parent
d0d22edce9
commit
bf4a03d383
1 file changed
+19
-1
@@ -167,6 +167,12 @@ const FileExplorerRow: ItemRenderer<StorageItem, FileExplorerRowProps> = ({
|
||||
setSelectedFilePreview(undefined)
|
||||
}
|
||||
|
||||
const onDoubleClickName = () => {
|
||||
if (canUpdateFiles && item.type !== STORAGE_ROW_TYPES.BUCKET) {
|
||||
setSelectedItemToRename(itemWithColumnIndex)
|
||||
}
|
||||
}
|
||||
|
||||
// Drag and drop handlers
|
||||
const onDragStart = (event: React.DragEvent) => {
|
||||
if (item.type === STORAGE_ROW_TYPES.FILE && canUpdateFiles) {
|
||||
@@ -483,7 +489,19 @@ const FileExplorerRow: ItemRenderer<StorageItem, FileExplorerRowProps> = ({
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
<p title={item.name} className="truncate text-sm" style={{ width: nameWidth }}>
|
||||
<p
|
||||
title={item.name}
|
||||
className="truncate text-sm cursor-pointer hover:text-foreground"
|
||||
style={{ width: nameWidth }}
|
||||
onDoubleClick={onDoubleClickName}
|
||||
onKeyDown={(event) => {
|
||||
if (event.key === 'Enter' || event.key === ' ') {
|
||||
event.preventDefault()
|
||||
onDoubleClickName()
|
||||
}
|
||||
}}
|
||||
tabIndex={canUpdateFiles && item.type !== STORAGE_ROW_TYPES.BUCKET ? 0 : -1}
|
||||
>
|
||||
{item.name}
|
||||
</p>
|
||||
{item.isCorrupted && (
|
||||
|
||||
Reference in new issue
Block a user