From 928ba6848c2ab390b581f17d796c1cbacd21ec76 Mon Sep 17 00:00:00 2001 From: Andrew Ozz Date: Fri, 20 Feb 2015 23:16:34 +0000 Subject: [PATCH] TinyMCE wpView: don't insert nested paragraphs when inserting embeddable URLs. Props iseulde, fixes #29526. git-svn-id: https://develop.svn.wordpress.org/trunk@31485 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-includes/js/mce-view.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/wp-includes/js/mce-view.js b/src/wp-includes/js/mce-view.js index 5f4d846999..3a21e01fa7 100644 --- a/src/wp-includes/js/mce-view.js +++ b/src/wp-includes/js/mce-view.js @@ -877,7 +877,7 @@ window.wp = window.wp || {}; wp.mce.views.register( 'embedURL', _.extend( {}, wp.mce.embedMixin, { toView: function( content ) { - var re = /(?:^|

)(https?:\/\/[^\s"]+?)(?:<\/p>\s*|$)/gi, + var re = /(^|

)(https?:\/\/[^\s"]+?)(<\/p>\s*|$)/gi, match = re.exec( tinymce.trim( content ) ); if ( ! match ) { @@ -885,10 +885,10 @@ window.wp = window.wp || {}; } return { - index: match.index, - content: match[0], + index: match.index + match[1].length, + content: match[2], options: { - url: match[1] + url: match[2] } }; }