chore(editor): add event track for html preview (#12592)

<!-- This is an auto-generated comment: release notes by coderabbit.ai -->
## Summary by CodeRabbit

- **New Features**
  - Enhanced tracking for code block interactions, including language selection and preview toggling.
  - Improved error reporting for HTML block preview failures, providing better visibility into issues.
- **Bug Fixes**
  - Added explicit feedback and tracking when cross-origin isolation is not supported during code block preview setup.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
This commit is contained in:
Flrande
2025-05-28 10:08:19 +00:00
parent 9e5d132bd0
commit f610d7b8af
7 changed files with 63 additions and 3 deletions

View File

@@ -0,0 +1,8 @@
import type { TelemetryEvent } from './types.js';
export type CodeBlockEventType =
| 'codeBlockLanguageSelect'
| 'htmlBlockTogglePreview'
| 'htmlBlockPreviewFailed';
export type CodeBlockEvents = Record<CodeBlockEventType, TelemetryEvent>;

View File

@@ -1,6 +1,7 @@
import { createIdentifier } from '@blocksuite/global/di';
import type { ExtensionType } from '@blocksuite/store';
import type { CodeBlockEvents } from './code-block.js';
import type { OutDatabaseAllEvents } from './database.js';
import type { LinkToolbarEvents } from './link.js';
import type { NoteEvents } from './note.js';
@@ -26,6 +27,7 @@ import type {
export type TelemetryEventMap = OutDatabaseAllEvents &
LinkToolbarEvents &
SlashMenuEvents &
CodeBlockEvents &
NoteEvents & {
DocCreated: DocCreatedEvent;
Link: TelemetryEvent;