fixed disabled state after finalizing on rich text editor
This commit is contained in:
parent
716a930c02
commit
d2cb6342ef
|
@ -1,4 +1,4 @@
|
|||
import { ChangeDetectionStrategy, Component, EventEmitter, Input, OnDestroy, OnInit } from "@angular/core";
|
||||
import { ChangeDetectionStrategy, Component, EventEmitter, Input, OnChanges, OnDestroy, OnInit, SimpleChanges } from "@angular/core";
|
||||
import { FormControl } from "@angular/forms";
|
||||
import { AngularEditorConfig } from "@kolkov/angular-editor";
|
||||
import { Subscription } from "rxjs";
|
||||
|
@ -22,7 +22,8 @@ import { Subscription } from "rxjs";
|
|||
// TODO: performance issue with this control. changed the change detection strategy in case it improves
|
||||
changeDetection: ChangeDetectionStrategy.OnPush
|
||||
})
|
||||
export class RichTextEditorComponent implements OnInit, OnDestroy {
|
||||
export class RichTextEditorComponent implements OnInit, OnChanges, OnDestroy {
|
||||
|
||||
@Input() form: FormControl;
|
||||
@Input() id: string = "editor1";
|
||||
@Input() placeholder: string = "Enter text";
|
||||
|
@ -82,6 +83,12 @@ export class RichTextEditorComponent implements OnInit, OnDestroy {
|
|||
}
|
||||
}
|
||||
|
||||
ngOnChanges(changes: SimpleChanges): void {
|
||||
if (changes['editable']) {
|
||||
this.editorConfig.editable = this.editable;
|
||||
}
|
||||
}
|
||||
|
||||
ngOnDestroy(): void {
|
||||
if (this.formTouchSubscription) {
|
||||
this.formTouchSubscription.unsubscribe();
|
||||
|
|
Loading…
Reference in New Issue