功能: 右键支持在访达中打开与添加本地文件到版本控制(FE-025),中间区域空白处提供当前目录菜单

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
fenghp
2026-06-11 14:23:13 +08:00
co-authored by Cursor
parent 6910563078
commit 75c8e00e19
11 changed files with 278 additions and 6 deletions
+22
View File
@@ -85,6 +85,28 @@ export async function pathsExist(paths: string[]): Promise<Record<string, boolea
return bridge.pathsExist(paths)
}
/**
* 在访达中打开本地路径(目录直接进入,文件定位选中),非 Electron 环境返回 false。
*/
export async function revealPath(targetPath: string, isFolder: boolean): Promise<boolean> {
const bridge = getBridge()
if (!bridge) {
return false
}
return bridge.revealPath(targetPath, isFolder)
}
/**
* 打开系统文件选择器(多选),非 Electron 环境返回 null。
*/
export async function selectFiles(defaultPath?: string): Promise<string[] | null> {
const bridge = getBridge()
if (!bridge) {
return null
}
return bridge.selectFiles(defaultPath)
}
/**
* 构造非 Electron 环境下的占位服务状态。
*/
+2
View File
@@ -6,6 +6,8 @@ export {
getToken,
isElectron,
pathsExist,
revealPath,
selectDirectory,
selectFiles,
startService,
} from "./bridge"
+2
View File
@@ -26,6 +26,8 @@ export interface MactfsBridge {
startService(): Promise<ServiceStatus>
selectDirectory(): Promise<string | null>
pathsExist(paths: string[]): Promise<Record<string, boolean>>
revealPath(targetPath: string, isFolder: boolean): Promise<boolean>
selectFiles(defaultPath?: string): Promise<string[] | null>
}
declare global {