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 { FormControl } from "@angular/forms";
|
||||||
import { AngularEditorConfig } from "@kolkov/angular-editor";
|
import { AngularEditorConfig } from "@kolkov/angular-editor";
|
||||||
import { Subscription } from "rxjs";
|
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
|
// TODO: performance issue with this control. changed the change detection strategy in case it improves
|
||||||
changeDetection: ChangeDetectionStrategy.OnPush
|
changeDetection: ChangeDetectionStrategy.OnPush
|
||||||
})
|
})
|
||||||
export class RichTextEditorComponent implements OnInit, OnDestroy {
|
export class RichTextEditorComponent implements OnInit, OnChanges, OnDestroy {
|
||||||
|
|
||||||
@Input() form: FormControl;
|
@Input() form: FormControl;
|
||||||
@Input() id: string = "editor1";
|
@Input() id: string = "editor1";
|
||||||
@Input() placeholder: string = "Enter text";
|
@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 {
|
ngOnDestroy(): void {
|
||||||
if (this.formTouchSubscription) {
|
if (this.formTouchSubscription) {
|
||||||
this.formTouchSubscription.unsubscribe();
|
this.formTouchSubscription.unsubscribe();
|
||||||
|
|
Loading…
Reference in New Issue