mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-13 21:05:19 +00:00
fix(native): split application & tappable application (#10491)
A listening tappable app's info should inherit from its group process's name/icon. However the group process may not be listed as a tappable application.
This commit is contained in:
@@ -19,6 +19,7 @@ import {
|
||||
import { configureFindInPageModule } from '@affine/core/modules/find-in-page';
|
||||
import { GlobalContextService } from '@affine/core/modules/global-context';
|
||||
import { I18nProvider } from '@affine/core/modules/i18n';
|
||||
import { JournalService } from '@affine/core/modules/journal';
|
||||
import { LifecycleService } from '@affine/core/modules/lifecycle';
|
||||
import {
|
||||
configureElectronStateStorageImpls,
|
||||
@@ -146,7 +147,8 @@ events?.applicationMenu.openAboutPageInSettingModal(() =>
|
||||
activeTab: 'about',
|
||||
})
|
||||
);
|
||||
events?.applicationMenu.onNewPageAction(() => {
|
||||
|
||||
function getCurrentWorkspace() {
|
||||
const currentWorkspaceId = frameworkProvider
|
||||
.get(GlobalContextService)
|
||||
.globalContext.workspaceId.get();
|
||||
@@ -158,6 +160,19 @@ events?.applicationMenu.onNewPageAction(() => {
|
||||
return;
|
||||
}
|
||||
const { workspace, dispose } = workspaceRef;
|
||||
|
||||
return {
|
||||
workspace,
|
||||
dispose,
|
||||
};
|
||||
}
|
||||
|
||||
events?.applicationMenu.onNewPageAction(type => {
|
||||
const currentWorkspace = getCurrentWorkspace();
|
||||
if (!currentWorkspace) {
|
||||
return;
|
||||
}
|
||||
const { workspace, dispose } = currentWorkspace;
|
||||
const editorSettingService = frameworkProvider.get(EditorSettingService);
|
||||
const docsService = workspace.scope.get(DocsService);
|
||||
const editorSetting = editorSettingService.editorSetting;
|
||||
@@ -171,7 +186,7 @@ events?.applicationMenu.onNewPageAction(() => {
|
||||
if (!isActive) {
|
||||
return;
|
||||
}
|
||||
const page = docsService.createDoc({ docProps });
|
||||
const page = docsService.createDoc({ docProps, primaryMode: type });
|
||||
workspace.scope.get(WorkbenchService).workbench.openDoc(page.id);
|
||||
})
|
||||
.catch(err => {
|
||||
@@ -181,6 +196,21 @@ events?.applicationMenu.onNewPageAction(() => {
|
||||
dispose();
|
||||
});
|
||||
|
||||
events?.applicationMenu.onOpenJournal(() => {
|
||||
const currentWorkspace = getCurrentWorkspace();
|
||||
if (!currentWorkspace) {
|
||||
return;
|
||||
}
|
||||
const { workspace, dispose } = currentWorkspace;
|
||||
|
||||
const workbench = workspace.scope.get(WorkbenchService).workbench;
|
||||
const journalService = workspace.scope.get(JournalService);
|
||||
const docId = journalService.ensureJournalByDate(new Date()).id;
|
||||
workbench.openDoc(docId);
|
||||
|
||||
dispose();
|
||||
});
|
||||
|
||||
export function App() {
|
||||
return (
|
||||
<Suspense>
|
||||
|
||||
Reference in New Issue
Block a user