mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-14 05:14:54 +00:00
feat: add isNewDoc flag to quick search api (#7232)
This commit is contained in:
@@ -13,6 +13,7 @@ import type {
|
||||
} from '@affine/core/modules/cmdk';
|
||||
import type { PeekViewService } from '@affine/core/modules/peek-view';
|
||||
import type { ActivePeekView } from '@affine/core/modules/peek-view/entities/peek-view';
|
||||
import { mixpanel } from '@affine/core/utils';
|
||||
import { DebugLogger } from '@affine/debug';
|
||||
import type { BlockSpec, WidgetElement } from '@blocksuite/block-std';
|
||||
import {
|
||||
@@ -413,6 +414,25 @@ export function patchQuickSearchService(
|
||||
pageId: linkedDoc.id,
|
||||
},
|
||||
]);
|
||||
if (result.isNewDoc) {
|
||||
mixpanel.track('DocCreated', {
|
||||
control: 'linked doc',
|
||||
module: 'slash commands',
|
||||
type: 'linked doc',
|
||||
category: 'doc',
|
||||
});
|
||||
mixpanel.track('LinkedDocCreated', {
|
||||
control: 'new doc',
|
||||
module: 'slash commands',
|
||||
type: 'doc',
|
||||
});
|
||||
} else {
|
||||
mixpanel.track('LinkedDocCreated', {
|
||||
control: 'linked doc',
|
||||
module: 'slash commands',
|
||||
type: 'doc',
|
||||
});
|
||||
}
|
||||
} else if ('userInput' in result) {
|
||||
const embedOptions = service.getEmbedBlockOptions(
|
||||
result.userInput
|
||||
|
||||
@@ -13,6 +13,7 @@ export type SearchCallbackResult =
|
||||
| {
|
||||
docId: string;
|
||||
blockId?: string;
|
||||
isNewDoc?: boolean;
|
||||
}
|
||||
| {
|
||||
query: string;
|
||||
|
||||
@@ -384,11 +384,7 @@ export const useSearchCallbackCommands = () => {
|
||||
const page = pageHelper.createPage('page', false);
|
||||
page.load();
|
||||
pageMetaHelper.setDocTitle(page.id, query);
|
||||
mixpanel.track('DocCreated', {
|
||||
control: 'cmdk',
|
||||
type: 'doc',
|
||||
});
|
||||
onSelectPage({ docId: page.id });
|
||||
onSelectPage({ docId: page.id, isNewDoc: true });
|
||||
},
|
||||
icon: <PageIcon />,
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user