@wordpress/block-library 9.16.0 → 9.17.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.
- package/CHANGELOG.md +2 -0
- package/build/archives/edit.js +2 -2
- package/build/archives/edit.js.map +1 -1
- package/build/categories/edit.js +115 -37
- package/build/categories/edit.js.map +1 -1
- package/build/comments/edit/comments-inspector-controls.js +6 -5
- package/build/comments/edit/comments-inspector-controls.js.map +1 -1
- package/build/comments-pagination/index.js +5 -0
- package/build/comments-pagination/index.js.map +1 -1
- package/build/cover/edit/inspector-controls.js +2 -9
- package/build/cover/edit/inspector-controls.js.map +1 -1
- package/build/details/edit.js +16 -2
- package/build/details/edit.js.map +1 -1
- package/build/details/index.js +9 -0
- package/build/details/index.js.map +1 -1
- package/build/details/save.js +2 -0
- package/build/details/save.js.map +1 -1
- package/build/embed/transforms.js +5 -2
- package/build/embed/transforms.js.map +1 -1
- package/build/form/variations.js +1 -1
- package/build/form/variations.js.map +1 -1
- package/build/group/edit.js +2 -9
- package/build/group/edit.js.map +1 -1
- package/build/home-link/edit.js +1 -2
- package/build/home-link/edit.js.map +1 -1
- package/build/latest-comments/edit.js +73 -26
- package/build/latest-comments/edit.js.map +1 -1
- package/build/latest-posts/constants.js +2 -1
- package/build/latest-posts/constants.js.map +1 -1
- package/build/latest-posts/edit.js +91 -38
- package/build/latest-posts/edit.js.map +1 -1
- package/build/list-item/index.js +1 -1
- package/build/navigation/edit/use-convert-classic-menu-to-block-menu.js +4 -4
- package/build/navigation/edit/use-convert-classic-menu-to-block-menu.js.map +1 -1
- package/build/navigation/edit/use-generate-default-navigation-title.js +4 -4
- package/build/navigation/edit/use-generate-default-navigation-title.js.map +1 -1
- package/build/navigation-link/edit.js +14 -19
- package/build/navigation-link/edit.js.map +1 -1
- package/build/navigation-submenu/index.js +7 -0
- package/build/navigation-submenu/index.js.map +1 -1
- package/build/page-list/edit.js +1 -1
- package/build/page-list/edit.js.map +1 -1
- package/build/paragraph/edit.js +4 -14
- package/build/paragraph/edit.js.map +1 -1
- package/build/pattern/index.js +1 -1
- package/build/post-content/index.js +1 -0
- package/build/post-content/index.js.map +1 -1
- package/build/post-date/edit.js +1 -1
- package/build/post-date/edit.js.map +1 -1
- package/build/post-featured-image/edit.js +0 -6
- package/build/post-featured-image/edit.js.map +1 -1
- package/build/post-navigation-link/variations.js +2 -2
- package/build/post-navigation-link/variations.js.map +1 -1
- package/build/post-terms/edit.js +1 -0
- package/build/post-terms/edit.js.map +1 -1
- package/build/post-time-to-read/index.js +1 -1
- package/build/query/edit/query-content.js +2 -6
- package/build/query/edit/query-content.js.map +1 -1
- package/build/query-no-results/index.js +1 -1
- package/build/query-pagination-numbers/edit.js +1 -1
- package/build/query-pagination-numbers/edit.js.map +1 -1
- package/build/query-title/edit.js +1 -0
- package/build/query-title/edit.js.map +1 -1
- package/build/read-more/edit.js +25 -7
- package/build/read-more/edit.js.map +1 -1
- package/build/search/edit.js +67 -49
- package/build/search/edit.js.map +1 -1
- package/build/separator/edit.js +2 -4
- package/build/separator/edit.js.map +1 -1
- package/build/spacer/controls.js +13 -9
- package/build/spacer/controls.js.map +1 -1
- package/build/spacer/edit.js +23 -21
- package/build/spacer/edit.js.map +1 -1
- package/build/template-part/edit/advanced-controls.js +2 -9
- package/build/template-part/edit/advanced-controls.js.map +1 -1
- package/build/utils/messages.js +22 -0
- package/build/utils/messages.js.map +1 -0
- package/build/video/edit-common-settings.js +1 -1
- package/build/video/edit-common-settings.js.map +1 -1
- package/build-module/archives/edit.js +2 -2
- package/build-module/archives/edit.js.map +1 -1
- package/build-module/categories/edit.js +116 -38
- package/build-module/categories/edit.js.map +1 -1
- package/build-module/comments/edit/comments-inspector-controls.js +5 -4
- package/build-module/comments/edit/comments-inspector-controls.js.map +1 -1
- package/build-module/comments-pagination/index.js +5 -0
- package/build-module/comments-pagination/index.js.map +1 -1
- package/build-module/cover/edit/inspector-controls.js +1 -8
- package/build-module/cover/edit/inspector-controls.js.map +1 -1
- package/build-module/details/edit.js +17 -3
- package/build-module/details/edit.js.map +1 -1
- package/build-module/details/index.js +9 -0
- package/build-module/details/index.js.map +1 -1
- package/build-module/details/save.js +2 -0
- package/build-module/details/save.js.map +1 -1
- package/build-module/embed/transforms.js +5 -2
- package/build-module/embed/transforms.js.map +1 -1
- package/build-module/form/variations.js +1 -1
- package/build-module/form/variations.js.map +1 -1
- package/build-module/group/edit.js +1 -8
- package/build-module/group/edit.js.map +1 -1
- package/build-module/home-link/edit.js +1 -2
- package/build-module/home-link/edit.js.map +1 -1
- package/build-module/latest-comments/edit.js +74 -27
- package/build-module/latest-comments/edit.js.map +1 -1
- package/build-module/latest-posts/constants.js +1 -0
- package/build-module/latest-posts/constants.js.map +1 -1
- package/build-module/latest-posts/edit.js +93 -40
- package/build-module/latest-posts/edit.js.map +1 -1
- package/build-module/list-item/index.js +1 -1
- package/build-module/navigation/edit/use-convert-classic-menu-to-block-menu.js +4 -4
- package/build-module/navigation/edit/use-convert-classic-menu-to-block-menu.js.map +1 -1
- package/build-module/navigation/edit/use-generate-default-navigation-title.js +4 -4
- package/build-module/navigation/edit/use-generate-default-navigation-title.js.map +1 -1
- package/build-module/navigation-link/edit.js +15 -20
- package/build-module/navigation-link/edit.js.map +1 -1
- package/build-module/navigation-submenu/index.js +7 -0
- package/build-module/navigation-submenu/index.js.map +1 -1
- package/build-module/page-list/edit.js +1 -1
- package/build-module/page-list/edit.js.map +1 -1
- package/build-module/paragraph/edit.js +5 -15
- package/build-module/paragraph/edit.js.map +1 -1
- package/build-module/pattern/index.js +1 -1
- package/build-module/post-content/index.js +1 -0
- package/build-module/post-content/index.js.map +1 -1
- package/build-module/post-date/edit.js +1 -1
- package/build-module/post-date/edit.js.map +1 -1
- package/build-module/post-featured-image/edit.js +0 -6
- package/build-module/post-featured-image/edit.js.map +1 -1
- package/build-module/post-navigation-link/variations.js +2 -2
- package/build-module/post-navigation-link/variations.js.map +1 -1
- package/build-module/post-terms/edit.js +1 -0
- package/build-module/post-terms/edit.js.map +1 -1
- package/build-module/post-time-to-read/index.js +1 -1
- package/build-module/query/edit/query-content.js +1 -5
- package/build-module/query/edit/query-content.js.map +1 -1
- package/build-module/query-no-results/index.js +1 -1
- package/build-module/query-pagination-numbers/edit.js +1 -1
- package/build-module/query-pagination-numbers/edit.js.map +1 -1
- package/build-module/query-title/edit.js +1 -0
- package/build-module/query-title/edit.js.map +1 -1
- package/build-module/read-more/edit.js +26 -8
- package/build-module/read-more/edit.js.map +1 -1
- package/build-module/search/edit.js +68 -50
- package/build-module/search/edit.js.map +1 -1
- package/build-module/separator/edit.js +1 -3
- package/build-module/separator/edit.js.map +1 -1
- package/build-module/spacer/controls.js +13 -9
- package/build-module/spacer/controls.js.map +1 -1
- package/build-module/spacer/edit.js +24 -22
- package/build-module/spacer/edit.js.map +1 -1
- package/build-module/template-part/edit/advanced-controls.js +1 -8
- package/build-module/template-part/edit/advanced-controls.js.map +1 -1
- package/build-module/utils/messages.js +15 -0
- package/build-module/utils/messages.js.map +1 -0
- package/build-module/video/edit-common-settings.js +1 -1
- package/build-module/video/edit-common-settings.js.map +1 -1
- package/build-style/editor-rtl.css +8 -45
- package/build-style/editor.css +8 -45
- package/build-style/gallery/editor-rtl.css +0 -44
- package/build-style/gallery/editor.css +0 -44
- package/build-style/navigation-link/editor-rtl.css +3 -0
- package/build-style/navigation-link/editor.css +3 -0
- package/build-style/paragraph/editor-rtl.css +4 -0
- package/build-style/paragraph/editor.css +4 -0
- package/build-style/post-featured-image/editor-rtl.css +1 -1
- package/build-style/post-featured-image/editor.css +1 -1
- package/package.json +35 -35
- package/src/archives/edit.js +2 -2
- package/src/categories/edit.js +133 -45
- package/src/comments/edit/comments-inspector-controls.js +5 -8
- package/src/comments-pagination/block.json +5 -0
- package/src/cover/edit/inspector-controls.js +1 -21
- package/src/details/block.json +9 -0
- package/src/details/edit.js +18 -2
- package/src/details/save.js +6 -2
- package/src/embed/transforms.js +3 -1
- package/src/form/variations.js +1 -1
- package/src/gallery/editor.scss +0 -56
- package/src/group/edit.js +1 -20
- package/src/home-link/edit.js +0 -6
- package/src/latest-comments/edit.js +93 -33
- package/src/latest-posts/constants.js +1 -0
- package/src/latest-posts/edit.js +119 -44
- package/src/list/test/edit.native.js +9 -9
- package/src/list-item/block.json +1 -1
- package/src/navigation/edit/use-convert-classic-menu-to-block-menu.js +4 -4
- package/src/navigation/edit/use-generate-default-navigation-title.js +4 -4
- package/src/navigation-link/edit.js +25 -29
- package/src/navigation-link/editor.scss +27 -18
- package/src/navigation-submenu/index.js +7 -0
- package/src/navigation-submenu/index.php +21 -4
- package/src/page-list/edit.js +52 -50
- package/src/paragraph/edit.js +3 -18
- package/src/paragraph/editor.scss +7 -0
- package/src/pattern/block.json +1 -1
- package/src/post-content/block.json +1 -0
- package/src/post-date/edit.js +1 -3
- package/src/post-featured-image/edit.js +2 -15
- package/src/post-featured-image/editor.scss +2 -2
- package/src/post-navigation-link/variations.js +2 -2
- package/src/post-terms/edit.js +1 -0
- package/src/post-time-to-read/block.json +1 -1
- package/src/query/edit/query-content.js +1 -11
- package/src/query-no-results/block.json +1 -1
- package/src/query-pagination-numbers/edit.js +1 -1
- package/src/query-title/edit.js +1 -0
- package/src/read-more/edit.js +35 -11
- package/src/search/edit.js +99 -74
- package/src/separator/edit.js +1 -6
- package/src/spacer/controls.js +10 -9
- package/src/spacer/edit.js +25 -23
- package/src/template-part/edit/advanced-controls.js +1 -21
- package/src/utils/messages.js +31 -0
- package/src/video/edit-common-settings.js +1 -1
|
@@ -7,7 +7,7 @@ import clsx from 'clsx';
|
|
|
7
7
|
/**
|
|
8
8
|
* WordPress dependencies
|
|
9
9
|
*/
|
|
10
|
-
import { PanelBody, Placeholder, QueryControls, RadioControl, RangeControl, Spinner, ToggleControl, ToolbarGroup, __experimentalToggleGroupControl as ToggleGroupControl, __experimentalToggleGroupControlOptionIcon as ToggleGroupControlOptionIcon } from '@wordpress/components';
|
|
10
|
+
import { PanelBody, Placeholder, QueryControls, RadioControl, RangeControl, Spinner, ToggleControl, ToolbarGroup, __experimentalToggleGroupControl as ToggleGroupControl, __experimentalToggleGroupControlOptionIcon as ToggleGroupControlOptionIcon, __experimentalToolsPanel as ToolsPanel, __experimentalToolsPanelItem as ToolsPanelItem } from '@wordpress/components';
|
|
11
11
|
import { __, _x, sprintf } from '@wordpress/i18n';
|
|
12
12
|
import { dateI18n, format, getSettings } from '@wordpress/date';
|
|
13
13
|
import { InspectorControls, BlockControls, __experimentalImageSizeControl as ImageSizeControl, useBlockProps, store as blockEditorStore } from '@wordpress/block-editor';
|
|
@@ -21,7 +21,8 @@ import { createInterpolateElement } from '@wordpress/element';
|
|
|
21
21
|
/**
|
|
22
22
|
* Internal dependencies
|
|
23
23
|
*/
|
|
24
|
-
import { MIN_EXCERPT_LENGTH, MAX_EXCERPT_LENGTH, MAX_POSTS_COLUMNS } from './constants';
|
|
24
|
+
import { MIN_EXCERPT_LENGTH, MAX_EXCERPT_LENGTH, MAX_POSTS_COLUMNS, DEFAULT_EXCERPT_LENGTH } from './constants';
|
|
25
|
+
import { useToolsPanelDropdownMenuProps } from '../utils/hooks';
|
|
25
26
|
|
|
26
27
|
/**
|
|
27
28
|
* Module Constants
|
|
@@ -50,6 +51,7 @@ export default function LatestPostsEdit({
|
|
|
50
51
|
}) {
|
|
51
52
|
var _categoriesList$reduc;
|
|
52
53
|
const instanceId = useInstanceId(LatestPostsEdit);
|
|
54
|
+
const dropdownMenuProps = useToolsPanelDropdownMenuProps();
|
|
53
55
|
const {
|
|
54
56
|
postsToShow,
|
|
55
57
|
order,
|
|
@@ -165,54 +167,105 @@ export default function LatestPostsEdit({
|
|
|
165
167
|
}];
|
|
166
168
|
const hasPosts = !!latestPosts?.length;
|
|
167
169
|
const inspectorControls = /*#__PURE__*/_jsxs(InspectorControls, {
|
|
168
|
-
children: [/*#__PURE__*/_jsxs(
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
170
|
+
children: [/*#__PURE__*/_jsxs(ToolsPanel, {
|
|
171
|
+
label: __('Post content'),
|
|
172
|
+
resetAll: () => setAttributes({
|
|
173
|
+
displayPostContent: false,
|
|
174
|
+
displayPostContentRadio: 'excerpt',
|
|
175
|
+
excerptLength: DEFAULT_EXCERPT_LENGTH
|
|
176
|
+
}),
|
|
177
|
+
dropdownMenuProps: dropdownMenuProps,
|
|
178
|
+
children: [/*#__PURE__*/_jsx(ToolsPanelItem, {
|
|
179
|
+
hasValue: () => !!displayPostContent,
|
|
172
180
|
label: __('Post content'),
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
181
|
+
onDeselect: () => setAttributes({
|
|
182
|
+
displayPostContent: false
|
|
183
|
+
}),
|
|
184
|
+
isShownByDefault: true,
|
|
185
|
+
children: /*#__PURE__*/_jsx(ToggleControl, {
|
|
186
|
+
__nextHasNoMarginBottom: true,
|
|
187
|
+
label: __('Post content'),
|
|
188
|
+
checked: displayPostContent,
|
|
189
|
+
onChange: value => setAttributes({
|
|
190
|
+
displayPostContent: value
|
|
191
|
+
})
|
|
176
192
|
})
|
|
177
|
-
}), displayPostContent && /*#__PURE__*/_jsx(
|
|
193
|
+
}), displayPostContent && /*#__PURE__*/_jsx(ToolsPanelItem, {
|
|
194
|
+
hasValue: () => displayPostContentRadio !== 'excerpt',
|
|
178
195
|
label: __('Show'),
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
label: __('
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
196
|
+
onDeselect: () => setAttributes({
|
|
197
|
+
displayPostContentRadio: 'excerpt'
|
|
198
|
+
}),
|
|
199
|
+
isShownByDefault: true,
|
|
200
|
+
children: /*#__PURE__*/_jsx(RadioControl, {
|
|
201
|
+
label: __('Show'),
|
|
202
|
+
selected: displayPostContentRadio,
|
|
203
|
+
options: [{
|
|
204
|
+
label: __('Excerpt'),
|
|
205
|
+
value: 'excerpt'
|
|
206
|
+
}, {
|
|
207
|
+
label: __('Full post'),
|
|
208
|
+
value: 'full_post'
|
|
209
|
+
}],
|
|
210
|
+
onChange: value => setAttributes({
|
|
211
|
+
displayPostContentRadio: value
|
|
212
|
+
})
|
|
189
213
|
})
|
|
190
|
-
}), displayPostContent && displayPostContentRadio === 'excerpt' && /*#__PURE__*/_jsx(
|
|
191
|
-
|
|
192
|
-
__next40pxDefaultSize: true,
|
|
214
|
+
}), displayPostContent && displayPostContentRadio === 'excerpt' && /*#__PURE__*/_jsx(ToolsPanelItem, {
|
|
215
|
+
hasValue: () => excerptLength !== DEFAULT_EXCERPT_LENGTH,
|
|
193
216
|
label: __('Max number of words'),
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
excerptLength: value
|
|
217
|
+
onDeselect: () => setAttributes({
|
|
218
|
+
excerptLength: DEFAULT_EXCERPT_LENGTH
|
|
197
219
|
}),
|
|
198
|
-
|
|
199
|
-
|
|
220
|
+
isShownByDefault: true,
|
|
221
|
+
children: /*#__PURE__*/_jsx(RangeControl, {
|
|
222
|
+
__nextHasNoMarginBottom: true,
|
|
223
|
+
__next40pxDefaultSize: true,
|
|
224
|
+
label: __('Max number of words'),
|
|
225
|
+
value: excerptLength,
|
|
226
|
+
onChange: value => setAttributes({
|
|
227
|
+
excerptLength: value
|
|
228
|
+
}),
|
|
229
|
+
min: MIN_EXCERPT_LENGTH,
|
|
230
|
+
max: MAX_EXCERPT_LENGTH
|
|
231
|
+
})
|
|
200
232
|
})]
|
|
201
|
-
}), /*#__PURE__*/_jsxs(
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
233
|
+
}), /*#__PURE__*/_jsxs(ToolsPanel, {
|
|
234
|
+
label: __('Post meta'),
|
|
235
|
+
resetAll: () => setAttributes({
|
|
236
|
+
displayAuthor: false,
|
|
237
|
+
displayPostDate: false
|
|
238
|
+
}),
|
|
239
|
+
dropdownMenuProps: dropdownMenuProps,
|
|
240
|
+
children: [/*#__PURE__*/_jsx(ToolsPanelItem, {
|
|
241
|
+
hasValue: () => !!displayAuthor,
|
|
205
242
|
label: __('Display author name'),
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
243
|
+
onDeselect: () => setAttributes({
|
|
244
|
+
displayAuthor: false
|
|
245
|
+
}),
|
|
246
|
+
isShownByDefault: true,
|
|
247
|
+
children: /*#__PURE__*/_jsx(ToggleControl, {
|
|
248
|
+
__nextHasNoMarginBottom: true,
|
|
249
|
+
label: __('Display author name'),
|
|
250
|
+
checked: displayAuthor,
|
|
251
|
+
onChange: value => setAttributes({
|
|
252
|
+
displayAuthor: value
|
|
253
|
+
})
|
|
209
254
|
})
|
|
210
|
-
}), /*#__PURE__*/_jsx(
|
|
211
|
-
|
|
255
|
+
}), /*#__PURE__*/_jsx(ToolsPanelItem, {
|
|
256
|
+
hasValue: () => !!displayPostDate,
|
|
212
257
|
label: __('Display post date'),
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
258
|
+
onDeselect: () => setAttributes({
|
|
259
|
+
displayPostDate: false
|
|
260
|
+
}),
|
|
261
|
+
isShownByDefault: true,
|
|
262
|
+
children: /*#__PURE__*/_jsx(ToggleControl, {
|
|
263
|
+
__nextHasNoMarginBottom: true,
|
|
264
|
+
label: __('Display post date'),
|
|
265
|
+
checked: displayPostDate,
|
|
266
|
+
onChange: value => setAttributes({
|
|
267
|
+
displayPostDate: value
|
|
268
|
+
})
|
|
216
269
|
})
|
|
217
270
|
})]
|
|
218
271
|
}), /*#__PURE__*/_jsxs(PanelBody, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["clsx","PanelBody","Placeholder","QueryControls","RadioControl","RangeControl","Spinner","ToggleControl","ToolbarGroup","__experimentalToggleGroupControl","ToggleGroupControl","__experimentalToggleGroupControlOptionIcon","ToggleGroupControlOptionIcon","__","_x","sprintf","dateI18n","format","getSettings","InspectorControls","BlockControls","__experimentalImageSizeControl","ImageSizeControl","useBlockProps","store","blockEditorStore","useSelect","useDispatch","pin","list","grid","alignNone","positionLeft","positionCenter","positionRight","coreStore","noticeStore","useInstanceId","createInterpolateElement","MIN_EXCERPT_LENGTH","MAX_EXCERPT_LENGTH","MAX_POSTS_COLUMNS","jsx","_jsx","jsxs","_jsxs","Fragment","_Fragment","CATEGORIES_LIST_QUERY","per_page","context","USERS_LIST_QUERY","has_published_posts","getFeaturedImageDetails","post","size","_image$media_details$","image","_embedded","url","media_details","sizes","source_url","alt","alt_text","LatestPostsEdit","attributes","setAttributes","_categoriesList$reduc","instanceId","postsToShow","order","orderBy","categories","selectedAuthor","displayFeaturedImage","displayPostContentRadio","displayPostContent","displayPostDate","displayAuthor","postLayout","columns","excerptLength","featuredImageAlign","featuredImageSizeSlug","featuredImageSizeWidth","featuredImageSizeHeight","addLinkToFeaturedImage","imageSizes","latestPosts","defaultImageWidth","defaultImageHeight","categoriesList","authorList","select","_settings$imageDimens","_settings$imageDimens2","getEntityRecords","getUsers","settings","catIds","length","map","cat","id","latestPostsQuery","Object","fromEntries","entries","author","orderby","_embed","filter","value","imageDimensions","width","height","createWarningNotice","showRedirectionPreventedNotice","event","preventDefault","type","imageSizeOptions","slug","name","label","categorySuggestions","reduce","accumulator","category","selectCategories","tokens","hasNoSuggestion","some","token","allCategories","includes","imageAlignmentOptions","icon","hasPosts","inspectorControls","children","title","__nextHasNoMarginBottom","checked","onChange","selected","options","__next40pxDefaultSize","min","max","newAttrs","hasOwnProperty","imageWidth","imageHeight","imageSizeHelp","onChangeImage","undefined","className","numberOfItems","onOrderChange","onOrderByChange","onNumberOfItemsChange","onCategoryChange","selectedCategories","onAuthorChange","Number","selectedAuthorId","Math","required","blockProps","Array","isArray","displayPosts","slice","layoutControls","onClick","isActive","dateFormat","formats","date","controls","titleTrimmed","rendered","trim","excerpt","currentAuthor","find","excerptElement","document","createElement","innerHTML","textContent","innerText","imageSourceUrl","featuredImageAlt","imageClasses","renderFeaturedImage","featuredImage","src","style","maxWidth","maxHeight","needsReadMore","split","raw","postExcerpt","join","a","href","link","rel","span","dangerouslySetInnerHTML","__html","date_gmt","dateTime","content"],"sources":["@wordpress/block-library/src/latest-posts/edit.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tPanelBody,\n\tPlaceholder,\n\tQueryControls,\n\tRadioControl,\n\tRangeControl,\n\tSpinner,\n\tToggleControl,\n\tToolbarGroup,\n\t__experimentalToggleGroupControl as ToggleGroupControl,\n\t__experimentalToggleGroupControlOptionIcon as ToggleGroupControlOptionIcon,\n} from '@wordpress/components';\nimport { __, _x, sprintf } from '@wordpress/i18n';\nimport { dateI18n, format, getSettings } from '@wordpress/date';\nimport {\n\tInspectorControls,\n\tBlockControls,\n\t__experimentalImageSizeControl as ImageSizeControl,\n\tuseBlockProps,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport {\n\tpin,\n\tlist,\n\tgrid,\n\talignNone,\n\tpositionLeft,\n\tpositionCenter,\n\tpositionRight,\n} from '@wordpress/icons';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { store as noticeStore } from '@wordpress/notices';\nimport { useInstanceId } from '@wordpress/compose';\nimport { createInterpolateElement } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport {\n\tMIN_EXCERPT_LENGTH,\n\tMAX_EXCERPT_LENGTH,\n\tMAX_POSTS_COLUMNS,\n} from './constants';\n\n/**\n * Module Constants\n */\nconst CATEGORIES_LIST_QUERY = {\n\tper_page: -1,\n\tcontext: 'view',\n};\nconst USERS_LIST_QUERY = {\n\tper_page: -1,\n\thas_published_posts: [ 'post' ],\n\tcontext: 'view',\n};\n\nfunction getFeaturedImageDetails( post, size ) {\n\tconst image = post._embedded?.[ 'wp:featuredmedia' ]?.[ '0' ];\n\n\treturn {\n\t\turl:\n\t\t\timage?.media_details?.sizes?.[ size ]?.source_url ??\n\t\t\timage?.source_url,\n\t\talt: image?.alt_text,\n\t};\n}\n\nexport default function LatestPostsEdit( { attributes, setAttributes } ) {\n\tconst instanceId = useInstanceId( LatestPostsEdit );\n\tconst {\n\t\tpostsToShow,\n\t\torder,\n\t\torderBy,\n\t\tcategories,\n\t\tselectedAuthor,\n\t\tdisplayFeaturedImage,\n\t\tdisplayPostContentRadio,\n\t\tdisplayPostContent,\n\t\tdisplayPostDate,\n\t\tdisplayAuthor,\n\t\tpostLayout,\n\t\tcolumns,\n\t\texcerptLength,\n\t\tfeaturedImageAlign,\n\t\tfeaturedImageSizeSlug,\n\t\tfeaturedImageSizeWidth,\n\t\tfeaturedImageSizeHeight,\n\t\taddLinkToFeaturedImage,\n\t} = attributes;\n\tconst {\n\t\timageSizes,\n\t\tlatestPosts,\n\t\tdefaultImageWidth,\n\t\tdefaultImageHeight,\n\t\tcategoriesList,\n\t\tauthorList,\n\t} = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getEntityRecords, getUsers } = select( coreStore );\n\t\t\tconst settings = select( blockEditorStore ).getSettings();\n\t\t\tconst catIds =\n\t\t\t\tcategories && categories.length > 0\n\t\t\t\t\t? categories.map( ( cat ) => cat.id )\n\t\t\t\t\t: [];\n\t\t\tconst latestPostsQuery = Object.fromEntries(\n\t\t\t\tObject.entries( {\n\t\t\t\t\tcategories: catIds,\n\t\t\t\t\tauthor: selectedAuthor,\n\t\t\t\t\torder,\n\t\t\t\t\torderby: orderBy,\n\t\t\t\t\tper_page: postsToShow,\n\t\t\t\t\t_embed: 'wp:featuredmedia',\n\t\t\t\t} ).filter( ( [ , value ] ) => typeof value !== 'undefined' )\n\t\t\t);\n\n\t\t\treturn {\n\t\t\t\tdefaultImageWidth:\n\t\t\t\t\tsettings.imageDimensions?.[ featuredImageSizeSlug ]\n\t\t\t\t\t\t?.width ?? 0,\n\t\t\t\tdefaultImageHeight:\n\t\t\t\t\tsettings.imageDimensions?.[ featuredImageSizeSlug ]\n\t\t\t\t\t\t?.height ?? 0,\n\t\t\t\timageSizes: settings.imageSizes,\n\t\t\t\tlatestPosts: getEntityRecords(\n\t\t\t\t\t'postType',\n\t\t\t\t\t'post',\n\t\t\t\t\tlatestPostsQuery\n\t\t\t\t),\n\t\t\t\tcategoriesList: getEntityRecords(\n\t\t\t\t\t'taxonomy',\n\t\t\t\t\t'category',\n\t\t\t\t\tCATEGORIES_LIST_QUERY\n\t\t\t\t),\n\t\t\t\tauthorList: getUsers( USERS_LIST_QUERY ),\n\t\t\t};\n\t\t},\n\t\t[\n\t\t\tfeaturedImageSizeSlug,\n\t\t\tpostsToShow,\n\t\t\torder,\n\t\t\torderBy,\n\t\t\tcategories,\n\t\t\tselectedAuthor,\n\t\t]\n\t);\n\n\t// If a user clicks to a link prevent redirection and show a warning.\n\tconst { createWarningNotice } = useDispatch( noticeStore );\n\tconst showRedirectionPreventedNotice = ( event ) => {\n\t\tevent.preventDefault();\n\t\tcreateWarningNotice( __( 'Links are disabled in the editor.' ), {\n\t\t\tid: `block-library/core/latest-posts/redirection-prevented/${ instanceId }`,\n\t\t\ttype: 'snackbar',\n\t\t} );\n\t};\n\n\tconst imageSizeOptions = imageSizes\n\t\t.filter( ( { slug } ) => slug !== 'full' )\n\t\t.map( ( { name, slug } ) => ( {\n\t\t\tvalue: slug,\n\t\t\tlabel: name,\n\t\t} ) );\n\tconst categorySuggestions =\n\t\tcategoriesList?.reduce(\n\t\t\t( accumulator, category ) => ( {\n\t\t\t\t...accumulator,\n\t\t\t\t[ category.name ]: category,\n\t\t\t} ),\n\t\t\t{}\n\t\t) ?? {};\n\tconst selectCategories = ( tokens ) => {\n\t\tconst hasNoSuggestion = tokens.some(\n\t\t\t( token ) =>\n\t\t\t\ttypeof token === 'string' && ! categorySuggestions[ token ]\n\t\t);\n\t\tif ( hasNoSuggestion ) {\n\t\t\treturn;\n\t\t}\n\t\t// Categories that are already will be objects, while new additions will be strings (the name).\n\t\t// allCategories nomalizes the array so that they are all objects.\n\t\tconst allCategories = tokens.map( ( token ) => {\n\t\t\treturn typeof token === 'string'\n\t\t\t\t? categorySuggestions[ token ]\n\t\t\t\t: token;\n\t\t} );\n\t\t// We do nothing if the category is not selected\n\t\t// from suggestions.\n\t\tif ( allCategories.includes( null ) ) {\n\t\t\treturn false;\n\t\t}\n\t\tsetAttributes( { categories: allCategories } );\n\t};\n\n\tconst imageAlignmentOptions = [\n\t\t{\n\t\t\tvalue: 'none',\n\t\t\ticon: alignNone,\n\t\t\tlabel: __( 'None' ),\n\t\t},\n\t\t{\n\t\t\tvalue: 'left',\n\t\t\ticon: positionLeft,\n\t\t\tlabel: __( 'Left' ),\n\t\t},\n\t\t{\n\t\t\tvalue: 'center',\n\t\t\ticon: positionCenter,\n\t\t\tlabel: __( 'Center' ),\n\t\t},\n\t\t{\n\t\t\tvalue: 'right',\n\t\t\ticon: positionRight,\n\t\t\tlabel: __( 'Right' ),\n\t\t},\n\t];\n\n\tconst hasPosts = !! latestPosts?.length;\n\tconst inspectorControls = (\n\t\t<InspectorControls>\n\t\t\t<PanelBody title={ __( 'Post content' ) }>\n\t\t\t\t<ToggleControl\n\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\tlabel={ __( 'Post content' ) }\n\t\t\t\t\tchecked={ displayPostContent }\n\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\tsetAttributes( { displayPostContent: value } )\n\t\t\t\t\t}\n\t\t\t\t/>\n\t\t\t\t{ displayPostContent && (\n\t\t\t\t\t<RadioControl\n\t\t\t\t\t\tlabel={ __( 'Show' ) }\n\t\t\t\t\t\tselected={ displayPostContentRadio }\n\t\t\t\t\t\toptions={ [\n\t\t\t\t\t\t\t{ label: __( 'Excerpt' ), value: 'excerpt' },\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tlabel: __( 'Full post' ),\n\t\t\t\t\t\t\t\tvalue: 'full_post',\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t] }\n\t\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\tdisplayPostContentRadio: value,\n\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t}\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t\t{ displayPostContent &&\n\t\t\t\t\tdisplayPostContentRadio === 'excerpt' && (\n\t\t\t\t\t\t<RangeControl\n\t\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\tlabel={ __( 'Max number of words' ) }\n\t\t\t\t\t\t\tvalue={ excerptLength }\n\t\t\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\t\t\tsetAttributes( { excerptLength: value } )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tmin={ MIN_EXCERPT_LENGTH }\n\t\t\t\t\t\t\tmax={ MAX_EXCERPT_LENGTH }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t</PanelBody>\n\n\t\t\t<PanelBody title={ __( 'Post meta' ) }>\n\t\t\t\t<ToggleControl\n\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\tlabel={ __( 'Display author name' ) }\n\t\t\t\t\tchecked={ displayAuthor }\n\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\tsetAttributes( { displayAuthor: value } )\n\t\t\t\t\t}\n\t\t\t\t/>\n\t\t\t\t<ToggleControl\n\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\tlabel={ __( 'Display post date' ) }\n\t\t\t\t\tchecked={ displayPostDate }\n\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\tsetAttributes( { displayPostDate: value } )\n\t\t\t\t\t}\n\t\t\t\t/>\n\t\t\t</PanelBody>\n\n\t\t\t<PanelBody title={ __( 'Featured image' ) }>\n\t\t\t\t<ToggleControl\n\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\tlabel={ __( 'Display featured image' ) }\n\t\t\t\t\tchecked={ displayFeaturedImage }\n\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\tsetAttributes( { displayFeaturedImage: value } )\n\t\t\t\t\t}\n\t\t\t\t/>\n\t\t\t\t{ displayFeaturedImage && (\n\t\t\t\t\t<>\n\t\t\t\t\t\t<ImageSizeControl\n\t\t\t\t\t\t\tonChange={ ( value ) => {\n\t\t\t\t\t\t\t\tconst newAttrs = {};\n\t\t\t\t\t\t\t\tif ( value.hasOwnProperty( 'width' ) ) {\n\t\t\t\t\t\t\t\t\tnewAttrs.featuredImageSizeWidth =\n\t\t\t\t\t\t\t\t\t\tvalue.width;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tif ( value.hasOwnProperty( 'height' ) ) {\n\t\t\t\t\t\t\t\t\tnewAttrs.featuredImageSizeHeight =\n\t\t\t\t\t\t\t\t\t\tvalue.height;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tsetAttributes( newAttrs );\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\tslug={ featuredImageSizeSlug }\n\t\t\t\t\t\t\twidth={ featuredImageSizeWidth }\n\t\t\t\t\t\t\theight={ featuredImageSizeHeight }\n\t\t\t\t\t\t\timageWidth={ defaultImageWidth }\n\t\t\t\t\t\t\timageHeight={ defaultImageHeight }\n\t\t\t\t\t\t\timageSizeOptions={ imageSizeOptions }\n\t\t\t\t\t\t\timageSizeHelp={ __(\n\t\t\t\t\t\t\t\t'Select the size of the source image.'\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\tonChangeImage={ ( value ) =>\n\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\tfeaturedImageSizeSlug: value,\n\t\t\t\t\t\t\t\t\tfeaturedImageSizeWidth: undefined,\n\t\t\t\t\t\t\t\t\tfeaturedImageSizeHeight: undefined,\n\t\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<ToggleGroupControl\n\t\t\t\t\t\t\tclassName=\"editor-latest-posts-image-alignment-control\"\n\t\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\tlabel={ __( 'Image alignment' ) }\n\t\t\t\t\t\t\tvalue={ featuredImageAlign || 'none' }\n\t\t\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\tfeaturedImageAlign:\n\t\t\t\t\t\t\t\t\t\tvalue !== 'none' ? value : undefined,\n\t\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ imageAlignmentOptions.map(\n\t\t\t\t\t\t\t\t( { value, icon, label } ) => {\n\t\t\t\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t\t\t\t<ToggleGroupControlOptionIcon\n\t\t\t\t\t\t\t\t\t\t\tkey={ value }\n\t\t\t\t\t\t\t\t\t\t\tvalue={ value }\n\t\t\t\t\t\t\t\t\t\t\ticon={ icon }\n\t\t\t\t\t\t\t\t\t\t\tlabel={ label }\n\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t</ToggleGroupControl>\n\t\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t\tlabel={ __( 'Add link to featured image' ) }\n\t\t\t\t\t\t\tchecked={ addLinkToFeaturedImage }\n\t\t\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\taddLinkToFeaturedImage: value,\n\t\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t/>\n\t\t\t\t\t</>\n\t\t\t\t) }\n\t\t\t</PanelBody>\n\n\t\t\t<PanelBody title={ __( 'Sorting and filtering' ) }>\n\t\t\t\t<QueryControls\n\t\t\t\t\t{ ...{ order, orderBy } }\n\t\t\t\t\tnumberOfItems={ postsToShow }\n\t\t\t\t\tonOrderChange={ ( value ) =>\n\t\t\t\t\t\tsetAttributes( { order: value } )\n\t\t\t\t\t}\n\t\t\t\t\tonOrderByChange={ ( value ) =>\n\t\t\t\t\t\tsetAttributes( { orderBy: value } )\n\t\t\t\t\t}\n\t\t\t\t\tonNumberOfItemsChange={ ( value ) =>\n\t\t\t\t\t\tsetAttributes( { postsToShow: value } )\n\t\t\t\t\t}\n\t\t\t\t\tcategorySuggestions={ categorySuggestions }\n\t\t\t\t\tonCategoryChange={ selectCategories }\n\t\t\t\t\tselectedCategories={ categories }\n\t\t\t\t\tonAuthorChange={ ( value ) =>\n\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\tselectedAuthor:\n\t\t\t\t\t\t\t\t'' !== value ? Number( value ) : undefined,\n\t\t\t\t\t\t} )\n\t\t\t\t\t}\n\t\t\t\t\tauthorList={ authorList ?? [] }\n\t\t\t\t\tselectedAuthorId={ selectedAuthor }\n\t\t\t\t/>\n\n\t\t\t\t{ postLayout === 'grid' && (\n\t\t\t\t\t<RangeControl\n\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\tlabel={ __( 'Columns' ) }\n\t\t\t\t\t\tvalue={ columns }\n\t\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\t\tsetAttributes( { columns: value } )\n\t\t\t\t\t\t}\n\t\t\t\t\t\tmin={ 2 }\n\t\t\t\t\t\tmax={\n\t\t\t\t\t\t\t! hasPosts\n\t\t\t\t\t\t\t\t? MAX_POSTS_COLUMNS\n\t\t\t\t\t\t\t\t: Math.min(\n\t\t\t\t\t\t\t\t\t\tMAX_POSTS_COLUMNS,\n\t\t\t\t\t\t\t\t\t\tlatestPosts.length\n\t\t\t\t\t\t\t\t )\n\t\t\t\t\t\t}\n\t\t\t\t\t\trequired\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t</PanelBody>\n\t\t</InspectorControls>\n\t);\n\n\tconst blockProps = useBlockProps( {\n\t\tclassName: clsx( {\n\t\t\t'wp-block-latest-posts__list': true,\n\t\t\t'is-grid': postLayout === 'grid',\n\t\t\t'has-dates': displayPostDate,\n\t\t\t'has-author': displayAuthor,\n\t\t\t[ `columns-${ columns }` ]: postLayout === 'grid',\n\t\t} ),\n\t} );\n\n\tif ( ! hasPosts ) {\n\t\treturn (\n\t\t\t<div { ...blockProps }>\n\t\t\t\t{ inspectorControls }\n\t\t\t\t<Placeholder icon={ pin } label={ __( 'Latest Posts' ) }>\n\t\t\t\t\t{ ! Array.isArray( latestPosts ) ? (\n\t\t\t\t\t\t<Spinner />\n\t\t\t\t\t) : (\n\t\t\t\t\t\t__( 'No posts found.' )\n\t\t\t\t\t) }\n\t\t\t\t</Placeholder>\n\t\t\t</div>\n\t\t);\n\t}\n\n\t// Removing posts from display should be instant.\n\tconst displayPosts =\n\t\tlatestPosts.length > postsToShow\n\t\t\t? latestPosts.slice( 0, postsToShow )\n\t\t\t: latestPosts;\n\n\tconst layoutControls = [\n\t\t{\n\t\t\ticon: list,\n\t\t\ttitle: _x( 'List view', 'Latest posts block display setting' ),\n\t\t\tonClick: () => setAttributes( { postLayout: 'list' } ),\n\t\t\tisActive: postLayout === 'list',\n\t\t},\n\t\t{\n\t\t\ticon: grid,\n\t\t\ttitle: _x( 'Grid view', 'Latest posts block display setting' ),\n\t\t\tonClick: () => setAttributes( { postLayout: 'grid' } ),\n\t\t\tisActive: postLayout === 'grid',\n\t\t},\n\t];\n\n\tconst dateFormat = getSettings().formats.date;\n\n\treturn (\n\t\t<>\n\t\t\t{ inspectorControls }\n\t\t\t<BlockControls>\n\t\t\t\t<ToolbarGroup controls={ layoutControls } />\n\t\t\t</BlockControls>\n\t\t\t<ul { ...blockProps }>\n\t\t\t\t{ displayPosts.map( ( post ) => {\n\t\t\t\t\tconst titleTrimmed = post.title.rendered.trim();\n\t\t\t\t\tlet excerpt = post.excerpt.rendered;\n\t\t\t\t\tconst currentAuthor = authorList?.find(\n\t\t\t\t\t\t( author ) => author.id === post.author\n\t\t\t\t\t);\n\n\t\t\t\t\tconst excerptElement = document.createElement( 'div' );\n\t\t\t\t\texcerptElement.innerHTML = excerpt;\n\n\t\t\t\t\texcerpt =\n\t\t\t\t\t\texcerptElement.textContent ||\n\t\t\t\t\t\texcerptElement.innerText ||\n\t\t\t\t\t\t'';\n\n\t\t\t\t\tconst { url: imageSourceUrl, alt: featuredImageAlt } =\n\t\t\t\t\t\tgetFeaturedImageDetails( post, featuredImageSizeSlug );\n\t\t\t\t\tconst imageClasses = clsx( {\n\t\t\t\t\t\t'wp-block-latest-posts__featured-image': true,\n\t\t\t\t\t\t[ `align${ featuredImageAlign }` ]:\n\t\t\t\t\t\t\t!! featuredImageAlign,\n\t\t\t\t\t} );\n\t\t\t\t\tconst renderFeaturedImage =\n\t\t\t\t\t\tdisplayFeaturedImage && imageSourceUrl;\n\t\t\t\t\tconst featuredImage = renderFeaturedImage && (\n\t\t\t\t\t\t<img\n\t\t\t\t\t\t\tsrc={ imageSourceUrl }\n\t\t\t\t\t\t\talt={ featuredImageAlt }\n\t\t\t\t\t\t\tstyle={ {\n\t\t\t\t\t\t\t\tmaxWidth: featuredImageSizeWidth,\n\t\t\t\t\t\t\t\tmaxHeight: featuredImageSizeHeight,\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t/>\n\t\t\t\t\t);\n\n\t\t\t\t\tconst needsReadMore =\n\t\t\t\t\t\texcerptLength < excerpt.trim().split( ' ' ).length &&\n\t\t\t\t\t\tpost.excerpt.raw === '';\n\n\t\t\t\t\tconst postExcerpt = needsReadMore ? (\n\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t{ excerpt\n\t\t\t\t\t\t\t\t.trim()\n\t\t\t\t\t\t\t\t.split( ' ', excerptLength )\n\t\t\t\t\t\t\t\t.join( ' ' ) }\n\t\t\t\t\t\t\t{ createInterpolateElement(\n\t\t\t\t\t\t\t\tsprintf(\n\t\t\t\t\t\t\t\t\t/* translators: 1: Hidden accessibility text: Post title */\n\t\t\t\t\t\t\t\t\t__(\n\t\t\t\t\t\t\t\t\t\t'… <a>Read more<span>: %1$s</span></a>'\n\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t\ttitleTrimmed || __( '(no title)' )\n\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\ta: (\n\t\t\t\t\t\t\t\t\t\t// eslint-disable-next-line jsx-a11y/anchor-has-content\n\t\t\t\t\t\t\t\t\t\t<a\n\t\t\t\t\t\t\t\t\t\t\tclassName=\"wp-block-latest-posts__read-more\"\n\t\t\t\t\t\t\t\t\t\t\thref={ post.link }\n\t\t\t\t\t\t\t\t\t\t\trel=\"noopener noreferrer\"\n\t\t\t\t\t\t\t\t\t\t\tonClick={\n\t\t\t\t\t\t\t\t\t\t\t\tshowRedirectionPreventedNotice\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t\tspan: (\n\t\t\t\t\t\t\t\t\t\t<span className=\"screen-reader-text\" />\n\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t</>\n\t\t\t\t\t) : (\n\t\t\t\t\t\texcerpt\n\t\t\t\t\t);\n\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<li key={ post.id }>\n\t\t\t\t\t\t\t{ renderFeaturedImage && (\n\t\t\t\t\t\t\t\t<div className={ imageClasses }>\n\t\t\t\t\t\t\t\t\t{ addLinkToFeaturedImage ? (\n\t\t\t\t\t\t\t\t\t\t<a\n\t\t\t\t\t\t\t\t\t\t\thref={ post.link }\n\t\t\t\t\t\t\t\t\t\t\trel=\"noreferrer noopener\"\n\t\t\t\t\t\t\t\t\t\t\tonClick={\n\t\t\t\t\t\t\t\t\t\t\t\tshowRedirectionPreventedNotice\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t{ featuredImage }\n\t\t\t\t\t\t\t\t\t\t</a>\n\t\t\t\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\t\t\t\tfeaturedImage\n\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t<a\n\t\t\t\t\t\t\t\tclassName=\"wp-block-latest-posts__post-title\"\n\t\t\t\t\t\t\t\thref={ post.link }\n\t\t\t\t\t\t\t\trel=\"noreferrer noopener\"\n\t\t\t\t\t\t\t\tdangerouslySetInnerHTML={\n\t\t\t\t\t\t\t\t\t!! titleTrimmed\n\t\t\t\t\t\t\t\t\t\t? {\n\t\t\t\t\t\t\t\t\t\t\t\t__html: titleTrimmed,\n\t\t\t\t\t\t\t\t\t\t }\n\t\t\t\t\t\t\t\t\t\t: undefined\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tonClick={ showRedirectionPreventedNotice }\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{ ! titleTrimmed ? __( '(no title)' ) : null }\n\t\t\t\t\t\t\t</a>\n\t\t\t\t\t\t\t{ displayAuthor && currentAuthor && (\n\t\t\t\t\t\t\t\t<div className=\"wp-block-latest-posts__post-author\">\n\t\t\t\t\t\t\t\t\t{ sprintf(\n\t\t\t\t\t\t\t\t\t\t/* translators: byline. %s: author. */\n\t\t\t\t\t\t\t\t\t\t__( 'by %s' ),\n\t\t\t\t\t\t\t\t\t\tcurrentAuthor.name\n\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t{ displayPostDate && post.date_gmt && (\n\t\t\t\t\t\t\t\t<time\n\t\t\t\t\t\t\t\t\tdateTime={ format( 'c', post.date_gmt ) }\n\t\t\t\t\t\t\t\t\tclassName=\"wp-block-latest-posts__post-date\"\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t{ dateI18n( dateFormat, post.date_gmt ) }\n\t\t\t\t\t\t\t\t</time>\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t{ displayPostContent &&\n\t\t\t\t\t\t\t\tdisplayPostContentRadio === 'excerpt' && (\n\t\t\t\t\t\t\t\t\t<div className=\"wp-block-latest-posts__post-excerpt\">\n\t\t\t\t\t\t\t\t\t\t{ postExcerpt }\n\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t{ displayPostContent &&\n\t\t\t\t\t\t\t\tdisplayPostContentRadio === 'full_post' && (\n\t\t\t\t\t\t\t\t\t<div\n\t\t\t\t\t\t\t\t\t\tclassName=\"wp-block-latest-posts__post-full-content\"\n\t\t\t\t\t\t\t\t\t\tdangerouslySetInnerHTML={ {\n\t\t\t\t\t\t\t\t\t\t\t__html: post.content.raw.trim(),\n\t\t\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t</li>\n\t\t\t\t\t);\n\t\t\t\t} ) }\n\t\t\t</ul>\n\t\t</>\n\t);\n}\n"],"mappings":";AAAA;AACA;AACA;AACA,OAAOA,IAAI,MAAM,MAAM;;AAEvB;AACA;AACA;AACA,SACCC,SAAS,EACTC,WAAW,EACXC,aAAa,EACbC,YAAY,EACZC,YAAY,EACZC,OAAO,EACPC,aAAa,EACbC,YAAY,EACZC,gCAAgC,IAAIC,kBAAkB,EACtDC,0CAA0C,IAAIC,4BAA4B,QACpE,uBAAuB;AAC9B,SAASC,EAAE,EAAEC,EAAE,EAAEC,OAAO,QAAQ,iBAAiB;AACjD,SAASC,QAAQ,EAAEC,MAAM,EAAEC,WAAW,QAAQ,iBAAiB;AAC/D,SACCC,iBAAiB,EACjBC,aAAa,EACbC,8BAA8B,IAAIC,gBAAgB,EAClDC,aAA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
+
{"version":3,"names":["clsx","PanelBody","Placeholder","QueryControls","RadioControl","RangeControl","Spinner","ToggleControl","ToolbarGroup","__experimentalToggleGroupControl","ToggleGroupControl","__experimentalToggleGroupControlOptionIcon","ToggleGroupControlOptionIcon","__experimentalToolsPanel","ToolsPanel","__experimentalToolsPanelItem","ToolsPanelItem","__","_x","sprintf","dateI18n","format","getSettings","InspectorControls","BlockControls","__experimentalImageSizeControl","ImageSizeControl","useBlockProps","store","blockEditorStore","useSelect","useDispatch","pin","list","grid","alignNone","positionLeft","positionCenter","positionRight","coreStore","noticeStore","useInstanceId","createInterpolateElement","MIN_EXCERPT_LENGTH","MAX_EXCERPT_LENGTH","MAX_POSTS_COLUMNS","DEFAULT_EXCERPT_LENGTH","useToolsPanelDropdownMenuProps","jsx","_jsx","jsxs","_jsxs","Fragment","_Fragment","CATEGORIES_LIST_QUERY","per_page","context","USERS_LIST_QUERY","has_published_posts","getFeaturedImageDetails","post","size","_image$media_details$","image","_embedded","url","media_details","sizes","source_url","alt","alt_text","LatestPostsEdit","attributes","setAttributes","_categoriesList$reduc","instanceId","dropdownMenuProps","postsToShow","order","orderBy","categories","selectedAuthor","displayFeaturedImage","displayPostContentRadio","displayPostContent","displayPostDate","displayAuthor","postLayout","columns","excerptLength","featuredImageAlign","featuredImageSizeSlug","featuredImageSizeWidth","featuredImageSizeHeight","addLinkToFeaturedImage","imageSizes","latestPosts","defaultImageWidth","defaultImageHeight","categoriesList","authorList","select","_settings$imageDimens","_settings$imageDimens2","getEntityRecords","getUsers","settings","catIds","length","map","cat","id","latestPostsQuery","Object","fromEntries","entries","author","orderby","_embed","filter","value","imageDimensions","width","height","createWarningNotice","showRedirectionPreventedNotice","event","preventDefault","type","imageSizeOptions","slug","name","label","categorySuggestions","reduce","accumulator","category","selectCategories","tokens","hasNoSuggestion","some","token","allCategories","includes","imageAlignmentOptions","icon","hasPosts","inspectorControls","children","resetAll","hasValue","onDeselect","isShownByDefault","__nextHasNoMarginBottom","checked","onChange","selected","options","__next40pxDefaultSize","min","max","title","newAttrs","hasOwnProperty","imageWidth","imageHeight","imageSizeHelp","onChangeImage","undefined","className","numberOfItems","onOrderChange","onOrderByChange","onNumberOfItemsChange","onCategoryChange","selectedCategories","onAuthorChange","Number","selectedAuthorId","Math","required","blockProps","Array","isArray","displayPosts","slice","layoutControls","onClick","isActive","dateFormat","formats","date","controls","titleTrimmed","rendered","trim","excerpt","currentAuthor","find","excerptElement","document","createElement","innerHTML","textContent","innerText","imageSourceUrl","featuredImageAlt","imageClasses","renderFeaturedImage","featuredImage","src","style","maxWidth","maxHeight","needsReadMore","split","raw","postExcerpt","join","a","href","link","rel","span","dangerouslySetInnerHTML","__html","date_gmt","dateTime","content"],"sources":["@wordpress/block-library/src/latest-posts/edit.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tPanelBody,\n\tPlaceholder,\n\tQueryControls,\n\tRadioControl,\n\tRangeControl,\n\tSpinner,\n\tToggleControl,\n\tToolbarGroup,\n\t__experimentalToggleGroupControl as ToggleGroupControl,\n\t__experimentalToggleGroupControlOptionIcon as ToggleGroupControlOptionIcon,\n\t__experimentalToolsPanel as ToolsPanel,\n\t__experimentalToolsPanelItem as ToolsPanelItem,\n} from '@wordpress/components';\nimport { __, _x, sprintf } from '@wordpress/i18n';\nimport { dateI18n, format, getSettings } from '@wordpress/date';\nimport {\n\tInspectorControls,\n\tBlockControls,\n\t__experimentalImageSizeControl as ImageSizeControl,\n\tuseBlockProps,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport {\n\tpin,\n\tlist,\n\tgrid,\n\talignNone,\n\tpositionLeft,\n\tpositionCenter,\n\tpositionRight,\n} from '@wordpress/icons';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { store as noticeStore } from '@wordpress/notices';\nimport { useInstanceId } from '@wordpress/compose';\nimport { createInterpolateElement } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport {\n\tMIN_EXCERPT_LENGTH,\n\tMAX_EXCERPT_LENGTH,\n\tMAX_POSTS_COLUMNS,\n\tDEFAULT_EXCERPT_LENGTH,\n} from './constants';\nimport { useToolsPanelDropdownMenuProps } from '../utils/hooks';\n\n/**\n * Module Constants\n */\nconst CATEGORIES_LIST_QUERY = {\n\tper_page: -1,\n\tcontext: 'view',\n};\nconst USERS_LIST_QUERY = {\n\tper_page: -1,\n\thas_published_posts: [ 'post' ],\n\tcontext: 'view',\n};\n\nfunction getFeaturedImageDetails( post, size ) {\n\tconst image = post._embedded?.[ 'wp:featuredmedia' ]?.[ '0' ];\n\n\treturn {\n\t\turl:\n\t\t\timage?.media_details?.sizes?.[ size ]?.source_url ??\n\t\t\timage?.source_url,\n\t\talt: image?.alt_text,\n\t};\n}\n\nexport default function LatestPostsEdit( { attributes, setAttributes } ) {\n\tconst instanceId = useInstanceId( LatestPostsEdit );\n\tconst dropdownMenuProps = useToolsPanelDropdownMenuProps();\n\n\tconst {\n\t\tpostsToShow,\n\t\torder,\n\t\torderBy,\n\t\tcategories,\n\t\tselectedAuthor,\n\t\tdisplayFeaturedImage,\n\t\tdisplayPostContentRadio,\n\t\tdisplayPostContent,\n\t\tdisplayPostDate,\n\t\tdisplayAuthor,\n\t\tpostLayout,\n\t\tcolumns,\n\t\texcerptLength,\n\t\tfeaturedImageAlign,\n\t\tfeaturedImageSizeSlug,\n\t\tfeaturedImageSizeWidth,\n\t\tfeaturedImageSizeHeight,\n\t\taddLinkToFeaturedImage,\n\t} = attributes;\n\tconst {\n\t\timageSizes,\n\t\tlatestPosts,\n\t\tdefaultImageWidth,\n\t\tdefaultImageHeight,\n\t\tcategoriesList,\n\t\tauthorList,\n\t} = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getEntityRecords, getUsers } = select( coreStore );\n\t\t\tconst settings = select( blockEditorStore ).getSettings();\n\t\t\tconst catIds =\n\t\t\t\tcategories && categories.length > 0\n\t\t\t\t\t? categories.map( ( cat ) => cat.id )\n\t\t\t\t\t: [];\n\t\t\tconst latestPostsQuery = Object.fromEntries(\n\t\t\t\tObject.entries( {\n\t\t\t\t\tcategories: catIds,\n\t\t\t\t\tauthor: selectedAuthor,\n\t\t\t\t\torder,\n\t\t\t\t\torderby: orderBy,\n\t\t\t\t\tper_page: postsToShow,\n\t\t\t\t\t_embed: 'wp:featuredmedia',\n\t\t\t\t} ).filter( ( [ , value ] ) => typeof value !== 'undefined' )\n\t\t\t);\n\n\t\t\treturn {\n\t\t\t\tdefaultImageWidth:\n\t\t\t\t\tsettings.imageDimensions?.[ featuredImageSizeSlug ]\n\t\t\t\t\t\t?.width ?? 0,\n\t\t\t\tdefaultImageHeight:\n\t\t\t\t\tsettings.imageDimensions?.[ featuredImageSizeSlug ]\n\t\t\t\t\t\t?.height ?? 0,\n\t\t\t\timageSizes: settings.imageSizes,\n\t\t\t\tlatestPosts: getEntityRecords(\n\t\t\t\t\t'postType',\n\t\t\t\t\t'post',\n\t\t\t\t\tlatestPostsQuery\n\t\t\t\t),\n\t\t\t\tcategoriesList: getEntityRecords(\n\t\t\t\t\t'taxonomy',\n\t\t\t\t\t'category',\n\t\t\t\t\tCATEGORIES_LIST_QUERY\n\t\t\t\t),\n\t\t\t\tauthorList: getUsers( USERS_LIST_QUERY ),\n\t\t\t};\n\t\t},\n\t\t[\n\t\t\tfeaturedImageSizeSlug,\n\t\t\tpostsToShow,\n\t\t\torder,\n\t\t\torderBy,\n\t\t\tcategories,\n\t\t\tselectedAuthor,\n\t\t]\n\t);\n\n\t// If a user clicks to a link prevent redirection and show a warning.\n\tconst { createWarningNotice } = useDispatch( noticeStore );\n\tconst showRedirectionPreventedNotice = ( event ) => {\n\t\tevent.preventDefault();\n\t\tcreateWarningNotice( __( 'Links are disabled in the editor.' ), {\n\t\t\tid: `block-library/core/latest-posts/redirection-prevented/${ instanceId }`,\n\t\t\ttype: 'snackbar',\n\t\t} );\n\t};\n\n\tconst imageSizeOptions = imageSizes\n\t\t.filter( ( { slug } ) => slug !== 'full' )\n\t\t.map( ( { name, slug } ) => ( {\n\t\t\tvalue: slug,\n\t\t\tlabel: name,\n\t\t} ) );\n\tconst categorySuggestions =\n\t\tcategoriesList?.reduce(\n\t\t\t( accumulator, category ) => ( {\n\t\t\t\t...accumulator,\n\t\t\t\t[ category.name ]: category,\n\t\t\t} ),\n\t\t\t{}\n\t\t) ?? {};\n\tconst selectCategories = ( tokens ) => {\n\t\tconst hasNoSuggestion = tokens.some(\n\t\t\t( token ) =>\n\t\t\t\ttypeof token === 'string' && ! categorySuggestions[ token ]\n\t\t);\n\t\tif ( hasNoSuggestion ) {\n\t\t\treturn;\n\t\t}\n\t\t// Categories that are already will be objects, while new additions will be strings (the name).\n\t\t// allCategories nomalizes the array so that they are all objects.\n\t\tconst allCategories = tokens.map( ( token ) => {\n\t\t\treturn typeof token === 'string'\n\t\t\t\t? categorySuggestions[ token ]\n\t\t\t\t: token;\n\t\t} );\n\t\t// We do nothing if the category is not selected\n\t\t// from suggestions.\n\t\tif ( allCategories.includes( null ) ) {\n\t\t\treturn false;\n\t\t}\n\t\tsetAttributes( { categories: allCategories } );\n\t};\n\n\tconst imageAlignmentOptions = [\n\t\t{\n\t\t\tvalue: 'none',\n\t\t\ticon: alignNone,\n\t\t\tlabel: __( 'None' ),\n\t\t},\n\t\t{\n\t\t\tvalue: 'left',\n\t\t\ticon: positionLeft,\n\t\t\tlabel: __( 'Left' ),\n\t\t},\n\t\t{\n\t\t\tvalue: 'center',\n\t\t\ticon: positionCenter,\n\t\t\tlabel: __( 'Center' ),\n\t\t},\n\t\t{\n\t\t\tvalue: 'right',\n\t\t\ticon: positionRight,\n\t\t\tlabel: __( 'Right' ),\n\t\t},\n\t];\n\n\tconst hasPosts = !! latestPosts?.length;\n\tconst inspectorControls = (\n\t\t<InspectorControls>\n\t\t\t<ToolsPanel\n\t\t\t\tlabel={ __( 'Post content' ) }\n\t\t\t\tresetAll={ () =>\n\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\tdisplayPostContent: false,\n\t\t\t\t\t\tdisplayPostContentRadio: 'excerpt',\n\t\t\t\t\t\texcerptLength: DEFAULT_EXCERPT_LENGTH,\n\t\t\t\t\t} )\n\t\t\t\t}\n\t\t\t\tdropdownMenuProps={ dropdownMenuProps }\n\t\t\t>\n\t\t\t\t<ToolsPanelItem\n\t\t\t\t\thasValue={ () => !! displayPostContent }\n\t\t\t\t\tlabel={ __( 'Post content' ) }\n\t\t\t\t\tonDeselect={ () =>\n\t\t\t\t\t\tsetAttributes( { displayPostContent: false } )\n\t\t\t\t\t}\n\t\t\t\t\tisShownByDefault\n\t\t\t\t>\n\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\tlabel={ __( 'Post content' ) }\n\t\t\t\t\t\tchecked={ displayPostContent }\n\t\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\t\tsetAttributes( { displayPostContent: value } )\n\t\t\t\t\t\t}\n\t\t\t\t\t/>\n\t\t\t\t</ToolsPanelItem>\n\t\t\t\t{ displayPostContent && (\n\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\thasValue={ () => displayPostContentRadio !== 'excerpt' }\n\t\t\t\t\t\tlabel={ __( 'Show' ) }\n\t\t\t\t\t\tonDeselect={ () =>\n\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\tdisplayPostContentRadio: 'excerpt',\n\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t}\n\t\t\t\t\t\tisShownByDefault\n\t\t\t\t\t>\n\t\t\t\t\t\t<RadioControl\n\t\t\t\t\t\t\tlabel={ __( 'Show' ) }\n\t\t\t\t\t\t\tselected={ displayPostContentRadio }\n\t\t\t\t\t\t\toptions={ [\n\t\t\t\t\t\t\t\t{ label: __( 'Excerpt' ), value: 'excerpt' },\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tlabel: __( 'Full post' ),\n\t\t\t\t\t\t\t\t\tvalue: 'full_post',\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t] }\n\t\t\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\tdisplayPostContentRadio: value,\n\t\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t/>\n\t\t\t\t\t</ToolsPanelItem>\n\t\t\t\t) }\n\t\t\t\t{ displayPostContent &&\n\t\t\t\t\tdisplayPostContentRadio === 'excerpt' && (\n\t\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\t\thasValue={ () =>\n\t\t\t\t\t\t\t\texcerptLength !== DEFAULT_EXCERPT_LENGTH\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tlabel={ __( 'Max number of words' ) }\n\t\t\t\t\t\t\tonDeselect={ () =>\n\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\texcerptLength: DEFAULT_EXCERPT_LENGTH,\n\t\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tisShownByDefault\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<RangeControl\n\t\t\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\t\tlabel={ __( 'Max number of words' ) }\n\t\t\t\t\t\t\t\tvalue={ excerptLength }\n\t\t\t\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\t\t\t\tsetAttributes( { excerptLength: value } )\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tmin={ MIN_EXCERPT_LENGTH }\n\t\t\t\t\t\t\t\tmax={ MAX_EXCERPT_LENGTH }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</ToolsPanelItem>\n\t\t\t\t\t) }\n\t\t\t</ToolsPanel>\n\n\t\t\t<ToolsPanel\n\t\t\t\tlabel={ __( 'Post meta' ) }\n\t\t\t\tresetAll={ () =>\n\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\tdisplayAuthor: false,\n\t\t\t\t\t\tdisplayPostDate: false,\n\t\t\t\t\t} )\n\t\t\t\t}\n\t\t\t\tdropdownMenuProps={ dropdownMenuProps }\n\t\t\t>\n\t\t\t\t<ToolsPanelItem\n\t\t\t\t\thasValue={ () => !! displayAuthor }\n\t\t\t\t\tlabel={ __( 'Display author name' ) }\n\t\t\t\t\tonDeselect={ () =>\n\t\t\t\t\t\tsetAttributes( { displayAuthor: false } )\n\t\t\t\t\t}\n\t\t\t\t\tisShownByDefault\n\t\t\t\t>\n\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\tlabel={ __( 'Display author name' ) }\n\t\t\t\t\t\tchecked={ displayAuthor }\n\t\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\t\tsetAttributes( { displayAuthor: value } )\n\t\t\t\t\t\t}\n\t\t\t\t\t/>\n\t\t\t\t</ToolsPanelItem>\n\t\t\t\t<ToolsPanelItem\n\t\t\t\t\thasValue={ () => !! displayPostDate }\n\t\t\t\t\tlabel={ __( 'Display post date' ) }\n\t\t\t\t\tonDeselect={ () =>\n\t\t\t\t\t\tsetAttributes( { displayPostDate: false } )\n\t\t\t\t\t}\n\t\t\t\t\tisShownByDefault\n\t\t\t\t>\n\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\tlabel={ __( 'Display post date' ) }\n\t\t\t\t\t\tchecked={ displayPostDate }\n\t\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\t\tsetAttributes( { displayPostDate: value } )\n\t\t\t\t\t\t}\n\t\t\t\t\t/>\n\t\t\t\t</ToolsPanelItem>\n\t\t\t</ToolsPanel>\n\t\t\t<PanelBody title={ __( 'Featured image' ) }>\n\t\t\t\t<ToggleControl\n\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\tlabel={ __( 'Display featured image' ) }\n\t\t\t\t\tchecked={ displayFeaturedImage }\n\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\tsetAttributes( { displayFeaturedImage: value } )\n\t\t\t\t\t}\n\t\t\t\t/>\n\t\t\t\t{ displayFeaturedImage && (\n\t\t\t\t\t<>\n\t\t\t\t\t\t<ImageSizeControl\n\t\t\t\t\t\t\tonChange={ ( value ) => {\n\t\t\t\t\t\t\t\tconst newAttrs = {};\n\t\t\t\t\t\t\t\tif ( value.hasOwnProperty( 'width' ) ) {\n\t\t\t\t\t\t\t\t\tnewAttrs.featuredImageSizeWidth =\n\t\t\t\t\t\t\t\t\t\tvalue.width;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tif ( value.hasOwnProperty( 'height' ) ) {\n\t\t\t\t\t\t\t\t\tnewAttrs.featuredImageSizeHeight =\n\t\t\t\t\t\t\t\t\t\tvalue.height;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tsetAttributes( newAttrs );\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\tslug={ featuredImageSizeSlug }\n\t\t\t\t\t\t\twidth={ featuredImageSizeWidth }\n\t\t\t\t\t\t\theight={ featuredImageSizeHeight }\n\t\t\t\t\t\t\timageWidth={ defaultImageWidth }\n\t\t\t\t\t\t\timageHeight={ defaultImageHeight }\n\t\t\t\t\t\t\timageSizeOptions={ imageSizeOptions }\n\t\t\t\t\t\t\timageSizeHelp={ __(\n\t\t\t\t\t\t\t\t'Select the size of the source image.'\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\tonChangeImage={ ( value ) =>\n\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\tfeaturedImageSizeSlug: value,\n\t\t\t\t\t\t\t\t\tfeaturedImageSizeWidth: undefined,\n\t\t\t\t\t\t\t\t\tfeaturedImageSizeHeight: undefined,\n\t\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<ToggleGroupControl\n\t\t\t\t\t\t\tclassName=\"editor-latest-posts-image-alignment-control\"\n\t\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\tlabel={ __( 'Image alignment' ) }\n\t\t\t\t\t\t\tvalue={ featuredImageAlign || 'none' }\n\t\t\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\tfeaturedImageAlign:\n\t\t\t\t\t\t\t\t\t\tvalue !== 'none' ? value : undefined,\n\t\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ imageAlignmentOptions.map(\n\t\t\t\t\t\t\t\t( { value, icon, label } ) => {\n\t\t\t\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t\t\t\t<ToggleGroupControlOptionIcon\n\t\t\t\t\t\t\t\t\t\t\tkey={ value }\n\t\t\t\t\t\t\t\t\t\t\tvalue={ value }\n\t\t\t\t\t\t\t\t\t\t\ticon={ icon }\n\t\t\t\t\t\t\t\t\t\t\tlabel={ label }\n\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t</ToggleGroupControl>\n\t\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t\tlabel={ __( 'Add link to featured image' ) }\n\t\t\t\t\t\t\tchecked={ addLinkToFeaturedImage }\n\t\t\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\taddLinkToFeaturedImage: value,\n\t\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t/>\n\t\t\t\t\t</>\n\t\t\t\t) }\n\t\t\t</PanelBody>\n\n\t\t\t<PanelBody title={ __( 'Sorting and filtering' ) }>\n\t\t\t\t<QueryControls\n\t\t\t\t\t{ ...{ order, orderBy } }\n\t\t\t\t\tnumberOfItems={ postsToShow }\n\t\t\t\t\tonOrderChange={ ( value ) =>\n\t\t\t\t\t\tsetAttributes( { order: value } )\n\t\t\t\t\t}\n\t\t\t\t\tonOrderByChange={ ( value ) =>\n\t\t\t\t\t\tsetAttributes( { orderBy: value } )\n\t\t\t\t\t}\n\t\t\t\t\tonNumberOfItemsChange={ ( value ) =>\n\t\t\t\t\t\tsetAttributes( { postsToShow: value } )\n\t\t\t\t\t}\n\t\t\t\t\tcategorySuggestions={ categorySuggestions }\n\t\t\t\t\tonCategoryChange={ selectCategories }\n\t\t\t\t\tselectedCategories={ categories }\n\t\t\t\t\tonAuthorChange={ ( value ) =>\n\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\tselectedAuthor:\n\t\t\t\t\t\t\t\t'' !== value ? Number( value ) : undefined,\n\t\t\t\t\t\t} )\n\t\t\t\t\t}\n\t\t\t\t\tauthorList={ authorList ?? [] }\n\t\t\t\t\tselectedAuthorId={ selectedAuthor }\n\t\t\t\t/>\n\n\t\t\t\t{ postLayout === 'grid' && (\n\t\t\t\t\t<RangeControl\n\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\tlabel={ __( 'Columns' ) }\n\t\t\t\t\t\tvalue={ columns }\n\t\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\t\tsetAttributes( { columns: value } )\n\t\t\t\t\t\t}\n\t\t\t\t\t\tmin={ 2 }\n\t\t\t\t\t\tmax={\n\t\t\t\t\t\t\t! hasPosts\n\t\t\t\t\t\t\t\t? MAX_POSTS_COLUMNS\n\t\t\t\t\t\t\t\t: Math.min(\n\t\t\t\t\t\t\t\t\t\tMAX_POSTS_COLUMNS,\n\t\t\t\t\t\t\t\t\t\tlatestPosts.length\n\t\t\t\t\t\t\t\t )\n\t\t\t\t\t\t}\n\t\t\t\t\t\trequired\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t</PanelBody>\n\t\t</InspectorControls>\n\t);\n\n\tconst blockProps = useBlockProps( {\n\t\tclassName: clsx( {\n\t\t\t'wp-block-latest-posts__list': true,\n\t\t\t'is-grid': postLayout === 'grid',\n\t\t\t'has-dates': displayPostDate,\n\t\t\t'has-author': displayAuthor,\n\t\t\t[ `columns-${ columns }` ]: postLayout === 'grid',\n\t\t} ),\n\t} );\n\n\tif ( ! hasPosts ) {\n\t\treturn (\n\t\t\t<div { ...blockProps }>\n\t\t\t\t{ inspectorControls }\n\t\t\t\t<Placeholder icon={ pin } label={ __( 'Latest Posts' ) }>\n\t\t\t\t\t{ ! Array.isArray( latestPosts ) ? (\n\t\t\t\t\t\t<Spinner />\n\t\t\t\t\t) : (\n\t\t\t\t\t\t__( 'No posts found.' )\n\t\t\t\t\t) }\n\t\t\t\t</Placeholder>\n\t\t\t</div>\n\t\t);\n\t}\n\n\t// Removing posts from display should be instant.\n\tconst displayPosts =\n\t\tlatestPosts.length > postsToShow\n\t\t\t? latestPosts.slice( 0, postsToShow )\n\t\t\t: latestPosts;\n\n\tconst layoutControls = [\n\t\t{\n\t\t\ticon: list,\n\t\t\ttitle: _x( 'List view', 'Latest posts block display setting' ),\n\t\t\tonClick: () => setAttributes( { postLayout: 'list' } ),\n\t\t\tisActive: postLayout === 'list',\n\t\t},\n\t\t{\n\t\t\ticon: grid,\n\t\t\ttitle: _x( 'Grid view', 'Latest posts block display setting' ),\n\t\t\tonClick: () => setAttributes( { postLayout: 'grid' } ),\n\t\t\tisActive: postLayout === 'grid',\n\t\t},\n\t];\n\n\tconst dateFormat = getSettings().formats.date;\n\n\treturn (\n\t\t<>\n\t\t\t{ inspectorControls }\n\t\t\t<BlockControls>\n\t\t\t\t<ToolbarGroup controls={ layoutControls } />\n\t\t\t</BlockControls>\n\t\t\t<ul { ...blockProps }>\n\t\t\t\t{ displayPosts.map( ( post ) => {\n\t\t\t\t\tconst titleTrimmed = post.title.rendered.trim();\n\t\t\t\t\tlet excerpt = post.excerpt.rendered;\n\t\t\t\t\tconst currentAuthor = authorList?.find(\n\t\t\t\t\t\t( author ) => author.id === post.author\n\t\t\t\t\t);\n\n\t\t\t\t\tconst excerptElement = document.createElement( 'div' );\n\t\t\t\t\texcerptElement.innerHTML = excerpt;\n\n\t\t\t\t\texcerpt =\n\t\t\t\t\t\texcerptElement.textContent ||\n\t\t\t\t\t\texcerptElement.innerText ||\n\t\t\t\t\t\t'';\n\n\t\t\t\t\tconst { url: imageSourceUrl, alt: featuredImageAlt } =\n\t\t\t\t\t\tgetFeaturedImageDetails( post, featuredImageSizeSlug );\n\t\t\t\t\tconst imageClasses = clsx( {\n\t\t\t\t\t\t'wp-block-latest-posts__featured-image': true,\n\t\t\t\t\t\t[ `align${ featuredImageAlign }` ]:\n\t\t\t\t\t\t\t!! featuredImageAlign,\n\t\t\t\t\t} );\n\t\t\t\t\tconst renderFeaturedImage =\n\t\t\t\t\t\tdisplayFeaturedImage && imageSourceUrl;\n\t\t\t\t\tconst featuredImage = renderFeaturedImage && (\n\t\t\t\t\t\t<img\n\t\t\t\t\t\t\tsrc={ imageSourceUrl }\n\t\t\t\t\t\t\talt={ featuredImageAlt }\n\t\t\t\t\t\t\tstyle={ {\n\t\t\t\t\t\t\t\tmaxWidth: featuredImageSizeWidth,\n\t\t\t\t\t\t\t\tmaxHeight: featuredImageSizeHeight,\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t/>\n\t\t\t\t\t);\n\n\t\t\t\t\tconst needsReadMore =\n\t\t\t\t\t\texcerptLength < excerpt.trim().split( ' ' ).length &&\n\t\t\t\t\t\tpost.excerpt.raw === '';\n\n\t\t\t\t\tconst postExcerpt = needsReadMore ? (\n\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t{ excerpt\n\t\t\t\t\t\t\t\t.trim()\n\t\t\t\t\t\t\t\t.split( ' ', excerptLength )\n\t\t\t\t\t\t\t\t.join( ' ' ) }\n\t\t\t\t\t\t\t{ createInterpolateElement(\n\t\t\t\t\t\t\t\tsprintf(\n\t\t\t\t\t\t\t\t\t/* translators: 1: Hidden accessibility text: Post title */\n\t\t\t\t\t\t\t\t\t__(\n\t\t\t\t\t\t\t\t\t\t'… <a>Read more<span>: %1$s</span></a>'\n\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t\ttitleTrimmed || __( '(no title)' )\n\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\ta: (\n\t\t\t\t\t\t\t\t\t\t// eslint-disable-next-line jsx-a11y/anchor-has-content\n\t\t\t\t\t\t\t\t\t\t<a\n\t\t\t\t\t\t\t\t\t\t\tclassName=\"wp-block-latest-posts__read-more\"\n\t\t\t\t\t\t\t\t\t\t\thref={ post.link }\n\t\t\t\t\t\t\t\t\t\t\trel=\"noopener noreferrer\"\n\t\t\t\t\t\t\t\t\t\t\tonClick={\n\t\t\t\t\t\t\t\t\t\t\t\tshowRedirectionPreventedNotice\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t\tspan: (\n\t\t\t\t\t\t\t\t\t\t<span className=\"screen-reader-text\" />\n\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t</>\n\t\t\t\t\t) : (\n\t\t\t\t\t\texcerpt\n\t\t\t\t\t);\n\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<li key={ post.id }>\n\t\t\t\t\t\t\t{ renderFeaturedImage && (\n\t\t\t\t\t\t\t\t<div className={ imageClasses }>\n\t\t\t\t\t\t\t\t\t{ addLinkToFeaturedImage ? (\n\t\t\t\t\t\t\t\t\t\t<a\n\t\t\t\t\t\t\t\t\t\t\thref={ post.link }\n\t\t\t\t\t\t\t\t\t\t\trel=\"noreferrer noopener\"\n\t\t\t\t\t\t\t\t\t\t\tonClick={\n\t\t\t\t\t\t\t\t\t\t\t\tshowRedirectionPreventedNotice\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t{ featuredImage }\n\t\t\t\t\t\t\t\t\t\t</a>\n\t\t\t\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\t\t\t\tfeaturedImage\n\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t<a\n\t\t\t\t\t\t\t\tclassName=\"wp-block-latest-posts__post-title\"\n\t\t\t\t\t\t\t\thref={ post.link }\n\t\t\t\t\t\t\t\trel=\"noreferrer noopener\"\n\t\t\t\t\t\t\t\tdangerouslySetInnerHTML={\n\t\t\t\t\t\t\t\t\t!! titleTrimmed\n\t\t\t\t\t\t\t\t\t\t? {\n\t\t\t\t\t\t\t\t\t\t\t\t__html: titleTrimmed,\n\t\t\t\t\t\t\t\t\t\t }\n\t\t\t\t\t\t\t\t\t\t: undefined\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tonClick={ showRedirectionPreventedNotice }\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{ ! titleTrimmed ? __( '(no title)' ) : null }\n\t\t\t\t\t\t\t</a>\n\t\t\t\t\t\t\t{ displayAuthor && currentAuthor && (\n\t\t\t\t\t\t\t\t<div className=\"wp-block-latest-posts__post-author\">\n\t\t\t\t\t\t\t\t\t{ sprintf(\n\t\t\t\t\t\t\t\t\t\t/* translators: byline. %s: author. */\n\t\t\t\t\t\t\t\t\t\t__( 'by %s' ),\n\t\t\t\t\t\t\t\t\t\tcurrentAuthor.name\n\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t{ displayPostDate && post.date_gmt && (\n\t\t\t\t\t\t\t\t<time\n\t\t\t\t\t\t\t\t\tdateTime={ format( 'c', post.date_gmt ) }\n\t\t\t\t\t\t\t\t\tclassName=\"wp-block-latest-posts__post-date\"\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t{ dateI18n( dateFormat, post.date_gmt ) }\n\t\t\t\t\t\t\t\t</time>\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t{ displayPostContent &&\n\t\t\t\t\t\t\t\tdisplayPostContentRadio === 'excerpt' && (\n\t\t\t\t\t\t\t\t\t<div className=\"wp-block-latest-posts__post-excerpt\">\n\t\t\t\t\t\t\t\t\t\t{ postExcerpt }\n\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t{ displayPostContent &&\n\t\t\t\t\t\t\t\tdisplayPostContentRadio === 'full_post' && (\n\t\t\t\t\t\t\t\t\t<div\n\t\t\t\t\t\t\t\t\t\tclassName=\"wp-block-latest-posts__post-full-content\"\n\t\t\t\t\t\t\t\t\t\tdangerouslySetInnerHTML={ {\n\t\t\t\t\t\t\t\t\t\t\t__html: post.content.raw.trim(),\n\t\t\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t</li>\n\t\t\t\t\t);\n\t\t\t\t} ) }\n\t\t\t</ul>\n\t\t</>\n\t);\n}\n"],"mappings":";AAAA;AACA;AACA;AACA,OAAOA,IAAI,MAAM,MAAM;;AAEvB;AACA;AACA;AACA,SACCC,SAAS,EACTC,WAAW,EACXC,aAAa,EACbC,YAAY,EACZC,YAAY,EACZC,OAAO,EACPC,aAAa,EACbC,YAAY,EACZC,gCAAgC,IAAIC,kBAAkB,EACtDC,0CAA0C,IAAIC,4BAA4B,EAC1EC,wBAAwB,IAAIC,UAAU,EACtCC,4BAA4B,IAAIC,cAAc,QACxC,uBAAuB;AAC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,CACL,EACC9C,eAAe,IAAIzB,IAAI,CAACsK,QAAQ,iBACjCjL,IAAA;YACCkL,QAAQ,EAAG9M,MAAM,CAAE,GAAG,EAAEuC,IAAI,CAACsK,QAAS,CAAG;YACzCzD,SAAS,EAAC,kCAAkC;YAAArB,QAAA,EAE1ChI,QAAQ,CAAEyK,UAAU,EAAEjI,IAAI,CAACsK,QAAS;UAAC,CAClC,CACN,EACC9I,kBAAkB,IACnBD,uBAAuB,KAAK,SAAS,iBACpClC,IAAA;YAAKwH,SAAS,EAAC,qCAAqC;YAAArB,QAAA,EACjDqE;UAAW,CACT,CACL,EACArI,kBAAkB,IACnBD,uBAAuB,KAAK,WAAW,iBACtClC,IAAA;YACCwH,SAAS,EAAC,0CAA0C;YACpDuD,uBAAuB,EAAG;cACzBC,MAAM,EAAErK,IAAI,CAACwK,OAAO,CAACZ,GAAG,CAACrB,IAAI,CAAC;YAC/B;UAAG,CACH,CACD;QAAA,GAhEOvI,IAAI,CAACmD,EAiEX,CAAC;MAEP,CAAE;IAAC,CACA,CAAC;EAAA,CACJ,CAAC;AAEL","ignoreList":[]}
|
|
@@ -40,7 +40,7 @@ function useConvertClassicToBlockMenu(createNavigationMenu, {
|
|
|
40
40
|
});
|
|
41
41
|
} catch (err) {
|
|
42
42
|
throw new Error(sprintf(
|
|
43
|
-
// translators: %s:
|
|
43
|
+
// translators: %s: The name of a menu (e.g. Header menu).
|
|
44
44
|
__(`Unable to fetch classic menu "%s" from API.`), menuName), {
|
|
45
45
|
cause: err
|
|
46
46
|
});
|
|
@@ -49,7 +49,7 @@ function useConvertClassicToBlockMenu(createNavigationMenu, {
|
|
|
49
49
|
// Handle offline response which resolves to `null`.
|
|
50
50
|
if (classicMenuItems === null) {
|
|
51
51
|
throw new Error(sprintf(
|
|
52
|
-
// translators: %s:
|
|
52
|
+
// translators: %s: The name of a menu (e.g. Header menu).
|
|
53
53
|
__(`Unable to fetch classic menu "%s" from API.`), menuName));
|
|
54
54
|
}
|
|
55
55
|
|
|
@@ -76,7 +76,7 @@ function useConvertClassicToBlockMenu(createNavigationMenu, {
|
|
|
76
76
|
});
|
|
77
77
|
} catch (err) {
|
|
78
78
|
throw new Error(sprintf(
|
|
79
|
-
// translators: %s:
|
|
79
|
+
// translators: %s: The name of a menu (e.g. Header menu).
|
|
80
80
|
__(`Unable to create Navigation Menu "%s".`), menuName), {
|
|
81
81
|
cause: err
|
|
82
82
|
});
|
|
@@ -114,7 +114,7 @@ function useConvertClassicToBlockMenu(createNavigationMenu, {
|
|
|
114
114
|
// Rethrow error for debugging.
|
|
115
115
|
if (throwOnError) {
|
|
116
116
|
throw new Error(sprintf(
|
|
117
|
-
// translators: %s:
|
|
117
|
+
// translators: %s: The name of a menu (e.g. Header menu).
|
|
118
118
|
__(`Unable to create Navigation Menu "%s".`), menuName), {
|
|
119
119
|
cause: err
|
|
120
120
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["useRegistry","useDispatch","store","coreStore","useState","useCallback","__","sprintf","menuItemsToBlocks","CLASSIC_MENU_CONVERSION_SUCCESS","CLASSIC_MENU_CONVERSION_ERROR","CLASSIC_MENU_CONVERSION_PENDING","CLASSIC_MENU_CONVERSION_IDLE","classicMenuBeingConvertedId","useConvertClassicToBlockMenu","createNavigationMenu","throwOnError","registry","editEntityRecord","status","setStatus","error","setError","convertClassicMenuToBlockMenu","menuId","menuName","postStatus","navigationMenu","classicMenuItems","resolveSelect","getMenuItems","menus","per_page","context","err","Error","cause","innerBlocks","id","convert","then","catch","message"],"sources":["@wordpress/block-library/src/navigation/edit/use-convert-classic-menu-to-block-menu.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useRegistry, useDispatch } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { useState, useCallback } from '@wordpress/element';\nimport { __, sprintf } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport menuItemsToBlocks from '../menu-items-to-blocks';\n\nexport const CLASSIC_MENU_CONVERSION_SUCCESS = 'success';\nexport const CLASSIC_MENU_CONVERSION_ERROR = 'error';\nexport const CLASSIC_MENU_CONVERSION_PENDING = 'pending';\nexport const CLASSIC_MENU_CONVERSION_IDLE = 'idle';\n\n// This is needed to ensure that multiple components using this hook\n// do not import the same classic menu twice.\nlet classicMenuBeingConvertedId = null;\n\nfunction useConvertClassicToBlockMenu(\n\tcreateNavigationMenu,\n\t{ throwOnError = false } = {}\n) {\n\tconst registry = useRegistry();\n\tconst { editEntityRecord } = useDispatch( coreStore );\n\n\tconst [ status, setStatus ] = useState( CLASSIC_MENU_CONVERSION_IDLE );\n\tconst [ error, setError ] = useState( null );\n\n\tconst convertClassicMenuToBlockMenu = useCallback(\n\t\tasync ( menuId, menuName, postStatus = 'publish' ) => {\n\t\t\tlet navigationMenu;\n\t\t\tlet classicMenuItems;\n\n\t\t\t// 1. Fetch the classic Menu items.\n\t\t\ttry {\n\t\t\t\tclassicMenuItems = await registry\n\t\t\t\t\t.resolveSelect( coreStore )\n\t\t\t\t\t.getMenuItems( {\n\t\t\t\t\t\tmenus: menuId,\n\t\t\t\t\t\tper_page: -1,\n\t\t\t\t\t\tcontext: 'view',\n\t\t\t\t\t} );\n\t\t\t} catch ( err ) {\n\t\t\t\tthrow new Error(\n\t\t\t\t\tsprintf(\n\t\t\t\t\t\t// translators: %s:
|
|
1
|
+
{"version":3,"names":["useRegistry","useDispatch","store","coreStore","useState","useCallback","__","sprintf","menuItemsToBlocks","CLASSIC_MENU_CONVERSION_SUCCESS","CLASSIC_MENU_CONVERSION_ERROR","CLASSIC_MENU_CONVERSION_PENDING","CLASSIC_MENU_CONVERSION_IDLE","classicMenuBeingConvertedId","useConvertClassicToBlockMenu","createNavigationMenu","throwOnError","registry","editEntityRecord","status","setStatus","error","setError","convertClassicMenuToBlockMenu","menuId","menuName","postStatus","navigationMenu","classicMenuItems","resolveSelect","getMenuItems","menus","per_page","context","err","Error","cause","innerBlocks","id","convert","then","catch","message"],"sources":["@wordpress/block-library/src/navigation/edit/use-convert-classic-menu-to-block-menu.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useRegistry, useDispatch } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { useState, useCallback } from '@wordpress/element';\nimport { __, sprintf } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport menuItemsToBlocks from '../menu-items-to-blocks';\n\nexport const CLASSIC_MENU_CONVERSION_SUCCESS = 'success';\nexport const CLASSIC_MENU_CONVERSION_ERROR = 'error';\nexport const CLASSIC_MENU_CONVERSION_PENDING = 'pending';\nexport const CLASSIC_MENU_CONVERSION_IDLE = 'idle';\n\n// This is needed to ensure that multiple components using this hook\n// do not import the same classic menu twice.\nlet classicMenuBeingConvertedId = null;\n\nfunction useConvertClassicToBlockMenu(\n\tcreateNavigationMenu,\n\t{ throwOnError = false } = {}\n) {\n\tconst registry = useRegistry();\n\tconst { editEntityRecord } = useDispatch( coreStore );\n\n\tconst [ status, setStatus ] = useState( CLASSIC_MENU_CONVERSION_IDLE );\n\tconst [ error, setError ] = useState( null );\n\n\tconst convertClassicMenuToBlockMenu = useCallback(\n\t\tasync ( menuId, menuName, postStatus = 'publish' ) => {\n\t\t\tlet navigationMenu;\n\t\t\tlet classicMenuItems;\n\n\t\t\t// 1. Fetch the classic Menu items.\n\t\t\ttry {\n\t\t\t\tclassicMenuItems = await registry\n\t\t\t\t\t.resolveSelect( coreStore )\n\t\t\t\t\t.getMenuItems( {\n\t\t\t\t\t\tmenus: menuId,\n\t\t\t\t\t\tper_page: -1,\n\t\t\t\t\t\tcontext: 'view',\n\t\t\t\t\t} );\n\t\t\t} catch ( err ) {\n\t\t\t\tthrow new Error(\n\t\t\t\t\tsprintf(\n\t\t\t\t\t\t// translators: %s: The name of a menu (e.g. Header menu).\n\t\t\t\t\t\t__( `Unable to fetch classic menu \"%s\" from API.` ),\n\t\t\t\t\t\tmenuName\n\t\t\t\t\t),\n\t\t\t\t\t{\n\t\t\t\t\t\tcause: err,\n\t\t\t\t\t}\n\t\t\t\t);\n\t\t\t}\n\n\t\t\t// Handle offline response which resolves to `null`.\n\t\t\tif ( classicMenuItems === null ) {\n\t\t\t\tthrow new Error(\n\t\t\t\t\tsprintf(\n\t\t\t\t\t\t// translators: %s: The name of a menu (e.g. Header menu).\n\t\t\t\t\t\t__( `Unable to fetch classic menu \"%s\" from API.` ),\n\t\t\t\t\t\tmenuName\n\t\t\t\t\t)\n\t\t\t\t);\n\t\t\t}\n\n\t\t\t// 2. Convert the classic items into blocks.\n\t\t\tconst { innerBlocks } = menuItemsToBlocks( classicMenuItems );\n\n\t\t\t// 3. Create the `wp_navigation` Post with the blocks.\n\t\t\ttry {\n\t\t\t\tnavigationMenu = await createNavigationMenu(\n\t\t\t\t\tmenuName,\n\t\t\t\t\tinnerBlocks,\n\t\t\t\t\tpostStatus\n\t\t\t\t);\n\n\t\t\t\t/**\n\t\t\t\t * Immediately trigger editEntityRecord to change the wp_navigation post status to 'publish'.\n\t\t\t\t * This status change causes the menu to be displayed on the front of the site and sets the post state to be \"dirty\".\n\t\t\t\t * The problem being solved is if saveEditedEntityRecord was used here, the menu would be updated on the frontend and the editor _automatically_,\n\t\t\t\t * without user interaction.\n\t\t\t\t * If the user abandons the site editor without saving, there would still be a wp_navigation post created as draft.\n\t\t\t\t */\n\t\t\t\tawait editEntityRecord(\n\t\t\t\t\t'postType',\n\t\t\t\t\t'wp_navigation',\n\t\t\t\t\tnavigationMenu.id,\n\t\t\t\t\t{\n\t\t\t\t\t\tstatus: 'publish',\n\t\t\t\t\t},\n\t\t\t\t\t{ throwOnError: true }\n\t\t\t\t);\n\t\t\t} catch ( err ) {\n\t\t\t\tthrow new Error(\n\t\t\t\t\tsprintf(\n\t\t\t\t\t\t// translators: %s: The name of a menu (e.g. Header menu).\n\t\t\t\t\t\t__( `Unable to create Navigation Menu \"%s\".` ),\n\t\t\t\t\t\tmenuName\n\t\t\t\t\t),\n\t\t\t\t\t{\n\t\t\t\t\t\tcause: err,\n\t\t\t\t\t}\n\t\t\t\t);\n\t\t\t}\n\n\t\t\treturn navigationMenu;\n\t\t},\n\t\t[ createNavigationMenu, editEntityRecord, registry ]\n\t);\n\n\tconst convert = useCallback(\n\t\tasync ( menuId, menuName, postStatus ) => {\n\t\t\t// Check whether this classic menu is being imported already.\n\t\t\tif ( classicMenuBeingConvertedId === menuId ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// Set the ID for the currently importing classic menu.\n\t\t\tclassicMenuBeingConvertedId = menuId;\n\n\t\t\tif ( ! menuId || ! menuName ) {\n\t\t\t\tsetError( 'Unable to convert menu. Missing menu details.' );\n\t\t\t\tsetStatus( CLASSIC_MENU_CONVERSION_ERROR );\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tsetStatus( CLASSIC_MENU_CONVERSION_PENDING );\n\t\t\tsetError( null );\n\n\t\t\treturn await convertClassicMenuToBlockMenu(\n\t\t\t\tmenuId,\n\t\t\t\tmenuName,\n\t\t\t\tpostStatus\n\t\t\t)\n\t\t\t\t.then( ( navigationMenu ) => {\n\t\t\t\t\tsetStatus( CLASSIC_MENU_CONVERSION_SUCCESS );\n\t\t\t\t\t// Reset the ID for the currently importing classic menu.\n\t\t\t\t\tclassicMenuBeingConvertedId = null;\n\t\t\t\t\treturn navigationMenu;\n\t\t\t\t} )\n\t\t\t\t.catch( ( err ) => {\n\t\t\t\t\tsetError( err?.message );\n\t\t\t\t\t// Reset the ID for the currently importing classic menu.\n\t\t\t\t\tsetStatus( CLASSIC_MENU_CONVERSION_ERROR );\n\n\t\t\t\t\t// Reset the ID for the currently importing classic menu.\n\t\t\t\t\tclassicMenuBeingConvertedId = null;\n\n\t\t\t\t\t// Rethrow error for debugging.\n\t\t\t\t\tif ( throwOnError ) {\n\t\t\t\t\t\tthrow new Error(\n\t\t\t\t\t\t\tsprintf(\n\t\t\t\t\t\t\t\t// translators: %s: The name of a menu (e.g. Header menu).\n\t\t\t\t\t\t\t\t__( `Unable to create Navigation Menu \"%s\".` ),\n\t\t\t\t\t\t\t\tmenuName\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tcause: err,\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t} );\n\t\t},\n\t\t[ convertClassicMenuToBlockMenu, throwOnError ]\n\t);\n\n\treturn {\n\t\tconvert,\n\t\tstatus,\n\t\terror,\n\t};\n}\n\nexport default useConvertClassicToBlockMenu;\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,WAAW,EAAEC,WAAW,QAAQ,iBAAiB;AAC1D,SAASC,KAAK,IAAIC,SAAS,QAAQ,sBAAsB;AACzD,SAASC,QAAQ,EAAEC,WAAW,QAAQ,oBAAoB;AAC1D,SAASC,EAAE,EAAEC,OAAO,QAAQ,iBAAiB;;AAE7C;AACA;AACA;AACA,OAAOC,iBAAiB,MAAM,yBAAyB;AAEvD,OAAO,MAAMC,+BAA+B,GAAG,SAAS;AACxD,OAAO,MAAMC,6BAA6B,GAAG,OAAO;AACpD,OAAO,MAAMC,+BAA+B,GAAG,SAAS;AACxD,OAAO,MAAMC,4BAA4B,GAAG,MAAM;;AAElD;AACA;AACA,IAAIC,2BAA2B,GAAG,IAAI;AAEtC,SAASC,4BAA4BA,CACpCC,oBAAoB,EACpB;EAAEC,YAAY,GAAG;AAAM,CAAC,GAAG,CAAC,CAAC,EAC5B;EACD,MAAMC,QAAQ,GAAGjB,WAAW,CAAC,CAAC;EAC9B,MAAM;IAAEkB;EAAiB,CAAC,GAAGjB,WAAW,CAAEE,SAAU,CAAC;EAErD,MAAM,CAAEgB,MAAM,EAAEC,SAAS,CAAE,GAAGhB,QAAQ,CAAEQ,4BAA6B,CAAC;EACtE,MAAM,CAAES,KAAK,EAAEC,QAAQ,CAAE,GAAGlB,QAAQ,CAAE,IAAK,CAAC;EAE5C,MAAMmB,6BAA6B,GAAGlB,WAAW,CAChD,OAAQmB,MAAM,EAAEC,QAAQ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ED,MAAMsB,OAAO,GAAGlC,WAAW,CAC1B,OAAQmB,MAAM,EAAEC,QAAQ,EAAEC,UAAU,KAAM;IACzC;IACA,IAAKb,2BAA2B,KAAKW,MAAM,EAAG;MAC7C;IACD;;IAEA;IACAX,2BAA2B,GAAGW,MAAM;IAEpC,IAAK,CAAEA,MAAM,IAAI,CAAEC,QAAQ,EAAG;MAC7BH,QAAQ,CAAE,+CAAgD,CAAC;MAC3DF,SAAS,CAAEV,6BAA8B,CAAC;MAC1C;IACD;IAEAU,SAAS,CAAET,+BAAgC,CAAC;IAC5CW,QAAQ,CAAE,IAAK,CAAC;IAEhB,OAAO,MAAMC,6BAA6B,CACzCC,MAAM,EACNC,QAAQ,EACRC,UACD,CAAC,CACCc,IAAI,CAAIb,cAAc,IAAM;MAC5BP,SAAS,CAAEX,+BAAgC,CAAC;MAC5C;MACAI,2BAA2B,GAAG,IAAI;MAClC,OAAOc,cAAc;IACtB,CAAE,CAAC,CACFc,KAAK,CAAIP,GAAG,IAAM;MAClBZ,QAAQ,CAAEY,GAAG,EAAEQ,OAAQ,CAAC;MACxB;MACAtB,SAAS,CAAEV,6BAA8B,CAAC;;MAE1C;MACAG,2BAA2B,GAAG,IAAI;;MAElC;MACA,IAAKG,YAAY,EAAG;QACnB,MAAM,IAAImB,KAAK,CACd5B,OAAO;QACN;QACAD,EAAE,CAAE,wCAAyC,CAAC,EAC9CmB,QACD,CAAC,EACD;UACCW,KAAK,EAAEF;QACR,CACD,CAAC;MACF;IACD,CAAE,CAAC;EACL,CAAC,EACD,CAAEX,6BAA6B,EAAEP,YAAY,CAC9C,CAAC;EAED,OAAO;IACNuB,OAAO;IACPpB,MAAM;IACNE;EACD,CAAC;AACF;AAEA,eAAeP,4BAA4B","ignoreList":[]}
|
|
@@ -41,10 +41,10 @@ export default function useGenerateDefaultNavigationTitle(clientId) {
|
|
|
41
41
|
} = registry.resolveSelect(coreStore);
|
|
42
42
|
const [draftNavigationMenus, navigationMenus] = await Promise.all([getEntityRecords(...DRAFT_MENU_PARAMS), getEntityRecords(...PUBLISHED_MENU_PARAMS)]);
|
|
43
43
|
const title = area ? sprintf(
|
|
44
|
-
// translators: %s: the name of a menu (e.g. Header
|
|
45
|
-
__('%s
|
|
46
|
-
// translators: '
|
|
47
|
-
__('
|
|
44
|
+
// translators: %s: the name of a menu (e.g. Header menu).
|
|
45
|
+
__('%s menu'), area) :
|
|
46
|
+
// translators: 'menu' as in website navigation menu.
|
|
47
|
+
__('Menu');
|
|
48
48
|
|
|
49
49
|
// Determine how many menus start with the automatic title.
|
|
50
50
|
const matchingMenuTitleCount = [...draftNavigationMenus, ...navigationMenus].reduce((count, menu) => menu?.title?.raw?.startsWith(title) ? count + 1 : count, 0);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["Disabled","store","coreStore","useRegistry","useContext","useCallback","__","sprintf","useTemplatePartAreaLabel","DRAFT_MENU_PARAMS","status","per_page","PUBLISHED_MENU_PARAMS","useGenerateDefaultNavigationTitle","clientId","isDisabled","Context","area","undefined","registry","getEntityRecords","resolveSelect","draftNavigationMenus","navigationMenus","Promise","all","title","matchingMenuTitleCount","reduce","count","menu","raw","startsWith","titleWithCount"],"sources":["@wordpress/block-library/src/navigation/edit/use-generate-default-navigation-title.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { Disabled } from '@wordpress/components';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { useRegistry } from '@wordpress/data';\nimport { useContext, useCallback } from '@wordpress/element';\nimport { __, sprintf } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport useTemplatePartAreaLabel from '../use-template-part-area-label';\n\nconst DRAFT_MENU_PARAMS = [\n\t'postType',\n\t'wp_navigation',\n\t{ status: 'draft', per_page: -1 },\n];\n\nconst PUBLISHED_MENU_PARAMS = [\n\t'postType',\n\t'wp_navigation',\n\t{ per_page: -1, status: 'publish' },\n];\n\nexport default function useGenerateDefaultNavigationTitle( clientId ) {\n\t// The block will be disabled in a block preview, use this as a way of\n\t// avoiding the side-effects of this component for block previews.\n\tconst isDisabled = useContext( Disabled.Context );\n\n\t// Because we can't conditionally call hooks, pass an undefined client id\n\t// arg to bypass the expensive `useTemplateArea` code. The hook will return\n\t// early.\n\tconst area = useTemplatePartAreaLabel( isDisabled ? undefined : clientId );\n\n\tconst registry = useRegistry();\n\treturn useCallback( async () => {\n\t\t// Ensure other navigation menus have loaded so an\n\t\t// accurate name can be created.\n\t\tif ( isDisabled ) {\n\t\t\treturn '';\n\t\t}\n\t\tconst { getEntityRecords } = registry.resolveSelect( coreStore );\n\n\t\tconst [ draftNavigationMenus, navigationMenus ] = await Promise.all( [\n\t\t\tgetEntityRecords( ...DRAFT_MENU_PARAMS ),\n\t\t\tgetEntityRecords( ...PUBLISHED_MENU_PARAMS ),\n\t\t] );\n\n\t\tconst title = area\n\t\t\t? sprintf(\n\t\t\t\t\t// translators: %s: the name of a menu (e.g. Header
|
|
1
|
+
{"version":3,"names":["Disabled","store","coreStore","useRegistry","useContext","useCallback","__","sprintf","useTemplatePartAreaLabel","DRAFT_MENU_PARAMS","status","per_page","PUBLISHED_MENU_PARAMS","useGenerateDefaultNavigationTitle","clientId","isDisabled","Context","area","undefined","registry","getEntityRecords","resolveSelect","draftNavigationMenus","navigationMenus","Promise","all","title","matchingMenuTitleCount","reduce","count","menu","raw","startsWith","titleWithCount"],"sources":["@wordpress/block-library/src/navigation/edit/use-generate-default-navigation-title.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { Disabled } from '@wordpress/components';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { useRegistry } from '@wordpress/data';\nimport { useContext, useCallback } from '@wordpress/element';\nimport { __, sprintf } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport useTemplatePartAreaLabel from '../use-template-part-area-label';\n\nconst DRAFT_MENU_PARAMS = [\n\t'postType',\n\t'wp_navigation',\n\t{ status: 'draft', per_page: -1 },\n];\n\nconst PUBLISHED_MENU_PARAMS = [\n\t'postType',\n\t'wp_navigation',\n\t{ per_page: -1, status: 'publish' },\n];\n\nexport default function useGenerateDefaultNavigationTitle( clientId ) {\n\t// The block will be disabled in a block preview, use this as a way of\n\t// avoiding the side-effects of this component for block previews.\n\tconst isDisabled = useContext( Disabled.Context );\n\n\t// Because we can't conditionally call hooks, pass an undefined client id\n\t// arg to bypass the expensive `useTemplateArea` code. The hook will return\n\t// early.\n\tconst area = useTemplatePartAreaLabel( isDisabled ? undefined : clientId );\n\n\tconst registry = useRegistry();\n\treturn useCallback( async () => {\n\t\t// Ensure other navigation menus have loaded so an\n\t\t// accurate name can be created.\n\t\tif ( isDisabled ) {\n\t\t\treturn '';\n\t\t}\n\t\tconst { getEntityRecords } = registry.resolveSelect( coreStore );\n\n\t\tconst [ draftNavigationMenus, navigationMenus ] = await Promise.all( [\n\t\t\tgetEntityRecords( ...DRAFT_MENU_PARAMS ),\n\t\t\tgetEntityRecords( ...PUBLISHED_MENU_PARAMS ),\n\t\t] );\n\n\t\tconst title = area\n\t\t\t? sprintf(\n\t\t\t\t\t// translators: %s: the name of a menu (e.g. Header menu).\n\t\t\t\t\t__( '%s menu' ),\n\t\t\t\t\tarea\n\t\t\t )\n\t\t\t: // translators: 'menu' as in website navigation menu.\n\t\t\t __( 'Menu' );\n\n\t\t// Determine how many menus start with the automatic title.\n\t\tconst matchingMenuTitleCount = [\n\t\t\t...draftNavigationMenus,\n\t\t\t...navigationMenus,\n\t\t].reduce(\n\t\t\t( count, menu ) =>\n\t\t\t\tmenu?.title?.raw?.startsWith( title ) ? count + 1 : count,\n\t\t\t0\n\t\t);\n\n\t\t// Append a number to the end of the title if a menu with\n\t\t// the same name exists.\n\t\tconst titleWithCount =\n\t\t\tmatchingMenuTitleCount > 0\n\t\t\t\t? `${ title } ${ matchingMenuTitleCount + 1 }`\n\t\t\t\t: title;\n\n\t\treturn titleWithCount || '';\n\t}, [ isDisabled, area, registry ] );\n}\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,QAA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,EAAE,CAAE,MAAO,CAAC;;IAEf;IACA,MAAMqB,sBAAsB,GAAG,CAC9B,GAAGL,oBAAoB,EACvB,GAAGC,eAAe,CAClB,CAACK,MAAM,CACP,CAAEC,KAAK,EAAEC,IAAI,KACZA,IAAI,EAAEJ,KAAK,EAAEK,GAAG,EAAEC,UAAU,CAAEN,KAAM,CAAC,GAAGG,KAAK,GAAG,CAAC,GAAGA,KAAK,EAC1D,CACD,CAAC;;IAED;IACA;IACA,MAAMI,cAAc,GACnBN,sBAAsB,GAAG,CAAC,GACvB,GAAID,KAAK,IAAMC,sBAAsB,GAAG,CAAC,EAAG,GAC5CD,KAAK;IAET,OAAOO,cAAc,IAAI,EAAE;EAC5B,CAAC,EAAE,CAAElB,UAAU,EAAEE,IAAI,EAAEE,QAAQ,CAAG,CAAC;AACpC","ignoreList":[]}
|
|
@@ -8,7 +8,7 @@ import clsx from 'clsx';
|
|
|
8
8
|
*/
|
|
9
9
|
import { createBlock } from '@wordpress/blocks';
|
|
10
10
|
import { useSelect, useDispatch } from '@wordpress/data';
|
|
11
|
-
import { __experimentalToolsPanel as ToolsPanel, __experimentalToolsPanelItem as ToolsPanelItem, TextControl, TextareaControl, ToolbarButton,
|
|
11
|
+
import { __experimentalToolsPanel as ToolsPanel, __experimentalToolsPanelItem as ToolsPanelItem, TextControl, TextareaControl, ToolbarButton, ToolbarGroup } from '@wordpress/components';
|
|
12
12
|
import { displayShortcut, isKeyboardEvent } from '@wordpress/keycodes';
|
|
13
13
|
import { __ } from '@wordpress/i18n';
|
|
14
14
|
import { BlockControls, InspectorControls, RichText, useBlockProps, store as blockEditorStore, getColorClassName, useInnerBlocksProps } from '@wordpress/block-editor';
|
|
@@ -445,7 +445,6 @@ export default function NavigationLinkEdit({
|
|
|
445
445
|
const missingText = getMissingText(type);
|
|
446
446
|
/* translators: Whether the navigation link is Invalid or a Draft. */
|
|
447
447
|
const placeholderText = `(${isInvalid ? __('Invalid') : __('Draft')})`;
|
|
448
|
-
const tooltipText = isInvalid || isDraft ? __('This item has been deleted, or is a draft') : __('This item is missing a link');
|
|
449
448
|
return /*#__PURE__*/_jsxs(_Fragment, {
|
|
450
449
|
children: [/*#__PURE__*/_jsx(BlockControls, {
|
|
451
450
|
children: /*#__PURE__*/_jsxs(ToolbarGroup, {
|
|
@@ -477,11 +476,8 @@ export default function NavigationLinkEdit({
|
|
|
477
476
|
className: classes,
|
|
478
477
|
children: [!url ? /*#__PURE__*/_jsx("div", {
|
|
479
478
|
className: "wp-block-navigation-link__placeholder-text",
|
|
480
|
-
children: /*#__PURE__*/_jsx(
|
|
481
|
-
|
|
482
|
-
children: /*#__PURE__*/_jsx("span", {
|
|
483
|
-
children: missingText
|
|
484
|
-
})
|
|
479
|
+
children: /*#__PURE__*/_jsx("span", {
|
|
480
|
+
children: missingText
|
|
485
481
|
})
|
|
486
482
|
}) : /*#__PURE__*/_jsxs(_Fragment, {
|
|
487
483
|
children: [!isInvalid && !isDraft && !isLabelFieldFocused && /*#__PURE__*/_jsxs(_Fragment, {
|
|
@@ -504,19 +500,18 @@ export default function NavigationLinkEdit({
|
|
|
504
500
|
children: description
|
|
505
501
|
})]
|
|
506
502
|
}), (isInvalid || isDraft || isLabelFieldFocused) && /*#__PURE__*/_jsx("div", {
|
|
507
|
-
className:
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
})
|
|
503
|
+
className: clsx('wp-block-navigation-link__placeholder-text', 'wp-block-navigation-link__label', {
|
|
504
|
+
'is-invalid': isInvalid,
|
|
505
|
+
'is-draft': isDraft
|
|
506
|
+
}),
|
|
507
|
+
children: /*#__PURE__*/_jsx("span", {
|
|
508
|
+
children:
|
|
509
|
+
// Some attributes are stored in an escaped form. It's a legacy issue.
|
|
510
|
+
// Ideally they would be stored in a raw, unescaped form.
|
|
511
|
+
// Unescape is used here to "recover" the escaped characters
|
|
512
|
+
// so they display without encoding.
|
|
513
|
+
// See `updateAttributes` for more details.
|
|
514
|
+
`${decodeEntities(label)} ${isInvalid || isDraft ? placeholderText : ''}`.trim()
|
|
520
515
|
})
|
|
521
516
|
})]
|
|
522
517
|
}), isLinkOpen && /*#__PURE__*/_jsx(LinkUI, {
|