file-tree: focus existing panel if file already open; exclude pinned from available slots
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
98729fc333
commit
9a7a1f2b82
|
|
@ -118,6 +118,20 @@ class FileTreePanel extends HTMLElement {
|
||||||
if ( editorTag )
|
if ( editorTag )
|
||||||
{
|
{
|
||||||
const containers = Array.from( document.querySelectorAll( 'tab-container' ) );
|
const containers = Array.from( document.querySelectorAll( 'tab-container' ) );
|
||||||
|
|
||||||
|
for ( const tc of containers )
|
||||||
|
{
|
||||||
|
const tabs = ( tc as any ).tabs as Array<{ id: string; element: HTMLElement }>;
|
||||||
|
for ( const tab of tabs )
|
||||||
|
{
|
||||||
|
if ( ( tab.element as any ).currentPath === path )
|
||||||
|
{
|
||||||
|
( tc as any ).activateTab( tab.id );
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
let found: { panel: HTMLElement; tc: any; tabId: string } | null = null;
|
let found: { panel: HTMLElement; tc: any; tabId: string } | null = null;
|
||||||
|
|
||||||
for ( const tc of containers )
|
for ( const tc of containers )
|
||||||
|
|
@ -125,7 +139,7 @@ class FileTreePanel extends HTMLElement {
|
||||||
const tabs = ( tc as any ).tabs as Array<{ id: string; element: HTMLElement; dirty: boolean }>;
|
const tabs = ( tc as any ).tabs as Array<{ id: string; element: HTMLElement; dirty: boolean }>;
|
||||||
for ( const tab of tabs )
|
for ( const tab of tabs )
|
||||||
{
|
{
|
||||||
if ( tab.element.tagName.toLowerCase() === editorTag && !tab.dirty )
|
if ( tab.element.tagName.toLowerCase() === editorTag && !tab.dirty && !( tab.element as any )._pinned )
|
||||||
{
|
{
|
||||||
found = { panel: tab.element, tc, tabId: tab.id };
|
found = { panel: tab.element, tc, tabId: tab.id };
|
||||||
break;
|
break;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue