mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-07-18 18:46:19 +08:00
feat(core): add track events for cmdk (#7668)
This commit is contained in:
@@ -2,6 +2,7 @@ import {
|
||||
PreconditionStrategy,
|
||||
registerAffineCommand,
|
||||
} from '@affine/core/commands';
|
||||
import { track } from '@affine/core/mixpanel';
|
||||
import { useService } from '@toeverything/infra';
|
||||
import { useEffect } from 'react';
|
||||
|
||||
@@ -23,6 +24,8 @@ export function useRegisterNavigationCommands() {
|
||||
binding: '$mod+[',
|
||||
},
|
||||
run() {
|
||||
track.$.cmdk.general.goBack();
|
||||
|
||||
navigator.back();
|
||||
},
|
||||
})
|
||||
@@ -38,6 +41,8 @@ export function useRegisterNavigationCommands() {
|
||||
binding: '$mod+]',
|
||||
},
|
||||
run() {
|
||||
track.$.cmdk.general.goForward();
|
||||
|
||||
navigator.forward();
|
||||
},
|
||||
})
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { track } from '@affine/core/mixpanel';
|
||||
import type { DocsService } from '@toeverything/infra';
|
||||
import { Service } from '@toeverything/infra';
|
||||
|
||||
@@ -47,6 +48,10 @@ export class CMDKQuickSearchService extends Service {
|
||||
blockId?: string;
|
||||
} = result.payload;
|
||||
|
||||
result.source === 'recent-doc' && track.$.cmdk.recent.recentDocs();
|
||||
result.source === 'docs' &&
|
||||
track.$.cmdk.results.searchResultsDocs();
|
||||
|
||||
this.workbenchService.workbench.openDoc({
|
||||
docId: doc.docId,
|
||||
blockId: doc.blockId,
|
||||
|
||||
Reference in New Issue
Block a user