From a56df22d91823c16942c88e1913a0f661aa1206a Mon Sep 17 00:00:00 2001 From: Andrew Ozz Date: Fri, 8 Jun 2018 08:58:51 +0000 Subject: [PATCH] TinyMCE: prevent creation of paragraphs from multiple HTML comments when `wpautop` is disabled. Fixes #44308. git-svn-id: https://develop.svn.wordpress.org/trunk@43336 602fd350-edb4-49c9-b593-d223f7449a82 --- .../vendor/tinymce/plugins/wordpress/plugin.js | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/js/_enqueues/vendor/tinymce/plugins/wordpress/plugin.js b/src/js/_enqueues/vendor/tinymce/plugins/wordpress/plugin.js index 2f9283281f..fdb3856d78 100644 --- a/src/js/_enqueues/vendor/tinymce/plugins/wordpress/plugin.js +++ b/src/js/_enqueues/vendor/tinymce/plugins/wordpress/plugin.js @@ -113,8 +113,13 @@ tinymce.PluginManager.add( 'wordpress', function( editor ) { 'alt="" title="' + title + '" data-mce-resize="false" data-mce-placeholder="1" />' ); } - if ( event.load && event.format !== 'raw' && hasWpautop ) { - event.content = wp.editor.autop( event.content ); + if ( event.load && event.format !== 'raw' ) { + if ( hasWpautop ) { + event.content = wp.editor.autop( event.content ); + } else { + // Prevent creation of paragraphs out of multiple HTML comments. + event.content = event.content.replace( /-->\s+\s*\n\n