拖放后保存iframe内的内容--TinyMCE [英] Preserve content within iframe after drag and drop - TinyMCE

查看:130
本文介绍了拖放后保存iframe内的内容--TinyMCE的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在努力将TinyMCE工作成一个我正在开展的大型专业项目。在一个地方,我们需要在表行中有多个可拖动的实例。但是,当您开始拖动其中一行时,TinyMCE iFrame中的内容(无论是加载页面还是被用户更改)都将消失。删除行后,内容仍然消失,但在页面刷新/重新加载时重新显示。有没有办法让TinyMCE iFrame保留其内容,而不需要重新加载页面?我有一个例子:

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

我不能像jsfiddle这样做,因为如果你在那里进行刷新那个页面从一开始就重新开始。

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.

还有一种方法可以在只重新加载被拖放的iframe的地方执行吗?

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

推荐答案

由于编辑器正在拖放中重新呈现,我认为您应该手动设置内容。

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.

要访问具体编辑器可以使用 TinyMCE.get('myiframe'),然后应该有一个 getContent setContent 函数返回编辑器对象以访问编辑者内容。

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.

这篇关于拖放后保存iframe内的内容--TinyMCE的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