Skip to content

Commit

Permalink
fix: patch after rendered contenteditable element (#1602)
Browse files Browse the repository at this point in the history
  • Loading branch information
splincode authored Nov 26, 2024
1 parent e3976a8 commit 76997da
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion projects/editor/components/editor/editor.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import {NgIf, NgTemplateOutlet} from '@angular/common';
import type {OnDestroy} from '@angular/core';
import {
ChangeDetectionStrategy,
ChangeDetectorRef,
Component,
computed,
DestroyRef,
Expand Down Expand Up @@ -125,6 +126,7 @@ export class TuiEditor extends TuiControl<string> implements OnDestroy {
protected readonly options = inject(TUI_EDITOR_OPTIONS);
protected readonly editorLoaded = signal(false);
protected readonly editorLoaded$ = inject(TIPTAP_EDITOR);
protected readonly cd = inject(ChangeDetectorRef);

protected readonly $ = this.editorLoaded$
.pipe(delay(0), takeUntilDestroyed())
Expand All @@ -135,10 +137,13 @@ export class TuiEditor extends TuiControl<string> implements OnDestroy {
(extension) => extension.name === 'mention',
);

this.patchContentEditableElement();
this.listenResizeEvents();
this.editorService.setValue(this.firstInitialValue);
this.editorLoaded.set(true);
this.cd.detectChanges();

// patch after rendered contenteditable element
this.patchContentEditableElement();
});

/**
Expand Down

0 comments on commit 76997da

Please sign in to comment.