diff --git a/localization/locales/en/translation.json b/localization/locales/en/translation.json index e8f6bf1a..a1e7252b 100644 --- a/localization/locales/en/translation.json +++ b/localization/locales/en/translation.json @@ -32,6 +32,7 @@ "OpenTidGi": "Open TidGi", "OpenTidGiMenuBar": "Open TidGi MenuBar", "OpenLinkInNewWindow": "Open Link in New Window", + "OpenWorkspaceInNewWindow": "Open Workspace in New Window", "Preferences": "Preferences...", "TidGiSupport": "TidGi Support", "TidGiWebsite": "TidGi Website", diff --git a/localization/locales/zh_CN/translation.json b/localization/locales/zh_CN/translation.json index ff8ac391..64e390a6 100644 --- a/localization/locales/zh_CN/translation.json +++ b/localization/locales/zh_CN/translation.json @@ -34,6 +34,7 @@ "OpenTidGiMenuBar": "打开太记小窗口", "OpenCommandPalette": "打开搜索与命令面板", "OpenLinkInNewWindow": "在新窗口中打开链接", + "OpenWorkspaceInNewWindow": "在新窗口中打开工作区", "Preferences": "设置...", "TidGiSupport": "TidGi 用户支持", "TidGiWebsite": "TidGi 官网", diff --git a/src/services/workspaces/getWorkspaceMenuTemplate.ts b/src/services/workspaces/getWorkspaceMenuTemplate.ts index 07fad038..49024127 100644 --- a/src/services/workspaces/getWorkspaceMenuTemplate.ts +++ b/src/services/workspaces/getWorkspaceMenuTemplate.ts @@ -36,6 +36,7 @@ interface IWorkspaceMenuRequiredServices { | 'restartWorkspaceViewService' | 'realignActiveWorkspace' | 'openUrlInWorkspace' + | 'openWorkspaceWindowWithView' >; } @@ -67,7 +68,7 @@ export async function getWorkspaceMenuTemplate( t: TFunction<[_DefaultNamespace, ...Array>]>, service: IWorkspaceMenuRequiredServices, ): Promise { - const { active, id, mainWikiID, hibernated, tagName, isSubWiki, wikiFolderLocation, gitUrl, storageService, port, name, enableHTTPAPI } = workspace; + const { active, id, mainWikiID, hibernated, tagName, isSubWiki, wikiFolderLocation, gitUrl, storageService, port, name, enableHTTPAPI, lastUrl, homeUrl } = workspace; /* eslint-disable @typescript-eslint/no-misused-promises */ const template: MenuItemConstructorOptions[] = [ { @@ -78,6 +79,13 @@ export async function getWorkspaceMenuTemplate( await openWorkspaceTagTiddler(workspace, service); }, }, + { + label: t('ContextMenu.OpenWorkspaceInNewWindow'), + enabled: !hibernated, + click: async () => { + await service.workspaceView.openWorkspaceWindowWithView(workspace, { uri: lastUrl ?? homeUrl }); + }, + }, { label: t('WorkspaceSelector.EditWorkspace'), click: async () => {