feat(mobile): long-press file references for path and open actions #9258
Mergedjuliusmarmingemerged 4 commits into
main fromrefs/pull/9258/headmerged by juliusmarminge View on GitHubgithub-actions[bot](GitHub profile, opens in a new tab) added labelsvouch:trusted
github-actions[bot](GitHub profile, opens in a new tab) added labelssize:L
github-actions[bot](GitHub profile, opens in a new tab) added labels📱 Native Change
- apps/mobile/src/features/threads/ThreadFeed.tsx line 2188Resolvedby macroscopeapp[bot](GitHub profile, opens in a new tab)@@ -2171,3 +2180,9 @@21712180 },21722181 [props.environmentId, props.threadId, props.workspaceRoot, navigation],21732182 );2183+ const markdownLinkHandlers = useMemo<MarkdownLinkHandlers>(2184+ () => ({2185+ onLinkPress: onMarkdownLinkPress,2186+ fileContextMenu: (href) => {2187+ const target = resolveFileChipTarget(href, props.workspaceRoot);2188+ return target ? fileChipMenu(target) : undefined;
- apps/mobile/src/features/threads/fileChipMenu.ts line 26Resolvedby macroscopeapp[bot](GitHub profile, opens in a new tab)@@ -0,0 +6,21 @@6+ resolveWorkspaceFilePath,7+ resolveWorkspaceRelativeFilePath,8+} from "../files/filePath";9+10+export type FileChipAction = "copy-full-path" | "copy-relative-path" | "open-file";11+12+export interface FileChipTarget {13+ /** The host path, when the link is absolute or the workspace root is known. */14+ readonly fullPath?: string;15+ /** The path inside the workspace, when the link resolves there. */16+ readonly relativePath?: string;17+}18+19+/** Null when the link is not a file or resolves nowhere the feed can open, such as `~/x` or `../x`. */20+export function resolveFileChipTarget(21+ href: string,22+ workspaceRoot: string | null | undefined,23+): FileChipTarget | null {24+ const presentation = resolveMarkdownLinkPresentation(href);25+ if (presentation.kind !== "file") return null;26+ const relativePath = resolveWorkspaceRelativeFilePath(workspaceRoot, presentation.path);
juliusmarminge merged this9159b80
juliusmarminge closed this
Sign in to join this conversation.

macroscopeapp[bot](GitHub profile, opens in a new tab) reviewed