55 createSignal ,
66 Match ,
77 on ,
8+ onCleanup ,
89 Show ,
910 Switch
1011} from 'solid-js' ;
@@ -28,7 +29,6 @@ import {
2829} from '../request-workspace' ;
2930import { ScriptPanel } from '../script' ;
3031import { CodeEditor } from './CodeEditor' ;
31- import { HttpEditor } from './HttpEditor' ;
3232import { RequestSelectorBar } from './RequestSelectorBar' ;
3333import { ResizableSplitPane } from './ResizableSplitPane' ;
3434
@@ -212,10 +212,60 @@ export const EditorWithExecution: Component<EditorWithExecutionProps> = (props)
212212
213213 const selectedExecution = ( ) => observer . selectedExecution ( ) ;
214214
215+ const handleHttpSave = async ( ) => {
216+ if ( activeRequestTab ( ) === 'headers' && requestHeaderDraft . isDirty ( ) ) {
217+ await requestHeaderDraft . onSave ( ) ;
218+ return ;
219+ }
220+
221+ if ( activeRequestTab ( ) === 'body' && requestBodyDraft . isDirty ( ) ) {
222+ await requestBodyDraft . onSave ( ) ;
223+ return ;
224+ }
225+
226+ if ( workspace . hasUnsavedChanges ( props . path ) ) {
227+ await workspace . saveFile ( props . path ) ;
228+ await workspace . loadRequests ( props . path ) ;
229+ }
230+ } ;
231+
232+ createEffect ( ( ) => {
233+ if ( fileType ( ) !== 'http' || typeof window === 'undefined' ) {
234+ return ;
235+ }
236+
237+ const handleKeyDown = ( event : KeyboardEvent ) => {
238+ if (
239+ event . defaultPrevented ||
240+ event . repeat ||
241+ ! ( event . ctrlKey || event . metaKey ) ||
242+ event . shiftKey
243+ ) {
244+ return ;
245+ }
246+
247+ if ( event . key === 'Enter' ) {
248+ event . preventDefault ( ) ;
249+ void handleHttpExecute ( ) ;
250+ return ;
251+ }
252+
253+ if ( event . key . toLowerCase ( ) === 's' ) {
254+ event . preventDefault ( ) ;
255+ void handleHttpSave ( ) ;
256+ }
257+ } ;
258+
259+ window . addEventListener ( 'keydown' , handleKeyDown ) ;
260+ onCleanup ( ( ) => {
261+ window . removeEventListener ( 'keydown' , handleKeyDown ) ;
262+ } ) ;
263+ } ) ;
264+
215265 return (
216266 < div class = "flex flex-col h-full" >
217267 < Switch >
218- { /* HTTP files: use HTTP editor with request selector */ }
268+ { /* HTTP files: request workspace + execution panel */ }
219269 < Match when = { fileType ( ) === 'http' } >
220270 < RequestSelectorBar
221271 requests = { requests ( ) }
@@ -231,7 +281,7 @@ export const EditorWithExecution: Component<EditorWithExecutionProps> = (props)
231281 < div class = "flex-1 min-h-0" >
232282 < ResizableSplitPane
233283 left = {
234- < div class = "flex h-full min-h-0 flex-col " >
284+ < div class = "h-full min-h-0 overflow-auto " >
235285 < RequestWorkspaceTabs
236286 activeTab = { activeRequestTab ( ) }
237287 onTabChange = { setActiveRequestTab }
@@ -272,9 +322,6 @@ export const EditorWithExecution: Component<EditorWithExecutionProps> = (props)
272322 onSaveBody = { requestBodyDraft . onSave }
273323 onDiscardBody = { requestBodyDraft . onDiscard }
274324 />
275- < div class = "flex-1 min-h-0" >
276- < HttpEditor path = { props . path } onExecute = { handleHttpExecute } />
277- </ div >
278325 </ div >
279326 }
280327 right = {
0 commit comments