@wordpress/block-library 9.6.0 → 9.7.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/audio/edit.js +2 -1
- package/build/audio/edit.js.map +1 -1
- package/build/block/edit.js +3 -5
- package/build/block/edit.js.map +1 -1
- package/build/button/edit.js +1 -1
- package/build/button/edit.js.map +1 -1
- package/build/categories/index.js +1 -0
- package/build/categories/index.js.map +1 -1
- package/build/comment-edit-link/index.js +13 -2
- package/build/comment-edit-link/index.js.map +1 -1
- package/build/comment-reply-link/index.js +13 -2
- package/build/comment-reply-link/index.js.map +1 -1
- package/build/comments/edit/comments-legacy.js +4 -1
- package/build/comments/edit/comments-legacy.js.map +1 -1
- package/build/cover/edit/block-controls.js +4 -2
- package/build/cover/edit/block-controls.js.map +1 -1
- package/build/cover/edit/index.js +2 -1
- package/build/cover/edit/index.js.map +1 -1
- package/build/cover/edit/inspector-controls.js +4 -12
- package/build/cover/edit/inspector-controls.js.map +1 -1
- package/build/details/index.js +3 -1
- package/build/details/index.js.map +1 -1
- package/build/details/transforms.js +24 -0
- package/build/details/transforms.js.map +1 -0
- package/build/embed/embed-placeholder.js +8 -2
- package/build/embed/embed-placeholder.js.map +1 -1
- package/build/file/edit.js +12 -1
- package/build/file/edit.js.map +1 -1
- package/build/freeform/edit.js +4 -4
- package/build/freeform/edit.js.map +1 -1
- package/build/freeform/modal.js +12 -3
- package/build/freeform/modal.js.map +1 -1
- package/build/home-link/edit.js +3 -9
- package/build/home-link/edit.js.map +1 -1
- package/build/image/edit.js +44 -34
- package/build/image/edit.js.map +1 -1
- package/build/image/image.js +22 -10
- package/build/image/image.js.map +1 -1
- package/build/media-text/deprecated.js +144 -3
- package/build/media-text/deprecated.js.map +1 -1
- package/build/media-text/edit.js +5 -5
- package/build/media-text/edit.js.map +1 -1
- package/build/media-text/image-fill.js +12 -0
- package/build/media-text/image-fill.js.map +1 -0
- package/build/media-text/media-container.js +21 -18
- package/build/media-text/media-container.js.map +1 -1
- package/build/media-text/media-container.native.js +0 -7
- package/build/media-text/media-container.native.js.map +1 -1
- package/build/media-text/save.js +5 -6
- package/build/media-text/save.js.map +1 -1
- package/build/missing/edit.js +6 -3
- package/build/missing/edit.js.map +1 -1
- package/build/navigation/edit/deleted-navigation-warning.js +4 -1
- package/build/navigation/edit/deleted-navigation-warning.js.map +1 -1
- package/build/navigation/edit/index.js +4 -1
- package/build/navigation/edit/index.js.map +1 -1
- package/build/navigation/edit/navigation-menu-delete-control.js +4 -1
- package/build/navigation/edit/navigation-menu-delete-control.js.map +1 -1
- package/build/navigation/edit/placeholder/index.js +4 -1
- package/build/navigation/edit/placeholder/index.js.map +1 -1
- package/build/navigation/edit/responsive-wrapper.js +8 -2
- package/build/navigation/edit/responsive-wrapper.js.map +1 -1
- package/build/navigation/edit/unsaved-inner-blocks.js +4 -4
- package/build/navigation/edit/unsaved-inner-blocks.js.map +1 -1
- package/build/navigation-link/link-ui.js +5 -2
- package/build/navigation-link/link-ui.js.map +1 -1
- package/build/page-list/convert-to-links-modal.js +8 -2
- package/build/page-list/convert-to-links-modal.js.map +1 -1
- package/build/page-list/edit.js +7 -2
- package/build/page-list/edit.js.map +1 -1
- package/build/post-comments-form/form.js +4 -1
- package/build/post-comments-form/form.js.map +1 -1
- package/build/post-featured-image/dimension-controls.js +6 -8
- package/build/post-featured-image/dimension-controls.js.map +1 -1
- package/build/post-featured-image/edit.js +5 -5
- package/build/post-featured-image/edit.js.map +1 -1
- package/build/query/edit/enhanced-pagination-modal.js +4 -1
- package/build/query/edit/enhanced-pagination-modal.js.map +1 -1
- package/build/query/edit/query-placeholder.js +8 -2
- package/build/query/edit/query-placeholder.js.map +1 -1
- package/build/site-logo/edit.js +15 -15
- package/build/site-logo/edit.js.map +1 -1
- package/build/social-link/edit.js +4 -1
- package/build/social-link/edit.js.map +1 -1
- package/build/social-links/edit.js +10 -9
- package/build/social-links/edit.js.map +1 -1
- package/build/template-part/edit/advanced-controls.js.map +1 -1
- package/build/template-part/edit/index.js +1 -1
- package/build/template-part/edit/index.js.map +1 -1
- package/build/template-part/edit/placeholder.js +8 -2
- package/build/template-part/edit/placeholder.js.map +1 -1
- package/build/utils/hooks.js +10 -10
- package/build/utils/hooks.js.map +1 -1
- package/build/video/edit.js +22 -14
- package/build/video/edit.js.map +1 -1
- package/build/video/tracks-editor.js +12 -3
- package/build/video/tracks-editor.js.map +1 -1
- package/build-module/audio/edit.js +2 -1
- package/build-module/audio/edit.js.map +1 -1
- package/build-module/block/edit.js +4 -6
- package/build-module/block/edit.js.map +1 -1
- package/build-module/button/edit.js +1 -1
- package/build-module/button/edit.js.map +1 -1
- package/build-module/categories/index.js +1 -0
- package/build-module/categories/index.js.map +1 -1
- package/build-module/comment-edit-link/index.js +13 -2
- package/build-module/comment-edit-link/index.js.map +1 -1
- package/build-module/comment-reply-link/index.js +13 -2
- package/build-module/comment-reply-link/index.js.map +1 -1
- package/build-module/comments/edit/comments-legacy.js +4 -1
- package/build-module/comments/edit/comments-legacy.js.map +1 -1
- package/build-module/cover/edit/block-controls.js +4 -2
- package/build-module/cover/edit/block-controls.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/cover/edit/inspector-controls.js +5 -13
- package/build-module/cover/edit/inspector-controls.js.map +1 -1
- package/build-module/details/index.js +3 -1
- package/build-module/details/index.js.map +1 -1
- package/build-module/details/transforms.js +18 -0
- package/build-module/details/transforms.js.map +1 -0
- package/build-module/embed/embed-placeholder.js +8 -2
- package/build-module/embed/embed-placeholder.js.map +1 -1
- package/build-module/file/edit.js +12 -1
- package/build-module/file/edit.js.map +1 -1
- package/build-module/freeform/edit.js +4 -4
- package/build-module/freeform/edit.js.map +1 -1
- package/build-module/freeform/modal.js +12 -3
- package/build-module/freeform/modal.js.map +1 -1
- package/build-module/home-link/edit.js +3 -9
- package/build-module/home-link/edit.js.map +1 -1
- package/build-module/image/edit.js +45 -34
- package/build-module/image/edit.js.map +1 -1
- package/build-module/image/image.js +23 -11
- package/build-module/image/image.js.map +1 -1
- package/build-module/media-text/deprecated.js +144 -3
- package/build-module/media-text/deprecated.js.map +1 -1
- package/build-module/media-text/edit.js +5 -5
- package/build-module/media-text/edit.js.map +1 -1
- package/build-module/media-text/image-fill.js +6 -0
- package/build-module/media-text/image-fill.js.map +1 -0
- package/build-module/media-text/media-container.js +21 -17
- package/build-module/media-text/media-container.js.map +1 -1
- package/build-module/media-text/media-container.native.js +0 -1
- package/build-module/media-text/media-container.native.js.map +1 -1
- package/build-module/media-text/save.js +5 -6
- package/build-module/media-text/save.js.map +1 -1
- package/build-module/missing/edit.js +6 -3
- package/build-module/missing/edit.js.map +1 -1
- package/build-module/navigation/edit/deleted-navigation-warning.js +4 -1
- package/build-module/navigation/edit/deleted-navigation-warning.js.map +1 -1
- package/build-module/navigation/edit/index.js +4 -1
- package/build-module/navigation/edit/index.js.map +1 -1
- package/build-module/navigation/edit/navigation-menu-delete-control.js +4 -1
- package/build-module/navigation/edit/navigation-menu-delete-control.js.map +1 -1
- package/build-module/navigation/edit/placeholder/index.js +4 -1
- package/build-module/navigation/edit/placeholder/index.js.map +1 -1
- package/build-module/navigation/edit/responsive-wrapper.js +8 -2
- package/build-module/navigation/edit/responsive-wrapper.js.map +1 -1
- package/build-module/navigation/edit/unsaved-inner-blocks.js +4 -4
- package/build-module/navigation/edit/unsaved-inner-blocks.js.map +1 -1
- package/build-module/navigation-link/link-ui.js +7 -4
- package/build-module/navigation-link/link-ui.js.map +1 -1
- package/build-module/page-list/convert-to-links-modal.js +8 -2
- package/build-module/page-list/convert-to-links-modal.js.map +1 -1
- package/build-module/page-list/edit.js +7 -2
- package/build-module/page-list/edit.js.map +1 -1
- package/build-module/post-comments-form/form.js +4 -1
- package/build-module/post-comments-form/form.js.map +1 -1
- package/build-module/post-featured-image/dimension-controls.js +6 -8
- package/build-module/post-featured-image/dimension-controls.js.map +1 -1
- package/build-module/post-featured-image/edit.js +6 -6
- package/build-module/post-featured-image/edit.js.map +1 -1
- package/build-module/query/edit/enhanced-pagination-modal.js +4 -1
- package/build-module/query/edit/enhanced-pagination-modal.js.map +1 -1
- package/build-module/query/edit/query-placeholder.js +8 -2
- package/build-module/query/edit/query-placeholder.js.map +1 -1
- package/build-module/site-logo/edit.js +16 -16
- package/build-module/site-logo/edit.js.map +1 -1
- package/build-module/social-link/edit.js +4 -1
- package/build-module/social-link/edit.js.map +1 -1
- package/build-module/social-links/edit.js +11 -10
- package/build-module/social-links/edit.js.map +1 -1
- package/build-module/template-part/edit/advanced-controls.js.map +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/template-part/edit/placeholder.js +8 -2
- package/build-module/template-part/edit/placeholder.js.map +1 -1
- package/build-module/utils/hooks.js +10 -10
- package/build-module/utils/hooks.js.map +1 -1
- package/build-module/video/edit.js +22 -15
- package/build-module/video/edit.js.map +1 -1
- package/build-module/video/tracks-editor.js +12 -3
- package/build-module/video/tracks-editor.js.map +1 -1
- package/build-style/button/editor-rtl.css +0 -4
- package/build-style/button/editor.css +0 -4
- package/build-style/buttons/editor-rtl.css +0 -3
- package/build-style/buttons/editor.css +0 -3
- package/build-style/comment-edit-link/style-rtl.css +94 -0
- package/build-style/comment-edit-link/style.css +94 -0
- package/build-style/comment-reply-link/style-rtl.css +94 -0
- package/build-style/comment-reply-link/style.css +94 -0
- package/build-style/comments-pagination/editor-rtl.css +2 -2
- package/build-style/comments-pagination/editor.css +2 -2
- package/build-style/cover/editor-rtl.css +0 -6
- package/build-style/cover/editor.css +0 -6
- package/build-style/editor-rtl.css +24 -68
- package/build-style/editor.css +24 -70
- package/build-style/group/editor-rtl.css +0 -1
- package/build-style/group/editor.css +0 -1
- package/build-style/image/editor-rtl.css +0 -1
- package/build-style/image/editor.css +0 -1
- package/build-style/media-text/editor-rtl.css +3 -1
- package/build-style/media-text/editor.css +3 -1
- package/build-style/media-text/style-rtl.css +20 -0
- package/build-style/media-text/style.css +20 -0
- package/build-style/navigation/editor-rtl.css +0 -1
- package/build-style/navigation/editor.css +0 -1
- package/build-style/post-featured-image/style-rtl.css +1 -1
- package/build-style/post-featured-image/style.css +1 -1
- package/build-style/query-pagination/editor-rtl.css +2 -16
- package/build-style/query-pagination/editor.css +2 -18
- package/build-style/query-pagination/style-rtl.css +0 -11
- package/build-style/query-pagination/style.css +0 -13
- package/build-style/site-title/editor-rtl.css +0 -4
- package/build-style/site-title/editor.css +0 -4
- package/build-style/social-links/editor-rtl.css +17 -0
- package/build-style/social-links/editor.css +17 -0
- package/build-style/style-rtl.css +29 -12
- package/build-style/style.css +29 -14
- package/build-style/video/editor-rtl.css +0 -29
- package/build-style/video/editor.css +0 -29
- package/package.json +35 -35
- package/src/audio/edit.js +1 -0
- package/src/block/edit.js +6 -4
- package/src/button/edit.js +1 -1
- package/src/button/editor.scss +0 -5
- package/src/buttons/editor.scss +0 -6
- package/src/categories/block.json +1 -0
- package/src/categories/index.php +13 -2
- package/src/comment-date/index.php +1 -1
- package/src/comment-edit-link/block.json +13 -2
- package/src/comment-edit-link/style.scss +4 -0
- package/src/comment-reply-link/block.json +13 -2
- package/src/comment-reply-link/style.scss +4 -0
- package/src/comments/edit/comments-legacy.js +2 -0
- package/src/comments-pagination/editor.scss +1 -1
- package/src/cover/edit/block-controls.js +2 -0
- package/src/cover/edit/index.js +1 -0
- package/src/cover/edit/inspector-controls.js +3 -15
- package/src/cover/editor.scss +0 -5
- package/src/cover/test/edit.js +30 -26
- package/src/details/index.js +2 -0
- package/src/details/transforms.js +26 -0
- package/src/embed/embed-placeholder.js +12 -2
- package/src/file/edit.js +11 -0
- package/src/form/index.php +2 -2
- package/src/freeform/edit.js +4 -4
- package/src/freeform/editor.scss +1 -1
- package/src/freeform/modal.js +10 -1
- package/src/gallery/editor.scss +1 -1
- package/src/group/editor.scss +0 -1
- package/src/home-link/edit.js +4 -7
- package/src/image/edit.js +42 -30
- package/src/image/editor.scss +0 -3
- package/src/image/image.js +75 -53
- package/src/media-text/deprecated.js +159 -3
- package/src/media-text/edit.js +5 -5
- package/src/media-text/editor.scss +3 -1
- package/src/media-text/image-fill.js +11 -0
- package/src/media-text/index.php +53 -43
- package/src/media-text/media-container.js +25 -25
- package/src/media-text/media-container.native.js +0 -2
- package/src/media-text/save.js +9 -13
- package/src/media-text/style.scss +21 -0
- package/src/media-text/test/image-fill.js +19 -0
- package/src/missing/edit.js +9 -3
- package/src/navigation/edit/deleted-navigation-warning.js +8 -1
- package/src/navigation/edit/index.js +2 -0
- package/src/navigation/edit/navigation-menu-delete-control.js +2 -0
- package/src/navigation/edit/placeholder/index.js +2 -0
- package/src/navigation/edit/responsive-wrapper.js +4 -0
- package/src/navigation/edit/unsaved-inner-blocks.js +4 -4
- package/src/navigation/editor.scss +6 -3
- package/src/navigation-link/link-ui.js +5 -3
- package/src/page-list/convert-to-links-modal.js +8 -1
- package/src/page-list/edit.js +7 -1
- package/src/page-list/index.php +3 -1
- package/src/post-comments-form/form.js +2 -0
- package/src/post-date/index.php +3 -3
- package/src/post-featured-image/dimension-controls.js +4 -4
- package/src/post-featured-image/edit.js +4 -6
- package/src/post-featured-image/style.scss +1 -1
- package/src/query/edit/enhanced-pagination-modal.js +6 -1
- package/src/query/edit/query-placeholder.js +4 -0
- package/src/query-pagination/editor.scss +1 -21
- package/src/query-pagination/style.scss +0 -15
- package/src/site-logo/edit.js +13 -20
- package/src/site-title/editor.scss +0 -4
- package/src/social-link/edit.js +2 -0
- package/src/social-links/edit.js +17 -10
- package/src/social-links/editor.scss +24 -5
- package/src/style.scss +2 -0
- package/src/tag-cloud/index.php +7 -2
- package/src/template-part/edit/advanced-controls.js +0 -1
- package/src/template-part/edit/index.js +12 -10
- package/src/template-part/edit/placeholder.js +8 -1
- package/src/utils/hooks.js +11 -11
- package/src/video/edit.js +26 -21
- package/src/video/editor.scss +0 -45
- package/src/video/tracks-editor.js +6 -0
- package/src/media-text/test/media-container.js +0 -24
package/src/media-text/index.php
CHANGED
|
@@ -29,15 +29,32 @@ function render_block_core_media_text( $attributes, $content ) {
|
|
|
29
29
|
return $content;
|
|
30
30
|
}
|
|
31
31
|
|
|
32
|
+
$has_media_on_right = isset( $attributes['mediaPosition'] ) && 'right' === $attributes['mediaPosition'];
|
|
33
|
+
$image_fill = isset( $attributes['imageFill'] ) && $attributes['imageFill'];
|
|
34
|
+
$focal_point = isset( $attributes['focalPoint'] ) ? round( $attributes['focalPoint']['x'] * 100 ) . '% ' . round( $attributes['focalPoint']['y'] * 100 ) . '%' : '50% 50%';
|
|
35
|
+
$unique_id = 'wp-block-media-text__media-' . wp_unique_id();
|
|
36
|
+
|
|
37
|
+
$block_tag_processor = new WP_HTML_Tag_Processor( $content );
|
|
38
|
+
$block_query = array(
|
|
39
|
+
'tag_name' => 'div',
|
|
40
|
+
'class_name' => 'wp-block-media-text',
|
|
41
|
+
);
|
|
42
|
+
|
|
43
|
+
while ( $block_tag_processor->next_tag( $block_query ) ) {
|
|
44
|
+
if ( $image_fill ) {
|
|
45
|
+
// The markup below does not work with the deprecated `is-image-fill` class.
|
|
46
|
+
$block_tag_processor->remove_class( 'is-image-fill' );
|
|
47
|
+
$block_tag_processor->add_class( 'is-image-fill-element' );
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
$content = $block_tag_processor->get_updated_html();
|
|
52
|
+
|
|
32
53
|
$media_tag_processor = new WP_HTML_Tag_Processor( $content );
|
|
33
54
|
$wrapping_figure_query = array(
|
|
34
55
|
'tag_name' => 'figure',
|
|
35
56
|
'class_name' => 'wp-block-media-text__media',
|
|
36
57
|
);
|
|
37
|
-
$has_media_on_right = isset( $attributes['mediaPosition'] ) && 'right' === $attributes['mediaPosition'];
|
|
38
|
-
$image_fill = isset( $attributes['imageFill'] ) && $attributes['imageFill'];
|
|
39
|
-
$focal_point = isset( $attributes['focalPoint'] ) ? round( $attributes['focalPoint']['x'] * 100 ) . '% ' . round( $attributes['focalPoint']['y'] * 100 ) . '%' : '50% 50%';
|
|
40
|
-
$unique_id = 'wp-block-media-text__media-' . wp_unique_id();
|
|
41
58
|
|
|
42
59
|
if ( $has_media_on_right ) {
|
|
43
60
|
// Loop through all the figure tags and set a bookmark on the last figure tag.
|
|
@@ -46,59 +63,52 @@ function render_block_core_media_text( $attributes, $content ) {
|
|
|
46
63
|
}
|
|
47
64
|
if ( $media_tag_processor->has_bookmark( 'last_figure' ) ) {
|
|
48
65
|
$media_tag_processor->seek( 'last_figure' );
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
} else {
|
|
52
|
-
// Insert a unique ID to identify the figure tag.
|
|
53
|
-
$media_tag_processor->set_attribute( 'id', $unique_id );
|
|
54
|
-
}
|
|
66
|
+
// Insert a unique ID to identify the figure tag.
|
|
67
|
+
$media_tag_processor->set_attribute( 'id', $unique_id );
|
|
55
68
|
}
|
|
56
69
|
} else {
|
|
57
70
|
if ( $media_tag_processor->next_tag( $wrapping_figure_query ) ) {
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
} else {
|
|
61
|
-
// Insert a unique ID to identify the figure tag.
|
|
62
|
-
$media_tag_processor->set_attribute( 'id', $unique_id );
|
|
63
|
-
}
|
|
71
|
+
// Insert a unique ID to identify the figure tag.
|
|
72
|
+
$media_tag_processor->set_attribute( 'id', $unique_id );
|
|
64
73
|
}
|
|
65
74
|
}
|
|
66
75
|
|
|
67
76
|
$content = $media_tag_processor->get_updated_html();
|
|
68
77
|
|
|
69
|
-
//
|
|
70
|
-
//
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
);
|
|
78
|
+
// Add the image tag inside the figure tag, and update the image attributes
|
|
79
|
+
// in order to display the featured image.
|
|
80
|
+
$media_size_slug = isset( $attributes['mediaSizeSlug'] ) ? $attributes['mediaSizeSlug'] : 'full';
|
|
81
|
+
$image_tag = '<img class="wp-block-media-text__featured_image">';
|
|
82
|
+
$content = preg_replace(
|
|
83
|
+
'/(<figure\s+id="' . preg_quote( $unique_id, '/' ) . '"\s+class="wp-block-media-text__media"\s*>)/',
|
|
84
|
+
'$1' . $image_tag,
|
|
85
|
+
$content
|
|
86
|
+
);
|
|
79
87
|
|
|
80
|
-
|
|
88
|
+
$image_tag_processor = new WP_HTML_Tag_Processor( $content );
|
|
89
|
+
if ( $image_tag_processor->next_tag(
|
|
90
|
+
array(
|
|
91
|
+
'tag_name' => 'figure',
|
|
92
|
+
'id' => $unique_id,
|
|
93
|
+
)
|
|
94
|
+
) ) {
|
|
95
|
+
// The ID is only used to ensure that the correct figure tag is selected,
|
|
96
|
+
// and can now be removed.
|
|
97
|
+
$image_tag_processor->remove_attribute( 'id' );
|
|
81
98
|
if ( $image_tag_processor->next_tag(
|
|
82
99
|
array(
|
|
83
|
-
'tag_name'
|
|
84
|
-
'
|
|
100
|
+
'tag_name' => 'img',
|
|
101
|
+
'class_name' => 'wp-block-media-text__featured_image',
|
|
85
102
|
)
|
|
86
103
|
) ) {
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
$image_tag_processor->
|
|
90
|
-
if ( $
|
|
91
|
-
|
|
92
|
-
'tag_name' => 'img',
|
|
93
|
-
'class_name' => 'wp-block-media-text__featured_image',
|
|
94
|
-
)
|
|
95
|
-
) ) {
|
|
96
|
-
$image_tag_processor->set_attribute( 'src', esc_url( $current_featured_image ) );
|
|
97
|
-
$image_tag_processor->set_attribute( 'class', 'wp-image-' . get_post_thumbnail_id() . ' size-' . $media_size_slug );
|
|
98
|
-
$image_tag_processor->set_attribute( 'alt', trim( strip_tags( get_post_meta( get_post_thumbnail_id(), '_wp_attachment_image_alt', true ) ) ) );
|
|
99
|
-
|
|
100
|
-
$content = $image_tag_processor->get_updated_html();
|
|
104
|
+
$image_tag_processor->set_attribute( 'src', esc_url( $current_featured_image ) );
|
|
105
|
+
$image_tag_processor->set_attribute( 'class', 'wp-image-' . get_post_thumbnail_id() . ' size-' . $media_size_slug );
|
|
106
|
+
$image_tag_processor->set_attribute( 'alt', trim( strip_tags( get_post_meta( get_post_thumbnail_id(), '_wp_attachment_image_alt', true ) ) ) );
|
|
107
|
+
if ( $image_fill ) {
|
|
108
|
+
$image_tag_processor->set_attribute( 'style', 'object-position:' . $focal_point . ';' );
|
|
101
109
|
}
|
|
110
|
+
|
|
111
|
+
$content = $image_tag_processor->get_updated_html();
|
|
102
112
|
}
|
|
103
113
|
}
|
|
104
114
|
|
|
@@ -22,25 +22,17 @@ import { isBlobURL } from '@wordpress/blob';
|
|
|
22
22
|
import { store as noticesStore } from '@wordpress/notices';
|
|
23
23
|
import { media as icon } from '@wordpress/icons';
|
|
24
24
|
|
|
25
|
+
/**
|
|
26
|
+
* Internal dependencies
|
|
27
|
+
*/
|
|
28
|
+
import { imageFillStyles } from './image-fill';
|
|
29
|
+
|
|
25
30
|
/**
|
|
26
31
|
* Constants
|
|
27
32
|
*/
|
|
28
33
|
const ALLOWED_MEDIA_TYPES = [ 'image', 'video' ];
|
|
29
34
|
const noop = () => {};
|
|
30
35
|
|
|
31
|
-
export function imageFillStyles( url, focalPoint ) {
|
|
32
|
-
return url
|
|
33
|
-
? {
|
|
34
|
-
backgroundImage: `url(${ url })`,
|
|
35
|
-
backgroundPosition: focalPoint
|
|
36
|
-
? `${ Math.round( focalPoint.x * 100 ) }% ${ Math.round(
|
|
37
|
-
focalPoint.y * 100
|
|
38
|
-
) }%`
|
|
39
|
-
: `50% 50%`,
|
|
40
|
-
}
|
|
41
|
-
: {};
|
|
42
|
-
}
|
|
43
|
-
|
|
44
36
|
const ResizableBoxContainer = forwardRef(
|
|
45
37
|
( { isSelected, isStackedOnMobile, ...props }, ref ) => {
|
|
46
38
|
const isMobile = useViewportMatch( 'small', '<' );
|
|
@@ -62,22 +54,18 @@ function ToolbarEditButton( {
|
|
|
62
54
|
onSelectMedia,
|
|
63
55
|
toggleUseFeaturedImage,
|
|
64
56
|
useFeaturedImage,
|
|
65
|
-
featuredImageURL,
|
|
66
57
|
} ) {
|
|
67
58
|
return (
|
|
68
59
|
<BlockControls group="other">
|
|
69
60
|
<MediaReplaceFlow
|
|
70
61
|
mediaId={ mediaId }
|
|
71
|
-
|
|
72
|
-
useFeaturedImage && featuredImageURL
|
|
73
|
-
? featuredImageURL
|
|
74
|
-
: mediaUrl
|
|
75
|
-
}
|
|
62
|
+
mediaURL={ mediaUrl }
|
|
76
63
|
allowedTypes={ ALLOWED_MEDIA_TYPES }
|
|
77
64
|
accept="image/*,video/*"
|
|
78
65
|
onSelect={ onSelectMedia }
|
|
79
66
|
onToggleFeaturedImage={ toggleUseFeaturedImage }
|
|
80
67
|
useFeaturedImage={ useFeaturedImage }
|
|
68
|
+
onReset={ () => onSelectMedia( undefined ) }
|
|
81
69
|
/>
|
|
82
70
|
</BlockControls>
|
|
83
71
|
);
|
|
@@ -133,6 +121,7 @@ function MediaContainer( props, ref ) {
|
|
|
133
121
|
useFeaturedImage,
|
|
134
122
|
featuredImageURL,
|
|
135
123
|
featuredImageAlt,
|
|
124
|
+
refMedia,
|
|
136
125
|
} = props;
|
|
137
126
|
|
|
138
127
|
const isTemporaryMedia = ! mediaId && isBlobURL( mediaUrl );
|
|
@@ -155,7 +144,7 @@ function MediaContainer( props, ref ) {
|
|
|
155
144
|
left: enableResize && mediaPosition === 'right',
|
|
156
145
|
};
|
|
157
146
|
|
|
158
|
-
const
|
|
147
|
+
const positionStyles =
|
|
159
148
|
mediaType === 'image' && imageFill
|
|
160
149
|
? imageFillStyles( mediaUrl || featuredImageURL, focalPoint )
|
|
161
150
|
: {};
|
|
@@ -163,11 +152,23 @@ function MediaContainer( props, ref ) {
|
|
|
163
152
|
const mediaTypeRenderers = {
|
|
164
153
|
image: () =>
|
|
165
154
|
useFeaturedImage && featuredImageURL ? (
|
|
166
|
-
<img
|
|
155
|
+
<img
|
|
156
|
+
ref={ refMedia }
|
|
157
|
+
src={ featuredImageURL }
|
|
158
|
+
alt={ featuredImageAlt }
|
|
159
|
+
style={ positionStyles }
|
|
160
|
+
/>
|
|
167
161
|
) : (
|
|
168
|
-
mediaUrl &&
|
|
162
|
+
mediaUrl && (
|
|
163
|
+
<img
|
|
164
|
+
ref={ refMedia }
|
|
165
|
+
src={ mediaUrl }
|
|
166
|
+
alt={ mediaAlt }
|
|
167
|
+
style={ positionStyles }
|
|
168
|
+
/>
|
|
169
|
+
)
|
|
169
170
|
),
|
|
170
|
-
video: () => <video controls src={ mediaUrl } />,
|
|
171
|
+
video: () => <video controls ref={ refMedia } src={ mediaUrl } />,
|
|
171
172
|
};
|
|
172
173
|
|
|
173
174
|
return (
|
|
@@ -178,7 +179,6 @@ function MediaContainer( props, ref ) {
|
|
|
178
179
|
'editor-media-container__resizer',
|
|
179
180
|
{ 'is-transient': isTemporaryMedia }
|
|
180
181
|
) }
|
|
181
|
-
style={ backgroundStyles }
|
|
182
182
|
size={ { width: mediaWidth + '%' } }
|
|
183
183
|
minWidth="10%"
|
|
184
184
|
maxWidth="100%"
|
|
@@ -200,7 +200,6 @@ function MediaContainer( props, ref ) {
|
|
|
200
200
|
}
|
|
201
201
|
mediaId={ mediaId }
|
|
202
202
|
toggleUseFeaturedImage={ toggleUseFeaturedImage }
|
|
203
|
-
useFeaturedImage={ useFeaturedImage }
|
|
204
203
|
/>
|
|
205
204
|
{ ( mediaTypeRenderers[ mediaType ] || noop )() }
|
|
206
205
|
{ isTemporaryMedia && <Spinner /> }
|
|
@@ -208,6 +207,7 @@ function MediaContainer( props, ref ) {
|
|
|
208
207
|
{ ! featuredImageURL && useFeaturedImage && (
|
|
209
208
|
<Placeholder
|
|
210
209
|
className="wp-block-media-text--placeholder-image"
|
|
210
|
+
style={ positionStyles }
|
|
211
211
|
withIllustration
|
|
212
212
|
/>
|
|
213
213
|
) }
|
package/src/media-text/save.js
CHANGED
|
@@ -11,7 +11,7 @@ import { useInnerBlocksProps, useBlockProps } from '@wordpress/block-editor';
|
|
|
11
11
|
/**
|
|
12
12
|
* Internal dependencies
|
|
13
13
|
*/
|
|
14
|
-
import { imageFillStyles } from './
|
|
14
|
+
import { imageFillStyles } from './image-fill';
|
|
15
15
|
import { DEFAULT_MEDIA_SIZE_SLUG } from './constants';
|
|
16
16
|
|
|
17
17
|
const DEFAULT_MEDIA_WIDTH = 50;
|
|
@@ -42,11 +42,16 @@ export default function save( { attributes } ) {
|
|
|
42
42
|
[ `size-${ mediaSizeSlug }` ]: mediaId && mediaType === 'image',
|
|
43
43
|
} );
|
|
44
44
|
|
|
45
|
+
const positionStyles = imageFill
|
|
46
|
+
? imageFillStyles( mediaUrl, focalPoint )
|
|
47
|
+
: {};
|
|
48
|
+
|
|
45
49
|
let image = mediaUrl ? (
|
|
46
50
|
<img
|
|
47
51
|
src={ mediaUrl }
|
|
48
52
|
alt={ mediaAlt }
|
|
49
53
|
className={ imageClasses || null }
|
|
54
|
+
style={ positionStyles }
|
|
50
55
|
/>
|
|
51
56
|
) : null;
|
|
52
57
|
|
|
@@ -71,11 +76,8 @@ export default function save( { attributes } ) {
|
|
|
71
76
|
'has-media-on-the-right': 'right' === mediaPosition,
|
|
72
77
|
'is-stacked-on-mobile': isStackedOnMobile,
|
|
73
78
|
[ `is-vertically-aligned-${ verticalAlignment }` ]: verticalAlignment,
|
|
74
|
-
'is-image-fill': imageFill,
|
|
79
|
+
'is-image-fill-element': imageFill,
|
|
75
80
|
} );
|
|
76
|
-
const backgroundStyles = imageFill
|
|
77
|
-
? imageFillStyles( mediaUrl, focalPoint )
|
|
78
|
-
: {};
|
|
79
81
|
|
|
80
82
|
let gridTemplateColumns;
|
|
81
83
|
if ( mediaWidth !== DEFAULT_MEDIA_WIDTH ) {
|
|
@@ -96,10 +98,7 @@ export default function save( { attributes } ) {
|
|
|
96
98
|
className: 'wp-block-media-text__content',
|
|
97
99
|
} ) }
|
|
98
100
|
/>
|
|
99
|
-
<figure
|
|
100
|
-
className="wp-block-media-text__media"
|
|
101
|
-
style={ backgroundStyles }
|
|
102
|
-
>
|
|
101
|
+
<figure className="wp-block-media-text__media">
|
|
103
102
|
{ ( mediaTypeRenders[ mediaType ] || noop )() }
|
|
104
103
|
</figure>
|
|
105
104
|
</div>
|
|
@@ -107,10 +106,7 @@ export default function save( { attributes } ) {
|
|
|
107
106
|
}
|
|
108
107
|
return (
|
|
109
108
|
<div { ...useBlockProps.save( { className, style } ) }>
|
|
110
|
-
<figure
|
|
111
|
-
className="wp-block-media-text__media"
|
|
112
|
-
style={ backgroundStyles }
|
|
113
|
-
>
|
|
109
|
+
<figure className="wp-block-media-text__media">
|
|
114
110
|
{ ( mediaTypeRenders[ mediaType ] || noop )() }
|
|
115
111
|
</figure>
|
|
116
112
|
<div
|
|
@@ -80,6 +80,7 @@
|
|
|
80
80
|
vertical-align: middle;
|
|
81
81
|
}
|
|
82
82
|
|
|
83
|
+
/* `is-image-fill` is deprecated and the styles are kept for backwards compatibility. */
|
|
83
84
|
.wp-block-media-text.is-image-fill > .wp-block-media-text__media {
|
|
84
85
|
height: 100%;
|
|
85
86
|
min-height: 250px;
|
|
@@ -102,6 +103,26 @@
|
|
|
102
103
|
clip: rect(0, 0, 0, 0);
|
|
103
104
|
border: 0;
|
|
104
105
|
}
|
|
106
|
+
|
|
107
|
+
/* Image fill for versions 8 and onwards */
|
|
108
|
+
.wp-block-media-text.is-image-fill-element > .wp-block-media-text__media {
|
|
109
|
+
position: relative;
|
|
110
|
+
height: 100%;
|
|
111
|
+
min-height: 250px;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
.wp-block-media-text.is-image-fill-element > .wp-block-media-text__media > a {
|
|
115
|
+
display: block;
|
|
116
|
+
height: 100%;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
.wp-block-media-text.is-image-fill-element > .wp-block-media-text__media img {
|
|
120
|
+
position: absolute;
|
|
121
|
+
width: 100%;
|
|
122
|
+
height: 100%;
|
|
123
|
+
object-fit: cover;
|
|
124
|
+
}
|
|
125
|
+
|
|
105
126
|
/*
|
|
106
127
|
* Here we here not able to use a mobile first CSS approach.
|
|
107
128
|
* Custom widths are set using inline styles, and on mobile,
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Internal dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { imageFillStyles } from '../image-fill';
|
|
5
|
+
|
|
6
|
+
describe( 'imageFillStyles()', () => {
|
|
7
|
+
it( 'should return centered object position', () => {
|
|
8
|
+
const { objectPosition } = imageFillStyles( 'image.jpg' );
|
|
9
|
+
expect( objectPosition ).toBe( '50% 50%' );
|
|
10
|
+
} );
|
|
11
|
+
|
|
12
|
+
it( 'should return custom object position', () => {
|
|
13
|
+
const { objectPosition } = imageFillStyles( 'image.jpg', {
|
|
14
|
+
x: 0.56,
|
|
15
|
+
y: 0.57,
|
|
16
|
+
} );
|
|
17
|
+
expect( objectPosition ).toBe( '56% 57%' );
|
|
18
|
+
} );
|
|
19
|
+
} );
|
package/src/missing/edit.js
CHANGED
|
@@ -49,7 +49,13 @@ export default function MissingEdit( { attributes, clientId } ) {
|
|
|
49
49
|
let messageHTML;
|
|
50
50
|
|
|
51
51
|
const convertToHtmlButton = (
|
|
52
|
-
<Button
|
|
52
|
+
<Button
|
|
53
|
+
// TODO: Switch to `true` (40px size) if possible
|
|
54
|
+
__next40pxDefaultSize={ false }
|
|
55
|
+
key="convert"
|
|
56
|
+
onClick={ convertToHTML }
|
|
57
|
+
variant="primary"
|
|
58
|
+
>
|
|
53
59
|
{ __( 'Keep as HTML' ) }
|
|
54
60
|
</Button>
|
|
55
61
|
);
|
|
@@ -69,7 +75,7 @@ export default function MissingEdit( { attributes, clientId } ) {
|
|
|
69
75
|
messageHTML = sprintf(
|
|
70
76
|
/* translators: %s: block name */
|
|
71
77
|
__(
|
|
72
|
-
'Your site doesn’t include support for the "%s" block. You can leave
|
|
78
|
+
'Your site doesn’t include support for the "%s" block. You can leave it as-is, convert it to custom HTML, or remove it.'
|
|
73
79
|
),
|
|
74
80
|
originalName
|
|
75
81
|
);
|
|
@@ -78,7 +84,7 @@ export default function MissingEdit( { attributes, clientId } ) {
|
|
|
78
84
|
messageHTML = sprintf(
|
|
79
85
|
/* translators: %s: block name */
|
|
80
86
|
__(
|
|
81
|
-
'Your site doesn’t include support for the "%s" block. You can leave
|
|
87
|
+
'Your site doesn’t include support for the "%s" block. You can leave it as-is or remove it.'
|
|
82
88
|
),
|
|
83
89
|
originalName
|
|
84
90
|
);
|
|
@@ -14,7 +14,14 @@ function DeletedNavigationWarning( { onCreateNew } ) {
|
|
|
14
14
|
'Navigation Menu has been deleted or is unavailable. <button>Create a new Menu?</button>'
|
|
15
15
|
),
|
|
16
16
|
{
|
|
17
|
-
button:
|
|
17
|
+
button: (
|
|
18
|
+
<Button
|
|
19
|
+
// TODO: Switch to `true` (40px size) if possible
|
|
20
|
+
__next40pxDefaultSize={ false }
|
|
21
|
+
onClick={ onCreateNew }
|
|
22
|
+
variant="link"
|
|
23
|
+
/>
|
|
24
|
+
),
|
|
18
25
|
}
|
|
19
26
|
) }
|
|
20
27
|
</Warning>
|
|
@@ -19,6 +19,8 @@ export default function NavigationMenuDeleteControl( { onDelete } ) {
|
|
|
19
19
|
return (
|
|
20
20
|
<>
|
|
21
21
|
<Button
|
|
22
|
+
// TODO: Switch to `true` (40px size) if possible
|
|
23
|
+
__next40pxDefaultSize={ false }
|
|
22
24
|
className="wp-block-navigation-delete-menu-button"
|
|
23
25
|
variant="secondary"
|
|
24
26
|
isDestructive
|
|
@@ -79,6 +79,8 @@ export default function ResponsiveWrapper( {
|
|
|
79
79
|
<>
|
|
80
80
|
{ ! isOpen && (
|
|
81
81
|
<Button
|
|
82
|
+
// TODO: Switch to `true` (40px size) if possible
|
|
83
|
+
__next40pxDefaultSize={ false }
|
|
82
84
|
aria-haspopup="true"
|
|
83
85
|
aria-label={ hasIcon && __( 'Open menu' ) }
|
|
84
86
|
className={ openButtonClasses }
|
|
@@ -100,6 +102,8 @@ export default function ResponsiveWrapper( {
|
|
|
100
102
|
>
|
|
101
103
|
<div { ...dialogProps }>
|
|
102
104
|
<Button
|
|
105
|
+
// TODO: Switch to `true` (40px size) if possible
|
|
106
|
+
__next40pxDefaultSize={ false }
|
|
103
107
|
className="wp-block-navigation__responsive-container-close"
|
|
104
108
|
aria-label={ hasIcon && __( 'Close menu' ) }
|
|
105
109
|
onClick={ () => onToggle( false ) }
|
|
@@ -20,13 +20,13 @@ export default function UnsavedInnerBlocks( {
|
|
|
20
20
|
createNavigationMenu,
|
|
21
21
|
hasSelection,
|
|
22
22
|
} ) {
|
|
23
|
-
const
|
|
23
|
+
const originalBlocksRef = useRef();
|
|
24
24
|
|
|
25
25
|
useEffect( () => {
|
|
26
26
|
// Initially store the uncontrolled inner blocks for
|
|
27
27
|
// dirty state comparison.
|
|
28
|
-
if ( !
|
|
29
|
-
|
|
28
|
+
if ( ! originalBlocksRef?.current ) {
|
|
29
|
+
originalBlocksRef.current = blocks;
|
|
30
30
|
}
|
|
31
31
|
}, [ blocks ] );
|
|
32
32
|
|
|
@@ -38,7 +38,7 @@ export default function UnsavedInnerBlocks( {
|
|
|
38
38
|
// entity records. As a result we need to perform a deep equality check skipping
|
|
39
39
|
// the page list's inner blocks.
|
|
40
40
|
const innerBlocksAreDirty = areBlocksDirty(
|
|
41
|
-
|
|
41
|
+
originalBlocksRef?.current,
|
|
42
42
|
blocks
|
|
43
43
|
);
|
|
44
44
|
|
|
@@ -5,6 +5,10 @@
|
|
|
5
5
|
// Undo default editor styles.
|
|
6
6
|
// These need extra specificity.
|
|
7
7
|
.editor-styles-wrapper .wp-block-navigation {
|
|
8
|
+
// Extra specificity is applied to do two things in classic themes:
|
|
9
|
+
// 1. Override the auto margin from alignment styles. This is needed as the `ul` element
|
|
10
|
+
// has a `wp-block` class applied to it, even though it's not a block.
|
|
11
|
+
// 2. Override list indentation that targets `ul,ol` elements.
|
|
8
12
|
ul {
|
|
9
13
|
margin-top: 0;
|
|
10
14
|
margin-bottom: 0;
|
|
@@ -100,7 +104,6 @@
|
|
|
100
104
|
background: $gray-900;
|
|
101
105
|
padding: 0;
|
|
102
106
|
width: $button-size-small;
|
|
103
|
-
border-radius: $radius-block-ui;
|
|
104
107
|
margin-right: 0;
|
|
105
108
|
margin-left: auto;
|
|
106
109
|
}
|
|
@@ -322,7 +325,7 @@ $color-control-label-height: 20px;
|
|
|
322
325
|
}
|
|
323
326
|
|
|
324
327
|
.wp-block-navigation-placeholder__controls {
|
|
325
|
-
border-radius: $radius-
|
|
328
|
+
border-radius: $radius-small;
|
|
326
329
|
background-color: $white;
|
|
327
330
|
box-shadow: inset 0 0 0 $border-width $gray-900;
|
|
328
331
|
display: none;
|
|
@@ -478,7 +481,7 @@ $color-control-label-height: 20px;
|
|
|
478
481
|
}
|
|
479
482
|
}
|
|
480
483
|
|
|
481
|
-
//
|
|
484
|
+
// `body.editor-styles-wrapper` ensures this only applies to the iframed editor.
|
|
482
485
|
body.editor-styles-wrapper .wp-block-navigation__responsive-container.is-menu-open {
|
|
483
486
|
top: 0;
|
|
484
487
|
right: 0;
|
|
@@ -8,7 +8,7 @@ import {
|
|
|
8
8
|
VisuallyHidden,
|
|
9
9
|
__experimentalVStack as VStack,
|
|
10
10
|
} from '@wordpress/components';
|
|
11
|
-
import { __, sprintf } from '@wordpress/i18n';
|
|
11
|
+
import { __, sprintf, isRTL } from '@wordpress/i18n';
|
|
12
12
|
import {
|
|
13
13
|
__experimentalLinkControl as LinkControl,
|
|
14
14
|
store as blockEditorStore,
|
|
@@ -28,7 +28,7 @@ import {
|
|
|
28
28
|
} from '@wordpress/core-data';
|
|
29
29
|
import { decodeEntities } from '@wordpress/html-entities';
|
|
30
30
|
import { useSelect, useDispatch } from '@wordpress/data';
|
|
31
|
-
import { chevronLeftSmall, plus } from '@wordpress/icons';
|
|
31
|
+
import { chevronLeftSmall, chevronRightSmall, plus } from '@wordpress/icons';
|
|
32
32
|
import { useInstanceId, useFocusOnMount } from '@wordpress/compose';
|
|
33
33
|
|
|
34
34
|
/**
|
|
@@ -123,7 +123,7 @@ function LinkUIBlockInserter( { clientId, onBack, onSelectBlock } ) {
|
|
|
123
123
|
|
|
124
124
|
<Button
|
|
125
125
|
className="link-ui-block-inserter__back"
|
|
126
|
-
icon={ chevronLeftSmall }
|
|
126
|
+
icon={ isRTL() ? chevronRightSmall : chevronLeftSmall }
|
|
127
127
|
onClick={ ( e ) => {
|
|
128
128
|
e.preventDefault();
|
|
129
129
|
onBack();
|
|
@@ -310,6 +310,8 @@ const LinkUITools = ( { setAddingBlock, focusAddBlockButton } ) => {
|
|
|
310
310
|
return (
|
|
311
311
|
<VStack className="link-ui-tools">
|
|
312
312
|
<Button
|
|
313
|
+
// TODO: Switch to `true` (40px size) if possible
|
|
314
|
+
__next40pxDefaultSize={ false }
|
|
313
315
|
ref={ addBlockButtonRef }
|
|
314
316
|
icon={ plus }
|
|
315
317
|
onClick={ ( e ) => {
|
|
@@ -31,10 +31,17 @@ export function ConvertToLinksModal( { onClick, onClose, disabled } ) {
|
|
|
31
31
|
{ convertDescription }
|
|
32
32
|
</p>
|
|
33
33
|
<div className="wp-block-page-list-modal-buttons">
|
|
34
|
-
<Button
|
|
34
|
+
<Button
|
|
35
|
+
// TODO: Switch to `true` (40px size) if possible
|
|
36
|
+
__next40pxDefaultSize={ false }
|
|
37
|
+
variant="tertiary"
|
|
38
|
+
onClick={ onClose }
|
|
39
|
+
>
|
|
35
40
|
{ __( 'Cancel' ) }
|
|
36
41
|
</Button>
|
|
37
42
|
<Button
|
|
43
|
+
// TODO: Switch to `true` (40px size) if possible
|
|
44
|
+
__next40pxDefaultSize={ false }
|
|
38
45
|
variant="primary"
|
|
39
46
|
accessibleWhenDisabled
|
|
40
47
|
disabled={ disabled }
|
package/src/page-list/edit.js
CHANGED
|
@@ -225,7 +225,11 @@ export default function PageListEdit( {
|
|
|
225
225
|
page.title?.rendered?.trim() !== ''
|
|
226
226
|
? page.title?.rendered
|
|
227
227
|
: __( '(no title)' ),
|
|
228
|
-
title:
|
|
228
|
+
title:
|
|
229
|
+
// translators: displayed when a page has an empty title.
|
|
230
|
+
page.title?.rendered?.trim() !== ''
|
|
231
|
+
? page.title?.rendered
|
|
232
|
+
: __( '(no title)' ),
|
|
229
233
|
link: page.url,
|
|
230
234
|
hasChildren,
|
|
231
235
|
};
|
|
@@ -338,6 +342,8 @@ export default function PageListEdit( {
|
|
|
338
342
|
<PanelBody title={ __( 'Edit this menu' ) }>
|
|
339
343
|
<p>{ convertDescription }</p>
|
|
340
344
|
<Button
|
|
345
|
+
// TODO: Switch to `true` (40px size) if possible
|
|
346
|
+
__next40pxDefaultSize={ false }
|
|
341
347
|
variant="primary"
|
|
342
348
|
accessibleWhenDisabled
|
|
343
349
|
disabled={ ! hasResolvedPages }
|
package/src/page-list/index.php
CHANGED
|
@@ -192,7 +192,9 @@ function block_core_page_list_render_nested_page_list( $open_submenus_on_click,
|
|
|
192
192
|
$css_class .= ' menu-item-home';
|
|
193
193
|
}
|
|
194
194
|
|
|
195
|
-
$title
|
|
195
|
+
$title = wp_kses_post( $page['title'] );
|
|
196
|
+
$title = $title ? $title : __( '(no title)' );
|
|
197
|
+
|
|
196
198
|
$aria_label = sprintf(
|
|
197
199
|
/* translators: Accessibility text. %s: Parent page title. */
|
|
198
200
|
__( '%s submenu' ),
|
|
@@ -84,6 +84,8 @@ const CommentsForm = ( { postId, postType } ) => {
|
|
|
84
84
|
if ( 'closed' === commentStatus ) {
|
|
85
85
|
const actions = [
|
|
86
86
|
<Button
|
|
87
|
+
// TODO: Switch to `true` (40px size) if possible
|
|
88
|
+
__next40pxDefaultSize={ false }
|
|
87
89
|
key="enableComments"
|
|
88
90
|
onClick={ () => setCommentStatus( 'open' ) }
|
|
89
91
|
variant="primary"
|
package/src/post-date/index.php
CHANGED
|
@@ -26,10 +26,10 @@ function render_block_core_post_date( $attributes, $content, $block ) {
|
|
|
26
26
|
$post_timestamp = get_post_timestamp( $post_ID );
|
|
27
27
|
if ( $post_timestamp > time() ) {
|
|
28
28
|
// translators: %s: human-readable time difference.
|
|
29
|
-
$formatted_date = sprintf( __( '%s from now'
|
|
29
|
+
$formatted_date = sprintf( __( '%s from now' ), human_time_diff( $post_timestamp ) );
|
|
30
30
|
} else {
|
|
31
31
|
// translators: %s: human-readable time difference.
|
|
32
|
-
$formatted_date = sprintf( __( '%s ago'
|
|
32
|
+
$formatted_date = sprintf( __( '%s ago' ), human_time_diff( $post_timestamp ) );
|
|
33
33
|
}
|
|
34
34
|
} else {
|
|
35
35
|
$formatted_date = get_the_date( empty( $attributes['format'] ) ? '' : $attributes['format'], $post_ID );
|
|
@@ -52,7 +52,7 @@ function render_block_core_post_date( $attributes, $content, $block ) {
|
|
|
52
52
|
if ( get_the_modified_date( 'Ymdhi', $post_ID ) > get_the_date( 'Ymdhi', $post_ID ) ) {
|
|
53
53
|
if ( isset( $attributes['format'] ) && 'human-diff' === $attributes['format'] ) {
|
|
54
54
|
// translators: %s: human-readable time difference.
|
|
55
|
-
$formatted_date = sprintf( __( '%s ago'
|
|
55
|
+
$formatted_date = sprintf( __( '%s ago' ), human_time_diff( get_post_timestamp( $post_ID, 'modified' ) ) );
|
|
56
56
|
} else {
|
|
57
57
|
$formatted_date = get_the_modified_date( empty( $attributes['format'] ) ? '' : $attributes['format'], $post_ID );
|
|
58
58
|
}
|