]> source.dussan.org Git - gitea.git/commit
Fix mermaid diagram height when initially hidden (#32457) (#32464)
authorGiteabot <teabot@gitea.io>
Sun, 10 Nov 2024 20:05:42 +0000 (04:05 +0800)
committerGitHub <noreply@github.com>
Sun, 10 Nov 2024 20:05:42 +0000 (04:05 +0800)
commit62d84331947014cc658560ba07bd9f5fec3c8175
tree15a65cfad9f7f67e60c1557fcec158b07573260b
parent22a93c1cdc63340ec4fb4805ed140e57b55fd57b
Fix mermaid diagram height when initially hidden (#32457) (#32464)

Backport #32457 by @silverwind

In a hidden iframe, `document.body.clientHeight` is not reliable. Use
`IntersectionObserver` to detect the visibility change and update the
height there.

Fixes: https://github.com/go-gitea/gitea/issues/32392
<img width="885" alt="image"
src="https://github.com/user-attachments/assets/a95ef6aa-27e7-443f-9d06-400ef27919ae">

Co-authored-by: silverwind <me@silverwind.io>
web_src/js/markup/mermaid.js