Skip to content

Commit

Permalink
feat: save Chatflow title when the ENTER key is pressed or discard …
Browse files Browse the repository at this point in the history
…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
  • Loading branch information
rhumbertgz authored Sep 26, 2024
1 parent eafa060 commit b8b3483
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions packages/ui/src/views/canvas/CanvasHeader.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -310,6 +310,13 @@ const CanvasHeader = ({ chatflow, isAgentCanvas, handleSaveFlow, handleDeleteFlo
ml: 2
}}
defaultValue={flowName}
onKeyDown={(e) => {
if (e.key === 'Enter') {
submitFlowName()
} else if (e.key === 'Escape') {
setEditingFlowName(false)
}
}}
/>
<ButtonBase title='Save Name' sx={{ borderRadius: '50%' }}>
<Avatar
Expand Down

0 comments on commit b8b3483

Please sign in to comment.