@wordpress/block-library 6.0.25 → 6.0.26

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 (119) hide show
  1. package/build/gallery/constants.js +5 -1
  2. package/build/gallery/constants.js.map +1 -1
  3. package/build/gallery/transforms.js +8 -2
  4. package/build/gallery/transforms.js.map +1 -1
  5. package/build/gallery/utils.js +4 -3
  6. package/build/gallery/utils.js.map +1 -1
  7. package/build/heading/edit.js +14 -2
  8. package/build/heading/edit.js.map +1 -1
  9. package/build/page-list/edit.js +37 -10
  10. package/build/page-list/edit.js.map +1 -1
  11. package/build/post-featured-image/dimension-controls.js +50 -30
  12. package/build/post-featured-image/dimension-controls.js.map +1 -1
  13. package/build/post-featured-image/edit.js +4 -2
  14. package/build/post-featured-image/edit.js.map +1 -1
  15. package/build/site-logo/edit.js +0 -25
  16. package/build/site-logo/edit.js.map +1 -1
  17. package/build/social-links/deprecated.js +1 -62
  18. package/build/social-links/deprecated.js.map +1 -1
  19. package/build/social-links/edit.js +1 -1
  20. package/build/social-links/edit.js.map +1 -1
  21. package/build/spacer/controls.js +111 -0
  22. package/build/spacer/controls.js.map +1 -0
  23. package/build/spacer/controls.native.js +95 -0
  24. package/build/spacer/controls.native.js.map +1 -0
  25. package/build/spacer/deprecated.js +53 -0
  26. package/build/spacer/deprecated.js.map +1 -0
  27. package/build/spacer/edit.js +111 -82
  28. package/build/spacer/edit.js.map +1 -1
  29. package/build/spacer/edit.native.js +76 -0
  30. package/build/spacer/edit.native.js.map +1 -0
  31. package/build/spacer/index.js +7 -4
  32. package/build/spacer/index.js.map +1 -1
  33. package/build/spacer/save.js +6 -3
  34. package/build/spacer/save.js.map +1 -1
  35. package/build-module/gallery/constants.js +2 -0
  36. package/build-module/gallery/constants.js.map +1 -1
  37. package/build-module/gallery/transforms.js +8 -2
  38. package/build-module/gallery/transforms.js.map +1 -1
  39. package/build-module/gallery/utils.js +5 -4
  40. package/build-module/gallery/utils.js.map +1 -1
  41. package/build-module/heading/edit.js +15 -3
  42. package/build-module/heading/edit.js.map +1 -1
  43. package/build-module/page-list/edit.js +38 -11
  44. package/build-module/page-list/edit.js.map +1 -1
  45. package/build-module/post-featured-image/dimension-controls.js +52 -29
  46. package/build-module/post-featured-image/dimension-controls.js.map +1 -1
  47. package/build-module/post-featured-image/edit.js +4 -2
  48. package/build-module/post-featured-image/edit.js.map +1 -1
  49. package/build-module/site-logo/edit.js +0 -25
  50. package/build-module/site-logo/edit.js.map +1 -1
  51. package/build-module/social-links/deprecated.js +1 -62
  52. package/build-module/social-links/deprecated.js.map +1 -1
  53. package/build-module/social-links/edit.js +1 -1
  54. package/build-module/social-links/edit.js.map +1 -1
  55. package/build-module/spacer/controls.js +101 -0
  56. package/build-module/spacer/controls.js.map +1 -0
  57. package/build-module/spacer/controls.native.js +82 -0
  58. package/build-module/spacer/controls.native.js.map +1 -0
  59. package/build-module/spacer/deprecated.js +44 -0
  60. package/build-module/spacer/deprecated.js.map +1 -0
  61. package/build-module/spacer/edit.js +108 -82
  62. package/build-module/spacer/edit.js.map +1 -1
  63. package/build-module/spacer/edit.native.js +61 -0
  64. package/build-module/spacer/edit.native.js.map +1 -0
  65. package/build-module/spacer/index.js +6 -4
  66. package/build-module/spacer/index.js.map +1 -1
  67. package/build-module/spacer/save.js +6 -3
  68. package/build-module/spacer/save.js.map +1 -1
  69. package/build-style/common-rtl.css +8 -0
  70. package/build-style/common.css +8 -0
  71. package/build-style/cover/style-rtl.css +60 -0
  72. package/build-style/cover/style.css +60 -0
  73. package/build-style/editor-rtl.css +8 -7
  74. package/build-style/editor.css +8 -7
  75. package/build-style/gallery/style-rtl.css +2 -1
  76. package/build-style/gallery/style.css +2 -1
  77. package/build-style/image/style-rtl.css +0 -2
  78. package/build-style/image/style.css +0 -2
  79. package/build-style/page-list/editor-rtl.css +4 -0
  80. package/build-style/page-list/editor.css +4 -0
  81. package/build-style/post-featured-image/editor-rtl.css +0 -7
  82. package/build-style/post-featured-image/editor.css +0 -7
  83. package/build-style/post-template/style-rtl.css +4 -0
  84. package/build-style/post-template/style.css +4 -0
  85. package/build-style/spacer/editor-rtl.css +4 -0
  86. package/build-style/spacer/editor.css +4 -0
  87. package/build-style/style-rtl.css +74 -3
  88. package/build-style/style.css +74 -3
  89. package/package.json +7 -7
  90. package/src/common.scss +8 -0
  91. package/src/cover/style.scss +13 -0
  92. package/src/gallery/constants.js +2 -0
  93. package/src/gallery/style.scss +4 -1
  94. package/src/gallery/transforms.js +7 -1
  95. package/src/gallery/utils.js +7 -3
  96. package/src/heading/edit.js +18 -5
  97. package/src/image/style.scss +0 -2
  98. package/src/page-list/edit.js +47 -9
  99. package/src/page-list/editor.scss +4 -0
  100. package/src/page-list/index.php +5 -0
  101. package/src/post-featured-image/dimension-controls.js +75 -50
  102. package/src/post-featured-image/edit.js +6 -4
  103. package/src/post-featured-image/editor.scss +0 -8
  104. package/src/post-template/style.scss +5 -0
  105. package/src/search/index.php +6 -4
  106. package/src/site-logo/edit.js +1 -32
  107. package/src/site-logo/index.php +1 -1
  108. package/src/site-title/index.php +0 -1
  109. package/src/social-links/deprecated.js +0 -59
  110. package/src/social-links/edit.js +1 -1
  111. package/src/spacer/block.json +3 -3
  112. package/src/spacer/controls.js +108 -0
  113. package/src/spacer/controls.native.js +82 -0
  114. package/src/spacer/deprecated.js +41 -0
  115. package/src/spacer/edit.js +127 -113
  116. package/src/spacer/edit.native.js +68 -0
  117. package/src/spacer/editor.scss +6 -0
  118. package/src/spacer/index.js +2 -0
  119. package/src/spacer/save.js +5 -2
