Block Editor: Package updates for WordPress 5.8 beta 1 (batch2).
This includes the following fixes: - Fix inspector opening when clicking outside the widget areas - Assume light theme when a transparent background is used - Make Post blocks non editable inside Query block - Rename QueryLoop to PostTemplate block Props ntsekouras. See #52991. Built from https://develop.svn.wordpress.org/trunk@51101 git-svn-id: http://core.svn.wordpress.org/trunk@50710 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
a44c69354d
commit
1a7f28b3cd
File diff suppressed because one or more lines are too long
|
@ -11,13 +11,13 @@ return array(
|
||||||
'categories' => array( 'query' ),
|
'categories' => array( 'query' ),
|
||||||
'content' => '<!-- wp:query {"query":{"perPage":6,"pages":0,"offset":0,"postType":"post","categoryIds":[],"tagIds":[],"order":"desc","orderBy":"date","author":"","search":"","exclude":[],"sticky":"exclude","inherit":false},"displayLayout":{"type":"flex","columns":3}} -->
|
'content' => '<!-- wp:query {"query":{"perPage":6,"pages":0,"offset":0,"postType":"post","categoryIds":[],"tagIds":[],"order":"desc","orderBy":"date","author":"","search":"","exclude":[],"sticky":"exclude","inherit":false},"displayLayout":{"type":"flex","columns":3}} -->
|
||||||
<div class="wp-block-query">
|
<div class="wp-block-query">
|
||||||
<!-- wp:query-loop -->
|
<!-- wp:post-template -->
|
||||||
<!-- wp:group {"tagName":"main","style":{"spacing":{"padding":{"top":"30px","right":"30px","bottom":"30px","left":"30px"}}},"layout":{"inherit":false}} -->
|
<!-- wp:group {"tagName":"main","style":{"spacing":{"padding":{"top":"30px","right":"30px","bottom":"30px","left":"30px"}}},"layout":{"inherit":false}} -->
|
||||||
<main class="wp-block-group" style="padding-top:30px;padding-right:30px;padding-bottom:30px;padding-left:30px"><!-- wp:post-title {"isLink":true} /-->
|
<main class="wp-block-group" style="padding-top:30px;padding-right:30px;padding-bottom:30px;padding-left:30px"><!-- wp:post-title {"isLink":true} /-->
|
||||||
<!-- wp:post-excerpt {"wordCount":20} /-->
|
<!-- wp:post-excerpt {"wordCount":20} /-->
|
||||||
<!-- wp:post-date /--></div>
|
<!-- wp:post-date /--></div>
|
||||||
<!-- /wp:group -->
|
<!-- /wp:group -->
|
||||||
<!-- /wp:query-loop -->
|
<!-- /wp:post-template -->
|
||||||
</div>
|
</div>
|
||||||
<!-- /wp:query -->',
|
<!-- /wp:query -->',
|
||||||
);
|
);
|
||||||
|
|
|
@ -11,7 +11,7 @@ return array(
|
||||||
'categories' => array( 'query' ),
|
'categories' => array( 'query' ),
|
||||||
'content' => '<!-- wp:group {"align":"full","style":{"spacing":{"padding":{"top":"100px","right":"100px","bottom":"100px","left":"100px"}},"color":{"text":"#ffffff","background":"#000000"}}} -->
|
'content' => '<!-- wp:group {"align":"full","style":{"spacing":{"padding":{"top":"100px","right":"100px","bottom":"100px","left":"100px"}},"color":{"text":"#ffffff","background":"#000000"}}} -->
|
||||||
<div class="wp-block-group alignfull has-text-color has-background" style="background-color:#000000;color:#ffffff;padding-top:100px;padding-right:100px;padding-bottom:100px;padding-left:100px"><!-- wp:query {"query":{"perPage":3,"pages":0,"offset":0,"postType":"post","categoryIds":[],"tagIds":[],"order":"desc","orderBy":"date","author":"","search":"","exclude":[],"sticky":"","inherit":false}} -->
|
<div class="wp-block-group alignfull has-text-color has-background" style="background-color:#000000;color:#ffffff;padding-top:100px;padding-right:100px;padding-bottom:100px;padding-left:100px"><!-- wp:query {"query":{"perPage":3,"pages":0,"offset":0,"postType":"post","categoryIds":[],"tagIds":[],"order":"desc","orderBy":"date","author":"","search":"","exclude":[],"sticky":"","inherit":false}} -->
|
||||||
<div class="wp-block-query"><!-- wp:query-loop -->
|
<div class="wp-block-query"><!-- wp:post-template -->
|
||||||
<!-- wp:separator {"customColor":"#ffffff","align":"wide","className":"is-style-wide"} -->
|
<!-- wp:separator {"customColor":"#ffffff","align":"wide","className":"is-style-wide"} -->
|
||||||
<hr class="wp-block-separator alignwide has-text-color has-background is-style-wide" style="background-color:#ffffff;color:#ffffff"/>
|
<hr class="wp-block-separator alignwide has-text-color has-background is-style-wide" style="background-color:#ffffff;color:#ffffff"/>
|
||||||
<!-- /wp:separator -->
|
<!-- /wp:separator -->
|
||||||
|
@ -25,7 +25,7 @@ return array(
|
||||||
<div class="wp-block-column is-vertically-aligned-center" style="flex-basis:80%"><!-- wp:post-title {"isLink":true,"style":{"typography":{"fontSize":"72px","lineHeight":"1.1"},"color":{"text":"#ffffff","link":"#ffffff"}}} /--></div>
|
<div class="wp-block-column is-vertically-aligned-center" style="flex-basis:80%"><!-- wp:post-title {"isLink":true,"style":{"typography":{"fontSize":"72px","lineHeight":"1.1"},"color":{"text":"#ffffff","link":"#ffffff"}}} /--></div>
|
||||||
<!-- /wp:column --></div>
|
<!-- /wp:column --></div>
|
||||||
<!-- /wp:columns -->
|
<!-- /wp:columns -->
|
||||||
<!-- /wp:query-loop --></div>
|
<!-- /wp:post-template --></div>
|
||||||
<!-- /wp:query --></div>
|
<!-- /wp:query --></div>
|
||||||
<!-- /wp:group -->',
|
<!-- /wp:group -->',
|
||||||
);
|
);
|
||||||
|
|
|
@ -11,7 +11,7 @@ return array(
|
||||||
'categories' => array( 'query' ),
|
'categories' => array( 'query' ),
|
||||||
'content' => '<!-- wp:query {"query":{"perPage":1,"pages":0,"offset":0,"postType":"post","categoryIds":[],"tagIds":[],"order":"desc","orderBy":"date","author":"","search":"","exclude":[],"sticky":"","inherit":false}} -->
|
'content' => '<!-- wp:query {"query":{"perPage":1,"pages":0,"offset":0,"postType":"post","categoryIds":[],"tagIds":[],"order":"desc","orderBy":"date","author":"","search":"","exclude":[],"sticky":"","inherit":false}} -->
|
||||||
<div class="wp-block-query">
|
<div class="wp-block-query">
|
||||||
<!-- wp:query-loop -->
|
<!-- wp:post-template -->
|
||||||
<!-- wp:columns {"align":"wide"} -->
|
<!-- wp:columns {"align":"wide"} -->
|
||||||
<div class="wp-block-columns alignwide"><!-- wp:column {"width":"66.66%"} -->
|
<div class="wp-block-columns alignwide"><!-- wp:column {"width":"66.66%"} -->
|
||||||
<div class="wp-block-column" style="flex-basis:66.66%"><!-- wp:post-featured-image {"isLink":true} /--></div>
|
<div class="wp-block-column" style="flex-basis:66.66%"><!-- wp:post-featured-image {"isLink":true} /--></div>
|
||||||
|
@ -21,7 +21,7 @@ return array(
|
||||||
<!-- wp:post-excerpt /--></div>
|
<!-- wp:post-excerpt /--></div>
|
||||||
<!-- /wp:column --></div>
|
<!-- /wp:column --></div>
|
||||||
<!-- /wp:columns -->
|
<!-- /wp:columns -->
|
||||||
<!-- /wp:query-loop -->
|
<!-- /wp:post-template -->
|
||||||
</div>
|
</div>
|
||||||
<!-- /wp:query -->',
|
<!-- /wp:query -->',
|
||||||
);
|
);
|
||||||
|
|
|
@ -13,26 +13,26 @@ return array(
|
||||||
<main class="wp-block-group" style="padding-top:30px;padding-right:30px;padding-bottom:30px;padding-left:30px"><!-- wp:columns -->
|
<main class="wp-block-group" style="padding-top:30px;padding-right:30px;padding-bottom:30px;padding-left:30px"><!-- wp:columns -->
|
||||||
<div class="wp-block-columns"><!-- wp:column {"width":"50%"} -->
|
<div class="wp-block-columns"><!-- wp:column {"width":"50%"} -->
|
||||||
<div class="wp-block-column" style="flex-basis:50%"><!-- wp:query {"query":{"perPage":2,"pages":0,"offset":0,"postType":"post","categoryIds":[],"tagIds":[],"order":"desc","orderBy":"date","author":"","search":"","exclude":[],"sticky":"exclude","inherit":false},"displayLayout":{"type":"list"}} -->
|
<div class="wp-block-column" style="flex-basis:50%"><!-- wp:query {"query":{"perPage":2,"pages":0,"offset":0,"postType":"post","categoryIds":[],"tagIds":[],"order":"desc","orderBy":"date","author":"","search":"","exclude":[],"sticky":"exclude","inherit":false},"displayLayout":{"type":"list"}} -->
|
||||||
<div class="wp-block-query"><!-- wp:query-loop -->
|
<div class="wp-block-query"><!-- wp:post-template -->
|
||||||
<!-- wp:post-featured-image /-->
|
<!-- wp:post-featured-image /-->
|
||||||
<!-- wp:post-title /-->
|
<!-- wp:post-title /-->
|
||||||
<!-- wp:post-date /-->
|
<!-- wp:post-date /-->
|
||||||
<!-- wp:spacer {"height":200} -->
|
<!-- wp:spacer {"height":200} -->
|
||||||
<div style="height:200px" aria-hidden="true" class="wp-block-spacer"></div>
|
<div style="height:200px" aria-hidden="true" class="wp-block-spacer"></div>
|
||||||
<!-- /wp:spacer -->
|
<!-- /wp:spacer -->
|
||||||
<!-- /wp:query-loop --></div>
|
<!-- /wp:post-template --></div>
|
||||||
<!-- /wp:query --></div>
|
<!-- /wp:query --></div>
|
||||||
<!-- /wp:column -->
|
<!-- /wp:column -->
|
||||||
<!-- wp:column {"width":"50%"} -->
|
<!-- wp:column {"width":"50%"} -->
|
||||||
<div class="wp-block-column" style="flex-basis:50%"><!-- wp:query {"query":{"perPage":2,"pages":0,"offset":2,"postType":"post","categoryIds":[],"tagIds":[],"order":"desc","orderBy":"date","author":"","search":"","exclude":[],"sticky":"exclude","inherit":false},"displayLayout":{"type":"list"}} -->
|
<div class="wp-block-column" style="flex-basis:50%"><!-- wp:query {"query":{"perPage":2,"pages":0,"offset":2,"postType":"post","categoryIds":[],"tagIds":[],"order":"desc","orderBy":"date","author":"","search":"","exclude":[],"sticky":"exclude","inherit":false},"displayLayout":{"type":"list"}} -->
|
||||||
<div class="wp-block-query"><!-- wp:query-loop -->
|
<div class="wp-block-query"><!-- wp:post-template -->
|
||||||
<!-- wp:spacer {"height":200} -->
|
<!-- wp:spacer {"height":200} -->
|
||||||
<div style="height:200px" aria-hidden="true" class="wp-block-spacer"></div>
|
<div style="height:200px" aria-hidden="true" class="wp-block-spacer"></div>
|
||||||
<!-- /wp:spacer -->
|
<!-- /wp:spacer -->
|
||||||
<!-- wp:post-featured-image /-->
|
<!-- wp:post-featured-image /-->
|
||||||
<!-- wp:post-title /-->
|
<!-- wp:post-title /-->
|
||||||
<!-- wp:post-date /-->
|
<!-- wp:post-date /-->
|
||||||
<!-- /wp:query-loop --></div>
|
<!-- /wp:post-template --></div>
|
||||||
<!-- /wp:query --></div>
|
<!-- /wp:query --></div>
|
||||||
<!-- /wp:column --></div>
|
<!-- /wp:column --></div>
|
||||||
<!-- /wp:columns --></main>
|
<!-- /wp:columns --></main>
|
||||||
|
|
|
@ -11,7 +11,7 @@ return array(
|
||||||
'categories' => array( 'query' ),
|
'categories' => array( 'query' ),
|
||||||
'content' => '<!-- wp:query {"query":{"perPage":1,"pages":0,"offset":0,"postType":"post","categoryIds":[],"tagIds":[],"order":"desc","orderBy":"date","author":"","search":"","exclude":[],"sticky":"","inherit":false}} -->
|
'content' => '<!-- wp:query {"query":{"perPage":1,"pages":0,"offset":0,"postType":"post","categoryIds":[],"tagIds":[],"order":"desc","orderBy":"date","author":"","search":"","exclude":[],"sticky":"","inherit":false}} -->
|
||||||
<div class="wp-block-query">
|
<div class="wp-block-query">
|
||||||
<!-- wp:query-loop -->
|
<!-- wp:post-template -->
|
||||||
<!-- wp:columns {"verticalAlignment":"center"} -->
|
<!-- wp:columns {"verticalAlignment":"center"} -->
|
||||||
<div class="wp-block-columns are-vertically-aligned-center"><!-- wp:column {"verticalAlignment":"center","width":"25%"} -->
|
<div class="wp-block-columns are-vertically-aligned-center"><!-- wp:column {"verticalAlignment":"center","width":"25%"} -->
|
||||||
<div class="wp-block-column is-vertically-aligned-center" style="flex-basis:25%"><!-- wp:post-featured-image {"isLink":true} /--></div>
|
<div class="wp-block-column is-vertically-aligned-center" style="flex-basis:25%"><!-- wp:post-featured-image {"isLink":true} /--></div>
|
||||||
|
@ -20,7 +20,7 @@ return array(
|
||||||
<div class="wp-block-column is-vertically-aligned-center" style="flex-basis:75%"><!-- wp:post-title {"isLink":true} /--></div>
|
<div class="wp-block-column is-vertically-aligned-center" style="flex-basis:75%"><!-- wp:post-title {"isLink":true} /--></div>
|
||||||
<!-- /wp:column --></div>
|
<!-- /wp:column --></div>
|
||||||
<!-- /wp:columns -->
|
<!-- /wp:columns -->
|
||||||
<!-- /wp:query-loop -->
|
<!-- /wp:post-template -->
|
||||||
</div>
|
</div>
|
||||||
<!-- /wp:query -->',
|
<!-- /wp:query -->',
|
||||||
);
|
);
|
||||||
|
|
|
@ -11,7 +11,7 @@ return array(
|
||||||
'categories' => array( 'query' ),
|
'categories' => array( 'query' ),
|
||||||
'content' => '<!-- wp:query {"query":{"perPage":1,"pages":0,"offset":0,"postType":"post","categoryIds":[],"tagIds":[],"order":"desc","orderBy":"date","author":"","search":"","exclude":[],"sticky":"","inherit":false}} -->
|
'content' => '<!-- wp:query {"query":{"perPage":1,"pages":0,"offset":0,"postType":"post","categoryIds":[],"tagIds":[],"order":"desc","orderBy":"date","author":"","search":"","exclude":[],"sticky":"","inherit":false}} -->
|
||||||
<div class="wp-block-query">
|
<div class="wp-block-query">
|
||||||
<!-- wp:query-loop -->
|
<!-- wp:post-template -->
|
||||||
<!-- wp:post-title {"isLink":true} /-->
|
<!-- wp:post-title {"isLink":true} /-->
|
||||||
<!-- wp:post-featured-image {"isLink":true,"align":"wide"} /-->
|
<!-- wp:post-featured-image {"isLink":true,"align":"wide"} /-->
|
||||||
<!-- wp:post-excerpt /-->
|
<!-- wp:post-excerpt /-->
|
||||||
|
@ -19,7 +19,7 @@ return array(
|
||||||
<hr class="wp-block-separator"/>
|
<hr class="wp-block-separator"/>
|
||||||
<!-- /wp:separator -->
|
<!-- /wp:separator -->
|
||||||
<!-- wp:post-date /-->
|
<!-- wp:post-date /-->
|
||||||
<!-- /wp:query-loop -->
|
<!-- /wp:post-template -->
|
||||||
</div>
|
</div>
|
||||||
<!-- /wp:query -->',
|
<!-- /wp:query -->',
|
||||||
);
|
);
|
||||||
|
|
|
@ -21,8 +21,8 @@ require ABSPATH . WPINC . '/blocks/post-excerpt.php';
|
||||||
require ABSPATH . WPINC . '/blocks/post-featured-image.php';
|
require ABSPATH . WPINC . '/blocks/post-featured-image.php';
|
||||||
require ABSPATH . WPINC . '/blocks/post-terms.php';
|
require ABSPATH . WPINC . '/blocks/post-terms.php';
|
||||||
require ABSPATH . WPINC . '/blocks/post-title.php';
|
require ABSPATH . WPINC . '/blocks/post-title.php';
|
||||||
|
require ABSPATH . WPINC . '/blocks/post-template.php';
|
||||||
require ABSPATH . WPINC . '/blocks/query.php';
|
require ABSPATH . WPINC . '/blocks/query.php';
|
||||||
require ABSPATH . WPINC . '/blocks/query-loop.php';
|
|
||||||
require ABSPATH . WPINC . '/blocks/query-pagination.php';
|
require ABSPATH . WPINC . '/blocks/query-pagination.php';
|
||||||
require ABSPATH . WPINC . '/blocks/query-pagination-next.php';
|
require ABSPATH . WPINC . '/blocks/query-pagination-next.php';
|
||||||
require ABSPATH . WPINC . '/blocks/query-pagination-numbers.php';
|
require ABSPATH . WPINC . '/blocks/query-pagination-numbers.php';
|
||||||
|
|
|
@ -0,0 +1,148 @@
|
||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* Server-side rendering of the `core/post-template` block.
|
||||||
|
*
|
||||||
|
* @package WordPress
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Renders the `core/post-template` block on the server.
|
||||||
|
*
|
||||||
|
* @param array $attributes Block attributes.
|
||||||
|
* @param string $content Block default content.
|
||||||
|
* @param WP_Block $block Block instance.
|
||||||
|
*
|
||||||
|
* @return string Returns the output of the query, structured using the layout defined by the block's inner blocks.
|
||||||
|
*/
|
||||||
|
function render_block_core_post_template( $attributes, $content, $block ) {
|
||||||
|
$page_key = isset( $block->context['queryId'] ) ? 'query-' . $block->context['queryId'] . '-page' : 'query-page';
|
||||||
|
$page = empty( $_GET[ $page_key ] ) ? 1 : (int) $_GET[ $page_key ];
|
||||||
|
|
||||||
|
$query_args = build_query_vars_from_query_block( $block, $page );
|
||||||
|
// Override the custom query with the global query if needed.
|
||||||
|
$use_global_query = ( isset( $block->context['query']['inherit'] ) && $block->context['query']['inherit'] );
|
||||||
|
if ( $use_global_query ) {
|
||||||
|
global $wp_query;
|
||||||
|
if ( $wp_query && isset( $wp_query->query_vars ) && is_array( $wp_query->query_vars ) ) {
|
||||||
|
// Unset `offset` because if is set, $wp_query overrides/ignores the paged parameter and breaks pagination.
|
||||||
|
unset( $query_args['offset'] );
|
||||||
|
$query_args = wp_parse_args( $wp_query->query_vars, $query_args );
|
||||||
|
|
||||||
|
if ( empty( $query_args['post_type'] ) && is_singular() ) {
|
||||||
|
$query_args['post_type'] = get_post_type( get_the_ID() );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$query = new WP_Query( $query_args );
|
||||||
|
|
||||||
|
if ( ! $query->have_posts() ) {
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
|
||||||
|
$classnames = '';
|
||||||
|
if ( isset( $block->context['displayLayout'] ) && isset( $block->context['query'] ) ) {
|
||||||
|
if ( isset( $block->context['displayLayout']['type'] ) && 'flex' === $block->context['displayLayout']['type'] ) {
|
||||||
|
$classnames = "is-flex-container columns-{$block->context['displayLayout']['columns']}";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$wrapper_attributes = get_block_wrapper_attributes( array( 'class' => $classnames ) );
|
||||||
|
|
||||||
|
$content = '';
|
||||||
|
while ( $query->have_posts() ) {
|
||||||
|
$query->the_post();
|
||||||
|
$block_content = (
|
||||||
|
new WP_Block(
|
||||||
|
$block->parsed_block,
|
||||||
|
array(
|
||||||
|
'postType' => get_post_type(),
|
||||||
|
'postId' => get_the_ID(),
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)->render( array( 'dynamic' => false ) );
|
||||||
|
$content .= "<li>{$block_content}</li>";
|
||||||
|
}
|
||||||
|
|
||||||
|
wp_reset_postdata();
|
||||||
|
|
||||||
|
return sprintf(
|
||||||
|
'<ul %1$s>%2$s</ul>',
|
||||||
|
$wrapper_attributes,
|
||||||
|
$content
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Registers the `core/post-template` block on the server.
|
||||||
|
*/
|
||||||
|
function register_block_core_post_template() {
|
||||||
|
register_block_type_from_metadata(
|
||||||
|
__DIR__ . '/post-template',
|
||||||
|
array(
|
||||||
|
'render_callback' => 'render_block_core_post_template',
|
||||||
|
'skip_inner_blocks' => true,
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
add_action( 'init', 'register_block_core_post_template' );
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Renders the legacy `core/query-loop` block on the server.
|
||||||
|
* It triggers a developer warning and then calls the renamed
|
||||||
|
* block's `render_callback` function output.
|
||||||
|
*
|
||||||
|
* This can be removed when WordPress 5.9 is released.
|
||||||
|
*
|
||||||
|
* @param array $attributes Block attributes.
|
||||||
|
* @param string $content Block default content.
|
||||||
|
* @param WP_Block $block Block instance.
|
||||||
|
*
|
||||||
|
* @return string Returns the output of the query, structured using the layout defined by the block's inner blocks.
|
||||||
|
*/
|
||||||
|
function render_legacy_query_loop_block( $attributes, $content, $block ) {
|
||||||
|
trigger_error(
|
||||||
|
/* translators: %1$s: Block type */
|
||||||
|
sprintf( __( 'Block %1$s has been renamed to Post Template. %1$s will be supported until WordPress version 5.9.', 'gutenberg' ), $block->name ),
|
||||||
|
headers_sent() || WP_DEBUG ? E_USER_WARNING : E_USER_NOTICE
|
||||||
|
);
|
||||||
|
return render_block_core_post_template( $attributes, $content, $block );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Complements the renaming of `Query Loop` to `Post Template`.
|
||||||
|
* This ensures backwards compatibility for any users running the Gutenberg
|
||||||
|
* plugin who have used Query Loop prior to its renaming.
|
||||||
|
*
|
||||||
|
* This can be removed when WordPress 5.9 is released.
|
||||||
|
*
|
||||||
|
* @see https://github.com/WordPress/gutenberg/pull/32514
|
||||||
|
*/
|
||||||
|
function gutenberg_register_legacy_query_loop_block() {
|
||||||
|
$registry = WP_Block_Type_Registry::get_instance();
|
||||||
|
if ( $registry->is_registered( 'core/query-loop' ) ) {
|
||||||
|
unregister_block_type( 'core/query-loop' );
|
||||||
|
}
|
||||||
|
register_block_type(
|
||||||
|
'core/query-loop',
|
||||||
|
array(
|
||||||
|
'category' => 'design',
|
||||||
|
'uses_context' => array(
|
||||||
|
'queryId',
|
||||||
|
'query',
|
||||||
|
'queryContext',
|
||||||
|
'displayLayout',
|
||||||
|
'templateSlug',
|
||||||
|
),
|
||||||
|
'supports' => array(
|
||||||
|
'reusable' => false,
|
||||||
|
'html' => false,
|
||||||
|
'align' => true,
|
||||||
|
),
|
||||||
|
'style' => 'wp-block-post-template',
|
||||||
|
'render_callback' => 'render_legacy_query_loop_block',
|
||||||
|
'skip_inner_blocks' => true,
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
add_action( 'init', 'gutenberg_register_legacy_query_loop_block' );
|
|
@ -1,10 +1,10 @@
|
||||||
{
|
{
|
||||||
"apiVersion": 2,
|
"apiVersion": 2,
|
||||||
"name": "core/query-loop",
|
"name": "core/post-template",
|
||||||
"title": "Query Loop",
|
"title": "Post Template",
|
||||||
"category": "design",
|
"category": "design",
|
||||||
"parent": [ "core/query" ],
|
"parent": [ "core/query" ],
|
||||||
"description": "Query loop.",
|
"description": "Post Template.",
|
||||||
"textdomain": "default",
|
"textdomain": "default",
|
||||||
"usesContext": [
|
"usesContext": [
|
||||||
"queryId",
|
"queryId",
|
||||||
|
@ -18,6 +18,6 @@
|
||||||
"html": false,
|
"html": false,
|
||||||
"align": true
|
"align": true
|
||||||
},
|
},
|
||||||
"style": "wp-block-query-loop",
|
"style": "wp-block-post-template",
|
||||||
"editorStyle": "wp-block-query-loop-editor"
|
"editorStyle": "wp-block-post-template-editor"
|
||||||
}
|
}
|
|
@ -68,7 +68,7 @@
|
||||||
/**
|
/**
|
||||||
* Reset the WP Admin page styles for Gutenberg-like pages.
|
* Reset the WP Admin page styles for Gutenberg-like pages.
|
||||||
*/
|
*/
|
||||||
.editor-styles-wrapper ul.wp-block-query-loop {
|
.editor-styles-wrapper ul.wp-block-post-template {
|
||||||
padding-right: 0;
|
padding-right: 0;
|
||||||
margin-right: 0;
|
margin-right: 0;
|
||||||
list-style: none;
|
list-style: none;
|
|
@ -0,0 +1 @@
|
||||||
|
.editor-styles-wrapper ul.wp-block-post-template{padding-right:0;margin-right:0;list-style:none}
|
|
@ -68,7 +68,7 @@
|
||||||
/**
|
/**
|
||||||
* Reset the WP Admin page styles for Gutenberg-like pages.
|
* Reset the WP Admin page styles for Gutenberg-like pages.
|
||||||
*/
|
*/
|
||||||
.editor-styles-wrapper ul.wp-block-query-loop {
|
.editor-styles-wrapper ul.wp-block-post-template {
|
||||||
padding-left: 0;
|
padding-left: 0;
|
||||||
margin-left: 0;
|
margin-left: 0;
|
||||||
list-style: none;
|
list-style: none;
|
|
@ -0,0 +1 @@
|
||||||
|
.editor-styles-wrapper ul.wp-block-post-template{padding-left:0;margin-left:0;list-style:none}
|
|
@ -68,55 +68,70 @@
|
||||||
/**
|
/**
|
||||||
* Reset the WP Admin page styles for Gutenberg-like pages.
|
* Reset the WP Admin page styles for Gutenberg-like pages.
|
||||||
*/
|
*/
|
||||||
|
.wp-block-post-template,
|
||||||
.wp-block-query-loop {
|
.wp-block-query-loop {
|
||||||
max-width: 100%;
|
max-width: 100%;
|
||||||
list-style: none;
|
list-style: none;
|
||||||
padding: 0;
|
padding: 0;
|
||||||
}
|
}
|
||||||
|
.wp-block-post-template li,
|
||||||
.wp-block-query-loop li {
|
.wp-block-query-loop li {
|
||||||
clear: both;
|
clear: both;
|
||||||
}
|
}
|
||||||
|
.wp-block-post-template.is-flex-container,
|
||||||
.wp-block-query-loop.is-flex-container {
|
.wp-block-query-loop.is-flex-container {
|
||||||
flex-direction: row;
|
flex-direction: row;
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-wrap: wrap;
|
flex-wrap: wrap;
|
||||||
}
|
}
|
||||||
|
.wp-block-post-template.is-flex-container li,
|
||||||
.wp-block-query-loop.is-flex-container li {
|
.wp-block-query-loop.is-flex-container li {
|
||||||
margin: 0 0 1.25em 0;
|
margin: 0 0 1.25em 0;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
}
|
}
|
||||||
@media (min-width: 600px) {
|
@media (min-width: 600px) {
|
||||||
.wp-block-query-loop.is-flex-container li {
|
.wp-block-post-template.is-flex-container li,
|
||||||
|
.wp-block-query-loop.is-flex-container li {
|
||||||
margin-left: 1.25em;
|
margin-left: 1.25em;
|
||||||
}
|
}
|
||||||
.wp-block-query-loop.is-flex-container.is-flex-container.columns-2 > li {
|
.wp-block-post-template.is-flex-container.is-flex-container.columns-2 > li,
|
||||||
|
.wp-block-query-loop.is-flex-container.is-flex-container.columns-2 > li {
|
||||||
width: calc((100% / 2) - 1.25em + (1.25em / 2));
|
width: calc((100% / 2) - 1.25em + (1.25em / 2));
|
||||||
}
|
}
|
||||||
.wp-block-query-loop.is-flex-container.is-flex-container.columns-2 > li:nth-child(2n) {
|
.wp-block-post-template.is-flex-container.is-flex-container.columns-2 > li:nth-child(2n),
|
||||||
|
.wp-block-query-loop.is-flex-container.is-flex-container.columns-2 > li:nth-child(2n) {
|
||||||
margin-left: 0;
|
margin-left: 0;
|
||||||
}
|
}
|
||||||
.wp-block-query-loop.is-flex-container.is-flex-container.columns-3 > li {
|
.wp-block-post-template.is-flex-container.is-flex-container.columns-3 > li,
|
||||||
|
.wp-block-query-loop.is-flex-container.is-flex-container.columns-3 > li {
|
||||||
width: calc((100% / 3) - 1.25em + (1.25em / 3));
|
width: calc((100% / 3) - 1.25em + (1.25em / 3));
|
||||||
}
|
}
|
||||||
.wp-block-query-loop.is-flex-container.is-flex-container.columns-3 > li:nth-child(3n) {
|
.wp-block-post-template.is-flex-container.is-flex-container.columns-3 > li:nth-child(3n),
|
||||||
|
.wp-block-query-loop.is-flex-container.is-flex-container.columns-3 > li:nth-child(3n) {
|
||||||
margin-left: 0;
|
margin-left: 0;
|
||||||
}
|
}
|
||||||
.wp-block-query-loop.is-flex-container.is-flex-container.columns-4 > li {
|
.wp-block-post-template.is-flex-container.is-flex-container.columns-4 > li,
|
||||||
|
.wp-block-query-loop.is-flex-container.is-flex-container.columns-4 > li {
|
||||||
width: calc((100% / 4) - 1.25em + (1.25em / 4));
|
width: calc((100% / 4) - 1.25em + (1.25em / 4));
|
||||||
}
|
}
|
||||||
.wp-block-query-loop.is-flex-container.is-flex-container.columns-4 > li:nth-child(4n) {
|
.wp-block-post-template.is-flex-container.is-flex-container.columns-4 > li:nth-child(4n),
|
||||||
|
.wp-block-query-loop.is-flex-container.is-flex-container.columns-4 > li:nth-child(4n) {
|
||||||
margin-left: 0;
|
margin-left: 0;
|
||||||
}
|
}
|
||||||
.wp-block-query-loop.is-flex-container.is-flex-container.columns-5 > li {
|
.wp-block-post-template.is-flex-container.is-flex-container.columns-5 > li,
|
||||||
|
.wp-block-query-loop.is-flex-container.is-flex-container.columns-5 > li {
|
||||||
width: calc((100% / 5) - 1.25em + (1.25em / 5));
|
width: calc((100% / 5) - 1.25em + (1.25em / 5));
|
||||||
}
|
}
|
||||||
.wp-block-query-loop.is-flex-container.is-flex-container.columns-5 > li:nth-child(5n) {
|
.wp-block-post-template.is-flex-container.is-flex-container.columns-5 > li:nth-child(5n),
|
||||||
|
.wp-block-query-loop.is-flex-container.is-flex-container.columns-5 > li:nth-child(5n) {
|
||||||
margin-left: 0;
|
margin-left: 0;
|
||||||
}
|
}
|
||||||
.wp-block-query-loop.is-flex-container.is-flex-container.columns-6 > li {
|
.wp-block-post-template.is-flex-container.is-flex-container.columns-6 > li,
|
||||||
|
.wp-block-query-loop.is-flex-container.is-flex-container.columns-6 > li {
|
||||||
width: calc((100% / 6) - 1.25em + (1.25em / 6));
|
width: calc((100% / 6) - 1.25em + (1.25em / 6));
|
||||||
}
|
}
|
||||||
.wp-block-query-loop.is-flex-container.is-flex-container.columns-6 > li:nth-child(6n) {
|
.wp-block-post-template.is-flex-container.is-flex-container.columns-6 > li:nth-child(6n),
|
||||||
|
.wp-block-query-loop.is-flex-container.is-flex-container.columns-6 > li:nth-child(6n) {
|
||||||
margin-left: 0;
|
margin-left: 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -0,0 +1 @@
|
||||||
|
.wp-block-post-template,.wp-block-query-loop{max-width:100%;list-style:none;padding:0}.wp-block-post-template li,.wp-block-query-loop li{clear:both}.wp-block-post-template.is-flex-container,.wp-block-query-loop.is-flex-container{flex-direction:row;display:flex;flex-wrap:wrap}.wp-block-post-template.is-flex-container li,.wp-block-query-loop.is-flex-container li{margin:0 0 1.25em;width:100%}@media (min-width:600px){.wp-block-post-template.is-flex-container li,.wp-block-query-loop.is-flex-container li{margin-left:1.25em}.wp-block-post-template.is-flex-container.is-flex-container.columns-2>li,.wp-block-query-loop.is-flex-container.is-flex-container.columns-2>li{width:calc(50% - .625em)}.wp-block-post-template.is-flex-container.is-flex-container.columns-2>li:nth-child(2n),.wp-block-query-loop.is-flex-container.is-flex-container.columns-2>li:nth-child(2n){margin-left:0}.wp-block-post-template.is-flex-container.is-flex-container.columns-3>li,.wp-block-query-loop.is-flex-container.is-flex-container.columns-3>li{width:calc(33.33333% - .83333em)}.wp-block-post-template.is-flex-container.is-flex-container.columns-3>li:nth-child(3n),.wp-block-query-loop.is-flex-container.is-flex-container.columns-3>li:nth-child(3n){margin-left:0}.wp-block-post-template.is-flex-container.is-flex-container.columns-4>li,.wp-block-query-loop.is-flex-container.is-flex-container.columns-4>li{width:calc(25% - .9375em)}.wp-block-post-template.is-flex-container.is-flex-container.columns-4>li:nth-child(4n),.wp-block-query-loop.is-flex-container.is-flex-container.columns-4>li:nth-child(4n){margin-left:0}.wp-block-post-template.is-flex-container.is-flex-container.columns-5>li,.wp-block-query-loop.is-flex-container.is-flex-container.columns-5>li{width:calc(20% - 1em)}.wp-block-post-template.is-flex-container.is-flex-container.columns-5>li:nth-child(5n),.wp-block-query-loop.is-flex-container.is-flex-container.columns-5>li:nth-child(5n){margin-left:0}.wp-block-post-template.is-flex-container.is-flex-container.columns-6>li,.wp-block-query-loop.is-flex-container.is-flex-container.columns-6>li{width:calc(16.66667% - 1.04167em)}.wp-block-post-template.is-flex-container.is-flex-container.columns-6>li:nth-child(6n),.wp-block-query-loop.is-flex-container.is-flex-container.columns-6>li:nth-child(6n){margin-left:0}}
|
|
@ -68,55 +68,70 @@
|
||||||
/**
|
/**
|
||||||
* Reset the WP Admin page styles for Gutenberg-like pages.
|
* Reset the WP Admin page styles for Gutenberg-like pages.
|
||||||
*/
|
*/
|
||||||
|
.wp-block-post-template,
|
||||||
.wp-block-query-loop {
|
.wp-block-query-loop {
|
||||||
max-width: 100%;
|
max-width: 100%;
|
||||||
list-style: none;
|
list-style: none;
|
||||||
padding: 0;
|
padding: 0;
|
||||||
}
|
}
|
||||||
|
.wp-block-post-template li,
|
||||||
.wp-block-query-loop li {
|
.wp-block-query-loop li {
|
||||||
clear: both;
|
clear: both;
|
||||||
}
|
}
|
||||||
|
.wp-block-post-template.is-flex-container,
|
||||||
.wp-block-query-loop.is-flex-container {
|
.wp-block-query-loop.is-flex-container {
|
||||||
flex-direction: row;
|
flex-direction: row;
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-wrap: wrap;
|
flex-wrap: wrap;
|
||||||
}
|
}
|
||||||
|
.wp-block-post-template.is-flex-container li,
|
||||||
.wp-block-query-loop.is-flex-container li {
|
.wp-block-query-loop.is-flex-container li {
|
||||||
margin: 0 0 1.25em 0;
|
margin: 0 0 1.25em 0;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
}
|
}
|
||||||
@media (min-width: 600px) {
|
@media (min-width: 600px) {
|
||||||
.wp-block-query-loop.is-flex-container li {
|
.wp-block-post-template.is-flex-container li,
|
||||||
|
.wp-block-query-loop.is-flex-container li {
|
||||||
margin-right: 1.25em;
|
margin-right: 1.25em;
|
||||||
}
|
}
|
||||||
.wp-block-query-loop.is-flex-container.is-flex-container.columns-2 > li {
|
.wp-block-post-template.is-flex-container.is-flex-container.columns-2 > li,
|
||||||
|
.wp-block-query-loop.is-flex-container.is-flex-container.columns-2 > li {
|
||||||
width: calc((100% / 2) - 1.25em + (1.25em / 2));
|
width: calc((100% / 2) - 1.25em + (1.25em / 2));
|
||||||
}
|
}
|
||||||
.wp-block-query-loop.is-flex-container.is-flex-container.columns-2 > li:nth-child(2n) {
|
.wp-block-post-template.is-flex-container.is-flex-container.columns-2 > li:nth-child(2n),
|
||||||
|
.wp-block-query-loop.is-flex-container.is-flex-container.columns-2 > li:nth-child(2n) {
|
||||||
margin-right: 0;
|
margin-right: 0;
|
||||||
}
|
}
|
||||||
.wp-block-query-loop.is-flex-container.is-flex-container.columns-3 > li {
|
.wp-block-post-template.is-flex-container.is-flex-container.columns-3 > li,
|
||||||
|
.wp-block-query-loop.is-flex-container.is-flex-container.columns-3 > li {
|
||||||
width: calc((100% / 3) - 1.25em + (1.25em / 3));
|
width: calc((100% / 3) - 1.25em + (1.25em / 3));
|
||||||
}
|
}
|
||||||
.wp-block-query-loop.is-flex-container.is-flex-container.columns-3 > li:nth-child(3n) {
|
.wp-block-post-template.is-flex-container.is-flex-container.columns-3 > li:nth-child(3n),
|
||||||
|
.wp-block-query-loop.is-flex-container.is-flex-container.columns-3 > li:nth-child(3n) {
|
||||||
margin-right: 0;
|
margin-right: 0;
|
||||||
}
|
}
|
||||||
.wp-block-query-loop.is-flex-container.is-flex-container.columns-4 > li {
|
.wp-block-post-template.is-flex-container.is-flex-container.columns-4 > li,
|
||||||
|
.wp-block-query-loop.is-flex-container.is-flex-container.columns-4 > li {
|
||||||
width: calc((100% / 4) - 1.25em + (1.25em / 4));
|
width: calc((100% / 4) - 1.25em + (1.25em / 4));
|
||||||
}
|
}
|
||||||
.wp-block-query-loop.is-flex-container.is-flex-container.columns-4 > li:nth-child(4n) {
|
.wp-block-post-template.is-flex-container.is-flex-container.columns-4 > li:nth-child(4n),
|
||||||
|
.wp-block-query-loop.is-flex-container.is-flex-container.columns-4 > li:nth-child(4n) {
|
||||||
margin-right: 0;
|
margin-right: 0;
|
||||||
}
|
}
|
||||||
.wp-block-query-loop.is-flex-container.is-flex-container.columns-5 > li {
|
.wp-block-post-template.is-flex-container.is-flex-container.columns-5 > li,
|
||||||
|
.wp-block-query-loop.is-flex-container.is-flex-container.columns-5 > li {
|
||||||
width: calc((100% / 5) - 1.25em + (1.25em / 5));
|
width: calc((100% / 5) - 1.25em + (1.25em / 5));
|
||||||
}
|
}
|
||||||
.wp-block-query-loop.is-flex-container.is-flex-container.columns-5 > li:nth-child(5n) {
|
.wp-block-post-template.is-flex-container.is-flex-container.columns-5 > li:nth-child(5n),
|
||||||
|
.wp-block-query-loop.is-flex-container.is-flex-container.columns-5 > li:nth-child(5n) {
|
||||||
margin-right: 0;
|
margin-right: 0;
|
||||||
}
|
}
|
||||||
.wp-block-query-loop.is-flex-container.is-flex-container.columns-6 > li {
|
.wp-block-post-template.is-flex-container.is-flex-container.columns-6 > li,
|
||||||
|
.wp-block-query-loop.is-flex-container.is-flex-container.columns-6 > li {
|
||||||
width: calc((100% / 6) - 1.25em + (1.25em / 6));
|
width: calc((100% / 6) - 1.25em + (1.25em / 6));
|
||||||
}
|
}
|
||||||
.wp-block-query-loop.is-flex-container.is-flex-container.columns-6 > li:nth-child(6n) {
|
.wp-block-post-template.is-flex-container.is-flex-container.columns-6 > li:nth-child(6n),
|
||||||
|
.wp-block-query-loop.is-flex-container.is-flex-container.columns-6 > li:nth-child(6n) {
|
||||||
margin-right: 0;
|
margin-right: 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -0,0 +1 @@
|
||||||
|
.wp-block-post-template,.wp-block-query-loop{max-width:100%;list-style:none;padding:0}.wp-block-post-template li,.wp-block-query-loop li{clear:both}.wp-block-post-template.is-flex-container,.wp-block-query-loop.is-flex-container{flex-direction:row;display:flex;flex-wrap:wrap}.wp-block-post-template.is-flex-container li,.wp-block-query-loop.is-flex-container li{margin:0 0 1.25em;width:100%}@media (min-width:600px){.wp-block-post-template.is-flex-container li,.wp-block-query-loop.is-flex-container li{margin-right:1.25em}.wp-block-post-template.is-flex-container.is-flex-container.columns-2>li,.wp-block-query-loop.is-flex-container.is-flex-container.columns-2>li{width:calc(50% - .625em)}.wp-block-post-template.is-flex-container.is-flex-container.columns-2>li:nth-child(2n),.wp-block-query-loop.is-flex-container.is-flex-container.columns-2>li:nth-child(2n){margin-right:0}.wp-block-post-template.is-flex-container.is-flex-container.columns-3>li,.wp-block-query-loop.is-flex-container.is-flex-container.columns-3>li{width:calc(33.33333% - .83333em)}.wp-block-post-template.is-flex-container.is-flex-container.columns-3>li:nth-child(3n),.wp-block-query-loop.is-flex-container.is-flex-container.columns-3>li:nth-child(3n){margin-right:0}.wp-block-post-template.is-flex-container.is-flex-container.columns-4>li,.wp-block-query-loop.is-flex-container.is-flex-container.columns-4>li{width:calc(25% - .9375em)}.wp-block-post-template.is-flex-container.is-flex-container.columns-4>li:nth-child(4n),.wp-block-query-loop.is-flex-container.is-flex-container.columns-4>li:nth-child(4n){margin-right:0}.wp-block-post-template.is-flex-container.is-flex-container.columns-5>li,.wp-block-query-loop.is-flex-container.is-flex-container.columns-5>li{width:calc(20% - 1em)}.wp-block-post-template.is-flex-container.is-flex-container.columns-5>li:nth-child(5n),.wp-block-query-loop.is-flex-container.is-flex-container.columns-5>li:nth-child(5n){margin-right:0}.wp-block-post-template.is-flex-container.is-flex-container.columns-6>li,.wp-block-query-loop.is-flex-container.is-flex-container.columns-6>li{width:calc(16.66667% - 1.04167em)}.wp-block-post-template.is-flex-container.is-flex-container.columns-6>li:nth-child(6n),.wp-block-query-loop.is-flex-container.is-flex-container.columns-6>li:nth-child(6n){margin-right:0}}
|
|
@ -1,88 +0,0 @@
|
||||||
<?php
|
|
||||||
/**
|
|
||||||
* Server-side rendering of the `core/query-loop` block.
|
|
||||||
*
|
|
||||||
* @package WordPress
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Renders the `core/query-loop` block on the server.
|
|
||||||
*
|
|
||||||
* @param array $attributes Block attributes.
|
|
||||||
* @param string $content Block default content.
|
|
||||||
* @param WP_Block $block Block instance.
|
|
||||||
*
|
|
||||||
* @return string Returns the output of the query, structured using the layout defined by the block's inner blocks.
|
|
||||||
*/
|
|
||||||
function render_block_core_query_loop( $attributes, $content, $block ) {
|
|
||||||
$page_key = isset( $block->context['queryId'] ) ? 'query-' . $block->context['queryId'] . '-page' : 'query-page';
|
|
||||||
$page = empty( $_GET[ $page_key ] ) ? 1 : (int) $_GET[ $page_key ];
|
|
||||||
|
|
||||||
$query_args = build_query_vars_from_query_block( $block, $page );
|
|
||||||
// Override the custom query with the global query if needed.
|
|
||||||
$use_global_query = ( isset( $block->context['query']['inherit'] ) && $block->context['query']['inherit'] );
|
|
||||||
if ( $use_global_query ) {
|
|
||||||
global $wp_query;
|
|
||||||
if ( $wp_query && isset( $wp_query->query_vars ) && is_array( $wp_query->query_vars ) ) {
|
|
||||||
// Unset `offset` because if is set, $wp_query overrides/ignores the paged parameter and breaks pagination.
|
|
||||||
unset( $query_args['offset'] );
|
|
||||||
$query_args = wp_parse_args( $wp_query->query_vars, $query_args );
|
|
||||||
|
|
||||||
if ( empty( $query_args['post_type'] ) && is_singular() ) {
|
|
||||||
$query_args['post_type'] = get_post_type( get_the_ID() );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$query = new WP_Query( $query_args );
|
|
||||||
|
|
||||||
if ( ! $query->have_posts() ) {
|
|
||||||
return '';
|
|
||||||
}
|
|
||||||
|
|
||||||
$classnames = '';
|
|
||||||
if ( isset( $block->context['displayLayout'] ) && isset( $block->context['query'] ) ) {
|
|
||||||
if ( isset( $block->context['displayLayout']['type'] ) && 'flex' === $block->context['displayLayout']['type'] ) {
|
|
||||||
$classnames = "is-flex-container columns-{$block->context['displayLayout']['columns']}";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$wrapper_attributes = get_block_wrapper_attributes( array( 'class' => $classnames ) );
|
|
||||||
|
|
||||||
$content = '';
|
|
||||||
while ( $query->have_posts() ) {
|
|
||||||
$query->the_post();
|
|
||||||
$block_content = (
|
|
||||||
new WP_Block(
|
|
||||||
$block->parsed_block,
|
|
||||||
array(
|
|
||||||
'postType' => get_post_type(),
|
|
||||||
'postId' => get_the_ID(),
|
|
||||||
)
|
|
||||||
)
|
|
||||||
)->render( array( 'dynamic' => false ) );
|
|
||||||
$content .= "<li>{$block_content}</li>";
|
|
||||||
}
|
|
||||||
|
|
||||||
wp_reset_postdata();
|
|
||||||
|
|
||||||
return sprintf(
|
|
||||||
'<ul %1$s>%2$s</ul>',
|
|
||||||
$wrapper_attributes,
|
|
||||||
$content
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Registers the `core/query-loop` block on the server.
|
|
||||||
*/
|
|
||||||
function register_block_core_query_loop() {
|
|
||||||
register_block_type_from_metadata(
|
|
||||||
__DIR__ . '/query-loop',
|
|
||||||
array(
|
|
||||||
'render_callback' => 'render_block_core_query_loop',
|
|
||||||
'skip_inner_blocks' => true,
|
|
||||||
)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
add_action( 'init', 'register_block_core_query_loop' );
|
|
|
@ -1 +0,0 @@
|
||||||
.editor-styles-wrapper ul.wp-block-query-loop{padding-right:0;margin-right:0;list-style:none}
|
|
|
@ -1 +0,0 @@
|
||||||
.editor-styles-wrapper ul.wp-block-query-loop{padding-left:0;margin-left:0;list-style:none}
|
|
|
@ -1 +0,0 @@
|
||||||
.wp-block-query-loop{max-width:100%;list-style:none;padding:0}.wp-block-query-loop li{clear:both}.wp-block-query-loop.is-flex-container{flex-direction:row;display:flex;flex-wrap:wrap}.wp-block-query-loop.is-flex-container li{margin:0 0 1.25em;width:100%}@media (min-width:600px){.wp-block-query-loop.is-flex-container li{margin-left:1.25em}.wp-block-query-loop.is-flex-container.is-flex-container.columns-2>li{width:calc(50% - .625em)}.wp-block-query-loop.is-flex-container.is-flex-container.columns-2>li:nth-child(2n){margin-left:0}.wp-block-query-loop.is-flex-container.is-flex-container.columns-3>li{width:calc(33.33333% - .83333em)}.wp-block-query-loop.is-flex-container.is-flex-container.columns-3>li:nth-child(3n){margin-left:0}.wp-block-query-loop.is-flex-container.is-flex-container.columns-4>li{width:calc(25% - .9375em)}.wp-block-query-loop.is-flex-container.is-flex-container.columns-4>li:nth-child(4n){margin-left:0}.wp-block-query-loop.is-flex-container.is-flex-container.columns-5>li{width:calc(20% - 1em)}.wp-block-query-loop.is-flex-container.is-flex-container.columns-5>li:nth-child(5n){margin-left:0}.wp-block-query-loop.is-flex-container.is-flex-container.columns-6>li{width:calc(16.66667% - 1.04167em)}.wp-block-query-loop.is-flex-container.is-flex-container.columns-6>li:nth-child(6n){margin-left:0}}
|
|
|
@ -1 +0,0 @@
|
||||||
.wp-block-query-loop{max-width:100%;list-style:none;padding:0}.wp-block-query-loop li{clear:both}.wp-block-query-loop.is-flex-container{flex-direction:row;display:flex;flex-wrap:wrap}.wp-block-query-loop.is-flex-container li{margin:0 0 1.25em;width:100%}@media (min-width:600px){.wp-block-query-loop.is-flex-container li{margin-right:1.25em}.wp-block-query-loop.is-flex-container.is-flex-container.columns-2>li{width:calc(50% - .625em)}.wp-block-query-loop.is-flex-container.is-flex-container.columns-2>li:nth-child(2n){margin-right:0}.wp-block-query-loop.is-flex-container.is-flex-container.columns-3>li{width:calc(33.33333% - .83333em)}.wp-block-query-loop.is-flex-container.is-flex-container.columns-3>li:nth-child(3n){margin-right:0}.wp-block-query-loop.is-flex-container.is-flex-container.columns-4>li{width:calc(25% - .9375em)}.wp-block-query-loop.is-flex-container.is-flex-container.columns-4>li:nth-child(4n){margin-right:0}.wp-block-query-loop.is-flex-container.is-flex-container.columns-5>li{width:calc(20% - 1em)}.wp-block-query-loop.is-flex-container.is-flex-container.columns-5>li:nth-child(5n){margin-right:0}.wp-block-query-loop.is-flex-container.is-flex-container.columns-6>li{width:calc(16.66667% - 1.04167em)}.wp-block-query-loop.is-flex-container.is-flex-container.columns-6>li:nth-child(6n){margin-right:0}}
|
|
|
@ -1,7 +1,7 @@
|
||||||
{
|
{
|
||||||
"apiVersion": 2,
|
"apiVersion": 2,
|
||||||
"name": "core/query",
|
"name": "core/query",
|
||||||
"title": "Query",
|
"title": "Query Loop",
|
||||||
"category": "design",
|
"category": "design",
|
||||||
"description": "Displays a list of posts as a result of a query.",
|
"description": "Displays a list of posts as a result of a query.",
|
||||||
"textdomain": "default",
|
"textdomain": "default",
|
||||||
|
|
|
@ -2311,7 +2311,7 @@ body.admin-bar .wp-block-navigation__responsive-container.is-menu-open {
|
||||||
border: 1px dashed;
|
border: 1px dashed;
|
||||||
}
|
}
|
||||||
|
|
||||||
.editor-styles-wrapper ul.wp-block-query-loop {
|
.editor-styles-wrapper ul.wp-block-post-template {
|
||||||
padding-right: 0;
|
padding-right: 0;
|
||||||
margin-right: 0;
|
margin-right: 0;
|
||||||
list-style: none;
|
list-style: none;
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -2316,7 +2316,7 @@ body.admin-bar .wp-block-navigation__responsive-container.is-menu-open {
|
||||||
border: 1px dashed;
|
border: 1px dashed;
|
||||||
}
|
}
|
||||||
|
|
||||||
.editor-styles-wrapper ul.wp-block-query-loop {
|
.editor-styles-wrapper ul.wp-block-post-template {
|
||||||
padding-left: 0;
|
padding-left: 0;
|
||||||
margin-left: 0;
|
margin-left: 0;
|
||||||
list-style: none;
|
list-style: none;
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -2028,55 +2028,70 @@ p.has-text-color a {
|
||||||
color: inherit;
|
color: inherit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.wp-block-post-template,
|
||||||
.wp-block-query-loop {
|
.wp-block-query-loop {
|
||||||
max-width: 100%;
|
max-width: 100%;
|
||||||
list-style: none;
|
list-style: none;
|
||||||
padding: 0;
|
padding: 0;
|
||||||
}
|
}
|
||||||
|
.wp-block-post-template li,
|
||||||
.wp-block-query-loop li {
|
.wp-block-query-loop li {
|
||||||
clear: both;
|
clear: both;
|
||||||
}
|
}
|
||||||
|
.wp-block-post-template.is-flex-container,
|
||||||
.wp-block-query-loop.is-flex-container {
|
.wp-block-query-loop.is-flex-container {
|
||||||
flex-direction: row;
|
flex-direction: row;
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-wrap: wrap;
|
flex-wrap: wrap;
|
||||||
}
|
}
|
||||||
|
.wp-block-post-template.is-flex-container li,
|
||||||
.wp-block-query-loop.is-flex-container li {
|
.wp-block-query-loop.is-flex-container li {
|
||||||
margin: 0 0 1.25em 0;
|
margin: 0 0 1.25em 0;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
}
|
}
|
||||||
@media (min-width: 600px) {
|
@media (min-width: 600px) {
|
||||||
.wp-block-query-loop.is-flex-container li {
|
.wp-block-post-template.is-flex-container li,
|
||||||
|
.wp-block-query-loop.is-flex-container li {
|
||||||
margin-left: 1.25em;
|
margin-left: 1.25em;
|
||||||
}
|
}
|
||||||
.wp-block-query-loop.is-flex-container.is-flex-container.columns-2 > li {
|
.wp-block-post-template.is-flex-container.is-flex-container.columns-2 > li,
|
||||||
|
.wp-block-query-loop.is-flex-container.is-flex-container.columns-2 > li {
|
||||||
width: calc((100% / 2) - 1.25em + (1.25em / 2));
|
width: calc((100% / 2) - 1.25em + (1.25em / 2));
|
||||||
}
|
}
|
||||||
.wp-block-query-loop.is-flex-container.is-flex-container.columns-2 > li:nth-child(2n) {
|
.wp-block-post-template.is-flex-container.is-flex-container.columns-2 > li:nth-child(2n),
|
||||||
|
.wp-block-query-loop.is-flex-container.is-flex-container.columns-2 > li:nth-child(2n) {
|
||||||
margin-left: 0;
|
margin-left: 0;
|
||||||
}
|
}
|
||||||
.wp-block-query-loop.is-flex-container.is-flex-container.columns-3 > li {
|
.wp-block-post-template.is-flex-container.is-flex-container.columns-3 > li,
|
||||||
|
.wp-block-query-loop.is-flex-container.is-flex-container.columns-3 > li {
|
||||||
width: calc((100% / 3) - 1.25em + (1.25em / 3));
|
width: calc((100% / 3) - 1.25em + (1.25em / 3));
|
||||||
}
|
}
|
||||||
.wp-block-query-loop.is-flex-container.is-flex-container.columns-3 > li:nth-child(3n) {
|
.wp-block-post-template.is-flex-container.is-flex-container.columns-3 > li:nth-child(3n),
|
||||||
|
.wp-block-query-loop.is-flex-container.is-flex-container.columns-3 > li:nth-child(3n) {
|
||||||
margin-left: 0;
|
margin-left: 0;
|
||||||
}
|
}
|
||||||
.wp-block-query-loop.is-flex-container.is-flex-container.columns-4 > li {
|
.wp-block-post-template.is-flex-container.is-flex-container.columns-4 > li,
|
||||||
|
.wp-block-query-loop.is-flex-container.is-flex-container.columns-4 > li {
|
||||||
width: calc((100% / 4) - 1.25em + (1.25em / 4));
|
width: calc((100% / 4) - 1.25em + (1.25em / 4));
|
||||||
}
|
}
|
||||||
.wp-block-query-loop.is-flex-container.is-flex-container.columns-4 > li:nth-child(4n) {
|
.wp-block-post-template.is-flex-container.is-flex-container.columns-4 > li:nth-child(4n),
|
||||||
|
.wp-block-query-loop.is-flex-container.is-flex-container.columns-4 > li:nth-child(4n) {
|
||||||
margin-left: 0;
|
margin-left: 0;
|
||||||
}
|
}
|
||||||
.wp-block-query-loop.is-flex-container.is-flex-container.columns-5 > li {
|
.wp-block-post-template.is-flex-container.is-flex-container.columns-5 > li,
|
||||||
|
.wp-block-query-loop.is-flex-container.is-flex-container.columns-5 > li {
|
||||||
width: calc((100% / 5) - 1.25em + (1.25em / 5));
|
width: calc((100% / 5) - 1.25em + (1.25em / 5));
|
||||||
}
|
}
|
||||||
.wp-block-query-loop.is-flex-container.is-flex-container.columns-5 > li:nth-child(5n) {
|
.wp-block-post-template.is-flex-container.is-flex-container.columns-5 > li:nth-child(5n),
|
||||||
|
.wp-block-query-loop.is-flex-container.is-flex-container.columns-5 > li:nth-child(5n) {
|
||||||
margin-left: 0;
|
margin-left: 0;
|
||||||
}
|
}
|
||||||
.wp-block-query-loop.is-flex-container.is-flex-container.columns-6 > li {
|
.wp-block-post-template.is-flex-container.is-flex-container.columns-6 > li,
|
||||||
|
.wp-block-query-loop.is-flex-container.is-flex-container.columns-6 > li {
|
||||||
width: calc((100% / 6) - 1.25em + (1.25em / 6));
|
width: calc((100% / 6) - 1.25em + (1.25em / 6));
|
||||||
}
|
}
|
||||||
.wp-block-query-loop.is-flex-container.is-flex-container.columns-6 > li:nth-child(6n) {
|
.wp-block-post-template.is-flex-container.is-flex-container.columns-6 > li:nth-child(6n),
|
||||||
|
.wp-block-query-loop.is-flex-container.is-flex-container.columns-6 > li:nth-child(6n) {
|
||||||
margin-left: 0;
|
margin-left: 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -2063,55 +2063,70 @@ p.has-text-color a {
|
||||||
color: inherit;
|
color: inherit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.wp-block-post-template,
|
||||||
.wp-block-query-loop {
|
.wp-block-query-loop {
|
||||||
max-width: 100%;
|
max-width: 100%;
|
||||||
list-style: none;
|
list-style: none;
|
||||||
padding: 0;
|
padding: 0;
|
||||||
}
|
}
|
||||||
|
.wp-block-post-template li,
|
||||||
.wp-block-query-loop li {
|
.wp-block-query-loop li {
|
||||||
clear: both;
|
clear: both;
|
||||||
}
|
}
|
||||||
|
.wp-block-post-template.is-flex-container,
|
||||||
.wp-block-query-loop.is-flex-container {
|
.wp-block-query-loop.is-flex-container {
|
||||||
flex-direction: row;
|
flex-direction: row;
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-wrap: wrap;
|
flex-wrap: wrap;
|
||||||
}
|
}
|
||||||
|
.wp-block-post-template.is-flex-container li,
|
||||||
.wp-block-query-loop.is-flex-container li {
|
.wp-block-query-loop.is-flex-container li {
|
||||||
margin: 0 0 1.25em 0;
|
margin: 0 0 1.25em 0;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
}
|
}
|
||||||
@media (min-width: 600px) {
|
@media (min-width: 600px) {
|
||||||
.wp-block-query-loop.is-flex-container li {
|
.wp-block-post-template.is-flex-container li,
|
||||||
|
.wp-block-query-loop.is-flex-container li {
|
||||||
margin-right: 1.25em;
|
margin-right: 1.25em;
|
||||||
}
|
}
|
||||||
.wp-block-query-loop.is-flex-container.is-flex-container.columns-2 > li {
|
.wp-block-post-template.is-flex-container.is-flex-container.columns-2 > li,
|
||||||
|
.wp-block-query-loop.is-flex-container.is-flex-container.columns-2 > li {
|
||||||
width: calc((100% / 2) - 1.25em + (1.25em / 2));
|
width: calc((100% / 2) - 1.25em + (1.25em / 2));
|
||||||
}
|
}
|
||||||
.wp-block-query-loop.is-flex-container.is-flex-container.columns-2 > li:nth-child(2n) {
|
.wp-block-post-template.is-flex-container.is-flex-container.columns-2 > li:nth-child(2n),
|
||||||
|
.wp-block-query-loop.is-flex-container.is-flex-container.columns-2 > li:nth-child(2n) {
|
||||||
margin-right: 0;
|
margin-right: 0;
|
||||||
}
|
}
|
||||||
.wp-block-query-loop.is-flex-container.is-flex-container.columns-3 > li {
|
.wp-block-post-template.is-flex-container.is-flex-container.columns-3 > li,
|
||||||
|
.wp-block-query-loop.is-flex-container.is-flex-container.columns-3 > li {
|
||||||
width: calc((100% / 3) - 1.25em + (1.25em / 3));
|
width: calc((100% / 3) - 1.25em + (1.25em / 3));
|
||||||
}
|
}
|
||||||
.wp-block-query-loop.is-flex-container.is-flex-container.columns-3 > li:nth-child(3n) {
|
.wp-block-post-template.is-flex-container.is-flex-container.columns-3 > li:nth-child(3n),
|
||||||
|
.wp-block-query-loop.is-flex-container.is-flex-container.columns-3 > li:nth-child(3n) {
|
||||||
margin-right: 0;
|
margin-right: 0;
|
||||||
}
|
}
|
||||||
.wp-block-query-loop.is-flex-container.is-flex-container.columns-4 > li {
|
.wp-block-post-template.is-flex-container.is-flex-container.columns-4 > li,
|
||||||
|
.wp-block-query-loop.is-flex-container.is-flex-container.columns-4 > li {
|
||||||
width: calc((100% / 4) - 1.25em + (1.25em / 4));
|
width: calc((100% / 4) - 1.25em + (1.25em / 4));
|
||||||
}
|
}
|
||||||
.wp-block-query-loop.is-flex-container.is-flex-container.columns-4 > li:nth-child(4n) {
|
.wp-block-post-template.is-flex-container.is-flex-container.columns-4 > li:nth-child(4n),
|
||||||
|
.wp-block-query-loop.is-flex-container.is-flex-container.columns-4 > li:nth-child(4n) {
|
||||||
margin-right: 0;
|
margin-right: 0;
|
||||||
}
|
}
|
||||||
.wp-block-query-loop.is-flex-container.is-flex-container.columns-5 > li {
|
.wp-block-post-template.is-flex-container.is-flex-container.columns-5 > li,
|
||||||
|
.wp-block-query-loop.is-flex-container.is-flex-container.columns-5 > li {
|
||||||
width: calc((100% / 5) - 1.25em + (1.25em / 5));
|
width: calc((100% / 5) - 1.25em + (1.25em / 5));
|
||||||
}
|
}
|
||||||
.wp-block-query-loop.is-flex-container.is-flex-container.columns-5 > li:nth-child(5n) {
|
.wp-block-post-template.is-flex-container.is-flex-container.columns-5 > li:nth-child(5n),
|
||||||
|
.wp-block-query-loop.is-flex-container.is-flex-container.columns-5 > li:nth-child(5n) {
|
||||||
margin-right: 0;
|
margin-right: 0;
|
||||||
}
|
}
|
||||||
.wp-block-query-loop.is-flex-container.is-flex-container.columns-6 > li {
|
.wp-block-post-template.is-flex-container.is-flex-container.columns-6 > li,
|
||||||
|
.wp-block-query-loop.is-flex-container.is-flex-container.columns-6 > li {
|
||||||
width: calc((100% / 6) - 1.25em + (1.25em / 6));
|
width: calc((100% / 6) - 1.25em + (1.25em / 6));
|
||||||
}
|
}
|
||||||
.wp-block-query-loop.is-flex-container.is-flex-container.columns-6 > li:nth-child(6n) {
|
.wp-block-post-template.is-flex-container.is-flex-container.columns-6 > li:nth-child(6n),
|
||||||
|
.wp-block-query-loop.is-flex-container.is-flex-container.columns-6 > li:nth-child(6n) {
|
||||||
margin-right: 0;
|
margin-right: 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -37670,9 +37670,9 @@ function useDarkThemeBodyClassName(styles) {
|
||||||
body
|
body
|
||||||
} = ownerDocument;
|
} = ownerDocument;
|
||||||
const canvas = ownerDocument.querySelector(EDITOR_STYLES_SELECTOR);
|
const canvas = ownerDocument.querySelector(EDITOR_STYLES_SELECTOR);
|
||||||
const backgroundColor = defaultView.getComputedStyle(canvas, null).getPropertyValue('background-color');
|
const backgroundColor = defaultView.getComputedStyle(canvas, null).getPropertyValue('background-color'); // If background is transparent, it should be treated as light color.
|
||||||
|
|
||||||
if (tinycolor_default()(backgroundColor).getLuminance() > 0.5) {
|
if (tinycolor_default()(backgroundColor).getLuminance() > 0.5 || tinycolor_default()(backgroundColor).getAlpha() === 0) {
|
||||||
body.classList.remove('is-dark-theme');
|
body.classList.remove('is-dark-theme');
|
||||||
} else {
|
} else {
|
||||||
body.classList.add('is-dark-theme');
|
body.classList.add('is-dark-theme');
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -1545,12 +1545,12 @@ __webpack_require__.d(query_namespaceObject, "metadata", function() { return que
|
||||||
__webpack_require__.d(query_namespaceObject, "name", function() { return query_name; });
|
__webpack_require__.d(query_namespaceObject, "name", function() { return query_name; });
|
||||||
__webpack_require__.d(query_namespaceObject, "settings", function() { return query_settings; });
|
__webpack_require__.d(query_namespaceObject, "settings", function() { return query_settings; });
|
||||||
|
|
||||||
// NAMESPACE OBJECT: ./node_modules/@wordpress/block-library/build-module/query-loop/index.js
|
// NAMESPACE OBJECT: ./node_modules/@wordpress/block-library/build-module/post-template/index.js
|
||||||
var query_loop_namespaceObject = {};
|
var post_template_namespaceObject = {};
|
||||||
__webpack_require__.r(query_loop_namespaceObject);
|
__webpack_require__.r(post_template_namespaceObject);
|
||||||
__webpack_require__.d(query_loop_namespaceObject, "metadata", function() { return query_loop_metadata; });
|
__webpack_require__.d(post_template_namespaceObject, "metadata", function() { return post_template_metadata; });
|
||||||
__webpack_require__.d(query_loop_namespaceObject, "name", function() { return query_loop_name; });
|
__webpack_require__.d(post_template_namespaceObject, "name", function() { return post_template_name; });
|
||||||
__webpack_require__.d(query_loop_namespaceObject, "settings", function() { return query_loop_settings; });
|
__webpack_require__.d(post_template_namespaceObject, "settings", function() { return post_template_settings; });
|
||||||
|
|
||||||
// NAMESPACE OBJECT: ./node_modules/@wordpress/block-library/build-module/query-title/index.js
|
// NAMESPACE OBJECT: ./node_modules/@wordpress/block-library/build-module/query-title/index.js
|
||||||
var query_title_namespaceObject = {};
|
var query_title_namespaceObject = {};
|
||||||
|
@ -30358,7 +30358,7 @@ const QueryPlaceholder = ({
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
const edit_TEMPLATE = [['core/query-loop']];
|
const edit_TEMPLATE = [['core/post-template']];
|
||||||
function QueryContent({
|
function QueryContent({
|
||||||
attributes,
|
attributes,
|
||||||
setAttributes
|
setAttributes
|
||||||
|
@ -30597,7 +30597,8 @@ const query_variations_variations = [{
|
||||||
orderBy: 'date',
|
orderBy: 'date',
|
||||||
author: '',
|
author: '',
|
||||||
search: '',
|
search: '',
|
||||||
sticky: 'exclude'
|
sticky: 'exclude',
|
||||||
|
inherit: false
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
scope: ['inserter']
|
scope: ['inserter']
|
||||||
|
@ -30605,25 +30606,25 @@ const query_variations_variations = [{
|
||||||
name: 'title-date',
|
name: 'title-date',
|
||||||
title: Object(external_wp_i18n_["__"])('Title & Date'),
|
title: Object(external_wp_i18n_["__"])('Title & Date'),
|
||||||
icon: titleDate,
|
icon: titleDate,
|
||||||
innerBlocks: [['core/query-loop', {}, [['core/post-title'], ['core/post-date']]]],
|
innerBlocks: [['core/post-template', {}, [['core/post-title'], ['core/post-date']]]],
|
||||||
scope: ['block']
|
scope: ['block']
|
||||||
}, {
|
}, {
|
||||||
name: 'title-excerpt',
|
name: 'title-excerpt',
|
||||||
title: Object(external_wp_i18n_["__"])('Title & Excerpt'),
|
title: Object(external_wp_i18n_["__"])('Title & Excerpt'),
|
||||||
icon: titleExcerpt,
|
icon: titleExcerpt,
|
||||||
innerBlocks: [['core/query-loop', {}, [['core/post-title'], ['core/post-excerpt']]]],
|
innerBlocks: [['core/post-template', {}, [['core/post-title'], ['core/post-excerpt']]]],
|
||||||
scope: ['block']
|
scope: ['block']
|
||||||
}, {
|
}, {
|
||||||
name: 'title-date-excerpt',
|
name: 'title-date-excerpt',
|
||||||
title: Object(external_wp_i18n_["__"])('Title, Date, & Excerpt'),
|
title: Object(external_wp_i18n_["__"])('Title, Date, & Excerpt'),
|
||||||
icon: titleDateExcerpt,
|
icon: titleDateExcerpt,
|
||||||
innerBlocks: [['core/query-loop', {}, [['core/post-title'], ['core/post-date'], ['core/post-excerpt']]]],
|
innerBlocks: [['core/post-template', {}, [['core/post-title'], ['core/post-date'], ['core/post-excerpt']]]],
|
||||||
scope: ['block']
|
scope: ['block']
|
||||||
}, {
|
}, {
|
||||||
name: 'image-date-title',
|
name: 'image-date-title',
|
||||||
title: Object(external_wp_i18n_["__"])('Image, Date, & Title'),
|
title: Object(external_wp_i18n_["__"])('Image, Date, & Title'),
|
||||||
icon: imageDateTitle,
|
icon: imageDateTitle,
|
||||||
innerBlocks: [['core/query-loop', {}, [['core/post-featured-image'], ['core/post-date'], ['core/post-title']]]],
|
innerBlocks: [['core/post-template', {}, [['core/post-featured-image'], ['core/post-date'], ['core/post-title']]]],
|
||||||
scope: ['block']
|
scope: ['block']
|
||||||
}];
|
}];
|
||||||
/* harmony default export */ var query_variations = (query_variations_variations);
|
/* harmony default export */ var query_variations = (query_variations_variations);
|
||||||
|
@ -30749,7 +30750,7 @@ const queryTopInspectorControls = Object(external_wp_compose_["createHigherOrder
|
||||||
const query_metadata = {
|
const query_metadata = {
|
||||||
apiVersion: 2,
|
apiVersion: 2,
|
||||||
name: "core/query",
|
name: "core/query",
|
||||||
title: "Query",
|
title: "Query Loop",
|
||||||
category: "design",
|
category: "design",
|
||||||
description: "Displays a list of posts as a result of a query.",
|
description: "Displays a list of posts as a result of a query.",
|
||||||
textdomain: "default",
|
textdomain: "default",
|
||||||
|
@ -30822,7 +30823,7 @@ const query_settings = {
|
||||||
|
|
||||||
Object(external_wp_hooks_["addFilter"])('editor.BlockEdit', 'core/query', hooks);
|
Object(external_wp_hooks_["addFilter"])('editor.BlockEdit', 'core/query', hooks);
|
||||||
|
|
||||||
// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/query-loop/edit.js
|
// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/post-template/edit.js
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -30839,8 +30840,8 @@ Object(external_wp_hooks_["addFilter"])('editor.BlockEdit', 'core/query', hooks)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
const query_loop_edit_TEMPLATE = [['core/post-title'], ['core/post-date'], ['core/post-excerpt']];
|
const post_template_edit_TEMPLATE = [['core/post-title'], ['core/post-date'], ['core/post-excerpt']];
|
||||||
function QueryLoopEdit({
|
function PostTemplateEdit({
|
||||||
clientId,
|
clientId,
|
||||||
context: {
|
context: {
|
||||||
query: {
|
query: {
|
||||||
|
@ -30938,7 +30939,7 @@ function QueryLoopEdit({
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
const innerBlocksProps = Object(external_wp_blockEditor_["__experimentalUseInnerBlocksProps"])({}, {
|
const innerBlocksProps = Object(external_wp_blockEditor_["__experimentalUseInnerBlocksProps"])({}, {
|
||||||
template: query_loop_edit_TEMPLATE
|
template: post_template_edit_TEMPLATE
|
||||||
});
|
});
|
||||||
|
|
||||||
if (!posts) {
|
if (!posts) {
|
||||||
|
@ -30959,18 +30960,18 @@ function QueryLoopEdit({
|
||||||
})))));
|
})))));
|
||||||
}
|
}
|
||||||
|
|
||||||
// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/query-loop/save.js
|
// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/post-template/save.js
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* WordPress dependencies
|
* WordPress dependencies
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function QueryLoopSave() {
|
function PostTemplateSave() {
|
||||||
return Object(external_wp_element_["createElement"])(external_wp_blockEditor_["InnerBlocks"].Content, null);
|
return Object(external_wp_element_["createElement"])(external_wp_blockEditor_["InnerBlocks"].Content, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/query-loop/index.js
|
// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/post-template/index.js
|
||||||
/**
|
/**
|
||||||
* WordPress dependencies
|
* WordPress dependencies
|
||||||
*/
|
*/
|
||||||
|
@ -30979,13 +30980,13 @@ function QueryLoopSave() {
|
||||||
* Internal dependencies
|
* Internal dependencies
|
||||||
*/
|
*/
|
||||||
|
|
||||||
const query_loop_metadata = {
|
const post_template_metadata = {
|
||||||
apiVersion: 2,
|
apiVersion: 2,
|
||||||
name: "core/query-loop",
|
name: "core/post-template",
|
||||||
title: "Query Loop",
|
title: "Post Template",
|
||||||
category: "design",
|
category: "design",
|
||||||
parent: ["core/query"],
|
parent: ["core/query"],
|
||||||
description: "Query loop.",
|
description: "Post Template.",
|
||||||
textdomain: "default",
|
textdomain: "default",
|
||||||
usesContext: ["queryId", "query", "queryContext", "displayLayout", "templateSlug"],
|
usesContext: ["queryId", "query", "queryContext", "displayLayout", "templateSlug"],
|
||||||
supports: {
|
supports: {
|
||||||
|
@ -30993,19 +30994,19 @@ const query_loop_metadata = {
|
||||||
html: false,
|
html: false,
|
||||||
align: true
|
align: true
|
||||||
},
|
},
|
||||||
style: "wp-block-query-loop",
|
style: "wp-block-post-template",
|
||||||
editorStyle: "wp-block-query-loop-editor"
|
editorStyle: "wp-block-post-template-editor"
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
const {
|
const {
|
||||||
name: query_loop_name
|
name: post_template_name
|
||||||
} = query_loop_metadata;
|
} = post_template_metadata;
|
||||||
|
|
||||||
const query_loop_settings = {
|
const post_template_settings = {
|
||||||
icon: library_loop,
|
icon: library_loop,
|
||||||
edit: QueryLoopEdit,
|
edit: PostTemplateEdit,
|
||||||
save: QueryLoopSave
|
save: PostTemplateSave
|
||||||
};
|
};
|
||||||
|
|
||||||
// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/query-title/edit.js
|
// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/query-title/edit.js
|
||||||
|
@ -31585,6 +31586,102 @@ const postTitle = Object(external_wp_element_["createElement"])(external_wp_prim
|
||||||
}));
|
}));
|
||||||
/* harmony default export */ var post_title = (postTitle);
|
/* harmony default export */ var post_title = (postTitle);
|
||||||
|
|
||||||
|
// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/utils/hooks.js
|
||||||
|
/**
|
||||||
|
* WordPress dependencies
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Internal dependencies
|
||||||
|
*/
|
||||||
|
|
||||||
|
const queryMetaData = {
|
||||||
|
apiVersion: 2,
|
||||||
|
name: "core/query",
|
||||||
|
title: "Query Loop",
|
||||||
|
category: "design",
|
||||||
|
description: "Displays a list of posts as a result of a query.",
|
||||||
|
textdomain: "default",
|
||||||
|
attributes: {
|
||||||
|
queryId: {
|
||||||
|
type: "number"
|
||||||
|
},
|
||||||
|
query: {
|
||||||
|
type: "object",
|
||||||
|
"default": {
|
||||||
|
perPage: null,
|
||||||
|
pages: 0,
|
||||||
|
offset: 0,
|
||||||
|
postType: "post",
|
||||||
|
categoryIds: [],
|
||||||
|
tagIds: [],
|
||||||
|
order: "desc",
|
||||||
|
orderBy: "date",
|
||||||
|
author: "",
|
||||||
|
search: "",
|
||||||
|
exclude: [],
|
||||||
|
sticky: "",
|
||||||
|
inherit: true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
tagName: {
|
||||||
|
type: "string",
|
||||||
|
"default": "div"
|
||||||
|
},
|
||||||
|
displayLayout: {
|
||||||
|
type: "object",
|
||||||
|
"default": {
|
||||||
|
type: "list"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
providesContext: {
|
||||||
|
queryId: "queryId",
|
||||||
|
query: "query",
|
||||||
|
displayLayout: "displayLayout"
|
||||||
|
},
|
||||||
|
supports: {
|
||||||
|
align: ["wide", "full"],
|
||||||
|
html: false,
|
||||||
|
color: {
|
||||||
|
gradients: true,
|
||||||
|
link: true
|
||||||
|
},
|
||||||
|
__experimentalLayout: true
|
||||||
|
},
|
||||||
|
editorStyle: "wp-block-query-editor"
|
||||||
|
};
|
||||||
|
const {
|
||||||
|
name: queryBlockName
|
||||||
|
} = queryMetaData;
|
||||||
|
/**
|
||||||
|
* Hook that determines if a Post block is editable or not.
|
||||||
|
* The returned value is used to determine if the specific
|
||||||
|
* Post block will be rendered in `readonly` mode or not.
|
||||||
|
*
|
||||||
|
* For now this is checking if a Post block is nested in
|
||||||
|
* a Query block. If it is, the block should not be editable.
|
||||||
|
*
|
||||||
|
* @param {string} clientId The ID of the block to be checked.
|
||||||
|
* @return {boolean} Whether the block can be edited or not.
|
||||||
|
*/
|
||||||
|
|
||||||
|
function useIsEditablePostBlock(clientId) {
|
||||||
|
return Object(external_wp_data_["useSelect"])(select => {
|
||||||
|
const {
|
||||||
|
getBlockParents,
|
||||||
|
getBlockName
|
||||||
|
} = select(external_wp_blockEditor_["store"]);
|
||||||
|
const blockParents = getBlockParents(clientId);
|
||||||
|
const hasQueryParent = blockParents.some(parentClientId => getBlockName(parentClientId) === queryBlockName);
|
||||||
|
return !hasQueryParent;
|
||||||
|
}, [clientId]);
|
||||||
|
}
|
||||||
|
/* harmony default export */ var utils_hooks = ({
|
||||||
|
useIsEditablePostBlock
|
||||||
|
});
|
||||||
|
|
||||||
// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/post-title/edit.js
|
// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/post-title/edit.js
|
||||||
|
|
||||||
|
|
||||||
|
@ -31607,7 +31704,9 @@ const postTitle = Object(external_wp_element_["createElement"])(external_wp_prim
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
function PostTitleEdit({
|
function PostTitleEdit({
|
||||||
|
clientId,
|
||||||
attributes: {
|
attributes: {
|
||||||
level,
|
level,
|
||||||
textAlign,
|
textAlign,
|
||||||
|
@ -31622,6 +31721,7 @@ function PostTitleEdit({
|
||||||
}
|
}
|
||||||
}) {
|
}) {
|
||||||
const TagName = 0 === level ? 'p' : 'h' + level;
|
const TagName = 0 === level ? 'p' : 'h' + level;
|
||||||
|
const isEditable = useIsEditablePostBlock(clientId);
|
||||||
const post = Object(external_wp_data_["useSelect"])(select => select(external_wp_coreData_["store"]).getEditedEntityRecord('postType', postType, postId), [postType, postId]);
|
const post = Object(external_wp_data_["useSelect"])(select => select(external_wp_coreData_["store"]).getEditedEntityRecord('postType', postType, postId), [postType, postId]);
|
||||||
const {
|
const {
|
||||||
editEntityRecord
|
editEntityRecord
|
||||||
|
@ -31643,7 +31743,7 @@ function PostTitleEdit({
|
||||||
let titleElement = Object(external_wp_element_["createElement"])(TagName, isLink ? {} : blockProps, Object(external_wp_i18n_["__"])('An example title'));
|
let titleElement = Object(external_wp_element_["createElement"])(TagName, isLink ? {} : blockProps, Object(external_wp_i18n_["__"])('An example title'));
|
||||||
|
|
||||||
if (postType && postId) {
|
if (postType && postId) {
|
||||||
titleElement = Object(external_wp_element_["createElement"])(external_wp_blockEditor_["PlainText"], Object(esm_extends["a" /* default */])({
|
titleElement = isEditable ? Object(external_wp_element_["createElement"])(external_wp_blockEditor_["PlainText"], Object(esm_extends["a" /* default */])({
|
||||||
tagName: TagName,
|
tagName: TagName,
|
||||||
placeholder: Object(external_wp_i18n_["__"])('No Title'),
|
placeholder: Object(external_wp_i18n_["__"])('No Title'),
|
||||||
value: title,
|
value: title,
|
||||||
|
@ -31651,11 +31751,11 @@ function PostTitleEdit({
|
||||||
title: value
|
title: value
|
||||||
}),
|
}),
|
||||||
__experimentalVersion: 2
|
__experimentalVersion: 2
|
||||||
}, isLink ? {} : blockProps));
|
}, isLink ? {} : blockProps)) : Object(external_wp_element_["createElement"])(TagName, isLink ? {} : blockProps, title);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isLink) {
|
if (isLink) {
|
||||||
titleElement = Object(external_wp_element_["createElement"])(TagName, blockProps, Object(external_wp_element_["createElement"])(external_wp_blockEditor_["PlainText"], {
|
titleElement = isEditable ? Object(external_wp_element_["createElement"])(TagName, blockProps, Object(external_wp_element_["createElement"])(external_wp_blockEditor_["PlainText"], {
|
||||||
tagName: "a",
|
tagName: "a",
|
||||||
href: link,
|
href: link,
|
||||||
target: linkTarget,
|
target: linkTarget,
|
||||||
|
@ -31666,7 +31766,12 @@ function PostTitleEdit({
|
||||||
title: value
|
title: value
|
||||||
}),
|
}),
|
||||||
__experimentalVersion: 2
|
__experimentalVersion: 2
|
||||||
}));
|
})) : Object(external_wp_element_["createElement"])(TagName, blockProps, Object(external_wp_element_["createElement"])("a", {
|
||||||
|
href: link,
|
||||||
|
target: linkTarget,
|
||||||
|
rel: rel,
|
||||||
|
onClick: event => event.preventDefault()
|
||||||
|
}, title));
|
||||||
}
|
}
|
||||||
|
|
||||||
return Object(external_wp_element_["createElement"])(external_wp_element_["Fragment"], null, Object(external_wp_element_["createElement"])(external_wp_blockEditor_["BlockControls"], {
|
return Object(external_wp_element_["createElement"])(external_wp_element_["Fragment"], null, Object(external_wp_element_["createElement"])(external_wp_blockEditor_["BlockControls"], {
|
||||||
|
@ -31796,8 +31901,24 @@ const postContent = Object(external_wp_element_["createElement"])(external_wp_pr
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Internal dependencies
|
||||||
|
*/
|
||||||
|
|
||||||
function Content({
|
|
||||||
|
|
||||||
|
function ReadOnlyContent({
|
||||||
|
postType,
|
||||||
|
postId
|
||||||
|
}) {
|
||||||
|
const [,, content] = Object(external_wp_coreData_["useEntityProp"])('postType', postType, 'content', postId);
|
||||||
|
const blockProps = Object(external_wp_blockEditor_["useBlockProps"])();
|
||||||
|
return Object(external_wp_element_["createElement"])("div", blockProps, Object(external_wp_element_["createElement"])(external_wp_element_["RawHTML"], {
|
||||||
|
key: "html"
|
||||||
|
}, content === null || content === void 0 ? void 0 : content.rendered));
|
||||||
|
}
|
||||||
|
|
||||||
|
function EditableContent({
|
||||||
layout,
|
layout,
|
||||||
postType,
|
postType,
|
||||||
postId
|
postId
|
||||||
|
@ -31844,6 +31965,19 @@ function Content({
|
||||||
return Object(external_wp_element_["createElement"])("div", props);
|
return Object(external_wp_element_["createElement"])("div", props);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function Content(props) {
|
||||||
|
const {
|
||||||
|
clientId,
|
||||||
|
postType,
|
||||||
|
postId
|
||||||
|
} = props;
|
||||||
|
const isEditable = useIsEditablePostBlock(clientId);
|
||||||
|
return isEditable ? Object(external_wp_element_["createElement"])(EditableContent, props) : Object(external_wp_element_["createElement"])(ReadOnlyContent, {
|
||||||
|
postType: postType,
|
||||||
|
postId: postId
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
function edit_Placeholder() {
|
function edit_Placeholder() {
|
||||||
const blockProps = Object(external_wp_blockEditor_["useBlockProps"])();
|
const blockProps = Object(external_wp_blockEditor_["useBlockProps"])();
|
||||||
return Object(external_wp_element_["createElement"])("div", blockProps, Object(external_wp_element_["createElement"])("div", {
|
return Object(external_wp_element_["createElement"])("div", blockProps, Object(external_wp_element_["createElement"])("div", {
|
||||||
|
@ -31857,6 +31991,7 @@ function RecursionError() {
|
||||||
}
|
}
|
||||||
|
|
||||||
function PostContentEdit({
|
function PostContentEdit({
|
||||||
|
clientId,
|
||||||
context: {
|
context: {
|
||||||
postId: contextPostId,
|
postId: contextPostId,
|
||||||
postType: contextPostType
|
postType: contextPostType
|
||||||
|
@ -31875,7 +32010,8 @@ function PostContentEdit({
|
||||||
return Object(external_wp_element_["createElement"])(RecursionProvider, null, contextPostId && contextPostType ? Object(external_wp_element_["createElement"])(Content, {
|
return Object(external_wp_element_["createElement"])(RecursionProvider, null, contextPostId && contextPostType ? Object(external_wp_element_["createElement"])(Content, {
|
||||||
postType: contextPostType,
|
postType: contextPostType,
|
||||||
postId: contextPostId,
|
postId: contextPostId,
|
||||||
layout: layout
|
layout: layout,
|
||||||
|
clientId: clientId
|
||||||
}) : Object(external_wp_element_["createElement"])(edit_Placeholder, null));
|
}) : Object(external_wp_element_["createElement"])(edit_Placeholder, null));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -31948,7 +32084,13 @@ const post_date_postDate = Object(external_wp_element_["createElement"])(externa
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Internal dependencies
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
function PostDateEdit({
|
function PostDateEdit({
|
||||||
|
clientId,
|
||||||
attributes,
|
attributes,
|
||||||
context,
|
context,
|
||||||
setAttributes
|
setAttributes
|
||||||
|
@ -31962,6 +32104,7 @@ function PostDateEdit({
|
||||||
postId,
|
postId,
|
||||||
postType
|
postType
|
||||||
} = context;
|
} = context;
|
||||||
|
const isEditable = useIsEditablePostBlock(clientId);
|
||||||
const [siteFormat] = Object(external_wp_coreData_["useEntityProp"])('root', 'site', 'date_format');
|
const [siteFormat] = Object(external_wp_coreData_["useEntityProp"])('root', 'site', 'date_format');
|
||||||
const [date, setDate] = Object(external_wp_coreData_["useEntityProp"])('postType', postType, 'date', postId);
|
const [date, setDate] = Object(external_wp_coreData_["useEntityProp"])('postType', postType, 'date', postId);
|
||||||
const [isPickerOpen, setIsPickerOpen] = Object(external_wp_element_["useState"])(false);
|
const [isPickerOpen, setIsPickerOpen] = Object(external_wp_element_["useState"])(false);
|
||||||
|
@ -32010,7 +32153,7 @@ function PostDateEdit({
|
||||||
textAlign: nextAlign
|
textAlign: nextAlign
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}), date && Object(external_wp_element_["createElement"])(external_wp_components_["ToolbarButton"], {
|
}), date && isEditable && Object(external_wp_element_["createElement"])(external_wp_components_["ToolbarButton"], {
|
||||||
icon: library_edit["a" /* default */],
|
icon: library_edit["a" /* default */],
|
||||||
title: Object(external_wp_i18n_["__"])('Change Date'),
|
title: Object(external_wp_i18n_["__"])('Change Date'),
|
||||||
onClick: () => setIsPickerOpen(_isPickerOpen => !_isPickerOpen)
|
onClick: () => setIsPickerOpen(_isPickerOpen => !_isPickerOpen)
|
||||||
|
@ -32120,6 +32263,11 @@ const post_excerpt_postExcerpt = Object(external_wp_element_["createElement"])(e
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Internal dependencies
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
function usePostContentExcerpt(wordCount, postId, postType) {
|
function usePostContentExcerpt(wordCount, postId, postType) {
|
||||||
// Don't destrcuture items from content here, it can be undefined.
|
// Don't destrcuture items from content here, it can be undefined.
|
||||||
|
@ -32138,6 +32286,7 @@ function usePostContentExcerpt(wordCount, postId, postType) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function PostExcerptEditor({
|
function PostExcerptEditor({
|
||||||
|
clientId,
|
||||||
attributes: {
|
attributes: {
|
||||||
textAlign,
|
textAlign,
|
||||||
wordCount,
|
wordCount,
|
||||||
|
@ -32151,6 +32300,7 @@ function PostExcerptEditor({
|
||||||
postType
|
postType
|
||||||
}
|
}
|
||||||
}) {
|
}) {
|
||||||
|
const isEditable = useIsEditablePostBlock(clientId);
|
||||||
const [excerpt, setExcerpt] = Object(external_wp_coreData_["useEntityProp"])('postType', postType, 'excerpt', postId);
|
const [excerpt, setExcerpt] = Object(external_wp_coreData_["useEntityProp"])('postType', postType, 'excerpt', postId);
|
||||||
const postContentExcerpt = usePostContentExcerpt(wordCount, postId, postType);
|
const postContentExcerpt = usePostContentExcerpt(wordCount, postId, postType);
|
||||||
const blockProps = Object(external_wp_blockEditor_["useBlockProps"])({
|
const blockProps = Object(external_wp_blockEditor_["useBlockProps"])({
|
||||||
|
@ -32173,6 +32323,12 @@ function PostExcerptEditor({
|
||||||
moreText: newMoreText
|
moreText: newMoreText
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
|
const excerptContent = isEditable ? Object(external_wp_element_["createElement"])(external_wp_blockEditor_["RichText"], {
|
||||||
|
className: !showMoreOnNewLine && 'wp-block-post-excerpt__excerpt is-inline',
|
||||||
|
"aria-label": Object(external_wp_i18n_["__"])('Post excerpt text'),
|
||||||
|
value: excerpt || postContentExcerpt || (isSelected ? '' : Object(external_wp_i18n_["__"])('No post excerpt found')),
|
||||||
|
onChange: setExcerpt
|
||||||
|
}) : excerpt || postContentExcerpt || Object(external_wp_i18n_["__"])('No post excerpt found');
|
||||||
return Object(external_wp_element_["createElement"])(external_wp_element_["Fragment"], null, Object(external_wp_element_["createElement"])(external_wp_blockEditor_["BlockControls"], null, Object(external_wp_element_["createElement"])(external_wp_blockEditor_["AlignmentToolbar"], {
|
return Object(external_wp_element_["createElement"])(external_wp_element_["Fragment"], null, Object(external_wp_element_["createElement"])(external_wp_blockEditor_["BlockControls"], null, Object(external_wp_element_["createElement"])(external_wp_blockEditor_["AlignmentToolbar"], {
|
||||||
value: textAlign,
|
value: textAlign,
|
||||||
onChange: newAlign => setAttributes({
|
onChange: newAlign => setAttributes({
|
||||||
|
@ -32194,12 +32350,7 @@ function PostExcerptEditor({
|
||||||
onChange: newShowMoreOnNewLine => setAttributes({
|
onChange: newShowMoreOnNewLine => setAttributes({
|
||||||
showMoreOnNewLine: newShowMoreOnNewLine
|
showMoreOnNewLine: newShowMoreOnNewLine
|
||||||
})
|
})
|
||||||
}))), Object(external_wp_element_["createElement"])("div", blockProps, Object(external_wp_element_["createElement"])(external_wp_blockEditor_["RichText"], {
|
}))), Object(external_wp_element_["createElement"])("div", blockProps, excerptContent, !showMoreOnNewLine && ' ', showMoreOnNewLine ? Object(external_wp_element_["createElement"])("p", {
|
||||||
className: !showMoreOnNewLine && 'wp-block-post-excerpt__excerpt is-inline',
|
|
||||||
"aria-label": Object(external_wp_i18n_["__"])('Post excerpt text'),
|
|
||||||
value: excerpt || postContentExcerpt || (isSelected ? '' : Object(external_wp_i18n_["__"])('No post excerpt found')),
|
|
||||||
onChange: setExcerpt
|
|
||||||
}), !showMoreOnNewLine && ' ', showMoreOnNewLine ? Object(external_wp_element_["createElement"])("p", {
|
|
||||||
className: "wp-block-post-excerpt__more-text"
|
className: "wp-block-post-excerpt__more-text"
|
||||||
}, readMoreLink) : readMoreLink));
|
}, readMoreLink) : readMoreLink));
|
||||||
}
|
}
|
||||||
|
@ -32288,6 +32439,11 @@ const postFeaturedImage = Object(external_wp_element_["createElement"])(external
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Internal dependencies
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
const post_featured_image_edit_ALLOWED_MEDIA_TYPES = ['image'];
|
const post_featured_image_edit_ALLOWED_MEDIA_TYPES = ['image'];
|
||||||
const placeholderChip = Object(external_wp_element_["createElement"])("div", {
|
const placeholderChip = Object(external_wp_element_["createElement"])("div", {
|
||||||
className: "post-featured-image_placeholder"
|
className: "post-featured-image_placeholder"
|
||||||
|
@ -32296,6 +32452,7 @@ const placeholderChip = Object(external_wp_element_["createElement"])("div", {
|
||||||
}), Object(external_wp_element_["createElement"])("p", null, " ", Object(external_wp_i18n_["__"])('Featured Image')));
|
}), Object(external_wp_element_["createElement"])("p", null, " ", Object(external_wp_i18n_["__"])('Featured Image')));
|
||||||
|
|
||||||
function PostFeaturedImageDisplay({
|
function PostFeaturedImageDisplay({
|
||||||
|
clientId,
|
||||||
attributes: {
|
attributes: {
|
||||||
isLink
|
isLink
|
||||||
},
|
},
|
||||||
|
@ -32307,8 +32464,10 @@ function PostFeaturedImageDisplay({
|
||||||
noticeUI,
|
noticeUI,
|
||||||
noticeOperations
|
noticeOperations
|
||||||
}) {
|
}) {
|
||||||
|
const isEditable = useIsEditablePostBlock(clientId);
|
||||||
const [featuredImage, setFeaturedImage] = Object(external_wp_coreData_["useEntityProp"])('postType', postType, 'featured_media', postId);
|
const [featuredImage, setFeaturedImage] = Object(external_wp_coreData_["useEntityProp"])('postType', postType, 'featured_media', postId);
|
||||||
const media = Object(external_wp_data_["useSelect"])(select => featuredImage && select(external_wp_coreData_["store"]).getMedia(featuredImage), [featuredImage]);
|
const media = Object(external_wp_data_["useSelect"])(select => featuredImage && select(external_wp_coreData_["store"]).getMedia(featuredImage), [featuredImage]);
|
||||||
|
const blockProps = Object(external_wp_blockEditor_["useBlockProps"])();
|
||||||
|
|
||||||
const onSelectImage = value => {
|
const onSelectImage = value => {
|
||||||
if (value !== null && value !== void 0 && value.id) {
|
if (value !== null && value !== void 0 && value.id) {
|
||||||
|
@ -32323,6 +32482,10 @@ function PostFeaturedImageDisplay({
|
||||||
|
|
||||||
let image;
|
let image;
|
||||||
|
|
||||||
|
if (!featuredImage && !isEditable) {
|
||||||
|
return Object(external_wp_element_["createElement"])("div", blockProps, placeholderChip);
|
||||||
|
}
|
||||||
|
|
||||||
if (!featuredImage) {
|
if (!featuredImage) {
|
||||||
image = Object(external_wp_element_["createElement"])(external_wp_blockEditor_["MediaPlaceholder"], {
|
image = Object(external_wp_element_["createElement"])(external_wp_blockEditor_["MediaPlaceholder"], {
|
||||||
icon: Object(external_wp_element_["createElement"])(external_wp_blockEditor_["BlockIcon"], {
|
icon: Object(external_wp_element_["createElement"])(external_wp_blockEditor_["BlockIcon"], {
|
||||||
|
@ -32355,16 +32518,16 @@ function PostFeaturedImageDisplay({
|
||||||
isLink: !isLink
|
isLink: !isLink
|
||||||
}),
|
}),
|
||||||
checked: isLink
|
checked: isLink
|
||||||
}))), Object(external_wp_element_["createElement"])(external_wp_blockEditor_["BlockControls"], {
|
}))), !!media && isEditable && Object(external_wp_element_["createElement"])(external_wp_blockEditor_["BlockControls"], {
|
||||||
group: "other"
|
group: "other"
|
||||||
}, !!media && Object(external_wp_element_["createElement"])(external_wp_blockEditor_["MediaReplaceFlow"], {
|
}, Object(external_wp_element_["createElement"])(external_wp_blockEditor_["MediaReplaceFlow"], {
|
||||||
mediaId: featuredImage,
|
mediaId: featuredImage,
|
||||||
mediaURL: media.source_url,
|
mediaURL: media.source_url,
|
||||||
allowedTypes: post_featured_image_edit_ALLOWED_MEDIA_TYPES,
|
allowedTypes: post_featured_image_edit_ALLOWED_MEDIA_TYPES,
|
||||||
accept: "image/*",
|
accept: "image/*",
|
||||||
onSelect: onSelectImage,
|
onSelect: onSelectImage,
|
||||||
onError: onUploadError
|
onError: onUploadError
|
||||||
})), Object(external_wp_element_["createElement"])("figure", Object(external_wp_blockEditor_["useBlockProps"])(), image));
|
})), Object(external_wp_element_["createElement"])("figure", blockProps, image));
|
||||||
}
|
}
|
||||||
|
|
||||||
const PostFeaturedImageWithNotices = Object(external_wp_components_["withNotices"])(PostFeaturedImageDisplay);
|
const PostFeaturedImageWithNotices = Object(external_wp_components_["withNotices"])(PostFeaturedImageDisplay);
|
||||||
|
@ -32771,7 +32934,7 @@ build_module_paragraph_namespaceObject, build_module_image_namespaceObject, buil
|
||||||
build_module_shortcode_namespaceObject, archives_namespaceObject, build_module_audio_namespaceObject, button_namespaceObject, build_module_buttons_namespaceObject, build_module_calendar_namespaceObject, categories_namespaceObject, code_namespaceObject, build_module_columns_namespaceObject, build_module_column_namespaceObject, build_module_cover_namespaceObject, embed_namespaceObject, build_module_file_namespaceObject, build_module_group_namespaceObject, window.wp && window.wp.oldEditor ? freeform_namespaceObject : null, // Only add the classic block in WP Context
|
build_module_shortcode_namespaceObject, archives_namespaceObject, build_module_audio_namespaceObject, button_namespaceObject, build_module_buttons_namespaceObject, build_module_calendar_namespaceObject, categories_namespaceObject, code_namespaceObject, build_module_columns_namespaceObject, build_module_column_namespaceObject, build_module_cover_namespaceObject, embed_namespaceObject, build_module_file_namespaceObject, build_module_group_namespaceObject, window.wp && window.wp.oldEditor ? freeform_namespaceObject : null, // Only add the classic block in WP Context
|
||||||
build_module_html_namespaceObject, media_text_namespaceObject, latest_comments_namespaceObject, latest_posts_namespaceObject, legacy_widget_namespaceObject, missing_namespaceObject, build_module_more_namespaceObject, nextpage_namespaceObject, page_list_namespaceObject, build_module_preformatted_namespaceObject, build_module_pullquote_namespaceObject, build_module_rss_namespaceObject, search_namespaceObject, build_module_separator_namespaceObject, block_namespaceObject, social_links_namespaceObject, social_link_namespaceObject, spacer_namespaceObject, build_module_table_namespaceObject, // tableOfContents,
|
build_module_html_namespaceObject, media_text_namespaceObject, latest_comments_namespaceObject, latest_posts_namespaceObject, legacy_widget_namespaceObject, missing_namespaceObject, build_module_more_namespaceObject, nextpage_namespaceObject, page_list_namespaceObject, build_module_preformatted_namespaceObject, build_module_pullquote_namespaceObject, build_module_rss_namespaceObject, search_namespaceObject, build_module_separator_namespaceObject, block_namespaceObject, social_links_namespaceObject, social_link_namespaceObject, spacer_namespaceObject, build_module_table_namespaceObject, // tableOfContents,
|
||||||
tag_cloud_namespaceObject, text_columns_namespaceObject, build_module_verse_namespaceObject, build_module_video_namespaceObject, // Theme blocks
|
tag_cloud_namespaceObject, text_columns_namespaceObject, build_module_verse_namespaceObject, build_module_video_namespaceObject, // Theme blocks
|
||||||
build_module_site_logo_namespaceObject, site_tagline_namespaceObject, site_title_namespaceObject, query_namespaceObject, query_loop_namespaceObject, query_title_namespaceObject, build_module_query_pagination_namespaceObject, build_module_query_pagination_next_namespaceObject, build_module_query_pagination_numbers_namespaceObject, build_module_query_pagination_previous_namespaceObject, build_module_post_title_namespaceObject, build_module_post_content_namespaceObject, build_module_post_date_namespaceObject, build_module_post_excerpt_namespaceObject, build_module_post_featured_image_namespaceObject, post_terms_namespaceObject, loginout_namespaceObject];
|
build_module_site_logo_namespaceObject, site_tagline_namespaceObject, site_title_namespaceObject, query_namespaceObject, post_template_namespaceObject, query_title_namespaceObject, build_module_query_pagination_namespaceObject, build_module_query_pagination_next_namespaceObject, build_module_query_pagination_numbers_namespaceObject, build_module_query_pagination_previous_namespaceObject, build_module_post_title_namespaceObject, build_module_post_content_namespaceObject, build_module_post_date_namespaceObject, build_module_post_excerpt_namespaceObject, build_module_post_featured_image_namespaceObject, post_terms_namespaceObject, loginout_namespaceObject];
|
||||||
/**
|
/**
|
||||||
* Function to register core blocks provided by the block editor.
|
* Function to register core blocks provided by the block editor.
|
||||||
*
|
*
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -5400,6 +5400,12 @@ function convertLegacyBlocks(name, attributes) {
|
||||||
}
|
}
|
||||||
|
|
||||||
name = 'core/embed';
|
name = 'core/embed';
|
||||||
|
} // Convert 'core/query-loop' blocks in existing content to 'core/post-template'.
|
||||||
|
// TODO: Remove this check when WordPress 5.9 is released.
|
||||||
|
|
||||||
|
|
||||||
|
if (name === 'core/query-loop') {
|
||||||
|
name = 'core/post-template';
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -1977,17 +1977,17 @@ function Sidebar() {
|
||||||
getActiveComplementaryArea
|
getActiveComplementaryArea
|
||||||
} = select(build_module["g" /* store */]);
|
} = select(build_module["g" /* store */]);
|
||||||
const selectedBlock = getSelectedBlock();
|
const selectedBlock = getSelectedBlock();
|
||||||
let activeArea = getActiveComplementaryArea(store.name);
|
const activeArea = getActiveComplementaryArea(store.name);
|
||||||
|
let currentSelection = activeArea;
|
||||||
|
|
||||||
if (!activeArea) {
|
if (!currentSelection) {
|
||||||
if (selectedBlock) {
|
if (selectedBlock) {
|
||||||
activeArea = BLOCK_INSPECTOR_IDENTIFIER;
|
currentSelection = BLOCK_INSPECTOR_IDENTIFIER;
|
||||||
} else {
|
} else {
|
||||||
activeArea = WIDGET_AREAS_IDENTIFIER;
|
currentSelection = WIDGET_AREAS_IDENTIFIER;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const isSidebarOpen = !!activeArea;
|
|
||||||
let widgetAreaBlock;
|
let widgetAreaBlock;
|
||||||
|
|
||||||
if (selectedBlock) {
|
if (selectedBlock) {
|
||||||
|
@ -1999,9 +1999,9 @@ function Sidebar() {
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
currentArea: activeArea,
|
currentArea: currentSelection,
|
||||||
hasSelectedNonAreaBlock: !!(selectedBlock && selectedBlock.name !== 'core/widget-area'),
|
hasSelectedNonAreaBlock: !!(selectedBlock && selectedBlock.name !== 'core/widget-area'),
|
||||||
isGeneralSidebarOpen: isSidebarOpen,
|
isGeneralSidebarOpen: !!activeArea,
|
||||||
selectedWidgetAreaBlock: widgetAreaBlock
|
selectedWidgetAreaBlock: widgetAreaBlock
|
||||||
};
|
};
|
||||||
}, []); // currentArea, and isGeneralSidebarOpen are intentionally left out from the dependencies,
|
}, []); // currentArea, and isGeneralSidebarOpen are intentionally left out from the dependencies,
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -13,7 +13,7 @@
|
||||||
*
|
*
|
||||||
* @global string $wp_version
|
* @global string $wp_version
|
||||||
*/
|
*/
|
||||||
$wp_version = '5.8-alpha-51100';
|
$wp_version = '5.8-alpha-51101';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||||
|
|
Loading…
Reference in New Issue