Make WordPress Core

Ticket #28335: trac-28335.diff

File trac-28335.diff, 979 bytes (added by ebinnion, 11 years ago)
  • wp-includes/js/tinymce/plugins/wordpress/plugin.js

    diff --git a/wp-includes/js/tinymce/plugins/wordpress/plugin.js b/wp-includes/js/tinymce/plugins/wordpress/plugin.js
    index b79146a..3a3347a 100644
    a b tinymce.PluginManager.add( 'wordpress', function( editor ) { 
    150150                        return;
    151151                }
    152152
    153                 // Get the top level parent node
    154                 parent = dom.getParent( node, function( found ) {
    155                         if ( found.parentNode && found.parentNode.nodeName === 'BODY' ) {
    156                                 return true;
    157                         }
    158 
    159                         return false;
    160                 }, editor.getBody() );
    161 
    162                 if ( parent ) {
    163                         if ( parent.nodeName === 'P' ) {
    164                                 parent.appendChild( dom.create( 'p', null, html ).firstChild );
    165                         } else {
    166                                 dom.insertAfter( dom.create( 'p', null, html ), parent );
    167                         }
    168 
    169                         editor.nodeChanged();
    170                 }
     153                var el = tinyMCE.activeEditor.dom.create('p', {}, html);
     154                editor.selection.setNode(el);
    171155        });
    172156
    173157        editor.addCommand( 'WP_Code', function() {