feat: 侧边面板重构为通用 TabPanel,页签栏对齐 ZCode 交互
This commit is contained in:
@@ -126,6 +126,8 @@ export class BrowserController {
|
||||
private listeners = new Set<(state: BrowserUiState) => void>()
|
||||
private traceText: string | null = null
|
||||
private settings: BrowserSettings = { riskAcknowledged: false }
|
||||
/** 最近关闭的页签(新的在前,供「最近关闭的标签页」恢复) */
|
||||
private closedTabs: Array<{ title: string; url: string; closedAt: number }> = []
|
||||
|
||||
constructor() {
|
||||
this.browserSession = electronSession.fromPartition(PARTITION)
|
||||
@@ -232,6 +234,7 @@ export class BrowserController {
|
||||
riskAcknowledged: this.settings.riskAcknowledged,
|
||||
tabs,
|
||||
activeTabId: this.activeTabId,
|
||||
recentClosed: this.closedTabs.map(({ title, url }) => ({ title, url })),
|
||||
trace: this.traceText,
|
||||
imported: this.settings.imported ?? null
|
||||
}
|
||||
@@ -439,6 +442,9 @@ export class BrowserController {
|
||||
}
|
||||
this.removeView(tab.view)
|
||||
this.tabs.delete(id)
|
||||
// 记入「最近关闭的标签页」(新的在前,最多 10 条)
|
||||
this.closedTabs.unshift({ title: tab.title || tab.url || '新标签页', url: tab.url, closedAt: Date.now() })
|
||||
this.closedTabs = this.closedTabs.slice(0, 10)
|
||||
if (this.activeTabId === id) this.activeTabId = this.tabs.keys().next().value ?? null
|
||||
if (this.agentTabId === id) this.agentTabId = this.activeTabId
|
||||
this.emitState()
|
||||
|
||||
Reference in New Issue
Block a user