@@ -45,12 +45,15 @@ import {
4545} from './image' ;
4646import { LinkPopoverController } from './link-popover-controller' ;
4747import { PlaygroundLinkPopover } from './link-popover' ;
48+ import { LinkPopover } from './link-popover.model' ;
4849import {
4950 PlaygroundMentionController ,
51+ PlaygroundMentionOption ,
5052 createPlaygroundMentionSource ,
5153} from './mention' ;
5254import { PlaygroundMentionMenu } from './mention-menu' ;
5355import { PlaygroundToolbar } from './toolbar' ;
56+ import { PosthogService } from '../services/posthog.service' ;
5457
5558@Component ( {
5659 changeDetection : ChangeDetectionStrategy . OnPush ,
@@ -103,7 +106,7 @@ import { PlaygroundToolbar } from './toolbar';
103106 [loading]="mentionController.loading()"
104107 [activeIndex]="mentionController.activeIndex()"
105108 (activate)="mentionController.setActiveIndex($event)"
106- (pick)="mentionController.insert ($event)"
109+ (pick)="onMentionPick ($event)"
107110 (dismiss)="mentionController.hide()"
108111 />
109112 }
@@ -113,7 +116,7 @@ import { PlaygroundToolbar } from './toolbar';
113116 [href]="linkPopover.href()"
114117 (hrefChange)="linkPopover.href.set($event)"
115118 (edit)="linkPopover.edit($event)"
116- (save)="linkPopover.save ($event)"
119+ (save)="onLinkSave ($event)"
117120 (remove)="linkPopover.remove($event)"
118121 (dismiss)="linkPopover.hide()"
119122 (keepOpen)="linkPopover.keepOpen()"
@@ -135,6 +138,7 @@ import { PlaygroundToolbar } from './toolbar';
135138} )
136139export class Playground {
137140 private readonly destroyRef = inject ( DestroyRef ) ;
141+ private readonly posthogService = inject ( PosthogService ) ;
138142 // `#mentionSurface` sits on the <qalma-content> component, so without an
139143 // explicit `read` the query resolves to the component instance (whose
140144 // `.nativeElement` is undefined). Read the host ElementRef instead.
@@ -238,6 +242,10 @@ export class Playground {
238242 currentImage ? 'updateImage' : 'insertImage' ,
239243 commandValue ,
240244 ) ;
245+
246+ this . posthogService . posthog . capture ( 'playground_image_inserted' , {
247+ type : 'url' ,
248+ } ) ;
241249 }
242250
243251 protected chooseImageFile ( ) : void {
@@ -269,6 +277,20 @@ export class Playground {
269277 title : file . name ,
270278 previewSrc,
271279 } ) ;
280+
281+ this . posthogService . posthog . capture ( 'playground_image_uploaded' , {
282+ mime_type : file . type ,
283+ } ) ;
284+ }
285+
286+ protected onLinkSave ( popover : LinkPopover ) : void {
287+ this . linkPopover . save ( popover ) ;
288+ this . posthogService . posthog . capture ( 'playground_link_saved' ) ;
289+ }
290+
291+ protected onMentionPick ( option : PlaygroundMentionOption ) : void {
292+ this . mentionController . insert ( option ) ;
293+ this . posthogService . posthog . capture ( 'playground_mention_inserted' ) ;
272294 }
273295
274296 private revokeImagePreviewUrls ( ) : void {
0 commit comments