@wordpress/block-library 9.7.1-next.5368f64a9.0 → 9.8.1

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 (132) hide show
  1. package/CHANGELOG.md +2 -0
  2. package/build/categories/edit.js +38 -17
  3. package/build/categories/edit.js.map +1 -1
  4. package/build/categories/index.js +10 -3
  5. package/build/categories/index.js.map +1 -1
  6. package/build/categories/variations.js +43 -0
  7. package/build/categories/variations.js.map +1 -0
  8. package/build/embed/edit.js +1 -0
  9. package/build/embed/edit.js.map +1 -1
  10. package/build/embed/edit.native.js +1 -0
  11. package/build/embed/edit.native.js.map +1 -1
  12. package/build/embed/embed-preview.js +80 -100
  13. package/build/embed/embed-preview.js.map +1 -1
  14. package/build/embed/embed-preview.native.js +1 -0
  15. package/build/embed/embed-preview.native.js.map +1 -1
  16. package/build/form/view.js +1 -0
  17. package/build/form/view.js.map +1 -1
  18. package/build/form-input/deprecated.js +113 -1
  19. package/build/form-input/deprecated.js.map +1 -1
  20. package/build/form-input/edit.js +16 -12
  21. package/build/form-input/edit.js.map +1 -1
  22. package/build/form-input/save.js +9 -1
  23. package/build/form-input/save.js.map +1 -1
  24. package/build/image/image.js +5 -2
  25. package/build/image/image.js.map +1 -1
  26. package/build/index.js +1 -0
  27. package/build/index.js.map +1 -1
  28. package/build/navigation-submenu/index.js +13 -0
  29. package/build/navigation-submenu/index.js.map +1 -1
  30. package/build/post-template/edit.js +6 -1
  31. package/build/post-template/edit.js.map +1 -1
  32. package/build/post-title/index.js +1 -4
  33. package/build/post-title/index.js.map +1 -1
  34. package/build/query/edit/inspector-controls/format-controls.js +102 -0
  35. package/build/query/edit/inspector-controls/format-controls.js.map +1 -0
  36. package/build/query/edit/inspector-controls/index.js +45 -9
  37. package/build/query/edit/inspector-controls/index.js.map +1 -1
  38. package/build/query/edit/query-content.js +26 -10
  39. package/build/query/edit/query-content.js.map +1 -1
  40. package/build/query/index.js +3 -1
  41. package/build/query/index.js.map +1 -1
  42. package/build/query/utils.js +12 -1
  43. package/build/query/utils.js.map +1 -1
  44. package/build/site-title/index.js +1 -4
  45. package/build/site-title/index.js.map +1 -1
  46. package/build/social-link/edit.js +13 -11
  47. package/build/social-link/edit.js.map +1 -1
  48. package/build-module/categories/edit.js +40 -19
  49. package/build-module/categories/edit.js.map +1 -1
  50. package/build-module/categories/index.js +10 -3
  51. package/build-module/categories/index.js.map +1 -1
  52. package/build-module/categories/variations.js +36 -0
  53. package/build-module/categories/variations.js.map +1 -0
  54. package/build-module/embed/edit.js +1 -0
  55. package/build-module/embed/edit.js.map +1 -1
  56. package/build-module/embed/edit.native.js +1 -0
  57. package/build-module/embed/edit.native.js.map +1 -1
  58. package/build-module/embed/embed-preview.js +80 -100
  59. package/build-module/embed/embed-preview.js.map +1 -1
  60. package/build-module/embed/embed-preview.native.js +1 -0
  61. package/build-module/embed/embed-preview.native.js.map +1 -1
  62. package/build-module/form/view.js +1 -0
  63. package/build-module/form/view.js.map +1 -1
  64. package/build-module/form-input/deprecated.js +114 -2
  65. package/build-module/form-input/deprecated.js.map +1 -1
  66. package/build-module/form-input/edit.js +16 -12
  67. package/build-module/form-input/edit.js.map +1 -1
  68. package/build-module/form-input/save.js +9 -1
  69. package/build-module/form-input/save.js.map +1 -1
  70. package/build-module/image/image.js +5 -2
  71. package/build-module/image/image.js.map +1 -1
  72. package/build-module/index.js +1 -0
  73. package/build-module/index.js.map +1 -1
  74. package/build-module/navigation-submenu/index.js +13 -0
  75. package/build-module/navigation-submenu/index.js.map +1 -1
  76. package/build-module/post-template/edit.js +6 -1
  77. package/build-module/post-template/edit.js.map +1 -1
  78. package/build-module/post-title/index.js +1 -4
  79. package/build-module/post-title/index.js.map +1 -1
  80. package/build-module/query/edit/inspector-controls/format-controls.js +96 -0
  81. package/build-module/query/edit/inspector-controls/format-controls.js.map +1 -0
  82. package/build-module/query/edit/inspector-controls/index.js +45 -9
  83. package/build-module/query/edit/inspector-controls/index.js.map +1 -1
  84. package/build-module/query/edit/query-content.js +27 -11
  85. package/build-module/query/edit/query-content.js.map +1 -1
  86. package/build-module/query/index.js +3 -1
  87. package/build-module/query/index.js.map +1 -1
  88. package/build-module/query/utils.js +12 -1
  89. package/build-module/query/utils.js.map +1 -1
  90. package/build-module/site-title/index.js +1 -4
  91. package/build-module/site-title/index.js.map +1 -1
  92. package/build-module/social-link/edit.js +14 -12
  93. package/build-module/social-link/edit.js.map +1 -1
  94. package/build-style/editor-rtl.css +1 -1
  95. package/build-style/editor.css +1 -1
  96. package/build-style/form-input/style-rtl.css +7 -8
  97. package/build-style/form-input/style.css +7 -8
  98. package/build-style/gallery/editor-rtl.css +1 -1
  99. package/build-style/gallery/editor.css +1 -1
  100. package/build-style/post-title/style-rtl.css +4 -18
  101. package/build-style/post-title/style.css +4 -18
  102. package/build-style/site-title/style-rtl.css +4 -18
  103. package/build-style/site-title/style.css +4 -18
  104. package/build-style/style-rtl.css +15 -44
  105. package/build-style/style.css +15 -44
  106. package/package.json +35 -35
  107. package/src/categories/block.json +7 -2
  108. package/src/categories/edit.js +69 -30
  109. package/src/categories/index.js +2 -0
  110. package/src/categories/index.php +21 -9
  111. package/src/categories/variations.js +40 -0
  112. package/src/comments-pagination-next/index.php +1 -1
  113. package/src/comments-pagination-previous/index.php +2 -1
  114. package/src/embed/embed-preview.js +96 -112
  115. package/src/form-input/deprecated.js +114 -1
  116. package/src/form-input/edit.js +17 -11
  117. package/src/form-input/save.js +13 -3
  118. package/src/form-input/style.scss +9 -8
  119. package/src/image/image.js +2 -1
  120. package/src/navigation-submenu/block.json +13 -0
  121. package/src/post-template/edit.js +6 -0
  122. package/src/post-template/index.php +5 -0
  123. package/src/post-title/block.json +1 -4
  124. package/src/post-title/style.scss +4 -21
  125. package/src/query/block.json +3 -1
  126. package/src/query/edit/inspector-controls/format-controls.js +90 -0
  127. package/src/query/edit/inspector-controls/index.js +68 -9
  128. package/src/query/edit/query-content.js +38 -5
  129. package/src/query/utils.js +16 -1
  130. package/src/site-title/block.json +1 -4
  131. package/src/site-title/style.scss +4 -21
  132. package/src/social-link/edit.js +11 -7
