I am trying to set the content of a tinymce editor in a plugin and I can change the content but the appearance of the editor changes when I use this code

jQuery(document).ready(function($) {
var name1 = "wprsspostprepend";
if($("#" + name1).length > 0) {

  tinyMCE.init({
    selector : "#wprsspostprepend",
     setup: function (editor) {
    editor.on('init', function () {
      var selector = tinyMCE.get('wprsspostprepend');
      var content =  selector.getContent();
   selector.setContent("<div id='random-wrap'>" + content + "</div>");
    });
  }
});

}


 });

I lose all the WordPress plugin icons from the menu bar and it changes to just a stock editor.

How can I set the content of the editor without changing the appearance?

Read more here: WordPress tinymce editor changes when I call tinymce.init


Solution:

If you know the solution of this issue, please leave us a reply in Comment section, to update the question.


Wordpress related questions and answers: