Skip to content

Commit

Permalink
fix(electron): cmd+num not working on mac
Browse files Browse the repository at this point in the history
  • Loading branch information
pengx17 committed Aug 14, 2024
1 parent 08cc15a commit 41b2da8
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 17 deletions.
29 changes: 13 additions & 16 deletions packages/frontend/electron/src/main/application-menu/create.ts
Original file line number Diff line number Diff line change
Expand Up @@ -139,22 +139,19 @@ export function createApplicationMenu() {
undoCloseTab().catch(console.error);
},
},
{
label: 'Switch to tab',
acceleratorWorksWhenHidden: true,
visible: false,
submenu: [1, 2, 3, 4, 5, 6, 7, 8, 9].map(n => {
const shortcut = `CommandOrControl+${n}`;
const listener = () => {
switchTab(n);
};
return {
label: `Switch to tab ${n}`,
accelerator: shortcut,
click: listener,
};
}),
},
...[1, 2, 3, 4, 5, 6, 7, 8, 9].map(n => {
const shortcut = `CommandOrControl+${n}`;
const listener = () => {
switchTab(n);
};
return {
acceleratorWorksWhenHidden: true,
label: `Switch to tab ${n}`,
accelerator: shortcut,
click: listener,
visible: false,
};
}),
],
},
{
Expand Down
4 changes: 3 additions & 1 deletion tests/affine-desktop/e2e/tabs.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,9 @@ async function enableSplitView(page: Page) {
})
);
});
await page.reload();
await page.reload({
timeout: 30000,
});
}

test('open new tab via cmd+click page link', async ({ page }) => {
Expand Down

0 comments on commit 41b2da8

Please sign in to comment.