Hi Yves,
Give this a try:
This will set the content when the form loads.
Code: Select all
function nuTinyMCEOnInit(e, editor, id) {
if (id === 'id_of_your_editor_here') { // <----------- Insert ID of your (WYSIWYG) editor object
setTinyMCEContent(id, '<h1>hello</h1>nuBuilder!');
}
}
function setTinyMCEContent(elementId, html) {
const tinyMCEId = $(`#${elementId}_parent_container`).find('.nuTinyMCE').attr('id');
const editor = tinymce.get(tinyMCEId);
if (editor) {
editor.setContent(html);
}
}
Alternatively, you can call
setTinyMCEContent('id_of_your_editor_here', '<h1>Hello</h1>nuBuilder!');
to insert content after the form has been loaded (e.g. on a button click)