From ae70680cebc9da062c55c660631408ce8c4ccbd0 Mon Sep 17 00:00:00 2001 From: Anoop M D Date: Sat, 21 Jan 2023 01:23:33 +0530 Subject: [PATCH] feat: ener keybindings for single line editor --- .../components/RequestPane/QueryUrl/index.js | 1 + .../src/components/SingleLineEditor/index.js | 43 ++++++++++++++++--- 2 files changed, 39 insertions(+), 5 deletions(-) diff --git a/packages/bruno-app/src/components/RequestPane/QueryUrl/index.js b/packages/bruno-app/src/components/RequestPane/QueryUrl/index.js index 08449e871..327902413 100644 --- a/packages/bruno-app/src/components/RequestPane/QueryUrl/index.js +++ b/packages/bruno-app/src/components/RequestPane/QueryUrl/index.js @@ -43,6 +43,7 @@ const QueryUrl = ({ item, collection, handleRun }) => { onUrlChange(newValue)} + onRun={handleRun} collection={collection} />
diff --git a/packages/bruno-app/src/components/SingleLineEditor/index.js b/packages/bruno-app/src/components/SingleLineEditor/index.js index e59246daa..fbeb8bb69 100644 --- a/packages/bruno-app/src/components/SingleLineEditor/index.js +++ b/packages/bruno-app/src/components/SingleLineEditor/index.js @@ -25,11 +25,44 @@ class SingleLineEditor extends Component { autofocus: true, mode: "brunovariables", extraKeys: { - "Enter": () => {}, - "Ctrl-Enter": () => {}, - "Cmd-Enter": () => {}, - "Alt-Enter": () => {}, - "Shift-Enter": () => {} + "Enter": () => { + if (this.props.onRun) { + this.props.onRun(); + } + }, + "Ctrl-Enter": () => { + if (this.props.onRun) { + this.props.onRun(); + } + }, + "Cmd-Enter": () => { + if (this.props.onRun) { + this.props.onRun(); + } + }, + "Alt-Enter": () => { + if (this.props.onRun) { + this.props.onRun(); + } + }, + "Shift-Enter": () => { + if (this.props.onRun) { + this.props.onRun(); + } + }, + 'Cmd-S': () => { + if (this.props.onSave) { + this.props.onSave(); + } + }, + 'Ctrl-S': () => { + if (this.props.onSave) { + this.props.onSave(); + } + }, + 'Cmd-F': () => {}, + 'Ctrl-F': () => {}, + 'Tab': () => {} }, }); this.editor.setValue(this.props.value)