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;