mirror of
https://github.com/wavetermdev/waveterm.git
synced 2024-12-21 16:38:23 +01:00
fix: bound custom fontsizes between 6 and 64 (#1577)
Adds bounding for markdown (and AI) fontsize and fixedfontsize.
This commit is contained in:
parent
a940de6df6
commit
0f15e4ff56
@ -9,7 +9,7 @@ import {
|
||||
resolveSrcSet,
|
||||
transformBlocks,
|
||||
} from "@/app/element/markdown-util";
|
||||
import { useAtomValueSafe } from "@/util/util";
|
||||
import { boundNumber, useAtomValueSafe } from "@/util/util";
|
||||
import { clsx } from "clsx";
|
||||
import { Atom } from "jotai";
|
||||
import { OverlayScrollbarsComponent, OverlayScrollbarsComponentRef } from "overlayscrollbars-react";
|
||||
@ -380,10 +380,10 @@ const Markdown = ({
|
||||
|
||||
const mergedStyle = { ...style };
|
||||
if (fontSizeOverride != null) {
|
||||
mergedStyle["--markdown-font-size"] = `${fontSizeOverride}px`;
|
||||
mergedStyle["--markdown-font-size"] = `${boundNumber(fontSizeOverride, 6, 64)}px`;
|
||||
}
|
||||
if (fixedFontSizeOverride != null) {
|
||||
mergedStyle["--markdown-fixed-font-size"] = `${fixedFontSizeOverride}px`;
|
||||
mergedStyle["--markdown-fixed-font-size"] = `${boundNumber(fixedFontSizeOverride, 6, 64)}px`;
|
||||
}
|
||||
return (
|
||||
<div className={clsx("markdown", className)} style={mergedStyle}>
|
||||
|
Loading…
Reference in New Issue
Block a user