diff --git a/src/wp-includes/js/quicktags.js b/src/wp-includes/js/quicktags.js index 8a2228f3af..a013b94735 100644 --- a/src/wp-includes/js/quicktags.js +++ b/src/wp-includes/js/quicktags.js @@ -643,7 +643,7 @@ function edButton(id, display, tagStart, tagEnd, access) { edButtons[90] = new qt.TagButton('ol','ol','
    \n','
\n\n','o'), edButtons[100] = new qt.TagButton('li','li','\t
  • ','
  • \n','l'), edButtons[110] = new qt.TagButton('code','code','','','c'), - edButtons[120] = new qt.TagButton('more','more','\n\n\n\n','','t'), + edButtons[120] = new qt.TagButton('more','more','\n\n','','t'), edButtons[140] = new qt.CloseButton(); })(); diff --git a/src/wp-includes/js/tinymce/plugins/wordpress/plugin.js b/src/wp-includes/js/tinymce/plugins/wordpress/plugin.js index d17f11411e..303f20d646 100644 --- a/src/wp-includes/js/tinymce/plugins/wordpress/plugin.js +++ b/src/wp-includes/js/tinymce/plugins/wordpress/plugin.js @@ -130,32 +130,10 @@ tinymce.PluginManager.add( 'wordpress', function( editor ) { } }); - // Make sure the "more" tag is in a separate paragraph - editor.on( 'PreProcess', function( event ) { - var more; - - if ( event.save ) { - more = editor.dom.select( 'img.wp-more-tag', event.node ); - - if ( more.length ) { - tinymce.each( more, function( node ) { - var parent = node.parentNode, p; - - if ( parent.nodeName === 'P' && parent.childNodes.length > 1 ) { - p = editor.dom.create('p'); - parent.parentNode.insertBefore( p, parent ); - p.appendChild( node ); - } - }); - } - } - }); - // Register commands editor.addCommand( 'WP_More', function( tag ) { - var parent, html, title, p1, p2, + var parent, html, title, classname = 'wp-more-tag', - spacer = tinymce.Env.ie ? '' : '
    ', dom = editor.dom, node = editor.selection.getNode(); @@ -165,8 +143,9 @@ tinymce.PluginManager.add( 'wordpress', function( editor ) { html = ''; - if ( node.nodeName === 'BODY' ) { - editor.insertContent( '

    ' + html + '

    ' ); + // Most common case + if ( node.nodeName === 'BODY' || ( node.nodeName === 'P' && node.parentNode.nodeName === 'BODY' ) ) { + editor.insertContent( html ); return; } @@ -180,16 +159,13 @@ tinymce.PluginManager.add( 'wordpress', function( editor ) { }, editor.getBody() ); if ( parent ) { - p1 = dom.create( 'p', null, html ); - dom.insertAfter( p1, parent ); - - if ( ! ( p2 = p1.nextSibling ) ) { - p2 = dom.create( 'p', null, spacer ); - dom.insertAfter( p2, p1 ); + if ( parent.nodeName === 'P' ) { + parent.appendChild( dom.create( 'p', null, html ).firstChild ); + } else { + dom.insertAfter( dom.create( 'p', null, html ), parent ); } editor.nodeChanged(); - editor.selection.setCursorLocation( p2, 0 ); } });