@@ -24,7 +24,6 @@ import * as Permissions from '/common/permissions.js';
2424import * as TSTAPI from '/common/tst-api.js' ;
2525import * as SidebarConnection from '/common/sidebar-connection.js' ;
2626import * as UserOperationBlocker from '/common/user-operation-blocker.js' ;
27- import * as TreeBehavior from '/common/tree-behavior.js' ;
2827import '/common/bookmark.js' ; // we need to load this once in the background page to register the global listener
2928
3029import Tab from '/common/Tab.js' ;
@@ -481,7 +480,7 @@ export async function confirmToCloseTabs(tabs, { windowId, configKey, messageKey
481480 }
482481
483482 const listing = configs . warnOnCloseTabsWithListing ?
484- TreeBehavior . tabsToHTMLList ( tabs , { maxRows : configs . warnOnCloseTabsWithListingMaxRows } ) :
483+ tabsToHTMLList ( tabs , { maxRows : configs . warnOnCloseTabsWithListingMaxRows } ) :
485484 '' ;
486485 const dialogParams = {
487486 content : `
@@ -549,6 +548,38 @@ Commands.onTabsClosing.addListener((tabIds, options = {}) => {
549548 return confirmToCloseTabs ( tabIds , options ) ;
550549} ) ;
551550
551+ export function tabsToHTMLList ( tabs , { maxRows } ) {
552+ const rootLevelOffset = tabs . map ( tab => parseInt ( tab . $TST . getAttribute ( Constants . kLEVEL ) || 0 ) ) . sort ( ) [ 0 ] ;
553+ return (
554+ `<ul style="border: 1px inset;
555+ display: flex;
556+ flex-direction: column;
557+ flex-grow: 1;
558+ flex-shrink: 1;
559+ margin: 0.5em 0;
560+ min-height: ${ ( Math . max ( 1 , maxRows || 0 ) ) + 1 } em;
561+ max-height: ${ ( Math . max ( 1 , maxRows || 0 ) ) + 1 } em;
562+ overflow: auto;
563+ padding: 0.5em;">` +
564+ tabs . map ( tab => `<li style="align-items: center;
565+ display: flex;
566+ flex-direction: row;
567+ padding-left: calc((${ tab . $TST . getAttribute ( Constants . kLEVEL ) } - ${ rootLevelOffset } ) * 0.25em);"
568+ title="${ sanitizeForHTMLText ( tab . title ) } "
569+ ><img style="display: flex;
570+ max-height: 1em;
571+ max-width: 1em;"
572+ alt=""
573+ src="${ sanitizeForHTMLText ( tab . favIconUrl || browser . extension . getURL ( 'resources/icons/globe-16.svg' ) ) } "
574+ ><span style="display: flex;
575+ margin-left: 0.25em;
576+ overflow: hidden;
577+ white-space: nowrap;"
578+ >${ sanitizeForHTMLText ( tab . title ) } </span></li>` ) . join ( '' ) +
579+ `</ul>`
580+ ) ;
581+ }
582+
552583function reserveToClearGrantedRemovingTabs ( ) {
553584 const lastGranted = configs . grantedRemovingTabIds . join ( ',' ) ;
554585 setTimeout ( ( ) => {
0 commit comments