tinymce / tinymce-angular

Official TinyMCE Angular Component
MIT License
320 stars 93 forks source link

Inline editor init fails when inside ngIf or ngFor. #245

Closed liesahead closed 6 months ago

liesahead commented 3 years ago

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. image

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. image

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).

image

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?

exalate-issue-sync[bot] commented 3 years ago

Ref: INT-2540

jscasca commented 3 years ago

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?

liesahead commented 3 years ago

@jscasca , will create a repro this month (I hope even this week).

danoaky-tiny commented 6 months ago

As this issue has gone stale, I'm closing it for now. Feel free to open a new issue if this problem persists.