fix(前端界面): 修复侧栏展开时的当前页定位及搜索滚动位置丢失问题
build.yaml / build (push) Successful in 36s

This commit is contained in:
xiaoqidun committed 2026-09-15 08:22:42 +08:00
1 parent 9c62847faf
commit 4d65896def
2 files changed
+12 -2

No files matched your search

+6 -2
View File
@@ -437,12 +437,16 @@ function toggleSidebar(side) {
}
function updateSidebarState() {
const openingPages = state.showPages && el.pageListPanel.inert;
document.body.toggleAttribute("data-hide-pages", !state.showPages);
document.body.toggleAttribute("data-hide-meta", !state.showMeta);
el.pageListPanel.inert = !state.showPages;
el.metaPanel.inert = !state.showMeta;
el.togglePagesButton.setAttribute("aria-pressed", String(state.showPages));
el.toggleMetaButton.setAttribute("aria-pressed", String(state.showMeta));
if (openingPages) {
updatePageListCurrent(true);
}
}
function syncLayoutMode(event) {
@@ -2235,10 +2239,10 @@ function setCurrentPage(index) {
}
}
function updatePageListCurrent() {
function updatePageListCurrent(force = false) {
const current = el.pageList.querySelector(".page-list-item[aria-current]");
if (current) {
if (Number.parseInt(current.dataset.pageIndex, 10) === state.pageIndex) {
if (!force && Number.parseInt(current.dataset.pageIndex, 10) === state.pageIndex) {
return;
}
current.removeAttribute("aria-current");