fix(electron): app menu about action (#10445)

fix AF-2268
This commit is contained in:
pengx17
2025-03-03 03:00:17 +00:00
parent bd1b26a230
commit 629aea48df
2 changed files with 15 additions and 9 deletions

View File

@@ -142,12 +142,6 @@ window.addEventListener('unload', () => {
.catch(console.error);
});
events?.applicationMenu.openAboutPageInSettingModal(() =>
frameworkProvider.get(WorkspaceDialogService).open('setting', {
activeTab: 'about',
})
);
function getCurrentWorkspace() {
const currentWorkspaceId = frameworkProvider
.get(GlobalContextService)
@@ -167,6 +161,18 @@ function getCurrentWorkspace() {
};
}
events?.applicationMenu.openAboutPageInSettingModal(() => {
const currentWorkspace = getCurrentWorkspace();
if (!currentWorkspace) {
return;
}
const { workspace, dispose } = currentWorkspace;
workspace.scope.get(WorkspaceDialogService).open('setting', {
activeTab: 'about',
});
dispose();
});
events?.applicationMenu.onNewPageAction(type => {
const currentWorkspace = getCurrentWorkspace();
if (!currentWorkspace) {

View File

@@ -60,8 +60,9 @@ export function useRegisterWorkspaceCommands() {
const appSidebarService = useService(AppSidebarService);
const i18n = useService(I18nService).i18n;
const quitAndInstall =
useServiceOptional(DesktopApiService)?.handler.updater.quitAndInstall;
const desktopApiService = useServiceOptional(DesktopApiService);
const quitAndInstall = desktopApiService?.handler.updater.quitAndInstall;
useEffect(() => {
const unsub = registerCMDKCommand(cmdkQuickSearchService);
@@ -124,7 +125,6 @@ export function useRegisterWorkspaceCommands() {
};
}, [editorSettingService, store, t, theme]);
// register AffineLanguageCommands
useEffect(() => {
const unsub = registerAffineLanguageCommands({
i18n,