feat: ener keybindings for single line editor

This commit is contained in:
Anoop M D 2023-01-21 01:23:33 +05:30
parent 60fc13c765
commit ae70680ceb
2 changed files with 39 additions and 5 deletions

View File

@ -43,6 +43,7 @@ const QueryUrl = ({ item, collection, handleRun }) => {
<SingleLineEditor
value={url}
onChange={(newValue) => onUrlChange(newValue)}
onRun={handleRun}
collection={collection}
/>
<div className="flex items-center h-full mr-2 cursor-pointer" id="send-request" onClick={handleRun}>

View File

@ -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)