feat(markdown): intercept links in MarkdownPane — relative files navigate in Files tab, external URLs open in browser
This commit is contained in:
parent
91aa711ef3
commit
cd438c2cf3
3 changed files with 75 additions and 3 deletions
|
|
@ -17,6 +17,17 @@
|
|||
loadFiles(cwd);
|
||||
});
|
||||
|
||||
function handleNavigate(absolutePath: string) {
|
||||
// If the file is in our discovered list, select it directly
|
||||
const match = files.find(f => f.path === absolutePath);
|
||||
if (match) {
|
||||
selectedPath = absolutePath;
|
||||
} else {
|
||||
// File not in sidebar — set it directly (MarkdownPane handles loading)
|
||||
selectedPath = absolutePath;
|
||||
}
|
||||
}
|
||||
|
||||
async function loadFiles(dir: string) {
|
||||
loading = true;
|
||||
try {
|
||||
|
|
@ -58,7 +69,7 @@
|
|||
|
||||
<main class="doc-content">
|
||||
{#if selectedPath}
|
||||
<MarkdownPane paneId="pf-{projectName}" filePath={selectedPath} />
|
||||
<MarkdownPane paneId="pf-{projectName}" filePath={selectedPath} onNavigate={handleNavigate} />
|
||||
{:else}
|
||||
<div class="state-msg full">Select a file</div>
|
||||
{/if}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue