feat: save Chatflow title when the `ENTER` key is pressed or discard upon `ESC` is pressed (#3265)

This simple event handler improves the usability of the UI by avoiding having to use the mouse to save or dicard title changes
This commit is contained in:
Humberto Rodríguez A. 2024-09-26 16:25:47 +02:00 committed by GitHub
parent eafa06015a
commit b8b34832b4
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 7 additions and 0 deletions

View File

@ -310,6 +310,13 @@ const CanvasHeader = ({ chatflow, isAgentCanvas, handleSaveFlow, handleDeleteFlo
ml: 2 ml: 2
}} }}
defaultValue={flowName} defaultValue={flowName}
onKeyDown={(e) => {
if (e.key === 'Enter') {
submitFlowName()
} else if (e.key === 'Escape') {
setEditingFlowName(false)
}
}}
/> />
<ButtonBase title='Save Name' sx={{ borderRadius: '50%' }}> <ButtonBase title='Save Name' sx={{ borderRadius: '50%' }}>
<Avatar <Avatar