@wordpress/block-library 7.15.0 → 7.16.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.
Files changed (180) hide show
  1. package/CHANGELOG.md +3 -0
  2. package/build/code/utils.js +3 -3
  3. package/build/code/utils.js.map +1 -1
  4. package/build/comments-pagination-numbers/index.js +7 -0
  5. package/build/comments-pagination-numbers/index.js.map +1 -1
  6. package/build/gallery/gallery.js +2 -28
  7. package/build/gallery/gallery.js.map +1 -1
  8. package/build/group/edit.js +1 -1
  9. package/build/group/edit.js.map +1 -1
  10. package/build/navigation/edit/index.js +12 -12
  11. package/build/navigation/edit/index.js.map +1 -1
  12. package/build/paragraph/deprecated.js +49 -10
  13. package/build/paragraph/deprecated.js.map +1 -1
  14. package/build/paragraph/drop-zone.js +99 -0
  15. package/build/paragraph/drop-zone.js.map +1 -0
  16. package/build/paragraph/edit.js +30 -6
  17. package/build/paragraph/edit.js.map +1 -1
  18. package/build/paragraph/save.js +3 -1
  19. package/build/paragraph/save.js.map +1 -1
  20. package/build/post-author/edit.js +20 -2
  21. package/build/post-author/edit.js.map +1 -1
  22. package/build/post-author/index.js +8 -0
  23. package/build/post-author/index.js.map +1 -1
  24. package/build/post-content/edit.js +6 -1
  25. package/build/post-content/edit.js.map +1 -1
  26. package/build/post-featured-image/index.js +1 -1
  27. package/build/post-featured-image/overlay.js +2 -2
  28. package/build/post-featured-image/overlay.js.map +1 -1
  29. package/build/post-terms/index.js +4 -0
  30. package/build/post-terms/index.js.map +1 -1
  31. package/build/query/edit/inspector-controls/author-control.js +2 -1
  32. package/build/query/edit/inspector-controls/author-control.js.map +1 -1
  33. package/build/query/edit/inspector-controls/index.js +1 -1
  34. package/build/query/edit/inspector-controls/index.js.map +1 -1
  35. package/build/query/edit/inspector-controls/parent-control.js +2 -1
  36. package/build/query/edit/inspector-controls/parent-control.js.map +1 -1
  37. package/build/query/edit/inspector-controls/taxonomy-controls.js +2 -1
  38. package/build/query/edit/inspector-controls/taxonomy-controls.js.map +1 -1
  39. package/build/query/utils.js +1 -1
  40. package/build/query/utils.js.map +1 -1
  41. package/build/quote/index.js +0 -1
  42. package/build/quote/index.js.map +1 -1
  43. package/build/site-title/index.js +2 -1
  44. package/build/site-title/index.js.map +1 -1
  45. package/build/template-part/index.js +2 -2
  46. package/build/template-part/index.js.map +1 -1
  47. package/build/video/edit.js +13 -1
  48. package/build/video/edit.js.map +1 -1
  49. package/build-module/code/utils.js +3 -3
  50. package/build-module/code/utils.js.map +1 -1
  51. package/build-module/comments-pagination-numbers/index.js +7 -0
  52. package/build-module/comments-pagination-numbers/index.js.map +1 -1
  53. package/build-module/gallery/gallery.js +2 -29
  54. package/build-module/gallery/gallery.js.map +1 -1
  55. package/build-module/group/edit.js +1 -1
  56. package/build-module/group/edit.js.map +1 -1
  57. package/build-module/navigation/edit/index.js +12 -12
  58. package/build-module/navigation/edit/index.js.map +1 -1
  59. package/build-module/paragraph/deprecated.js +49 -11
  60. package/build-module/paragraph/deprecated.js.map +1 -1
  61. package/build-module/paragraph/drop-zone.js +88 -0
  62. package/build-module/paragraph/drop-zone.js.map +1 -0
  63. package/build-module/paragraph/edit.js +29 -6
  64. package/build-module/paragraph/edit.js.map +1 -1
  65. package/build-module/paragraph/save.js +2 -1
  66. package/build-module/paragraph/save.js.map +1 -1
  67. package/build-module/post-author/edit.js +21 -2
  68. package/build-module/post-author/edit.js.map +1 -1
  69. package/build-module/post-author/index.js +8 -0
  70. package/build-module/post-author/index.js.map +1 -1
  71. package/build-module/post-content/edit.js +6 -1
  72. package/build-module/post-content/edit.js.map +1 -1
  73. package/build-module/post-featured-image/index.js +1 -1
  74. package/build-module/post-featured-image/overlay.js +2 -2
  75. package/build-module/post-featured-image/overlay.js.map +1 -1
  76. package/build-module/post-terms/index.js +4 -0
  77. package/build-module/post-terms/index.js.map +1 -1
  78. package/build-module/query/edit/inspector-controls/author-control.js +2 -1
  79. package/build-module/query/edit/inspector-controls/author-control.js.map +1 -1
  80. package/build-module/query/edit/inspector-controls/index.js +1 -1
  81. package/build-module/query/edit/inspector-controls/index.js.map +1 -1
  82. package/build-module/query/edit/inspector-controls/parent-control.js +2 -1
  83. package/build-module/query/edit/inspector-controls/parent-control.js.map +1 -1
  84. package/build-module/query/edit/inspector-controls/taxonomy-controls.js +2 -1
  85. package/build-module/query/edit/inspector-controls/taxonomy-controls.js.map +1 -1
  86. package/build-module/query/utils.js +1 -1
  87. package/build-module/query/utils.js.map +1 -1
  88. package/build-module/quote/index.js +0 -1
  89. package/build-module/quote/index.js.map +1 -1
  90. package/build-module/site-title/index.js +2 -1
  91. package/build-module/site-title/index.js.map +1 -1
  92. package/build-module/template-part/index.js +2 -2
  93. package/build-module/template-part/index.js.map +1 -1
  94. package/build-module/video/edit.js +15 -3
  95. package/build-module/video/edit.js.map +1 -1
  96. package/build-style/classic-rtl.css +85 -0
  97. package/build-style/classic.css +85 -0
  98. package/build-style/code/style-rtl.css +3 -0
  99. package/build-style/code/style.css +3 -0
  100. package/build-style/editor-rtl.css +110 -31
  101. package/build-style/editor.css +110 -31
  102. package/build-style/group/editor-rtl.css +11 -1
  103. package/build-style/group/editor.css +11 -1
  104. package/build-style/image/editor-rtl.css +3 -0
  105. package/build-style/image/editor.css +3 -0
  106. package/build-style/navigation/editor-rtl.css +15 -1
  107. package/build-style/navigation/editor.css +15 -1
  108. package/build-style/navigation/style-rtl.css +3 -0
  109. package/build-style/navigation/style.css +3 -0
  110. package/build-style/paragraph/editor-rtl.css +16 -0
  111. package/build-style/paragraph/editor.css +16 -0
  112. package/build-style/paragraph/style-rtl.css +5 -0
  113. package/build-style/paragraph/style.css +5 -0
  114. package/build-style/post-featured-image/editor-rtl.css +39 -29
  115. package/build-style/post-featured-image/editor.css +39 -29
  116. package/build-style/post-terms/style-rtl.css +4 -1
  117. package/build-style/post-terms/style.css +4 -1
  118. package/build-style/site-title/editor-rtl.css +4 -0
  119. package/build-style/site-title/editor.css +4 -0
  120. package/build-style/site-title/style-rtl.css +79 -0
  121. package/build-style/site-title/style.css +79 -0
  122. package/build-style/style-rtl.css +19 -1
  123. package/build-style/style.css +19 -1
  124. package/build-style/video/editor-rtl.css +22 -0
  125. package/build-style/video/editor.css +22 -0
  126. package/package.json +28 -28
  127. package/src/archives/index.php +4 -7
  128. package/src/categories/index.php +1 -1
  129. package/src/classic.scss +15 -0
  130. package/src/code/style.scss +12 -7
  131. package/src/code/utils.js +3 -3
  132. package/src/comment-author-name/index.php +1 -1
  133. package/src/comment-reply-link/index.php +1 -1
  134. package/src/comment-template/index.php +18 -9
  135. package/src/comments-pagination-numbers/block.json +7 -0
  136. package/src/cover/index.php +1 -1
  137. package/src/gallery/gallery.js +1 -31
  138. package/src/group/edit.js +1 -1
  139. package/src/image/editor.scss +4 -0
  140. package/src/latest-posts/index.php +1 -1
  141. package/src/navigation/edit/index.js +12 -10
  142. package/src/navigation/editor.scss +6 -0
  143. package/src/navigation/style.scss +8 -0
  144. package/src/navigation-submenu/index.php +11 -2
  145. package/src/page-list/index.php +3 -3
  146. package/src/paragraph/deprecated.js +36 -0
  147. package/src/paragraph/drop-zone.js +105 -0
  148. package/src/paragraph/edit.js +37 -9
  149. package/src/paragraph/editor.scss +20 -0
  150. package/src/paragraph/save.js +5 -1
  151. package/src/paragraph/style.scss +5 -0
  152. package/src/post-author/block.json +8 -0
  153. package/src/post-author/edit.js +29 -3
  154. package/src/post-author/index.php +7 -1
  155. package/src/post-content/edit.js +3 -1
  156. package/src/post-featured-image/block.json +1 -1
  157. package/src/post-featured-image/editor.scss +79 -72
  158. package/src/post-featured-image/index.php +18 -24
  159. package/src/post-featured-image/overlay.js +17 -14
  160. package/src/post-terms/block.json +4 -0
  161. package/src/post-terms/style.scss +7 -2
  162. package/src/query/edit/inspector-controls/author-control.js +1 -0
  163. package/src/query/edit/inspector-controls/index.js +1 -4
  164. package/src/query/edit/inspector-controls/parent-control.js +1 -0
  165. package/src/query/edit/inspector-controls/taxonomy-controls.js +1 -0
  166. package/src/query/utils.js +1 -1
  167. package/src/quote/block.json +0 -1
  168. package/src/site-title/block.json +2 -1
  169. package/src/site-title/editor.scss +6 -0
  170. package/src/site-title/style.scss +5 -0
  171. package/src/style.scss +1 -0
  172. package/src/tag-cloud/index.php +1 -8
  173. package/src/template-part/index.js +2 -2
  174. package/src/video/edit.js +19 -0
  175. package/src/video/editor.scss +37 -0
  176. package/build/navigation-submenu/view.js +0 -56
  177. package/build/navigation-submenu/view.js.map +0 -1
  178. package/build-module/navigation-submenu/view.js +0 -54
  179. package/build-module/navigation-submenu/view.js.map +0 -1
  180. package/src/navigation-submenu/view.js +0 -67
