0
0
mirror of https://github.com/go-gitea/gitea.git synced 2026-05-10 09:41:52 +02:00

Update web_src/js/features/file-view.ts

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Signed-off-by: hamkido <hamki.do2000@gmail.com>
This commit is contained in:
hamkido 2026-01-26 17:19:07 +08:00 committed by GitHub
parent 5896a80421
commit 24f253fe44
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -132,8 +132,13 @@ function initSidebarToggle(elFileView: HTMLElement): void {
// For file view, first add margin, wait for layout, then show sidebar
if (isFileView && repoViewContent) {
repoViewContent.classList.add('sidebar-visible');
// Wait for CSS transition to complete (200ms) before calculating position
setTimeout(showAfterLayout, 220);
// Wait for CSS transition to actually complete before calculating position
const onTransitionEnd = (event: TransitionEvent) => {
if (event.target !== repoViewContent) return;
repoViewContent.removeEventListener('transitionend', onTransitionEnd);
showAfterLayout();
};
repoViewContent.addEventListener('transitionend', onTransitionEnd);
} else {
// For home page (README), no margin needed, show with small delay
setTimeout(showAfterLayout, 10);