mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-08-11 05:58:56 +08:00
chore(editor): add telemetry track to display mode of note (#10192)
Close [BS-2468](https://linear.app/affine-design/issue/BS-2468/analytics-for-page-block-polish)
This commit is contained in:
@@ -0,0 +1,10 @@
|
|||||||
|
import type { TelemetryEvent } from './types.js';
|
||||||
|
|
||||||
|
export type NoteEventType = 'NoteDisplayModeChanged';
|
||||||
|
|
||||||
|
export type NoteEvents = {
|
||||||
|
NoteDisplayModeChanged: TelemetryEvent & {
|
||||||
|
control: 'display mode';
|
||||||
|
type: 'note';
|
||||||
|
};
|
||||||
|
};
|
||||||
@@ -2,6 +2,7 @@ import { createIdentifier } from '@blocksuite/global/di';
|
|||||||
|
|
||||||
import type { OutDatabaseAllEvents } from './database.js';
|
import type { OutDatabaseAllEvents } from './database.js';
|
||||||
import type { LinkToolbarEvents } from './link.js';
|
import type { LinkToolbarEvents } from './link.js';
|
||||||
|
import type { NoteEvents } from './note.js';
|
||||||
import type {
|
import type {
|
||||||
AttachmentUploadedEvent,
|
AttachmentUploadedEvent,
|
||||||
DocCreatedEvent,
|
DocCreatedEvent,
|
||||||
@@ -13,7 +14,8 @@ import type {
|
|||||||
} from './types.js';
|
} from './types.js';
|
||||||
|
|
||||||
export type TelemetryEventMap = OutDatabaseAllEvents &
|
export type TelemetryEventMap = OutDatabaseAllEvents &
|
||||||
LinkToolbarEvents & {
|
LinkToolbarEvents &
|
||||||
|
NoteEvents & {
|
||||||
DocCreated: DocCreatedEvent;
|
DocCreated: DocCreatedEvent;
|
||||||
Link: TelemetryEvent;
|
Link: TelemetryEvent;
|
||||||
LinkedDocCreated: LinkedDocCreatedEvent;
|
LinkedDocCreated: LinkedDocCreatedEvent;
|
||||||
|
|||||||
@@ -27,6 +27,7 @@ import {
|
|||||||
FeatureFlagService,
|
FeatureFlagService,
|
||||||
NotificationProvider,
|
NotificationProvider,
|
||||||
SidebarExtensionIdentifier,
|
SidebarExtensionIdentifier,
|
||||||
|
TelemetryProvider,
|
||||||
ThemeProvider,
|
ThemeProvider,
|
||||||
} from '@blocksuite/affine-shared/services';
|
} from '@blocksuite/affine-shared/services';
|
||||||
import {
|
import {
|
||||||
@@ -190,6 +191,7 @@ export class EdgelessChangeNoteButton extends WithDisposable(LitElement) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private _setDisplayMode(note: NoteBlockModel, newMode: NoteDisplayMode) {
|
private _setDisplayMode(note: NoteBlockModel, newMode: NoteDisplayMode) {
|
||||||
|
const oldMode = note.displayMode;
|
||||||
this.edgeless.std.command.exec(changeNoteDisplayMode, {
|
this.edgeless.std.command.exec(changeNoteDisplayMode, {
|
||||||
noteId: note.id,
|
noteId: note.id,
|
||||||
mode: newMode,
|
mode: newMode,
|
||||||
@@ -263,6 +265,17 @@ export class EdgelessChangeNoteButton extends WithDisposable(LitElement) {
|
|||||||
clear();
|
clear();
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
this.edgeless.std
|
||||||
|
.getOptional(TelemetryProvider)
|
||||||
|
?.track('NoteDisplayModeChanged', {
|
||||||
|
page: 'whiteboard editor',
|
||||||
|
segment: 'element toolbar',
|
||||||
|
module: 'element toolbar',
|
||||||
|
control: 'display mode',
|
||||||
|
type: 'note',
|
||||||
|
other: `from ${oldMode} to ${newMode}`,
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private _setShadowType(shadowType: string) {
|
private _setShadowType(shadowType: string) {
|
||||||
|
|||||||
Reference in New Issue
Block a user