how to set tinymce default content

十年热恋 提交于 2019-12-06 06:00:27
migreva

This is likely because the tinyMCE editor has not been initialized yet. If you run your tinyMCE.init() function then right after in the script try to do a setContent call, it will fail because the init() function is still running.

What you can do is specify an init_instance_callback, which will run after the tinyMCE editor is initialized. Running your setContent call in this callback will successfully set the content of the editor.

E.g.

tinymce.init({
    ...
    init_instance_callback: "insert_contents",
});


function insert_contents(inst){
    inst.setContent('<strong>Some contents</strong>');  
}
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!