2012-02-29 1364 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」

相關問題