diff --git a/apps/client/src/widgets/react/FormTextBox.tsx b/apps/client/src/widgets/react/FormTextBox.tsx index a545fa66c..abf0e9c5a 100644 --- a/apps/client/src/widgets/react/FormTextBox.tsx +++ b/apps/client/src/widgets/react/FormTextBox.tsx @@ -9,6 +9,15 @@ interface FormTextBoxProps extends Omit, " } export default function FormTextBox({ inputRef, className, type, currentValue, onChange, ...rest}: FormTextBoxProps) { + if (type === "number" && currentValue) { + const { min, max } = rest; + if (min && currentValue < min) { + currentValue = String(min); + } else if (max && currentValue > max) { + currentValue = String(max); + } + } + return ( {overrideThemeFonts === "true" && } {isElectron() && } + ) } @@ -159,7 +162,7 @@ function Fonts() { {t("fonts.not_all_fonts_available")}

- {t("fonts.apply_font_changes")} -

-`; - -export default class MaxContentWidthOptions extends OptionsWidget { - - private $maxContentWidth!: JQuery; - - doRender() { - this.$widget = $(TPL); - - this.$maxContentWidth = this.$widget.find(".max-content-width"); - - this.$maxContentWidth.on("change", async () => this.updateOption("maxContentWidth", String(this.$maxContentWidth.val()))); - - this.$widget.find(".reload-frontend-button").on("click", () => utils.reloadFrontendApp(t("max_content_width.reload_description"))); - } - - async optionsLoaded(options: OptionMap) { - this.$maxContentWidth.val(Math.max(MIN_VALUE, parseInt(options.maxContentWidth, 10))); - } -}