fix(electron): duplicate tab views issue (#7703)

fix PD-1523
This commit is contained in:
pengx17
2024-08-05 03:11:52 +00:00
parent 741ff2379e
commit cbdcfdc2d8

View File

@@ -387,7 +387,7 @@ export class WebContentViewsManager {
addTab = async (option?: AddTabOption) => { addTab = async (option?: AddTabOption) => {
if (!option) { if (!option) {
const activeWorkbench = this.activeWorkbenchMeta; const activeWorkbench = this.activeWorkbenchMeta;
const basename = (activeWorkbench?.basename ?? '') + '/'; const basename = activeWorkbench?.basename ?? '/';
option = { option = {
basename, basename,
@@ -395,7 +395,7 @@ export class WebContentViewsManager {
title: 'New Tab', title: 'New Tab',
path: basename.startsWith('/workspace') path: basename.startsWith('/workspace')
? { ? {
pathname: 'all', pathname: '/all',
} }
: undefined, : undefined,
}, },
@@ -1025,7 +1025,11 @@ export const showTabContextMenu = async (tabId: string, viewIndex: number) => {
{ {
label: 'Duplicate tab', label: 'Duplicate tab',
click: () => { click: () => {
addTab(tabMeta).catch(logger.error); addTab({
basename: tabMeta.basename,
view: tabMeta.views,
show: false,
}).catch(logger.error);
}, },
}, },