Make WordPress Core

Ticket #28335: 28335.diff

File 28335.diff, 937 bytes (added by DrewAPicture, 11 years ago)
  • src/wp-includes/js/tinymce/plugins/wordpress/plugin.js

     
    153153                        return;
    154154                }
    155155
    156                 // Get the top level parent node
    157                 parent = dom.getParent( node, function( found ) {
    158                         if ( found.parentNode && found.parentNode.nodeName === 'BODY' ) {
    159                                 return true;
    160                         }
    161 
    162                         return false;
    163                 }, editor.getBody() );
    164 
    165                 if ( parent ) {
    166                         if ( parent.nodeName === 'P' ) {
    167                                 parent.appendChild( dom.create( 'p', null, html ).firstChild );
    168                         } else {
    169                                 dom.insertAfter( dom.create( 'p', null, html ), parent );
    170                         }
    171 
    172                         editor.nodeChanged();
    173                 }
     156                var el = tinyMCE.activeEditor.dom.create('p', {}, html);
     157                editor.selection.setNode(el);
    174158        });
    175159
    176160        editor.addCommand( 'WP_Code', function() {