tinymce.full.js
function (content, args) {
        var self = this, body = self.getBody(), forcedRootBlockName, padd;

        // Setup args object
        args = args || {};
        args.format = args.format || 'html';
        args.set = true;
        args.content = content;

        // Do preprocessing
        if (!args.no_events) {
          self.fire('BeforeSetContent', args);
        }

        content = args.content;

        // Padd empty content in Gecko and Safari. Commands will otherwise fail on the content
        // It will also be impossible to place the caret in the editor unless there is a BR element present
        if (content.length === 0 || /^\s+$/.test(content)) {
          padd = ie && ie < 11 ? '' : '<br data-mce-bogus="1">';

          // Todo: There is a lot more root elements that need special padding
          // so separate this and add all of them at some point.
          if (body.nodeName == 'TABLE') {
            content = '<tr><td>' + padd + '</td></tr>';
          } else if (/^(UL|OL)$/.test(body.nodeName)) {
            content = '<li>' + padd + '</li>';
          }

          forcedRootBlockName = self.settings.forced_root_block;

          // Check if forcedRootBlock is configured and that the block is a valid child of the body
          if (forcedRootBlockName && self.schema.isValidChild(body.nodeName.toLowerCase(), forcedRootBlockName.toLowerCase())) {
            // Padd with bogus BR elements on modern browsers and IE 7 and 8 since they don't render empty P tags properly
            content = padd;
            content = self.dom.createHTML(forcedRootBlockName, self.settings.forced_root_block_attrs, content);
          } else if (!ie && !content) {
            // We need to add a BR when forced_root_block is disabled on non IE browsers to place the caret
            content = '<br data-mce-bogus="1">';
          }

          self.dom.setHTML(body, content);

          self.fire('SetContent', args);
        } else {
          // Parse and serialize the html
          if (args.format !== 'raw') {
            content = new Serializer({
              validate: self.validate
            }, self.schema).serialize(
              self.parser.parse(content, { isRootContent: true })
              );
          }

          // Set the new cleaned contents to the editor
          args.content = trim(content);
          self.dom.setHTML(body, args.content);

          // Do post processing
          if (!args.no_events) {
            self.fire('SetContent', args);
          }

          // Don't normalize selection if the focused element isn't the body in
          // content editable mode since it will steal focus otherwise
          /*if (!self.settings.content_editable || document.activeElement === self.getBody()) {
            self.selection.normalize();
          }*/
        }

        return args.content;
      }
function (content, args) {
        var self = this, body = self.getBody(), forcedRootBlockName, padd;

        // Setup args object
        args = args || {};
        args.format = args.format || 'html';
        args.set = true;
        args.content = content;

        // Do preprocessing
        if (!args.no_events) {
          self.fire('BeforeSetContent', args);
        }

        content = args.content;

        // Padd empty content in Gecko and Safari. Commands will otherwise fail on the content
        // It will also be impossible to place the caret in the editor unless there is a BR element present
        if (content.length === 0 || /^\s+$/.test(content)) {
          padd = ie && ie < 11 ? '' : '<br data-mce-bogus="1">';

          // Todo: There is a lot more root elements that need special padding
          // so separate this and add all of them at some point.
          if (body.nodeName == 'TABLE') {
            content = '<tr><td>' + padd + '</td></tr>';
          } else if (/^(UL|OL)$/.test(body.nodeName)) {
            content = '<li>' + padd + '</li>';
          }

          forcedRootBlockName = self.settings.forced_root_block;

          // Check if forcedRootBlock is configured and that the block is a valid child of the body
          if (forcedRootBlockName && self.schema.isValidChild(body.nodeName.toLowerCase(), forcedRootBlockName.toLowerCase())) {
            // Padd with bogus BR elements on modern browsers and IE 7 and 8 since they don't render empty P tags properly
            content = padd;
            content = self.dom.createHTML(forcedRootBlockName, self.settings.forced_root_block_attrs, content);
          } else if (!ie && !content) {
            // We need to add a BR when forced_root_block is disabled on non IE browsers to place the caret
            content = '<br data-mce-bogus="1">';
          }

          self.dom.setHTML(body, content);

          self.fire('SetContent', args);
        } else {
          // Parse and serialize the html
          if (args.format !== 'raw') {
            content = new Serializer({
              validate: self.validate
            }, self.schema).serialize(
              self.parser.parse(content, { isRootContent: true })
              );
          }

          // Set the new cleaned contents to the editor
          args.content = trim(content);
          self.dom.setHTML(body, args.content);

          // Do post processing
          if (!args.no_events) {
            self.fire('SetContent', args);
          }

          // Don't normalize selection if the focused element isn't the body in
          // content editable mode since it will steal focus otherwise
          /*if (!self.settings.content_editable || document.activeElement === self.getBody()) {
            self.selection.normalize();
          }*/
        }

        return args.content;
      }
