tinymce-angular
tinymce-angular copied to clipboard
Inline editor init fails when inside ngIf or ngFor.
What is the current behavior?
Currently getting such error when editor (editor is not in iframe but :warning: inline so it shouldn't happen) is initialized inside ngFor or ngIf. Due to this error toolbar for such editors is not displayed and content from formControl is not set on init.

Please provide the steps to reproduce and if possible a minimal demo of the problem via codesandbox.io or similar.
Error is happening in tinymce.js (place marked in screenshot) because documentOrShadowRoot is for some reason not the document but some ancestor element for such editors.

What is the expected behavior?
No such errors. When editor is not in mat tabs or with ngIf/ngFor attribute it doesn't fail (screenshot of working editor attached below).

We were able to fix it with some hack (not sure yet how stable it is). We have a wrapper component for angular-tinymce where we added a viewInited boolean variable. In ngAfterViewInit this variable is toggled to true. And it is used in template like so:
<editor *ngIf="viewInited"></editor>
Which versions of TinyMCE/TinyMCE-Angular, and which browser / OS are affected by this issue? Did this work in previous versions of TinyMCE or TinyMCE-Angular?
- "@angular/animations": "^11.2.13",
- "@angular/cdk": "^11.2.12",
- "@angular/common": "^11.2.13",
- "@angular/compiler": "^11.2.13",
- "@angular/core": "^11.2.13",
- "@angular/forms": "^11.2.13",
- "@tinymce/tinymce-angular": "^4.2.2",
- "tinymce": "5.8.0"
Ref: INT-2540
It looks like it is referencing a removed element. It's a bit hard to tell without a replication case. Can you provide a simple replication?
@jscasca , will create a repro this month (I hope even this week).
As this issue has gone stale, I'm closing it for now. Feel free to open a new issue if this problem persists.