fix(remote): 上传下载现在使用文件面板当前选择的路径
This commit is contained in:
@@ -10,6 +10,7 @@ interface RemoteFilePanelProps {
|
||||
selectedFile: RemoteFileItem | null
|
||||
onSelect: (file: RemoteFileItem | null) => void
|
||||
onDownload: () => void
|
||||
onPathChange?: (path: string) => void
|
||||
disabled?: boolean
|
||||
}
|
||||
|
||||
@@ -20,6 +21,7 @@ export const RemoteFilePanel: React.FC<RemoteFilePanelProps> = ({
|
||||
selectedFile,
|
||||
onSelect,
|
||||
onDownload,
|
||||
onPathChange,
|
||||
disabled,
|
||||
}) => {
|
||||
const [currentPath, setCurrentPath] = useState('')
|
||||
@@ -71,6 +73,7 @@ export const RemoteFilePanel: React.FC<RemoteFilePanelProps> = ({
|
||||
setPathHistory(newHistory)
|
||||
setCurrentPath(prevPath)
|
||||
onSelect(null)
|
||||
onPathChange?.(prevPath)
|
||||
} else {
|
||||
loadDrives()
|
||||
}
|
||||
@@ -82,11 +85,13 @@ export const RemoteFilePanel: React.FC<RemoteFilePanelProps> = ({
|
||||
setPathHistory(['', newPath])
|
||||
setCurrentPath(newPath)
|
||||
loadFiles(newPath)
|
||||
onPathChange?.(newPath)
|
||||
} else {
|
||||
const newPath = currentPath ? `${currentPath}\\${file.name}` : file.name
|
||||
setPathHistory([...pathHistory, newPath])
|
||||
setCurrentPath(newPath)
|
||||
loadFiles(newPath)
|
||||
onPathChange?.(newPath)
|
||||
}
|
||||
onSelect(null)
|
||||
}
|
||||
@@ -104,6 +109,7 @@ export const RemoteFilePanel: React.FC<RemoteFilePanelProps> = ({
|
||||
setCurrentPath('')
|
||||
loadDrives()
|
||||
onSelect(null)
|
||||
onPathChange?.('')
|
||||
}
|
||||
|
||||
const getDisplayPath = () => {
|
||||
|
||||
Reference in New Issue
Block a user