@@ -30,6 +30,7 @@
30
30
  margin-top: auto;
31
31
  margin-bottom: auto;
32
32
  flex-direction: column;
33
+ max-width: 100%;
33
34
 
34
35
  > div,
35
36
  > a {
@@ -41,7 +42,9 @@
41
42
  img {
42
43
  display: block;
43
44
  height: auto;
44
- max-width: 100%;
45
+ // Ensure max-width is not overridden on the img when the parent gallery has
46
+ // wide or full alignment.
47
+ max-width: 100% !important;
45
48
  width: auto;
46
49
  }
47
50
 
@@ -291,7 +291,10 @@ const transforms = {
291
291
  url,
292
292
  alt,
293
293
  caption,
294
- imageSizeSlug,
294
+ sizeSlug: imageSizeSlug,
295
+ linkDestination,
296
+ href,
297
+ linkTarget,
295
298
  },
296
299
  } ) =>
297
300
  createBlock( 'core/image', {
@@ -301,6 +304,9 @@ const transforms = {
301
304
  caption,
302
305
  sizeSlug: imageSizeSlug,
303
306
  align,
307
+ linkDestination,
308
+ href,
309
+ linkTarget,
304
310
  } )
305
311
  );
306
312
  }
@@ -5,6 +5,8 @@ import {
5
5
  LINK_DESTINATION_ATTACHMENT,
6
6
  LINK_DESTINATION_MEDIA,
7
7
  LINK_DESTINATION_NONE,
8
+ LINK_DESTINATION_MEDIA_WP_CORE,
9
+ LINK_DESTINATION_ATTACHMENT_WP_CORE,
8
10
  } from './constants';
