diff --git a/src/wp-includes/js/tinymce/plugins/wordpress/plugin.js b/src/wp-includes/js/tinymce/plugins/wordpress/plugin.js index d022137bc5..96fae445e1 100644 --- a/src/wp-includes/js/tinymce/plugins/wordpress/plugin.js +++ b/src/wp-includes/js/tinymce/plugins/wordpress/plugin.js @@ -187,7 +187,8 @@ tinymce.PluginManager.add( 'wordpress', function( editor ) { var parent, html, title, classname = 'wp-more-tag', dom = editor.dom, - node = editor.selection.getNode(); + node = editor.selection.getNode(), + rootNode = editor.getBody(); tag = tag || 'more'; classname += ' mce-wp-' + tag; @@ -197,14 +198,14 @@ tinymce.PluginManager.add( 'wordpress', function( editor ) { 'data-wp-more="' + tag + '" data-mce-resize="false" data-mce-placeholder="1" />'; // Most common case - if ( node.nodeName === 'BODY' || ( node.nodeName === 'P' && node.parentNode.nodeName === 'BODY' ) ) { + if ( node === rootNode || ( node.nodeName === 'P' && node.parentNode === rootNode ) ) { editor.insertContent( html ); return; } // Get the top level parent node parent = dom.getParent( node, function( found ) { - if ( found.parentNode && found.parentNode.nodeName === 'BODY' ) { + if ( found.parentNode && found.parentNode === rootNode ) { return true; }