@wordpress/block-library 9.25.0 → 9.26.1-next.719a03cbe.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 (179) hide show
  1. package/CHANGELOG.md +2 -0
  2. package/build/avatar/edit.js +84 -39
  3. package/build/avatar/edit.js.map +1 -1
  4. package/build/avatar/user-control.js +32 -17
  5. package/build/avatar/user-control.js.map +1 -1
  6. package/build/button/edit.js +1 -1
  7. package/build/button/edit.js.map +1 -1
  8. package/build/cover/edit/inspector-controls.js +2 -2
  9. package/build/cover/edit/inspector-controls.js.map +1 -1
  10. package/build/details/index.js +1 -1
  11. package/build/details/index.js.map +1 -1
  12. package/build/embed/variations.js +0 -10
  13. package/build/embed/variations.js.map +1 -1
  14. package/build/form/edit.js +0 -1
  15. package/build/form/edit.js.map +1 -1
  16. package/build/form/index.js +3 -3
  17. package/build/form/index.js.map +1 -1
  18. package/build/form-input/index.js +2 -1
  19. package/build/form-input/index.js.map +1 -1
  20. package/build/form-submission-notification/index.js +2 -1
  21. package/build/form-submission-notification/index.js.map +1 -1
  22. package/build/form-submit-button/index.js +2 -1
  23. package/build/form-submit-button/index.js.map +1 -1
  24. package/build/gallery/constants.js +2 -1
  25. package/build/gallery/constants.js.map +1 -1
  26. package/build/gallery/edit.js +93 -15
  27. package/build/gallery/edit.js.map +1 -1
  28. package/build/image/edit.js +6 -0
  29. package/build/image/edit.js.map +1 -1
  30. package/build/image/image.js +1 -0
  31. package/build/image/image.js.map +1 -1
  32. package/build/image/view.js +0 -3
  33. package/build/image/view.js.map +1 -1
  34. package/build/list/index.js +0 -1
  35. package/build/list/index.js.map +1 -1
  36. package/build/more/edit.native.js +17 -32
  37. package/build/more/edit.native.js.map +1 -1
  38. package/build/navigation-link/edit.js +28 -1
  39. package/build/navigation-link/edit.js.map +1 -1
  40. package/build/post-author/edit.js +152 -52
  41. package/build/post-author/edit.js.map +1 -1
  42. package/build/post-comments-form/form.js +1 -1
  43. package/build/post-comments-form/form.js.map +1 -1
  44. package/build/post-featured-image/edit.js +2 -1
  45. package/build/post-featured-image/edit.js.map +1 -1
  46. package/build/post-navigation-link/edit.js +72 -33
  47. package/build/post-navigation-link/edit.js.map +1 -1
  48. package/build/search/edit.js +1 -1
  49. package/build/search/edit.js.map +1 -1
  50. package/build/site-logo/edit.js +69 -24
  51. package/build/site-logo/edit.js.map +1 -1
  52. package/build/social-link/edit.js +21 -5
  53. package/build/social-link/edit.js.map +1 -1
  54. package/build/social-link/edit.native.js +13 -5
  55. package/build/social-link/edit.native.js.map +1 -1
  56. package/build/social-link/social-list.js +17 -25
  57. package/build/social-link/social-list.js.map +1 -1
  58. package/build/social-links/edit.js +8 -5
  59. package/build/social-links/edit.js.map +1 -1
  60. package/build/video/tracks-editor.js +23 -9
  61. package/build/video/tracks-editor.js.map +1 -1
  62. package/build-module/avatar/edit.js +83 -38
  63. package/build-module/avatar/edit.js.map +1 -1
  64. package/build-module/avatar/user-control.js +33 -18
  65. package/build-module/avatar/user-control.js.map +1 -1
  66. package/build-module/button/edit.js +1 -1
  67. package/build-module/button/edit.js.map +1 -1
  68. package/build-module/cover/edit/inspector-controls.js +2 -2
  69. package/build-module/cover/edit/inspector-controls.js.map +1 -1
  70. package/build-module/details/index.js +1 -1
  71. package/build-module/details/index.js.map +1 -1
  72. package/build-module/embed/variations.js +0 -10
  73. package/build-module/embed/variations.js.map +1 -1
  74. package/build-module/form/edit.js +0 -1
  75. package/build-module/form/edit.js.map +1 -1
  76. package/build-module/form/index.js +3 -3
  77. package/build-module/form/index.js.map +1 -1
  78. package/build-module/form-input/index.js +2 -1
  79. package/build-module/form-input/index.js.map +1 -1
  80. package/build-module/form-submission-notification/index.js +2 -1
  81. package/build-module/form-submission-notification/index.js.map +1 -1
  82. package/build-module/form-submit-button/index.js +2 -1
  83. package/build-module/form-submit-button/index.js.map +1 -1
  84. package/build-module/gallery/constants.js +1 -0
  85. package/build-module/gallery/constants.js.map +1 -1
  86. package/build-module/gallery/edit.js +95 -17
  87. package/build-module/gallery/edit.js.map +1 -1
  88. package/build-module/image/edit.js +6 -0
  89. package/build-module/image/edit.js.map +1 -1
  90. package/build-module/image/image.js +1 -0
  91. package/build-module/image/image.js.map +1 -1
  92. package/build-module/image/view.js +0 -3
  93. package/build-module/image/view.js.map +1 -1
  94. package/build-module/list/index.js +0 -1
  95. package/build-module/list/index.js.map +1 -1
  96. package/build-module/more/edit.native.js +16 -30
  97. package/build-module/more/edit.native.js.map +1 -1
  98. package/build-module/navigation-link/edit.js +29 -2
  99. package/build-module/navigation-link/edit.js.map +1 -1
  100. package/build-module/post-author/edit.js +153 -53
  101. package/build-module/post-author/edit.js.map +1 -1
  102. package/build-module/post-comments-form/form.js +1 -1
  103. package/build-module/post-comments-form/form.js.map +1 -1
  104. package/build-module/post-featured-image/edit.js +2 -1
  105. package/build-module/post-featured-image/edit.js.map +1 -1
  106. package/build-module/post-navigation-link/edit.js +73 -34
  107. package/build-module/post-navigation-link/edit.js.map +1 -1
  108. package/build-module/search/edit.js +1 -1
  109. package/build-module/search/edit.js.map +1 -1
  110. package/build-module/site-logo/edit.js +70 -25
  111. package/build-module/site-logo/edit.js.map +1 -1
  112. package/build-module/social-link/edit.js +24 -8
  113. package/build-module/social-link/edit.js.map +1 -1
  114. package/build-module/social-link/edit.native.js +15 -6
  115. package/build-module/social-link/edit.native.js.map +1 -1
  116. package/build-module/social-link/social-list.js +16 -21
  117. package/build-module/social-link/social-list.js.map +1 -1
  118. package/build-module/social-links/edit.js +8 -5
  119. package/build-module/social-links/edit.js.map +1 -1
  120. package/build-module/video/tracks-editor.js +24 -10
  121. package/build-module/video/tracks-editor.js.map +1 -1
  122. package/build-style/calendar/style-rtl.css +7 -7
  123. package/build-style/calendar/style.css +7 -7
  124. package/build-style/comments-pagination/editor-rtl.css +0 -12
  125. package/build-style/comments-pagination/editor.css +0 -14
  126. package/build-style/comments-pagination/style-rtl.css +0 -7
  127. package/build-style/comments-pagination/style.css +0 -9
  128. package/build-style/editor-rtl.css +0 -30
  129. package/build-style/editor.css +0 -32
  130. package/build-style/gallery/editor-rtl.css +0 -13
  131. package/build-style/gallery/editor.css +0 -13
  132. package/build-style/navigation/style-rtl.css +5 -0
  133. package/build-style/navigation/style.css +5 -0
  134. package/build-style/style-rtl.css +12 -14
  135. package/build-style/style.css +12 -16
  136. package/package.json +35 -35
  137. package/src/avatar/edit.js +99 -51
  138. package/src/avatar/user-control.js +34 -29
  139. package/src/button/edit.js +1 -1
  140. package/src/calendar/style.scss +10 -10
  141. package/src/comments-pagination/editor.scss +0 -15
  142. package/src/comments-pagination/style.scss +0 -8
  143. package/src/cover/edit/inspector-controls.js +1 -1
  144. package/src/details/index.js +1 -1
  145. package/src/editor.scss +0 -1
  146. package/src/embed/variations.js +0 -8
  147. package/src/form/block.json +1 -2
  148. package/src/form/edit.js +0 -1
  149. package/src/form/index.js +1 -0
  150. package/src/form-input/index.js +1 -0
  151. package/src/form-submission-notification/index.js +1 -0
  152. package/src/form-submit-button/index.js +1 -0
  153. package/src/gallery/constants.js +1 -0
  154. package/src/gallery/edit.js +182 -68
  155. package/src/gallery/editor.scss +0 -17
  156. package/src/image/edit.js +12 -0
  157. package/src/image/image.js +1 -0
  158. package/src/image/index.php +4 -1
  159. package/src/image/view.js +0 -3
  160. package/src/list/block.json +0 -1
  161. package/src/more/edit.native.js +19 -33
  162. package/src/navigation/style.scss +9 -0
  163. package/src/navigation-link/edit.js +32 -2
  164. package/src/post-author/edit.js +178 -63
  165. package/src/post-comments-form/form.js +1 -1
  166. package/src/post-featured-image/edit.js +1 -0
  167. package/src/post-navigation-link/edit.js +96 -51
  168. package/src/rss/index.php +2 -1
  169. package/src/search/edit.js +1 -1
  170. package/src/site-logo/edit.js +90 -35
  171. package/src/social-link/edit.js +18 -7
  172. package/src/social-link/edit.native.js +10 -4
  173. package/src/social-link/index.php +13 -0
  174. package/src/social-link/social-list.js +15 -20
  175. package/src/social-links/edit.js +6 -7
  176. package/src/video/tracks-editor.js +18 -6
  177. package/build-style/post-author/editor-rtl.css +0 -140
  178. package/build-style/post-author/editor.css +0 -140
  179. package/src/post-author/editor.scss +0 -7
