mirror of
https://github.com/simstudioai/sim.git
synced 2026-09-24 15:45:35 +08:00
Fixed code editing bug and shortened agent input
This commit is contained in:
@@ -124,6 +124,23 @@ export function Code() {
|
||||
|
||||
const handleAutoClose = useCallback(
|
||||
(e: React.KeyboardEvent<HTMLTextAreaElement>) => {
|
||||
// If we're typing a closing character (not an opening one)
|
||||
if (Object.values(MATCHING_PAIRS).includes(e.key)) {
|
||||
const textarea = e.currentTarget
|
||||
const start = textarea.selectionStart
|
||||
const currentContent = lines[currentLine].content
|
||||
|
||||
// If cursor is before the same closing character, just move cursor
|
||||
if (currentContent[start] === e.key) {
|
||||
e.preventDefault()
|
||||
setTimeout(() => {
|
||||
textarea.selectionStart = textarea.selectionEnd = start + 1
|
||||
}, 0)
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
// Handle opening characters
|
||||
const closingChar = MATCHING_PAIRS[e.key]
|
||||
if (!closingChar) return false
|
||||
|
||||
|
||||
@@ -27,7 +27,7 @@ export const AgentBlock: BlockConfig = {
|
||||
},
|
||||
{
|
||||
title: 'Context',
|
||||
type: 'long-input',
|
||||
type: 'short-input',
|
||||
layout: 'full',
|
||||
},
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user