@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.
Files changed (187) hide show
  1. package/build/cover/edit.js +8 -3
  2. package/build/cover/edit.js.map +1 -1
  3. package/build/cover/transforms.js +2 -0
  4. package/build/cover/transforms.js.map +1 -1
  5. package/build/gallery/edit.js +1 -1
  6. package/build/gallery/edit.js.map +1 -1
  7. package/build/gallery/v1/update-gallery-modal.js +1 -1
  8. package/build/gallery/v1/update-gallery-modal.js.map +1 -1
  9. package/build/index.js +4 -3
  10. package/build/index.js.map +1 -1
  11. package/build/navigation/deprecated.js +118 -12
  12. package/build/navigation/deprecated.js.map +1 -1
  13. package/build/navigation/edit/index.js +59 -33
  14. package/build/navigation/edit/index.js.map +1 -1
  15. package/build/navigation/edit/inner-blocks.js +1 -1
  16. package/build/navigation/edit/inner-blocks.js.map +1 -1
  17. package/build/navigation/edit/navigation-menu-selector.js +2 -2
  18. package/build/navigation/edit/navigation-menu-selector.js.map +1 -1
  19. package/build/navigation/edit/placeholder/index.js +16 -48
  20. package/build/navigation/edit/placeholder/index.js.map +1 -1
  21. package/build/navigation/edit/responsive-wrapper.js +5 -2
  22. package/build/navigation/edit/responsive-wrapper.js.map +1 -1
  23. package/build/navigation/edit/unsaved-inner-blocks.js +4 -35
  24. package/build/navigation/edit/unsaved-inner-blocks.js.map +1 -1
  25. package/build/navigation/edit/use-create-navigation-menu.js +50 -0
  26. package/build/navigation/edit/use-create-navigation-menu.js.map +1 -0
  27. package/build/navigation/edit/use-generate-default-navigation-title.js +73 -0
  28. package/build/navigation/edit/use-generate-default-navigation-title.js.map +1 -0
  29. package/build/navigation/index.js +1 -1
  30. package/build/navigation/save.js +2 -2
  31. package/build/navigation/save.js.map +1 -1
  32. package/build/navigation/use-navigation-menu.js +19 -8
  33. package/build/navigation/use-navigation-menu.js.map +1 -1
  34. package/build/navigation-area/edit.js +5 -0
  35. package/build/navigation-area/edit.js.map +1 -1
  36. package/build/page-list/edit.js +40 -42
  37. package/build/page-list/edit.js.map +1 -1
  38. package/build/pattern/index.js +1 -1
  39. package/build/post-featured-image/edit.js +53 -23
  40. package/build/post-featured-image/edit.js.map +1 -1
  41. package/build/post-terms/index.js +1 -1
  42. package/build/post-title/edit.js +2 -2
  43. package/build/post-title/edit.js.map +1 -1
  44. package/build/query-title/index.js +1 -1
  45. package/build/site-logo/index.js +1 -1
  46. package/build/site-tagline/index.js +1 -1
  47. package/build/site-title/index.js +1 -1
  48. package/build/template-part/edit/placeholder/index.js +1 -1
  49. package/build/template-part/edit/placeholder/index.js.map +1 -1
  50. package/build/template-part/index.js +2 -1
  51. package/build/template-part/index.js.map +1 -1
  52. package/build-module/cover/edit.js +8 -3
  53. package/build-module/cover/edit.js.map +1 -1
  54. package/build-module/cover/transforms.js +2 -0
  55. package/build-module/cover/transforms.js.map +1 -1
  56. package/build-module/gallery/edit.js +1 -1
  57. package/build-module/gallery/edit.js.map +1 -1
  58. package/build-module/gallery/v1/update-gallery-modal.js +1 -1
  59. package/build-module/gallery/v1/update-gallery-modal.js.map +1 -1
  60. package/build-module/index.js +4 -3
  61. package/build-module/index.js.map +1 -1
  62. package/build-module/navigation/deprecated.js +118 -12
  63. package/build-module/navigation/deprecated.js.map +1 -1
  64. package/build-module/navigation/edit/index.js +60 -33
  65. package/build-module/navigation/edit/index.js.map +1 -1
  66. package/build-module/navigation/edit/inner-blocks.js +1 -1
  67. package/build-module/navigation/edit/inner-blocks.js.map +1 -1
  68. package/build-module/navigation/edit/navigation-menu-selector.js +2 -2
  69. package/build-module/navigation/edit/navigation-menu-selector.js.map +1 -1
  70. package/build-module/navigation/edit/placeholder/index.js +15 -45
  71. package/build-module/navigation/edit/placeholder/index.js.map +1 -1
  72. package/build-module/navigation/edit/responsive-wrapper.js +5 -2
  73. package/build-module/navigation/edit/responsive-wrapper.js.map +1 -1
  74. package/build-module/navigation/edit/unsaved-inner-blocks.js +6 -35
  75. package/build-module/navigation/edit/unsaved-inner-blocks.js.map +1 -1
  76. package/build-module/navigation/edit/use-create-navigation-menu.js +36 -0
  77. package/build-module/navigation/edit/use-create-navigation-menu.js.map +1 -0
  78. package/build-module/navigation/edit/use-generate-default-navigation-title.js +57 -0
  79. package/build-module/navigation/edit/use-generate-default-navigation-title.js.map +1 -0
  80. package/build-module/navigation/index.js +1 -1
  81. package/build-module/navigation/save.js +2 -2
  82. package/build-module/navigation/save.js.map +1 -1
  83. package/build-module/navigation/use-navigation-menu.js +19 -8
  84. package/build-module/navigation/use-navigation-menu.js.map +1 -1
  85. package/build-module/navigation-area/edit.js +4 -0
  86. package/build-module/navigation-area/edit.js.map +1 -1
  87. package/build-module/page-list/edit.js +41 -43
  88. package/build-module/page-list/edit.js.map +1 -1
  89. package/build-module/pattern/index.js +1 -1
  90. package/build-module/post-featured-image/edit.js +55 -26
  91. package/build-module/post-featured-image/edit.js.map +1 -1
  92. package/build-module/post-terms/index.js +1 -1
  93. package/build-module/post-title/edit.js +2 -2
  94. package/build-module/post-title/edit.js.map +1 -1
  95. package/build-module/query-title/index.js +1 -1
  96. package/build-module/site-logo/index.js +1 -1
  97. package/build-module/site-tagline/index.js +1 -1
  98. package/build-module/site-title/index.js +1 -1
  99. package/build-module/template-part/edit/placeholder/index.js +2 -2
  100. package/build-module/template-part/edit/placeholder/index.js.map +1 -1
  101. package/build-module/template-part/index.js +2 -1
  102. package/build-module/template-part/index.js.map +1 -1
  103. package/build-style/code/theme-rtl.css +1 -1
  104. package/build-style/code/theme.css +1 -1
  105. package/build-style/cover/style-rtl.css +8 -2
  106. package/build-style/cover/style.css +8 -2
  107. package/build-style/editor-rtl.css +104 -53
  108. package/build-style/editor.css +104 -53
  109. package/build-style/gallery/editor-rtl.css +1 -0
  110. package/build-style/gallery/editor.css +1 -0
  111. package/build-style/navigation/style-rtl.css +40 -3
  112. package/build-style/navigation/style.css +40 -3
  113. package/build-style/post-comments-form/style-rtl.css +18 -0
  114. package/build-style/post-comments-form/style.css +18 -0
  115. package/build-style/post-featured-image/editor-rtl.css +100 -16
  116. package/build-style/post-featured-image/editor.css +100 -16
  117. package/build-style/site-logo/editor-rtl.css +2 -2
  118. package/build-style/site-logo/editor.css +2 -2
  119. package/build-style/social-links/editor-rtl.css +1 -35
  120. package/build-style/social-links/editor.css +1 -35
  121. package/build-style/style-rtl.css +66 -27
  122. package/build-style/style.css +66 -27
  123. package/build-style/theme-rtl.css +1 -1
  124. package/build-style/theme.css +1 -1
  125. package/package.json +8 -8
  126. package/src/calendar/index.php +3 -3
  127. package/src/code/theme.scss +1 -1
  128. package/src/cover/edit.js +8 -1
  129. package/src/cover/style.scss +9 -2
  130. package/src/cover/transforms.js +2 -0
  131. package/src/gallery/edit.js +1 -1
  132. package/src/gallery/editor.scss +1 -0
  133. package/src/gallery/index.php +1 -1
  134. package/src/gallery/v1/update-gallery-modal.js +1 -1
  135. package/src/home-link/index.php +1 -1
  136. package/src/image/index.php +1 -1
  137. package/src/index.js +28 -26
  138. package/src/navigation/block.json +1 -1
  139. package/src/navigation/deprecated.js +105 -4
  140. package/src/navigation/edit/index.js +68 -36
  141. package/src/navigation/edit/inner-blocks.js +2 -1
  142. package/src/navigation/edit/navigation-menu-selector.js +2 -2
  143. package/src/navigation/edit/placeholder/index.js +16 -62
  144. package/src/navigation/edit/responsive-wrapper.js +8 -1
  145. package/src/navigation/edit/unsaved-inner-blocks.js +6 -57
  146. package/src/navigation/edit/use-create-navigation-menu.js +39 -0
  147. package/src/navigation/edit/use-generate-default-navigation-title.js +79 -0
  148. package/src/navigation/index.php +173 -19
  149. package/src/navigation/save.js +2 -2
  150. package/src/navigation/style.scss +56 -5
  151. package/src/navigation/use-navigation-menu.js +20 -9
  152. package/src/navigation-area/edit.js +5 -0
  153. package/src/navigation-area/index.php +2 -1
  154. package/src/navigation-link/index.php +1 -1
  155. package/src/navigation-submenu/index.php +2 -8
  156. package/src/page-list/edit.js +35 -44
  157. package/src/page-list/index.php +10 -5
  158. package/src/pattern/block.json +1 -1
  159. package/src/post-comments-form/style.scss +20 -1
  160. package/src/post-featured-image/edit.js +58 -26
  161. package/src/post-featured-image/editor.scss +124 -20
  162. package/src/post-terms/block.json +1 -1
  163. package/src/post-title/edit.js +2 -2
  164. package/src/query-title/block.json +1 -1
  165. package/src/site-logo/block.json +1 -1
  166. package/src/site-logo/editor.scss +3 -2
  167. package/src/site-tagline/block.json +1 -1
  168. package/src/site-title/block.json +1 -1
  169. package/src/social-links/editor.scss +1 -47
  170. package/src/style.scss +0 -1
  171. package/src/table-of-contents/index.php +1 -1
  172. package/src/template-part/block.json +2 -1
  173. package/src/template-part/edit/placeholder/index.js +2 -2
  174. package/src/template-part/index.php +2 -1
  175. package/build/navigation/edit/navigation-menu-name-modal.js +0 -55
  176. package/build/navigation/edit/navigation-menu-name-modal.js.map +0 -1
  177. package/build/navigation/edit/navigation-menu-publish-button.js +0 -53
  178. package/build/navigation/edit/navigation-menu-publish-button.js.map +0 -1
  179. package/build-module/navigation/edit/navigation-menu-name-modal.js +0 -47
  180. package/build-module/navigation/edit/navigation-menu-name-modal.js.map +0 -1
  181. package/build-module/navigation/edit/navigation-menu-publish-button.js +0 -40
  182. package/build-module/navigation/edit/navigation-menu-publish-button.js.map +0 -1
  183. package/build-style/navigation-submenu/style-rtl.css +0 -97
  184. package/build-style/navigation-submenu/style.css +0 -97
  185. package/src/navigation/edit/navigation-menu-name-modal.js +0 -69
  186. package/src/navigation/edit/navigation-menu-publish-button.js +0 -57
  187. package/src/navigation-submenu/style.scss +0 -25