@@ -15,22 +15,98 @@ import {
15
15
  } from '@wordpress/block-editor';
16
16
  import {
17
17
  ComboboxControl,
18
- PanelBody,
19
18
  SelectControl,
20
19
  ToggleControl,
21
- __experimentalVStack as VStack,
20
+ __experimentalToolsPanel as ToolsPanel,
21
+ __experimentalToolsPanelItem as ToolsPanelItem,
22
22
  } from '@wordpress/components';
23
+ import { debounce } from '@wordpress/compose';
24
+ import { useMemo, useState } from '@wordpress/element';
23
25
  import { useSelect, useDispatch } from '@wordpress/data';
24
26
  import { __, sprintf } from '@wordpress/i18n';
27
+ import { decodeEntities } from '@wordpress/html-entities';
25
28
  import { store as coreStore } from '@wordpress/core-data';
26
29
 
27
- const minimumUsersForCombobox = 25;
30
+ /**
31
+ * Internal dependencies
32
+ */
33
+ import { useToolsPanelDropdownMenuProps } from '../utils/hooks';
28
34
 
29
35
  const AUTHORS_QUERY = {
30
36
  who: 'authors',
31
37
  per_page: 100,
38
+ _fields: 'id,name',
39
+ context: 'view',
32
40
  };