@@ -80,8 +80,5 @@
80
80
  }
81
81
  }
82
82
  },
83
- "style": "wp-block-post-title",
84
- "selectors": {
85
- "typography": ".wp-block-post-title, .wp-block-post-title > a"
86
- }
83
+ "style": "wp-block-post-title"
87
84
  }
@@ -3,31 +3,14 @@
3
3
  // This block has customizable padding, border-box makes that more predictable.
4
4
  box-sizing: border-box;
5
5
 
6
- &[style*="font-weight"] :where(a) {
7
- font-weight: inherit;
8
- }
9
- &[class*="-font-family"] :where(a),
10
- &[style*="font-family"] :where(a) {
6
+ :where(a) {
7
+ display: inline-block;
11
8
  font-family: inherit;
12
- }
13
- &[class*="-font-size"] :where(a),
14
- &[style*="font-size"] :where(a) {
15
9
  font-size: inherit;
16
- }
17
- &[style*="line-height"] :where(a) {
18
- line-height: inherit;
19
- }
20
- &[style*="font-style"] :where(a) {
21
10
  font-style: inherit;
22
- }
23
- &[style*="letter-spacing"] :where(a) {
11
+ font-weight: inherit;
24
12
  letter-spacing: inherit;
25
- }
26
- &[style*="text-decoration"] :where(a) {
13
+ line-height: inherit;
27
14
  text-decoration: inherit;
28
15
  }
29
-
30
- a {
31
- display: inline-block;
32
- }
33
16
  }
