【发布时间】:2012-03-23 03:01:39
【问题描述】:
好吧,所以我有一个完整的 ajax 系统,每个加载的页面都是通过 ajax 处理的,目前它有很多乱七八糟的代码,所以我不会向你展示。
我遇到的问题是,当我转到加载 TinyMCE 的内容时,它会完美运行一次,然后一旦提交表单,它就会在 TinyMCE 元素上使用remove(),然后一旦完成,它就会从然后服务器有一个用于 TinyMCE 的文本区域,它加载了奇怪的事情是内容没有显示,但是如果我单击 HTML 按钮,内容就在 TinyMCE 文本区域内。
我将尝试使用尽可能少的代码更好地解释一下
所以这是每次从服务器重新加载内容时的 TinyMCE 调用
$(".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"
}
});
这是第一次完美运行
现在我的 ajaxForm 代码运行,就在它将数据提交到它调用的服务器之前
$(".addonContent form textarea.tinyMCE").tinymce().remove()
但是当内容返回并加载 Tiny MCE 时,它不会在编辑器中显示内容,但如果我单击 HTML 按钮,内容会显示
编辑 这似乎是 TinyMCE 和 Google Chrome 的一个错误,因为下面的代码适用于 IE8+ 并且适用于 Firefox 我现在正在尝试 CKeditor。
【问题讨论】: