From 1d60c4255059930421ba89603affe8ad5f16d926 Mon Sep 17 00:00:00 2001 From: Daryl Koopersmith Date: Wed, 10 Oct 2012 10:52:14 +0000 Subject: [PATCH] Add a class to the TinyMCE view end marker. Certain TinyMCE plugins scan for all spans in the document and remove any that do not have classes (or a handful of other attributes). This is quite aggressive, and breaks the regex used to scan for MCE views when transforming them back to plain text. Adding a class ensures that any plugins that do so will not break MCE views. see #21812, #21390. git-svn-id: http://core.svn.wordpress.org/trunk@22162 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/js/mce-view.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/wp-includes/js/mce-view.js b/wp-includes/js/mce-view.js index 93c0d26ed5..0c88864d2e 100644 --- a/wp-includes/js/mce-view.js +++ b/wp-includes/js/mce-view.js @@ -325,7 +325,7 @@ window.wp = window.wp || {}; // Empty the wrapper, attach the view element to the wrapper, // and add an ending marker to the wrapper to help regexes // scan the HTML string. - wrapper.empty().append( view.el ).append(''); + wrapper.empty().append( view.el ).append(''); }); }, @@ -333,7 +333,7 @@ window.wp = window.wp || {}; // Scans an HTML `content` string and replaces any view instances with // their respective text representations. toText: function( content ) { - return content.replace( /<(?:div|span)[^>]+data-wp-view="([^"]+)"[^>]*>.*?]*><\/span><\/(?:div|span)>/g, function( match, id ) { + return content.replace( /<(?:div|span)[^>]+data-wp-view="([^"]+)"[^>]*>.*?]+data-wp-view-end[^>]*><\/span><\/(?:div|span)>/g, function( match, id ) { var instance = instances[ id ], view;