Add save actions and cross-platform file manager support (#848)
* files-download-feature * feat: add save option to file directory context menus and viewer * fix: open files in the system file manager
This commit is contained in:
@@ -521,6 +521,7 @@ export interface FilesAPI {
|
||||
rename?(oldPath: string, newPath: string): Promise<{ success: boolean; path: string }>;
|
||||
revealPath?(path: string): Promise<{ success: boolean }>;
|
||||
execCommands?(commands: string[], cwd: string): Promise<{ success: boolean; results: CommandExecResult[] }>;
|
||||
downloadFile?(path: string): Promise<void>;
|
||||
}
|
||||
|
||||
export interface ProjectEntry {
|
||||
|
||||
@@ -16,6 +16,17 @@ export const isMacOS = (): boolean => {
|
||||
return /Macintosh|Mac OS X/.test(navigator.userAgent || '');
|
||||
};
|
||||
|
||||
export const isWindows = (): boolean => {
|
||||
if (typeof navigator === 'undefined') return false;
|
||||
return /Windows/.test(navigator.userAgent || '');
|
||||
};
|
||||
|
||||
export const getRevealLabel = (): string => {
|
||||
if (isMacOS()) return 'Reveal in Finder';
|
||||
if (isWindows()) return 'Open in File Explorer';
|
||||
return 'Open in File Manager';
|
||||
};
|
||||
|
||||
/**
|
||||
* Checks if the platform-appropriate modifier key is pressed.
|
||||
* On macOS desktop app: Cmd (metaKey), on other platforms or web: Ctrl (ctrlKey).
|
||||
|
||||
Reference in New Issue
Block a user