Christian Ziebarth
Christian Ziebarth

Reputation: 753

Preserve content within iframe after drag and drop - TinyMCE

I am trying to work TinyMCE into a large professional project I am working on. In one spot we need to have multiple instances in table rows that are draggable. However, when you begin dragging one of the rows the content that is in the TinyMCE iFrame (whether it was loaded with the page or altered by the user) disappears. Once you drop the row the content is still gone but re-appears upon page refresh/reload. Is there a way to get the TinyMCE iFrame to preserve its content without needing to do a page reload? I have an example here:

http://cmzmedia.com/tinymce/examples/simple.html

I can't do it in something like jsfiddle because if you do it there and refresh the page it starts everything back from the beginning again.

Or perhaps there is a way to do it where only the dragged-and-dropped iframe is reloaded?

Upvotes: 1

Views: 1336

Answers (1)

mojarras
mojarras

Reputation: 1634

Since the editor is being re-rendered on a drag and drop, I think you should set the content manually yourself.

You should first grab the contents of the editor being dragged and then restore it after the drop.

To get access to a specific editor you can use TinyMCE.get('myiframe'), and then there should be a getContent and setContent function on that returning editor object to gain access to the editors content.

Upvotes: 1

Related Questions