33
41
 
42
+ function AuthorCombobox( { value, onChange } ) {
43
+ const [ filterValue, setFilterValue ] = useState( '' );
44
+ const { authors, isLoading } = useSelect(
45
+ ( select ) => {
46
+ const { getUsers, isResolving } = select( coreStore );
47
+
48
+ const query = { ...AUTHORS_QUERY };
49
+ if ( filterValue ) {
50
+ query.search = filterValue;
51
+ query.search_columns = [ 'name' ];
52
+ }
53
+
54
+ return {
55
+ authors: getUsers( query ),
56
+ isLoading: isResolving( 'getUsers', [ query ] ),
57
+ };
58
+ },
59
+ [ filterValue ]
60
+ );
61
+
62
+ const authorOptions = useMemo( () => {
63
+ const fetchedAuthors = ( authors ?? [] ).map( ( author ) => {
64
+ return {
65
+ value: author.id,
66
+ label: decodeEntities( author.name ),
67
+ };
68
+ } );
69
+
70
+ // Ensure the current author is included in the list.
71
+ const foundAuthor = fetchedAuthors.findIndex(
72
+ ( fetchedAuthor ) => value?.id === fetchedAuthor.value
73
+ );
74
+
75
+ let currentAuthor = [];
76
+ if ( foundAuthor < 0 && value ) {
77
+ currentAuthor = [
78
+ {
79
+ value: value.id,
80
+ label: decodeEntities( value.name ),
81
+ },
82
+ ];
83
+ } else if ( foundAuthor < 0 && ! value ) {
84
+ currentAuthor = [
85
+ {
86
+ value: 0,
87
+ label: __( '(No author)' ),
88
+ },
89
+ ];
90
+ }
91
+
92
+ return [ ...currentAuthor, ...fetchedAuthors ];
93
+ }, [ authors, value ] );
94
+
95
+ return (
96
+ <ComboboxControl
97
+ __next40pxDefaultSize
98
+ __nextHasNoMarginBottom
99
+ label={ __( 'Author' ) }
100
+ options={ authorOptions }
101
+ value={ value?.id }
102
+ onFilterValueChange={ debounce( setFilterValue, 300 ) }
103
+ onChange={ onChange }
104
+ allowReset={ false }
105
+ isLoading={ isLoading }
106
+ />
107
+ );
108
+ }
109
+
34
110
  function PostAuthorEdit( {
35
111
  isSelected,
36
112
  context: { postType, postId, queryId },
@@ -38,22 +114,30 @@ function PostAuthorEdit( {
38
114
  setAttributes,
39
115
  } ) {
40
116
  const isDescendentOfQueryLoop = Number.isFinite( queryId );
41
- const { authorId, authorDetails, authors, supportsAuthor } = useSelect(
117
+ const dropdownMenuProps = useToolsPanelDropdownMenuProps();
118
+
119
+ const { authorDetails, canAssignAuthor, supportsAuthor } = useSelect(
42
120
  ( select ) => {
43
- const { getEditedEntityRecord, getUser, getUsers, getPostType } =
121
+ const { getEditedEntityRecord, getUser, getPostType } =
44
122
  select( coreStore );
45
- const _authorId = getEditedEntityRecord(
123
+ const currentPost = getEditedEntityRecord(
46
124
  'postType',
47
125
  postType,
48
126
  postId
49
- )?.author;
127
+ );
128
+ const authorId = currentPost?.author;
50
129
 
51
130
  return {
52
- authorId: _authorId,
53
- authorDetails: _authorId ? getUser( _authorId ) : null,
54
- authors: getUsers( AUTHORS_QUERY ),
131
+ authorDetails: authorId
132
+ ? getUser( authorId, { context: 'view' } )
133
+ : null,
55
134
  supportsAuthor:
56
135
  getPostType( postType )?.supports?.author ?? false,
136
+ canAssignAuthor: currentPost?._links?.[
137
+ 'wp:action-assign-author'
138
+ ]
139
+ ? true
140
+ : false,
57
141
  };
58
142
  },
59
143
  [ postType, postId ]
@@ -61,8 +145,15 @@ function PostAuthorEdit( {
61
145
 
62
146
  const { editEntityRecord } = useDispatch( coreStore );
63
147
 
64
- const { textAlign, showAvatar, showBio, byline, isLink, linkTarget } =
65
- attributes;
148
+ const {
149
+ textAlign,
150
+ showAvatar,
151
+ showBio,
152
+ byline,
153
+ isLink,
154
+ linkTarget,
155
+ avatarSize,
156
+ } = attributes;
66
157
  const avatarSizes = [];
67
158
  const authorName = authorDetails?.name || __( 'Post Author' );
68
159
  if ( authorDetails?.avatar_urls ) {
@@ -80,24 +171,14 @@ function PostAuthorEdit( {
80
171
  } ),
81
172
  } );
82
173
 
83
- const authorOptions = authors?.length
84
- ? authors.map( ( { id, name } ) => {
85
- return {
86
- value: id,
87
- label: name,
88
- };
89
- } )
90
- : [];
91
-
92
174
  const handleSelect = ( nextAuthorId ) => {
93
175
  editEntityRecord( 'postType', postType, postId, {
94
176
  author: nextAuthorId,
95
177
  } );
96
178
  };
97
179
 
98
- const showCombobox = authorOptions.length >= minimumUsersForCombobox;
99
180
  const showAuthorControl =
100
- !! postId && ! isDescendentOfQueryLoop && authorOptions.length > 0;
181
+ !! postId && ! isDescendentOfQueryLoop && canAssignAuthor;
101
182
 
102
183
  if ( ! supportsAuthor && postType !== undefined ) {
103
184
  return (
@@ -114,46 +195,59 @@ function PostAuthorEdit( {
114
195
  return (
115
196
  <>
116
197
  <InspectorControls>
117
- <PanelBody title={ __( 'Settings' ) }>
118
- <VStack
119
- spacing={ 4 }
120
- className="wp-block-post-author__inspector-settings"
198
+ <ToolsPanel
199
+ label={ __( 'Settings' ) }
200
+ resetAll={ () => {
201
+ setAttributes( {
202
+ avatarSize: 48,
203
+ showAvatar: true,
204
+ isLink: false,
205
+ linkTarget: '_self',
206
+ } );
207
+ } }
208
+ dropdownMenuProps={ dropdownMenuProps }
209
+ >
210
+ { showAuthorControl && (
211
+ <div style={ { gridColumn: '1 / -1' } }>
212
+ <AuthorCombobox
213
+ value={ authorDetails }
214
+ onChange={ handleSelect }
215
+ />
216
+ </div>
217
+ ) }
218
+ <ToolsPanelItem
219
+ label={ __( 'Show avatar' ) }
220
+ isShownByDefault
221
+ hasValue={ () => ! showAvatar }
222
+ onDeselect={ () =>
223
+ setAttributes( { showAvatar: true } )
224
+ }
121
225
  >
122
- { showAuthorControl &&
123
- ( ( showCombobox && (
124
- <ComboboxControl
125
- __next40pxDefaultSize
126
- __nextHasNoMarginBottom
127
- label={ __( 'Author' ) }
128
- options={ authorOptions }
129
- value={ authorId }
130
- onChange={ handleSelect }
131
- allowReset={ false }
132
- />
133
- ) ) || (
134
- <SelectControl
135
- __next40pxDefaultSize
136
- __nextHasNoMarginBottom
137
- label={ __( 'Author' ) }
138
- value={ authorId }
139
- options={ authorOptions }
140
- onChange={ handleSelect }
141
- />
142
- ) ) }
143
226
  <ToggleControl
144
227
  __nextHasNoMarginBottom
145
228
  label={ __( 'Show avatar' ) }
146
229
  checked={ showAvatar }
147
230
  onChange={ () =>
148
- setAttributes( { showAvatar: ! showAvatar } )
231
+ setAttributes( {
232
+ showAvatar: ! showAvatar,
233
+ } )
149
234
  }
150
235
  />
151
- { showAvatar && (
236
+ </ToolsPanelItem>
237
+ { showAvatar && (
238
+ <ToolsPanelItem
239
+ label={ __( 'Avatar size' ) }
240
+ isShownByDefault
241
+ hasValue={ () => avatarSize !== 48 }
242
+ onDeselect={ () =>
243
+ setAttributes( { avatarSize: 48 } )
244
+ }
245
+ >
152
246
  <SelectControl
153
247
  __next40pxDefaultSize
154
248
  __nextHasNoMarginBottom
155
249
  label={ __( 'Avatar size' ) }
156
- value={ attributes.avatarSize }
250
+ value={ avatarSize }
157
251
  options={ avatarSizes }
158
252
  onChange={ ( size ) => {
159
253
  setAttributes( {
@@ -161,15 +255,31 @@ function PostAuthorEdit( {
161
255
  } );
162
256
  } }
163
257
  />
164
- ) }
258
+ </ToolsPanelItem>
259
+ ) }
260
+ <ToolsPanelItem
261
+ label={ __( 'Show bio' ) }
262
+ isShownByDefault
263
+ hasValue={ () => !! showBio }
264
+ onDeselect={ () =>
265
+ setAttributes( { showBio: undefined } )
266
+ }
267
+ >
165
268
  <ToggleControl
166
269
  __nextHasNoMarginBottom
167
270
  label={ __( 'Show bio' ) }
168
- checked={ showBio }
271
+ checked={ !! showBio }
169
272
  onChange={ () =>
170
273
  setAttributes( { showBio: ! showBio } )
171
274
  }
172
275
  />
276
+ </ToolsPanelItem>
277
+ <ToolsPanelItem
278
+ label={ __( 'Link author name to author page' ) }
279
+ isShownByDefault
280
+ hasValue={ () => !! isLink }
281
+ onDeselect={ () => setAttributes( { isLink: false } ) }
282
+ >
173
283
  <ToggleControl
174
284
  __nextHasNoMarginBottom
175
285
  label={ __( 'Link author name to author page' ) }
@@ -178,7 +288,16 @@ function PostAuthorEdit( {
178
288
  setAttributes( { isLink: ! isLink } )
179
289
  }
180
290
  />
181
- { isLink && (
291
+ </ToolsPanelItem>
292
+ { isLink && (
293
+ <ToolsPanelItem
294
+ label={ __( 'Link target' ) }
295
+ isShownByDefault
296
+ hasValue={ () => linkTarget !== '_self' }
297
+ onDeselect={ () =>
298
+ setAttributes( { linkTarget: '_self' } )
299
+ }
300
+ >
182
301
  <ToggleControl
183
302
  __nextHasNoMarginBottom
184
303
  label={ __( 'Open in new tab' ) }
@@ -189,9 +308,9 @@ function PostAuthorEdit( {
189
308
  }
190
309
  checked={ linkTarget === '_blank' }
191
310
  />
192
- ) }
193
- </VStack>
194
- </PanelBody>
311
+ </ToolsPanelItem>
312
+ ) }
313
+ </ToolsPanel>
195
314
  </InspectorControls>
196
315
 
197
316
  <BlockControls group="block">
@@ -207,12 +326,8 @@ function PostAuthorEdit( {
207
326
  { showAvatar && authorDetails?.avatar_urls && (
208
327
  <div className="wp-block-post-author__avatar">
209
328
  <img
210
- width={ attributes.avatarSize }
211
- src={
212
- authorDetails.avatar_urls[
213
- attributes.avatarSize
214
- ]
215
- }
329
+ width={ avatarSize }
330
+ src={ authorDetails.avatar_urls[ avatarSize ] }
216
331
  alt={ authorDetails.name }
217
332
  />
218
333
  </div>
@@ -106,7 +106,7 @@ const CommentsForm = ( { postId, postType } ) => {
106
106
  return (
107
107
  <Warning>
108
108
  { sprintf(
109
- /* translators: 1: Post type (i.e. "post", "page") */
109
+ /* translators: %s: Post type (i.e. "post", "page") */
110
110
  __(
111
111
  'Post Comments Form block: Comments are not enabled for this post type (%s).'
112
112
  ),
@@ -248,6 +248,7 @@ export default function PostFeaturedImageEdit( {
248
248
  isLink: false,
249
249
  linkTarget: '_self',
250
250
  rel: '',
251
+ sizeSlug: DEFAULT_MEDIA_SIZE_SLUG,
251
252
  } );
252
253
  } }
253
254
  dropdownMenuProps={ dropdownMenuProps }
@@ -9,9 +9,10 @@ import clsx from 'clsx';
9
9
  import {
10
10
  __experimentalToggleGroupControl as ToggleGroupControl,
11
11
  __experimentalToggleGroupControlOption as ToggleGroupControlOption,
12
+ __experimentalToolsPanel as ToolsPanel,
13
+ __experimentalToolsPanelItem as ToolsPanelItem,
12
14
  ToggleControl,
13
15
  SelectControl,
14
- PanelBody,
15
16
  } from '@wordpress/components';
16
17
  import {
17
18
  InspectorControls,
@@ -25,6 +26,11 @@ import { __, _x } from '@wordpress/i18n';
25
26
  import { useSelect } from '@wordpress/data';
26
27
  import { store as coreStore } from '@wordpress/core-data';
27
28
 
29
+ /**
30
+ * Internal dependencies
31
+ */
32
+ import { useToolsPanelDropdownMenuProps } from '../utils/hooks';
33
+
28
34
  export default function PostNavigationLinkEdit( {
29
35
  context: { postType },
30
36
  attributes: {
@@ -94,73 +100,112 @@ export default function PostNavigationLinkEdit( {
94
100
  return [ selectOption, ...taxonomyOptions ];
95
101
  };
96
102
 
103
+ const dropdownMenuProps = useToolsPanelDropdownMenuProps();
104
+
97
105
  return (
98
106
  <>
99
107
  <InspectorControls>
100
- <PanelBody>
101
- <ToggleControl
102
- __nextHasNoMarginBottom
108
+ <ToolsPanel
109
+ label={ __( 'Settings' ) }
110
+ resetAll={ () => {
111
+ setAttributes( {
112
+ showTitle: false,
113
+ linkLabel: false,
114
+ arrow: 'none',
115
+ } );
116
+ } }
117
+ dropdownMenuProps={ dropdownMenuProps }
118
+ >
119
+ <ToolsPanelItem
103
120
  label={ __( 'Display the title as a link' ) }
104
- help={ __(
105
- 'If you have entered a custom label, it will be prepended before the title.'
106
- ) }
107
- checked={ !! showTitle }
108
- onChange={ () =>
109
- setAttributes( {
110
- showTitle: ! showTitle,
111
- } )
121
+ isShownByDefault
122
+ hasValue={ () => showTitle }
123
+ onDeselect={ () =>
124
+ setAttributes( { showTitle: false } )
112
125
  }
113
- />
114
- { showTitle && (
126
+ >
115
127
  <ToggleControl
116
128
  __nextHasNoMarginBottom
117
- label={ __(
118
- 'Include the label as part of the link'
129
+ label={ __( 'Display the title as a link' ) }
130
+ help={ __(
131
+ 'If you have entered a custom label, it will be prepended before the title.'
119
132
  ) }
120
- checked={ !! linkLabel }
133
+ checked={ !! showTitle }
121
134
  onChange={ () =>
122
135
  setAttributes( {
123
- linkLabel: ! linkLabel,
136
+ showTitle: ! showTitle,
124
137
  } )
125
138
  }
126
139
  />
140
+ </ToolsPanelItem>
141
+ { showTitle && (
142
+ <ToolsPanelItem
143
+ label={ __(
144
+ 'Include the label as part of the link'
145
+ ) }
146
+ isShownByDefault
147
+ hasValue={ () => !! linkLabel }
148
+ onDeselect={ () =>
149
+ setAttributes( { linkLabel: false } )
150
+ }
151
+ >
152
+ <ToggleControl
153
+ __nextHasNoMarginBottom
154
+ label={ __(
155
+ 'Include the label as part of the link'
156
+ ) }
157
+ checked={ !! linkLabel }
158
+ onChange={ () =>
159
+ setAttributes( {
160
+ linkLabel: ! linkLabel,
161
+ } )
162
+ }
163
+ />
164
+ </ToolsPanelItem>
127
165
  ) }
128
- <ToggleGroupControl
129
- __next40pxDefaultSize
130
- __nextHasNoMarginBottom
166
+ <ToolsPanelItem
131
167
  label={ __( 'Arrow' ) }
132
- value={ arrow }
133
- onChange={ ( value ) => {
134
- setAttributes( { arrow: value } );
135
- } }
136
- help={ __(
137
- 'A decorative arrow for the next and previous link.'
138
- ) }
139
- isBlock
168
+ isShownByDefault
169
+ hasValue={ () => arrow !== 'none' }
170
+ onDeselect={ () => setAttributes( { arrow: 'none' } ) }
140
171
  >
141
- <ToggleGroupControlOption
142
- value="none"
143
- label={ _x(
144
- 'None',
145
- 'Arrow option for Next/Previous link'
146
- ) }
147
- />
148
- <ToggleGroupControlOption
149
- value="arrow"
150
- label={ _x(
151
- 'Arrow',
152
- 'Arrow option for Next/Previous link'
153
- ) }
154
- />
155
- <ToggleGroupControlOption
156
- value="chevron"
157
- label={ _x(
158
- 'Chevron',
159
- 'Arrow option for Next/Previous link'
172
+ <ToggleGroupControl
173
+ __next40pxDefaultSize
174
+ __nextHasNoMarginBottom
175
+ label={ __( 'Arrow' ) }
176
+ value={ arrow }
177
+ onChange={ ( value ) => {
178
+ setAttributes( { arrow: value } );
179
+ } }
180
+ help={ __(
181
+ 'A decorative arrow for the next and previous link.'
160
182
  ) }
161
- />
162
- </ToggleGroupControl>
163
- </PanelBody>
183
+ isBlock
184
+ >
185
+ <ToggleGroupControlOption
186
+ value="none"
187
+ label={ _x(
188
+ 'None',
189
+ 'Arrow option for Next/Previous link'
190
+ ) }
191
+ />
192
+ <ToggleGroupControlOption
193
+ value="arrow"
194
+ label={ _x(
195
+ 'Arrow',
196
+ 'Arrow option for Next/Previous link'
197
+ ) }
198
+ />
199
+ <ToggleGroupControlOption
200
+ value="chevron"
201
+ label={ _x(
202
+ 'Chevron',
203
+ 'Arrow option for Next/Previous link'
204
+ ) }
205
+ />
206
+ </ToggleGroupControl>
207
+ </ToolsPanelItem>
208
+ </ToolsPanel>
164
209
  </InspectorControls>
165
210
  <InspectorControls group="advanced">
166
211
  <SelectControl
package/src/rss/index.php CHANGED
@@ -46,7 +46,8 @@ function render_block_core_rss( $attributes ) {
46
46
  }
47
47
 
48
48
  foreach ( $rss_items as $item ) {
49
- $title = esc_html( trim( strip_tags( $item->get_title() ) ) );
49
+ $title = esc_html( trim( strip_tags( html_entity_decode( $item->get_title() ) ) ) );
50
+
50
51
  if ( empty( $title ) ) {
51
52
  $title = __( '(no title)' );
52
53
  }
@@ -480,7 +480,7 @@ export default function SearchEdit( {
480
480
  key={ widthValue }
481
481
  value={ widthValue }
482
482
  label={ sprintf(
483
- /* translators: Percentage value. */
483
+ /* translators: %d: Percentage value. */
484
484
  __( '%d%%' ),
485
485
  widthValue
486
486
  ) }