2012-02-13 52 views

回答

0

爲此,您需要使用兩個獨立的tinymce init函數。 我想你在開始的時候在你的頁面上有兩個textareas。 第一個被使用這樣一個初始化頁面加載啓動:

$(document).ready(function() { 
    tinyMCE.init({ 
     // General options 
     mode:  "exact", 
     elements : "id_of_first_textarea", 
     ... 
    }); 
}); 

「添加新的」 -buttonclick你做到以下幾點:

tinyMCE.init({ 
    // General options 
    mode:  "exact", 
    elements : "id_of_second_textarea", 
    // deactivates the editor body 
    setup : function(ed) { 
     ed.onInit.add(function(ed, evt) { 
      // you may also add a click handler here to disable the focus of the editor body 
      $(ed.getBody()).attr('contenteditable', false); 
     }); 
    }, 
    ... 
}); 

「獲取內容」 buttonaction執行以下操作:

var content = tinymce.get('textarea_id_of_the_desired_editor').getContent(); 
+0

感謝您的支持。 .. – Tarjo 2012-02-14 05:00:27

0

可以效仿的榜樣在他們的網站:http://www.tinymce.com/tryit/multiple_configs.php

  • 或 -

你可以隨時把第二個放在一個iframe中,然後在你的表單上提交與iframe的通信以獲取內容,但這不是一個優雅的解決方案

+0

我想添加TinyMCE來點擊,在他早先的剪裁中我錯了圖像。 – Tarjo 2012-02-13 05:03:29

+0

你可以看到一個像這樣的圖片.. http://tuto-rial.com/add_multiple_tinyMCE.png – Tarjo 2012-02-13 05:05:44

+0

我認爲這是你想要的:http://blog.dileno.com/archive/201102/adding -tinymce-editor-dynamic-and-get-its-value/ – 2012-02-13 18:20:36