tinymce / tinymce-angular

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

Error when trying to use transclusion with content that isn't initially visible "Cannot read property 'open' of undefined" #185

Closed crhistianramirez closed 3 years ago

crhistianramirez commented 3 years ago

What is the current behavior?

An error occurs if you try to use tinymce angular with transclusion where the editor shouldn't be initially visible.

Please provide the steps to reproduce and if possible a minimal demo of the problem via codesandbox.io or similar.

  1. Open code sandbox: https://codesandbox.io/s/tinymceangular-forked-qf54i
  2. Open app/app.component.ts
  3. On line 53 change show to false and observe error.

What is the expected behavior?

I would expect to be able to use transclusion without any errors.

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?

TinyMCE: 5.4.0 TinyMCE-Angular: 4.1.0 Browsers: Chrome, Firefox Safari, Internet Explorer

This does not appear to work in earlier versions.

@SimonFc I noticed your name as I was perusing the issues for a solution. I hope you don't mind me tagging you but I'm not sure where to go from here. This is obviously a very simplified repro but in our case we have a very generic list component and we need content transcluded. It differs a bit from the solution you posted on storybook because we don't know ahead of time what that content will be.

SimonFc commented 3 years ago

Is it possible for you to use a template outlet instead? See this example and the comment I made in app.component.ts. This is what the transclusion/content projection Storybook example is demonstrating, although I understand that it is a bit unclear so we'll fix that.

crhistianramirez commented 3 years ago

I am using ngTemplateOutlet on line 37 of app.component.ts

I actually see that this issue is more similar to https://github.com/tinymce/tinymce-angular/issues/9. The dynamic nature of my component means I don't know what will be transcluded ahead of time. I see it was closed as "can't fix". I think I might need to search for alternatives. Thank you for your time