@wordpress/block-library 6.0.6 → 6.0.10
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/build/cover/edit.js +8 -3
- package/build/cover/edit.js.map +1 -1
- package/build/cover/transforms.js +2 -0
- package/build/cover/transforms.js.map +1 -1
- package/build/gallery/edit.js +1 -1
- package/build/gallery/edit.js.map +1 -1
- package/build/gallery/v1/update-gallery-modal.js +1 -1
- package/build/gallery/v1/update-gallery-modal.js.map +1 -1
- package/build/index.js +4 -3
- package/build/index.js.map +1 -1
- package/build/navigation/deprecated.js +118 -12
- package/build/navigation/deprecated.js.map +1 -1
- package/build/navigation/edit/index.js +59 -33
- package/build/navigation/edit/index.js.map +1 -1
- package/build/navigation/edit/inner-blocks.js +1 -1
- package/build/navigation/edit/inner-blocks.js.map +1 -1
- package/build/navigation/edit/navigation-menu-selector.js +2 -2
- package/build/navigation/edit/navigation-menu-selector.js.map +1 -1
- package/build/navigation/edit/placeholder/index.js +16 -48
- package/build/navigation/edit/placeholder/index.js.map +1 -1
- package/build/navigation/edit/responsive-wrapper.js +5 -2
- package/build/navigation/edit/responsive-wrapper.js.map +1 -1
- package/build/navigation/edit/unsaved-inner-blocks.js +4 -35
- package/build/navigation/edit/unsaved-inner-blocks.js.map +1 -1
- package/build/navigation/edit/use-create-navigation-menu.js +50 -0
- package/build/navigation/edit/use-create-navigation-menu.js.map +1 -0
- package/build/navigation/edit/use-generate-default-navigation-title.js +73 -0
- package/build/navigation/edit/use-generate-default-navigation-title.js.map +1 -0
- package/build/navigation/index.js +1 -1
- package/build/navigation/save.js +2 -2
- package/build/navigation/save.js.map +1 -1
- package/build/navigation/use-navigation-menu.js +19 -8
- package/build/navigation/use-navigation-menu.js.map +1 -1
- package/build/navigation-area/edit.js +5 -0
- package/build/navigation-area/edit.js.map +1 -1
- package/build/page-list/edit.js +40 -42
- package/build/page-list/edit.js.map +1 -1
- package/build/pattern/index.js +1 -1
- package/build/post-featured-image/edit.js +53 -23
- package/build/post-featured-image/edit.js.map +1 -1
- package/build/post-terms/index.js +1 -1
- package/build/post-title/edit.js +2 -2
- package/build/post-title/edit.js.map +1 -1
- package/build/query-title/index.js +1 -1
- package/build/site-logo/index.js +1 -1
- package/build/site-tagline/index.js +1 -1
- package/build/site-title/index.js +1 -1
- package/build/template-part/edit/placeholder/index.js +1 -1
- package/build/template-part/edit/placeholder/index.js.map +1 -1
- package/build/template-part/index.js +2 -1
- package/build/template-part/index.js.map +1 -1
- package/build-module/cover/edit.js +8 -3
- package/build-module/cover/edit.js.map +1 -1
- package/build-module/cover/transforms.js +2 -0
- package/build-module/cover/transforms.js.map +1 -1
- package/build-module/gallery/edit.js +1 -1
- package/build-module/gallery/edit.js.map +1 -1
- package/build-module/gallery/v1/update-gallery-modal.js +1 -1
- package/build-module/gallery/v1/update-gallery-modal.js.map +1 -1
- package/build-module/index.js +4 -3
- package/build-module/index.js.map +1 -1
- package/build-module/navigation/deprecated.js +118 -12
- package/build-module/navigation/deprecated.js.map +1 -1
- package/build-module/navigation/edit/index.js +60 -33
- package/build-module/navigation/edit/index.js.map +1 -1
- package/build-module/navigation/edit/inner-blocks.js +1 -1
- package/build-module/navigation/edit/inner-blocks.js.map +1 -1
- package/build-module/navigation/edit/navigation-menu-selector.js +2 -2
- package/build-module/navigation/edit/navigation-menu-selector.js.map +1 -1
- package/build-module/navigation/edit/placeholder/index.js +15 -45
- package/build-module/navigation/edit/placeholder/index.js.map +1 -1
- package/build-module/navigation/edit/responsive-wrapper.js +5 -2
- package/build-module/navigation/edit/responsive-wrapper.js.map +1 -1
- package/build-module/navigation/edit/unsaved-inner-blocks.js +6 -35
- package/build-module/navigation/edit/unsaved-inner-blocks.js.map +1 -1
- package/build-module/navigation/edit/use-create-navigation-menu.js +36 -0
- package/build-module/navigation/edit/use-create-navigation-menu.js.map +1 -0
- package/build-module/navigation/edit/use-generate-default-navigation-title.js +57 -0
- package/build-module/navigation/edit/use-generate-default-navigation-title.js.map +1 -0
- package/build-module/navigation/index.js +1 -1
- package/build-module/navigation/save.js +2 -2
- package/build-module/navigation/save.js.map +1 -1
- package/build-module/navigation/use-navigation-menu.js +19 -8
- package/build-module/navigation/use-navigation-menu.js.map +1 -1
- package/build-module/navigation-area/edit.js +4 -0
- package/build-module/navigation-area/edit.js.map +1 -1
- package/build-module/page-list/edit.js +41 -43
- package/build-module/page-list/edit.js.map +1 -1
- package/build-module/pattern/index.js +1 -1
- package/build-module/post-featured-image/edit.js +55 -26
- package/build-module/post-featured-image/edit.js.map +1 -1
- package/build-module/post-terms/index.js +1 -1
- package/build-module/post-title/edit.js +2 -2
- package/build-module/post-title/edit.js.map +1 -1
- package/build-module/query-title/index.js +1 -1
- package/build-module/site-logo/index.js +1 -1
- package/build-module/site-tagline/index.js +1 -1
- package/build-module/site-title/index.js +1 -1
- package/build-module/template-part/edit/placeholder/index.js +2 -2
- package/build-module/template-part/edit/placeholder/index.js.map +1 -1
- package/build-module/template-part/index.js +2 -1
- package/build-module/template-part/index.js.map +1 -1
- package/build-style/code/theme-rtl.css +1 -1
- package/build-style/code/theme.css +1 -1
- package/build-style/cover/style-rtl.css +8 -2
- package/build-style/cover/style.css +8 -2
- package/build-style/editor-rtl.css +104 -53
- package/build-style/editor.css +104 -53
- package/build-style/gallery/editor-rtl.css +1 -0
- package/build-style/gallery/editor.css +1 -0
- package/build-style/navigation/style-rtl.css +40 -3
- package/build-style/navigation/style.css +40 -3
- package/build-style/post-comments-form/style-rtl.css +18 -0
- package/build-style/post-comments-form/style.css +18 -0
- package/build-style/post-featured-image/editor-rtl.css +100 -16
- package/build-style/post-featured-image/editor.css +100 -16
- package/build-style/site-logo/editor-rtl.css +2 -2
- package/build-style/site-logo/editor.css +2 -2
- package/build-style/social-links/editor-rtl.css +1 -35
- package/build-style/social-links/editor.css +1 -35
- package/build-style/style-rtl.css +66 -27
- package/build-style/style.css +66 -27
- package/build-style/theme-rtl.css +1 -1
- package/build-style/theme.css +1 -1
- package/package.json +8 -8
- package/src/calendar/index.php +3 -3
- package/src/code/theme.scss +1 -1
- package/src/cover/edit.js +8 -1
- package/src/cover/style.scss +9 -2
- package/src/cover/transforms.js +2 -0
- package/src/gallery/edit.js +1 -1
- package/src/gallery/editor.scss +1 -0
- package/src/gallery/index.php +1 -1
- package/src/gallery/v1/update-gallery-modal.js +1 -1
- package/src/home-link/index.php +1 -1
- package/src/image/index.php +1 -1
- package/src/index.js +28 -26
- package/src/navigation/block.json +1 -1
- package/src/navigation/deprecated.js +105 -4
- package/src/navigation/edit/index.js +68 -36
- package/src/navigation/edit/inner-blocks.js +2 -1
- package/src/navigation/edit/navigation-menu-selector.js +2 -2
- package/src/navigation/edit/placeholder/index.js +16 -62
- package/src/navigation/edit/responsive-wrapper.js +8 -1
- package/src/navigation/edit/unsaved-inner-blocks.js +6 -57
- package/src/navigation/edit/use-create-navigation-menu.js +39 -0
- package/src/navigation/edit/use-generate-default-navigation-title.js +79 -0
- package/src/navigation/index.php +173 -19
- package/src/navigation/save.js +2 -2
- package/src/navigation/style.scss +56 -5
- package/src/navigation/use-navigation-menu.js +20 -9
- package/src/navigation-area/edit.js +5 -0
- package/src/navigation-area/index.php +2 -1
- package/src/navigation-link/index.php +1 -1
- package/src/navigation-submenu/index.php +2 -8
- package/src/page-list/edit.js +35 -44
- package/src/page-list/index.php +10 -5
- package/src/pattern/block.json +1 -1
- package/src/post-comments-form/style.scss +20 -1
- package/src/post-featured-image/edit.js +58 -26
- package/src/post-featured-image/editor.scss +124 -20
- package/src/post-terms/block.json +1 -1
- package/src/post-title/edit.js +2 -2
- package/src/query-title/block.json +1 -1
- package/src/site-logo/block.json +1 -1
- package/src/site-logo/editor.scss +3 -2
- package/src/site-tagline/block.json +1 -1
- package/src/site-title/block.json +1 -1
- package/src/social-links/editor.scss +1 -47
- package/src/style.scss +0 -1
- package/src/table-of-contents/index.php +1 -1
- package/src/template-part/block.json +2 -1
- package/src/template-part/edit/placeholder/index.js +2 -2
- package/src/template-part/index.php +2 -1
- package/build/navigation/edit/navigation-menu-name-modal.js +0 -55
- package/build/navigation/edit/navigation-menu-name-modal.js.map +0 -1
- package/build/navigation/edit/navigation-menu-publish-button.js +0 -53
- package/build/navigation/edit/navigation-menu-publish-button.js.map +0 -1
- package/build-module/navigation/edit/navigation-menu-name-modal.js +0 -47
- package/build-module/navigation/edit/navigation-menu-name-modal.js.map +0 -1
- package/build-module/navigation/edit/navigation-menu-publish-button.js +0 -40
- package/build-module/navigation/edit/navigation-menu-publish-button.js.map +0 -1
- package/build-style/navigation-submenu/style-rtl.css +0 -97
- package/build-style/navigation-submenu/style.css +0 -97
- package/src/navigation/edit/navigation-menu-name-modal.js +0 -69
- package/src/navigation/edit/navigation-menu-publish-button.js +0 -57
- package/src/navigation-submenu/style.scss +0 -25
package/src/page-list/index.php
CHANGED
|
@@ -34,7 +34,7 @@ function block_core_page_list_build_css_colors( $attributes, $context ) {
|
|
|
34
34
|
|
|
35
35
|
if ( $has_named_text_color ) {
|
|
36
36
|
// Add the color class.
|
|
37
|
-
$colors['css_classes'][] = sprintf( 'has-%s-color',
|
|
37
|
+
$colors['css_classes'][] = sprintf( 'has-%s-color', _wp_to_kebab_case( $context['textColor'] ) );
|
|
38
38
|
} elseif ( $has_picked_text_color ) {
|
|
39
39
|
$colors['inline_styles'] .= sprintf( 'color: %s;', $context['customTextColor'] );
|
|
40
40
|
} elseif ( $has_custom_text_color ) {
|
|
@@ -55,7 +55,7 @@ function block_core_page_list_build_css_colors( $attributes, $context ) {
|
|
|
55
55
|
|
|
56
56
|
if ( $has_named_background_color ) {
|
|
57
57
|
// Add the background-color class.
|
|
58
|
-
$colors['css_classes'][] = sprintf( 'has-%s-background-color',
|
|
58
|
+
$colors['css_classes'][] = sprintf( 'has-%s-background-color', _wp_to_kebab_case( $context['backgroundColor'] ) );
|
|
59
59
|
} elseif ( $has_picked_background_color ) {
|
|
60
60
|
$colors['inline_styles'] .= sprintf( 'background-color: %s;', $context['customBackgroundColor'] );
|
|
61
61
|
} elseif ( $has_custom_background_color ) {
|
|
@@ -74,7 +74,7 @@ function block_core_page_list_build_css_colors( $attributes, $context ) {
|
|
|
74
74
|
|
|
75
75
|
// Give overlay colors priority, fall back to Navigation block colors, then global styles.
|
|
76
76
|
if ( $has_named_overlay_text_color ) {
|
|
77
|
-
$colors['overlay_css_classes'][] = sprintf( 'has-%s-color',
|
|
77
|
+
$colors['overlay_css_classes'][] = sprintf( 'has-%s-color', _wp_to_kebab_case( $context['overlayTextColor'] ) );
|
|
78
78
|
} elseif ( $has_picked_overlay_text_color ) {
|
|
79
79
|
$colors['overlay_inline_styles'] .= sprintf( 'color: %s;', $context['customOverlayTextColor'] );
|
|
80
80
|
}
|
|
@@ -89,7 +89,7 @@ function block_core_page_list_build_css_colors( $attributes, $context ) {
|
|
|
89
89
|
}
|
|
90
90
|
|
|
91
91
|
if ( $has_named_overlay_background_color ) {
|
|
92
|
-
$colors['overlay_css_classes'][] = sprintf( 'has-%s-background-color',
|
|
92
|
+
$colors['overlay_css_classes'][] = sprintf( 'has-%s-background-color', _wp_to_kebab_case( $context['overlayBackgroundColor'] ) );
|
|
93
93
|
} elseif ( $has_picked_overlay_background_color ) {
|
|
94
94
|
$colors['overlay_inline_styles'] .= sprintf( 'background-color: %s;', $context['customOverlayBackgroundColor'] );
|
|
95
95
|
}
|
|
@@ -182,7 +182,7 @@ function block_core_page_list_render_nested_page_list( $open_submenus_on_click,
|
|
|
182
182
|
) . '<span class="wp-block-page-list__submenu-icon wp-block-navigation__submenu-icon"><svg xmlns="http://www.w3.org/2000/svg" width="12" height="12" viewBox="0 0 12 12" fill="none" role="img" aria-hidden="true" focusable="false"><path d="M1.50002 4L6.00002 8L10.5 4" stroke-width="1.5"></path></svg></span>' .
|
|
183
183
|
'</button>';
|
|
184
184
|
} else {
|
|
185
|
-
$markup .= '<a class="wp-block-pages-list__item__link' . $navigation_child_content_class . '
|
|
185
|
+
$markup .= '<a class="wp-block-pages-list__item__link' . $navigation_child_content_class . '" href="' . esc_url( $page['link'] ) . '"' . $aria_current . '>' . wp_kses(
|
|
186
186
|
$page['title'],
|
|
187
187
|
wp_kses_allowed_html( 'post' )
|
|
188
188
|
) . '</a>';
|
|
@@ -293,6 +293,11 @@ function render_block_core_page_list( $attributes, $content, $block ) {
|
|
|
293
293
|
|
|
294
294
|
$nested_pages = block_core_page_list_nest_pages( $top_level_pages, $pages_with_children );
|
|
295
295
|
|
|
296
|
+
// Limit the number of items to be visually displayed.
|
|
297
|
+
if ( ! empty( $attributes['__unstableMaxPages'] ) ) {
|
|
298
|
+
$nested_pages = array_slice( $nested_pages, 0, $attributes['__unstableMaxPages'] );
|
|
299
|
+
}
|
|
300
|
+
|
|
296
301
|
$is_navigation_child = array_key_exists( 'showSubmenuIcon', $block->context );
|
|
297
302
|
|
|
298
303
|
$open_submenus_on_click = array_key_exists( 'openSubmenusOnClick', $block->context ) ? $block->context['openSubmenusOnClick'] : false;
|
package/src/pattern/block.json
CHANGED
|
@@ -1,6 +1,25 @@
|
|
|
1
|
-
// Styles copied from button block styles.
|
|
2
1
|
.wp-block-post-comments-form {
|
|
2
|
+
&[style*="font-weight"] :where(.comment-reply-title) {
|
|
3
|
+
font-weight: inherit;
|
|
4
|
+
}
|
|
5
|
+
&[style*="font-family"] :where(.comment-reply-title) {
|
|
6
|
+
font-family: inherit;
|
|
7
|
+
}
|
|
8
|
+
&[class*="-font-size"] :where(.comment-reply-title),
|
|
9
|
+
&[style*="font-size"] :where(.comment-reply-title) {
|
|
10
|
+
font-size: inherit;
|
|
11
|
+
}
|
|
12
|
+
&[style*="line-height"] :where(.comment-reply-title) {
|
|
13
|
+
line-height: inherit;
|
|
14
|
+
}
|
|
15
|
+
&[style*="font-style"] :where(.comment-reply-title) {
|
|
16
|
+
font-style: inherit;
|
|
17
|
+
}
|
|
18
|
+
&[style*="letter-spacing"] :where(.comment-reply-title) {
|
|
19
|
+
letter-spacing: inherit;
|
|
20
|
+
}
|
|
3
21
|
|
|
22
|
+
// Styles copied from button block styles.
|
|
4
23
|
input[type="submit"] {
|
|
5
24
|
border: none;
|
|
6
25
|
box-shadow: none;
|
|
@@ -2,34 +2,46 @@
|
|
|
2
2
|
* WordPress dependencies
|
|
3
3
|
*/
|
|
4
4
|
import { useEntityProp, store as coreStore } from '@wordpress/core-data';
|
|
5
|
-
import { useSelect } from '@wordpress/data';
|
|
5
|
+
import { useSelect, useDispatch } from '@wordpress/data';
|
|
6
6
|
import {
|
|
7
|
-
Icon,
|
|
8
7
|
ToggleControl,
|
|
9
8
|
PanelBody,
|
|
10
|
-
|
|
9
|
+
Placeholder,
|
|
10
|
+
Button,
|
|
11
11
|
} from '@wordpress/components';
|
|
12
12
|
import {
|
|
13
13
|
InspectorControls,
|
|
14
14
|
BlockControls,
|
|
15
15
|
MediaPlaceholder,
|
|
16
16
|
MediaReplaceFlow,
|
|
17
|
-
BlockIcon,
|
|
18
17
|
useBlockProps,
|
|
19
18
|
} from '@wordpress/block-editor';
|
|
20
19
|
import { __, sprintf } from '@wordpress/i18n';
|
|
21
|
-
import {
|
|
20
|
+
import { upload } from '@wordpress/icons';
|
|
21
|
+
import { SVG, Path } from '@wordpress/primitives';
|
|
22
|
+
import { store as noticesStore } from '@wordpress/notices';
|
|
22
23
|
|
|
23
24
|
/**
|
|
24
25
|
* Internal dependencies
|
|
25
26
|
*/
|
|
26
27
|
import DimensionControls from './dimension-controls';
|
|
27
28
|
|
|
29
|
+
const placeholderIllustration = (
|
|
30
|
+
<SVG
|
|
31
|
+
className="components-placeholder__illustration"
|
|
32
|
+
fill="none"
|
|
33
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
34
|
+
viewBox="0 0 60 60"
|
|
35
|
+
preserveAspectRatio="none"
|
|
36
|
+
>
|
|
37
|
+
<Path vectorEffect="non-scaling-stroke" d="M60 60 0 0" />
|
|
38
|
+
</SVG>
|
|
39
|
+
);
|
|
40
|
+
|
|
28
41
|
const ALLOWED_MEDIA_TYPES = [ 'image' ];
|
|
29
42
|
const placeholderChip = (
|
|
30
|
-
<div className="post-featured-
|
|
31
|
-
|
|
32
|
-
<p> { __( 'Featured Image' ) }</p>
|
|
43
|
+
<div className="wp-block-post-featured-image__placeholder">
|
|
44
|
+
{ placeholderIllustration }
|
|
33
45
|
</div>
|
|
34
46
|
);
|
|
35
47
|
|
|
@@ -37,8 +49,6 @@ function PostFeaturedImageDisplay( {
|
|
|
37
49
|
attributes,
|
|
38
50
|
setAttributes,
|
|
39
51
|
context: { postId, postType, queryId },
|
|
40
|
-
noticeUI,
|
|
41
|
-
noticeOperations,
|
|
42
52
|
} ) {
|
|
43
53
|
const isDescendentOfQueryLoop = !! queryId;
|
|
44
54
|
const { isLink, height, width, scale } = attributes;
|
|
@@ -48,42 +58,66 @@ function PostFeaturedImageDisplay( {
|
|
|
48
58
|
'featured_media',
|
|
49
59
|
postId
|
|
50
60
|
);
|
|
61
|
+
|
|
51
62
|
const media = useSelect(
|
|
52
63
|
( select ) =>
|
|
53
64
|
featuredImage &&
|
|
54
65
|
select( coreStore ).getMedia( featuredImage, { context: 'view' } ),
|
|
55
66
|
[ featuredImage ]
|
|
56
67
|
);
|
|
68
|
+
|
|
57
69
|
const blockProps = useBlockProps( {
|
|
58
|
-
style: { width },
|
|
70
|
+
style: { width, height },
|
|
59
71
|
} );
|
|
72
|
+
|
|
73
|
+
const placeholder = ( content ) => {
|
|
74
|
+
return (
|
|
75
|
+
<Placeholder className="block-editor-media-placeholder">
|
|
76
|
+
{ placeholderIllustration }
|
|
77
|
+
{ content }
|
|
78
|
+
</Placeholder>
|
|
79
|
+
);
|
|
80
|
+
};
|
|
81
|
+
|
|
60
82
|
const onSelectImage = ( value ) => {
|
|
61
83
|
if ( value?.id ) {
|
|
62
84
|
setFeaturedImage( value.id );
|
|
63
85
|
}
|
|
64
86
|
};
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
87
|
+
|
|
88
|
+
const { createErrorNotice } = useDispatch( noticesStore );
|
|
89
|
+
const onUploadError = ( message ) => {
|
|
90
|
+
createErrorNotice( message[ 2 ], { type: 'snackbar' } );
|
|
91
|
+
};
|
|
92
|
+
|
|
69
93
|
let image;
|
|
70
94
|
if ( ! featuredImage && isDescendentOfQueryLoop ) {
|
|
71
95
|
return <div { ...blockProps }>{ placeholderChip }</div>;
|
|
72
96
|
}
|
|
97
|
+
|
|
98
|
+
const label = __( 'Add a featured image' );
|
|
99
|
+
|
|
73
100
|
if ( ! featuredImage ) {
|
|
74
101
|
image = (
|
|
75
102
|
<MediaPlaceholder
|
|
76
|
-
icon={ <BlockIcon icon={ postFeaturedImage } /> }
|
|
77
103
|
onSelect={ onSelectImage }
|
|
78
|
-
notices={ noticeUI }
|
|
79
|
-
onError={ onUploadError }
|
|
80
104
|
accept="image/*"
|
|
81
105
|
allowedTypes={ ALLOWED_MEDIA_TYPES }
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
106
|
+
onError={ onUploadError }
|
|
107
|
+
placeholder={ placeholder }
|
|
108
|
+
mediaLibraryButton={ ( { open } ) => {
|
|
109
|
+
return (
|
|
110
|
+
<Button
|
|
111
|
+
icon={ upload }
|
|
112
|
+
variant="primary"
|
|
113
|
+
label={ label }
|
|
114
|
+
showTooltip
|
|
115
|
+
tooltipPosition="top center"
|
|
116
|
+
onClick={ () => {
|
|
117
|
+
open();
|
|
118
|
+
} }
|
|
119
|
+
/>
|
|
120
|
+
);
|
|
87
121
|
} }
|
|
88
122
|
/>
|
|
89
123
|
);
|
|
@@ -136,12 +170,10 @@ function PostFeaturedImageDisplay( {
|
|
|
136
170
|
);
|
|
137
171
|
}
|
|
138
172
|
|
|
139
|
-
const PostFeaturedImageWithNotices = withNotices( PostFeaturedImageDisplay );
|
|
140
|
-
|
|
141
173
|
export default function PostFeaturedImageEdit( props ) {
|
|
142
174
|
const blockProps = useBlockProps();
|
|
143
175
|
if ( ! props.context?.postId ) {
|
|
144
176
|
return <div { ...blockProps }>{ placeholderChip }</div>;
|
|
145
177
|
}
|
|
146
|
-
return <
|
|
178
|
+
return <PostFeaturedImageDisplay { ...props } />;
|
|
147
179
|
}
|
|
@@ -1,33 +1,137 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
// Give the featured image placeholder the appearance of a literal image placeholder.
|
|
2
|
+
// @todo: this CSS is similar to that of the Site Logo. That makes it an opportunity
|
|
3
|
+
// to create a new component for placeholders meant to inherit some theme styles.
|
|
4
|
+
.wp-block-post-featured-image.wp-block-post-featured-image {
|
|
5
|
+
// Inherit border radius from style variations.
|
|
6
|
+
.components-placeholder,
|
|
7
|
+
.components-resizable-box__container {
|
|
8
|
+
border-radius: inherit;
|
|
6
9
|
}
|
|
7
|
-
}
|
|
8
10
|
|
|
9
|
-
.
|
|
10
|
-
.post-featured-
|
|
11
|
-
|
|
12
|
-
|
|
11
|
+
// Style the placeholder.
|
|
12
|
+
.wp-block-post-featured-image__placeholder,
|
|
13
|
+
.components-placeholder {
|
|
14
|
+
justify-content: center;
|
|
13
15
|
align-items: center;
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
16
|
+
box-shadow: none;
|
|
17
|
+
padding: 0;
|
|
18
|
+
|
|
19
|
+
// Hide the upload button, as it's also available in the media library.
|
|
20
|
+
.components-form-file-upload {
|
|
21
|
+
display: none;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
// Position the spinner.
|
|
25
|
+
.components-placeholder__preview {
|
|
26
|
+
position: absolute;
|
|
27
|
+
top: $grid-unit-05;
|
|
28
|
+
right: $grid-unit-05;
|
|
29
|
+
bottom: $grid-unit-05;
|
|
30
|
+
left: $grid-unit-05;
|
|
31
|
+
background: rgba($white, 0.8);
|
|
32
|
+
display: flex;
|
|
33
|
+
align-items: center;
|
|
34
|
+
justify-content: center;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
// Draw the dashed outline.
|
|
38
|
+
// By setting the dashed border to currentColor, we ensure it's visible
|
|
39
|
+
// against any background color.
|
|
40
|
+
color: currentColor;
|
|
41
|
+
background: transparent;
|
|
42
|
+
&::before {
|
|
43
|
+
content: "";
|
|
44
|
+
display: block;
|
|
45
|
+
position: absolute;
|
|
46
|
+
top: 0;
|
|
47
|
+
right: 0;
|
|
48
|
+
bottom: 0;
|
|
49
|
+
left: 0;
|
|
50
|
+
border: $border-width dashed currentColor;
|
|
51
|
+
opacity: 0.4;
|
|
52
|
+
pointer-events: none;
|
|
53
|
+
|
|
54
|
+
// Inherit border radius from style variations.
|
|
55
|
+
border-radius: inherit;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
// Style the upload button.
|
|
59
|
+
.components-placeholder__fieldset {
|
|
60
|
+
width: auto;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
.components-button.components-button {
|
|
64
|
+
color: inherit;
|
|
65
|
+
padding: 0;
|
|
66
|
+
display: flex;
|
|
67
|
+
justify-content: center;
|
|
68
|
+
align-items: center;
|
|
69
|
+
width: $grid-unit-60;
|
|
70
|
+
height: $grid-unit-60;
|
|
71
|
+
border-radius: 50%;
|
|
72
|
+
position: relative;
|
|
73
|
+
visibility: hidden;
|
|
74
|
+
|
|
75
|
+
// Animation.
|
|
76
|
+
background: transparent;
|
|
77
|
+
transition: all 0.1s linear;
|
|
78
|
+
@include reduce-motion("transition");
|
|
20
79
|
}
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
80
|
+
|
|
81
|
+
.components-button.components-button > svg {
|
|
82
|
+
color: $white;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
// Style the placeholder illustration.
|
|
86
|
+
.components-placeholder__illustration {
|
|
87
|
+
position: absolute;
|
|
88
|
+
top: 0;
|
|
89
|
+
right: 0;
|
|
90
|
+
bottom: 0;
|
|
91
|
+
left: 0;
|
|
92
|
+
width: 100%;
|
|
93
|
+
height: 100%;
|
|
94
|
+
stroke: currentColor;
|
|
95
|
+
stroke-dasharray: 3;
|
|
96
|
+
opacity: 0.4;
|
|
25
97
|
}
|
|
98
|
+
|
|
99
|
+
// Show default placeholder height when not resized.
|
|
100
|
+
min-height: 200px;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
// Provide a minimum size for the placeholder when resized.
|
|
104
|
+
// Note, this should be as small as we can afford it, and exists only
|
|
105
|
+
// to ensure there's room for the upload button.
|
|
106
|
+
&[style*="height"] .components-placeholder {
|
|
107
|
+
min-height: $grid-unit-60;
|
|
108
|
+
min-width: $grid-unit-60;
|
|
109
|
+
height: 100%;
|
|
110
|
+
width: 100%;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
// Show upload button on block selection.
|
|
114
|
+
&.is-selected .components-button.components-button {
|
|
115
|
+
background: var(--wp-admin-theme-color);
|
|
116
|
+
border-color: var(--wp-admin-theme-color);
|
|
117
|
+
border-style: solid;
|
|
118
|
+
color: $white;
|
|
119
|
+
opacity: 1;
|
|
120
|
+
visibility: visible;
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
div[data-type="core/post-featured-image"] {
|
|
125
|
+
img {
|
|
126
|
+
max-width: 100%;
|
|
127
|
+
height: auto;
|
|
128
|
+
display: block;
|
|
26
129
|
}
|
|
27
130
|
}
|
|
28
131
|
|
|
29
132
|
.block-library-post-featured-image-dimension-controls {
|
|
30
133
|
margin-bottom: $grid-unit-10;
|
|
134
|
+
|
|
31
135
|
&.scale-control-is-visible {
|
|
32
136
|
margin-bottom: $grid-unit-20;
|
|
33
137
|
}
|
package/src/post-title/edit.js
CHANGED
|
@@ -62,7 +62,7 @@ export default function PostTitleEdit( {
|
|
|
62
62
|
/>
|
|
63
63
|
) : (
|
|
64
64
|
<TagName { ...blockProps }>
|
|
65
|
-
<RawHTML key="html">{ fullTitle
|
|
65
|
+
<RawHTML key="html">{ fullTitle?.rendered }</RawHTML>
|
|
66
66
|
</TagName>
|
|
67
67
|
);
|
|
68
68
|
}
|
|
@@ -92,7 +92,7 @@ export default function PostTitleEdit( {
|
|
|
92
92
|
rel={ rel }
|
|
93
93
|
onClick={ ( event ) => event.preventDefault() }
|
|
94
94
|
>
|
|
95
|
-
<RawHTML key="html">{ fullTitle
|
|
95
|
+
<RawHTML key="html">{ fullTitle?.rendered }</RawHTML>
|
|
96
96
|
</a>
|
|
97
97
|
</TagName>
|
|
98
98
|
);
|
package/src/site-logo/block.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"apiVersion": 2,
|
|
3
3
|
"name": "core/site-logo",
|
|
4
4
|
"title": "Site Logo",
|
|
5
|
-
"category": "
|
|
5
|
+
"category": "theme",
|
|
6
6
|
"description": "Display a graphic to represent this site. Update the block, and the changes apply everywhere it’s used. This is different than the site icon, which is the smaller image visible in your dashboard, browser tabs, etc used to help others recognize this site.",
|
|
7
7
|
"textdomain": "default",
|
|
8
8
|
"attributes": {
|
|
@@ -57,6 +57,7 @@
|
|
|
57
57
|
width: 120px;
|
|
58
58
|
}
|
|
59
59
|
|
|
60
|
+
// Style the placeholder.
|
|
60
61
|
.components-placeholder {
|
|
61
62
|
justify-content: center;
|
|
62
63
|
align-items: center;
|
|
@@ -109,7 +110,7 @@
|
|
|
109
110
|
bottom: 0;
|
|
110
111
|
left: 0;
|
|
111
112
|
border: $border-width dashed currentColor;
|
|
112
|
-
opacity: 0.
|
|
113
|
+
opacity: 0.4;
|
|
113
114
|
pointer-events: none;
|
|
114
115
|
|
|
115
116
|
// Inherit border radius from style variations.
|
|
@@ -154,7 +155,7 @@
|
|
|
154
155
|
height: 100%;
|
|
155
156
|
stroke: currentColor;
|
|
156
157
|
stroke-dasharray: 3;
|
|
157
|
-
opacity: 0.
|
|
158
|
+
opacity: 0.4;
|
|
158
159
|
}
|
|
159
160
|
}
|
|
160
161
|
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"apiVersion": 2,
|
|
3
3
|
"name": "core/site-tagline",
|
|
4
4
|
"title": "Site Tagline",
|
|
5
|
-
"category": "
|
|
5
|
+
"category": "theme",
|
|
6
6
|
"description": "Describe in a few words what the website is about. The tagline can be used in search results or when sharing on social networks even if it's not displayed in the theme design.",
|
|
7
7
|
"keywords": [ "description" ],
|
|
8
8
|
"textdomain": "default",
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"apiVersion": 2,
|
|
3
3
|
"name": "core/site-title",
|
|
4
4
|
"title": "Site Title",
|
|
5
|
-
"category": "
|
|
5
|
+
"category": "theme",
|
|
6
6
|
"description": "Displays the name of this site. Update the block, and the changes apply everywhere it’s used. This will also appear in the browser title bar and in search results.",
|
|
7
7
|
"textdomain": "default",
|
|
8
8
|
"attributes": {
|
|
@@ -37,7 +37,6 @@
|
|
|
37
37
|
display: flex;
|
|
38
38
|
}
|
|
39
39
|
|
|
40
|
-
& + .block-list-appender,
|
|
41
40
|
.wp-social-link {
|
|
42
41
|
padding: 0.25em;
|
|
43
42
|
|
|
@@ -66,6 +65,7 @@
|
|
|
66
65
|
|
|
67
66
|
// Selected placeholder state.
|
|
68
67
|
.wp-block-social-links .wp-block-social-links__social-prompt {
|
|
68
|
+
min-height: $button-size-small;
|
|
69
69
|
list-style: none;
|
|
70
70
|
order: 2; // Move after the appender button. Because this element is non-interactive, it does not affect tab order.
|
|
71
71
|
|
|
@@ -77,52 +77,6 @@
|
|
|
77
77
|
margin-bottom: auto;
|
|
78
78
|
cursor: default;
|
|
79
79
|
padding-right: $grid-unit-10;
|
|
80
|
-
|
|
81
|
-
& + .block-list-appender {
|
|
82
|
-
margin-right: $grid-unit-10;
|
|
83
|
-
padding: 0.25em;
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
// Polish the Appender.
|
|
88
|
-
.wp-block-social-links .block-list-appender {
|
|
89
|
-
// Match the overall silhouette of social links.
|
|
90
|
-
margin: 4px auto 4px 0;
|
|
91
|
-
border-radius: 9999px; // This works as both circular and pill shapes.
|
|
92
|
-
|
|
93
|
-
// Treat just like a social icon.
|
|
94
|
-
.block-editor-inserter {
|
|
95
|
-
display: flex;
|
|
96
|
-
align-items: center;
|
|
97
|
-
justify-content: center;
|
|
98
|
-
font-size: inherit;
|
|
99
|
-
width: 1em;
|
|
100
|
-
height: 1em;
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
// Duplicate the font sizes from style.scss to size the appender.
|
|
104
|
-
.has-small-icon-size & {
|
|
105
|
-
font-size: 16px; // 16 makes for a quarter-padding that keeps the icon centered.
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
// Normal/default.
|
|
109
|
-
.has-normal-icon-size & {
|
|
110
|
-
font-size: 24px;
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
// Large.
|
|
114
|
-
.has-large-icon-size & {
|
|
115
|
-
font-size: 36px;
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
// Huge.
|
|
119
|
-
.has-huge-icon-size & {
|
|
120
|
-
font-size: 48px;
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
&::before {
|
|
124
|
-
content: none;
|
|
125
|
-
}
|
|
126
80
|
}
|
|
127
81
|
|
|
128
82
|
// Center flex items. This has an equivalent in style.scss.
|
package/src/style.scss
CHANGED
|
@@ -19,7 +19,6 @@
|
|
|
19
19
|
@import "./media-text/style.scss";
|
|
20
20
|
@import "./navigation/style.scss";
|
|
21
21
|
@import "./navigation-link/style.scss";
|
|
22
|
-
@import "./navigation-submenu/style.scss";
|
|
23
22
|
@import "./home-link/style.scss";
|
|
24
23
|
@import "./page-list/style.scss";
|
|
25
24
|
@import "./paragraph/style.scss";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* External dependencies
|
|
3
3
|
*/
|
|
4
|
-
import { find } from 'lodash';
|
|
4
|
+
import { find, kebabCase } from 'lodash';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* WordPress dependencies
|
|
@@ -65,7 +65,7 @@ export default function TemplatePartPlaceholder( {
|
|
|
65
65
|
// block attributes.
|
|
66
66
|
const record = {
|
|
67
67
|
title,
|
|
68
|
-
slug:
|
|
68
|
+
slug: kebabCase( title ),
|
|
69
69
|
content: serialize( startingBlocks ),
|
|
70
70
|
// `area` is filterable on the server and defaults to `UNCATEGORIZED`
|
|
71
71
|
// if provided value is not allowed.
|
|
@@ -53,7 +53,8 @@ function render_block_core_template_part( $attributes ) {
|
|
|
53
53
|
} else {
|
|
54
54
|
// Else, if the template part was provided by the active theme,
|
|
55
55
|
// render the corresponding file content.
|
|
56
|
-
$
|
|
56
|
+
$theme_folders = get_block_theme_folders();
|
|
57
|
+
$template_part_file_path = get_theme_file_path( '/' . $theme_folders['wp_template_part'] . '/' . $attributes['slug'] . '.html' );
|
|
57
58
|
if ( 0 === validate_file( $attributes['slug'] ) && file_exists( $template_part_file_path ) ) {
|
|
58
59
|
$content = file_get_contents( $template_part_file_path );
|
|
59
60
|
$content = is_string( $content ) && '' !== $content
|