]> source.dussan.org Git - gitea.git/commit
Fix mermaid diagram height when initially hidden (#32457)
authorsilverwind <me@silverwind.io>
Sat, 9 Nov 2024 18:03:55 +0000 (19:03 +0100)
committerGitHub <noreply@github.com>
Sat, 9 Nov 2024 18:03:55 +0000 (20:03 +0200)
commitb55a31eb6a894feb5508e350ff5e9548b2531bd6
tree2c2c3d4978adb657a6bd0ab5b8a69c991a35befd
parent18aeca53203adba7b4fb3b7311f0e77bef92e266
Fix mermaid diagram height when initially hidden (#32457)

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">
web_src/js/markup/mermaid.ts