From d5102471622fc5debbdbc3543b76e122347000ed Mon Sep 17 00:00:00 2001 From: Rodriguez Avila Humberto Date: Thu, 26 Sep 2024 13:10:33 +0200 Subject: [PATCH] feat: save Chatflow title when the `ENTER` key is pressed or discard upon `ESC` is pressed This simple event handler improves the usability of the UI by avoiding having to use the mouse to save or dicard title changes --- packages/ui/src/views/canvas/CanvasHeader.jsx | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/packages/ui/src/views/canvas/CanvasHeader.jsx b/packages/ui/src/views/canvas/CanvasHeader.jsx index 228d18ef5ed..6aa6fe78e08 100644 --- a/packages/ui/src/views/canvas/CanvasHeader.jsx +++ b/packages/ui/src/views/canvas/CanvasHeader.jsx @@ -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) + } + }} />