Skip to content

Commit

Permalink
add change event for wysiwyg
Browse files Browse the repository at this point in the history
  • Loading branch information
jsavell committed Jun 18, 2024
1 parent eaa86e1 commit a3f3973
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions projects/wvr-elements/src/lib/wvr-wysiwyg/wvr-wysiwyg.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ export class WvrWysiwygComponent extends WvrBaseComponent implements OnInit, OnD

@Input() emitSaveEvent: string;

@Input() emitChangeEvent: string;

@Input() set height(height: string) { this.config.height = height; }
get height(): string { return this.config.height; }

Expand Down Expand Up @@ -108,6 +110,18 @@ export class WvrWysiwygComponent extends WvrBaseComponent implements OnInit, OnD
}));
}

onChange($event): void {
if (this.emitChangeEvent) {
this.eRef.nativeElement.dispatchEvent(new CustomEvent(this.emitChangeEvent, {
bubbles: true,
detail: {
data: this.content,
wysiwyg: this
}
}));
}
}

onSave($event): void {
this.store.dispatch(WysiwygActions.saveWysiwyg({
content: this.content,
Expand Down

0 comments on commit a3f3973

Please sign in to comment.