一页上的 tinyMCE 的双实例

Double instance of tinyMCE on one page

我一直在尝试将 TinyMCE 编辑器的两个实例添加到一个页面中,但我做不到,所以我做了一些研究,并尝试将每个 [=14] 的 id 分开=].为此,我将这段代码添加到我的 JS 中:

JS

  tinymce.init({
        selector: "#mytextarea1",
        mode : "exact",
        elements :"area1",
        menubar: false,
        statusbar: false,
        height : 240,

    });

    tinymce.init({
        selector: "#mytextarea2",
        mode : "exact",
        elements :"area2",
        menubar: false,
        statusbar: false,
        height : 240,

    });

由于我正在使用 laravel 5,这是我用于表单的代码:

Laravel - Blade

TinyMCE 实例 #1(有效)

{!! Form::textarea('noteContent',null,array( 'id'=>'mytextarea1')) !!} 

TinyMCE 实例 #2(不起作用,而是显示正常的文本框)

{!! Form::textarea('noteContentEdit',null,array( 'id'=>'mytextarea2')) !!} 

我做错了什么吗?我读到我必须确保 selector 在每个元素中都是不同的,我想我已经做到了,但我一定是做错了什么,提前谢谢你。

P.S This 是我试图合并到我的问题中的SO问题。

好吧,我所要做的就是将 jQuery 代码编辑为:

jQuery

tinymce.init({
            editor_selector : "mceCreate",
            mode: "textareas",
            menubar: false,
            statusbar: false,
            height : 240,

        });

tinymce.init({
            editor_selector : "mceEdit",
            mode: "textareas",
            menubar: false,
            statusbar: false,
            height : 240,

            });

为每个标签添加一个 editor_selector 属性,而不是标签中的 id,我使用 类。我还将 mode 属性更改为 textarea.. 现在可以使用了。