From 6b84df3bbdd116f48fc37ed4406bde58460a9a15 Mon Sep 17 00:00:00 2001 From: Scott Taylor Date: Fri, 16 Jan 2015 00:27:21 +0000 Subject: [PATCH] Ensure that `
` is not autop'd. Fixes #29219. Built from https://develop.svn.wordpress.org/trunk@31186 git-svn-id: http://core.svn.wordpress.org/trunk@31167 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-admin/js/editor.js | 2 +- wp-admin/js/editor.min.js | 2 +- wp-includes/formatting.php | 2 +- wp-includes/version.php | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/wp-admin/js/editor.js b/wp-admin/js/editor.js index 0b3e04b2cd..4ff70df848 100644 --- a/wp-admin/js/editor.js +++ b/wp-admin/js/editor.js @@ -211,7 +211,7 @@ window.switchEditors = { preserve_br = false, blocklist = 'table|thead|tfoot|caption|col|colgroup|tbody|tr|td|th|div|dl|dd|dt|ul|ol|li|pre' + '|form|map|area|blockquote|address|math|style|p|h[1-6]|hr|fieldset|legend|section' + - '|article|aside|hgroup|header|footer|nav|figure|details|menu|summary'; + '|article|aside|hgroup|header|footer|nav|figure|figcaption|details|menu|summary'; if ( pee.indexOf( '/g, function( a ) { diff --git a/wp-admin/js/editor.min.js b/wp-admin/js/editor.min.js index 0b2ce5d1d0..fa44e53175 100644 --- a/wp-admin/js/editor.min.js +++ b/wp-admin/js/editor.min.js @@ -1 +1 @@ -window.switchEditors={switchto:function(a){var b=a.id,c=b.length,d=b.substr(0,c-5),e=b.substr(c-4);this.go(d,e)},go:function(a,b){function c(){var a=k.select(".mce-toolbar-grp",d.getContainer())[0],b=a&&a.clientHeight;return b&&b>10&&200>b?parseInt(b,10):30}var d,e,f,g,h,i,j=this,k=tinymce.DOM;if(a=a||"content",b=b||"toggle",d=tinymce.get(a),e="wp-"+a+"-wrap",f=k.get(a),"toggle"===b&&(b=d&&!d.isHidden()?"html":"tmce"),"tmce"===b||"tinymce"===b){if(d&&!d.isHidden())return!1;"undefined"!=typeof QTags&&QTags.closeAllTags(a),h=f?parseInt(f.style.height,10):0,tinyMCEPreInit.mceInit[a]&&tinyMCEPreInit.mceInit[a].wpautop&&(f.value=j.wpautop(f.value)),d?(d.show(),!tinymce.Env.iOS&&h&&(i=c(),h=h-i+14,h>50&&5e3>h&&d.theme.resizeTo(null,h))):tinymce.init(tinyMCEPreInit.mceInit[a]),k.removeClass(e,"html-active"),k.addClass(e,"tmce-active"),k.setAttrib(f,"aria-hidden",!0),setUserSetting("editor","tinymce")}else if("html"===b){if(d&&d.isHidden())return!1;d?(tinymce.Env.iOS||(g=k.get(a+"_ifr"),h=g?parseInt(g.style.height,10):0,h&&(i=c(),h=h+i-14,h>50&&5e3>h&&(f.style.height=h+"px"))),d.hide()):(tinyMCEPreInit.mceInit[a]&&tinyMCEPreInit.mceInit[a].wpautop&&(f.value=j.pre_wpautop(f.value)),k.setStyles(f,{display:"",visibility:""})),k.removeClass(e,"tmce-active"),k.addClass(e,"html-active"),k.setAttrib(f,"aria-hidden",!1),setUserSetting("editor","html")}return!1},_wp_Nop:function(a){var b,c,d=!1,e=!1;return(-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")&&(e=!0,a=a.replace(/\[caption[\s\S]+?\[\/caption\]/g,function(a){return a.replace(/]*)>/g,"").replace(/[\r\n\t]+/,"")})),b="blockquote|ul|ol|li|table|thead|tbody|tfoot|tr|th|td|div|h[1-6]|p|fieldset",a=a.replace(new RegExp("\\s*\\s*","g"),"\n"),a=a.replace(new RegExp("\\s*<((?:"+b+")(?: [^>]*)?)>","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"),c="blockquote|ul|ol|li|table|thead|tbody|tfoot|tr|th|td|h[1-6]|pre|fieldset",a=a.replace(new RegExp("\\s*<((?:"+c+")(?: [^>]*)?)\\s*>","g"),"\n<$1>"),a=a.replace(new RegExp("\\s*\\s*","g"),"\n"),a=a.replace(/]*)>/g," "),-1!==a.indexOf("/g,"\n")),-1!==a.indexOf("]*)?>\s*/g,"\n\n\n\n")),-1!==a.indexOf("/g,function(a){return a.replace(/[\r\n]+/g,"")})),a=a.replace(/<\/p#>/g,"

\n"),a=a.replace(/\s*(

]+>[\s\S]*?<\/p>)/g,"\n$1"),a=a.replace(/^\s+/,""),a=a.replace(/[\s\u00a0]+$/,""),d&&(a=a.replace(//g,"\n")),e&&(a=a.replace(/]*)>/g,"")),a},_wp_Autop:function(a){var b=!1,c=!1,d="table|thead|tfoot|caption|col|colgroup|tbody|tr|td|th|div|dl|dd|dt|ul|ol|li|pre|form|map|area|blockquote|address|math|style|p|h[1-6]|hr|fieldset|legend|section|article|aside|hgroup|header|footer|nav|figure|details|menu|summary";return-1!==a.indexOf("/g,function(a){return a.replace(/[\r\n]+/g,"")})),a=a.replace(/<[^<>]+>/g,function(a){return a.replace(/[\r\n]+/g," ")}),(-1!==a.indexOf("]*>[\s\S]+?<\/\1>/g,function(a){return a.replace(/(\r\n|\n)/g,"")})),-1!==a.indexOf("[caption")&&(c=!0,a=a.replace(/\[caption[\s\S]+?\[\/caption\]/g,function(a){return a=a.replace(/]*)>/g,""),a=a.replace(/<[a-zA-Z0-9]+( [^<>]+)?>/g,function(a){return a.replace(/[\r\n\t]+/," ")}),a.replace(/\s*\n\s*/g,"")})),a+="\n\n",a=a.replace(/
\s*
/gi,"\n\n"),a=a.replace(new RegExp("(<(?:"+d+")(?: [^>]*)?>)","gi"),"\n$1"),a=a.replace(new RegExp("()","gi"),"$1\n\n"),a=a.replace(/]*)?>/gi,"\n\n"),a=a.replace(/\s*"),a=a.replace(/\r\n|\r/g,"\n"),a=a.replace(/\n\s*\n+/g,"\n\n"),a=a.replace(/([\s\S]+?)\n\n/g,"

$1

\n"),a=a.replace(/

\s*?<\/p>/gi,""),a=a.replace(new RegExp("

\\s*(]*)?>)\\s*

