2012-02-13 25 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