tinymce-angular icon indicating copy to clipboard operation
tinymce-angular copied to clipboard

Inline editor init fails when inside ngIf or ngFor.

Open liesahead opened this issue 4 years ago • 3 comments

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?

  • "@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"

liesahead avatar May 13 '21 12:05 liesahead

Ref: INT-2540

exalate-issue-sync[bot] avatar May 13 '21 12:05 exalate-issue-sync[bot]

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 avatar Jun 07 '21 04:06 jscasca

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

liesahead avatar Jun 07 '21 07:06 liesahead

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

danoaky-tiny avatar Jan 10 '24 19:01 danoaky-tiny