Skip to content

Commit

Permalink
feat: support focus events
Browse files Browse the repository at this point in the history
  • Loading branch information
splincode committed Aug 6, 2024
1 parent 900e4f3 commit e4f5b53
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions projects/editor/src/components/editor/editor.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,12 @@ export class TuiEditor extends TuiControl<string> implements OnDestroy {
@Output()
public readonly fileAttached = new EventEmitter<Array<TuiEditorAttachedFile<any>>>();

@Output()
public readonly focusIn = new EventEmitter<void>();

@Output()
public readonly focusOut = new EventEmitter<void>();

public hasMentionPlugin = false;
public focused = false;
public readonly editorService = inject(TuiTiptapEditorService);
Expand Down Expand Up @@ -234,6 +240,12 @@ export class TuiEditor extends TuiControl<string> implements OnDestroy {

protected onActiveZone(focused: boolean): void {
this.focused = focused;

if (focused) {
this.focusIn.emit();
} else {
this.focusOut.emit();
}
}

protected addAnchor(anchor: string): void {
Expand Down

0 comments on commit e4f5b53

Please sign in to comment.