Skip to content

Commit

Permalink
fix: primefaces#16825 Editor: reactive forms setValue does not work w…
Browse files Browse the repository at this point in the history
…hile editor formControl is in dialog that is not visible
  • Loading branch information
stefanbildl committed Nov 22, 2024
1 parent cb341b8 commit 93f7900
Showing 1 changed file with 2 additions and 24 deletions.
26 changes: 2 additions & 24 deletions src/app/components/editor/editor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -174,8 +174,6 @@ export class Editor implements AfterContentInit, ControlValueAccessor {

value: Nullable<string>;

delayedCommand: Function | null = null;

_readonly: boolean = false;

onModelChange: Function = () => {};
Expand All @@ -188,10 +186,6 @@ export class Editor implements AfterContentInit, ControlValueAccessor {

headerTemplate: Nullable<TemplateRef<any>>;

private get isAttachedQuillEditorToDOM(): boolean | undefined {
return this.quillElements?.editorElement?.isConnected;
}

private quillElements!: { editorElement: HTMLElement; toolbarElement: HTMLElement };

constructor(
Expand Down Expand Up @@ -222,25 +216,9 @@ export class Editor implements AfterContentInit, ControlValueAccessor {

if (this.quill) {
if (value) {
const command = (): void => {
this.quill.setContents(this.quill.clipboard.convert(this.dynamicQuill.version.startsWith('2') ? { html: this.value } : this.value));
};

if (this.isAttachedQuillEditorToDOM) {
command();
} else {
this.delayedCommand = command;
}
this.quill.setContents(this.quill.clipboard.convert(this.dynamicQuill.version.startsWith('2') ? { html: this.value } : this.value));
} else {
const command = (): void => {
this.quill.setText('');
};

if (this.isAttachedQuillEditorToDOM) {
command();
} else {
this.delayedCommand = command;
}
this.quill.setText('');
}
}
}
Expand Down

0 comments on commit 93f7900

Please sign in to comment.