TinyMCE: fix adding the <!-- more --> tag when the editor is inline.

Props iseulde.
Fixes #41230.
Built from https://develop.svn.wordpress.org/trunk@40996


git-svn-id: http://core.svn.wordpress.org/trunk@40846 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Andrew Ozz 2017-07-03 21:41:41 +00:00
parent dcc372e098
commit 8c47285f4e
4 changed files with 6 additions and 5 deletions

View File

@ -187,7 +187,8 @@ tinymce.PluginManager.add( 'wordpress', function( editor ) {
var parent, html, title, var parent, html, title,
classname = 'wp-more-tag', classname = 'wp-more-tag',
dom = editor.dom, dom = editor.dom,
node = editor.selection.getNode(); node = editor.selection.getNode(),
rootNode = editor.getBody();
tag = tag || 'more'; tag = tag || 'more';
classname += ' mce-wp-' + tag; 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" />'; 'data-wp-more="' + tag + '" data-mce-resize="false" data-mce-placeholder="1" />';
// Most common case // 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 ); editor.insertContent( html );
return; return;
} }
// Get the top level parent node // Get the top level parent node
parent = dom.getParent( node, function( found ) { parent = dom.getParent( node, function( found ) {
if ( found.parentNode && found.parentNode.nodeName === 'BODY' ) { if ( found.parentNode && found.parentNode === rootNode ) {
return true; return true;
} }

File diff suppressed because one or more lines are too long

View File

@ -4,7 +4,7 @@
* *
* @global string $wp_version * @global string $wp_version
*/ */
$wp_version = '4.9-alpha-40995'; $wp_version = '4.9-alpha-40996';
/** /**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema. * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.