Open files in more installed editors (#2119)
* feat(desktop): open files in more installed editors Detect bundled app commands as well as PATH launchers and preserve file positions through editor-specific launches. * fix(desktop): preserve editor target compatibility Keep existing file-manager preference ids, retain project context for file launches, and recognize Windows 64-bit IDE commands.
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
import { Folder, SquareTerminal } from "lucide-react-native";
|
||||
import { useMemo } from "react";
|
||||
import { Image } from "react-native";
|
||||
|
||||
import type { DesktopOpenTargetIcon } from "@/workspace/desktop-open-targets";
|
||||
|
||||
interface EditorTargetIconProps {
|
||||
icon: DesktopOpenTargetIcon;
|
||||
size?: number;
|
||||
color?: string;
|
||||
}
|
||||
|
||||
export function EditorTargetIcon({ icon, size = 16, color }: EditorTargetIconProps) {
|
||||
const imageStyle = useMemo(() => ({ width: size, height: size }), [size]);
|
||||
const imageSource = useMemo(
|
||||
() => (icon.kind === "image" ? { uri: icon.dataUrl } : undefined),
|
||||
[icon],
|
||||
);
|
||||
|
||||
if (imageSource) {
|
||||
return <Image source={imageSource} style={imageStyle} resizeMode="contain" />;
|
||||
}
|
||||
if (icon.kind === "symbol" && icon.name === "folder") {
|
||||
return <Folder size={size} color={color} />;
|
||||
}
|
||||
return <SquareTerminal size={size} color={color} />;
|
||||
}
|
||||
Reference in New Issue
Block a user