Skip to content

An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作

:lipstick: Center active mobile tab in the tab list https://github.com/siyuan-note/siyuan/issues/16094

Danielf4fc59059ae2
diff --git a/app/src/mobile/tabs/MobileTabs.ts b/app/src/mobile/tabs/MobileTabs.ts
index a65fa524d6..5d7019b47f 100644
--- a/app/src/mobile/tabs/MobileTabs.ts
+++ b/app/src/mobile/tabs/MobileTabs.ts
@@ -800,6 +800,16 @@ export class MobileTabs {
}
});
});
+ requestAnimationFrame(() => {
+ const listElement = element.querySelector<HTMLElement>(".mobile-tabs__list");
+ const activeElement = listElement?.querySelector<HTMLElement>(".mobile-tabs__item--active");
+ if (!listElement || !activeElement) {
+ return;
+ }
+ const listRect = listElement.getBoundingClientRect();
+ const activeRect = activeElement.getBoundingClientRect();
+ listElement.scrollTop += activeRect.top - listRect.top - (listRect.height - activeRect.height) / 2;
+ });
},
});
}