@@ -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', gutenberg_experimental_to_kebab_case( $context['textColor'] ) );
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', gutenberg_experimental_to_kebab_case( $context['backgroundColor'] ) );
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', gutenberg_experimental_to_kebab_case( $context['overlayTextColor'] ) );
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', gutenberg_experimental_to_kebab_case( $context['overlayBackgroundColor'] ) );
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 . ' "href="' . esc_url( $page['link'] ) . '"' . $aria_current . '>' . wp_kses(
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;
@@ -2,7 +2,7 @@
2
2
  "apiVersion": 2,
3
3
  "name": "core/pattern",
4
4
  "title": "Pattern",
5
- "category": "design",
5
+ "category": "theme",
6
6
  "description": "Show a block pattern.",
7
7
  "supports": {
8
8
  "html": false,
@@ -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
- withNotices,
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 { postFeaturedImage } from '@wordpress/icons';
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-image_placeholder">
31
- <Icon icon={ postFeaturedImage } />
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
- function onUploadError( message ) {
66
- noticeOperations.removeAllNotices();
67
- noticeOperations.createErrorNotice( message );
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
- labels={ {
83
- title: __( 'Featured image' ),
84
- instructions: __(
85
- 'Upload a media file or pick one from your media library.'
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 <PostFeaturedImageWithNotices { ...props } />;
178
+ return <PostFeaturedImageDisplay { ...props } />;
147
179
  }
@@ -1,33 +1,137 @@
1
- div[data-type="core/post-featured-image"] {
2
- img {
3
- max-width: 100%;
4
- height: auto;
5
- display: block;
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
- .editor-styles-wrapper {
10
- .post-featured-image_placeholder {
11
- display: flex;
12
- flex-direction: row;
11
+ // Style the placeholder.
12
+ .wp-block-post-featured-image__placeholder,
13
+ .components-placeholder {
14
+ justify-content: center;
13
15
  align-items: center;
14
- border-radius: $radius-block-ui;
15
- background-color: $white;
16
- box-shadow: inset 0 0 0 $border-width $gray-900;
17
- padding: $grid-unit-15;
18
- svg {
19
- margin-right: $grid-unit-15;
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
- p {
22
- font-family: $default-font;
23
- font-size: $default-font-size;
24
- margin: 0;
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
  }
@@ -2,7 +2,7 @@
2
2
  "apiVersion": 2,
3
3
  "name": "core/post-terms",
4
4
  "title": "Post Terms",
5
- "category": "design",
5
+ "category": "theme",
6
6
  "description": "Post terms.",
7
7
  "textdomain": "default",
8
8
  "attributes": {
@@ -62,7 +62,7 @@ export default function PostTitleEdit( {
62
62
  />
63
63
  ) : (
64
64
  <TagName { ...blockProps }>
65
- <RawHTML key="html">{ fullTitle.rendered }</RawHTML>
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.rendered }</RawHTML>
95
+ <RawHTML key="html">{ fullTitle?.rendered }</RawHTML>
96
96
  </a>
97
97
  </TagName>
98
98
  );
@@ -2,7 +2,7 @@
2
2
  "apiVersion": 2,
3
3
  "name": "core/query-title",
4
4
  "title": "Query Title",
5
- "category": "design",
5
+ "category": "theme",
6
6
  "description": "Display the query title.",
7
7
  "textdomain": "default",
8
8
  "attributes": {
@@ -2,7 +2,7 @@
2
2
  "apiVersion": 2,
3
3
  "name": "core/site-logo",
4
4
  "title": "Site Logo",
5
- "category": "layout",
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.3;
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.3;
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": "design",
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": "design",
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";
@@ -2,7 +2,7 @@
2
2
  /**
3
3
  * Server-side rendering of the `core/table-of-contents` block.
4
4
  *
5
- * @package gutenberg
5
+ * @package WordPress
6
6
  */
7
7
 
8
8
  /**
@@ -29,7 +29,8 @@
29
29
  "spacing": {
30
30
  "padding": true
31
31
  },
32
- "__experimentalLayout": true
32
+ "__experimentalLayout": true,
33
+ "reusable": false
33
34
  },
34
35
  "editorStyle": "wp-block-template-part-editor"
35
36
  }
@@ -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: 'template-part',
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
- $template_part_file_path = get_theme_file_path( '/block-template-parts/' . $attributes['slug'] . '.html' );
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