2012-03-05 70 views
2

好吧,所以我有一个完整的ajax系统每个页面加载处理,虽然ajax它的很多凌乱的代码在这一刻,所以我不会告诉你。TinyMCE jQuery ajax从保存后不显示

我遇到的问题是,当我到我的内容加载TinyMCE它完美的工作,一次,然后一旦表单提交它使用TinyMCE元素remove()然后一旦它完成它从内容服务器,然后有一个TinyMCE textarea和它加载奇怪的东西是内容不显示,但如果我点击HTML按钮的内容是在TinyMCE textarea内。

我会尽量表现出更好的说明了一下使用尽可能少的代码为更多钞票

所以这个每次conent从服务器

$(".addonContent form textarea.tinyMCE").tinymce({ 
     // Location of TinyMCE script 
     script_url : '/script/tiny_mce/tiny_mce.js', 

     // General options 
     theme : "advanced", 
     plugins : "pagebreak,style,layer,table,save,advhr,advimage,advlink,emotions,iespell,inlinepopups,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,template", 

     // Theme options 
     theme_advanced_buttons1 : "bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,styleselect,formatselect,fontselect,fontsizeselect", 
     theme_advanced_buttons2 : "cut,copy,paste,pasteword,|,bullist,numlist,|,blockquote,|,undo,redo,|,link,unlink,anchor,image,code,", 
     theme_advanced_buttons3 : "tablecontrols,|,hr,removeformat,visualaid,|,charmap,emotions,media,|,ltr,rtl,|,fullscreen", 
     theme_advanced_buttons4 : "", 
     theme_advanced_toolbar_location : "top", 
     theme_advanced_toolbar_align : "left", 
     theme_advanced_statusbar_location : "bottom", 
     theme_advanced_resizing : true, 

     // Example content CSS (should be your site CSS) 
     content_css : "/style/style_content.css", 

     // Drop lists for link/image/media/template dialogs 
     template_external_list_url : "lists/template_list.js", 
     external_link_list_url : "lists/link_list.js", 
     external_image_list_url : "lists/image_list.js", 
     media_external_list_url : "lists/media_list.js", 

     // Replace values for the template plugin 
     template_replace_values : { 
       username : "Some User", 
       staffid : "991234" 
     } 
    }); 

重新加载时间是TinyMCE的呼叫,这个完美的作品第一次

现在我给ajaxForm代码的运行,并将其提交数据到服务器之前调用

$(".addonContent form textarea.tinyMCE").tinymce().remove() 

但随后当内容回来,微小的MCE负荷不会显示在编辑器中的内容,但如果我点击HTML按钮,内容显示

编辑 这似乎与TinyMCE的一个bug和谷歌浏览器作为下面的代码与IE8 +的作品,并与Firefox的作​​品,我现在尝试CKeditor。

+0

+1好问题描述 – Thariama 2012-03-06 09:39:08

回答

0

您需要先关闭一个tinymce editro实例,然后再加载第二个具有相同ID的实例。 在此处使用mceRemoveControl execCommand。

+0

不好意思,它不是对我的工作做同样的事情 – 2012-03-05 16:26:47

+0

你仍然称这个:$(“。addonContent form textarea.tinyMCE”)。tinymce()。remove()?? – Thariama 2012-03-05 16:27:51

+0

不,我不只是调用,'$(“。addonContent form textarea.tinyMCE”)。tinymce()。execCommand('mceRemoveControl');' – 2012-03-05 16:29:39