@@ -155,6 +155,7 @@ function TabOverflowDropdown(props: TabOverflowDropdownProps) {
155155// ============================================================================
156156
157157interface TabProps {
158+ ref ?: ( el : HTMLDivElement ) => void ;
158159 file : OpenFile ;
159160 isActive : boolean ;
160161 isGroupFocused ?: boolean ;
@@ -177,6 +178,9 @@ interface TabProps {
177178 onContextMenu : ( e : MouseEvent ) => void ;
178179 onDragStart : ( e : DragEvent ) => void ;
179180 onDragEnd : ( e : DragEvent ) => void ;
181+ onDragOver : ( e : DragEvent ) => void ;
182+ onDragLeave : ( ) => void ;
183+ onDrop : ( e : DragEvent ) => void ;
180184 isDraggedOver : boolean ;
181185 dropPosition ?: "left" | "right" | null ;
182186 isFirstTab ?: boolean ;
@@ -421,6 +425,7 @@ function Tab(props: TabProps) {
421425
422426 return (
423427 < div
428+ ref = { ( el ) => { props . ref ?.( el ) ; } }
424429 class = { tabClasses ( ) }
425430 style = { getTabStyle ( ) }
426431 onMouseEnter = { ( ) => setIsHovered ( true ) }
@@ -432,6 +437,9 @@ function Tab(props: TabProps) {
432437 draggable = { true }
433438 onDragStart = { handleDragStart }
434439 onDragEnd = { handleDragEnd }
440+ onDragOver = { props . onDragOver }
441+ onDragLeave = { props . onDragLeave }
442+ onDrop = { props . onDrop }
435443 >
436444 { /* Active tab top border is handled inline in getTabStyle() */ }
437445
@@ -1048,7 +1056,6 @@ export function TabBar(props: TabBarProps) {
10481056 < For each = { sortedFiles ( ) } >
10491057 { ( file , index ) => {
10501058 let tabRef : HTMLDivElement | undefined ;
1051- const state = dragState ( ) ;
10521059 const isFirst = index ( ) === 0 ;
10531060 const isLast = index ( ) === sortedFiles ( ) . length - 1 ;
10541061 const isPinned = isTabPinned ( file . id ) ;
@@ -1062,14 +1069,9 @@ export function TabBar(props: TabBarProps) {
10621069 const isAfterActive = currentIdx === activeIdx + 1 && activeIdx < files . length - 1 ;
10631070
10641071 return (
1065- < div
1066- ref = { tabRef }
1067- style = { { display : "contents" } }
1068- onDragOver = { ( e ) => tabRef && handleDragOver ( e , file . id , tabRef ) }
1069- onDragLeave = { handleDragLeave }
1070- onDrop = { ( e ) => handleDrop ( e , file . id ) }
1071- >
1072+ < >
10721073< Tab
1074+ ref = { ( el : HTMLDivElement ) => { tabRef = el ; } }
10731075 file = { file }
10741076 isActive = { activeFileId ( ) === file . id }
10751077 isGroupFocused = { isGroupFocused ( ) }
@@ -1096,8 +1098,11 @@ export function TabBar(props: TabBarProps) {
10961098 onContextMenu = { ( e ) => handleContextMenu ( e , file ) }
10971099 onDragStart = { ( e ) => handleDragStart ( e , file . id ) }
10981100 onDragEnd = { handleDragEnd }
1099- isDraggedOver = { state . overId === file . id }
1100- dropPosition = { state . overId === file . id ? state . position : null }
1101+ onDragOver = { ( e ) => tabRef && handleDragOver ( e , file . id , tabRef ) }
1102+ onDragLeave = { handleDragLeave }
1103+ onDrop = { ( e ) => handleDrop ( e , file . id ) }
1104+ isDraggedOver = { dragState ( ) . overId === file . id }
1105+ dropPosition = { dragState ( ) . overId === file . id ? dragState ( ) . position : null }
11011106 isFirstTab = { isFirst }
11021107 isLastTab = { isLast }
11031108 isBeforeActive = { isBeforeActive }
@@ -1114,7 +1119,7 @@ export function TabBar(props: TabBarProps) {
11141119 margin : "0 2px" ,
11151120 } } />
11161121 </ Show >
1117- </ div >
1122+ </ >
11181123 ) ;
11191124 } }
11201125 </ For >
0 commit comments