You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a list of components (form elements) one of which is a tinymce editor. They change order based on a state variable using a map of ids and using cloneElement to create the components. If the tiny mce editor moves or the items above it change order it can't be interacted with. The iframe just has an empty html element in it.
TinyMCE uses an iframe to display the internal content and keep it separate from the page styling. It does this by writing to the iframe with Javascript. As soon as that iframe is removed from the DOM the content is gone. We hope in future we might be able to use shadow-dom to do this but for now the requirement for IE support has our hands tied.
Note you can sort of sidestep the iframe problem by using inline mode however that does behave very differently from standard iframe TinyMCE and you still have to keep the same elements (you can't clone them!) because TinyMCE keeps references to them.
Therefore the only way to make this happen is to move components around TinyMCE without removing TinyMCE itself.
I'm going to convert this to a discussion since we are unable to make any action for the moment both due to a dependence on IE and due to Shadow Dom having a lacking selection API so we can't really treat it like a movable iframe. It is useful to have this information available to people who run into the same problem though.
Activity
tiny-james commentedon Sep 14, 2020
You've hit on something that's very difficult to do with TinyMCE...
The core problem is that you can not move iframes without them losing their state:
https://stackoverflow.com/questions/8318264/how-to-move-an-iframe-in-the-dom-without-losing-its-state
TinyMCE uses an iframe to display the internal content and keep it separate from the page styling. It does this by writing to the iframe with Javascript. As soon as that iframe is removed from the DOM the content is gone. We hope in future we might be able to use shadow-dom to do this but for now the requirement for IE support has our hands tied.
Note you can sort of sidestep the iframe problem by using inline mode however that does behave very differently from standard iframe TinyMCE and you still have to keep the same elements (you can't clone them!) because TinyMCE keeps references to them.
Therefore the only way to make this happen is to move components around TinyMCE without removing TinyMCE itself.
jacobbrown0192 commentedon Sep 14, 2020
@tiny-james Thanks for this, I wasn't aware of this interaction between react and iframes but it does makes sense.
I don't think it is worth the effort to try and get the components to move around tinyMCE.
Our options at this point seem to be:
I'll update with what we end up going with incase someone else runs into this problem.
Thanks again @tiny-james
tiny-james commentedon Mar 26, 2021
I'm going to convert this to a discussion since we are unable to make any action for the moment both due to a dependence on IE and due to Shadow Dom having a lacking selection API so we can't really treat it like a movable iframe. It is useful to have this information available to people who run into the same problem though.
exalate-issue-sync commentedon Mar 26, 2021
Ref: INT-2467