Browse Source

Use ToC hrefs for proper navigation

master
buttercat1791 9 months ago
parent
commit
0fc90e5ceb
  1. 5
      src/lib/components/publications/Publication.svelte
  2. 3
      src/lib/components/publications/TableOfContents.svelte

5
src/lib/components/publications/Publication.svelte

@ -167,8 +167,9 @@
<!-- Table of contents --> <!-- Table of contents -->
{#if publicationType !== 'blog' || !isLeaf} {#if publicationType !== 'blog' || !isLeaf}
{#if $publicationColumnVisibility.toc} {#if $publicationColumnVisibility.toc}
<Sidebar class='sidebar-leather left-0 md:!pr-8 overflow-y-auto'> <Sidebar
<CloseButton onclick={closeToc} class='btn-leather absolute top-0 right-0' /> activeUrl={`#${activeAddress ?? ''}`}
>
<TableOfContents <TableOfContents
displayMode='sidebar' displayMode='sidebar'
rootAddress={rootAddress} rootAddress={rootAddress}

3
src/lib/components/publications/TableOfContents.svelte

@ -46,7 +46,6 @@
} }
</script> </script>
<!-- TODO: Href doesn't work with query params. -->
<!-- Michael J - 16 June 2025 - Accordion mode is untested. --> <!-- Michael J - 16 June 2025 - Accordion mode is untested. -->
{#if displayMode === 'accordion'} {#if displayMode === 'accordion'}
<Accordion multiple> <Accordion multiple>
@ -80,9 +79,9 @@
{@const expanded = toc.expandedMap.get(address) ?? false} {@const expanded = toc.expandedMap.get(address) ?? false}
{@const isLeaf = toc.leaves.has(address)} {@const isLeaf = toc.leaves.has(address)}
{#if isLeaf} {#if isLeaf}
<!-- TODO: Add href -->
<SidebarItem <SidebarItem
label={entry.title} label={entry.title}
href={`#${address}`}
onclick={() => onSectionFocused?.(address)} onclick={() => onSectionFocused?.(address)}
/> />
{:else} {:else}

Loading…
Cancel
Save