Editor: Restore shortcode support for block templates.

Follow up to [55761].

Props youknowriad, Clorith, desrosj, antpb, Otto42, johnbillion, jorbin, rmccue, timothyblynjacobs, mikeschroder, peterwilsoncc, audrasjb, matveb, noisysocks, xknown, ehtis, isabel_brison, talldanwp, gziolo, chriscct7, davidbaumwald.
Merges [55828] to the 6.1 branch.
See #58333.

git-svn-id: https://develop.svn.wordpress.org/branches/6.1@55830 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Jonathan Desrosiers 2023-05-20 04:02:09 +00:00
parent 8768607685
commit e45d1dbdd9
5 changed files with 39 additions and 31 deletions

46
package-lock.json generated
View File

@ -4021,9 +4021,9 @@
}
},
"@wordpress/block-directory": {
"version": "3.15.11",
"resolved": "https://registry.npmjs.org/@wordpress/block-directory/-/block-directory-3.15.11.tgz",
"integrity": "sha512-KiQrYfxkiLrrQJgRaw1C32a9vXbNEZorEd0KuEVRZs4LYtNOKj/Je1low4Tvj77lh870Q38SiOCMWgtqtRtRJA==",
"version": "3.15.13",
"resolved": "https://registry.npmjs.org/@wordpress/block-directory/-/block-directory-3.15.13.tgz",
"integrity": "sha512-xlHKFQkx1Hi/Ka07PG449fiz6us5exuQ9S0guoRpFHK+oR/XDLn7dLnk4VEPWIRupWM9POV8kHEJvK83+Pojjw==",
"requires": {
"@babel/runtime": "^7.16.0",
"@wordpress/a11y": "^3.17.1",
@ -4034,7 +4034,7 @@
"@wordpress/compose": "^5.15.2",
"@wordpress/core-data": "^5.0.4",
"@wordpress/data": "^7.1.3",
"@wordpress/edit-post": "^6.14.11",
"@wordpress/edit-post": "^6.14.13",
"@wordpress/editor": "^12.16.10",
"@wordpress/element": "^4.15.1",
"@wordpress/hooks": "^3.17.1",
@ -4095,9 +4095,9 @@
}
},
"@wordpress/block-library": {
"version": "7.14.11",
"resolved": "https://registry.npmjs.org/@wordpress/block-library/-/block-library-7.14.11.tgz",
"integrity": "sha512-BiLDYp1snS+FCzNWJJEjMxNjKlhLTRQgKzNUwiK/UIQr/5Drif6GNPsNOiFs3ha5kKZli7l4CyFHiZE99PNiJA==",
"version": "7.14.13",
"resolved": "https://registry.npmjs.org/@wordpress/block-library/-/block-library-7.14.13.tgz",
"integrity": "sha512-NHU5xRimeUk0FRzvuZuxa5V/5gj8t2CsU/VkPSrtup5Ijywhut1AJfWlqhDgRP42MMHhzGTHD6TjKcPOHZFsZQ==",
"requires": {
"@babel/runtime": "^7.16.0",
"@wordpress/a11y": "^3.17.1",
@ -4300,13 +4300,13 @@
}
},
"@wordpress/customize-widgets": {
"version": "3.14.11",
"resolved": "https://registry.npmjs.org/@wordpress/customize-widgets/-/customize-widgets-3.14.11.tgz",
"integrity": "sha512-aJ/++NFDjirmTF0zAbOzfKSeX+6sMK0vjv07Pjis4gztRJ4P+lfYaj/aUCjQz/OhJwaw1jyQNx3FxcbS3L/iLg==",
"version": "3.14.13",
"resolved": "https://registry.npmjs.org/@wordpress/customize-widgets/-/customize-widgets-3.14.13.tgz",
"integrity": "sha512-V/0eTab5KEBh+BVxOcXSJ5GfSHds5STLW5ZjXG4oRJjJQhSBknVufpGsZYlr0NlhpPkzGz6zHQSUKGhlWLAi0g==",
"requires": {
"@babel/runtime": "^7.16.0",
"@wordpress/block-editor": "^10.0.10",
"@wordpress/block-library": "^7.14.11",
"@wordpress/block-library": "^7.14.13",
"@wordpress/blocks": "^11.16.4",
"@wordpress/components": "^21.0.7",
"@wordpress/compose": "^5.15.2",
@ -4451,15 +4451,15 @@
}
},
"@wordpress/edit-post": {
"version": "6.14.11",
"resolved": "https://registry.npmjs.org/@wordpress/edit-post/-/edit-post-6.14.11.tgz",
"integrity": "sha512-ZqNPUlCRBRd4rUYExTVDmaIX/J0yAwaZybtcfSWPacrNnq40xrv16wrLFNZAFn5oCTrKAkuTWWjsjuQhEbw8yg==",
"version": "6.14.13",
"resolved": "https://registry.npmjs.org/@wordpress/edit-post/-/edit-post-6.14.13.tgz",
"integrity": "sha512-jDBjIILhdrS16KzWeVwhqL0qCLHd7JfLqvtgBdCdJUEJ+8xtMzldE3D6Y/lF2M0SToDZYWhYSeW7TfZoMRhjfg==",
"requires": {
"@babel/runtime": "^7.16.0",
"@wordpress/a11y": "^3.17.1",
"@wordpress/api-fetch": "^6.14.1",
"@wordpress/block-editor": "^10.0.10",
"@wordpress/block-library": "^7.14.11",
"@wordpress/block-library": "^7.14.13",
"@wordpress/blocks": "^11.16.4",
"@wordpress/components": "^21.0.7",
"@wordpress/compose": "^5.15.2",
@ -4488,15 +4488,15 @@
}
},
"@wordpress/edit-site": {
"version": "4.14.13",
"resolved": "https://registry.npmjs.org/@wordpress/edit-site/-/edit-site-4.14.13.tgz",
"integrity": "sha512-A5mmwIOSVgiJ1QoCHfnO+ehECoI4gW/g0/GDCpvxbEiHLhexKh3aNDwsy2izO990IoAd1h55hYPYAUBxNX8a+w==",
"version": "4.14.15",
"resolved": "https://registry.npmjs.org/@wordpress/edit-site/-/edit-site-4.14.15.tgz",
"integrity": "sha512-ZP3TnE6nXvODhVDkruayCLa/ahPdVF56IWQwN1KfR8KIGunIMJkEpWE/C5rRz9sp5J01wOJY8/QMkrKUauHHBA==",
"requires": {
"@babel/runtime": "^7.16.0",
"@wordpress/a11y": "^3.17.1",
"@wordpress/api-fetch": "^6.14.1",
"@wordpress/block-editor": "^10.0.10",
"@wordpress/block-library": "^7.14.11",
"@wordpress/block-library": "^7.14.13",
"@wordpress/blocks": "^11.16.4",
"@wordpress/components": "^21.0.7",
"@wordpress/compose": "^5.15.2",
@ -4529,14 +4529,14 @@
}
},
"@wordpress/edit-widgets": {
"version": "4.14.11",
"resolved": "https://registry.npmjs.org/@wordpress/edit-widgets/-/edit-widgets-4.14.11.tgz",
"integrity": "sha512-5nb583zlv/YZCbIfEkV7gTk+UddZNDGr1C4B/7EWAjNhQAg3/dv3eqD0N/WYTYLxBAUI3O2heO0i85/AiGqUKg==",
"version": "4.14.13",
"resolved": "https://registry.npmjs.org/@wordpress/edit-widgets/-/edit-widgets-4.14.13.tgz",
"integrity": "sha512-JPtT1UaiPs5SZBGHVSNeUX8D93hQrsmGmHoKu7Ja5TbbWGvOiRVaqcG3hFSP0aZpMvecY8uBWi5f8WWP+bPK3g==",
"requires": {
"@babel/runtime": "^7.16.0",
"@wordpress/api-fetch": "^6.14.1",
"@wordpress/block-editor": "^10.0.10",
"@wordpress/block-library": "^7.14.11",
"@wordpress/block-library": "^7.14.13",
"@wordpress/blocks": "^11.16.4",
"@wordpress/components": "^21.0.7",
"@wordpress/compose": "^5.15.2",

View File

@ -81,24 +81,24 @@
"@wordpress/api-fetch": "6.14.1",
"@wordpress/autop": "3.17.1",
"@wordpress/blob": "3.17.1",
"@wordpress/block-directory": "3.15.11",
"@wordpress/block-directory": "3.15.13",
"@wordpress/block-editor": "10.0.10",
"@wordpress/block-library": "7.14.11",
"@wordpress/block-library": "7.14.13",
"@wordpress/block-serialization-default-parser": "4.17.1",
"@wordpress/blocks": "11.16.4",
"@wordpress/components": "21.0.7",
"@wordpress/compose": "5.15.2",
"@wordpress/core-data": "5.0.4",
"@wordpress/customize-widgets": "3.14.11",
"@wordpress/customize-widgets": "3.14.13",
"@wordpress/data": "7.1.3",
"@wordpress/data-controls": "2.17.3",
"@wordpress/date": "4.17.1",
"@wordpress/deprecated": "3.17.1",
"@wordpress/dom": "3.17.2",
"@wordpress/dom-ready": "3.17.1",
"@wordpress/edit-post": "6.14.11",
"@wordpress/edit-site": "4.14.13",
"@wordpress/edit-widgets": "4.14.11",
"@wordpress/edit-post": "6.14.13",
"@wordpress/edit-site": "4.14.15",
"@wordpress/edit-widgets": "4.14.13",
"@wordpress/editor": "12.16.10",
"@wordpress/element": "4.15.1",
"@wordpress/escape-html": "2.17.1",

View File

@ -237,6 +237,8 @@ function get_the_block_template_html() {
$content = $wp_embed->run_shortcode( $_wp_current_template_content );
$content = $wp_embed->autoembed( $content );
$content = shortcode_unautop( $content );
$content = do_shortcode( $content );
$content = do_blocks( $content );
$content = wptexturize( $content );
$content = convert_smilies( $content );

View File

@ -19,6 +19,12 @@ function render_block_core_post_featured_image( $attributes, $content, $block )
}
$post_ID = $block->context['postId'];
// Check is needed for backward compatibility with third-party plugins
// that might rely on the `in_the_loop` check; calling `the_post` sets it to true.
if ( ! in_the_loop() && have_posts() ) {
the_post();
}
$is_link = isset( $attributes['isLink'] ) && $attributes['isLink'];
$size_slug = isset( $attributes['sizeSlug'] ) ? $attributes['sizeSlug'] : 'post-thumbnail';
$post_title = trim( strip_tags( get_the_title( $post_ID ) ) );

View File

@ -128,14 +128,14 @@ function render_block_core_template_part( $attributes ) {
}
// Run through the actions that are typically taken on the_content.
$content = shortcode_unautop( $content );
$content = do_shortcode( $content );
$seen_ids[ $template_part_id ] = true;
$content = do_blocks( $content );
unset( $seen_ids[ $template_part_id ] );
$content = wptexturize( $content );
$content = convert_smilies( $content );
$content = shortcode_unautop( $content );
$content = wp_filter_content_tags( $content );
$content = do_shortcode( $content );
// Handle embeds for block template parts.
global $wp_embed;