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