initialize tinymce with content

后端 未结 2 1001
春和景丽
春和景丽 2020-12-20 16:10

I have a page containing one tinymce4 editor instance. I want to initialize this editor with some content, programmatically. I know that I have to call: tinymce.get(\'

相关标签:
2条回答
  • 2020-12-20 16:42

    With version 4 you should do it like this:

    tinymce.init({selector:'textarea'});
    tinymce.activeEditor.setContent('custom');
    

    Here's a fiddle.

    0 讨论(0)
  • 2020-12-20 16:50

    I've used the init_instance_callback, which is fired when the editor is ready to setContent.

    var options = { ... };
    options.init_instance_callback = function (editor) {
        editor.setContent(initialContent);
    };
    $("some-selector").tinymce(options);

    0 讨论(0)
提交回复
热议问题