","gi"),"$1"),a=a.replace(/

(/gi,"$1"),a=a.replace(/

\s*]*)>/gi,"

"),a=a.replace(/<\/blockquote>\s*<\/p>/gi,"

"),a=a.replace(new RegExp("

\\s*(]*)?>)","gi"),"$1"),a=a.replace(new RegExp("(]*)?>)\\s*

","gi"),"$1"),a=a.replace(/\s*\n/gi,"
\n"),a=a.replace(new RegExp("(]*>)\\s*
","gi"),"$1"),a=a.replace(/
(\s*<\/?(?:p|li|div|dl|dd|dt|th|pre|td|ul|ol)>)/gi,"$1"),a=a.replace(/(?:

|
)*\s*\[caption([^\[]+)\[\/caption\]\s*(?:<\/p>|
)*/gi,"[caption$1[/caption]"),a=a.replace(/(<(?:div|th|td|form|fieldset|dd)[^>]*>)(.*?)<\/p>/g,function(a,b,c){return c.match(/]*)?>/)?a:b+"

"+c+"

"}),b&&(a=a.replace(//g,"\n")),c&&(a=a.replace(/]*)>/g,"")),a},pre_wpautop:function(a){var b=this,c={o:b,data:a,unfiltered:a},d="undefined"!=typeof jQuery;return d&&jQuery("body").trigger("beforePreWpautop",[c]),c.data=b._wp_Nop(c.data),d&&jQuery("body").trigger("afterPreWpautop",[c]),c.data},wpautop:function(a){var b=this,c={o:b,data:a,unfiltered:a},d="undefined"!=typeof jQuery;return d&&jQuery("body").trigger("beforeWpautop",[c]),c.data=b._wp_Autop(c.data),d&&jQuery("body").trigger("afterWpautop",[c]),c.data}}; \ No newline at end of file +window.switchEditors={switchto:function(a){var b=a.id,c=b.length,d=b.substr(0,c-5),e=b.substr(c-4);this.go(d,e)},go:function(a,b){function c(){var a=k.select(".mce-toolbar-grp",d.getContainer())[0],b=a&&a.clientHeight;return b&&b>10&&200>b?parseInt(b,10):30}var d,e,f,g,h,i,j=this,k=tinymce.DOM;if(a=a||"content",b=b||"toggle",d=tinymce.get(a),e="wp-"+a+"-wrap",f=k.get(a),"toggle"===b&&(b=d&&!d.isHidden()?"html":"tmce"),"tmce"===b||"tinymce"===b){if(d&&!d.isHidden())return!1;"undefined"!=typeof QTags&&QTags.closeAllTags(a),h=f?parseInt(f.style.height,10):0,tinyMCEPreInit.mceInit[a]&&tinyMCEPreInit.mceInit[a].wpautop&&(f.value=j.wpautop(f.value)),d?(d.show(),!tinymce.Env.iOS&&h&&(i=c(),h=h-i+14,h>50&&5e3>h&&d.theme.resizeTo(null,h))):tinymce.init(tinyMCEPreInit.mceInit[a]),k.removeClass(e,"html-active"),k.addClass(e,"tmce-active"),k.setAttrib(f,"aria-hidden",!0),setUserSetting("editor","tinymce")}else if("html"===b){if(d&&d.isHidden())return!1;d?(tinymce.Env.iOS||(g=k.get(a+"_ifr"),h=g?parseInt(g.style.height,10):0,h&&(i=c(),h=h+i-14,h>50&&5e3>h&&(f.style.height=h+"px"))),d.hide()):(tinyMCEPreInit.mceInit[a]&&tinyMCEPreInit.mceInit[a].wpautop&&(f.value=j.pre_wpautop(f.value)),k.setStyles(f,{display:"",visibility:""})),k.removeClass(e,"tmce-active"),k.addClass(e,"html-active"),k.setAttrib(f,"aria-hidden",!1),setUserSetting("editor","html")}return!1},_wp_Nop:function(a){var b,c,d=!1,e=!1;return(-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")&&(e=!0,a=a.replace(/\[caption[\s\S]+?\[\/caption\]/g,function(a){return a.replace(/]*)>/g,"").replace(/[\r\n\t]+/,"")})),b="blockquote|ul|ol|li|table|thead|tbody|tfoot|tr|th|td|div|h[1-6]|p|fieldset",a=a.replace(new RegExp("\\s*\\s*","g"),"\n"),a=a.replace(new RegExp("\\s*<((?:"+b+")(?: [^>]*)?)>","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"),c="blockquote|ul|ol|li|table|thead|tbody|tfoot|tr|th|td|h[1-6]|pre|fieldset",a=a.replace(new RegExp("\\s*<((?:"+c+")(?: [^>]*)?)\\s*>","g"),"\n<$1>"),a=a.replace(new RegExp("\\s*\\s*","g"),"\n"),a=a.replace(/]*)>/g," "),-1!==a.indexOf("/g,"\n")),-1!==a.indexOf("]*)?>\s*/g,"\n\n\n\n")),-1!==a.indexOf("/g,function(a){return a.replace(/[\r\n]+/g,"")})),a=a.replace(/<\/p#>/g,"

\n"),a=a.replace(/\s*(

]+>[\s\S]*?<\/p>)/g,"\n$1"),a=a.replace(/^\s+/,""),a=a.replace(/[\s\u00a0]+$/,""),d&&(a=a.replace(//g,"\n")),e&&(a=a.replace(/]*)>/g,"")),a},_wp_Autop:function(a){var b=!1,c=!1,d="table|thead|tfoot|caption|col|colgroup|tbody|tr|td|th|div|dl|dd|dt|ul|ol|li|pre|form|map|area|blockquote|address|math|style|p|h[1-6]|hr|fieldset|legend|section|article|aside|hgroup|header|footer|nav|figure|figcaption|details|menu|summary";return-1!==a.indexOf("/g,function(a){return a.replace(/[\r\n]+/g,"")})),a=a.replace(/<[^<>]+>/g,function(a){return a.replace(/[\r\n]+/g," ")}),(-1!==a.indexOf("]*>[\s\S]+?<\/\1>/g,function(a){return a.replace(/(\r\n|\n)/g,"")})),-1!==a.indexOf("[caption")&&(c=!0,a=a.replace(/\[caption[\s\S]+?\[\/caption\]/g,function(a){return a=a.replace(/]*)>/g,""),a=a.replace(/<[a-zA-Z0-9]+( [^<>]+)?>/g,function(a){return a.replace(/[\r\n\t]+/," ")}),a.replace(/\s*\n\s*/g,"")})),a+="\n\n",a=a.replace(/
\s*
/gi,"\n\n"),a=a.replace(new RegExp("(<(?:"+d+")(?: [^>]*)?>)","gi"),"\n$1"),a=a.replace(new RegExp("()","gi"),"$1\n\n"),a=a.replace(/]*)?>/gi,"\n\n"),a=a.replace(/\s*"),a=a.replace(/\r\n|\r/g,"\n"),a=a.replace(/\n\s*\n+/g,"\n\n"),a=a.replace(/([\s\S]+?)\n\n/g,"

$1

\n"),a=a.replace(/

\s*?<\/p>/gi,""),a=a.replace(new RegExp("

\\s*(]*)?>)\\s*

