|
|
|
|
@ -7,7 +7,7 @@ export function useCodeGroups() {
|
|
|
|
|
Array.from(el.children).forEach((child) => {
|
|
|
|
|
child.classList.remove('active')
|
|
|
|
|
})
|
|
|
|
|
el.children[0].classList.add('active')
|
|
|
|
|
activate(el.children[0])
|
|
|
|
|
})
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
@ -36,7 +36,7 @@ export function useCodeGroups() {
|
|
|
|
|
if (!next || current === next) return
|
|
|
|
|
|
|
|
|
|
current.classList.remove('active')
|
|
|
|
|
next.classList.add('active')
|
|
|
|
|
activate(next)
|
|
|
|
|
|
|
|
|
|
const label = group?.querySelector(`label[for="${el.id}"]`)
|
|
|
|
|
label?.scrollIntoView({ block: 'nearest' })
|
|
|
|
|
@ -44,3 +44,10 @@ export function useCodeGroups() {
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function activate(el: Element): void {
|
|
|
|
|
el.classList.add('active')
|
|
|
|
|
window.dispatchEvent(
|
|
|
|
|
new CustomEvent('vitepress:codeGroupTabActivate', { detail: el })
|
|
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
|