我正在使用tinymce,是否可以申请一个textarea

Nav*_*ruk 33 javascript textarea tinymce

我正在使用tinymce,我的页面上有多个文本区域.是否可以申请一个textarea,

1个文本区域用于描述验证,如下所示

var text = tinyMCE.get('txtdesc').getContent();

但是我的页面中还有3个以上的文本区域,所以tineMCE不应该适用于所有这些文本区域

我如何仅适用于一个文本区域

// this is my tinyMCE code 
    tinyMCE.init({
        mode : "textareas",
        theme : "advanced"
    });

// /tinyMCE

小智 65

对于textarea指定class=""给textarea属性,这将支持您

<script type="text/javascript">
    tinyMCE.init({
        //mode : "textareas",
        mode : "specific_textareas",
        editor_selector : "myTextEditor",
        theme : "simple"
    });
</script>

<textarea id="txtdesc" name="txtdesc" class="myTextEditor" rows="6" cols="96" ></textarea>
Run Code Online (Sandbox Code Playgroud)

  • mode:"exact",elements:"textarea_id"| 请在代码中使用此代码来使用 (2认同)

Dun*_*zzz 45

在TinyMCE 3.x配置中,您可以将类选择器或取消选择器专门启用或禁用某些类的textareas上的TinyMCE,只需将该class=""属性放在textarea上即可.

editor_deselector : "mceNoEditor" // class="mceNoEditor" will not have tinyMCE
editor_selector : "mceEditor", // class="mceEditor" will.
Run Code Online (Sandbox Code Playgroud)

来源.


截至TinyMCE 4.0.x

selector: "textarea", // Select all textarea
selector: "textarea.editme", // Select all textarea with the class editme
selector : "textarea:not(.mceNoEditor)", // Select all textarea exluding the mceNoEditor class
Run Code Online (Sandbox Code Playgroud)

来源.


KEO*_*OKI 6

在TinyMCE 4.x中没有取消选择器,因此您可以使用普通的css来确定选择哪些textareas,哪些不是.

<script type="text/javascript">
  tinymce.init({
        selector: "textarea:not(.textarea-no-styles)",
 });
</script>
Run Code Online (Sandbox Code Playgroud)