ai #1

Merged
ssa merged 17 commits from ai into main 2026-02-18 22:44:42 +03:00
2 changed files with 22 additions and 2 deletions
Showing only changes of commit 88984a21b2 - Show all commits

View File

@@ -61,6 +61,25 @@ export function ConfigTemplate(props: ConfigTemplateProps) {
} }
} }
function handleKeyDown(e: React.KeyboardEvent<HTMLTextAreaElement>) {
if (e.key === 'Tab') {
e.preventDefault();
const textarea = e.currentTarget;
const start = textarea.selectionStart;
const end = textarea.selectionEnd;
const value = textarea.value;
// Insert 2 spaces at cursor position
const newValue = value.substring(0, start) + ' ' + value.substring(end);
handleDraftChange(newValue);
// Move cursor after the inserted spaces
setTimeout(() => {
textarea.selectionStart = textarea.selectionEnd = start + 2;
}, 0);
}
}
const isValidJson = jsonError === null; const isValidJson = jsonError === null;
return ( return (
@@ -105,6 +124,7 @@ export function ConfigTemplate(props: ConfigTemplateProps) {
className={`form-control font-monospace ${isValidJson ? 'border-success' : 'border-danger'}`} className={`form-control font-monospace ${isValidJson ? 'border-success' : 'border-danger'}`}
value={draftContent} value={draftContent}
onChange={(e) => handleDraftChange(e.target.value)} onChange={(e) => handleDraftChange(e.target.value)}
onKeyDown={handleKeyDown}
rows={20} rows={20}
style={{ style={{
fontFamily: 'monospace', fontFamily: 'monospace',

View File

@@ -1,4 +1,4 @@
.highlihgt-scrolled { .highlihgt-scrolled {
overflow-x: auto; overflow-x: auto;
max-width: 90%; / max-width: 90%;
} }