9
11
  import {
10
12
  LINK_DESTINATION_ATTACHMENT as IMAGE_LINK_DESTINATION_ATTACHMENT,
@@ -21,15 +23,17 @@ import {
21
23
  * @return {Object} New attributes to assign to image block.
22
24
  */
23
25
  export function getHrefAndDestination( image, destination ) {
24
- // Need to determine the URL that the selected destination maps to.
25
- // Gutenberg and WordPress use different constants so the new link
26
- // destination also needs to be tweaked.
26
+ // Gutenberg and WordPress use different constants so if image_default_link_type
27
+ // option is set we need to map from the WP Core values.
28
+
27
29
  switch ( destination ) {
30
+ case LINK_DESTINATION_MEDIA_WP_CORE:
28
31
  case LINK_DESTINATION_MEDIA:
29
32
  return {
30
33
  href: image?.source_url || image?.url, // eslint-disable-line camelcase
31
34
  linkDestination: IMAGE_LINK_DESTINATION_MEDIA,
32
35
  };
36
+ case LINK_DESTINATION_ATTACHMENT_WP_CORE:
33
37
  case LINK_DESTINATION_ATTACHMENT:
34
38
  return {
35
39
  href: image?.link,
@@ -8,7 +8,7 @@ import classnames from 'classnames';
8
8
  */
9
9
  import { __ } from '@wordpress/i18n';
10
10
  import { useEffect } from '@wordpress/element';
11
- import { useDispatch } from '@wordpress/data';
11
+ import { useDispatch, useSelect } from '@wordpress/data';
12
12
  import { createBlock, getDefaultBlockName } from '@wordpress/blocks';
13
13
  import {
14
14
  AlignmentControl,
@@ -41,6 +41,14 @@ function HeadingEdit( {
41
41
  style,
42
42
  } );
43
43
 
44
+ const { canGenerateAnchors } = useSelect( ( select ) => {
45
+ const settings = select( blockEditorStore ).getSettings();
46
+
47
+ return {
48
+ canGenerateAnchors: !! settings.__experimentalGenerateAnchors,
49
+ };
50
+ }, [] );
51
+
44
52
  const { __unstableMarkNextChangeAsNotPersistent } = useDispatch(
45
53
  blockEditorStore
46
54
  );
@@ -48,6 +56,10 @@ function HeadingEdit( {
48
56
  // Initially set anchor for headings that have content but no anchor set.
49
57
  // This is used when transforming a block to heading, or for legacy anchors.
50
58
  useEffect( () => {
59
+ if ( ! canGenerateAnchors ) {
60
+ return;
61
+ }
62
+
51
63
  if ( ! anchor && content ) {
52
64
  // This side-effect should not create an undo level.
53
65
  __unstableMarkNextChangeAsNotPersistent();
@@ -59,14 +71,15 @@ function HeadingEdit( {
59
71
 
60
72
  // Remove anchor map when block unmounts.
61
73
  return () => setAnchor( clientId, null );
62
- }, [ content, anchor ] );
74
+ }, [ anchor, content, clientId, canGenerateAnchors ] );
63
75
 
64
76
  const onContentChange = ( value ) => {
65
77
  const newAttrs = { content: value };
66
78
  if (
67
- ! anchor ||
68
- ! value ||
69
- generateAnchor( clientId, content ) === anchor
79
+ canGenerateAnchors &&
80
+ ( ! anchor ||
81
+ ! value ||
82
+ generateAnchor( clientId, content ) === anchor )
70
83
  ) {
71
84
  newAttrs.anchor = generateAnchor( clientId, value );
72
85
  }
@@ -2,8 +2,6 @@
2
2
  margin: 0 0 1em 0;
3
3
 
4
4
  img {
5
- height: auto;
6
- max-width: 100%;
7
5
  vertical-align: bottom;
8
6
  }
9
7
 
@@ -12,7 +12,12 @@ import {
12
12
  useBlockProps,
13
13
  getColorClassName,
14
14
  } from '@wordpress/block-editor';
15
- import { ToolbarButton, Placeholder, Spinner } from '@wordpress/components';
15
+ import {
16
+ ToolbarButton,
17
+ Placeholder,
18
+ Spinner,
19
+ Notice,
20
+ } from '@wordpress/components';
16
21
  import { __ } from '@wordpress/i18n';
17
22
  import { useMemo, useState, memo } from '@wordpress/element';
18
23
  import { useSelect } from '@wordpress/data';
@@ -29,7 +34,7 @@ import { ItemSubmenuIcon } from '../navigation-link/icons';
29
34
  const MAX_PAGE_COUNT = 100;
30
35
 
31
36
  export default function PageListEdit( { context, clientId } ) {
32
- const { pagesByParentId, totalPages } = usePagesByParentId();
37
+ const { pagesByParentId, totalPages, hasResolvedPages } = usePageData();
33
38
 
34
39
  const isNavigationChild = 'showSubmenuIcon' in context;
35
40
  const allowConvertToLinks =
@@ -70,16 +75,29 @@ export default function PageListEdit( { context, clientId } ) {
70
75
  clientId={ clientId }
71
76
  />
72
77
  ) }
73
- { totalPages === undefined && (
78
+ { ! hasResolvedPages && (
74
79
  <div { ...blockProps }>
75
80
  <Placeholder>
76
81
  <Spinner />
77
82
  </Placeholder>
78
83
  </div>
79
84
  ) }
85
+
86
+ { hasResolvedPages && totalPages === null && (
87
+ <div { ...blockProps }>
88
+ <div { ...blockProps }>
89
+ <Notice status={ 'warning' } isDismissible={ false }>
90
+ { __( 'Page List: Cannot retrieve Pages.' ) }
91
+ </Notice>
92
+ </div>
93
+ </div>
94
+ ) }
95
+
80
96
  { totalPages === 0 && (
81
97
  <div { ...blockProps }>
82
- <span>{ __( 'Page List: No pages to show.' ) }</span>
98
+ <Notice status={ 'info' } isDismissible={ false }>
99
+ { __( 'Page List: Cannot retrieve Pages.' ) }
100
+ </Notice>
83
101
  </div>
84
102
  ) }
85
103
  { totalPages > 0 && (
@@ -94,9 +112,16 @@ export default function PageListEdit( { context, clientId } ) {
94
112
  );
95
113
  }
96
114
 
97
- function usePagesByParentId() {
98
- const { pages } = useSelect( ( select ) => {
99
- const { getEntityRecords } = select( coreStore );
115
+ function useFrontPageId() {
116
+ return useSelect( ( select ) => {
117
+ const site = select( coreStore ).getEntityRecord( 'root', 'site' );
118
+ return site?.show_on_front === 'page' && site?.page_on_front;
119
+ }, [] );
120
+ }
121
+
122
+ function usePageData() {
123
+ const { pages, hasResolvedPages } = useSelect( ( select ) => {
124
+ const { getEntityRecords, hasFinishedResolution } = select( coreStore );
100
125
 
101
126
  return {
102
127
  pages: getEntityRecords( 'postType', 'page', {
@@ -105,6 +130,16 @@ function usePagesByParentId() {
105
130
  _fields: [ 'id', 'link', 'parent', 'title', 'menu_order' ],
106
131
  per_page: -1,
107
132
  } ),
133
+ hasResolvedPages: hasFinishedResolution( 'getEntityRecords', [
134
+ 'postType',
135
+ 'page',
136
+ {
137
+ orderby: 'menu_order',
138
+ order: 'asc',
139
+ _fields: [ 'id', 'link', 'parent', 'title', 'menu_order' ],
140
+ per_page: -1,
141
+ },
142
+ ] ),
108
143
  };
109
144
  }, [] );
110
145
 
@@ -125,9 +160,10 @@ function usePagesByParentId() {
125
160
 
126
161
  return {
127
162
  pagesByParentId,
128
- totalPages: pages?.length,
163
+ hasResolvedPages,
164
+ totalPages: pages?.length ?? null,
129
165
  };
130
- }, [ pages ] );
166
+ }, [ pages, hasResolvedPages ] );
131
167
  }
132
168
 
133
169
  const PageItems = memo( function PageItems( {
@@ -137,6 +173,7 @@ const PageItems = memo( function PageItems( {
137
173
  depth = 0,
138
174
  } ) {
139
175
  const pages = pagesByParentId.get( parentId );
176
+ const frontPageId = useFrontPageId();
140
177
 
141
178
  if ( ! pages?.length ) {
142
179
  return [];
@@ -155,6 +192,7 @@ const PageItems = memo( function PageItems( {
155
192
  'open-on-hover-click':
156
193
  ! context.openSubmenusOnClick &&
157
194
  context.showSubmenuIcon,
195
+ 'menu-item-home': page.id === frontPageId,
158
196
  } ) }
159
197
  >
160
198
  { hasChildren && context.openSubmenusOnClick ? (
@@ -64,3 +64,7 @@
64
64
  }
65
65
  }
66
66
  }
67
+
68
+ .wp-block-page-list .components-notice {
69
+ margin-left: 0;
70
+ }
@@ -173,6 +173,11 @@ function block_core_page_list_render_nested_page_list( $open_submenus_on_click,
173
173
  }
174
174
  }
175
175
 
176
+ $front_page_id = (int) get_option( 'page_on_front' );
177
+ if ( (int) $page['page_id'] === $front_page_id ) {
178
+ $css_class .= ' menu-item-home';
179
+ }
180
+
176
181
  $title = wp_kses( $page['title'], wp_kses_allowed_html( 'post' ) );
177
182
  $aria_label = sprintf(
178
183
  /* translators: Accessibility text. %s: Parent page title. */
@@ -1,22 +1,15 @@
1
- /**
2
- * External dependencies
3
- */
4
- import classNames from 'classnames';
5
-
6
1
  /**
7
2
  * WordPress dependencies
8
3
  */
9
4
  import { __, _x } from '@wordpress/i18n';
10
5
  import {
11
- PanelBody,
12
6
  __experimentalUnitControl as UnitControl,
13
- Flex,
14
- FlexItem,
15
7
  __experimentalToggleGroupControl as ToggleGroupControl,
16
8
  __experimentalToggleGroupControlOption as ToggleGroupControlOption,
17
9
  __experimentalUseCustomUnits as useCustomUnits,
10
+ __experimentalToolsPanelItem as ToolsPanelItem,
18
11
  } from '@wordpress/components';
19
- import { useSetting } from '@wordpress/block-editor';
12
+ import { InspectorControls, useSetting } from '@wordpress/block-editor';
20
13
 
21
14
  const SCALE_OPTIONS = (
22
15
  <>
@@ -38,6 +31,8 @@ const SCALE_OPTIONS = (
38
31
  </>
39
32
  );
40
33
 
34
+ const DEFAULT_SCALE = 'cover';
35
+
41
36
  const scaleHelp = {
42
37
  cover: __(
43
38
  'Image is scaled and cropped to fill the entire space without being distorted.'
@@ -51,6 +46,7 @@ const scaleHelp = {
51
46
  };
52
47
 
53
48
  const DimensionControls = ( {
49
+ clientId,
54
50
  attributes: { width, height, scale },
55
51
  setAttributes,
56
52
  } ) => {
@@ -72,53 +68,82 @@ const DimensionControls = ( {
72
68
  };
73
69
  const scaleLabel = _x( 'Scale', 'Image scaling options' );
74
70
  return (
75
- <PanelBody title={ __( 'Dimensions' ) }>
76
- <Flex
77
- justify="space-between"
78
- className={ classNames(
79
- 'block-library-post-featured-image-dimension-controls',
80
- { 'scale-control-is-visible': !! height }
81
- ) }
71
+ <InspectorControls __experimentalGroup="dimensions">
72
+ <ToolsPanelItem
73
+ className="single-column"
74
+ hasValue={ () => !! height }
75
+ label={ __( 'Height' ) }
76
+ onDeselect={ () => setAttributes( { height: undefined } ) }
77
+ resetAllFilter={ () => ( {
78
+ height: undefined,
79
+ } ) }
80
+ isShownByDefault={ true }
81
+ panelId={ clientId }
82
+ >
83
+ <UnitControl
84
+ label={ __( 'Height' ) }
85
+ labelPosition="top"
86
+ value={ height || '' }
87
+ min={ 0 }
88
+ onChange={ ( nextHeight ) =>
89
+ onDimensionChange( 'height', nextHeight )
90
+ }
91
+ units={ units }
92
+ />
93
+ </ToolsPanelItem>
94
+ <ToolsPanelItem
95
+ className="single-column"
96
+ hasValue={ () => !! width }
97
+ label={ __( 'Width' ) }
98
+ onDeselect={ () => setAttributes( { width: undefined } ) }
99
+ resetAllFilter={ () => ( {
100
+ width: undefined,
101
+ } ) }
102
+ isShownByDefault={ true }
103
+ panelId={ clientId }
82
104
  >
83
- <FlexItem>
84
- <UnitControl
85
- label={ __( 'Height' ) }
86
- labelPosition="top"
87
- value={ height || '' }
88
- onChange={ ( nextHeight ) => {
89
- onDimensionChange( 'height', nextHeight );
90
- } }
91
- units={ units }
92
- />
93
- </FlexItem>
94
- <FlexItem>
95
- <UnitControl
96
- label={ __( 'Width' ) }
97
- labelPosition="top"
98
- value={ width || '' }
99
- onChange={ ( nextWidth ) => {
100
- onDimensionChange( 'width', nextWidth );
101
- } }
102
- units={ units }
103
- />
104
- </FlexItem>
105
- </Flex>
105
+ <UnitControl
106
+ label={ __( 'Width' ) }
107
+ labelPosition="top"
108
+ value={ width || '' }
109
+ min={ 0 }
110
+ onChange={ ( nextWidth ) =>
111
+ onDimensionChange( 'width', nextWidth )
112
+ }
113
+ units={ units }
114
+ />
115
+ </ToolsPanelItem>
106
116
  { !! height && (
107
- <ToggleGroupControl
117
+ <ToolsPanelItem
118
+ hasValue={ () => !! scale && scale !== DEFAULT_SCALE }
108
119
  label={ scaleLabel }
109
- value={ scale }
110
- help={ scaleHelp[ scale ] }
111
- onChange={ ( value ) => {
120
+ onDeselect={ () =>
112
121
  setAttributes( {
113
- scale: value,
114
- } );
115
- } }
116
- isBlock
122
+ scale: DEFAULT_SCALE,
123
+ } )
124
+ }
125
+ resetAllFilter={ () => ( {
126
+ scale: DEFAULT_SCALE,
127
+ } ) }
128
+ isShownByDefault={ true }
129
+ panelId={ clientId }
117
130
  >
118
- { SCALE_OPTIONS }
119
- </ToggleGroupControl>
131
+ <ToggleGroupControl
132
+ label={ scaleLabel }
133
+ value={ scale }
134
+ help={ scaleHelp[ scale ] }
135
+ onChange={ ( value ) =>
136
+ setAttributes( {
137
+ scale: value,
138
+ } )
139
+ }
140
+ isBlock
141
+ >
142
+ { SCALE_OPTIONS }
143
+ </ToggleGroupControl>
144
+ </ToolsPanelItem>
120
145
  ) }
121
- </PanelBody>
146
+ </InspectorControls>
122
147
  );
123
148
  };
124
149
 
@@ -46,6 +46,7 @@ const placeholderChip = (
46
46
  );
47
47
 
48
48
  function PostFeaturedImageDisplay( {
49
+ clientId,
49
50
  attributes,
50
51
  setAttributes,
51
52
  context: { postId, postType, queryId },
@@ -136,11 +137,12 @@ function PostFeaturedImageDisplay( {
136
137
 
137
138
  return (
138
139
  <>
140
+ <DimensionControls
141
+ clientId={ clientId }
142
+ attributes={ attributes }
143
+ setAttributes={ setAttributes }
144
+ />
139
145
  <InspectorControls>
140
- <DimensionControls
141
- attributes={ attributes }
142
- setAttributes={ setAttributes }
143
- />
144
146
  <PanelBody title={ __( 'Link settings' ) }>
145
147
  <ToggleControl
146
148
  label={ sprintf(
@@ -128,11 +128,3 @@ div[data-type="core/post-featured-image"] {
128
128
  display: block;
129
129
  }
130
130
  }
131
-
132
- .block-library-post-featured-image-dimension-controls {
133
- margin-bottom: $grid-unit-10;
134
-
135
- &.scale-control-is-visible {
136
- margin-bottom: $grid-unit-20;
137
- }
138
- }
@@ -11,6 +11,11 @@
11
11
  list-style: none;
12
12
  padding: 0;
13
13
 
14
+ // Unset background colors that can be inherited from Global Styles with extra specificity.
15
+ &.wp-block-post-template {
16
+ background: none;
17
+ }
18
+
14
19
  &.is-flex-container {
15
20
  flex-direction: row;
16
21
  display: flex;
@@ -43,16 +43,18 @@ function render_block_core_search( $attributes ) {
43
43
  // Border color classes need to be applied to the elements that have a border color.
44
44
  $border_color_classes = get_border_color_classes_for_block_core_search( $attributes );
45
45
 
46
+ $label_inner_html = empty( $attributes['label'] ) ? __( 'Search' ) : wp_kses_post( $attributes['label'] );
47
+
46
48
  $label_markup = sprintf(
47
49
  '<label for="%1$s" class="wp-block-search__label screen-reader-text">%2$s</label>',
48
- $input_id,
49
- empty( $attributes['label'] ) ? __( 'Search' ) : esc_html( $attributes['label'] )
50
+ esc_attr( $input_id ),
51
+ $label_inner_html
50
52
  );
51
53
  if ( $show_label && ! empty( $attributes['label'] ) ) {
52
54
  $label_markup = sprintf(
53
55
  '<label for="%1$s" class="wp-block-search__label">%2$s</label>',
54
56
  $input_id,
55
- esc_html( $attributes['label'] )
57
+ $label_inner_html
56
58
  );
57
59
  }
58
60
 
@@ -77,7 +79,7 @@ function render_block_core_search( $attributes ) {
77
79
  }
78
80
  if ( ! $use_icon_button ) {
79
81
  if ( ! empty( $attributes['buttonText'] ) ) {
80
- $button_internal_markup = esc_html( $attributes['buttonText'] );
82
+ $button_internal_markup = wp_kses_post( $attributes['buttonText'] );
81
83
  }
82
84
  } else {
83
85
  $button_classes .= ' has-icon';
@@ -358,7 +358,7 @@ export default function LogoEdit( {
358
358
  setAttributes,
359
359
  isSelected,
360
360
  } ) {
361
- const { className: styleClass, width, shouldSyncIcon } = attributes;
361
+ const { width, shouldSyncIcon } = attributes;
362
362
  const [ logoUrl, setLogoUrl ] = useState();
363
363
  const ref = useRef();
364
364
 
@@ -406,39 +406,8 @@ export default function LogoEdit( {
406
406
  };
407
407
  }, [] );
408
408
 
409
- const { getGlobalBlockCount } = useSelect( blockEditorStore );
410
409
  const { editEntityRecord } = useDispatch( coreStore );
411
410
 
412
- useEffect( () => {
413
- // Cleanup function to discard unsaved changes to the icon and logo when
414
- // the block is removed.
415
- return () => {
416
- // Do nothing if the block is being rendered in the styles preview or the
417
- // block inserter.
418
- if (
419
- styleClass?.includes(
420
- 'block-editor-block-types-list__site-logo-example'
421
- ) ||
422
- styleClass?.includes(
423
- 'block-editor-block-styles__block-preview-container'
424
- )
425
- ) {
426
- return;
427
- }
428
-
429
- const logoBlockCount = getGlobalBlockCount( 'core/site-logo' );
430
-
431
- // Only discard unsaved changes if we are removing the last Site Logo block
432
- // on the page.
433
- if ( logoBlockCount === 0 ) {
434
- editEntityRecord( 'root', 'site', undefined, {
435
- site_logo: undefined,
436
- site_icon: undefined,
437
- } );
438
- }
439
- };
440
- }, [] );
441
-
442
411
  const setLogo = ( newValue, shouldForceSync = false ) => {
443
412
  // `shouldForceSync` is used to force syncing when the attribute
444
413
  // may not have updated yet.
@@ -14,7 +14,7 @@
14
14
  */
15
15
  function render_block_core_site_logo( $attributes ) {
16
16
  $adjust_width_height_filter = function ( $image ) use ( $attributes ) {
17
- if ( empty( $attributes['width'] ) || empty( $image ) ) {
17
+ if ( empty( $attributes['width'] ) || empty( $image ) || ! $image[1] || ! $image[2] ) {
18
18
  return $image;
19
19
  }
20
20
  $height = (float) $attributes['width'] / ( (float) $image[1] / (float) $image[2] );
@@ -35,7 +35,6 @@ function render_block_core_site_title( $attributes ) {
35
35
  );
36
36
  if ( '_blank' === $attributes['linkTarget'] ) {
37
37
  $link_attrs[] = 'target="_blank"';
38
- $link_attrs[] = 'aria-label="' . esc_attr__( '(opens in a new tab)' ) . '"';
39
38
  }
40
39
  $site_title = sprintf( '<a %1$s>%2$s</a>', implode( ' ', $link_attrs ), $site_title );
41
40
  }
@@ -49,65 +49,6 @@ const migrateWithLayout = ( attributes ) => {
49
49
 
50
50
  // Social Links block deprecations.
51
51
  const deprecated = [
52
- // Implement `flex` layout.
53
- {
54
- attributes: {
55
- iconColor: {
56
- type: 'string',
57
- },
58
- customIconColor: {
59
- type: 'string',
60
- },
61
- iconColorValue: {
62
- type: 'string',
63
- },
64
- iconBackgroundColor: {
65
- type: 'string',
66
- },
67
- customIconBackgroundColor: {
68
- type: 'string',
69
- },
70
- iconBackgroundColorValue: {
71
- type: 'string',
72
- },
73
- openInNewTab: {
74
- type: 'boolean',
75
- default: false,
76
- },
77
- size: {
78
- type: 'string',
79
- },
80
- },
81
- supports: {
82
- align: [ 'left', 'center', 'right' ],
83
- anchor: true,
84
- __experimentalExposeControlsToChildren: true,
85
- },
86
- isEligible: ( { layout } ) => ! layout,
87
- migrate: migrateWithLayout,
88
- save( props ) {
89
- const {
90
- attributes: {
91
- iconBackgroundColorValue,
92
- iconColorValue,
93
- itemsJustification,
94
- size,
95
- },
96
- } = props;
97
-
98
- const className = classNames( size, {
99
- 'has-icon-color': iconColorValue,
100
- 'has-icon-background-color': iconBackgroundColorValue,
101
- [ `items-justified-${ itemsJustification }` ]: itemsJustification,
102
- } );
103
-
104
- return (
105
- <ul { ...useBlockProps.save( { className } ) }>
106
- <InnerBlocks.Content />
107
- </ul>
108
- );
109
- },
110
- },
111
52
  // V1. Remove CSS variable use for colors.
112
53
  {
113
54
  attributes: {
@@ -192,7 +192,7 @@ export function SocialLinksEdit( props ) {
192
192
  iconBackgroundColorValue: colorValue,
193
193
  } );
194
194
  },
195
- label: __( 'Icon background color' ),
195
+ label: __( 'Icon background' ),
196
196
  },
197
197
  ] }
198
198
  />
@@ -7,11 +7,11 @@
7
7
  "textdomain": "default",
8
8
  "attributes": {
9
9
  "height": {
10
- "type": "number",
11
- "default": 100
10
+ "type": "string",
11
+ "default": "100px"
12
12
  },
13
13
  "width": {
14
- "type": "number"
14
+ "type": "string"
15
15
  }
16
16
  },
17
17
  "usesContext": [ "orientation" ],