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
This commit is contained in:
Daryl Koopersmith 2012-10-10 10:52:14 +00:00
parent d1c2c7714c
commit 1d60c42550
1 changed files with 2 additions and 2 deletions

View File

@ -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('<span data-wp-view-end></span>');
wrapper.empty().append( view.el ).append('<span data-wp-view-end class="wp-view-end"></span>');
});
},
@ -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 data-wp-view-end[^>]*><\/span><\/(?:div|span)>/g, function( match, id ) {
return content.replace( /<(?:div|span)[^>]+data-wp-view="([^"]+)"[^>]*>.*?<span[^>]+data-wp-view-end[^>]*><\/span><\/(?:div|span)>/g, function( match, id ) {
var instance = instances[ id ],
view;