Preserve content within iframe after drag and drop - TinyMCE

只谈情不闲聊 提交于 2019-12-24 05:44:10

问题


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?


回答1:


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.



来源:https://stackoverflow.com/questions/14866630/preserve-content-within-iframe-after-drag-and-drop-tinymce

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!