Commit 9846921737

9846921737b847ada8e0c1c3537e6408dc38c0cb

parent: 15682beef3

Unsigned

Duck <57977673+woducku@users.noreply.github.com> · 2026-06-27 06:24 UTC

Fix for icon not showing in the history path

Layout: unified · split

docs/.vitepress/theme/components/Search.vue +20 −8
@@ -1600,7 +1600,7 @@ function getSearchResultHref(item: SearchResult & Result) {
1600} 1600}
1601 1601
1602function navigateToUrlResult(item: UrlResult) { 1602function navigateToUrlResult(item: UrlResult) {
1603 saveToHistory(filterText.value, searchMode.value, [getPageLabel(item.pageId), ...item.titles, item.linkText].map(decodeHtml).filter(Boolean), buildResultHref(item.pageId, item.tabs, item.anchor)) 1603 saveToHistory(filterText.value, searchMode.value, [getPageLabel(item.pageId), ...item.titles, item.linkText].map(toHistoryPathHtml).filter(Boolean), buildResultHref(item.pageId, item.tabs, item.anchor))
1604 window.dispatchEvent( 1604 window.dispatchEvent(
1605 new CustomEvent('search-nav', { detail: { query: filterText.value } }) 1605 new CustomEvent('search-nav', { detail: { query: filterText.value } })
1606 ) 1606 )
@@ -1640,7 +1640,7 @@ onKeyStroke('Enter', (e) => {
1640 } 1640 }
1641 1641
1642 if (selectedPackage) { 1642 if (selectedPackage) {
1643 saveToHistory(filterText.value, searchMode.value, [getPageLabel(getPageKey(String(selectedPackage.id))), ...selectedPackage.titles, selectedPackage.title].map(decodeHtml).filter(Boolean), getSearchResultHref(selectedPackage)) 1643 saveToHistory(filterText.value, searchMode.value, [getPageLabel(getPageKey(String(selectedPackage.id))), ...selectedPackage.titles, selectedPackage.title].map(toHistoryPathHtml).filter(Boolean), getSearchResultHref(selectedPackage))
1644 window.dispatchEvent( 1644 window.dispatchEvent(
1645 new CustomEvent('search-nav', { 1645 new CustomEvent('search-nav', {
1646 detail: { query: filterText.value } 1646 detail: { query: filterText.value }
@@ -1652,7 +1652,7 @@ onKeyStroke('Enter', (e) => {
1652}) 1652})
1653 1653
1654function onResultClick(item: SearchResult & Result) { 1654function onResultClick(item: SearchResult & Result) {
1655 saveToHistory(filterText.value, searchMode.value, [getPageLabel(getPageKey(String(item.id))), ...item.titles, item.title].map(decodeHtml).filter(Boolean), getSearchResultHref(item)) 1655 saveToHistory(filterText.value, searchMode.value, [getPageLabel(getPageKey(String(item.id))), ...item.titles, item.title].map(toHistoryPathHtml).filter(Boolean), getSearchResultHref(item))
1656 window.dispatchEvent( 1656 window.dispatchEvent(
1657 new CustomEvent('search-nav', { 1657 new CustomEvent('search-nav', {
1658 detail: { query: filterText.value } 1658 detail: { query: filterText.value }
@@ -1744,6 +1744,12 @@ function decodeHtml(html: string): string {
1744 return txt.value 1744 return txt.value
1745} 1745}
1746 1746
1747function toHistoryPathHtml(html: string): string {
1748 const stripped = decodeHtml(html.replace(/<[^>]*>/g, ' ').replace(/\s+/g, ' ').trim())
1749 if (stripped) return escapeHtml(stripped)
1750 return html.trim()
1751}
1752
1747function resetSearch() { 1753function resetSearch() {
1748 filterText.value = '' 1754 filterText.value = ''
1749 nextTick().then(() => focusSearchInput(false)) 1755 nextTick().then(() => focusSearchInput(false))
@@ -2081,11 +2087,17 @@ function onMouseMove(e: MouseEvent) {
2081 <span class="history-query">{{ entry.query }}</span> 2087 <span class="history-query">{{ entry.query }}</span>
2082 <template v-if="entry.path?.length"> 2088 <template v-if="entry.path?.length">
2083 <ArrowRight :size="13" stroke-width="1.5" class="history-arrow" /> 2089 <ArrowRight :size="13" stroke-width="1.5" class="history-arrow" />
2084 <template v-if="entry.path.length > 1"> 2090 <template v-for="(seg, si) in entry.path" :key="si">
2085 <span class="history-path-start">{{ entry.path.slice(0, -1).join(' › ') }}</span> 2091 <span
2086 <span class="history-path-sep">›</span> 2092 class="history-path-seg"
2093 :class="{
2094 'history-path-end': si === entry.path.length - 1,
2095 'history-path-only': entry.path.length === 1
2096 }"
2097 v-html="seg"
2098 />
2099 <span v-if="si < entry.path.length - 1" class="history-path-sep">›</span>
2087 </template> 2100 </template>
2088 <span class="history-path-end" :class="{ 'history-path-only': entry.path.length === 1 }">{{ entry.path[entry.path.length - 1] }}</span>
2089 </template> 2101 </template>
2090 </div> 2102 </div>
2091 <component 2103 <component
@@ -3564,7 +3576,7 @@ svg {
3564 color: var(--vp-c-text-3); 3576 color: var(--vp-c-text-3);
3565} 3577}
3566 3578
3567.history-path-start { 3579.history-path-seg {
3568 min-width: 0; 3580 min-width: 0;
3569 overflow: hidden; 3581 overflow: hidden;
3570 text-overflow: ellipsis; 3582 text-overflow: ellipsis;