2012-02-29 1361 views
1

我有一个页面,我一起使用手风琴和tinymce。不能在一个页面上显示多个tinymce编辑器

对于accordion控件中的每个展开/折叠组合,我都有一个编辑按钮。点击编辑按钮显示一个有2个输入的表单。第一个是文本框,第二个是textarea。

我希望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的其余部分显示常规textareas而不是tinymce编辑器。

我还没有在IE上测试过。

有人可以帮忙。我不确定我做错了什么。

在此先感谢 普尼特

+0

你怎么TinyMCE的绑定到你的文字区域? – Hck 2012-02-29 07:20:21

+0

我是否必须将每个textarea单独绑定到tinymce? – ppaul74 2012-02-29 07:27:47

+0

不,您可以使用类选择器一次绑定所有textareas。但要弄清楚这个问题,我需要知道你如何将tinuMce实例绑定到你的textarea上。 – Hck 2012-02-29 07:56:19

回答

1

确保所有textarea元素的id不同,解决了问题。 textarea的就是TinyMCE的编辑器插件出现

1

尝试使用mode: 'exact',,并列出下element设置的所有元素的ID。

+0

不工作。现在它甚至没有向我展示它在 – ppaul74 2012-02-29 16:29:40

+0

之前向我展示的一个tiny_mce,请发布您的确切设置 – Thariama 2012-02-29 17:15:28

+0

对不起,我实际上不知道所有将在textareas之前的元素id的名称。这就是为什么我不能在页面加载时创建一个元素标识的静态列表 – ppaul74 2012-02-29 18:41:42

0

您可以在远程文件分开TinyMCE的代码(例如LIB/tinytextarea.html),然后用我的jQuery插件,当它从远程文件

加载哪些改变textarea的ID加载它
$.fn.loadChangeTAreaId = function(urlpath,prefix,suffix){ 
    $(this).load(urlpath, function(data) { 
     $(this).find('textarea[id]').andSelf().attr('id', function(index, previous) { 

      return prefix+ previous+suffix; 
     }); 
    }) 

如何使用?

$('#divContainer').loadChangeTAreaId('lib/tinytextarea.html','pre','suf'); 

如果先前textarea的ID是 “榆树”,新的ID是 “preelmsuf”

相关问题