feat: menu item to open new window

This commit is contained in:
lin onetwo 2023-12-28 01:20:48 +08:00
parent 300ae255eb
commit 0156e80bbd
3 changed files with 11 additions and 1 deletions

View file

@ -36,6 +36,7 @@ interface IWorkspaceMenuRequiredServices {
| 'restartWorkspaceViewService'
| 'realignActiveWorkspace'
| 'openUrlInWorkspace'
| 'openWorkspaceWindowWithView'
>;
}
@ -67,7 +68,7 @@ export async function getWorkspaceMenuTemplate(
t: TFunction<[_DefaultNamespace, ...Array<Exclude<FlatNamespace, _DefaultNamespace>>]>,
service: IWorkspaceMenuRequiredServices,
): Promise<MenuItemConstructorOptions[]> {
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 () => {