mirror of
https://github.com/usebruno/bruno.git
synced 2026-06-11 09:51:30 +00:00
fix/send request shortcut issue (#7993)
This commit is contained in:
@@ -64,13 +64,16 @@ class CodeEditor extends React.Component {
|
|||||||
|
|
||||||
componentDidMount() {
|
componentDidMount() {
|
||||||
const variables = getAllVariables(this.props.collection, this.props.item);
|
const variables = getAllVariables(this.props.collection, this.props.item);
|
||||||
const runShortcut = () => {
|
/**
|
||||||
if (this.props.onRun) {
|
* No-op. We claim Cmd-Enter / Ctrl-Enter here only to suppress CodeMirror's
|
||||||
this.props.onRun();
|
* sublime keymap default (insertLineAfter), which would otherwise insert a
|
||||||
return;
|
* newline. sendRequest dispatch is owned by Mousetrap — the editor input has
|
||||||
}
|
* the `mousetrap` class (added below) so the global
|
||||||
return CodeMirror.Pass;
|
* useKeybinding('sendRequest', …) in RequestTabPanel handles it, and only
|
||||||
};
|
* in request tabs. Falling through with CodeMirror.Pass when onRun is absent
|
||||||
|
* would re-introduce the newline in collection/folder-level editors.
|
||||||
|
*/
|
||||||
|
const runShortcut = () => {};
|
||||||
|
|
||||||
const editor = (this.editor = CodeMirror(this._node, {
|
const editor = (this.editor = CodeMirror(this._node, {
|
||||||
value: this.props.value || '',
|
value: this.props.value || '',
|
||||||
|
|||||||
@@ -30,13 +30,16 @@ class MultiLineEditor extends Component {
|
|||||||
// Initialize CodeMirror as a single line editor
|
// Initialize CodeMirror as a single line editor
|
||||||
/** @type {import("codemirror").Editor} */
|
/** @type {import("codemirror").Editor} */
|
||||||
const variables = getAllVariables(this.props.collection, this.props.item);
|
const variables = getAllVariables(this.props.collection, this.props.item);
|
||||||
const runShortcut = () => {
|
/**
|
||||||
if (this.props.onRun) {
|
* No-op. We claim Cmd-Enter / Ctrl-Enter here only to suppress CodeMirror's
|
||||||
this.props.onRun();
|
* sublime keymap default (insertLineAfter), which would otherwise insert a
|
||||||
return;
|
* newline. sendRequest dispatch is owned by Mousetrap — the editor input has
|
||||||
}
|
* the `mousetrap` class (added below) so the global
|
||||||
return CodeMirror.Pass;
|
* useKeybinding('sendRequest', …) in RequestTabPanel handles it, and only
|
||||||
};
|
* in request tabs. Falling through with CodeMirror.Pass when onRun is absent
|
||||||
|
* would re-introduce the newline in collection/folder-level editors.
|
||||||
|
*/
|
||||||
|
const runShortcut = () => {};
|
||||||
|
|
||||||
this.editor = CodeMirror(this.editorRef.current, {
|
this.editor = CodeMirror(this.editorRef.current, {
|
||||||
lineWrapping: false,
|
lineWrapping: false,
|
||||||
|
|||||||
@@ -53,6 +53,16 @@ export default class QueryEditor extends React.Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
componentDidMount() {
|
componentDidMount() {
|
||||||
|
/**
|
||||||
|
* No-op. We claim Cmd-Enter / Ctrl-Enter here only to suppress CodeMirror's
|
||||||
|
* sublime keymap default (insertLineAfter), which would otherwise insert a
|
||||||
|
* newline. sendRequest dispatch is owned by Mousetrap — the editor input has
|
||||||
|
* the `mousetrap` class (added below) so the global
|
||||||
|
* useKeybinding('sendRequest', …) in RequestTabPanel handles it, and only
|
||||||
|
* in request tabs.
|
||||||
|
*/
|
||||||
|
const runShortcut = () => {};
|
||||||
|
|
||||||
const editor = (this.editor = CodeMirror(this._node, {
|
const editor = (this.editor = CodeMirror(this._node, {
|
||||||
value: this.props.value || '',
|
value: this.props.value || '',
|
||||||
lineNumbers: true,
|
lineNumbers: true,
|
||||||
@@ -125,7 +135,9 @@ export default class QueryEditor extends React.Component {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
'Cmd-F': 'findPersistent',
|
'Cmd-F': 'findPersistent',
|
||||||
'Ctrl-F': 'findPersistent'
|
'Ctrl-F': 'findPersistent',
|
||||||
|
'Cmd-Enter': runShortcut,
|
||||||
|
'Ctrl-Enter': runShortcut
|
||||||
}
|
}
|
||||||
}));
|
}));
|
||||||
if (editor) {
|
if (editor) {
|
||||||
|
|||||||
Reference in New Issue
Block a user