Commit bd5ee0c5e9

bd5ee0c5e979eeadd8bde0ada5a266b781ba7748

parent: 3d6300af44

Unsigned

Duck <57977673+woducku@users.noreply.github.com> · 2026-09-19 14:02 UTC

c

Layout: unified · split

docs/.vitepress/theme/Layout.vue +35 −2
@@ -106,7 +106,22 @@ if (!import.meta.env.SSR) {
106 if (!searchNavigated) return 106 if (!searchNavigated) return
107 attempts++ 107 attempts++
108 const currentHash = window.location.hash.slice(1) 108 const currentHash = window.location.hash.slice(1)
109 if (!currentHash) return 109 if (!currentHash) {
110 if (attempts < 5) {
111 requestAnimationFrame(retryHighlight)
112 return
113 }
114 expandTablesForTerms(getSearchTerms(searchQuery))
115 const docRoot = document.querySelector<HTMLElement>('.VPDoc .vp-doc')
116 if (docRoot) highlightSearchResult(docRoot)
117 const tablePath = getOpenTableMorePath()
118 if (tablePath.length) {
119 window.history.replaceState(null, '', buildUrl({ tables: tablePath }))
120 rewriteAnchorLinks()
121 }
122 resetSearchNavigation()
123 return
124 }
110 const target = getTargetByHash(currentHash) 125 const target = getTargetByHash(currentHash)
111 if (target) { 126 if (target) {
112 scanSectionForTerms( 127 scanSectionForTerms(
@@ -426,6 +441,13 @@ const expandTableMoreEl = (t: HTMLElement) => {
426 if (box && !box.checked) box.checked = true 441 if (box && !box.checked) box.checked = true
427} 442}
428 443
444const expandTablesForTerms = (terms: string[]) => {
445 if (!terms.length) return
446 document.querySelectorAll('table').forEach((t) => {
447 if (tableContainsTerms(t, terms)) expandTableMoreEl(t)
448 })
449}
450
429const scanSectionForTerms = ( 451const scanSectionForTerms = (
430 target: HTMLElement, 452 target: HTMLElement,
431 terms: string[], 453 terms: string[],
@@ -820,7 +842,18 @@ const tryOpenAnchoredContent = async () => {
820 (selectedTabs 842 (selectedTabs
821 ? getSelectedTabScrollTarget(selectedTabs) 843 ? getSelectedTabScrollTarget(selectedTabs)
822 : document.querySelector<HTMLElement>('.VPDoc') ?? undefined) 844 : document.querySelector<HTMLElement>('.VPDoc') ?? undefined)
823 if (searchNavigated) highlightSearchResult(scrollTarget) 845 if (searchNavigated) {
846 const terms = getSearchTerms(searchQuery)
847 scrollTarget?.querySelectorAll('table').forEach((t) => {
848 if (tableContainsTerms(t, terms)) expandTableMoreEl(t)
849 })
850 highlightSearchResult(scrollTarget)
851 const tablePath = getOpenTableMorePath()
852 if (tablePath.length) {
853 window.history.replaceState(null, '', buildUrl({ tables: tablePath }))
854 rewriteAnchorLinks()
855 }
856 }
824 resetSearchNavigation() 857 resetSearchNavigation()
825 if (openedCollapsible) { 858 if (openedCollapsible) {
826 scrollToElement(openedCollapsible, false) 859 scrollToElement(openedCollapsible, false)
docs/.vitepress/theme/components/search/Search.vue +5
@@ -846,6 +846,11 @@ function buildDocExcerpt(docId: string): Promise<void> {
846 document.createElement = originalCreateElement 846 document.createElement = originalCreateElement
847 } 847 }
848 const headings = div.querySelectorAll('h1, h2, h3, h4, h5, h6') 848 const headings = div.querySelectorAll('h1, h2, h3, h4, h5, h6')
849 div.querySelectorAll<HTMLInputElement>('.table-more-checkbox').forEach(
850 (box) => {
851 box.checked = true
852 }
853 )
849 headings.forEach((heading) => { 854 headings.forEach((heading) => {
850 const href = heading.querySelector('a')?.getAttribute('href') 855 const href = heading.querySelector('a')?.getAttribute('href')
851 const hashIndex = href?.indexOf('#') ?? -1 856 const hashIndex = href?.indexOf('#') ?? -1