How to set html content in TinyMCE

I am working on an e-commerce project that needs an Html text editor, and I choose TinyMCE. TinyMCE is a good text editing editor.

I am using Asp.net MVC4 and mysql database to store tinyMCE data. I can easily get the contents of the tinyMCE editor. Using

tinymce.get("textfull").getContent({ format: 'raw' }).replace(/</g, "&lt;").replace(/>/g, "&gt;");

this code provides me with HTML encoded text, but I want to show this text in a new tinyMCE editor using this code

tinymce.get("textfull").setContent($("<div/>").html(d.Description).text());

but this html Text not Html code set rendered content in a browser TinyMCE Result

Please tell me which is the right way to display an HTML element, not text.

+4
source share
1 answer

tinymce.get("textfull").getBody().innerHTML = $("").html(d.Description).text();

tinymce.get("textfull").getBody().innerHTML = d.Description;
+3

Source: https://habr.com/ru/post/1623719/


All Articles