Set content function returns [object Object]

143 Views Asked by At

I'm using this script to get the content of TinyMCE:

let editorContent;
editorContent.set(tinymce.get("firstEditor").getContent());

After receiving the content, I save it to my database as a string value. When needed I want to be able to retrieve the value and display it in the same TinyMCE editor. I tried using the script below to do so but that ends up displaying [object Object]..

tinymce.get("firstEditor").setContent(editorContent);

Does anybody have some clue to what could cause this problem?

1

There are 1 best solutions below

0
On

I fount the solution, using ".get()" on the string variable worked!

So instead of:

tinymce.get("firstEditor").setContent(editorContent);

I used this command:

tinymce.get("firstEditor").setContent(editorContent.get());