@@ -46,9 +46,10 @@ function PostAuthorEdit( {
46
46
 
47
47
  const { editEntityRecord } = useDispatch( coreStore );
48
48
 
49
- const { textAlign, showAvatar, showBio, byline } = attributes;
50
-
49
+ const { textAlign, showAvatar, showBio, byline, isLink, linkTarget } =
50
+ attributes;
51
51
  const avatarSizes = [];
52
+ const authorName = authorDetails?.name || __( 'Post Author' );
52
53
  if ( authorDetails ) {
53
54
  Object.keys( authorDetails.avatar_urls ).forEach( ( size ) => {
54
55
  avatarSizes.push( {
@@ -118,6 +119,22 @@ function PostAuthorEdit( {
118
119
  setAttributes( { showBio: ! showBio } )
119
120
  }
120
121
  />
122
+ <ToggleControl
123
+ label={ __( 'Link author name to author page' ) }
124
+ checked={ isLink }
125
+ onChange={ () => setAttributes( { isLink: ! isLink } ) }
126
+ />
127
+ { isLink && (
128
+ <ToggleControl
129
+ label={ __( 'Open in new tab' ) }
130
+ onChange={ ( value ) =>
131
+ setAttributes( {
132
+ linkTarget: value ? '_blank' : '_self',
133
+ } )
134
+ }
135
+ checked={ linkTarget === '_blank' }
136
+ />
137
+ ) }
121
138
  </PanelBody>
122
139
  </InspectorControls>
123
140
 
@@ -158,7 +175,16 @@ function PostAuthorEdit( {
158
175
  />
159
176
  ) }
160
177
  <p className="wp-block-post-author__name">
161
- { authorDetails?.name || __( 'Post Author' ) }
178
+ { isLink ? (
179
+ <a
180
+ href="#post-author-pseudo-link"
181
+ onClick={ ( event ) => event.preventDefault() }
182
+ >
183
+ { authorName }
184
+ </a>
185
+ ) : (
186
+ authorName
187
+ ) }
162
188
  </p>
163
189
  { showBio && (
164
190
  <p
@@ -29,6 +29,12 @@ function render_block_core_post_author( $attributes, $content, $block ) {
29
29
  $attributes['avatarSize']
30
30
  ) : null;
31
31
 
32
+ $link = get_author_posts_url( $author_id );
33
+ $author_name = get_the_author_meta( 'display_name', $author_id );
34
+ if ( ! empty( $attributes['isLink'] && ! empty( $attributes['linkTarget'] ) ) ) {
35
+ $author_name = sprintf( '<a href="%1s" target="%2s">%2s</a>', esc_url( $link ), esc_attr( $attributes['linkTarget'] ), $author_name );
36
+ }
37
+
32
38
  $byline = ! empty( $attributes['byline'] ) ? $attributes['byline'] : false;
33
39
  $classes = array_merge(
34
40
  isset( $attributes['itemsJustification'] ) ? array( 'items-justified-' . $attributes['itemsJustification'] ) : array(),
@@ -41,7 +47,7 @@ function render_block_core_post_author( $attributes, $content, $block ) {
41
47
  ( ! empty( $attributes['showAvatar'] ) ? '<div class="wp-block-post-author__avatar">' . $avatar . '</div>' : '' ) .
42
48
  '<div class="wp-block-post-author__content">' .
43
49
  ( ! empty( $byline ) ? '<p class="wp-block-post-author__byline">' . wp_kses_post( $byline ) . '</p>' : '' ) .
44
- '<p class="wp-block-post-author__name">' . get_the_author_meta( 'display_name', $author_id ) . '</p>' .
50
+ '<p class="wp-block-post-author__name">' . $author_name . '</p>' .
45
51
  ( ! empty( $attributes['showBio'] ) ? '<p class="wp-block-post-author__bio">' . get_the_author_meta( 'user_description', $author_id ) . '</p>' : '' ) .
46
52
  '</div>' .
47
53
  '</div>';
@@ -46,7 +46,9 @@ function EditableContent( { layout, context = {} } ) {
46
46
  return getSettings()?.supportsLayout;
47
47
  }, [] );
48
48
  const defaultLayout = useSetting( 'layout' ) || {};
49
- const usedLayout = !! layout && layout.inherit ? defaultLayout : layout;
49
+ const usedLayout = ! layout?.type
50
+ ? { ...defaultLayout, ...layout, type: 'default' }
51
+ : { ...defaultLayout, ...layout };
50
52
  const [ blocks, onInput, onChange ] = useEntityBlockEditor(
51
53
  'postType',
52
54
  postType,
@@ -62,7 +62,7 @@
62
62
  "color": true,
63
63
  "radius": true,
64
64
  "width": true,
65
- "__experimentalSelector": "img, .block-editor-media-placeholder",
65
+ "__experimentalSelector": "img, .block-editor-media-placeholder, .wp-block-post-featured-image__overlay",
66
66
  "__experimentalSkipSerialization": true,
67
67
  "__experimentalDefaultControls": {
68
68
  "color": true,
@@ -6,87 +6,94 @@
6
6
  backdrop-filter: none; // Removes background blur so the overlay's actual color is visible.
7
7
  }
8
8
 
9
- &.wp-block-post-featured-image {
10
- // Style the placeholder.
11
- .wp-block-post-featured-image__placeholder,
12
- .components-placeholder {
13
- justify-content: center;
14
- align-items: center;
15
- padding: 0;
9
+ // Style the placeholder.
10
+ .wp-block-post-featured-image__placeholder,
11
+ .components-placeholder {
12
+ justify-content: center;
13
+ align-items: center;
14
+ padding: 0;
16
15
 
17
- // Hide the upload button, as it's also available in the media library.
18
- .components-form-file-upload {
19
- display: none;
20
- }
16
+ // Hide the upload button, as it's also available in the media library.
17
+ .components-form-file-upload {
18
+ display: none;
19
+ }
21
20
 
22
- // Style the upload button.
23
- .components-button.components-button {
24
- padding: 0;
25
- display: flex;
26
- justify-content: center;
27
- align-items: center;
28
- width: $grid-unit-60;
29
- height: $grid-unit-60;
30
- border-radius: 50%;
31
- position: relative;
32
- background: var(--wp-admin-theme-color);
33
- border-color: var(--wp-admin-theme-color);
34
- border-style: solid;
35
- color: $white;
21
+ // Style the upload button.
22
+ .components-button {
23
+ padding: 0;
24
+ display: flex;
25
+ justify-content: center;
26
+ align-items: center;
27
+ width: $grid-unit-60;
28
+ height: $grid-unit-60;
29
+ border-radius: 50%;
30
+ position: relative;
31
+ background: var(--wp-admin-theme-color);
32
+ border-color: var(--wp-admin-theme-color);
33
+ border-style: solid;
34
+ color: $white;
36
35
 
37
- > svg {
38
- color: inherit;
39
- }
36
+ > svg {
37
+ color: inherit;
40
38
  }
39
+ }
41
40
 
42
- // Show default placeholder height when not resized.
43
- min-height: 200px;
44
-
45
- // The following override the default placeholder styles that remove
46
- // its border so that a user selection for border color or width displays
47
- // a visual border.
48
- &:where(.has-border-color) {
49
- border-style: solid;
50
- }
51
- &:where([style*="border-top-color"]) {
52
- border-top-style: solid;
53
- }
54
- &:where([style*="border-right-color"]) {
55
- border-right-style: solid;
56
- }
57
- &:where([style*="border-bottom-color"]) {
58
- border-bottom-style: solid;
59
- }
60
- &:where([style*="border-left-color"]) {
61
- border-left-style: solid;
62
- }
41
+ // Show default placeholder height when not resized.
42
+ min-height: 200px;
43
+ }
63
44
 
64
- &:where([style*="border-width"]) {
65
- border-style: solid;
66
- }
67
- &:where([style*="border-top-width"]) {
68
- border-top-style: solid;
69
- }
70
- &:where([style*="border-right-width"]) {
71
- border-right-style: solid;
72
- }
73
- &:where([style*="border-bottom-width"]) {
74
- border-bottom-style: solid;
75
- }
76
- &:where([style*="border-left-width"]) {
77
- border-left-style: solid;
78
- }
45
+ // The following override the default placeholder styles that remove
46
+ // its border so that a user selection for border color or width displays
47
+ // a visual border. They also override the `img { border: none; }` applied
48
+ // by core.
49
+ .wp-block-post-featured-image__placeholder,
50
+ .components-placeholder,
51
+ img {
52
+ // The following is required to overcome WP Core applying styles that clear
53
+ // img borders with a higher specificity than those added by the border
54
+ // block support to provide a default border-style of solid when a border
55
+ // color or width has been set.
56
+ &:where(.has-border-color) {
57
+ border-style: solid;
58
+ }
59
+ &:where([style*="border-top-color"]) {
60
+ border-top-style: solid;
61
+ }
62
+ &:where([style*="border-right-color"]) {
63
+ border-right-style: solid;
64
+ }
65
+ &:where([style*="border-bottom-color"]) {
66
+ border-bottom-style: solid;
67
+ }
68
+ &:where([style*="border-left-color"]) {
69
+ border-left-style: solid;
79
70
  }
80
71
 
81
- // Provide a minimum size for the placeholder when resized.
82
- // Note, this should be as small as we can afford it, and exists only
83
- // to ensure there's room for the upload button.
84
- &[style*="height"] .components-placeholder {
85
- min-height: $grid-unit-60;
86
- min-width: $grid-unit-60;
87
- height: 100%;
88
- width: 100%;
72
+ &:where([style*="border-width"]) {
73
+ border-style: solid;
74
+ }
75
+ &:where([style*="border-top-width"]) {
76
+ border-top-style: solid;
77
+ }
78
+ &:where([style*="border-right-width"]) {
79
+ border-right-style: solid;
89
80
  }
81
+ &:where([style*="border-bottom-width"]) {
82
+ border-bottom-style: solid;
83
+ }
84
+ &:where([style*="border-left-width"]) {
85
+ border-left-style: solid;
86
+ }
87
+ }
88
+
89
+ // Provide a minimum size for the placeholder when resized.
90
+ // Note, this should be as small as we can afford it, and exists only
91
+ // to ensure there's room for the upload button.
92
+ &[style*="height"] .components-placeholder {
93
+ min-height: $grid-unit-60;
94
+ min-width: $grid-unit-60;
95
+ height: 100%;
96
+ width: 100%;
90
97
  }
91
98
  }
92
99
 
@@ -76,16 +76,25 @@ function get_block_core_post_featured_image_overlay_element_markup( $attributes
76
76
  $has_custom_gradient = isset( $attributes['customGradient'] ) && $attributes['customGradient'];
77
77
  $has_solid_overlay = isset( $attributes['overlayColor'] ) && $attributes['overlayColor'];
78
78
  $has_custom_overlay = isset( $attributes['customOverlayColor'] ) && $attributes['customOverlayColor'];
79
- $class_names = array(
80
- 'wp-block-post-featured-image__overlay',
81
- );
82
- $styles_properties = array();
79
+ $class_names = array( 'wp-block-post-featured-image__overlay' );
80
+ $styles = array();
83
81
 
84
82
  if ( ! $has_dim_background ) {
85
83
  return '';
86
84
  }
87
85
 
88
- // Generate required classes for the element.
86
+ // Apply border classes and styles.
87
+ $border_attributes = get_block_core_post_featured_image_border_attributes( $attributes );
88
+
89
+ if ( ! empty( $border_attributes['class'] ) ) {
90
+ $class_names[] = $border_attributes['class'];
91
+ }
92
+
93
+ if ( ! empty( $border_attributes['style'] ) ) {
94
+ $styles[] = $border_attributes['style'];
95
+ }
96
+
97
+ // Apply overlay and gradient classes.
89
98
  if ( $has_dim_background ) {
90
99
  $class_names[] = 'has-background-dim';
91
100
  $class_names[] = "has-background-dim-{$attributes['dimRatio']}";
@@ -103,35 +112,20 @@ function get_block_core_post_featured_image_overlay_element_markup( $attributes
103
112
  $class_names[] = "has-{$attributes['gradient']}-gradient-background";
104
113
  }
105
114
 
106
- // Generate required CSS properties and their values.
107
- if ( ! empty( $attributes['style']['border']['radius'] ) ) {
108
- $styles_properties['border-radius'] = $attributes['style']['border']['radius'];
109
- }
110
-
111
- if ( ! empty( $attributes['style']['border']['width'] ) ) {
112
- $styles_properties['border-width'] = $attributes['style']['border']['width'];
113
- }
114
-
115
+ // Apply background styles.
115
116
  if ( $has_custom_gradient ) {
116
- $styles_properties['background-image'] = $attributes['customGradient'];
117
+ $styles[] = sprintf( 'background-image: %s;', $attributes['customGradient'] );
117
118
  }
118
119
 
119
120
  if ( $has_custom_overlay ) {
120
- $styles_properties['background-color'] = $attributes['customOverlayColor'];
121
- }
122
-
123
- $styles = '';
124
-
125
- foreach ( $styles_properties as $style_attribute => $style_attribute_value ) {
126
- $styles .= "{$style_attribute}: $style_attribute_value; ";
121
+ $styles[] = sprintf( 'background-color: %s;', $attributes['customOverlayColor'] );
127
122
  }
128
123
 
129
124
  return sprintf(
130
125
  '<span class="%s" style="%s" aria-hidden="true"></span>',
131
126
  esc_attr( implode( ' ', $class_names ) ),
132
- esc_attr( trim( $styles ) )
127
+ esc_attr( safecss_filter_attr( implode( ' ', $styles ) ) )
133
128
  );
134
-
135
129
  }
136
130
 
137
131
  /**
@@ -47,20 +47,23 @@ const Overlay = ( {
47
47
 
48
48
  return (
49
49
  <>
50
- <span
51
- aria-hidden="true"
52
- className={ classnames(
53
- 'wp-block-post-featured-image__overlay',
54
- dimRatioToClass( dimRatio ),
55
- {
56
- [ overlayColor.class ]: overlayColor.class,
57
- 'has-background-dim': dimRatio !== undefined,
58
- 'has-background-gradient': gradientValue,
59
- [ gradientClass ]: gradientClass,
60
- }
61
- ) }
62
- style={ overlayStyles }
63
- />
50
+ { !! dimRatio && (
51
+ <span
52
+ aria-hidden="true"
53
+ className={ classnames(
54
+ 'wp-block-post-featured-image__overlay',
55
+ dimRatioToClass( dimRatio ),
56
+ {
57
+ [ overlayColor.class ]: overlayColor.class,
58
+ 'has-background-dim': dimRatio !== undefined,
59
+ 'has-background-gradient': gradientValue,
60
+ [ gradientClass ]: gradientClass,
61
+ },
62
+ borderProps.className
63
+ ) }
64
+ style={ overlayStyles }
65
+ />
66
+ ) }
64
67
  <InspectorControls __experimentalGroup="color">
65
68
  <ColorGradientSettingsDropdown
66
69
  __experimentalHasMultipleOrigins
@@ -38,6 +38,10 @@
38
38
  "link": true
39
39
  }
40
40
  },
41
+ "spacing": {
42
+ "margin": true,
43
+ "padding": true
44
+ },
41
45
  "typography": {
42
46
  "fontSize": true,
43
47
  "lineHeight": true,
@@ -1,3 +1,8 @@
1
- .wp-block-post-terms__separator {
2
- white-space: pre-wrap;
1
+ .wp-block-post-terms {
2
+ // This block has customizable padding, border-box makes that more predictable.
3
+ box-sizing: border-box;
4
+
5
+ .wp-block-post-terms__separator {
6
+ white-space: pre-wrap;
7
+ }
3
8
  }
@@ -71,6 +71,7 @@ function AuthorControl( { value, onChange } ) {
71
71
  value={ sanitizedValue }
72
72
  suggestions={ authorsInfo.names }
73
73
  onChange={ onAuthorChange }
74
+ __experimentalShowHowTo={ false }
74
75
  />
75
76
  );
76
77
  }
@@ -237,10 +237,7 @@ export default function QueryInspectorControls( {
237
237
  </ToolsPanelItem>
238
238
  ) }
239
239
  { isPostTypeHierarchical &&
240
- ! isControlAllowed(
241
- allowedControls,
242
- 'parents'
243
- ) && (
240
+ isControlAllowed( allowedControls, 'parents' ) && (
244
241
  <ToolsPanelItem
245
242
  hasValue={ () => !! parents?.length }
246
243
  label={ __( 'Parents' ) }
@@ -125,6 +125,7 @@ function ParentControl( { parents, postType, onChange } ) {
125
125
  onInputChange={ debouncedSearch }
126
126
  suggestions={ suggestions }
127
127
  onChange={ onParentChange }
128
+ __experimentalShowHowTo={ false }
128
129
  />
129
130
  );
130
131
  }
@@ -116,6 +116,7 @@ export function TaxonomyControls( { onChange, query } ) {
116
116
  value={ getExistingTaxQueryValue( slug ) }
117
117
  suggestions={ terms.names }
118
118
  onChange={ onTermsChange( slug ) }
119
+ __experimentalShowHowTo={ false }
119
120
  />
120
121
  </div>
121
122
  );
@@ -162,7 +162,7 @@ export function useAllowedControls( attributes ) {
162
162
  select( blocksStore ).getActiveBlockVariation(
163
163
  queryLoopName,
164
164
  attributes
165
- )?.allowControls,
165
+ )?.allowedControls,
166
166
 
167
167
  [ attributes ]
168
168
  );
@@ -29,7 +29,6 @@
29
29
  },
30
30
  "supports": {
31
31
  "anchor": true,
32
- "__experimentalSlashInserter": true,
33
32
  "__experimentalOnEnter": true,
34
33
  "typography": {
35
34
  "fontSize": true,
@@ -60,5 +60,6 @@
60
60
  }
61
61
  }
62
62
  },
63
- "editorStyle": "wp-block-site-title-editor"
63
+ "editorStyle": "wp-block-site-title-editor",
64
+ "style": "wp-block-site-title"
64
65
  }
@@ -2,3 +2,9 @@
2
2
  padding: 1em 0;
3
3
  border: 1px dashed;
4
4
  }
5
+
6
+ .editor-styles-wrapper .wp-block-site-title {
7
+ a {
8
+ color: inherit;
9
+ }
10
+ }
@@ -0,0 +1,5 @@
1
+ .wp-block-site-title {
2
+ a {
3
+ color: inherit;
4
+ }
5
+ }
package/src/style.scss CHANGED
@@ -44,6 +44,7 @@
44
44
  @import "./search/style.scss";
45
45
  @import "./separator/style.scss";
46
46
  @import "./site-logo/style.scss";
47
+ @import "./site-title/style.scss";
47
48
  @import "./social-links/style.scss";
48
49
  @import "./spacer/style.scss";
49
50
  @import "./tag-cloud/style.scss";
@@ -28,14 +28,7 @@ function render_block_core_tag_cloud( $attributes ) {
28
28
  $tag_cloud = wp_tag_cloud( $args );
29
29
 
30
30
  if ( ! $tag_cloud ) {
31
- $labels = get_taxonomy_labels( get_taxonomy( $attributes['taxonomy'] ) );
32
- $tag_cloud = esc_html(
33
- sprintf(
34
- /* translators: %s: taxonomy name */
35
- __( 'Your site doesn&#8217;t have any %s, so there&#8217;s nothing to display here at the moment.' ),
36
- strtolower( $labels->name )
37
- )
38
- );
31
+ $tag_cloud = __( 'There&#8217;s no content to show here yet.' );
39
32
  }
40
33
 
41
34
  $wrapper_attributes = get_block_wrapper_attributes();
@@ -62,13 +62,13 @@ export const init = () => {
62
62
  'blockEditor.__unstableCanInsertBlockType',
63
63
  'removeTemplatePartsFromPostTemplates',
64
64
  (
65
- can,
65
+ canInsert,
66
66
  blockType,
67
67
  rootClientId,
68
68
  { getBlock, getBlockParentsByBlockName }
69
69
  ) => {
70
70
  if ( blockType.name !== 'core/template-part' ) {
71
- return can;
71
+ return canInsert;
72
72
  }
73
73
 
74
74
  for ( const disallowedParentType of DISALLOWED_PARENTS ) {
package/src/video/edit.js CHANGED
@@ -13,6 +13,7 @@ import {
13
13
  Disabled,
14
14
  PanelBody,
15
15
  Spinner,
16
+ Placeholder,
16
17
  } from '@wordpress/components';
17
18
  import {
18
19
  BlockControls,
@@ -43,6 +44,23 @@ import VideoCommonSettings from './edit-common-settings';
43
44
  import TracksEditor from './tracks-editor';
44
45
  import Tracks from './tracks';
45
46
 
47
+ // Much of this description is duplicated from MediaPlaceholder.
48
+ const placeholder = ( content ) => {
49
+ return (
50
+ <Placeholder
51
+ className="block-editor-media-placeholder"
52
+ withIllustration={ true }
53
+ icon={ icon }
54
+ label={ __( 'Video' ) }
55
+ instructions={ __(
56
+ 'Upload a video file, pick one from your media library, or add one with a URL.'
57
+ ) }
58
+ >
59
+ { content }
60
+ </Placeholder>
61
+ );
62
+ };
63
+
46
64
  const ALLOWED_MEDIA_TYPES = [ 'video' ];
47
65
  const VIDEO_POSTER_ALLOWED_MEDIA_TYPES = [ 'image' ];
48
66
 
@@ -146,6 +164,7 @@ function VideoEdit( {
146
164
  allowedTypes={ ALLOWED_MEDIA_TYPES }
147
165
  value={ attributes }
148
166
  onError={ onUploadError }
167
+ placeholder={ placeholder }
149
168
  />
150
169
  </div>
151
170
  );
@@ -1,3 +1,40 @@
1
+ // Provide special styling for the placeholder.
2
+ // @todo: this particular minimal style of placeholder could be componentized further.
3
+ .wp-block-video.wp-block-video {
4
+ // Show Placeholder style on-select.
5
+ &.is-selected .components-placeholder {
6
+ // Block UI appearance.
7
+ color: $gray-900;
8
+ background-color: $white;
9
+ box-shadow: inset 0 0 0 $border-width $gray-900;
10
+ border: none;
11
+
12
+ // @todo: this should eventually be overridden by a custom border-radius set in the inspector.
13
+ border-radius: $radius-block-ui;
14
+
15
+ > svg {
16
+ opacity: 0;
17
+ }
18
+
19
+ .components-placeholder__illustration {
20
+ display: none;
21
+ }
22
+
23
+ &::before {
24
+ opacity: 0;
25
+ }
26
+ }
27
+
28
+ // Remove the transition while we still have a legacy placeholder style.
29
+ // Otherwise the content jumps between the 1px placeholder border, and any inherited custom
30
+ // parent border that may get applied when you deselect.
31
+ .components-placeholder__label,
32
+ .components-placeholder__instructions,
33
+ .components-button {
34
+ transition: none;
35
+ }
36
+ }
37
+
1
38
  .wp-block[data-align="center"] > .wp-block-video {
2
39
  text-align: center;
3
40
  }
@@ -1,56 +0,0 @@
1
- "use strict";
2
-
3
- const closeSubmenus = element => {
4
- element.querySelectorAll('[aria-expanded="true"]').forEach(toggle => {
5
- toggle.setAttribute('aria-expanded', 'false');
6
- });
7
- };
8
-
9
- const toggleSubmenuOnClick = event => {
10
- const buttonToggle = event.target.closest('[aria-expanded]');
11
- const isSubmenuOpen = buttonToggle.getAttribute('aria-expanded');
12
-
13
- if (isSubmenuOpen === 'true') {
14
- closeSubmenus(buttonToggle.closest('.wp-block-navigation-submenu'));
15
- } else {
16
- // Close all sibling submenus.
17
- const parentElement = buttonToggle.closest('.wp-block-navigation-submenu');
18
- const parentList = buttonToggle.closest('.wp-block-navigation__submenu-container') || buttonToggle.closest('.wp-block-navigation__container');
19
- Array.from(parentList.children).forEach(child => {
20
- if (child !== parentElement) {
21
- closeSubmenus(child);
22
- }
23
- }); // Open submenu.
24
-
25
- buttonToggle.setAttribute('aria-expanded', 'true');
26
- }
27
- };
28
-
29
- const submenuButtons = document.querySelectorAll('.wp-block-navigation-submenu__toggle');
30
- submenuButtons.forEach(button => {
31
- button.addEventListener('click', toggleSubmenuOnClick);
32
- }); // Close on click outside.
33
-
34
- document.addEventListener('click', function (event) {
35
- const navigationBlocks = document.querySelectorAll('.wp-block-navigation');
36
- navigationBlocks.forEach(block => {
37
- if (!block.contains(event.target)) {
38
- closeSubmenus(block);
39
- }
40
- });
41
- }); // Close on focus outside or escape key.
42
-
43
- document.addEventListener('keyup', function (event) {
44
- const submenuBlocks = document.querySelectorAll('.wp-block-navigation-submenu');
45
- submenuBlocks.forEach(block => {
46
- if (!block.contains(event.target)) {
47
- closeSubmenus(block);
48
- } else if (event.key === 'Escape') {
49
- const toggle = block.querySelector('[aria-expanded="true"]');
50
- closeSubmenus(block); // Focus the submenu trigger so focus does not get trapped in the closed submenu.
51
-
52
- toggle === null || toggle === void 0 ? void 0 : toggle.focus();
53
- }
54
- });
55
- });
56
- //# sourceMappingURL=view.js.map