@wordpress/block-library 8.30.0 → 8.31.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +2 -0
- package/build/block/edit.js +17 -8
- package/build/block/edit.js.map +1 -1
- package/build/code/save.js +3 -1
- package/build/code/save.js.map +1 -1
- package/build/cover/edit/index.js +2 -1
- package/build/cover/edit/index.js.map +1 -1
- package/build/details/edit.js +1 -0
- package/build/details/edit.js.map +1 -1
- package/build/file/edit.js +2 -0
- package/build/file/edit.js.map +1 -1
- package/build/heading/index.js +4 -3
- package/build/heading/index.js.map +1 -1
- package/build/media-text/edit.js +33 -9
- package/build/media-text/edit.js.map +1 -1
- package/build/media-text/index.js +5 -0
- package/build/media-text/index.js.map +1 -1
- package/build/media-text/media-container.js +30 -11
- package/build/media-text/media-container.js.map +1 -1
- package/build/media-text/save.js +2 -2
- package/build/media-text/save.js.map +1 -1
- package/build/navigation/edit/index.js +23 -29
- package/build/navigation/edit/index.js.map +1 -1
- package/build/navigation/edit/navigation-menu-delete-control.js +12 -20
- package/build/navigation/edit/navigation-menu-delete-control.js.map +1 -1
- package/build/navigation/edit/navigation-menu-selector.js +24 -23
- package/build/navigation/edit/navigation-menu-selector.js.map +1 -1
- package/build/navigation/edit/placeholder/index.js +4 -4
- package/build/navigation/edit/placeholder/index.js.map +1 -1
- package/build/navigation/use-navigation-menu.js +15 -12
- package/build/navigation/use-navigation-menu.js.map +1 -1
- package/build/navigation-link/edit.js +12 -10
- package/build/navigation-link/edit.js.map +1 -1
- package/build/navigation-submenu/edit.js +4 -0
- package/build/navigation-submenu/edit.js.map +1 -1
- package/build/post-author/edit.js +1 -0
- package/build/post-author/edit.js.map +1 -1
- package/build/post-excerpt/edit.js +1 -0
- package/build/post-excerpt/edit.js.map +1 -1
- package/build/post-featured-image/edit.js +4 -1
- package/build/post-featured-image/edit.js.map +1 -1
- package/build/post-featured-image/index.js +6 -0
- package/build/post-featured-image/index.js.map +1 -1
- package/build/post-navigation-link/edit.js +1 -0
- package/build/post-navigation-link/edit.js.map +1 -1
- package/build/post-terms/edit.js +2 -0
- package/build/post-terms/edit.js.map +1 -1
- package/build/quote/edit.js +2 -2
- package/build/quote/edit.js.map +1 -1
- package/build/read-more/edit.js +1 -0
- package/build/read-more/edit.js.map +1 -1
- package/build/search/edit.js +2 -0
- package/build/search/edit.js.map +1 -1
- package/build/search/edit.native.js +2 -2
- package/build/search/edit.native.js.map +1 -1
- package/build/social-link/edit.js +1 -1
- package/build/social-link/edit.js.map +1 -1
- package/build/social-link/icons/medium.js +1 -1
- package/build/social-link/icons/medium.js.map +1 -1
- package/build/social-link/icons/reddit.js +1 -1
- package/build/social-link/icons/reddit.js.map +1 -1
- package/build/table/deprecated.js +285 -175
- package/build/table/deprecated.js.map +1 -1
- package/build/table/index.js +1 -1
- package/build/template-part/edit/index.js +1 -1
- package/build/template-part/edit/index.js.map +1 -1
- package/build/video/edit.native.js +1 -1
- package/build/video/edit.native.js.map +1 -1
- package/build-module/block/edit.js +18 -9
- package/build-module/block/edit.js.map +1 -1
- package/build-module/code/save.js +3 -1
- package/build-module/code/save.js.map +1 -1
- package/build-module/cover/edit/index.js +2 -1
- package/build-module/cover/edit/index.js.map +1 -1
- package/build-module/details/edit.js +1 -0
- package/build-module/details/edit.js.map +1 -1
- package/build-module/file/edit.js +2 -0
- package/build-module/file/edit.js.map +1 -1
- package/build-module/heading/index.js +4 -3
- package/build-module/heading/index.js.map +1 -1
- package/build-module/media-text/edit.js +34 -10
- package/build-module/media-text/edit.js.map +1 -1
- package/build-module/media-text/index.js +5 -0
- package/build-module/media-text/index.js.map +1 -1
- package/build-module/media-text/media-container.js +31 -12
- package/build-module/media-text/media-container.js.map +1 -1
- package/build-module/media-text/save.js +2 -2
- package/build-module/media-text/save.js.map +1 -1
- package/build-module/navigation/edit/index.js +24 -30
- package/build-module/navigation/edit/index.js.map +1 -1
- package/build-module/navigation/edit/navigation-menu-delete-control.js +15 -23
- package/build-module/navigation/edit/navigation-menu-delete-control.js.map +1 -1
- package/build-module/navigation/edit/navigation-menu-selector.js +24 -23
- package/build-module/navigation/edit/navigation-menu-selector.js.map +1 -1
- package/build-module/navigation/edit/placeholder/index.js +4 -4
- package/build-module/navigation/edit/placeholder/index.js.map +1 -1
- package/build-module/navigation/use-navigation-menu.js +15 -12
- package/build-module/navigation/use-navigation-menu.js.map +1 -1
- package/build-module/navigation-link/edit.js +13 -11
- package/build-module/navigation-link/edit.js.map +1 -1
- package/build-module/navigation-submenu/edit.js +4 -0
- package/build-module/navigation-submenu/edit.js.map +1 -1
- package/build-module/post-author/edit.js +1 -0
- package/build-module/post-author/edit.js.map +1 -1
- package/build-module/post-excerpt/edit.js +1 -0
- package/build-module/post-excerpt/edit.js.map +1 -1
- package/build-module/post-featured-image/edit.js +5 -2
- package/build-module/post-featured-image/edit.js.map +1 -1
- package/build-module/post-featured-image/index.js +6 -0
- package/build-module/post-featured-image/index.js.map +1 -1
- package/build-module/post-navigation-link/edit.js +1 -0
- package/build-module/post-navigation-link/edit.js.map +1 -1
- package/build-module/post-terms/edit.js +2 -0
- package/build-module/post-terms/edit.js.map +1 -1
- package/build-module/quote/edit.js +2 -2
- package/build-module/quote/edit.js.map +1 -1
- package/build-module/read-more/edit.js +1 -0
- package/build-module/read-more/edit.js.map +1 -1
- package/build-module/search/edit.js +2 -0
- package/build-module/search/edit.js.map +1 -1
- package/build-module/search/edit.native.js +2 -2
- package/build-module/search/edit.native.js.map +1 -1
- package/build-module/social-link/edit.js +1 -1
- package/build-module/social-link/edit.js.map +1 -1
- package/build-module/social-link/icons/medium.js +1 -1
- package/build-module/social-link/icons/medium.js.map +1 -1
- package/build-module/social-link/icons/reddit.js +1 -1
- package/build-module/social-link/icons/reddit.js.map +1 -1
- package/build-module/table/deprecated.js +286 -176
- package/build-module/table/deprecated.js.map +1 -1
- package/build-module/table/index.js +1 -1
- package/build-module/template-part/edit/index.js +1 -1
- package/build-module/template-part/edit/index.js.map +1 -1
- package/build-module/video/edit.native.js +1 -1
- package/build-module/video/edit.native.js.map +1 -1
- package/build-style/editor-rtl.css +10 -4
- package/build-style/editor.css +10 -4
- package/build-style/file/editor-rtl.css +3 -0
- package/build-style/file/editor.css +3 -0
- package/build-style/image/editor-rtl.css +0 -3
- package/build-style/image/editor.css +0 -3
- package/build-style/media-text/editor-rtl.css +7 -1
- package/build-style/media-text/editor.css +7 -1
- package/build-style/social-links/style-rtl.css +2 -2
- package/build-style/social-links/style.css +2 -2
- package/build-style/style-rtl.css +2 -2
- package/build-style/style.css +2 -2
- package/package.json +34 -34
- package/src/archives/index.php +4 -0
- package/src/avatar/index.php +6 -0
- package/src/block/edit.js +38 -15
- package/src/block/index.php +4 -0
- package/src/block/test/edit.native.js +67 -0
- package/src/calendar/index.php +12 -0
- package/src/categories/index.php +6 -0
- package/src/code/save.js +7 -1
- package/src/comment-author-name/index.php +4 -0
- package/src/comment-content/index.php +4 -0
- package/src/comment-date/index.php +4 -0
- package/src/comment-edit-link/index.php +4 -0
- package/src/comment-reply-link/index.php +4 -0
- package/src/comment-template/index.php +4 -0
- package/src/comments/index.php +10 -0
- package/src/comments-pagination/index.php +4 -0
- package/src/comments-pagination-next/index.php +4 -0
- package/src/comments-pagination-numbers/index.php +4 -0
- package/src/comments-pagination-previous/index.php +4 -0
- package/src/comments-title/index.php +4 -0
- package/src/cover/edit/index.js +4 -1
- package/src/cover/index.php +4 -0
- package/src/details/edit.js +1 -0
- package/src/file/edit.js +2 -0
- package/src/file/editor.scss +3 -0
- package/src/file/index.php +4 -0
- package/src/gallery/index.php +6 -0
- package/src/heading/index.js +4 -3
- package/src/heading/index.php +4 -0
- package/src/home-link/index.php +10 -0
- package/src/image/editor.scss +0 -5
- package/src/image/index.php +12 -1
- package/src/latest-comments/index.php +4 -0
- package/src/latest-posts/index.php +8 -0
- package/src/loginout/index.php +4 -0
- package/src/media-text/block.json +5 -0
- package/src/media-text/edit.js +70 -19
- package/src/media-text/editor.scss +7 -1
- package/src/media-text/index.php +70 -0
- package/src/media-text/media-container.js +49 -9
- package/src/media-text/save.js +2 -2
- package/src/navigation/edit/index.js +67 -71
- package/src/navigation/edit/navigation-menu-delete-control.js +22 -49
- package/src/navigation/edit/navigation-menu-selector.js +39 -21
- package/src/navigation/edit/placeholder/index.js +4 -4
- package/src/navigation/edit/test/navigation-menu-selector.js +75 -53
- package/src/navigation/index.php +101 -26
- package/src/navigation/test/use-navigation-menu.js +21 -21
- package/src/navigation/use-navigation-menu.js +23 -9
- package/src/navigation-link/edit.js +12 -13
- package/src/navigation-link/index.php +14 -0
- package/src/navigation-submenu/edit.js +4 -0
- package/src/navigation-submenu/index.php +8 -0
- package/src/page-list/index.php +12 -0
- package/src/page-list-item/index.php +2 -0
- package/src/pattern/index.php +2 -0
- package/src/post-author/edit.js +1 -0
- package/src/post-author/index.php +4 -0
- package/src/post-author-biography/index.php +4 -0
- package/src/post-author-name/index.php +4 -0
- package/src/post-comments-form/index.php +6 -0
- package/src/post-content/index.php +4 -0
- package/src/post-date/index.php +4 -0
- package/src/post-excerpt/edit.js +1 -0
- package/src/post-excerpt/index.php +4 -0
- package/src/post-featured-image/block.json +6 -0
- package/src/post-featured-image/edit.js +4 -0
- package/src/post-featured-image/index.php +15 -0
- package/src/post-navigation-link/edit.js +1 -0
- package/src/post-navigation-link/index.php +4 -0
- package/src/post-template/index.php +4 -0
- package/src/post-terms/edit.js +2 -0
- package/src/post-terms/index.php +6 -0
- package/src/post-title/index.php +2 -0
- package/src/query/index.php +2 -0
- package/src/query-no-results/index.php +4 -0
- package/src/query-pagination/index.php +4 -0
- package/src/query-pagination-next/index.php +4 -0
- package/src/query-pagination-numbers/index.php +4 -0
- package/src/query-pagination-previous/index.php +4 -0
- package/src/query-title/index.php +4 -0
- package/src/quote/edit.js +11 -5
- package/src/read-more/edit.js +1 -0
- package/src/read-more/index.php +4 -0
- package/src/rss/index.php +4 -0
- package/src/search/edit.js +2 -0
- package/src/search/edit.native.js +2 -2
- package/src/search/index.php +19 -1
- package/src/shortcode/index.php +4 -0
- package/src/site-logo/index.php +20 -0
- package/src/site-tagline/index.php +4 -0
- package/src/site-title/index.php +4 -0
- package/src/social-link/edit.js +1 -1
- package/src/social-link/icons/medium.js +1 -1
- package/src/social-link/icons/reddit.js +1 -1
- package/src/social-link/index.php +22 -9
- package/src/social-link/socials-with-bg.scss +1 -1
- package/src/social-link/socials-without-bg.scss +1 -1
- package/src/table/block.json +1 -1
- package/src/table/deprecated.js +308 -175
- package/src/tag-cloud/index.php +4 -0
- package/src/template-part/edit/index.js +1 -1
- package/src/template-part/index.php +10 -0
- package/src/term-description/index.php +4 -0
- package/src/video/edit.native.js +2 -0
- package/tsconfig.json +1 -0
|
@@ -8,6 +8,8 @@
|
|
|
8
8
|
/**
|
|
9
9
|
* Renders the `core/comments-pagination-next` block on the server.
|
|
10
10
|
*
|
|
11
|
+
* @since 6.0.0
|
|
12
|
+
*
|
|
11
13
|
* @param array $attributes Block attributes.
|
|
12
14
|
* @param string $content Block default content.
|
|
13
15
|
* @param WP_Block $block Block instance.
|
|
@@ -48,6 +50,8 @@ function render_block_core_comments_pagination_next( $attributes, $content, $blo
|
|
|
48
50
|
|
|
49
51
|
/**
|
|
50
52
|
* Registers the `core/comments-pagination-next` block on the server.
|
|
53
|
+
*
|
|
54
|
+
* @since 6.0.0
|
|
51
55
|
*/
|
|
52
56
|
function register_block_core_comments_pagination_next() {
|
|
53
57
|
register_block_type_from_metadata(
|
|
@@ -8,6 +8,8 @@
|
|
|
8
8
|
/**
|
|
9
9
|
* Renders the `core/comments-pagination-numbers` block on the server.
|
|
10
10
|
*
|
|
11
|
+
* @since 6.0.0
|
|
12
|
+
*
|
|
11
13
|
* @param array $attributes Block attributes.
|
|
12
14
|
* @param string $content Block default content.
|
|
13
15
|
* @param WP_Block $block Block instance.
|
|
@@ -50,6 +52,8 @@ function render_block_core_comments_pagination_numbers( $attributes, $content, $
|
|
|
50
52
|
|
|
51
53
|
/**
|
|
52
54
|
* Registers the `core/comments-pagination-numbers` block on the server.
|
|
55
|
+
*
|
|
56
|
+
* @since 6.0.0
|
|
53
57
|
*/
|
|
54
58
|
function register_block_core_comments_pagination_numbers() {
|
|
55
59
|
register_block_type_from_metadata(
|
|
@@ -8,6 +8,8 @@
|
|
|
8
8
|
/**
|
|
9
9
|
* Renders the `core/comments-pagination-previous` block on the server.
|
|
10
10
|
*
|
|
11
|
+
* @since 6.0.0
|
|
12
|
+
*
|
|
11
13
|
* @param array $attributes Block attributes.
|
|
12
14
|
* @param string $content Block default content.
|
|
13
15
|
* @param WP_Block $block Block instance.
|
|
@@ -40,6 +42,8 @@ function render_block_core_comments_pagination_previous( $attributes, $content,
|
|
|
40
42
|
|
|
41
43
|
/**
|
|
42
44
|
* Registers the `core/comments-pagination-previous` block on the server.
|
|
45
|
+
*
|
|
46
|
+
* @since 6.0.0
|
|
43
47
|
*/
|
|
44
48
|
function register_block_core_comments_pagination_previous() {
|
|
45
49
|
register_block_type_from_metadata(
|
|
@@ -8,6 +8,8 @@
|
|
|
8
8
|
/**
|
|
9
9
|
* Renders the `core/comments-title` block on the server.
|
|
10
10
|
*
|
|
11
|
+
* @since 6.0.0
|
|
12
|
+
*
|
|
11
13
|
* @param array $attributes Block attributes.
|
|
12
14
|
*
|
|
13
15
|
* @return string Return the post comments title.
|
|
@@ -84,6 +86,8 @@ function render_block_core_comments_title( $attributes ) {
|
|
|
84
86
|
|
|
85
87
|
/**
|
|
86
88
|
* Registers the `core/comments-title` block on the server.
|
|
89
|
+
*
|
|
90
|
+
* @since 6.0.0
|
|
87
91
|
*/
|
|
88
92
|
function register_block_core_comments_title() {
|
|
89
93
|
register_block_type_from_metadata(
|
package/src/cover/edit/index.js
CHANGED
|
@@ -489,6 +489,9 @@ function CoverEdit( {
|
|
|
489
489
|
getPositionClassName( contentPosition )
|
|
490
490
|
);
|
|
491
491
|
|
|
492
|
+
const showOverlay =
|
|
493
|
+
url || ! useFeaturedImage || ( useFeaturedImage && ! url );
|
|
494
|
+
|
|
492
495
|
return (
|
|
493
496
|
<>
|
|
494
497
|
{ blockControls }
|
|
@@ -500,7 +503,7 @@ function CoverEdit( {
|
|
|
500
503
|
data-url={ url }
|
|
501
504
|
>
|
|
502
505
|
{ resizeListener }
|
|
503
|
-
{
|
|
506
|
+
{ showOverlay && (
|
|
504
507
|
<span
|
|
505
508
|
aria-hidden="true"
|
|
506
509
|
className={ classnames(
|
package/src/cover/index.php
CHANGED
|
@@ -8,6 +8,8 @@
|
|
|
8
8
|
/**
|
|
9
9
|
* Renders the `core/cover` block on server.
|
|
10
10
|
*
|
|
11
|
+
* @since 6.0.0
|
|
12
|
+
*
|
|
11
13
|
* @param array $attributes The block attributes.
|
|
12
14
|
* @param string $content The block rendered content.
|
|
13
15
|
*
|
|
@@ -66,6 +68,8 @@ function render_block_core_cover( $attributes, $content ) {
|
|
|
66
68
|
|
|
67
69
|
/**
|
|
68
70
|
* Registers the `core/cover` block renderer on server.
|
|
71
|
+
*
|
|
72
|
+
* @since 6.0.0
|
|
69
73
|
*/
|
|
70
74
|
function register_block_core_cover() {
|
|
71
75
|
register_block_type_from_metadata(
|
package/src/details/edit.js
CHANGED
|
@@ -64,6 +64,7 @@ function DetailsEdit( { attributes, setAttributes, clientId } ) {
|
|
|
64
64
|
>
|
|
65
65
|
<summary onClick={ ( event ) => event.preventDefault() }>
|
|
66
66
|
<RichText
|
|
67
|
+
identifier="summary"
|
|
67
68
|
aria-label={ __( 'Write summary' ) }
|
|
68
69
|
placeholder={ __( 'Write summary…' ) }
|
|
69
70
|
allowedFormats={ [] }
|
package/src/file/edit.js
CHANGED
|
@@ -254,6 +254,7 @@ function FileEdit( { attributes, isSelected, setAttributes, clientId } ) {
|
|
|
254
254
|
) }
|
|
255
255
|
<div className={ 'wp-block-file__content-wrapper' }>
|
|
256
256
|
<RichText
|
|
257
|
+
identifier="fileName"
|
|
257
258
|
tagName="a"
|
|
258
259
|
value={ fileName }
|
|
259
260
|
placeholder={ __( 'Write file name…' ) }
|
|
@@ -273,6 +274,7 @@ function FileEdit( { attributes, isSelected, setAttributes, clientId } ) {
|
|
|
273
274
|
>
|
|
274
275
|
{ /* Using RichText here instead of PlainText so that it can be styled like a button. */ }
|
|
275
276
|
<RichText
|
|
277
|
+
identifier="downloadButtonText"
|
|
276
278
|
tagName="div" // Must be block-level or else cursor disappears.
|
|
277
279
|
aria-label={ __( 'Download button text' ) }
|
|
278
280
|
className={ classnames(
|
package/src/file/editor.scss
CHANGED
package/src/file/index.php
CHANGED
|
@@ -8,6 +8,8 @@
|
|
|
8
8
|
/**
|
|
9
9
|
* When the `core/file` block is rendering, check if we need to enqueue the `wp-block-file-view` script.
|
|
10
10
|
*
|
|
11
|
+
* @since 5.8.0
|
|
12
|
+
*
|
|
11
13
|
* @param array $attributes The block attributes.
|
|
12
14
|
* @param string $content The block content.
|
|
13
15
|
* @param WP_Block $block The parsed block.
|
|
@@ -65,6 +67,8 @@ function render_block_core_file( $attributes, $content ) {
|
|
|
65
67
|
|
|
66
68
|
/**
|
|
67
69
|
* Registers the `core/file` block on server.
|
|
70
|
+
*
|
|
71
|
+
* @since 5.8.0
|
|
68
72
|
*/
|
|
69
73
|
function register_block_core_file() {
|
|
70
74
|
register_block_type_from_metadata(
|
package/src/gallery/index.php
CHANGED
|
@@ -13,6 +13,8 @@
|
|
|
13
13
|
* we add a custom `data-id` attribute before rendering the gallery
|
|
14
14
|
* so that the Image Block can pick it up in its render_callback.
|
|
15
15
|
*
|
|
16
|
+
* @since 5.9.0
|
|
17
|
+
*
|
|
16
18
|
* @param array $parsed_block The block being rendered.
|
|
17
19
|
* @return array The migrated block object.
|
|
18
20
|
*/
|
|
@@ -35,6 +37,8 @@ add_filter( 'render_block_data', 'block_core_gallery_data_id_backcompatibility'
|
|
|
35
37
|
/**
|
|
36
38
|
* Renders the `core/gallery` block on the server.
|
|
37
39
|
*
|
|
40
|
+
* @since 6.0.0
|
|
41
|
+
*
|
|
38
42
|
* @param array $attributes Attributes of the block being rendered.
|
|
39
43
|
* @param string $content Content of the block being rendered.
|
|
40
44
|
* @return string The content of the block being rendered.
|
|
@@ -164,6 +168,8 @@ function block_core_gallery_render( $attributes, $content ) {
|
|
|
164
168
|
}
|
|
165
169
|
/**
|
|
166
170
|
* Registers the `core/gallery` block on server.
|
|
171
|
+
*
|
|
172
|
+
* @since 5.9.0
|
|
167
173
|
*/
|
|
168
174
|
function register_block_core_gallery() {
|
|
169
175
|
register_block_type_from_metadata(
|
package/src/heading/index.js
CHANGED
|
@@ -30,15 +30,16 @@ export const settings = {
|
|
|
30
30
|
const { content, level } = attributes;
|
|
31
31
|
|
|
32
32
|
const customName = attributes?.metadata?.name;
|
|
33
|
+
const hasContent = content?.trim().length > 0;
|
|
33
34
|
|
|
34
35
|
// In the list view, use the block's content as the label.
|
|
35
36
|
// If the content is empty, fall back to the default label.
|
|
36
|
-
if ( context === 'list-view' && ( customName ||
|
|
37
|
-
return
|
|
37
|
+
if ( context === 'list-view' && ( customName || hasContent ) ) {
|
|
38
|
+
return customName || content;
|
|
38
39
|
}
|
|
39
40
|
|
|
40
41
|
if ( context === 'accessibility' ) {
|
|
41
|
-
return !
|
|
42
|
+
return ! hasContent
|
|
42
43
|
? sprintf(
|
|
43
44
|
/* translators: accessibility text. %s: heading level. */
|
|
44
45
|
__( 'Level %s. Empty.' ),
|
package/src/heading/index.php
CHANGED
|
@@ -14,6 +14,8 @@
|
|
|
14
14
|
* Would be transformed to:
|
|
15
15
|
* <h2 class="align-left wp-block-heading">Hello World</h2>
|
|
16
16
|
*
|
|
17
|
+
* @since 6.2.0
|
|
18
|
+
*
|
|
17
19
|
* @param array $attributes Attributes of the block being rendered.
|
|
18
20
|
* @param string $content Content of the block being rendered.
|
|
19
21
|
*
|
|
@@ -39,6 +41,8 @@ function block_core_heading_render( $attributes, $content ) {
|
|
|
39
41
|
|
|
40
42
|
/**
|
|
41
43
|
* Registers the `core/heading` block on server.
|
|
44
|
+
*
|
|
45
|
+
* @since 6.2.0
|
|
42
46
|
*/
|
|
43
47
|
function register_block_core_heading() {
|
|
44
48
|
register_block_type_from_metadata(
|
package/src/home-link/index.php
CHANGED
|
@@ -9,6 +9,8 @@
|
|
|
9
9
|
* Build an array with CSS classes and inline styles defining the colors
|
|
10
10
|
* which will be applied to the home link markup in the front-end.
|
|
11
11
|
*
|
|
12
|
+
* @since 6.0.0
|
|
13
|
+
*
|
|
12
14
|
* @param array $context home link block context.
|
|
13
15
|
* @return array Colors CSS classes and inline styles.
|
|
14
16
|
*/
|
|
@@ -61,6 +63,8 @@ function block_core_home_link_build_css_colors( $context ) {
|
|
|
61
63
|
* Build an array with CSS classes and inline styles defining the font sizes
|
|
62
64
|
* which will be applied to the home link markup in the front-end.
|
|
63
65
|
*
|
|
66
|
+
* @since 6.0.0
|
|
67
|
+
*
|
|
64
68
|
* @param array $context Home link block context.
|
|
65
69
|
* @return array Font size CSS classes and inline styles.
|
|
66
70
|
*/
|
|
@@ -88,6 +92,8 @@ function block_core_home_link_build_css_font_sizes( $context ) {
|
|
|
88
92
|
/**
|
|
89
93
|
* Builds an array with classes and style for the li wrapper
|
|
90
94
|
*
|
|
95
|
+
* @since 6.0.0
|
|
96
|
+
*
|
|
91
97
|
* @param array $context Home link block context.
|
|
92
98
|
* @return string The li wrapper attributes.
|
|
93
99
|
*/
|
|
@@ -121,6 +127,8 @@ function block_core_home_link_build_li_wrapper_attributes( $context ) {
|
|
|
121
127
|
/**
|
|
122
128
|
* Renders the `core/home-link` block.
|
|
123
129
|
*
|
|
130
|
+
* @since 6.0.0
|
|
131
|
+
*
|
|
124
132
|
* @param array $attributes The block attributes.
|
|
125
133
|
* @param string $content The saved content.
|
|
126
134
|
* @param WP_Block $block The parsed block.
|
|
@@ -155,6 +163,8 @@ function render_block_core_home_link( $attributes, $content, $block ) {
|
|
|
155
163
|
/**
|
|
156
164
|
* Register the home block
|
|
157
165
|
*
|
|
166
|
+
* @since 6.0.0
|
|
167
|
+
*
|
|
158
168
|
* @uses render_block_core_home_link()
|
|
159
169
|
* @throws WP_Error An WP_Error exception parsing the block definition.
|
|
160
170
|
*/
|
package/src/image/editor.scss
CHANGED
|
@@ -2,11 +2,6 @@
|
|
|
2
2
|
// @todo: this particular minimal style of placeholder could be componentized further.
|
|
3
3
|
.wp-block-image.wp-block-image {
|
|
4
4
|
|
|
5
|
-
&:not(.is-selected) .components-placeholder__fieldset {
|
|
6
|
-
// Show only is selected.
|
|
7
|
-
display: none;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
5
|
// Show Placeholder style on-select.
|
|
11
6
|
&.is-selected .components-placeholder {
|
|
12
7
|
// Block UI appearance.
|
package/src/image/index.php
CHANGED
|
@@ -9,6 +9,8 @@
|
|
|
9
9
|
* Renders the `core/image` block on the server,
|
|
10
10
|
* adding a data-id attribute to the element if core/gallery has added on pre-render.
|
|
11
11
|
*
|
|
12
|
+
* @since 5.9.0
|
|
13
|
+
*
|
|
12
14
|
* @param array $attributes The block attributes.
|
|
13
15
|
* @param string $content The block content.
|
|
14
16
|
* @param WP_Block $block The block object.
|
|
@@ -85,6 +87,8 @@ function render_block_core_image( $attributes, $content, $block ) {
|
|
|
85
87
|
*
|
|
86
88
|
* This is used to determine whether the lightbox should be rendered or not.
|
|
87
89
|
*
|
|
90
|
+
* @since 6.4.0
|
|
91
|
+
*
|
|
88
92
|
* @param array $block Block data.
|
|
89
93
|
*
|
|
90
94
|
* @return array Filtered block data.
|
|
@@ -115,6 +119,8 @@ function block_core_image_get_lightbox_settings( $block ) {
|
|
|
115
119
|
/**
|
|
116
120
|
* Adds the directives and layout needed for the lightbox behavior.
|
|
117
121
|
*
|
|
122
|
+
* @since 6.4.0
|
|
123
|
+
*
|
|
118
124
|
* @param string $block_content Rendered block content.
|
|
119
125
|
* @param array $block Block object.
|
|
120
126
|
*
|
|
@@ -219,6 +225,9 @@ function block_core_image_render_lightbox( $block_content, $block ) {
|
|
|
219
225
|
return $body_content;
|
|
220
226
|
}
|
|
221
227
|
|
|
228
|
+
/**
|
|
229
|
+
* @since 6.5.0
|
|
230
|
+
*/
|
|
222
231
|
function block_core_image_print_lightbox_overlay() {
|
|
223
232
|
$close_button_label = esc_attr__( 'Close' );
|
|
224
233
|
|
|
@@ -238,7 +247,7 @@ function block_core_image_print_lightbox_overlay() {
|
|
|
238
247
|
}
|
|
239
248
|
|
|
240
249
|
echo <<<HTML
|
|
241
|
-
<div
|
|
250
|
+
<div
|
|
242
251
|
class="wp-lightbox-overlay zoom"
|
|
243
252
|
data-wp-interactive="core/image"
|
|
244
253
|
data-wp-context='{}'
|
|
@@ -278,6 +287,8 @@ HTML;
|
|
|
278
287
|
|
|
279
288
|
/**
|
|
280
289
|
* Registers the `core/image` block on server.
|
|
290
|
+
*
|
|
291
|
+
* @since 5.9.0
|
|
281
292
|
*/
|
|
282
293
|
function register_block_core_image() {
|
|
283
294
|
register_block_type_from_metadata(
|
|
@@ -36,6 +36,8 @@ function wp_latest_comments_draft_or_post_title( $post = 0 ) {
|
|
|
36
36
|
/**
|
|
37
37
|
* Renders the `core/latest-comments` block on server.
|
|
38
38
|
*
|
|
39
|
+
* @since 5.1.0
|
|
40
|
+
*
|
|
39
41
|
* @param array $attributes The block attributes.
|
|
40
42
|
*
|
|
41
43
|
* @return string Returns the post content with latest comments added.
|
|
@@ -145,6 +147,8 @@ function render_block_core_latest_comments( $attributes = array() ) {
|
|
|
145
147
|
|
|
146
148
|
/**
|
|
147
149
|
* Registers the `core/latest-comments` block.
|
|
150
|
+
*
|
|
151
|
+
* @since 5.3.0
|
|
148
152
|
*/
|
|
149
153
|
function register_block_core_latest_comments() {
|
|
150
154
|
register_block_type_from_metadata(
|
|
@@ -18,6 +18,8 @@ $block_core_latest_posts_excerpt_length = 0;
|
|
|
18
18
|
* Callback for the excerpt_length filter used by
|
|
19
19
|
* the Latest Posts block at render time.
|
|
20
20
|
*
|
|
21
|
+
* @since 5.4.0
|
|
22
|
+
*
|
|
21
23
|
* @return int Returns the global $block_core_latest_posts_excerpt_length variable
|
|
22
24
|
* to allow the excerpt_length filter respect the Latest Block setting.
|
|
23
25
|
*/
|
|
@@ -29,6 +31,8 @@ function block_core_latest_posts_get_excerpt_length() {
|
|
|
29
31
|
/**
|
|
30
32
|
* Renders the `core/latest-posts` block on server.
|
|
31
33
|
*
|
|
34
|
+
* @since 5.0.0
|
|
35
|
+
*
|
|
32
36
|
* @param array $attributes The block attributes.
|
|
33
37
|
*
|
|
34
38
|
* @return string Returns the post content with latest posts added.
|
|
@@ -218,6 +222,8 @@ function render_block_core_latest_posts( $attributes ) {
|
|
|
218
222
|
|
|
219
223
|
/**
|
|
220
224
|
* Registers the `core/latest-posts` block on server.
|
|
225
|
+
*
|
|
226
|
+
* @since 5.0.0
|
|
221
227
|
*/
|
|
222
228
|
function register_block_core_latest_posts() {
|
|
223
229
|
register_block_type_from_metadata(
|
|
@@ -241,6 +247,8 @@ add_action( 'init', 'register_block_core_latest_posts' );
|
|
|
241
247
|
* TODO: Remove when and if the bottom client-side deprecation for this block
|
|
242
248
|
* is removed.
|
|
243
249
|
*
|
|
250
|
+
* @since 5.5.0
|
|
251
|
+
*
|
|
244
252
|
* @param array $block A single parsed block object.
|
|
245
253
|
*
|
|
246
254
|
* @return array The migrated block object.
|
package/src/loginout/index.php
CHANGED
|
@@ -8,6 +8,8 @@
|
|
|
8
8
|
/**
|
|
9
9
|
* Renders the `core/loginout` block on server.
|
|
10
10
|
*
|
|
11
|
+
* @since 5.8.0
|
|
12
|
+
*
|
|
11
13
|
* @param array $attributes The block attributes.
|
|
12
14
|
*
|
|
13
15
|
* @return string Returns the login-out link or form.
|
|
@@ -39,6 +41,8 @@ function render_block_core_loginout( $attributes ) {
|
|
|
39
41
|
|
|
40
42
|
/**
|
|
41
43
|
* Registers the `core/loginout` block on server.
|
|
44
|
+
*
|
|
45
|
+
* @since 5.8.0
|
|
42
46
|
*/
|
|
43
47
|
function register_block_core_loginout() {
|
|
44
48
|
register_block_type_from_metadata(
|
|
@@ -92,8 +92,13 @@
|
|
|
92
92
|
},
|
|
93
93
|
"allowedBlocks": {
|
|
94
94
|
"type": "array"
|
|
95
|
+
},
|
|
96
|
+
"useFeaturedImage": {
|
|
97
|
+
"type": "boolean",
|
|
98
|
+
"default": false
|
|
95
99
|
}
|
|
96
100
|
},
|
|
101
|
+
"usesContext": [ "postId", "postType" ],
|
|
97
102
|
"supports": {
|
|
98
103
|
"anchor": true,
|
|
99
104
|
"align": [ "wide", "full" ],
|
package/src/media-text/edit.js
CHANGED
|
@@ -31,7 +31,7 @@ import {
|
|
|
31
31
|
} from '@wordpress/components';
|
|
32
32
|
import { isBlobURL, getBlobTypeByURL } from '@wordpress/blob';
|
|
33
33
|
import { pullLeft, pullRight } from '@wordpress/icons';
|
|
34
|
-
import { store as coreStore } from '@wordpress/core-data';
|
|
34
|
+
import { useEntityProp, store as coreStore } from '@wordpress/core-data';
|
|
35
35
|
|
|
36
36
|
/**
|
|
37
37
|
* Internal dependencies
|
|
@@ -127,7 +127,12 @@ function attributesFromMedia( {
|
|
|
127
127
|
};
|
|
128
128
|
}
|
|
129
129
|
|
|
130
|
-
function MediaTextEdit( {
|
|
130
|
+
function MediaTextEdit( {
|
|
131
|
+
attributes,
|
|
132
|
+
isSelected,
|
|
133
|
+
setAttributes,
|
|
134
|
+
context: { postId, postType },
|
|
135
|
+
} ) {
|
|
131
136
|
const {
|
|
132
137
|
focalPoint,
|
|
133
138
|
href,
|
|
@@ -145,9 +150,42 @@ function MediaTextEdit( { attributes, isSelected, setAttributes } ) {
|
|
|
145
150
|
rel,
|
|
146
151
|
verticalAlignment,
|
|
147
152
|
allowedBlocks,
|
|
153
|
+
useFeaturedImage,
|
|
148
154
|
} = attributes;
|
|
149
155
|
const mediaSizeSlug = attributes.mediaSizeSlug || DEFAULT_MEDIA_SIZE_SLUG;
|
|
150
156
|
|
|
157
|
+
const [ featuredImage ] = useEntityProp(
|
|
158
|
+
'postType',
|
|
159
|
+
postType,
|
|
160
|
+
'featured_media',
|
|
161
|
+
postId
|
|
162
|
+
);
|
|
163
|
+
|
|
164
|
+
const featuredImageMedia = useSelect(
|
|
165
|
+
( select ) =>
|
|
166
|
+
featuredImage &&
|
|
167
|
+
select( coreStore ).getMedia( featuredImage, { context: 'view' } ),
|
|
168
|
+
[ featuredImage ]
|
|
169
|
+
);
|
|
170
|
+
|
|
171
|
+
const featuredImageURL = useFeaturedImage
|
|
172
|
+
? featuredImageMedia?.source_url
|
|
173
|
+
: '';
|
|
174
|
+
const featuredImageAlt = useFeaturedImage
|
|
175
|
+
? featuredImageMedia?.alt_text
|
|
176
|
+
: '';
|
|
177
|
+
|
|
178
|
+
const toggleUseFeaturedImage = () => {
|
|
179
|
+
setAttributes( {
|
|
180
|
+
imageFill: false,
|
|
181
|
+
mediaType: 'image',
|
|
182
|
+
mediaId: undefined,
|
|
183
|
+
mediaUrl: undefined,
|
|
184
|
+
mediaAlt: undefined,
|
|
185
|
+
useFeaturedImage: ! useFeaturedImage,
|
|
186
|
+
} );
|
|
187
|
+
};
|
|
188
|
+
|
|
151
189
|
const { imageSizes, image } = useSelect(
|
|
152
190
|
( select ) => {
|
|
153
191
|
const { getSettings } = select( blockEditorStore );
|
|
@@ -261,25 +299,30 @@ function MediaTextEdit( { attributes, isSelected, setAttributes } ) {
|
|
|
261
299
|
}
|
|
262
300
|
/>
|
|
263
301
|
) }
|
|
264
|
-
{ imageFill &&
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
302
|
+
{ imageFill &&
|
|
303
|
+
( mediaUrl || featuredImageURL ) &&
|
|
304
|
+
mediaType === 'image' && (
|
|
305
|
+
<FocalPointPicker
|
|
306
|
+
__nextHasNoMarginBottom
|
|
307
|
+
label={ __( 'Focal point' ) }
|
|
308
|
+
url={
|
|
309
|
+
useFeaturedImage && featuredImageURL
|
|
310
|
+
? featuredImageURL
|
|
311
|
+
: mediaUrl
|
|
312
|
+
}
|
|
313
|
+
value={ focalPoint }
|
|
314
|
+
onChange={ ( value ) =>
|
|
315
|
+
setAttributes( { focalPoint: value } )
|
|
316
|
+
}
|
|
317
|
+
onDragStart={ imperativeFocalPointPreview }
|
|
318
|
+
onDrag={ imperativeFocalPointPreview }
|
|
319
|
+
/>
|
|
320
|
+
) }
|
|
321
|
+
{ mediaType === 'image' && ( mediaUrl || featuredImageURL ) && (
|
|
279
322
|
<TextareaControl
|
|
280
323
|
__nextHasNoMarginBottom
|
|
281
324
|
label={ __( 'Alternative text' ) }
|
|
282
|
-
value={ mediaAlt }
|
|
325
|
+
value={ mediaAlt || featuredImageAlt }
|
|
283
326
|
onChange={ onMediaAltChange }
|
|
284
327
|
help={
|
|
285
328
|
<>
|
|
@@ -353,7 +396,11 @@ function MediaTextEdit( { attributes, isSelected, setAttributes } ) {
|
|
|
353
396
|
onChangeUrl={ onSetHref }
|
|
354
397
|
linkDestination={ linkDestination }
|
|
355
398
|
mediaType={ mediaType }
|
|
356
|
-
mediaUrl={
|
|
399
|
+
mediaUrl={
|
|
400
|
+
useFeaturedImage && featuredImageURL
|
|
401
|
+
? featuredImageURL
|
|
402
|
+
: image && image.source_url
|
|
403
|
+
}
|
|
357
404
|
mediaLink={ image && image.link }
|
|
358
405
|
linkTarget={ linkTarget }
|
|
359
406
|
linkClass={ linkClass }
|
|
@@ -370,6 +417,7 @@ function MediaTextEdit( { attributes, isSelected, setAttributes } ) {
|
|
|
370
417
|
commitWidthChange={ commitWidthChange }
|
|
371
418
|
ref={ refMediaContainer }
|
|
372
419
|
enableResize={ blockEditingMode === 'default' }
|
|
420
|
+
toggleUseFeaturedImage={ toggleUseFeaturedImage }
|
|
373
421
|
{ ...{
|
|
374
422
|
focalPoint,
|
|
375
423
|
imageFill,
|
|
@@ -381,6 +429,9 @@ function MediaTextEdit( { attributes, isSelected, setAttributes } ) {
|
|
|
381
429
|
mediaType,
|
|
382
430
|
mediaUrl,
|
|
383
431
|
mediaWidth,
|
|
432
|
+
useFeaturedImage,
|
|
433
|
+
featuredImageURL,
|
|
434
|
+
featuredImageAlt,
|
|
384
435
|
} }
|
|
385
436
|
/>
|
|
386
437
|
{ mediaPosition !== 'right' && <div { ...innerBlocksProps } /> }
|
|
@@ -26,7 +26,8 @@
|
|
|
26
26
|
width: 100% !important;
|
|
27
27
|
}
|
|
28
28
|
|
|
29
|
-
.wp-block-media-text.is-image-fill .editor-media-container__resizer
|
|
29
|
+
.wp-block-media-text.is-image-fill .editor-media-container__resizer,
|
|
30
|
+
.wp-block-media-text.is-image-fill .components-placeholder.has-illustration {
|
|
30
31
|
// The resizer sets an inline height but for the image fill we set it to full height.
|
|
31
32
|
height: 100% !important;
|
|
32
33
|
}
|
|
@@ -34,3 +35,8 @@
|
|
|
34
35
|
.wp-block-media-text > .block-editor-block-list__layout > .block-editor-block-list__block {
|
|
35
36
|
max-width: unset;
|
|
36
37
|
}
|
|
38
|
+
|
|
39
|
+
/* Make the featured image placeholder the same height as the media selection area. */
|
|
40
|
+
.wp-block-media-text--placeholder-image {
|
|
41
|
+
min-height: 205px;
|
|
42
|
+
}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
<?php
|
|
2
|
+
/**
|
|
3
|
+
* Server-side rendering of the `core/media-text` block.
|
|
4
|
+
*
|
|
5
|
+
* @package WordPress
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Renders the `core/media-text` block on server.
|
|
10
|
+
*
|
|
11
|
+
* @since 6.6.0
|
|
12
|
+
*
|
|
13
|
+
* @param array $attributes The block attributes.
|
|
14
|
+
* @param string $content The block rendered content.
|
|
15
|
+
*
|
|
16
|
+
* @return string Returns the Media & Text block markup, if useFeaturedImage is true.
|
|
17
|
+
*/
|
|
18
|
+
function render_block_core_media_text( $attributes, $content ) {
|
|
19
|
+
if ( false === $attributes['useFeaturedImage'] ) {
|
|
20
|
+
return $content;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
if ( in_the_loop() ) {
|
|
24
|
+
update_post_thumbnail_cache();
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
$current_featured_image = get_the_post_thumbnail_url();
|
|
28
|
+
if ( ! $current_featured_image ) {
|
|
29
|
+
return $content;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
$image_tag = '<figure class="wp-block-media-text__media"><img>';
|
|
33
|
+
$content = preg_replace( '/<figure\s+class="wp-block-media-text__media">/', $image_tag, $content );
|
|
34
|
+
|
|
35
|
+
$processor = new WP_HTML_Tag_Processor( $content );
|
|
36
|
+
if ( isset( $attributes['imageFill'] ) && $attributes['imageFill'] ) {
|
|
37
|
+
$position = '50% 50%';
|
|
38
|
+
if ( isset( $attributes['focalPoint'] ) ) {
|
|
39
|
+
$position = round( $attributes['focalPoint']['x'] * 100 ) . '% ' . round( $attributes['focalPoint']['y'] * 100 ) . '%';
|
|
40
|
+
}
|
|
41
|
+
$processor->next_tag( 'figure' );
|
|
42
|
+
$processor->set_attribute( 'style', 'background-image:url(' . esc_url( $current_featured_image ) . ');background-position:' . $position . ';' );
|
|
43
|
+
}
|
|
44
|
+
$processor->next_tag( 'img' );
|
|
45
|
+
$media_size_slug = 'full';
|
|
46
|
+
if ( isset( $attributes['mediaSizeSlug'] ) ) {
|
|
47
|
+
$media_size_slug = $attributes['mediaSizeSlug'];
|
|
48
|
+
}
|
|
49
|
+
$processor->set_attribute( 'src', esc_url( $current_featured_image ) );
|
|
50
|
+
$processor->set_attribute( 'class', 'wp-image-' . get_post_thumbnail_id() . ' size-' . $media_size_slug );
|
|
51
|
+
|
|
52
|
+
$content = $processor->get_updated_html();
|
|
53
|
+
|
|
54
|
+
return $content;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* Registers the `core/media-text` block renderer on server.
|
|
59
|
+
*
|
|
60
|
+
* @since 6.6.0
|
|
61
|
+
*/
|
|
62
|
+
function register_block_core_media_text() {
|
|
63
|
+
register_block_type_from_metadata(
|
|
64
|
+
__DIR__ . '/media-text',
|
|
65
|
+
array(
|
|
66
|
+
'render_callback' => 'render_block_core_media_text',
|
|
67
|
+
)
|
|
68
|
+
);
|
|
69
|
+
}
|
|
70
|
+
add_action( 'init', 'register_block_core_media_text' );
|