我已经元素,通过一个简单的AJAX / jQuery的编辑按钮,它的伟大工程,可编辑的列表。但是,当我尝试编辑同一领域第二次它并不想打球。
修改 - AJAX返回一个包含MySQL的内容TinyMCE的textarea的 保存 - AJAX的职位TinyMCE的内容,MySQL和显示张贴的内容 修改(再) - 返回相同的TinyMCE的textarea的内容,并像往常一样 保存(再次) - 第二次救尝试,将返回错误: g.win.document为null 的code片段的
VAR含量= tinyMCE.get(内容)的getContent()。 //获取TinyMCE的内容
$(#edititem)的负载(editItem.php,{内容:内容}); // jQuery的岗位
解决方案的 - 这是我得到它的工作:
修改 - 编辑时,TinyMCE的控件添加到文本区域
tinyMCE.execCommand(mceAddControl,真的,内容);
保存 - 保存时,删除对下一次控制
tinyMCE.execCommand(mceRemoveControl',假的,内容);
解决方案
我比较熟悉FCKeditor的,但我认为这是类似的。 TinyMCE有mceAddControl命令添加/创建编辑器的实例。你这样做,你重新加载的内容后?
tinyMCE.execCommand(mceAddControl'...
I've a list of elements editable via a simple AJAX/jQuery edit button, which works great. But when I try editing the same field a second time it doesn't want to play ball.
EDIT - AJAX returns a tinyMCE textarea containing content from MySQL SAVE - AJAX posts tinyMCE contents to MySQL and displays posted content EDIT (again) - Returns the same tinyMCE textarea and content as usual SAVE (again) - The second time save is attempted, returns error: g.win.document is nullCode snippets
var content = tinyMCE.get('content').getContent(); //get tinyMCE content
$("#edititem").load("editItem.php", {content: content}); //jQuery post
Solution - this is how I got it working:
EDIT - when editing, add the tinyMCE control to the textarea
tinyMCE.execCommand("mceAddControl",true,'content');
SAVE - when saving, remove the control for next time
tinyMCE.execCommand('mceRemoveControl',false,'content');
解决方案
I am more familiar with FCKeditor but I think it is similar. TinyMCE has mceAddControl command to add/create editor instances. Are you doing that after you reload your content?
tinyMCE.execCommand('mceAddControl' ...