From 0aefde95f20b235a85426f200cf3b3b5824ef537 Mon Sep 17 00:00:00 2001 From: Chris Hengge Date: Sat, 21 Mar 2026 21:11:18 -0500 Subject: [PATCH] fix(web/config): fill viewport and add TOML syntax highlighting (#4201) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Two issues with the config editor: Layout: the page root had no height constraint and the textarea used min-h-[500px] resize-y, causing independent scrollbars on both the page and the editor. Fixed by adopting the Memory/Cron flex column pattern so the editor fills the remaining viewport height with a single scroll surface. Highlighting: plain textarea with no visual structure for TOML. Added a zero-dependency layered pre-overlay technique — no new npm packages (per CLAUDE.md anti-pattern rules). A pre element sits absolute behind a transparent textarea; highlightToml() produces HTML colour-coding sections, keys, strings, booleans, numbers, datetimes, and comments via per-line regex. onScroll syncs the overlay. Tab key inserts two spaces instead of leaving focus. dangerouslySetInnerHTML used on the pre — content is the user's own local config, not from the network, risk equivalent to any local editor. Risk: Low-Medium — no API or backend change. New rendering logic in editor only. Does not change: save/load API calls, validation, sensitive field masking behaviour. --- web/src/pages/Config.tsx | 136 ++++++++++++++++++++++++++++++++++++--- 1 file changed, 126 insertions(+), 10 deletions(-) diff --git a/web/src/pages/Config.tsx b/web/src/pages/Config.tsx index 66167b791..f23d25b47 100644 --- a/web/src/pages/Config.tsx +++ b/web/src/pages/Config.tsx @@ -1,4 +1,4 @@ -import { useState, useEffect } from 'react'; +import { useState, useEffect, useRef, useCallback } from 'react'; import { Settings, Save, @@ -9,6 +9,91 @@ import { import { getConfig, putConfig } from '@/lib/api'; import { t } from '@/lib/i18n'; + +// --------------------------------------------------------------------------- +// Lightweight zero-dependency TOML syntax highlighter. +// Produces an HTML string. The
 overlay sits behind the