","gi"),"$1"),a=a.replace(/

(/gi,"$1"),a=a.replace(/

\s*]*)>/gi,"

"),a=a.replace(/<\/blockquote>\s*<\/p>/gi,"

"),a=a.replace(new RegExp("

\\s*(]*)?>)","gi"),"$1"),a=a.replace(new RegExp("(]*)?>)\\s*

","gi"),"$1"),a=a.replace(/\s*\n/gi,"
\n"),a=a.replace(new RegExp("(]*>)\\s*
","gi"),"$1"),a=a.replace(/
(\s*<\/?(?:p|li|div|dl|dd|dt|th|pre|td|ul|ol)>)/gi,"$1"),a=a.replace(/(?:

|
)*\s*\[caption([^\[]+)\[\/caption\]\s*(?:<\/p>|
)*/gi,"[caption$1[/caption]"),a=a.replace(/(<(?:div|th|td|form|fieldset|dd)[^>]*>)(.*?)<\/p>/g,function(a,b,c){return c.match(/]*)?>/)?a:b+"

"+c+"

"}),b&&(a=a.replace(//g,"\n")),c&&(a=a.replace(/]*)>/g,"")),a},pre_wpautop:function(a){var b=this,c={o:b,data:a,unfiltered:a},d="undefined"!=typeof jQuery;return d&&jQuery("body").trigger("beforePreWpautop",[c]),c.data=b._wp_Nop(c.data),d&&jQuery("body").trigger("afterPreWpautop",[c]),c.data},wpautop:function(a){var b=this,c={o:b,data:a,unfiltered:a},d="undefined"!=typeof jQuery;return d&&jQuery("body").trigger("beforeWpautop",[c]),c.data=b._wp_Autop(c.data),d&&jQuery("body").trigger("afterWpautop",[c]),c.data}}; \ No newline at end of file diff --git a/wp-includes/formatting.php b/wp-includes/formatting.php index c4f7614457..f8d1e74264 100644 --- a/wp-includes/formatting.php +++ b/wp-includes/formatting.php @@ -405,7 +405,7 @@ function wpautop($pee, $br = true) { $pee = preg_replace('|
\s*
|', "\n\n", $pee); // Space things out a little - $allblocks = '(?:table|thead|tfoot|caption|col|colgroup|tbody|tr|td|th|div|dl|dd|dt|ul|ol|li|pre|form|map|area|blockquote|address|math|style|p|h[1-6]|hr|fieldset|legend|section|article|aside|hgroup|header|footer|nav|figure|details|menu|summary)'; + $allblocks = '(?:table|thead|tfoot|caption|col|colgroup|tbody|tr|td|th|div|dl|dd|dt|ul|ol|li|pre|form|map|area|blockquote|address|math|style|p|h[1-6]|hr|fieldset|legend|section|article|aside|hgroup|header|footer|nav|figure|figcaption|details|menu|summary)'; $pee = preg_replace('!(<' . $allblocks . '[^>]*>)!', "\n$1", $pee); $pee = preg_replace('!()!', "$1\n\n", $pee); $pee = str_replace(array("\r\n", "\r"), "\n", $pee); // cross-platform newlines diff --git a/wp-includes/version.php b/wp-includes/version.php index 4996640b49..1feec50e95 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -4,7 +4,7 @@ * * @global string $wp_version */ -$wp_version = '4.2-alpha-31185'; +$wp_version = '4.2-alpha-31186'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.