fix(webui): prevent equation tags from overlapping formulas

This commit is contained in:
chengyongru authored and chengyongru committed 2026-10-14 14:32:14 +08:00
1 parent 74b22b6522
commit bdb6c369d0
2 files changed
+8

No files matched your search

+2
View File
@@ -9,6 +9,8 @@ export function DisplayMath({ children }: { children: ReactNode }) {
useLayoutEffect(() => {
const update = () => {
if (!frame.current || !content.current) return;
const tag = content.current.querySelector<HTMLElement>(".katex-html > .tag");
content.current.style.setProperty("--math-tag-width", `${tag?.offsetWidth ?? 0}px`);
const width = content.current.offsetWidth;
const scale = width ? Math.min(1, frame.current.clientWidth / width) : 1;
const height = content.current.offsetHeight * scale;