From 9b5781fef96582b8c2f3da0a13a05ad790b02c66 Mon Sep 17 00:00:00 2001 From: Andrew Ozz Date: Mon, 3 Jul 2017 21:40:22 +0000 Subject: [PATCH] TinyMCE: fix adding the `` tag when the editor is inline. Props iseulde. Fixes #41230. git-svn-id: https://develop.svn.wordpress.org/trunk@40996 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-includes/js/tinymce/plugins/wordpress/plugin.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) 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; }