mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-07-20 03:26:47 +08:00
6c125d9a38
fix AF-2420, AF-2391, AF-2265
34 lines
919 B
TypeScript
34 lines
919 B
TypeScript
import type { MainEventRegister } from '../type';
|
|
import { applicationMenuSubjects } from './subject';
|
|
|
|
export * from './create';
|
|
export * from './subject';
|
|
|
|
/**
|
|
* Events triggered by application menu
|
|
*/
|
|
export const applicationMenuEvents = {
|
|
/**
|
|
* File -> New Doc
|
|
*/
|
|
onNewPageAction: (fn: (type: 'page' | 'edgeless') => void) => {
|
|
const sub = applicationMenuSubjects.newPageAction$.subscribe(fn);
|
|
return () => {
|
|
sub.unsubscribe();
|
|
};
|
|
},
|
|
// todo: properly define the active tab type
|
|
openInSettingModal: (fn: (activeTab: string) => void) => {
|
|
const sub = applicationMenuSubjects.openInSettingModal$.subscribe(fn);
|
|
return () => {
|
|
sub.unsubscribe();
|
|
};
|
|
},
|
|
onOpenJournal: (fn: () => void) => {
|
|
const sub = applicationMenuSubjects.openJournal$.subscribe(fn);
|
|
return () => {
|
|
sub.unsubscribe();
|
|
};
|
|
},
|
|
} satisfies Record<string, MainEventRegister>;
|