mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-11 20:08:37 +00:00
feat(editor): add tracking for the creation of linked-doc (#9266)
close: BS-2189
This commit is contained in:
@@ -7,6 +7,7 @@ import type {
|
||||
DocCreatedEvent,
|
||||
ElementCreationEvent,
|
||||
ElementLockEvent,
|
||||
LinkedDocCreatedEvent,
|
||||
MindMapCollapseEvent,
|
||||
TelemetryEvent,
|
||||
} from './types.js';
|
||||
@@ -15,7 +16,7 @@ export type TelemetryEventMap = OutDatabaseAllEvents &
|
||||
LinkToolbarEvents & {
|
||||
DocCreated: DocCreatedEvent;
|
||||
Link: TelemetryEvent;
|
||||
LinkedDocCreated: TelemetryEvent;
|
||||
LinkedDocCreated: LinkedDocCreatedEvent;
|
||||
SplitNote: TelemetryEvent;
|
||||
CanvasElementAdded: ElementCreationEvent;
|
||||
EdgelessElementLocked: ElementLockEvent;
|
||||
|
||||
@@ -22,6 +22,10 @@ export interface TelemetryEvent {
|
||||
other?: unknown;
|
||||
}
|
||||
|
||||
export interface LinkedDocCreatedEvent extends TelemetryEvent {
|
||||
parentFlavour?: string;
|
||||
}
|
||||
|
||||
export interface DocCreatedEvent extends TelemetryEvent {
|
||||
page?: 'doc editor' | 'whiteboard editor';
|
||||
segment?: 'whiteboard' | 'note' | 'doc';
|
||||
|
||||
@@ -3,6 +3,7 @@ import type {
|
||||
DatabaseBlockModel,
|
||||
RootBlockModel,
|
||||
} from '@blocksuite/affine-model';
|
||||
import { TelemetryProvider } from '@blocksuite/affine-shared/services';
|
||||
import type { AffineTextAttributes } from '@blocksuite/affine-shared/types';
|
||||
import {
|
||||
createDefaultDoc,
|
||||
@@ -78,6 +79,13 @@ export class NoteRenderer
|
||||
])
|
||||
);
|
||||
}
|
||||
// Track when a linked doc is created in database title column
|
||||
this.host.std.getOptional(TelemetryProvider)?.track('LinkedDocCreated', {
|
||||
segment: 'database',
|
||||
module: 'center peek in database',
|
||||
type: 'turn into',
|
||||
parentFlavour: 'affine:database',
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -3,7 +3,10 @@ import {
|
||||
type RichText,
|
||||
} from '@blocksuite/affine-components/rich-text';
|
||||
import type { RootBlockModel } from '@blocksuite/affine-model';
|
||||
import { ParseDocUrlProvider } from '@blocksuite/affine-shared/services';
|
||||
import {
|
||||
ParseDocUrlProvider,
|
||||
TelemetryProvider,
|
||||
} from '@blocksuite/affine-shared/services';
|
||||
import {
|
||||
getViewportElement,
|
||||
isValidUrl,
|
||||
@@ -295,6 +298,14 @@ export class HeaderAreaTextCellEditing extends BaseTextCell {
|
||||
index: inlineRange.index + text.length,
|
||||
length: 0,
|
||||
});
|
||||
|
||||
// Track when a linked doc is created in database title column
|
||||
std?.getOptional(TelemetryProvider)?.track('LinkedDocCreated', {
|
||||
module: 'database title cell',
|
||||
type: 'paste',
|
||||
segment: 'database',
|
||||
parentFlavour: 'affine:database',
|
||||
});
|
||||
} else {
|
||||
inlineEditor?.insertText(inlineRange, text, {
|
||||
link: text,
|
||||
@@ -390,6 +401,7 @@ export class HeaderAreaTextCellEditing extends BaseTextCell {
|
||||
this.topContenteditableElement?.host
|
||||
? getViewportElement(this.topContenteditableElement.host)
|
||||
: null}"
|
||||
data-parent-flavour="affine:database"
|
||||
class="data-view-header-area-rich-text can-link-doc"
|
||||
></rich-text>`;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user