@@ -25,7 +25,8 @@
25
25
  "sticky": "",
26
26
  "inherit": true,
27
27
  "taxQuery": null,
28
- "parents": []
28
+ "parents": [],
29
+ "format": []
29
30
  }
30
31
  },
31
32
  "tagName": {
@@ -40,6 +41,7 @@
40
41
  "default": false
41
42
  }
42
43
  },
44
+ "usesContext": [ "postType" ],
43
45
  "providesContext": {
44
46
  "queryId": "queryId",
45
47
  "query": "query",
@@ -0,0 +1,90 @@
1
+ /**
2
+ * WordPress dependencies
3
+ */
4
+ import { FormTokenField } from '@wordpress/components';
5
+ import { useSelect } from '@wordpress/data';
6
+ import { store as coreStore } from '@wordpress/core-data';
7
+ import { __ } from '@wordpress/i18n';
8
+
9
+ // All WP post formats, sorted alphabetically by translated name.
10
+ // Value is the post format slug. Label is the name.
11
+ const POST_FORMATS = [
12
+ { value: 'aside', label: __( 'Aside' ) },
13
+ { value: 'audio', label: __( 'Audio' ) },
14
+ { value: 'chat', label: __( 'Chat' ) },
15
+ { value: 'gallery', label: __( 'Gallery' ) },
16
+ { value: 'image', label: __( 'Image' ) },
17
+ { value: 'link', label: __( 'Link' ) },
18
+ { value: 'quote', label: __( 'Quote' ) },
19
+ { value: 'standard', label: __( 'Standard' ) },
20
+ { value: 'status', label: __( 'Status' ) },
21
+ { value: 'video', label: __( 'Video' ) },
22
+ ].sort( ( a, b ) => {
23
+ const normalizedA = a.label.toUpperCase();
24
+ const normalizedB = b.label.toUpperCase();
25
+
26
+ if ( normalizedA < normalizedB ) {
27
+ return -1;
28
+ }
29
+ if ( normalizedA > normalizedB ) {
30
+ return 1;
31
+ }
32
+ return 0;
33
+ } );
34
+
35
+ // A helper function to convert translatable post format names into their static values.
36
+ function formatNamesToValues( names, formats ) {
37
+ return names
38
+ .map( ( name ) => {
39
+ return formats.find(
40
+ ( item ) =>
41
+ item.label.toLocaleLowerCase() === name.toLocaleLowerCase()
42
+ )?.value;
43
+ } )
44
+ .filter( Boolean );
45
+ }
46
+
47
+ export default function FormatControls( { onChange, query: { format } } ) {
48
+ // 'format' is expected to be an array. If it is not an array, for example
49
+ // if a user has manually entered an invalid value in the block markup,
50
+ // convert it to an array to prevent JavaScript errors.
51
+ const normalizedFormats = Array.isArray( format ) ? format : [ format ];
52
+
53
+ const { supportedFormats } = useSelect( ( select ) => {
54
+ const themeSupports = select( coreStore ).getThemeSupports();
55
+ return {
56
+ supportedFormats: themeSupports.formats,
57
+ };
58
+ }, [] );
59
+
60
+ const formats = POST_FORMATS.filter( ( item ) =>
61
+ supportedFormats.includes( item.value )
62
+ );
63
+
64
+ const values = normalizedFormats
65
+ .map(
66
+ ( name ) => formats.find( ( item ) => item.value === name )?.label
67
+ )
68
+ .filter( Boolean );
69
+
70
+ const suggestions = formats
71
+ .filter( ( item ) => ! format.includes( item.value ) )
72
+ .map( ( item ) => item.label );
73
+
74
+ return (
75
+ <FormTokenField
76
+ label={ __( 'Formats' ) }
77
+ value={ values }
78
+ suggestions={ suggestions }
79
+ onChange={ ( newValues ) => {
80
+ onChange( {
81
+ format: formatNamesToValues( newValues, formats ),
82
+ } );
83
+ } }
84
+ __experimentalShowHowTo={ false }
85
+ __experimentalExpandOnFocus
86
+ __nextHasNoMarginBottom
87
+ __next40pxDefaultSize
88
+ />
89
+ );
90
+ }
@@ -12,6 +12,8 @@ import {
12
12
  __experimentalToolsPanel as ToolsPanel,
13
13
  __experimentalToolsPanelItem as ToolsPanelItem,
14
14
  } from '@wordpress/components';
15
+ import { useSelect } from '@wordpress/data';
16
+ import { store as coreStore } from '@wordpress/core-data';
15
17
  import { __ } from '@wordpress/i18n';
16
18
  import { privateApis as blockEditorPrivateApis } from '@wordpress/block-editor';
17
19
  import { debounce } from '@wordpress/compose';
@@ -24,6 +26,7 @@ import OrderControl from './order-control';
24
26
  import AuthorControl from './author-control';
25
27
  import ParentControl from './parent-control';
26
28
  import { TaxonomyControls } from './taxonomy-controls';
29
+ import FormatControls from './format-controls';
27
30
  import StickyControl from './sticky-control';
28
31
  import CreateNewPostLink from './create-new-post-link';
29
32
  import PerPageControl from './per-page-control';
@@ -42,7 +45,7 @@ import { useToolsPanelDropdownMenuProps } from '../../../utils/hooks';
42
45
  const { BlockInfo } = unlock( blockEditorPrivateApis );
43
46
 
44
47
  export default function QueryInspectorControls( props ) {
45
- const { attributes, setQuery, setDisplayLayout } = props;
48
+ const { attributes, setQuery, setDisplayLayout, isTemplate } = props;
46
49
  const { query, displayLayout } = attributes;
47
50
  const {
48
51
  order,
@@ -56,10 +59,15 @@ export default function QueryInspectorControls( props ) {
56
59
  inherit,
57
60
  taxQuery,
58
61
  parents,
62
+ format,
59
63
  } = query;
60
64
  const allowedControls = useAllowedControls( attributes );
61
65
  const [ showSticky, setShowSticky ] = useState( postType === 'post' );
62
- const { postTypesTaxonomiesMap, postTypesSelectOptions } = usePostTypes();
66
+ const {
67
+ postTypesTaxonomiesMap,
68
+ postTypesSelectOptions,
69
+ postTypeFormatSupportMap,
70
+ } = usePostTypes();
63
71
  const taxonomies = useTaxonomies( postType );
64
72
  const isPostTypeHierarchical = useIsPostTypeHierarchical( postType );
65
73
  useEffect( () => {
@@ -88,6 +96,14 @@ export default function QueryInspectorControls( props ) {
88
96
  }
89
97
  // We need to reset `parents` because they are tied to each post type.
90
98
  updateQuery.parents = [];
99
+ // Post types can register post format support with `add_post_type_support`.
100
+ // But we need to reset the `format` property when switching to post types
101
+ // that do not support post formats.
102
+ const hasFormatSupport = postTypeFormatSupportMap[ newValue ];
103
+ if ( ! hasFormatSupport ) {
104
+ updateQuery.format = [];
105
+ }
106
+
91
107
  setQuery( updateQuery );
92
108
  };
93
109
  const [ querySearch, setQuerySearch ] = useState( query.search );
@@ -103,20 +119,25 @@ export default function QueryInspectorControls( props ) {
103
119
  onChangeDebounced();
104
120
  return onChangeDebounced.cancel;
105
121
  }, [ querySearch, onChangeDebounced ] );
106
- const showInheritControl = isControlAllowed( allowedControls, 'inherit' );
122
+
123
+ const showInheritControl =
124
+ isTemplate && isControlAllowed( allowedControls, 'inherit' );
107
125
  const showPostTypeControl =
108
- ! inherit && isControlAllowed( allowedControls, 'postType' );
126
+ ( ! inherit && isControlAllowed( allowedControls, 'postType' ) ) ||
127
+ ! isTemplate;
109
128
  const postTypeControlLabel = __( 'Post type' );
110
129
  const postTypeControlHelp = __(
111
130
  'Select the type of content to display: posts, pages, or custom post types.'
112
131
  );
113
132
  const showColumnsControl = false;
114
133
  const showOrderControl =
115
- ! inherit && isControlAllowed( allowedControls, 'order' );
134
+ ( ! inherit && isControlAllowed( allowedControls, 'order' ) ) ||
135
+ ! isTemplate;
116
136
  const showStickyControl =
117
- ! inherit &&
118
- showSticky &&
119
- isControlAllowed( allowedControls, 'sticky' );
137
+ ( ! inherit &&
138
+ showSticky &&
139
+ isControlAllowed( allowedControls, 'sticky' ) ) ||
140
+ ( showSticky && ! isTemplate );
120
141
  const showSettingsPanel =
121
142
  showInheritControl ||
122
143
  showPostTypeControl ||
@@ -132,11 +153,36 @@ export default function QueryInspectorControls( props ) {
132
153
  isControlAllowed( allowedControls, 'parents' ) &&
133
154
  isPostTypeHierarchical;
134
155
 
156
+ const postTypeHasFormatSupport = postTypeFormatSupportMap[ postType ];
157
+ const showFormatControl = useSelect(
158
+ ( select ) => {
159
+ // Check if the post type supports post formats and if the control is allowed.
160
+ if (
161
+ ! postTypeHasFormatSupport ||
162
+ ! isControlAllowed( allowedControls, 'format' )
163
+ ) {
164
+ return false;
165
+ }
166
+
167
+ const themeSupports = select( coreStore ).getThemeSupports();
168
+
169
+ // If there are no supported formats, getThemeSupports still includes the default 'standard' format,
170
+ // and in this case the control should not be shown since the user has no other formats to choose from.
171
+ return (
172
+ themeSupports.formats &&
173
+ themeSupports.formats.length > 0 &&
174
+ themeSupports.formats.some( ( type ) => type !== 'standard' )
175
+ );
176
+ },
177
+ [ allowedControls, postTypeHasFormatSupport ]
178
+ );
179
+
135
180
  const showFiltersPanel =
136
181
  showTaxControl ||
137
182
  showAuthorControl ||
138
183
  showSearchControl ||
139
- showParentControl;
184
+ showParentControl ||
185
+ showFormatControl;
140
186
  const dropdownMenuProps = useToolsPanelDropdownMenuProps();
141
187
 
142
188
  const showPostCountControl = isControlAllowed(
@@ -313,6 +359,7 @@ export default function QueryInspectorControls( props ) {
313
359
  parents: [],
314
360
  search: '',
315
361
  taxQuery: null,
362
+ format: [],
316
363
  } );
317
364
  setQuerySearch( '' );
318
365
  } }
@@ -374,6 +421,18 @@ export default function QueryInspectorControls( props ) {
374
421
  />
375
422
  </ToolsPanelItem>
376
423
  ) }
424
+ { showFormatControl && (
425
+ <ToolsPanelItem
426
+ hasValue={ () => !! format?.length }
427
+ label={ __( 'Formats' ) }
428
+ onDeselect={ () => setQuery( { format: [] } ) }
429
+ >
430
+ <FormatControls
431
+ onChange={ setQuery }
432
+ query={ query }
433
+ />
434
+ </ToolsPanelItem>
435
+ ) }
377
436
  </ToolsPanel>
378
437
  ) }
