@@ -27,6 +27,7 @@ import { INSOMNIA_TAB_HEIGHT } from '../../constant';
2727import { useInsomniaTabContext } from '../../context/app/insomnia-tab-context' ;
2828import { type Size , useResizeObserver } from '../../hooks/use-resize-observer' ;
2929import { Icon } from '../icon' ;
30+ import { useDocBodyKeyboardShortcuts } from '../keydown-binder' ;
3031import { AddRequestToCollectionModal } from '../modals/add-request-to-collection-modal' ;
3132import { formatMethodName , getRequestMethodShortHand } from '../tags/method-tag' ;
3233import { type BaseTab , InsomniaTab , type TabType } from './tab' ;
@@ -79,10 +80,29 @@ export const OrganizationTabList = ({ showActiveStatus = true, currentPage = ''
7980 moveBefore,
8081 batchUpdateTabs,
8182 currentOrgTabs,
83+ goToNextTab,
84+ goToPreviousTab,
85+ reopenClosedTab,
8286 } = useInsomniaTabContext ( ) ;
8387
8488 const { tabList, activeTabId } = currentOrgTabs ;
8589
90+ // Register keyboard shortcuts for tab navigation
91+ useDocBodyKeyboardShortcuts ( {
92+ tab_nextTab : event => {
93+ event . preventDefault ( ) ;
94+ goToNextTab ?.( ) ;
95+ } ,
96+ tab_previousTab : event => {
97+ event . preventDefault ( ) ;
98+ goToPreviousTab ?.( ) ;
99+ } ,
100+ tab_reopenClosedTab : event => {
101+ event . preventDefault ( ) ;
102+ reopenClosedTab ?.( ) ;
103+ } ,
104+ } ) ;
105+
86106 const handleSelectionChange = ( keys : Selection ) => {
87107 if ( keys !== 'all' ) {
88108 const key = [ ...keys . values ( ) ] ?. [ 0 ] as string ;
@@ -115,17 +135,16 @@ export const OrganizationTabList = ({ showActiveStatus = true, currentPage = ''
115135 ( docId : string , docType : string ) => {
116136 if ( docType === models . project . type ) {
117137 // delete all tabs of this project
118- closeAllTabsUnderProject ?.( docId ) ;
119- }
120- if ( docType === models . workspace . type ) {
138+ closeAllTabsUnderProject ?.( docId , { removeFromClosedTabs : true } ) ;
139+ } else if ( docType === models . workspace . type ) {
121140 // delete all tabs of this workspace
122- closeAllTabsUnderWorkspace ?.( docId ) ;
141+ closeAllTabsUnderWorkspace ?.( docId , { removeFromClosedTabs : true } ) ;
123142 } else if ( docType === models . requestGroup . type ) {
124143 // when delete a folder, we need also delete the corresponding folder runner tab(if exists)
125- batchCloseTabs ?.( [ docId , `runner_${ docId } ` ] ) ;
144+ batchCloseTabs ?.( [ docId , `runner_${ docId } ` ] , { removeFromClosedTabs : true } ) ;
126145 } else {
127146 // delete tab by id
128- closeTabById ( docId ) ;
147+ closeTabById ( docId , { removeFromClosedTabs : true } ) ;
129148 }
130149 } ,
131150 [ batchCloseTabs , closeAllTabsUnderProject , closeAllTabsUnderWorkspace , closeTabById ] ,
0 commit comments