feat: add deep linking support for file modal

- Update URL hash when opening/closing modal (#file=path)
- Handle browser back/forward navigation
- Open modal on page load if hash is present
- Share button now copies deep link URL instead of GitHub URL
This commit is contained in:
Aaron Powell
2026-01-29 10:34:06 +11:00
parent c052ec05b5
commit 9da53a279e
3 changed files with 63 additions and 7 deletions

View File

@@ -144,11 +144,11 @@ export async function downloadFile(filePath: string): Promise<boolean> {
}
/**
* Share/copy link to clipboard
* Share/copy link to clipboard (deep link to current page with file hash)
*/
export async function shareFile(filePath: string): Promise<boolean> {
const url = getGitHubUrl(filePath);
return copyToClipboard(url);
const deepLinkUrl = `${window.location.origin}${window.location.pathname}#file=${encodeURIComponent(filePath)}`;
return copyToClipboard(deepLinkUrl);
}
/**