mirror of
https://github.com/WordPress/WordPress.git
synced 2025-03-11 22:29:48 +01:00
Formatting: fix wpautop()
to stop adding paragraph tags around <figcaption>
.
Fixes #39307 for trunk. Built from https://develop.svn.wordpress.org/trunk@39912 git-svn-id: http://core.svn.wordpress.org/trunk@39849 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
ee3052fdbe
commit
85ee190163
@ -167,7 +167,7 @@
|
||||
* @return {string} The content with stripped paragraph tags.
|
||||
*/
|
||||
function removep( html ) {
|
||||
var blocklist = 'blockquote|ul|ol|li|dl|dt|dd|table|thead|tbody|tfoot|tr|th|td|h[1-6]|fieldset',
|
||||
var blocklist = 'blockquote|ul|ol|li|dl|dt|dd|table|thead|tbody|tfoot|tr|th|td|h[1-6]|fieldset|figure',
|
||||
blocklist1 = blocklist + '|div|p',
|
||||
blocklist2 = blocklist + '|pre',
|
||||
preserve_linebreaks = false,
|
||||
@ -331,6 +331,11 @@
|
||||
});
|
||||
}
|
||||
|
||||
if ( text.indexOf( '<figcaption' ) !== -1 ) {
|
||||
text = text.replace( /\s*(<figcaption[^>]*>)/g, '$1' );
|
||||
text = text.replace( /<\/figcaption>\s*/g, '</figcaption>' );
|
||||
}
|
||||
|
||||
// Keep <br> tags inside captions.
|
||||
if ( text.indexOf( '[caption' ) !== -1 ) {
|
||||
preserve_br = true;
|
||||
|
2
wp-admin/js/editor.min.js
vendored
2
wp-admin/js/editor.min.js
vendored
File diff suppressed because one or more lines are too long
@ -506,6 +506,12 @@ function wpautop( $pee, $br = true ) {
|
||||
$pee = preg_replace( '%\s*(<(?:source|track)[^>]*>)\s*%', '$1', $pee );
|
||||
}
|
||||
|
||||
// Collapse line breaks before and after <figcaption> elements.
|
||||
if ( strpos( $pee, '<figcaption' ) !== false ) {
|
||||
$pee = preg_replace( '|\s*(<figcaption[^>]*>)|', '$1', $pee );
|
||||
$pee = preg_replace( '|</figcaption>\s*|', '</figcaption>', $pee );
|
||||
}
|
||||
|
||||
// Remove more than two contiguous line breaks.
|
||||
$pee = preg_replace("/\n\n+/", "\n\n", $pee);
|
||||
|
||||
|
@ -4,7 +4,7 @@
|
||||
*
|
||||
* @global string $wp_version
|
||||
*/
|
||||
$wp_version = '4.8-alpha-39911';
|
||||
$wp_version = '4.8-alpha-39912';
|
||||
|
||||
/**
|
||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||
|
Loading…
Reference in New Issue
Block a user