Fix Themes Tab

This commit is contained in:
Vendicated 2023-01-25 17:49:19 +01:00
parent 41226f0358
commit 103cd14361
No known key found for this signature in database
GPG key ID: A1DC0CFB5615D905

View file

@ -75,11 +75,11 @@ function Validators({ themeLinks }: { themeLinks: string[]; }) {
export default ErrorBoundary.wrap(function () { export default ErrorBoundary.wrap(function () {
const settings = useSettings(); const settings = useSettings();
const ref = React.useRef<HTMLTextAreaElement>(null); const [themeText, setThemeText] = React.useState(settings.themeLinks.join("\n"));
function onBlur() { function onBlur() {
settings.themeLinks = [...new Set( settings.themeLinks = [...new Set(
ref.current!.value themeText
.trim() .trim()
.split(/\n+/) .split(/\n+/)
.map(s => s.trim()) .map(s => s.trim())
@ -119,8 +119,8 @@ export default ErrorBoundary.wrap(function () {
padding: ".5em", padding: ".5em",
border: "1px solid var(--background-modifier-accent)" border: "1px solid var(--background-modifier-accent)"
}} }}
ref={ref} value={themeText}
defaultValue={settings.themeLinks.join("\n")} onChange={e => setThemeText(e.currentTarget.value)}
className={TextAreaProps.textarea} className={TextAreaProps.textarea}
placeholder="Theme Links" placeholder="Theme Links"
spellCheck={false} spellCheck={false}