function ( content , args ) { var self = this , body = self . getBody ( ) , forcedRootBlockName , padd ; // Setup args object args = args || { } ; args . format = args . format || 'html' ; args . set = true ; args . content = content ; // Do preprocessing if ( ! args . no_events ) { self . fire ( 'BeforeSetContent' , args ) ; } content = args . content ; // Padd empty content in Gecko and Safari. Commands will otherwise fail on the content // It will also be impossible to place the caret in the editor unless there is a BR element present if ( content . length === 0 || / ^\s+$ / . test ( content ) ) { padd = ie && ie < 11 ? '' : '<br data-mce-bogus="1">' ; // Todo: There is a lot more root elements that need special padding // so separate this and add all of them at some point. if ( body . nodeName == 'TABLE' ) { content = '<tr><td>' + padd + '</td></tr>' ; } else if ( / ^(UL|OL)$ / . test ( body . nodeName ) ) { content = '<li>' + padd + '</li>' ; } forcedRootBlockName = self . settings . forced_root_block ; // Check if forcedRootBlock is configured and that the block is a valid child of the body if ( forcedRootBlockName && self . schema . isValidChild ( body . nodeName . toLowerCase ( ) , forcedRootBlockName . toLowerCase ( ) ) ) { // Padd with bogus BR elements on modern browsers and IE 7 and 8 since they don't render empty P tags properly content = padd ; content = self . dom . createHTML ( forcedRootBlockName , self . settings . forced_root_block_attrs , content ) ; } else if ( ! ie && ! content ) { // We need to add a BR when forced_root_block is disabled on non IE browsers to place the caret content = '<br data-mce-bogus="1">' ; } self . dom . setHTML ( body , content ) ; self . fire ( 'SetContent' , args ) ; } else { // Parse and serialize the html if ( args . format !== 'raw' ) { content = new Serializer ( { validate : self . validate } , self . schema ) . serialize ( self . parser . parse ( content , { isRootContent : true } ) ) ; } // Set the new cleaned contents to the editor args . content = trim ( content ) ; self . dom . setHTML ( body , args . content ) ; // Do post processing if ( ! args . no_events ) { self . fire ( 'SetContent' , args ) ; } // Don't normalize selection if the focused element isn't the body in // content editable mode since it will steal focus otherwise /*if (!self.settings.content_editable || document.activeElement === self.getBody()) {
            self.selection.normalize();
          }*/ } return args . content ; }
Sets the specified content to the editor instance, this will cleanup the content before it gets set using
the different cleanup rules options.

@method setContent
@param {String} content Content to set to editor, normally HTML contents but can be other formats as well.
@param {Object} args Optional content object, this gets passed around through the whole set process.
@return {String} HTML string that got set into the editor.
@example
// Sets the HTML contents of the activeEditor editor
tinymce.activeEditor.setContent('<span>some</span> html');

// Sets the raw contents of the activeEditor editor
tinymce.activeEditor.setContent('<span>some</span> html', {format: 'raw'});

// Sets the content of a specific editor (my_editor in this example)
tinymce.get('my_editor').setContent(data);

// Sets the bbcode contents of the activeEditor editor if the bbcode plugin was added
tinymce.activeEditor.setContent('[b]some[/b] html', {format: 'bbcode'});
Sets the specified content to the editor instance this will cleanup the content before it gets set using the different cleanup rules options .