';
+ } );
+ }
+
+ // Protect pre tags.
+ if ( html.indexOf( ']*>[\s\S]+?<\/\1>/g, function( a ) {
+ html = html.replace( /]*>[\s\S]+?<\/pre>/g, function( a ) {
a = a.replace( /
(\r\n|\n)?/g, '' );
a = a.replace( /<\/?p( [^>]*)?>(\r\n|\n)?/g, '' );
return a.replace( /\r?\n/g, '' );
@@ -205,6 +214,13 @@
html = html.replace( /]*)>/g, '
' );
}
+ // Put back preserved tags.
+ if ( preserve.length ) {
+ html = html.replace( //g, function() {
+ return preserve.shift();
+ } );
+ }
+
return html;
}
diff --git a/wp-admin/js/editor.min.js b/wp-admin/js/editor.min.js
index 9f87c87b82..9315fe4350 100644
--- a/wp-admin/js/editor.min.js
+++ b/wp-admin/js/editor.min.js
@@ -1 +1 @@
-!function(a){function b(){function b(){!i&&window.tinymce&&(i=window.tinymce,j=i.$,j(document).on("click",function(a){var b,c,e=j(a.target);e.hasClass("wp-switch-editor")&&(b=e.attr("data-wp-editor-id"),c=e.hasClass("switch-tmce")?"tmce":"html",d(b,c))}))}function c(a){var b=j(".mce-toolbar-grp",a.getContainer())[0],c=b&&b.clientHeight;return c&&c>10&&200>c?parseInt(c,10):30}function d(a,b){a=a||"content",b=b||"toggle";var d,e,f,g=i.get(a),h=j("#wp-"+a+"-wrap"),k=j("#"+a),l=k[0];if("toggle"===b&&(b=g&&!g.isHidden()?"html":"tmce"),"tmce"===b||"tinymce"===b){if(g&&!g.isHidden())return!1;"undefined"!=typeof window.QTags&&window.QTags.closeAllTags(a),d=parseInt(l.style.height,10)||0,g?(g.show(),!i.Env.iOS&&d&&(e=c(g),d=d-e+14,d>50&&5e3>d&&g.theme.resizeTo(null,d))):i.init(window.tinyMCEPreInit.mceInit[a]),h.removeClass("html-active").addClass("tmce-active"),k.attr("aria-hidden",!0),window.setUserSetting("editor","tinymce")}else if("html"===b){if(g&&g.isHidden())return!1;g?(i.Env.iOS||(f=g.iframeElement,d=f?parseInt(f.style.height,10):0,d&&(e=c(g),d=d+e-14,d>50&&5e3>d&&(l.style.height=d+"px"))),g.hide()):k.css({display:"",visibility:""}),h.removeClass("tmce-active").addClass("html-active"),k.attr("aria-hidden",!1),window.setUserSetting("editor","html")}}function e(a){var b="blockquote|ul|ol|li|dl|dt|dd|table|thead|tbody|tfoot|tr|th|td|h[1-6]|fieldset",c=b+"|div|p",d=b+"|pre",e=!1,f=!1;return a?(-1===a.indexOf("]*>[\s\S]+?<\/\1>/g,function(a){return a=a.replace(/
(\r\n|\n)?/g,""),a=a.replace(/<\/?p( [^>]*)?>(\r\n|\n)?/g,""),a.replace(/\r?\n/g,"")})),-1!==a.indexOf("[caption")&&(f=!0,a=a.replace(/\[caption[\s\S]+?\[\/caption\]/g,function(a){return a.replace(/
]*)>/g,"").replace(/[\r\n\t]+/,"")})),a=a.replace(new RegExp("\\s*("+c+")>\\s*","g"),"$1>\n"),a=a.replace(new RegExp("\\s*<((?:"+c+")(?: [^>]*)?)>","g"),"\n<$1>"),a=a.replace(/(]+>.*?)<\/p>/g,"$1
"),a=a.replace(/]*)?>\s*
/gi,"
\n\n"),a=a.replace(/\s*
/gi,""),a=a.replace(/\s*<\/p>\s*/gi,"\n\n"),a=a.replace(/\n[\s\u00a0]+\n/g,"\n\n"),a=a.replace(/\s*
\s*/gi,"\n"),a=a.replace(/\s*
\s*/g,"
\n"),a=a.replace(/\s*\[caption([^\[]+)\[\/caption\]\s*/gi,"\n\n[caption$1[/caption]\n\n"),a=a.replace(/caption\]\n\n+\[caption/g,"caption]\n\n[caption"),a=a.replace(new RegExp("\\s*<((?:"+d+")(?: [^>]*)?)\\s*>","g"),"\n<$1>"),a=a.replace(new RegExp("\\s*("+d+")>\\s*","g"),"$1>\n"),a=a.replace(/<((li|dt|dd)[^>]*)>/g," <$1>"),-1!==a.indexOf("