379
438
  </>
@@ -3,7 +3,7 @@
3
3
  */
4
4
  import { useSelect, useDispatch } from '@wordpress/data';
5
5
  import { useInstanceId } from '@wordpress/compose';
6
- import { useEffect } from '@wordpress/element';
6
+ import { useEffect, useCallback } from '@wordpress/element';
7
7
  import {
8
8
  BlockControls,
9
9
  InspectorControls,
@@ -32,6 +32,7 @@ export default function QueryContent( {
32
32
  openPatternSelectionModal,
33
33
  name,
34
34
  clientId,
35
+ context,
35
36
  } ) {
36
37
  const {
37
38
  queryId,
@@ -41,6 +42,7 @@ export default function QueryContent( {
41
42
  tagName: TagName = 'div',
42
43
  query: { inherit } = {},
43
44
  } = attributes;
45
+ const { postType } = context;
44
46
  const { __unstableMarkNextChangeAsNotPersistent } =
45
47
  useDispatch( blockEditorStore );
46
48
  const instanceId = useInstanceId( QueryContent );
@@ -48,6 +50,16 @@ export default function QueryContent( {
48
50
  const innerBlocksProps = useInnerBlocksProps( blockProps, {
49
51
  template: TEMPLATE,
50
52
  } );
53
+ const isTemplate = useSelect(
54
+ ( select ) => {
55
+ const currentTemplate =
56
+ select( coreStore ).__experimentalGetTemplateForLink()?.type;
57
+ const isInTemplate = 'wp_template' === currentTemplate;
58
+ const isInSingularContent = postType !== undefined;
59
+ return isInTemplate && ! isInSingularContent;
60
+ },
61
+ [ postType ]
62
+ );
51
63
  const { postsPerPage } = useSelect( ( select ) => {
52
64
  const { getSettings } = select( blockEditorStore );
53
65
  const { getEntityRecord, getEntityRecordEdits, canUser } =
@@ -81,6 +93,10 @@ export default function QueryContent( {
81
93
  // Changes in query property (which is an object) need to be in the same callback,
82
94
  // because updates are batched after the render and changes in different query properties
83
95
  // would cause to override previous wanted changes.
96
+ const updateQuery = useCallback(
97
+ ( newQuery ) => setAttributes( { query: { ...query, ...newQuery } } ),
98
+ [ query, setAttributes ]
99
+ );
84
100
  useEffect( () => {
85
101
  const newQuery = {};
86
102
  // When we inherit from global query always need to set the `perPage`
@@ -90,11 +106,24 @@ export default function QueryContent( {
90
106
  } else if ( ! query.perPage && postsPerPage ) {
91
107
  newQuery.perPage = postsPerPage;
92
108
  }
109
+ // We need to reset the `inherit` value if not in a template, as queries
110
+ // are not inherited when outside a template (e.g. when in singular content).
111
+ if ( ! isTemplate && query.inherit ) {
112
+ newQuery.inherit = false;
113
+ }
93
114
  if ( !! Object.keys( newQuery ).length ) {
94
115
  __unstableMarkNextChangeAsNotPersistent();
95
116
  updateQuery( newQuery );
96
117
  }
97
- }, [ query.perPage, postsPerPage, inherit ] );
118
+ }, [
119
+ query.perPage,
120
+ postsPerPage,
121
+ inherit,
122
+ isTemplate,
123
+ query.inherit,
124
+ __unstableMarkNextChangeAsNotPersistent,
125
+ updateQuery,
126
+ ] );
98
127
  // We need this for multi-query block pagination.
99
128
  // Query parameters for each block are scoped to their ID.
100
129
  useEffect( () => {
@@ -102,9 +131,12 @@ export default function QueryContent( {
102
131
  __unstableMarkNextChangeAsNotPersistent();
103
132
  setAttributes( { queryId: instanceId } );
104
133
  }
105
- }, [ queryId, instanceId ] );
106
- const updateQuery = ( newQuery ) =>
107
- setAttributes( { query: { ...query, ...newQuery } } );
134
+ }, [
135
+ queryId,
136
+ instanceId,
137
+ __unstableMarkNextChangeAsNotPersistent,
138
+ setAttributes,
139
+ ] );
108
140
  const updateDisplayLayout = ( newDisplayLayout ) =>
109
141
  setAttributes( {
110
142
  displayLayout: { ...displayLayout, ...newDisplayLayout },
@@ -135,6 +167,7 @@ export default function QueryContent( {
135
167
  setDisplayLayout={ updateDisplayLayout }
136
168
  setAttributes={ setAttributes }
137
169
  clientId={ clientId }
170
+ isTemplate={ isTemplate }
138
171
  />
139
172
  </InspectorControls>
140
173
  <BlockControls>
@@ -94,6 +94,7 @@ export const mapToIHasNameAndId = ( entities, path ) => {
94
94
  * Returns a helper object that contains:
95
95
  * 1. An `options` object from the available post types, to be passed to a `SelectControl`.
96
96
  * 2. A helper map with available taxonomies per post type.
97
+ * 3. A helper map with post format support per post type.
97
98
  *
98
99
  * @return {Object} The helper object related to post types.
99
100
  */
@@ -124,7 +125,21 @@ export const usePostTypes = () => {
124
125
  } ) ),
125
126
  [ postTypes ]
126
127
  );
127
- return { postTypesTaxonomiesMap, postTypesSelectOptions };
128
+ const postTypeFormatSupportMap = useMemo( () => {
129
+ if ( ! postTypes?.length ) {
130
+ return {};
131
+ }
132
+ return postTypes.reduce( ( accumulator, type ) => {
133
+ accumulator[ type.slug ] =
134
+ type.supports?.[ 'post-formats' ] || false;
135
+ return accumulator;
136
+ }, {} );
137
+ }, [ postTypes ] );
138
+ return {
139
+ postTypesTaxonomiesMap,
140
+ postTypesSelectOptions,
141
+ postTypeFormatSupportMap,
142
+ };
128
143
  };
129
144
 
130
145
  /**
@@ -75,8 +75,5 @@
75
75
  }
76
76
  },
77
77
  "editorStyle": "wp-block-site-title-editor",
78
- "style": "wp-block-site-title",
79
- "selectors": {
80
- "typography": ".wp-block-site-title > span, .wp-block-site-title > a"
81
- }
78
+ "style": "wp-block-site-title"
82
79
  }
@@ -2,31 +2,14 @@
2
2
  // This block has customizable padding, border-box makes that more predictable.
3
3
  box-sizing: border-box;
4
4
 
5
- &[style*="font-weight"] :where(a) {
6
- font-weight: inherit;
7
- }
8
- &[class*="-font-family"] :where(a),
9
- &[style*="font-family"] :where(a) {
5
+ :where(a) {
6
+ color: inherit;
10
7
  font-family: inherit;
11
- }
12
- &[class*="-font-size"] :where(a),
13
- &[style*="font-size"] :where(a) {
14
8
  font-size: inherit;
15
- }
16
- &[style*="line-height"] :where(a) {
17
- line-height: inherit;
18
- }
19
- &[style*="font-style"] :where(a) {
20
9
  font-style: inherit;
21
- }
22
- &[style*="letter-spacing"] :where(a) {
10
+ font-weight: inherit;
23
11
  letter-spacing: inherit;
24
- }
25
- &[style*="text-decoration"] :where(a) {
12
+ line-height: inherit;
26
13
  text-decoration: inherit;
27
14
  }
28
-
29
- :where(a) {
30
- color: inherit;
31
- }
32
15
  }
@@ -22,6 +22,7 @@ import {
22
22
  PanelBody,
23
23
  PanelRow,
24
24
  TextControl,
25
+ __experimentalInputControlSuffixWrapper as InputControlSuffixWrapper,
25
26
  } from '@wordpress/components';
26
27
  import { __ } from '@wordpress/i18n';
27
28
  import { keyboardReturn } from '@wordpress/icons';
@@ -78,15 +79,18 @@ const SocialLinkURLPopover = ( {
78
79
  }
79
80
  removeBlock( clientId );
80
81
  } }
82
+ suffix={
83
+ <InputControlSuffixWrapper variant="control">
84
+ <Button
85
+ icon={ keyboardReturn }
86
+ label={ __( 'Apply' ) }
87
+ type="submit"
88
+ size="small"
89
+ />
90
+ </InputControlSuffixWrapper>
91
+ }
81
92
  />
82
93
  </div>
83
- <Button
84
- // TODO: Switch to `true` (40px size) if possible.
85
- __next40pxDefaultSize={ false }
86
- icon={ keyboardReturn }
87
- label={ __( 'Apply' ) }
88
- type="submit"
89
- />
90
94
  </form>
91
95
  </URLPopover>
92
96
  );