chore(editor): update page block telemetry (#10487)
Close [BS-2711](https://linear.app/affine-design/issue/BS-2711/page-block埋点更新)
This commit is contained in:
@@ -2,10 +2,11 @@ import { EdgelessLegacySlotIdentifier } from '@blocksuite/affine-block-surface';
|
|||||||
import type { DocTitle } from '@blocksuite/affine-components/doc-title';
|
import type { DocTitle } from '@blocksuite/affine-components/doc-title';
|
||||||
import { NoteDisplayMode } from '@blocksuite/affine-model';
|
import { NoteDisplayMode } from '@blocksuite/affine-model';
|
||||||
import { EDGELESS_BLOCK_CHILD_PADDING } from '@blocksuite/affine-shared/consts';
|
import { EDGELESS_BLOCK_CHILD_PADDING } from '@blocksuite/affine-shared/consts';
|
||||||
|
import { TelemetryProvider } from '@blocksuite/affine-shared/services';
|
||||||
import { stopPropagation } from '@blocksuite/affine-shared/utils';
|
import { stopPropagation } from '@blocksuite/affine-shared/utils';
|
||||||
import { toGfxBlockComponent } from '@blocksuite/block-std';
|
import { toGfxBlockComponent } from '@blocksuite/block-std';
|
||||||
import { Bound } from '@blocksuite/global/utils';
|
import { Bound } from '@blocksuite/global/utils';
|
||||||
import { html, nothing } from 'lit';
|
import { html, nothing, type PropertyValues } from 'lit';
|
||||||
import { query, state } from 'lit/decorators.js';
|
import { query, state } from 'lit/decorators.js';
|
||||||
import { classMap } from 'lit/directives/class-map.js';
|
import { classMap } from 'lit/directives/class-map.js';
|
||||||
import { ifDefined } from 'lit/directives/if-defined.js';
|
import { ifDefined } from 'lit/directives/if-defined.js';
|
||||||
@@ -173,6 +174,15 @@ export class EdgelessNoteBlockComponent extends toGfxBlockComponent(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override updated(changedProperties: PropertyValues) {
|
||||||
|
if (changedProperties.has('_editing') && this._editing) {
|
||||||
|
this.std.getOptional(TelemetryProvider)?.track('EdgelessNoteEditing', {
|
||||||
|
page: 'edgeless',
|
||||||
|
segment: this.model.isPageBlock() ? 'page' : 'note',
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
override getRenderingRect() {
|
override getRenderingRect() {
|
||||||
const { xywh, edgeless } = this.model;
|
const { xywh, edgeless } = this.model;
|
||||||
const { collapse, scale = 1 } = edgeless;
|
const { collapse, scale = 1 } = edgeless;
|
||||||
|
|||||||
@@ -7,4 +7,5 @@ export type NoteEvents = {
|
|||||||
control: 'display mode';
|
control: 'display mode';
|
||||||
type: 'note';
|
type: 'note';
|
||||||
};
|
};
|
||||||
|
EdgelessNoteEditing: TelemetryEvent;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -69,6 +69,9 @@ const EdgelessNoteToggleButton = ({ note }: { note: NoteBlockModel }) => {
|
|||||||
}, [gfx, note]);
|
}, [gfx, note]);
|
||||||
|
|
||||||
const toggle = useCallback(() => {
|
const toggle = useCallback(() => {
|
||||||
|
track.edgeless.pageBlock.headerToolbar.toggle({
|
||||||
|
type: collapsed ? 'expand' : 'collapse',
|
||||||
|
});
|
||||||
note.doc.transact(() => {
|
note.doc.transact(() => {
|
||||||
if (collapsed) {
|
if (collapsed) {
|
||||||
note.edgeless.collapse = false;
|
note.edgeless.collapse = false;
|
||||||
@@ -111,6 +114,7 @@ const ViewInPageButton = () => {
|
|||||||
const editor = useService(EditorService).editor;
|
const editor = useService(EditorService).editor;
|
||||||
|
|
||||||
const viewInPage = useCallback(() => {
|
const viewInPage = useCallback(() => {
|
||||||
|
track.edgeless.pageBlock.headerToolbar.switchPageMode();
|
||||||
editor.setMode('page');
|
editor.setMode('page');
|
||||||
}, [editor]);
|
}, [editor]);
|
||||||
|
|
||||||
@@ -132,7 +136,7 @@ const InfoButton = ({ note }: { note: NoteBlockModel }) => {
|
|||||||
const workspaceDialogService = useService(WorkspaceDialogService);
|
const workspaceDialogService = useService(WorkspaceDialogService);
|
||||||
|
|
||||||
const onOpenInfoModal = useCallback(() => {
|
const onOpenInfoModal = useCallback(() => {
|
||||||
track.doc.editor.pageBlockHeader.openDocInfo();
|
track.edgeless.pageBlock.headerToolbar.openDocInfo();
|
||||||
workspaceDialogService.open('doc-info', { docId: note.doc.id });
|
workspaceDialogService.open('doc-info', { docId: note.doc.id });
|
||||||
}, [note.doc.id, workspaceDialogService]);
|
}, [note.doc.id, workspaceDialogService]);
|
||||||
|
|
||||||
@@ -162,6 +166,7 @@ const LinkButton = ({ note }: { note: NoteBlockModel }) => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
const copyLink = useCallback(() => {
|
const copyLink = useCallback(() => {
|
||||||
|
track.edgeless.pageBlock.headerToolbar.copyBlockToLink();
|
||||||
onClickCopyLink('edgeless', [note.id]);
|
onClickCopyLink('edgeless', [note.id]);
|
||||||
}, [note.id, onClickCopyLink]);
|
}, [note.id, onClickCopyLink]);
|
||||||
|
|
||||||
|
|||||||
@@ -53,7 +53,12 @@ type DocEvents =
|
|||||||
| 'editProperty'
|
| 'editProperty'
|
||||||
| 'editPropertyMeta'
|
| 'editPropertyMeta'
|
||||||
| 'addProperty';
|
| 'addProperty';
|
||||||
type EditorEvents = 'bold' | 'italic' | 'underline' | 'strikeThrough';
|
type EditorEvents =
|
||||||
|
| 'bold'
|
||||||
|
| 'italic'
|
||||||
|
| 'underline'
|
||||||
|
| 'strikeThrough'
|
||||||
|
| 'foldEdgelessNote';
|
||||||
// END SECTION
|
// END SECTION
|
||||||
|
|
||||||
// SECTION: setting events
|
// SECTION: setting events
|
||||||
@@ -360,7 +365,6 @@ const PageEvents = {
|
|||||||
'openInPeekView',
|
'openInPeekView',
|
||||||
],
|
],
|
||||||
aiActions: ['requestSignIn'],
|
aiActions: ['requestSignIn'],
|
||||||
pageBlockHeader: ['openDocInfo'],
|
|
||||||
starterBar: ['quickStart', 'openTemplateListMenu'],
|
starterBar: ['quickStart', 'openTemplateListMenu'],
|
||||||
},
|
},
|
||||||
inlineDocInfo: {
|
inlineDocInfo: {
|
||||||
@@ -377,7 +381,16 @@ const PageEvents = {
|
|||||||
backlinkPreview: ['navigate'],
|
backlinkPreview: ['navigate'],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
edgeless: {},
|
edgeless: {
|
||||||
|
pageBlock: {
|
||||||
|
headerToolbar: [
|
||||||
|
'toggle',
|
||||||
|
'openDocInfo',
|
||||||
|
'copyBlockToLink',
|
||||||
|
'switchPageMode',
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
workspace: {
|
workspace: {
|
||||||
$: {
|
$: {
|
||||||
$: ['upgradeWorkspace'],
|
$: ['upgradeWorkspace'],
|
||||||
|
|||||||
Reference in New Issue
Block a user