【发布时间】:2012-02-29 02:48:29
【问题描述】:
我有一个页面,我在其中同时使用手风琴和 tinymce。
对于手风琴控件中的每个展开/折叠组合,我都有一个编辑按钮。单击编辑按钮会显示一个带有 2 个输入的表单。第一个是文本框,第二个是文本区域。
我希望 textarea 是一个 tinymce 实例。手风琴控件有多个展开/折叠控件,我希望为每个控件显示一个 tinymce 实例。
我的tinymce初始化代码如下
tinyMCE.init({
// General options
mode : "textareas",
theme : "advanced",
plugins : "safari,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,|,blockquote,|,justifyleft,justifycenter,justifyright,justifyfull,|,paste,pastetext,pasteword,|,bullist,numlist,|,advhr,|,forecolor,formatselect",
// theme_advanced_buttons1 : "save,newdocument,|,bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,|,styleselect,formatselect,fontselect,fontsizeselect",
theme_advanced_buttons2 : "", //"cut,copy,paste,pastetext,pasteword,|,search,replace,|,bullist,numlist,|,outdent,indent,blockquote,|,undo,redo,|,link,unlink,anchor,image,cleanup,help,code,|,insertdate,inserttime,preview,|,forecolor,backcolor",
theme_advanced_buttons3 : "", //"tablecontrols,|,hr,removeformat,visualaid,|,sub,sup,|,charmap,emotions,iespell,media,advhr,|,print,|,ltr,rtl,|,fullscreen",
theme_advanced_buttons4 : "", //"insertlayer,moveforward,movebackward,absolute,|,styleprops,|,cite,abbr,acronym,del,ins,attribs,|,visualchars,nonbreaking,template,pagebreak",
theme_advanced_toolbar_location : "top",
theme_advanced_toolbar_align : "left",
theme_advanced_statusbar_location : "bottom",
theme_advanced_resizing : true,
});
当我在 chrome 和 firefox 上加载页面时,手风琴控件按预期显示。然而,tinymce 控件只出现在第一个折叠 div 中。折叠 div 的其余部分显示常规文本区域,而不是 tinymce 编辑器。
我没有在 IE 上测试过。
有人可以帮忙吗。我不确定我做错了什么。
提前致谢 普奈特
【问题讨论】:
-
如何将 tinyMCE 绑定到 textareas?
-
我是否必须将每个 textarea 单独绑定到 tinymce?
-
不,您可以使用类选择器一次绑定所有文本区域。但要弄清楚问题,我需要知道你如何将 tinuMce 实例绑定到你的 textareas。
-
我没有做任何特别的事情。我只是在我的页面中添加一个指向 tiny_mce/tiny_mce.js 文件的脚本标签,我还添加了上面执行 tinyMCE.init 的 javascript 代码
-
好的,我明白了,您希望 tinyMce 替换所有文本区域。调用 tinyMce.init 时是否可以使用其他 textareas 标签?例如,其他文本区域可以通过 ajax 加载并插入到 DOM 中。
标签: ruby-on-rails-3 tinymce accordion