diff --git a/web/src/routes/Config.jsx b/web/src/routes/Config.jsx index 8a5cdb790..62d5d7c66 100644 --- a/web/src/routes/Config.jsx +++ b/web/src/routes/Config.jsx @@ -9,7 +9,6 @@ import * as monaco from 'monaco-editor'; export default function Config() { const { data: config } = useSWR('config/raw'); - const [newCode, setNewCode] = useState(); const [success, setSuccess] = useState(); const [error, setError] = useState(); @@ -19,7 +18,7 @@ export default function Config() { } axios - .post('config/save', newCode, { + .post('config/save', window.editor.getValue(), { headers: { 'Content-Type': 'text/plain' }, }) .then((response) => { @@ -37,7 +36,7 @@ export default function Config() { }; const handleCopyConfig = async () => { - await window.navigator.clipboard.writeText(newCode); + await window.navigator.clipboard.writeText(window.editor.getValue()); }; useEffect(() => { @@ -45,9 +44,11 @@ export default function Config() { return; } - monaco.editor.create(document.getElementById('container'), { + window.editor = monaco.editor.create(document.getElementById('container'), { language: 'yaml', value: config, + scrollBeyondLastLine: false, + theme: 'vs-dark', }); }); @@ -63,11 +64,9 @@ export default function Config() { - {newCode && ( - - )} +