TinyMCE按需加载特定的textarea

时间:2015-03-30 22:54:15

标签: javascript jquery html tinymce rich-text-editor

我需要在特定TinyMCE上加载textarea,正如我所做的那样,它将TinyMCE添加到文档中的所有textareas

<script src="//code.jquery.com/jquery-1.10.2.js"></script>
<script type="text/javascript" src="tinymce/tinymce.min.js"></script>
<script type="text/javascript">
function setup() {
   tinyMCE.init({
      mode : "textareas",
      theme : "modern",
      plugins : "pagebreak,layer,table,save,hr,image,link,emoticons,spellchecker,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,template",
      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
   });
}
</script>

<form method="post" action="somepage">
        <textarea name="content" style="width:100%">
        </textarea>
     <textarea name="another_content" style="width:100%">
        </textarea>
        <a href="javascript:setup();">Load TinyMCE</a>
</form>

1 个答案:

答案 0 :(得分:0)

http://www.tinymce.com/wiki.php/TinyMCE3x:jQuery_Plugin。如果可能,最容易将jQuery版本与特定选择器一起使用。

相关问题