mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-07-19 02:56:23 +08:00
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 { NoteDisplayMode } from '@blocksuite/affine-model';
|
||||
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 { toGfxBlockComponent } from '@blocksuite/block-std';
|
||||
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 { classMap } from 'lit/directives/class-map.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() {
|
||||
const { xywh, edgeless } = this.model;
|
||||
const { collapse, scale = 1 } = edgeless;
|
||||
|
||||
@@ -7,4 +7,5 @@ export type NoteEvents = {
|
||||
control: 'display mode';
|
||||
type: 'note';
|
||||
};
|
||||
EdgelessNoteEditing: TelemetryEvent;
|
||||
};
|
||||
|
||||
+6
-1
@@ -69,6 +69,9 @@ const EdgelessNoteToggleButton = ({ note }: { note: NoteBlockModel }) => {
|
||||
}, [gfx, note]);
|
||||
|
||||
const toggle = useCallback(() => {
|
||||
track.edgeless.pageBlock.headerToolbar.toggle({
|
||||
type: collapsed ? 'expand' : 'collapse',
|
||||
});
|
||||
note.doc.transact(() => {
|
||||
if (collapsed) {
|
||||
note.edgeless.collapse = false;
|
||||
@@ -111,6 +114,7 @@ const ViewInPageButton = () => {
|
||||
const editor = useService(EditorService).editor;
|
||||
|
||||
const viewInPage = useCallback(() => {
|
||||
track.edgeless.pageBlock.headerToolbar.switchPageMode();
|
||||
editor.setMode('page');
|
||||
}, [editor]);
|
||||
|
||||
@@ -132,7 +136,7 @@ const InfoButton = ({ note }: { note: NoteBlockModel }) => {
|
||||
const workspaceDialogService = useService(WorkspaceDialogService);
|
||||
|
||||
const onOpenInfoModal = useCallback(() => {
|
||||
track.doc.editor.pageBlockHeader.openDocInfo();
|
||||
track.edgeless.pageBlock.headerToolbar.openDocInfo();
|
||||
workspaceDialogService.open('doc-info', { docId: note.doc.id });
|
||||
}, [note.doc.id, workspaceDialogService]);
|
||||
|
||||
@@ -162,6 +166,7 @@ const LinkButton = ({ note }: { note: NoteBlockModel }) => {
|
||||
});
|
||||
|
||||
const copyLink = useCallback(() => {
|
||||
track.edgeless.pageBlock.headerToolbar.copyBlockToLink();
|
||||
onClickCopyLink('edgeless', [note.id]);
|
||||
}, [note.id, onClickCopyLink]);
|
||||
|
||||
|
||||
@@ -53,7 +53,12 @@ type DocEvents =
|
||||
| 'editProperty'
|
||||
| 'editPropertyMeta'
|
||||
| 'addProperty';
|
||||
type EditorEvents = 'bold' | 'italic' | 'underline' | 'strikeThrough';
|
||||
type EditorEvents =
|
||||
| 'bold'
|
||||
| 'italic'
|
||||
| 'underline'
|
||||
| 'strikeThrough'
|
||||
| 'foldEdgelessNote';
|
||||
// END SECTION
|
||||
|
||||
// SECTION: setting events
|
||||
@@ -360,7 +365,6 @@ const PageEvents = {
|
||||
'openInPeekView',
|
||||
],
|
||||
aiActions: ['requestSignIn'],
|
||||
pageBlockHeader: ['openDocInfo'],
|
||||
starterBar: ['quickStart', 'openTemplateListMenu'],
|
||||
},
|
||||
inlineDocInfo: {
|
||||
@@ -377,7 +381,16 @@ const PageEvents = {
|
||||
backlinkPreview: ['navigate'],
|
||||
},
|
||||
},
|
||||
edgeless: {},
|
||||
edgeless: {
|
||||
pageBlock: {
|
||||
headerToolbar: [
|
||||
'toggle',
|
||||
'openDocInfo',
|
||||
'copyBlockToLink',
|
||||
'switchPageMode',
|
||||
],
|
||||
},
|
||||
},
|
||||
workspace: {
|
||||
$: {
|
||||
$: ['upgradeWorkspace'],
|
||||
|
||||
Reference in New Issue
Block a user