File tree Expand file tree Collapse file tree 2 files changed +20
-3
lines changed Expand file tree Collapse file tree 2 files changed +20
-3
lines changed Original file line number Diff line number Diff line change @@ -12,6 +12,7 @@ import { RequestInput } from '../../model/send/send-request-model';
1212import { EditableContentType } from '../../model/events/content-types' ;
1313
1414import { ContainerSizedEditor } from '../editor/base-editor' ;
15+ import { useHotkeys } from '../../util/ui' ;
1516
1617import { SendCardContainer } from './send-card-section' ;
1718import { SendRequestLine } from './send-request-line' ;
@@ -33,7 +34,17 @@ const METHODS_WITHOUT_BODY = [
3334 'GET' ,
3435 'HEAD' ,
3536 'OPTIONS'
36- ]
37+ ] ;
38+
39+ const RequestPaneKeyboardShortcuts = ( props : {
40+ sendRequest : ( ) => void
41+ } ) => {
42+ useHotkeys ( 'Ctrl+Enter, Cmd+Enter' , ( event ) => {
43+ props . sendRequest ( )
44+ } , [ props . sendRequest ] ) ;
45+
46+ return null ;
47+ } ;
3748
3849@inject ( 'rulesStore' )
3950@inject ( 'uiStore' )
@@ -75,6 +86,10 @@ export class RequestPane extends React.Component<{
7586 return < SendCardContainer
7687 hasExpandedChild = { ! ! uiStore ?. expandedSendRequestCard }
7788 >
89+ < RequestPaneKeyboardShortcuts
90+ sendRequest = { this . sendRequest }
91+ />
92+
7893 < SendRequestLine
7994 method = { requestInput . method }
8095 updateMethod = { this . updateMethod }
Original file line number Diff line number Diff line change @@ -4,9 +4,11 @@ import { Method } from 'mockttp';
44import { styled } from '../../styles' ;
55import { Icon , ArrowIcon } from '../../icons' ;
66
7- import { Button , Select , TextInput } from '../common/inputs' ;
87import { getMethodColor } from '../../model/events/categorization' ;
98
9+ import { Ctrl } from '../../util/ui' ;
10+ import { Button , Select , TextInput } from '../common/inputs' ;
11+
1012type MethodName = keyof typeof Method ;
1113const validMethods = Object . values ( Method )
1214 . filter (
@@ -160,7 +162,7 @@ export const SendRequestLine = (props: {
160162 < SendButton
161163 type = 'submit'
162164 disabled = { props . isSending }
163- title = ' Send this request'
165+ title = { ` Send this request ( ${ Ctrl } +Enter)` }
164166 >
165167 { props . isSending
166168 ? < Icon spin fixedWidth = { true } icon = { [ 'fas' , 'spinner' ] } />
You can’t perform that action at this time.
0 commit comments