TinyMCE: fix adding the <!-- more --> 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
This commit is contained in:
Andrew Ozz
2017-07-03 21:40:22 +00:00
parent 05325257c9
commit 9b5781fef9
@@ -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;
}