Skip to content
Draft
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions app/components/Code/FileTree.vue
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,20 @@ function getFileRoute(nodePath: string): RouteLocationRaw {

const { toggleDir, isExpanded, autoExpandAncestors } = useFileTreeState(props.baseUrl)

const scrollIntoView = () => {
const el = document.querySelector('[aria-current="true"]') as HTMLElement
if (el) {
el.scrollIntoView({ block: 'center' })
}
}

// Auto-expand directories in the current path
watch(
() => props.currentPath,
path => {
if (path) {
autoExpandAncestors(path)
nextTick(scrollIntoView)
Comment thread
btea marked this conversation as resolved.
}
},
{ immediate: true },
Expand Down
Loading