@wordpress/block-library 7.1.1 → 7.2.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 +11 -0
- package/build/avatar/edit.js +205 -0
- package/build/avatar/edit.js.map +1 -0
- package/build/avatar/hooks.js +111 -0
- package/build/avatar/hooks.js.map +1 -0
- package/build/avatar/index.js +83 -0
- package/build/avatar/index.js.map +1 -0
- package/build/avatar/user-control.js +63 -0
- package/build/avatar/user-control.js.map +1 -0
- package/build/column/index.js +2 -1
- package/build/column/index.js.map +1 -1
- package/build/comment-author-avatar/index.js +1 -0
- package/build/comment-author-avatar/index.js.map +1 -1
- package/build/comment-date/edit.js +10 -25
- package/build/comment-date/edit.js.map +1 -1
- package/build/comment-template/edit.js +79 -52
- package/build/comment-template/edit.js.map +1 -1
- package/build/cover/edit.js +23 -33
- package/build/cover/edit.js.map +1 -1
- package/build/embed/variations.js +2 -2
- package/build/embed/variations.js.map +1 -1
- package/build/gallery/edit.js +18 -5
- package/build/gallery/edit.js.map +1 -1
- package/build/gallery/gallery.js +1 -1
- package/build/gallery/gallery.js.map +1 -1
- package/build/gallery/gap-styles.js +29 -0
- package/build/gallery/gap-styles.js.map +1 -0
- package/build/gallery/index.js +17 -1
- package/build/gallery/index.js.map +1 -1
- package/build/group/index.js +3 -1
- package/build/group/index.js.map +1 -1
- package/build/group/variations.js +1 -2
- package/build/group/variations.js.map +1 -1
- package/build/image/image.js +3 -1
- package/build/image/image.js.map +1 -1
- package/build/index.js +8 -2
- package/build/index.js.map +1 -1
- package/build/list/index.js +5 -7
- package/build/list/index.js.map +1 -1
- package/build/list/v2/edit.js +85 -0
- package/build/list/v2/edit.js.map +1 -0
- package/build/list/v2/index.js +33 -0
- package/build/list/v2/index.js.map +1 -0
- package/build/list/v2/save.js +34 -0
- package/build/list/v2/save.js.map +1 -0
- package/build/list/v2/transforms.js +121 -0
- package/build/list/v2/transforms.js.map +1 -0
- package/build/list-item/edit.js +47 -0
- package/build/list-item/edit.js.map +1 -0
- package/build/list-item/index.js +67 -0
- package/build/list-item/index.js.map +1 -0
- package/build/list-item/save.js +23 -0
- package/build/list-item/save.js.map +1 -0
- package/build/media-text/edit.js +3 -1
- package/build/media-text/edit.js.map +1 -1
- package/build/navigation/use-navigation-entities.js +26 -54
- package/build/navigation/use-navigation-entities.js.map +1 -1
- package/build/navigation-link/edit.js +88 -34
- package/build/navigation-link/edit.js.map +1 -1
- package/build/post-date/edit.js +31 -37
- package/build/post-date/edit.js.map +1 -1
- package/build/post-featured-image/edit.js +2 -1
- package/build/post-featured-image/edit.js.map +1 -1
- package/build/pullquote/edit.js +5 -3
- package/build/pullquote/edit.js.map +1 -1
- package/build/query/variations.js +4 -4
- package/build/query/variations.js.map +1 -1
- package/build/query-no-results/edit.js +28 -0
- package/build/query-no-results/edit.js.map +1 -0
- package/build/query-no-results/index.js +54 -0
- package/build/query-no-results/index.js.map +1 -0
- package/build/query-no-results/save.js +18 -0
- package/build/query-no-results/save.js.map +1 -0
- package/build/search/edit.js +2 -3
- package/build/search/edit.js.map +1 -1
- package/build/separator/deprecated.js +83 -0
- package/build/separator/deprecated.js.map +1 -0
- package/build/separator/edit.js +31 -23
- package/build/separator/edit.js.map +1 -1
- package/build/separator/index.js +17 -7
- package/build/separator/index.js.map +1 -1
- package/build/separator/save.js +18 -13
- package/build/separator/save.js.map +1 -1
- package/build/separator/use-deprecated-opacity.js +39 -0
- package/build/separator/use-deprecated-opacity.js.map +1 -0
- package/build/social-links/edit.js +14 -3
- package/build/social-links/edit.js.map +1 -1
- package/build/social-links/index.js +1 -1
- package/build/spacer/controls.js +6 -16
- package/build/spacer/controls.js.map +1 -1
- package/build/spacer/controls.native.js +3 -1
- package/build/spacer/controls.native.js.map +1 -1
- package/build/spacer/edit.js +4 -5
- package/build/spacer/edit.js.map +1 -1
- package/build/table/deprecated.js +1 -1
- package/build/table/deprecated.js.map +1 -1
- package/build/tag-cloud/edit.js +58 -2
- package/build/tag-cloud/edit.js.map +1 -1
- package/build/tag-cloud/index.js +8 -0
- package/build/tag-cloud/index.js.map +1 -1
- package/build-module/avatar/edit.js +190 -0
- package/build-module/avatar/edit.js.map +1 -0
- package/build-module/avatar/hooks.js +99 -0
- package/build-module/avatar/hooks.js.map +1 -0
- package/build-module/avatar/index.js +70 -0
- package/build-module/avatar/index.js.map +1 -0
- package/build-module/avatar/user-control.js +52 -0
- package/build-module/avatar/user-control.js.map +1 -0
- package/build-module/column/index.js +2 -1
- package/build-module/column/index.js.map +1 -1
- package/build-module/comment-author-avatar/index.js +1 -0
- package/build-module/comment-author-avatar/index.js.map +1 -1
- package/build-module/comment-date/edit.js +13 -30
- package/build-module/comment-date/edit.js.map +1 -1
- package/build-module/comment-template/edit.js +79 -52
- package/build-module/comment-template/edit.js.map +1 -1
- package/build-module/cover/edit.js +23 -34
- package/build-module/cover/edit.js.map +1 -1
- package/build-module/embed/variations.js +2 -2
- package/build-module/embed/variations.js.map +1 -1
- package/build-module/gallery/edit.js +17 -5
- package/build-module/gallery/edit.js.map +1 -1
- package/build-module/gallery/gallery.js +1 -1
- package/build-module/gallery/gallery.js.map +1 -1
- package/build-module/gallery/gap-styles.js +22 -0
- package/build-module/gallery/gap-styles.js.map +1 -0
- package/build-module/gallery/index.js +17 -1
- package/build-module/gallery/index.js.map +1 -1
- package/build-module/group/index.js +3 -1
- package/build-module/group/index.js.map +1 -1
- package/build-module/group/variations.js +1 -2
- package/build-module/group/variations.js.map +1 -1
- package/build-module/image/image.js +3 -1
- package/build-module/image/image.js.map +1 -1
- package/build-module/index.js +5 -2
- package/build-module/index.js.map +1 -1
- package/build-module/list/index.js +5 -1
- package/build-module/list/index.js.map +1 -1
- package/build-module/list/v2/edit.js +69 -0
- package/build-module/list/v2/edit.js.map +1 -0
- package/build-module/list/v2/index.js +19 -0
- package/build-module/list/v2/index.js.map +1 -0
- package/build-module/list/v2/save.js +23 -0
- package/build-module/list/v2/save.js.map +1 -0
- package/build-module/list/v2/transforms.js +111 -0
- package/build-module/list/v2/transforms.js.map +1 -0
- package/build-module/list-item/edit.js +37 -0
- package/build-module/list-item/edit.js.map +1 -0
- package/build-module/list-item/index.js +53 -0
- package/build-module/list-item/index.js.map +1 -0
- package/build-module/list-item/save.js +15 -0
- package/build-module/list-item/save.js.map +1 -0
- package/build-module/media-text/edit.js +3 -1
- package/build-module/media-text/edit.js.map +1 -1
- package/build-module/navigation/use-navigation-entities.js +27 -54
- package/build-module/navigation/use-navigation-entities.js.map +1 -1
- package/build-module/navigation-link/edit.js +88 -33
- package/build-module/navigation-link/edit.js.map +1 -1
- package/build-module/post-date/edit.js +32 -43
- package/build-module/post-date/edit.js.map +1 -1
- package/build-module/post-featured-image/edit.js +2 -1
- package/build-module/post-featured-image/edit.js.map +1 -1
- package/build-module/pullquote/edit.js +6 -3
- package/build-module/pullquote/edit.js.map +1 -1
- package/build-module/query/variations.js +4 -4
- package/build-module/query/variations.js.map +1 -1
- package/build-module/query-no-results/edit.js +18 -0
- package/build-module/query-no-results/edit.js.map +1 -0
- package/build-module/query-no-results/index.js +40 -0
- package/build-module/query-no-results/index.js.map +1 -0
- package/build-module/query-no-results/save.js +10 -0
- package/build-module/query-no-results/save.js.map +1 -0
- package/build-module/search/edit.js +2 -3
- package/build-module/search/edit.js.map +1 -1
- package/build-module/separator/deprecated.js +70 -0
- package/build-module/separator/deprecated.js.map +1 -0
- package/build-module/separator/edit.js +31 -22
- package/build-module/separator/edit.js.map +1 -1
- package/build-module/separator/index.js +16 -7
- package/build-module/separator/index.js.map +1 -1
- package/build-module/separator/save.js +19 -14
- package/build-module/separator/save.js.map +1 -1
- package/build-module/separator/use-deprecated-opacity.js +30 -0
- package/build-module/separator/use-deprecated-opacity.js.map +1 -0
- package/build-module/social-links/edit.js +15 -4
- package/build-module/social-links/edit.js.map +1 -1
- package/build-module/social-links/index.js +1 -1
- package/build-module/spacer/controls.js +8 -19
- package/build-module/spacer/controls.js.map +1 -1
- package/build-module/spacer/controls.native.js +2 -1
- package/build-module/spacer/controls.native.js.map +1 -1
- package/build-module/spacer/edit.js +3 -3
- package/build-module/spacer/edit.js.map +1 -1
- package/build-module/table/deprecated.js +1 -1
- package/build-module/table/deprecated.js.map +1 -1
- package/build-module/tag-cloud/edit.js +60 -4
- package/build-module/tag-cloud/edit.js.map +1 -1
- package/build-module/tag-cloud/index.js +8 -0
- package/build-module/tag-cloud/index.js.map +1 -1
- package/build-style/avatar/editor-rtl.css +79 -0
- package/build-style/avatar/editor.css +79 -0
- package/build-style/editor-rtl.css +23 -2
- package/build-style/editor.css +23 -2
- package/build-style/gallery/editor-rtl.css +0 -1
- package/build-style/gallery/editor.css +0 -1
- package/build-style/gallery/style-rtl.css +102 -169
- package/build-style/gallery/style.css +102 -169
- package/build-style/image/style-rtl.css +2 -0
- package/build-style/image/style.css +2 -0
- package/build-style/navigation-link/editor-rtl.css +13 -0
- package/build-style/navigation-link/editor.css +13 -0
- package/build-style/pullquote/style-rtl.css +0 -4
- package/build-style/pullquote/style.css +0 -4
- package/build-style/separator/editor-rtl.css +3 -0
- package/build-style/separator/editor.css +3 -0
- package/build-style/separator/theme-rtl.css +7 -1
- package/build-style/separator/theme.css +7 -1
- package/build-style/site-logo/editor-rtl.css +3 -1
- package/build-style/site-logo/editor.css +3 -1
- package/build-style/style-rtl.css +104 -173
- package/build-style/style.css +104 -173
- package/build-style/theme-rtl.css +7 -1
- package/build-style/theme.css +7 -1
- package/package.json +28 -28
- package/src/avatar/block.json +53 -0
- package/src/avatar/edit.js +222 -0
- package/src/avatar/editor.scss +3 -0
- package/src/avatar/hooks.js +96 -0
- package/src/avatar/index.js +18 -0
- package/src/avatar/index.php +146 -0
- package/src/avatar/user-control.js +56 -0
- package/src/column/block.json +2 -1
- package/src/comment-author-avatar/block.json +1 -0
- package/src/comment-date/edit.js +20 -30
- package/src/comment-template/edit.js +65 -44
- package/src/cover/edit.js +26 -31
- package/src/editor.scss +1 -0
- package/src/embed/variations.js +2 -2
- package/src/gallery/block.json +17 -1
- package/src/gallery/deprecated.scss +2 -2
- package/src/gallery/edit.js +15 -8
- package/src/gallery/editor.scss +0 -1
- package/src/gallery/gallery.js +8 -7
- package/src/gallery/gap-styles.js +21 -0
- package/src/gallery/index.php +42 -1
- package/src/gallery/style.scss +11 -44
- package/src/group/block.json +3 -1
- package/src/group/variations.js +1 -1
- package/src/image/image.js +4 -1
- package/src/image/style.scss +3 -0
- package/src/index.js +6 -1
- package/src/list/index.js +6 -1
- package/src/list/v2/edit.js +77 -0
- package/src/list/v2/index.js +20 -0
- package/src/list/v2/save.js +18 -0
- package/src/list/v2/transforms.js +116 -0
- package/src/list-item/block.json +26 -0
- package/src/list-item/edit.js +47 -0
- package/src/list-item/index.js +27 -0
- package/src/list-item/save.js +13 -0
- package/src/media-text/edit.js +1 -1
- package/src/navigation/index.php +22 -2
- package/src/navigation/use-navigation-entities.js +37 -73
- package/src/navigation-link/edit.js +145 -61
- package/src/navigation-link/editor.scss +11 -0
- package/src/post-date/edit.js +63 -52
- package/src/post-date/index.php +1 -1
- package/src/post-date/test/edit.js +17 -0
- package/src/post-featured-image/edit.js +9 -1
- package/src/post-featured-image/index.php +2 -1
- package/src/pullquote/edit.js +4 -3
- package/src/pullquote/style.scss +0 -5
- package/src/query/variations.js +4 -0
- package/src/query-no-results/block.json +20 -0
- package/src/query-no-results/edit.js +28 -0
- package/src/query-no-results/index.js +20 -0
- package/src/query-no-results/index.php +59 -0
- package/src/query-no-results/save.js +8 -0
- package/src/search/edit.js +1 -2
- package/src/separator/block.json +13 -6
- package/src/separator/deprecated.js +57 -0
- package/src/separator/deprecated.scss +6 -0
- package/src/separator/edit.js +36 -14
- package/src/separator/editor.scss +6 -0
- package/src/separator/index.js +2 -0
- package/src/separator/save.js +22 -14
- package/src/separator/test/edit.js +113 -0
- package/src/separator/theme.scss +7 -1
- package/src/separator/use-deprecated-opacity.js +41 -0
- package/src/site-logo/editor.scss +3 -1
- package/src/social-links/block.json +1 -1
- package/src/social-links/edit.js +15 -5
- package/src/spacer/controls.js +12 -18
- package/src/spacer/controls.native.js +2 -1
- package/src/spacer/edit.js +3 -6
- package/src/table/deprecated.js +5 -1
- package/src/tag-cloud/block.json +8 -0
- package/src/tag-cloud/edit.js +82 -2
- package/src/tag-cloud/index.php +6 -0
- package/build/separator/separator-settings.js +0 -36
- package/build/separator/separator-settings.js.map +0 -1
- package/build-module/separator/separator-settings.js +0 -27
- package/build-module/separator/separator-settings.js.map +0 -1
- package/src/separator/separator-settings.js +0 -24
|
@@ -337,6 +337,68 @@ const updateNavigationLinkBlockAttributes = function () {
|
|
|
337
337
|
})
|
|
338
338
|
});
|
|
339
339
|
};
|
|
340
|
+
|
|
341
|
+
exports.updateNavigationLinkBlockAttributes = updateNavigationLinkBlockAttributes;
|
|
342
|
+
|
|
343
|
+
const useIsInvalidLink = (kind, type, id) => {
|
|
344
|
+
const isPostType = kind === 'post-type' || type === 'post' || type === 'page';
|
|
345
|
+
const hasId = Number.isInteger(id);
|
|
346
|
+
const postStatus = (0, _data.useSelect)(select => {
|
|
347
|
+
var _getEntityRecord;
|
|
348
|
+
|
|
349
|
+
if (!isPostType) {
|
|
350
|
+
return null;
|
|
351
|
+
}
|
|
352
|
+
|
|
353
|
+
const {
|
|
354
|
+
getEntityRecord
|
|
355
|
+
} = select(_coreData.store);
|
|
356
|
+
return (_getEntityRecord = getEntityRecord('postType', type, id)) === null || _getEntityRecord === void 0 ? void 0 : _getEntityRecord.status;
|
|
357
|
+
}, [isPostType, type, id]); // Check Navigation Link validity if:
|
|
358
|
+
// 1. Link is 'post-type'.
|
|
359
|
+
// 2. It has an id.
|
|
360
|
+
// 3. It's neither null, nor undefined, as valid items might be either of those while loading.
|
|
361
|
+
// If those conditions are met, check if
|
|
362
|
+
// 1. The post status is published.
|
|
363
|
+
// 2. The Navigation Link item has no label.
|
|
364
|
+
// If either of those is true, invalidate.
|
|
365
|
+
|
|
366
|
+
const isInvalid = isPostType && hasId && postStatus && 'trash' === postStatus;
|
|
367
|
+
const isDraft = 'draft' === postStatus;
|
|
368
|
+
return [isInvalid, isDraft];
|
|
369
|
+
};
|
|
370
|
+
|
|
371
|
+
const useMissingText = type => {
|
|
372
|
+
let missingText = '';
|
|
373
|
+
|
|
374
|
+
switch (type) {
|
|
375
|
+
case 'post':
|
|
376
|
+
/* translators: label for missing post in navigation link block */
|
|
377
|
+
missingText = (0, _i18n.__)('Select post');
|
|
378
|
+
break;
|
|
379
|
+
|
|
380
|
+
case 'page':
|
|
381
|
+
/* translators: label for missing page in navigation link block */
|
|
382
|
+
missingText = (0, _i18n.__)('Select page');
|
|
383
|
+
break;
|
|
384
|
+
|
|
385
|
+
case 'category':
|
|
386
|
+
/* translators: label for missing category in navigation link block */
|
|
387
|
+
missingText = (0, _i18n.__)('Select category');
|
|
388
|
+
break;
|
|
389
|
+
|
|
390
|
+
case 'tag':
|
|
391
|
+
/* translators: label for missing tag in navigation link block */
|
|
392
|
+
missingText = (0, _i18n.__)('Select tag');
|
|
393
|
+
break;
|
|
394
|
+
|
|
395
|
+
default:
|
|
396
|
+
/* translators: label for missing values in navigation link block */
|
|
397
|
+
missingText = (0, _i18n.__)('Add link');
|
|
398
|
+
}
|
|
399
|
+
|
|
400
|
+
return missingText;
|
|
401
|
+
};
|
|
340
402
|
/**
|
|
341
403
|
* Removes HTML from a given string.
|
|
342
404
|
* Note the does not provide XSS protection or otherwise attempt
|
|
@@ -349,8 +411,6 @@ const updateNavigationLinkBlockAttributes = function () {
|
|
|
349
411
|
*/
|
|
350
412
|
|
|
351
413
|
|
|
352
|
-
exports.updateNavigationLinkBlockAttributes = updateNavigationLinkBlockAttributes;
|
|
353
|
-
|
|
354
414
|
function navStripHTML(html) {
|
|
355
415
|
const doc = document.implementation.createHTMLDocument('');
|
|
356
416
|
doc.body.innerHTML = html;
|
|
@@ -401,6 +461,7 @@ function NavigationLinkEdit(_ref2) {
|
|
|
401
461
|
clientId
|
|
402
462
|
} = _ref2;
|
|
403
463
|
const {
|
|
464
|
+
id,
|
|
404
465
|
label,
|
|
405
466
|
type,
|
|
406
467
|
opensInNewTab,
|
|
@@ -410,6 +471,7 @@ function NavigationLinkEdit(_ref2) {
|
|
|
410
471
|
title,
|
|
411
472
|
kind
|
|
412
473
|
} = attributes;
|
|
474
|
+
const [isInvalid, isDraft] = useIsInvalidLink(kind, type, id);
|
|
413
475
|
const link = {
|
|
414
476
|
url,
|
|
415
477
|
opensInNewTab,
|
|
@@ -621,41 +683,18 @@ function NavigationLinkEdit(_ref2) {
|
|
|
621
683
|
onKeyDown
|
|
622
684
|
});
|
|
623
685
|
|
|
624
|
-
if (!url) {
|
|
686
|
+
if (!url || isInvalid || isDraft) {
|
|
625
687
|
blockProps.onClick = () => setIsLinkOpen(true);
|
|
626
688
|
}
|
|
627
689
|
|
|
628
690
|
const classes = (0, _classnames.default)('wp-block-navigation-item__content', {
|
|
629
|
-
'wp-block-navigation-link__placeholder': !url
|
|
691
|
+
'wp-block-navigation-link__placeholder': !url || isInvalid || isDraft
|
|
630
692
|
});
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
switch (type) {
|
|
634
|
-
case 'post':
|
|
635
|
-
/* translators: label for missing post in navigation link block */
|
|
636
|
-
missingText = (0, _i18n.__)('Select post');
|
|
637
|
-
break;
|
|
638
|
-
|
|
639
|
-
case 'page':
|
|
640
|
-
/* translators: label for missing page in navigation link block */
|
|
641
|
-
missingText = (0, _i18n.__)('Select page');
|
|
642
|
-
break;
|
|
643
|
-
|
|
644
|
-
case 'category':
|
|
645
|
-
/* translators: label for missing category in navigation link block */
|
|
646
|
-
missingText = (0, _i18n.__)('Select category');
|
|
647
|
-
break;
|
|
648
|
-
|
|
649
|
-
case 'tag':
|
|
650
|
-
/* translators: label for missing tag in navigation link block */
|
|
651
|
-
missingText = (0, _i18n.__)('Select tag');
|
|
652
|
-
break;
|
|
653
|
-
|
|
654
|
-
default:
|
|
655
|
-
/* translators: label for missing values in navigation link block */
|
|
656
|
-
missingText = (0, _i18n.__)('Add link');
|
|
657
|
-
}
|
|
693
|
+
const missingText = useMissingText(type, isInvalid, isDraft);
|
|
694
|
+
/* translators: Whether the navigation link is Invalid or a Draft. */
|
|
658
695
|
|
|
696
|
+
const placeholderText = `(${isInvalid ? (0, _i18n.__)('Invalid') : (0, _i18n.__)('Draft')})`;
|
|
697
|
+
const tooltipText = isInvalid || isDraft ? (0, _i18n.__)('This item has been deleted, or is a draft') : (0, _i18n.__)('This item is missing a link');
|
|
659
698
|
return (0, _element.createElement)(_element.Fragment, null, (0, _element.createElement)(_blockEditor.BlockControls, null, (0, _element.createElement)(_components.ToolbarGroup, null, (0, _element.createElement)(_components.ToolbarButton, {
|
|
660
699
|
name: "link",
|
|
661
700
|
icon: _icons.link,
|
|
@@ -702,8 +741,10 @@ function NavigationLinkEdit(_ref2) {
|
|
|
702
741
|
className: "wp-block-navigation-link__placeholder-text"
|
|
703
742
|
}, (0, _element.createElement)(_components.Tooltip, {
|
|
704
743
|
position: "top center",
|
|
705
|
-
text:
|
|
706
|
-
}, (0, _element.createElement)("span", null, missingText)
|
|
744
|
+
text: tooltipText
|
|
745
|
+
}, (0, _element.createElement)(_element.Fragment, null, (0, _element.createElement)("span", null, missingText), (0, _element.createElement)("span", {
|
|
746
|
+
className: "wp-block-navigation-link__missing_text-tooltip"
|
|
747
|
+
}, tooltipText)))) : (0, _element.createElement)(_element.Fragment, null, !isInvalid && !isDraft && (0, _element.createElement)(_blockEditor.RichText, {
|
|
707
748
|
ref: ref,
|
|
708
749
|
identifier: "label",
|
|
709
750
|
className: "wp-block-navigation-item__label",
|
|
@@ -723,7 +764,20 @@ function NavigationLinkEdit(_ref2) {
|
|
|
723
764
|
setIsLinkOpen(true);
|
|
724
765
|
}
|
|
725
766
|
}
|
|
726
|
-
}),
|
|
767
|
+
}), (isInvalid || isDraft) && (0, _element.createElement)("div", {
|
|
768
|
+
className: "wp-block-navigation-link__placeholder-text wp-block-navigation-link__label"
|
|
769
|
+
}, (0, _element.createElement)(_components.KeyboardShortcuts, {
|
|
770
|
+
shortcuts: {
|
|
771
|
+
enter: () => isSelected && setIsLinkOpen(true)
|
|
772
|
+
}
|
|
773
|
+
}), (0, _element.createElement)(_components.Tooltip, {
|
|
774
|
+
position: "top center",
|
|
775
|
+
text: tooltipText
|
|
776
|
+
}, (0, _element.createElement)(_element.Fragment, null, (0, _element.createElement)("span", null,
|
|
777
|
+
/* Trim to avoid trailing white space when the placeholder text is not present */
|
|
778
|
+
`${label} ${placeholderText}`.trim()), (0, _element.createElement)("span", {
|
|
779
|
+
className: "wp-block-navigation-link__missing_text-tooltip"
|
|
780
|
+
}, tooltipText))))), isLinkOpen && (0, _element.createElement)(_components.Popover, {
|
|
727
781
|
position: "bottom center",
|
|
728
782
|
onClose: () => setIsLinkOpen(false),
|
|
729
783
|
anchorRef: listItemRef.current
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-library/src/navigation-link/edit.js"],"names":["MAX_NESTING","useIsDraggingWithin","elementRef","isDraggingWithin","setIsDraggingWithin","ownerDocument","current","handleDragStart","event","handleDragEnter","handleDragEnd","contains","target","addEventListener","removeEventListener","getSuggestionsQuery","type","kind","subtype","getColors","context","isSubMenu","textColor","customTextColor","backgroundColor","customBackgroundColor","overlayTextColor","customOverlayTextColor","overlayBackgroundColor","customOverlayBackgroundColor","style","colors","color","text","background","updateNavigationLinkBlockAttributes","updatedValue","setAttributes","blockAttributes","label","originalLabel","originalKind","originalType","title","url","opensInNewTab","id","newKind","newType","normalizedTitle","replace","normalizedURL","escapeTitle","isBuiltInType","indexOf","isCustomLink","encodeURI","undefined","Number","isInteger","navStripHTML","html","doc","document","implementation","createHTMLDocument","body","innerHTML","textContent","LinkControlTransforms","block","transforms","length","map","item","index","clientId","name","icon","NavigationLinkEdit","attributes","isSelected","insertBlocksAfter","mergeBlocks","onReplace","description","rel","link","saveEntityRecord","coreStore","replaceBlock","__unstableMarkNextChangeAsNotPersistent","blockEditorStore","isLinkOpen","setIsLinkOpen","listItemRef","itemLabelPlaceholder","ref","innerBlocks","isAtMaxNesting","isTopLevelLink","isParentOfSelectedBlock","hasDescendants","userCanCreatePages","userCanCreatePosts","thisBlock","blockTransforms","select","getBlock","getBlocks","getBlockName","getBlockRootClientId","getClientIdsOfDescendants","hasSelectedInnerBlock","getSelectedBlockClientId","getBlockParentsByBlockName","getBlockTransformItems","selectedBlockId","descendants","isImmediateParentOfSelectedBlock","selectedBlockHasDescendants","canUser","transformToSubmenu","newSubmenu","featuredBlocks","featuredTransforms","filter","includes","test","selectLabelText","focus","defaultView","selection","getSelection","range","createRange","selectNodeContents","removeAllRanges","addRange","removeLink","userCanCreate","handleCreate","pageTitle","postType","page","status","rendered","onKeyDown","isKeyboardEvent","primary","keyCode","ENTER","blockProps","className","onClick","classes","missingText","linkIcon","displayShortcut","addSubmenu","descriptionValue","titleValue","relValue","labelValue","searchTerm","format","mark"],"mappings":";;;;;;;;;;AAkCA;;AA/BA;;AACA;;AAKA;;AACA;;AACA;;AAUA;;AACA;;AACA;;AAUA;;AAQA;;AACA;;AACA;;AA3CA;AACA;AACA;;AAIA;AACA;AACA;;AAqCA;AACA;AACA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGA,MAAMA,WAAW,GAAG,CAApB;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,MAAMC,mBAAmB,GAAKC,UAAF,IAAkB;AAC7C,QAAM,CAAEC,gBAAF,EAAoBC,mBAApB,IAA4C,uBAAU,KAAV,CAAlD;AAEA,0BAAW,MAAM;AAChB,UAAM;AAAEC,MAAAA;AAAF,QAAoBH,UAAU,CAACI,OAArC;;AAEA,aAASC,eAAT,CAA0BC,KAA1B,EAAkC;AACjC;AACAC,MAAAA,eAAe,CAAED,KAAF,CAAf;AACA,KANe,CAQhB;;;AACA,aAASE,aAAT,GAAyB;AACxBN,MAAAA,mBAAmB,CAAE,KAAF,CAAnB;AACA;;AAED,aAASK,eAAT,CAA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BAA0B,EAAKuB,UAAF,IAAkB;AAC9C,UAAIC,MAAJ;;AACA,UAAKrJ,IAAI,KAAK,MAAd,EAAuB;AACtB;AACAqJ,QAAAA,MAAM,GAAG,cACR,oCADQ,CAAT;AAGA,OALD,MAKO;AACN;AACAA,QAAAA,MAAM,GAAG,cACR,oCADQ,CAAT;AAGA;;AACD,aAAO,uCACN,mBAASA,MAAT,EAAiBD,UAAjB,CADM,EAEN;AAAEE,QAAAA,IAAI,EAAE;AAAR,OAFM,CAAP;AAIA,KAzBF;AA0BC,IAAA,aAAa,EAAG,CAAC,CAAEtJ,IA1BpB;AA2BC,IAAA,eAAe,EAAG,CAAC,CAAEA,IA3BtB;AA4BC,IAAA,gBAAgB,EAAGD,mBAAmB,CACrCC,IADqC,EAErCC,IAFqC,CA5BvC;AAgCC,IAAA,QAAQ,EAAKmB,YAAF,IACVD,mCAAmC,CAClCC,YADkC,EAElCC,aAFkC,EAGlC2C,UAHkC,CAjCrC;AAuCC,IAAA,QAAQ,EAAG2D,UAvCZ;AAwCC,IAAA,mBAAmB,EAClB,CAAE/F,GAAF,GACG,MACA,4BAAC,qBAAD;AACC,MAAA,KAAK,EAAG6D,SADT;AAEC,MAAA,UAAU,EACToB,kBAHF;AAKC,MAAA,OAAO,EAAGnC;AALX,MAFH,GAUG;AAnDL,IALD,CA9CF,CAFD,CAlDD,CADD;AAoKA","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\nimport { escape } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { createBlock, switchToBlockType } from '@wordpress/blocks';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport {\n\tButton,\n\tPanelBody,\n\tPopover,\n\tTextControl,\n\tTextareaControl,\n\tToolbarButton,\n\tTooltip,\n\tToolbarGroup,\n} from '@wordpress/components';\nimport { displayShortcut, isKeyboardEvent, ENTER } from '@wordpress/keycodes';\nimport { __, sprintf } from '@wordpress/i18n';\nimport {\n\tBlockControls,\n\tBlockIcon,\n\tInspectorControls,\n\tRichText,\n\t__experimentalLinkControl as LinkControl,\n\tuseBlockProps,\n\tstore as blockEditorStore,\n\tgetColorClassName,\n} from '@wordpress/block-editor';\nimport { isURL, prependHTTP, safeDecodeURI } from '@wordpress/url';\nimport {\n\tFragment,\n\tuseState,\n\tuseEffect,\n\tuseRef,\n\tcreateInterpolateElement,\n} from '@wordpress/element';\nimport { placeCaretAtHorizontalEdge } from '@wordpress/dom';\nimport { link as linkIcon, addSubmenu } from '@wordpress/icons';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport { name } from './block.json';\n\nconst MAX_NESTING = 5;\n\n/**\n * A React hook to determine if it's dragging within the target element.\n *\n * @typedef {import('@wordpress/element').RefObject} RefObject\n *\n * @param {RefObject<HTMLElement>} elementRef The target elementRef object.\n *\n * @return {boolean} Is dragging within the target element.\n */\nconst useIsDraggingWithin = ( elementRef ) => {\n\tconst [ isDraggingWithin, setIsDraggingWithin ] = useState( false );\n\n\tuseEffect( () => {\n\t\tconst { ownerDocument } = elementRef.current;\n\n\t\tfunction handleDragStart( event ) {\n\t\t\t// Check the first time when the dragging starts.\n\t\t\thandleDragEnter( event );\n\t\t}\n\n\t\t// Set to false whenever the user cancel the drag event by either releasing the mouse or press Escape.\n\t\tfunction handleDragEnd() {\n\t\t\tsetIsDraggingWithin( false );\n\t\t}\n\n\t\tfunction handleDragEnter( event ) {\n\t\t\t// Check if the current target is inside the item element.\n\t\t\tif ( elementRef.current.contains( event.target ) ) {\n\t\t\t\tsetIsDraggingWithin( true );\n\t\t\t} else {\n\t\t\t\tsetIsDraggingWithin( false );\n\t\t\t}\n\t\t}\n\n\t\t// Bind these events to the document to catch all drag events.\n\t\t// Ideally, we can also use `event.relatedTarget`, but sadly that\n\t\t// doesn't work in Safari.\n\t\townerDocument.addEventListener( 'dragstart', handleDragStart );\n\t\townerDocument.addEventListener( 'dragend', handleDragEnd );\n\t\townerDocument.addEventListener( 'dragenter', handleDragEnter );\n\n\t\treturn () => {\n\t\t\townerDocument.removeEventListener( 'dragstart', handleDragStart );\n\t\t\townerDocument.removeEventListener( 'dragend', handleDragEnd );\n\t\t\townerDocument.removeEventListener( 'dragenter', handleDragEnter );\n\t\t};\n\t}, [] );\n\n\treturn isDraggingWithin;\n};\n\n/**\n * Given the Link block's type attribute, return the query params to give to\n * /wp/v2/search.\n *\n * @param {string} type Link block's type attribute.\n * @param {string} kind Link block's entity of kind (post-type|taxonomy)\n * @return {{ type?: string, subtype?: string }} Search query params.\n */\nfunction getSuggestionsQuery( type, kind ) {\n\tswitch ( type ) {\n\t\tcase 'post':\n\t\tcase 'page':\n\t\t\treturn { type: 'post', subtype: type };\n\t\tcase 'category':\n\t\t\treturn { type: 'term', subtype: 'category' };\n\t\tcase 'tag':\n\t\t\treturn { type: 'term', subtype: 'post_tag' };\n\t\tcase 'post_format':\n\t\t\treturn { type: 'post-format' };\n\t\tdefault:\n\t\t\tif ( kind === 'taxonomy' ) {\n\t\t\t\treturn { type: 'term', subtype: type };\n\t\t\t}\n\t\t\tif ( kind === 'post-type' ) {\n\t\t\t\treturn { type: 'post', subtype: type };\n\t\t\t}\n\t\t\treturn {};\n\t}\n}\n\n/**\n * Determine the colors for a menu.\n *\n * Order of priority is:\n * 1: Overlay custom colors (if submenu)\n * 2: Overlay theme colors (if submenu)\n * 3: Custom colors\n * 4: Theme colors\n * 5: Global styles\n *\n * @param {Object} context\n * @param {boolean} isSubMenu\n */\nfunction getColors( context, isSubMenu ) {\n\tconst {\n\t\ttextColor,\n\t\tcustomTextColor,\n\t\tbackgroundColor,\n\t\tcustomBackgroundColor,\n\t\toverlayTextColor,\n\t\tcustomOverlayTextColor,\n\t\toverlayBackgroundColor,\n\t\tcustomOverlayBackgroundColor,\n\t\tstyle,\n\t} = context;\n\n\tconst colors = {};\n\n\tif ( isSubMenu && !! customOverlayTextColor ) {\n\t\tcolors.customTextColor = customOverlayTextColor;\n\t} else if ( isSubMenu && !! overlayTextColor ) {\n\t\tcolors.textColor = overlayTextColor;\n\t} else if ( !! customTextColor ) {\n\t\tcolors.customTextColor = customTextColor;\n\t} else if ( !! textColor ) {\n\t\tcolors.textColor = textColor;\n\t} else if ( !! style?.color?.text ) {\n\t\tcolors.customTextColor = style.color.text;\n\t}\n\n\tif ( isSubMenu && !! customOverlayBackgroundColor ) {\n\t\tcolors.customBackgroundColor = customOverlayBackgroundColor;\n\t} else if ( isSubMenu && !! overlayBackgroundColor ) {\n\t\tcolors.backgroundColor = overlayBackgroundColor;\n\t} else if ( !! customBackgroundColor ) {\n\t\tcolors.customBackgroundColor = customBackgroundColor;\n\t} else if ( !! backgroundColor ) {\n\t\tcolors.backgroundColor = backgroundColor;\n\t} else if ( !! style?.color?.background ) {\n\t\tcolors.customTextColor = style.color.background;\n\t}\n\n\treturn colors;\n}\n\n/**\n * @typedef {'post-type'|'custom'|'taxonomy'|'post-type-archive'} WPNavigationLinkKind\n */\n\n/**\n * Navigation Link Block Attributes\n *\n * @typedef {Object} WPNavigationLinkBlockAttributes\n *\n * @property {string} [label] Link text.\n * @property {WPNavigationLinkKind} [kind] Kind is used to differentiate between term and post ids to check post draft status.\n * @property {string} [type] The type such as post, page, tag, category and other custom types.\n * @property {string} [rel] The relationship of the linked URL.\n * @property {number} [id] A post or term id.\n * @property {boolean} [opensInNewTab] Sets link target to _blank when true.\n * @property {string} [url] Link href.\n * @property {string} [title] Link title attribute.\n */\n\n/**\n * Link Control onChange handler that updates block attributes when a setting is changed.\n *\n * @param {Object} updatedValue New block attributes to update.\n * @param {Function} setAttributes Block attribute update function.\n * @param {WPNavigationLinkBlockAttributes} blockAttributes Current block attributes.\n *\n */\nexport const updateNavigationLinkBlockAttributes = (\n\tupdatedValue = {},\n\tsetAttributes,\n\tblockAttributes = {}\n) => {\n\tconst {\n\t\tlabel: originalLabel = '',\n\t\tkind: originalKind = '',\n\t\ttype: originalType = '',\n\t} = blockAttributes;\n\n\tconst {\n\t\ttitle = '', // the title of any provided Post.\n\t\turl = '',\n\n\t\topensInNewTab,\n\t\tid,\n\t\tkind: newKind = originalKind,\n\t\ttype: newType = originalType,\n\t} = updatedValue;\n\tconst normalizedTitle = title.replace( /http(s?):\\/\\//gi, '' );\n\tconst normalizedURL = url.replace( /http(s?):\\/\\//gi, '' );\n\tconst escapeTitle =\n\t\ttitle !== '' &&\n\t\tnormalizedTitle !== normalizedURL &&\n\t\toriginalLabel !== title;\n\n\tconst label = escapeTitle\n\t\t? escape( title )\n\t\t: originalLabel || escape( normalizedURL );\n\n\t// In https://github.com/WordPress/gutenberg/pull/24670 we decided to use \"tag\" in favor of \"post_tag\"\n\tconst type = newType === 'post_tag' ? 'tag' : newType.replace( '-', '_' );\n\n\tconst isBuiltInType =\n\t\t[ 'post', 'page', 'tag', 'category' ].indexOf( type ) > -1;\n\n\tconst isCustomLink =\n\t\t( ! newKind && ! isBuiltInType ) || newKind === 'custom';\n\tconst kind = isCustomLink ? 'custom' : newKind;\n\n\tsetAttributes( {\n\t\t// Passed `url` may already be encoded. To prevent double encoding, decodeURI is executed to revert to the original string.\n\t\t...( url && { url: encodeURI( safeDecodeURI( url ) ) } ),\n\t\t...( label && { label } ),\n\t\t...( undefined !== opensInNewTab && { opensInNewTab } ),\n\t\t...( id && Number.isInteger( id ) && { id } ),\n\t\t...( kind && { kind } ),\n\t\t...( type && type !== 'URL' && { type } ),\n\t} );\n};\n\n/**\n * Removes HTML from a given string.\n * Note the does not provide XSS protection or otherwise attempt\n * to filter strings with malicious intent.\n *\n * See also: https://github.com/WordPress/gutenberg/pull/35539\n *\n * @param {string} html the string from which HTML should be removed.\n * @return {string} the \"cleaned\" string.\n */\nfunction navStripHTML( html ) {\n\tconst doc = document.implementation.createHTMLDocument( '' );\n\tdoc.body.innerHTML = html;\n\treturn doc.body.textContent || '';\n}\n\n/**\n * Add transforms to Link Control\n */\n\nfunction LinkControlTransforms( { block, transforms, replace } ) {\n\tif ( ! transforms?.length ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<div className=\"link-control-transform\">\n\t\t\t<h3 className=\"link-control-transform__subheading\">\n\t\t\t\t{ __( 'Transform' ) }\n\t\t\t</h3>\n\t\t\t<div className=\"link-control-transform__items\">\n\t\t\t\t{ transforms.map( ( item, index ) => {\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\tkey={ `transform-${ index }` }\n\t\t\t\t\t\t\tonClick={ () =>\n\t\t\t\t\t\t\t\treplace(\n\t\t\t\t\t\t\t\t\tblock.clientId,\n\t\t\t\t\t\t\t\t\tswitchToBlockType( block, item.name )\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tclassName=\"link-control-transform__item\"\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<BlockIcon icon={ item.icon } />\n\t\t\t\t\t\t\t{ item.title }\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t);\n\t\t\t\t} ) }\n\t\t\t</div>\n\t\t</div>\n\t);\n}\n\nexport default function NavigationLinkEdit( {\n\tattributes,\n\tisSelected,\n\tsetAttributes,\n\tinsertBlocksAfter,\n\tmergeBlocks,\n\tonReplace,\n\tcontext,\n\tclientId,\n} ) {\n\tconst {\n\t\tlabel,\n\t\ttype,\n\t\topensInNewTab,\n\t\turl,\n\t\tdescription,\n\t\trel,\n\t\ttitle,\n\t\tkind,\n\t} = attributes;\n\n\tconst link = {\n\t\turl,\n\t\topensInNewTab,\n\t\ttitle: label && navStripHTML( label ), // don't allow HTML to display inside the <LinkControl>\n\t};\n\tconst { saveEntityRecord } = useDispatch( coreStore );\n\tconst {\n\t\treplaceBlock,\n\t\t__unstableMarkNextChangeAsNotPersistent,\n\t} = useDispatch( blockEditorStore );\n\tconst [ isLinkOpen, setIsLinkOpen ] = useState( false );\n\tconst listItemRef = useRef( null );\n\tconst isDraggingWithin = useIsDraggingWithin( listItemRef );\n\tconst itemLabelPlaceholder = __( 'Add link…' );\n\tconst ref = useRef();\n\n\tconst {\n\t\tinnerBlocks,\n\t\tisAtMaxNesting,\n\t\tisTopLevelLink,\n\t\tisParentOfSelectedBlock,\n\t\thasDescendants,\n\t\tuserCanCreatePages,\n\t\tuserCanCreatePosts,\n\t\tthisBlock,\n\t\tblockTransforms,\n\t} = useSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\tgetBlock,\n\t\t\t\tgetBlocks,\n\t\t\t\tgetBlockName,\n\t\t\t\tgetBlockRootClientId,\n\t\t\t\tgetClientIdsOfDescendants,\n\t\t\t\thasSelectedInnerBlock,\n\t\t\t\tgetSelectedBlockClientId,\n\t\t\t\tgetBlockParentsByBlockName,\n\t\t\t\tgetBlockTransformItems,\n\t\t\t} = select( blockEditorStore );\n\n\t\t\tconst selectedBlockId = getSelectedBlockClientId();\n\n\t\t\tconst descendants = getClientIdsOfDescendants( [ clientId ] )\n\t\t\t\t.length;\n\n\t\t\treturn {\n\t\t\t\tinnerBlocks: getBlocks( clientId ),\n\t\t\t\tisAtMaxNesting:\n\t\t\t\t\tgetBlockParentsByBlockName( clientId, [\n\t\t\t\t\t\tname,\n\t\t\t\t\t\t'core/navigation-submenu',\n\t\t\t\t\t] ).length >= MAX_NESTING,\n\t\t\t\tisTopLevelLink:\n\t\t\t\t\tgetBlockName( getBlockRootClientId( clientId ) ) ===\n\t\t\t\t\t'core/navigation',\n\t\t\t\tisParentOfSelectedBlock: hasSelectedInnerBlock(\n\t\t\t\t\tclientId,\n\t\t\t\t\ttrue\n\t\t\t\t),\n\t\t\t\tisImmediateParentOfSelectedBlock: hasSelectedInnerBlock(\n\t\t\t\t\tclientId,\n\t\t\t\t\tfalse\n\t\t\t\t),\n\t\t\t\thasDescendants: !! descendants,\n\t\t\t\tselectedBlockHasDescendants: !! getClientIdsOfDescendants( [\n\t\t\t\t\tselectedBlockId,\n\t\t\t\t] )?.length,\n\t\t\t\tuserCanCreatePages: select( coreStore ).canUser(\n\t\t\t\t\t'create',\n\t\t\t\t\t'pages'\n\t\t\t\t),\n\t\t\t\tuserCanCreatePosts: select( coreStore ).canUser(\n\t\t\t\t\t'create',\n\t\t\t\t\t'posts'\n\t\t\t\t),\n\t\t\t\tthisBlock: getBlock( clientId ),\n\t\t\t\tblockTransforms: getBlockTransformItems(\n\t\t\t\t\t[ getBlock( clientId ) ],\n\t\t\t\t\tgetBlockRootClientId( clientId )\n\t\t\t\t),\n\t\t\t};\n\t\t},\n\t\t[ clientId ]\n\t);\n\n\tuseEffect( () => {\n\t\t// This side-effect should not create an undo level as those should\n\t\t// only be created via user interactions. Mark this change as\n\t\t// not persistent to avoid undo level creation.\n\t\t// See https://github.com/WordPress/gutenberg/issues/34564.\n\t\t__unstableMarkNextChangeAsNotPersistent();\n\t\tsetAttributes( { isTopLevelLink } );\n\t}, [ isTopLevelLink ] );\n\n\t/**\n\t * Transform to submenu block.\n\t */\n\tfunction transformToSubmenu() {\n\t\tconst newSubmenu = createBlock(\n\t\t\t'core/navigation-submenu',\n\t\t\tattributes,\n\t\t\tinnerBlocks\n\t\t);\n\t\treplaceBlock( clientId, newSubmenu );\n\t}\n\n\tconst featuredBlocks = [\n\t\t'core/site-logo',\n\t\t'core/social-links',\n\t\t'core/search',\n\t];\n\tconst featuredTransforms = blockTransforms.filter( ( item ) => {\n\t\treturn featuredBlocks.includes( item.name );\n\t} );\n\n\tuseEffect( () => {\n\t\t// Show the LinkControl on mount if the URL is empty\n\t\t// ( When adding a new menu item)\n\t\t// This can't be done in the useState call because it conflicts\n\t\t// with the autofocus behavior of the BlockListBlock component.\n\t\tif ( ! url ) {\n\t\t\tsetIsLinkOpen( true );\n\t\t}\n\t\t// If block has inner blocks, transform to Submenu.\n\t\tif ( hasDescendants ) {\n\t\t\ttransformToSubmenu();\n\t\t}\n\t}, [] );\n\n\t/**\n\t * The hook shouldn't be necessary but due to a focus loss happening\n\t * when selecting a suggestion in the link popover, we force close on block unselection.\n\t */\n\tuseEffect( () => {\n\t\tif ( ! isSelected ) {\n\t\t\tsetIsLinkOpen( false );\n\t\t}\n\t}, [ isSelected ] );\n\n\t// If the LinkControl popover is open and the URL has changed, close the LinkControl and focus the label text.\n\tuseEffect( () => {\n\t\tif ( isLinkOpen && url ) {\n\t\t\t// Does this look like a URL and have something TLD-ish?\n\t\t\tif (\n\t\t\t\tisURL( prependHTTP( label ) ) &&\n\t\t\t\t/^.+\\.[a-z]+/.test( label )\n\t\t\t) {\n\t\t\t\t// Focus and select the label text.\n\t\t\t\tselectLabelText();\n\t\t\t} else {\n\t\t\t\t// Focus it (but do not select).\n\t\t\t\tplaceCaretAtHorizontalEdge( ref.current, true );\n\t\t\t}\n\t\t}\n\t}, [ url ] );\n\n\t/**\n\t * Focus the Link label text and select it.\n\t */\n\tfunction selectLabelText() {\n\t\tref.current.focus();\n\t\tconst { ownerDocument } = ref.current;\n\t\tconst { defaultView } = ownerDocument;\n\t\tconst selection = defaultView.getSelection();\n\t\tconst range = ownerDocument.createRange();\n\t\t// Get the range of the current ref contents so we can add this range to the selection.\n\t\trange.selectNodeContents( ref.current );\n\t\tselection.removeAllRanges();\n\t\tselection.addRange( range );\n\t}\n\n\t/**\n\t * Removes the current link if set.\n\t */\n\tfunction removeLink() {\n\t\t// Reset all attributes that comprise the link.\n\t\tsetAttributes( {\n\t\t\turl: '',\n\t\t\tlabel: '',\n\t\t\tid: '',\n\t\t\tkind: '',\n\t\t\ttype: '',\n\t\t} );\n\n\t\t// Close the link editing UI.\n\t\tsetIsLinkOpen( false );\n\t}\n\n\tlet userCanCreate = false;\n\tif ( ! type || type === 'page' ) {\n\t\tuserCanCreate = userCanCreatePages;\n\t} else if ( type === 'post' ) {\n\t\tuserCanCreate = userCanCreatePosts;\n\t}\n\n\tasync function handleCreate( pageTitle ) {\n\t\tconst postType = type || 'page';\n\n\t\tconst page = await saveEntityRecord( 'postType', postType, {\n\t\t\ttitle: pageTitle,\n\t\t\tstatus: 'draft',\n\t\t} );\n\n\t\treturn {\n\t\t\tid: page.id,\n\t\t\ttype: postType,\n\t\t\ttitle: page.title.rendered,\n\t\t\turl: page.link,\n\t\t\tkind: 'post-type',\n\t\t};\n\t}\n\n\tconst {\n\t\ttextColor,\n\t\tcustomTextColor,\n\t\tbackgroundColor,\n\t\tcustomBackgroundColor,\n\t} = getColors( context, ! isTopLevelLink );\n\n\tfunction onKeyDown( event ) {\n\t\tif (\n\t\t\tisKeyboardEvent.primary( event, 'k' ) ||\n\t\t\t( ! url && event.keyCode === ENTER )\n\t\t) {\n\t\t\tsetIsLinkOpen( true );\n\t\t}\n\t}\n\n\tconst blockProps = useBlockProps( {\n\t\tref: listItemRef,\n\t\tclassName: classnames( 'wp-block-navigation-item', {\n\t\t\t'is-editing': isSelected || isParentOfSelectedBlock,\n\t\t\t'is-dragging-within': isDraggingWithin,\n\t\t\t'has-link': !! url,\n\t\t\t'has-child': hasDescendants,\n\t\t\t'has-text-color': !! textColor || !! customTextColor,\n\t\t\t[ getColorClassName( 'color', textColor ) ]: !! textColor,\n\t\t\t'has-background': !! backgroundColor || customBackgroundColor,\n\t\t\t[ getColorClassName(\n\t\t\t\t'background-color',\n\t\t\t\tbackgroundColor\n\t\t\t) ]: !! backgroundColor,\n\t\t} ),\n\t\tstyle: {\n\t\t\tcolor: ! textColor && customTextColor,\n\t\t\tbackgroundColor: ! backgroundColor && customBackgroundColor,\n\t\t},\n\t\tonKeyDown,\n\t} );\n\n\tif ( ! url ) {\n\t\tblockProps.onClick = () => setIsLinkOpen( true );\n\t}\n\n\tconst classes = classnames( 'wp-block-navigation-item__content', {\n\t\t'wp-block-navigation-link__placeholder': ! url,\n\t} );\n\n\tlet missingText = '';\n\tswitch ( type ) {\n\t\tcase 'post':\n\t\t\t/* translators: label for missing post in navigation link block */\n\t\t\tmissingText = __( 'Select post' );\n\t\t\tbreak;\n\t\tcase 'page':\n\t\t\t/* translators: label for missing page in navigation link block */\n\t\t\tmissingText = __( 'Select page' );\n\t\t\tbreak;\n\t\tcase 'category':\n\t\t\t/* translators: label for missing category in navigation link block */\n\t\t\tmissingText = __( 'Select category' );\n\t\t\tbreak;\n\t\tcase 'tag':\n\t\t\t/* translators: label for missing tag in navigation link block */\n\t\t\tmissingText = __( 'Select tag' );\n\t\t\tbreak;\n\t\tdefault:\n\t\t\t/* translators: label for missing values in navigation link block */\n\t\t\tmissingText = __( 'Add link' );\n\t}\n\n\treturn (\n\t\t<Fragment>\n\t\t\t<BlockControls>\n\t\t\t\t<ToolbarGroup>\n\t\t\t\t\t<ToolbarButton\n\t\t\t\t\t\tname=\"link\"\n\t\t\t\t\t\ticon={ linkIcon }\n\t\t\t\t\t\ttitle={ __( 'Link' ) }\n\t\t\t\t\t\tshortcut={ displayShortcut.primary( 'k' ) }\n\t\t\t\t\t\tonClick={ () => setIsLinkOpen( true ) }\n\t\t\t\t\t/>\n\t\t\t\t\t{ ! isAtMaxNesting && (\n\t\t\t\t\t\t<ToolbarButton\n\t\t\t\t\t\t\tname=\"submenu\"\n\t\t\t\t\t\t\ticon={ addSubmenu }\n\t\t\t\t\t\t\ttitle={ __( 'Add submenu' ) }\n\t\t\t\t\t\t\tonClick={ transformToSubmenu }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t</ToolbarGroup>\n\t\t\t</BlockControls>\n\t\t\t<InspectorControls>\n\t\t\t\t<PanelBody title={ __( 'Link settings' ) }>\n\t\t\t\t\t<TextareaControl\n\t\t\t\t\t\tvalue={ description || '' }\n\t\t\t\t\t\tonChange={ ( descriptionValue ) => {\n\t\t\t\t\t\t\tsetAttributes( { description: descriptionValue } );\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tlabel={ __( 'Description' ) }\n\t\t\t\t\t\thelp={ __(\n\t\t\t\t\t\t\t'The description will be displayed in the menu if the current theme supports it.'\n\t\t\t\t\t\t) }\n\t\t\t\t\t/>\n\t\t\t\t\t<TextControl\n\t\t\t\t\t\tvalue={ title || '' }\n\t\t\t\t\t\tonChange={ ( titleValue ) => {\n\t\t\t\t\t\t\tsetAttributes( { title: titleValue } );\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tlabel={ __( 'Link title' ) }\n\t\t\t\t\t\tautoComplete=\"off\"\n\t\t\t\t\t/>\n\t\t\t\t\t<TextControl\n\t\t\t\t\t\tvalue={ rel || '' }\n\t\t\t\t\t\tonChange={ ( relValue ) => {\n\t\t\t\t\t\t\tsetAttributes( { rel: relValue } );\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tlabel={ __( 'Link rel' ) }\n\t\t\t\t\t\tautoComplete=\"off\"\n\t\t\t\t\t/>\n\t\t\t\t</PanelBody>\n\t\t\t</InspectorControls>\n\t\t\t<div { ...blockProps }>\n\t\t\t\t{ /* eslint-disable jsx-a11y/anchor-is-valid */ }\n\t\t\t\t<a className={ classes }>\n\t\t\t\t\t{ /* eslint-enable */ }\n\t\t\t\t\t{ ! url ? (\n\t\t\t\t\t\t<div className=\"wp-block-navigation-link__placeholder-text\">\n\t\t\t\t\t\t\t<Tooltip\n\t\t\t\t\t\t\t\tposition=\"top center\"\n\t\t\t\t\t\t\t\ttext={ __( 'This item is missing a link' ) }\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t<span>{ missingText }</span>\n\t\t\t\t\t\t\t</Tooltip>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t) : (\n\t\t\t\t\t\t<RichText\n\t\t\t\t\t\t\tref={ ref }\n\t\t\t\t\t\t\tidentifier=\"label\"\n\t\t\t\t\t\t\tclassName=\"wp-block-navigation-item__label\"\n\t\t\t\t\t\t\tvalue={ label }\n\t\t\t\t\t\t\tonChange={ ( labelValue ) =>\n\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\tlabel: labelValue,\n\t\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tonMerge={ mergeBlocks }\n\t\t\t\t\t\t\tonReplace={ onReplace }\n\t\t\t\t\t\t\t__unstableOnSplitAtEnd={ () =>\n\t\t\t\t\t\t\t\tinsertBlocksAfter(\n\t\t\t\t\t\t\t\t\tcreateBlock( 'core/navigation-link' )\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\taria-label={ __( 'Navigation link text' ) }\n\t\t\t\t\t\t\tplaceholder={ itemLabelPlaceholder }\n\t\t\t\t\t\t\twithoutInteractiveFormatting\n\t\t\t\t\t\t\tallowedFormats={ [\n\t\t\t\t\t\t\t\t'core/bold',\n\t\t\t\t\t\t\t\t'core/italic',\n\t\t\t\t\t\t\t\t'core/image',\n\t\t\t\t\t\t\t\t'core/strikethrough',\n\t\t\t\t\t\t\t] }\n\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\tif ( ! url ) {\n\t\t\t\t\t\t\t\t\tsetIsLinkOpen( true );\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{ isLinkOpen && (\n\t\t\t\t\t\t<Popover\n\t\t\t\t\t\t\tposition=\"bottom center\"\n\t\t\t\t\t\t\tonClose={ () => setIsLinkOpen( false ) }\n\t\t\t\t\t\t\tanchorRef={ listItemRef.current }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<LinkControl\n\t\t\t\t\t\t\t\thasTextControl\n\t\t\t\t\t\t\t\thasRichPreviews\n\t\t\t\t\t\t\t\tclassName=\"wp-block-navigation-link__inline-link-input\"\n\t\t\t\t\t\t\t\tvalue={ link }\n\t\t\t\t\t\t\t\tshowInitialSuggestions={ true }\n\t\t\t\t\t\t\t\twithCreateSuggestion={ userCanCreate }\n\t\t\t\t\t\t\t\tcreateSuggestion={ handleCreate }\n\t\t\t\t\t\t\t\tcreateSuggestionButtonText={ ( searchTerm ) => {\n\t\t\t\t\t\t\t\t\tlet format;\n\t\t\t\t\t\t\t\t\tif ( type === 'post' ) {\n\t\t\t\t\t\t\t\t\t\t/* translators: %s: search term. */\n\t\t\t\t\t\t\t\t\t\tformat = __(\n\t\t\t\t\t\t\t\t\t\t\t'Create draft post: <mark>%s</mark>'\n\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\t\t/* translators: %s: search term. */\n\t\t\t\t\t\t\t\t\t\tformat = __(\n\t\t\t\t\t\t\t\t\t\t\t'Create draft page: <mark>%s</mark>'\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\treturn createInterpolateElement(\n\t\t\t\t\t\t\t\t\t\tsprintf( format, searchTerm ),\n\t\t\t\t\t\t\t\t\t\t{ mark: <mark /> }\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\tnoDirectEntry={ !! type }\n\t\t\t\t\t\t\t\tnoURLSuggestion={ !! type }\n\t\t\t\t\t\t\t\tsuggestionsQuery={ getSuggestionsQuery(\n\t\t\t\t\t\t\t\t\ttype,\n\t\t\t\t\t\t\t\t\tkind\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\tonChange={ ( updatedValue ) =>\n\t\t\t\t\t\t\t\t\tupdateNavigationLinkBlockAttributes(\n\t\t\t\t\t\t\t\t\t\tupdatedValue,\n\t\t\t\t\t\t\t\t\t\tsetAttributes,\n\t\t\t\t\t\t\t\t\t\tattributes\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\tonRemove={ removeLink }\n\t\t\t\t\t\t\t\trenderControlBottom={\n\t\t\t\t\t\t\t\t\t! url\n\t\t\t\t\t\t\t\t\t\t? () => (\n\t\t\t\t\t\t\t\t\t\t\t\t<LinkControlTransforms\n\t\t\t\t\t\t\t\t\t\t\t\t\tblock={ thisBlock }\n\t\t\t\t\t\t\t\t\t\t\t\t\ttransforms={\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tfeaturedTransforms\n\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t\treplace={ replaceBlock }\n\t\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: null\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</Popover>\n\t\t\t\t\t) }\n\t\t\t\t</a>\n\t\t\t</div>\n\t\t</Fragment>\n\t);\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["@wordpress/block-library/src/navigation-link/edit.js"],"names":["MAX_NESTING","useIsDraggingWithin","elementRef","isDraggingWithin","setIsDraggingWithin","ownerDocument","current","handleDragStart","event","handleDragEnter","handleDragEnd","contains","target","addEventListener","removeEventListener","getSuggestionsQuery","type","kind","subtype","getColors","context","isSubMenu","textColor","customTextColor","backgroundColor","customBackgroundColor","overlayTextColor","customOverlayTextColor","overlayBackgroundColor","customOverlayBackgroundColor","style","colors","color","text","background","updateNavigationLinkBlockAttributes","updatedValue","setAttributes","blockAttributes","label","originalLabel","originalKind","originalType","title","url","opensInNewTab","id","newKind","newType","normalizedTitle","replace","normalizedURL","escapeTitle","isBuiltInType","indexOf","isCustomLink","encodeURI","undefined","Number","isInteger","useIsInvalidLink","isPostType","hasId","postStatus","select","getEntityRecord","coreStore","status","isInvalid","isDraft","useMissingText","missingText","navStripHTML","html","doc","document","implementation","createHTMLDocument","body","innerHTML","textContent","LinkControlTransforms","block","transforms","length","map","item","index","clientId","name","icon","NavigationLinkEdit","attributes","isSelected","insertBlocksAfter","mergeBlocks","onReplace","description","rel","link","saveEntityRecord","replaceBlock","__unstableMarkNextChangeAsNotPersistent","blockEditorStore","isLinkOpen","setIsLinkOpen","listItemRef","itemLabelPlaceholder","ref","innerBlocks","isAtMaxNesting","isTopLevelLink","isParentOfSelectedBlock","hasDescendants","userCanCreatePages","userCanCreatePosts","thisBlock","blockTransforms","getBlock","getBlocks","getBlockName","getBlockRootClientId","getClientIdsOfDescendants","hasSelectedInnerBlock","getSelectedBlockClientId","getBlockParentsByBlockName","getBlockTransformItems","selectedBlockId","descendants","isImmediateParentOfSelectedBlock","selectedBlockHasDescendants","canUser","transformToSubmenu","newSubmenu","featuredBlocks","featuredTransforms","filter","includes","test","selectLabelText","focus","defaultView","selection","getSelection","range","createRange","selectNodeContents","removeAllRanges","addRange","removeLink","userCanCreate","handleCreate","pageTitle","postType","page","rendered","onKeyDown","isKeyboardEvent","primary","keyCode","ENTER","blockProps","className","onClick","classes","placeholderText","tooltipText","linkIcon","displayShortcut","addSubmenu","descriptionValue","titleValue","relValue","labelValue","enter","trim","searchTerm","format","mark"],"mappings":";;;;;;;;;;AAmCA;;AAhCA;;AACA;;AAKA;;AACA;;AACA;;AAWA;;AACA;;AACA;;AAUA;;AAQA;;AACA;;AACA;;AA5CA;AACA;AACA;;AAIA;AACA;AACA;;AAsCA;AACA;AACA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGA,MAAMA,WAAW,GAAG,CAApB;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,MAAMC,mBAAmB,GAAKC,UAAF,IAAkB;AAC7C,QAAM,CAAEC,gBAAF,EAAoBC,mBAApB,IAA4C,uBAAU,KAAV,CAAlD;AAEA,0BAAW,MAAM;AAChB,UAAM;AAAEC,MAAAA;AAAF,QAAoBH,UAAU,CAACI,OAArC;;AAEA,aAASC,eAAT,CAA0BC,KAA1B,EAAkC;AACjC;AACAC,MAAAA,eAAe,CAAED,KAAF,CAAf;AACA,KANe,CAQhB;;;AACA,aAASE,aAAT,GAAyB;AACxBN,MAAAA,mBAAmB,CAAE,KAAF,CAAnB;AACA;;AAED,aAASK,eAAT,CAA0BD,KAA1B,EAAkC;AACjC;AACA,UAAKN,UAAU,CAACI,OAAX,CAAmBK,QAAnB,CAA6BH,KAAK,CAACI,MAAnC,CAAL,EAAmD;AAClDR,QAAAA,mBAAmB,CAAE,IAAF,CAAnB;AACA,OAFD,MAEO;AACNA,QAAAA,mBAAmB,CAAE,KAAF,CAAnB;A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AAA,OAAO,EAAGlC;AALX,MAFH,GAUG;AAnDL,IALD,CAjFF,CAFD,CAlDD,CADD;AAuMA","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\nimport { escape } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { createBlock, switchToBlockType } from '@wordpress/blocks';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport {\n\tButton,\n\tPanelBody,\n\tPopover,\n\tTextControl,\n\tTextareaControl,\n\tToolbarButton,\n\tTooltip,\n\tToolbarGroup,\n\tKeyboardShortcuts,\n} from '@wordpress/components';\nimport { displayShortcut, isKeyboardEvent, ENTER } from '@wordpress/keycodes';\nimport { __, sprintf } from '@wordpress/i18n';\nimport {\n\tBlockControls,\n\tBlockIcon,\n\tInspectorControls,\n\tRichText,\n\t__experimentalLinkControl as LinkControl,\n\tuseBlockProps,\n\tstore as blockEditorStore,\n\tgetColorClassName,\n} from '@wordpress/block-editor';\nimport { isURL, prependHTTP, safeDecodeURI } from '@wordpress/url';\nimport {\n\tFragment,\n\tuseState,\n\tuseEffect,\n\tuseRef,\n\tcreateInterpolateElement,\n} from '@wordpress/element';\nimport { placeCaretAtHorizontalEdge } from '@wordpress/dom';\nimport { link as linkIcon, addSubmenu } from '@wordpress/icons';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport { name } from './block.json';\n\nconst MAX_NESTING = 5;\n\n/**\n * A React hook to determine if it's dragging within the target element.\n *\n * @typedef {import('@wordpress/element').RefObject} RefObject\n *\n * @param {RefObject<HTMLElement>} elementRef The target elementRef object.\n *\n * @return {boolean} Is dragging within the target element.\n */\nconst useIsDraggingWithin = ( elementRef ) => {\n\tconst [ isDraggingWithin, setIsDraggingWithin ] = useState( false );\n\n\tuseEffect( () => {\n\t\tconst { ownerDocument } = elementRef.current;\n\n\t\tfunction handleDragStart( event ) {\n\t\t\t// Check the first time when the dragging starts.\n\t\t\thandleDragEnter( event );\n\t\t}\n\n\t\t// Set to false whenever the user cancel the drag event by either releasing the mouse or press Escape.\n\t\tfunction handleDragEnd() {\n\t\t\tsetIsDraggingWithin( false );\n\t\t}\n\n\t\tfunction handleDragEnter( event ) {\n\t\t\t// Check if the current target is inside the item element.\n\t\t\tif ( elementRef.current.contains( event.target ) ) {\n\t\t\t\tsetIsDraggingWithin( true );\n\t\t\t} else {\n\t\t\t\tsetIsDraggingWithin( false );\n\t\t\t}\n\t\t}\n\n\t\t// Bind these events to the document to catch all drag events.\n\t\t// Ideally, we can also use `event.relatedTarget`, but sadly that\n\t\t// doesn't work in Safari.\n\t\townerDocument.addEventListener( 'dragstart', handleDragStart );\n\t\townerDocument.addEventListener( 'dragend', handleDragEnd );\n\t\townerDocument.addEventListener( 'dragenter', handleDragEnter );\n\n\t\treturn () => {\n\t\t\townerDocument.removeEventListener( 'dragstart', handleDragStart );\n\t\t\townerDocument.removeEventListener( 'dragend', handleDragEnd );\n\t\t\townerDocument.removeEventListener( 'dragenter', handleDragEnter );\n\t\t};\n\t}, [] );\n\n\treturn isDraggingWithin;\n};\n\n/**\n * Given the Link block's type attribute, return the query params to give to\n * /wp/v2/search.\n *\n * @param {string} type Link block's type attribute.\n * @param {string} kind Link block's entity of kind (post-type|taxonomy)\n * @return {{ type?: string, subtype?: string }} Search query params.\n */\nfunction getSuggestionsQuery( type, kind ) {\n\tswitch ( type ) {\n\t\tcase 'post':\n\t\tcase 'page':\n\t\t\treturn { type: 'post', subtype: type };\n\t\tcase 'category':\n\t\t\treturn { type: 'term', subtype: 'category' };\n\t\tcase 'tag':\n\t\t\treturn { type: 'term', subtype: 'post_tag' };\n\t\tcase 'post_format':\n\t\t\treturn { type: 'post-format' };\n\t\tdefault:\n\t\t\tif ( kind === 'taxonomy' ) {\n\t\t\t\treturn { type: 'term', subtype: type };\n\t\t\t}\n\t\t\tif ( kind === 'post-type' ) {\n\t\t\t\treturn { type: 'post', subtype: type };\n\t\t\t}\n\t\t\treturn {};\n\t}\n}\n\n/**\n * Determine the colors for a menu.\n *\n * Order of priority is:\n * 1: Overlay custom colors (if submenu)\n * 2: Overlay theme colors (if submenu)\n * 3: Custom colors\n * 4: Theme colors\n * 5: Global styles\n *\n * @param {Object} context\n * @param {boolean} isSubMenu\n */\nfunction getColors( context, isSubMenu ) {\n\tconst {\n\t\ttextColor,\n\t\tcustomTextColor,\n\t\tbackgroundColor,\n\t\tcustomBackgroundColor,\n\t\toverlayTextColor,\n\t\tcustomOverlayTextColor,\n\t\toverlayBackgroundColor,\n\t\tcustomOverlayBackgroundColor,\n\t\tstyle,\n\t} = context;\n\n\tconst colors = {};\n\n\tif ( isSubMenu && !! customOverlayTextColor ) {\n\t\tcolors.customTextColor = customOverlayTextColor;\n\t} else if ( isSubMenu && !! overlayTextColor ) {\n\t\tcolors.textColor = overlayTextColor;\n\t} else if ( !! customTextColor ) {\n\t\tcolors.customTextColor = customTextColor;\n\t} else if ( !! textColor ) {\n\t\tcolors.textColor = textColor;\n\t} else if ( !! style?.color?.text ) {\n\t\tcolors.customTextColor = style.color.text;\n\t}\n\n\tif ( isSubMenu && !! customOverlayBackgroundColor ) {\n\t\tcolors.customBackgroundColor = customOverlayBackgroundColor;\n\t} else if ( isSubMenu && !! overlayBackgroundColor ) {\n\t\tcolors.backgroundColor = overlayBackgroundColor;\n\t} else if ( !! customBackgroundColor ) {\n\t\tcolors.customBackgroundColor = customBackgroundColor;\n\t} else if ( !! backgroundColor ) {\n\t\tcolors.backgroundColor = backgroundColor;\n\t} else if ( !! style?.color?.background ) {\n\t\tcolors.customTextColor = style.color.background;\n\t}\n\n\treturn colors;\n}\n\n/**\n * @typedef {'post-type'|'custom'|'taxonomy'|'post-type-archive'} WPNavigationLinkKind\n */\n\n/**\n * Navigation Link Block Attributes\n *\n * @typedef {Object} WPNavigationLinkBlockAttributes\n *\n * @property {string} [label] Link text.\n * @property {WPNavigationLinkKind} [kind] Kind is used to differentiate between term and post ids to check post draft status.\n * @property {string} [type] The type such as post, page, tag, category and other custom types.\n * @property {string} [rel] The relationship of the linked URL.\n * @property {number} [id] A post or term id.\n * @property {boolean} [opensInNewTab] Sets link target to _blank when true.\n * @property {string} [url] Link href.\n * @property {string} [title] Link title attribute.\n */\n\n/**\n * Link Control onChange handler that updates block attributes when a setting is changed.\n *\n * @param {Object} updatedValue New block attributes to update.\n * @param {Function} setAttributes Block attribute update function.\n * @param {WPNavigationLinkBlockAttributes} blockAttributes Current block attributes.\n *\n */\nexport const updateNavigationLinkBlockAttributes = (\n\tupdatedValue = {},\n\tsetAttributes,\n\tblockAttributes = {}\n) => {\n\tconst {\n\t\tlabel: originalLabel = '',\n\t\tkind: originalKind = '',\n\t\ttype: originalType = '',\n\t} = blockAttributes;\n\n\tconst {\n\t\ttitle = '', // the title of any provided Post.\n\t\turl = '',\n\n\t\topensInNewTab,\n\t\tid,\n\t\tkind: newKind = originalKind,\n\t\ttype: newType = originalType,\n\t} = updatedValue;\n\tconst normalizedTitle = title.replace( /http(s?):\\/\\//gi, '' );\n\tconst normalizedURL = url.replace( /http(s?):\\/\\//gi, '' );\n\tconst escapeTitle =\n\t\ttitle !== '' &&\n\t\tnormalizedTitle !== normalizedURL &&\n\t\toriginalLabel !== title;\n\n\tconst label = escapeTitle\n\t\t? escape( title )\n\t\t: originalLabel || escape( normalizedURL );\n\n\t// In https://github.com/WordPress/gutenberg/pull/24670 we decided to use \"tag\" in favor of \"post_tag\"\n\tconst type = newType === 'post_tag' ? 'tag' : newType.replace( '-', '_' );\n\n\tconst isBuiltInType =\n\t\t[ 'post', 'page', 'tag', 'category' ].indexOf( type ) > -1;\n\n\tconst isCustomLink =\n\t\t( ! newKind && ! isBuiltInType ) || newKind === 'custom';\n\tconst kind = isCustomLink ? 'custom' : newKind;\n\n\tsetAttributes( {\n\t\t// Passed `url` may already be encoded. To prevent double encoding, decodeURI is executed to revert to the original string.\n\t\t...( url && { url: encodeURI( safeDecodeURI( url ) ) } ),\n\t\t...( label && { label } ),\n\t\t...( undefined !== opensInNewTab && { opensInNewTab } ),\n\t\t...( id && Number.isInteger( id ) && { id } ),\n\t\t...( kind && { kind } ),\n\t\t...( type && type !== 'URL' && { type } ),\n\t} );\n};\n\nconst useIsInvalidLink = ( kind, type, id ) => {\n\tconst isPostType =\n\t\tkind === 'post-type' || type === 'post' || type === 'page';\n\tconst hasId = Number.isInteger( id );\n\tconst postStatus = useSelect(\n\t\t( select ) => {\n\t\t\tif ( ! isPostType ) {\n\t\t\t\treturn null;\n\t\t\t}\n\t\t\tconst { getEntityRecord } = select( coreStore );\n\t\t\treturn getEntityRecord( 'postType', type, id )?.status;\n\t\t},\n\t\t[ isPostType, type, id ]\n\t);\n\n\t// Check Navigation Link validity if:\n\t// 1. Link is 'post-type'.\n\t// 2. It has an id.\n\t// 3. It's neither null, nor undefined, as valid items might be either of those while loading.\n\t// If those conditions are met, check if\n\t// 1. The post status is published.\n\t// 2. The Navigation Link item has no label.\n\t// If either of those is true, invalidate.\n\tconst isInvalid =\n\t\tisPostType && hasId && postStatus && 'trash' === postStatus;\n\tconst isDraft = 'draft' === postStatus;\n\n\treturn [ isInvalid, isDraft ];\n};\n\nconst useMissingText = ( type ) => {\n\tlet missingText = '';\n\n\tswitch ( type ) {\n\t\tcase 'post':\n\t\t\t/* translators: label for missing post in navigation link block */\n\t\t\tmissingText = __( 'Select post' );\n\t\t\tbreak;\n\t\tcase 'page':\n\t\t\t/* translators: label for missing page in navigation link block */\n\t\t\tmissingText = __( 'Select page' );\n\t\t\tbreak;\n\t\tcase 'category':\n\t\t\t/* translators: label for missing category in navigation link block */\n\t\t\tmissingText = __( 'Select category' );\n\t\t\tbreak;\n\t\tcase 'tag':\n\t\t\t/* translators: label for missing tag in navigation link block */\n\t\t\tmissingText = __( 'Select tag' );\n\t\t\tbreak;\n\t\tdefault:\n\t\t\t/* translators: label for missing values in navigation link block */\n\t\t\tmissingText = __( 'Add link' );\n\t}\n\n\treturn missingText;\n};\n\n/**\n * Removes HTML from a given string.\n * Note the does not provide XSS protection or otherwise attempt\n * to filter strings with malicious intent.\n *\n * See also: https://github.com/WordPress/gutenberg/pull/35539\n *\n * @param {string} html the string from which HTML should be removed.\n * @return {string} the \"cleaned\" string.\n */\nfunction navStripHTML( html ) {\n\tconst doc = document.implementation.createHTMLDocument( '' );\n\tdoc.body.innerHTML = html;\n\treturn doc.body.textContent || '';\n}\n\n/**\n * Add transforms to Link Control\n */\n\nfunction LinkControlTransforms( { block, transforms, replace } ) {\n\tif ( ! transforms?.length ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<div className=\"link-control-transform\">\n\t\t\t<h3 className=\"link-control-transform__subheading\">\n\t\t\t\t{ __( 'Transform' ) }\n\t\t\t</h3>\n\t\t\t<div className=\"link-control-transform__items\">\n\t\t\t\t{ transforms.map( ( item, index ) => {\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\tkey={ `transform-${ index }` }\n\t\t\t\t\t\t\tonClick={ () =>\n\t\t\t\t\t\t\t\treplace(\n\t\t\t\t\t\t\t\t\tblock.clientId,\n\t\t\t\t\t\t\t\t\tswitchToBlockType( block, item.name )\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tclassName=\"link-control-transform__item\"\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<BlockIcon icon={ item.icon } />\n\t\t\t\t\t\t\t{ item.title }\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t);\n\t\t\t\t} ) }\n\t\t\t</div>\n\t\t</div>\n\t);\n}\n\nexport default function NavigationLinkEdit( {\n\tattributes,\n\tisSelected,\n\tsetAttributes,\n\tinsertBlocksAfter,\n\tmergeBlocks,\n\tonReplace,\n\tcontext,\n\tclientId,\n} ) {\n\tconst {\n\t\tid,\n\t\tlabel,\n\t\ttype,\n\t\topensInNewTab,\n\t\turl,\n\t\tdescription,\n\t\trel,\n\t\ttitle,\n\t\tkind,\n\t} = attributes;\n\n\tconst [ isInvalid, isDraft ] = useIsInvalidLink( kind, type, id );\n\n\tconst link = {\n\t\turl,\n\t\topensInNewTab,\n\t\ttitle: label && navStripHTML( label ), // don't allow HTML to display inside the <LinkControl>\n\t};\n\tconst { saveEntityRecord } = useDispatch( coreStore );\n\tconst {\n\t\treplaceBlock,\n\t\t__unstableMarkNextChangeAsNotPersistent,\n\t} = useDispatch( blockEditorStore );\n\tconst [ isLinkOpen, setIsLinkOpen ] = useState( false );\n\tconst listItemRef = useRef( null );\n\tconst isDraggingWithin = useIsDraggingWithin( listItemRef );\n\tconst itemLabelPlaceholder = __( 'Add link…' );\n\tconst ref = useRef();\n\n\tconst {\n\t\tinnerBlocks,\n\t\tisAtMaxNesting,\n\t\tisTopLevelLink,\n\t\tisParentOfSelectedBlock,\n\t\thasDescendants,\n\t\tuserCanCreatePages,\n\t\tuserCanCreatePosts,\n\t\tthisBlock,\n\t\tblockTransforms,\n\t} = useSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\tgetBlock,\n\t\t\t\tgetBlocks,\n\t\t\t\tgetBlockName,\n\t\t\t\tgetBlockRootClientId,\n\t\t\t\tgetClientIdsOfDescendants,\n\t\t\t\thasSelectedInnerBlock,\n\t\t\t\tgetSelectedBlockClientId,\n\t\t\t\tgetBlockParentsByBlockName,\n\t\t\t\tgetBlockTransformItems,\n\t\t\t} = select( blockEditorStore );\n\n\t\t\tconst selectedBlockId = getSelectedBlockClientId();\n\n\t\t\tconst descendants = getClientIdsOfDescendants( [ clientId ] )\n\t\t\t\t.length;\n\n\t\t\treturn {\n\t\t\t\tinnerBlocks: getBlocks( clientId ),\n\t\t\t\tisAtMaxNesting:\n\t\t\t\t\tgetBlockParentsByBlockName( clientId, [\n\t\t\t\t\t\tname,\n\t\t\t\t\t\t'core/navigation-submenu',\n\t\t\t\t\t] ).length >= MAX_NESTING,\n\t\t\t\tisTopLevelLink:\n\t\t\t\t\tgetBlockName( getBlockRootClientId( clientId ) ) ===\n\t\t\t\t\t'core/navigation',\n\t\t\t\tisParentOfSelectedBlock: hasSelectedInnerBlock(\n\t\t\t\t\tclientId,\n\t\t\t\t\ttrue\n\t\t\t\t),\n\t\t\t\tisImmediateParentOfSelectedBlock: hasSelectedInnerBlock(\n\t\t\t\t\tclientId,\n\t\t\t\t\tfalse\n\t\t\t\t),\n\t\t\t\thasDescendants: !! descendants,\n\t\t\t\tselectedBlockHasDescendants: !! getClientIdsOfDescendants( [\n\t\t\t\t\tselectedBlockId,\n\t\t\t\t] )?.length,\n\t\t\t\tuserCanCreatePages: select( coreStore ).canUser(\n\t\t\t\t\t'create',\n\t\t\t\t\t'pages'\n\t\t\t\t),\n\t\t\t\tuserCanCreatePosts: select( coreStore ).canUser(\n\t\t\t\t\t'create',\n\t\t\t\t\t'posts'\n\t\t\t\t),\n\t\t\t\tthisBlock: getBlock( clientId ),\n\t\t\t\tblockTransforms: getBlockTransformItems(\n\t\t\t\t\t[ getBlock( clientId ) ],\n\t\t\t\t\tgetBlockRootClientId( clientId )\n\t\t\t\t),\n\t\t\t};\n\t\t},\n\t\t[ clientId ]\n\t);\n\n\tuseEffect( () => {\n\t\t// This side-effect should not create an undo level as those should\n\t\t// only be created via user interactions. Mark this change as\n\t\t// not persistent to avoid undo level creation.\n\t\t// See https://github.com/WordPress/gutenberg/issues/34564.\n\t\t__unstableMarkNextChangeAsNotPersistent();\n\t\tsetAttributes( { isTopLevelLink } );\n\t}, [ isTopLevelLink ] );\n\n\t/**\n\t * Transform to submenu block.\n\t */\n\tfunction transformToSubmenu() {\n\t\tconst newSubmenu = createBlock(\n\t\t\t'core/navigation-submenu',\n\t\t\tattributes,\n\t\t\tinnerBlocks\n\t\t);\n\t\treplaceBlock( clientId, newSubmenu );\n\t}\n\n\tconst featuredBlocks = [\n\t\t'core/site-logo',\n\t\t'core/social-links',\n\t\t'core/search',\n\t];\n\tconst featuredTransforms = blockTransforms.filter( ( item ) => {\n\t\treturn featuredBlocks.includes( item.name );\n\t} );\n\n\tuseEffect( () => {\n\t\t// Show the LinkControl on mount if the URL is empty\n\t\t// ( When adding a new menu item)\n\t\t// This can't be done in the useState call because it conflicts\n\t\t// with the autofocus behavior of the BlockListBlock component.\n\t\tif ( ! url ) {\n\t\t\tsetIsLinkOpen( true );\n\t\t}\n\t\t// If block has inner blocks, transform to Submenu.\n\t\tif ( hasDescendants ) {\n\t\t\ttransformToSubmenu();\n\t\t}\n\t}, [] );\n\n\t/**\n\t * The hook shouldn't be necessary but due to a focus loss happening\n\t * when selecting a suggestion in the link popover, we force close on block unselection.\n\t */\n\tuseEffect( () => {\n\t\tif ( ! isSelected ) {\n\t\t\tsetIsLinkOpen( false );\n\t\t}\n\t}, [ isSelected ] );\n\n\t// If the LinkControl popover is open and the URL has changed, close the LinkControl and focus the label text.\n\tuseEffect( () => {\n\t\tif ( isLinkOpen && url ) {\n\t\t\t// Does this look like a URL and have something TLD-ish?\n\t\t\tif (\n\t\t\t\tisURL( prependHTTP( label ) ) &&\n\t\t\t\t/^.+\\.[a-z]+/.test( label )\n\t\t\t) {\n\t\t\t\t// Focus and select the label text.\n\t\t\t\tselectLabelText();\n\t\t\t} else {\n\t\t\t\t// Focus it (but do not select).\n\t\t\t\tplaceCaretAtHorizontalEdge( ref.current, true );\n\t\t\t}\n\t\t}\n\t}, [ url ] );\n\n\t/**\n\t * Focus the Link label text and select it.\n\t */\n\tfunction selectLabelText() {\n\t\tref.current.focus();\n\t\tconst { ownerDocument } = ref.current;\n\t\tconst { defaultView } = ownerDocument;\n\t\tconst selection = defaultView.getSelection();\n\t\tconst range = ownerDocument.createRange();\n\t\t// Get the range of the current ref contents so we can add this range to the selection.\n\t\trange.selectNodeContents( ref.current );\n\t\tselection.removeAllRanges();\n\t\tselection.addRange( range );\n\t}\n\n\t/**\n\t * Removes the current link if set.\n\t */\n\tfunction removeLink() {\n\t\t// Reset all attributes that comprise the link.\n\t\tsetAttributes( {\n\t\t\turl: '',\n\t\t\tlabel: '',\n\t\t\tid: '',\n\t\t\tkind: '',\n\t\t\ttype: '',\n\t\t} );\n\n\t\t// Close the link editing UI.\n\t\tsetIsLinkOpen( false );\n\t}\n\n\tlet userCanCreate = false;\n\tif ( ! type || type === 'page' ) {\n\t\tuserCanCreate = userCanCreatePages;\n\t} else if ( type === 'post' ) {\n\t\tuserCanCreate = userCanCreatePosts;\n\t}\n\n\tasync function handleCreate( pageTitle ) {\n\t\tconst postType = type || 'page';\n\n\t\tconst page = await saveEntityRecord( 'postType', postType, {\n\t\t\ttitle: pageTitle,\n\t\t\tstatus: 'draft',\n\t\t} );\n\n\t\treturn {\n\t\t\tid: page.id,\n\t\t\ttype: postType,\n\t\t\ttitle: page.title.rendered,\n\t\t\turl: page.link,\n\t\t\tkind: 'post-type',\n\t\t};\n\t}\n\n\tconst {\n\t\ttextColor,\n\t\tcustomTextColor,\n\t\tbackgroundColor,\n\t\tcustomBackgroundColor,\n\t} = getColors( context, ! isTopLevelLink );\n\n\tfunction onKeyDown( event ) {\n\t\tif (\n\t\t\tisKeyboardEvent.primary( event, 'k' ) ||\n\t\t\t( ! url && event.keyCode === ENTER )\n\t\t) {\n\t\t\tsetIsLinkOpen( true );\n\t\t}\n\t}\n\n\tconst blockProps = useBlockProps( {\n\t\tref: listItemRef,\n\t\tclassName: classnames( 'wp-block-navigation-item', {\n\t\t\t'is-editing': isSelected || isParentOfSelectedBlock,\n\t\t\t'is-dragging-within': isDraggingWithin,\n\t\t\t'has-link': !! url,\n\t\t\t'has-child': hasDescendants,\n\t\t\t'has-text-color': !! textColor || !! customTextColor,\n\t\t\t[ getColorClassName( 'color', textColor ) ]: !! textColor,\n\t\t\t'has-background': !! backgroundColor || customBackgroundColor,\n\t\t\t[ getColorClassName(\n\t\t\t\t'background-color',\n\t\t\t\tbackgroundColor\n\t\t\t) ]: !! backgroundColor,\n\t\t} ),\n\t\tstyle: {\n\t\t\tcolor: ! textColor && customTextColor,\n\t\t\tbackgroundColor: ! backgroundColor && customBackgroundColor,\n\t\t},\n\t\tonKeyDown,\n\t} );\n\n\tif ( ! url || isInvalid || isDraft ) {\n\t\tblockProps.onClick = () => setIsLinkOpen( true );\n\t}\n\n\tconst classes = classnames( 'wp-block-navigation-item__content', {\n\t\t'wp-block-navigation-link__placeholder': ! url || isInvalid || isDraft,\n\t} );\n\n\tconst missingText = useMissingText( type, isInvalid, isDraft );\n\t/* translators: Whether the navigation link is Invalid or a Draft. */\n\tconst placeholderText = `(${\n\t\tisInvalid ? __( 'Invalid' ) : __( 'Draft' )\n\t})`;\n\tconst tooltipText =\n\t\tisInvalid || isDraft\n\t\t\t? __( 'This item has been deleted, or is a draft' )\n\t\t\t: __( 'This item is missing a link' );\n\n\treturn (\n\t\t<Fragment>\n\t\t\t<BlockControls>\n\t\t\t\t<ToolbarGroup>\n\t\t\t\t\t<ToolbarButton\n\t\t\t\t\t\tname=\"link\"\n\t\t\t\t\t\ticon={ linkIcon }\n\t\t\t\t\t\ttitle={ __( 'Link' ) }\n\t\t\t\t\t\tshortcut={ displayShortcut.primary( 'k' ) }\n\t\t\t\t\t\tonClick={ () => setIsLinkOpen( true ) }\n\t\t\t\t\t/>\n\t\t\t\t\t{ ! isAtMaxNesting && (\n\t\t\t\t\t\t<ToolbarButton\n\t\t\t\t\t\t\tname=\"submenu\"\n\t\t\t\t\t\t\ticon={ addSubmenu }\n\t\t\t\t\t\t\ttitle={ __( 'Add submenu' ) }\n\t\t\t\t\t\t\tonClick={ transformToSubmenu }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t</ToolbarGroup>\n\t\t\t</BlockControls>\n\t\t\t<InspectorControls>\n\t\t\t\t<PanelBody title={ __( 'Link settings' ) }>\n\t\t\t\t\t<TextareaControl\n\t\t\t\t\t\tvalue={ description || '' }\n\t\t\t\t\t\tonChange={ ( descriptionValue ) => {\n\t\t\t\t\t\t\tsetAttributes( { description: descriptionValue } );\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tlabel={ __( 'Description' ) }\n\t\t\t\t\t\thelp={ __(\n\t\t\t\t\t\t\t'The description will be displayed in the menu if the current theme supports it.'\n\t\t\t\t\t\t) }\n\t\t\t\t\t/>\n\t\t\t\t\t<TextControl\n\t\t\t\t\t\tvalue={ title || '' }\n\t\t\t\t\t\tonChange={ ( titleValue ) => {\n\t\t\t\t\t\t\tsetAttributes( { title: titleValue } );\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tlabel={ __( 'Link title' ) }\n\t\t\t\t\t\tautoComplete=\"off\"\n\t\t\t\t\t/>\n\t\t\t\t\t<TextControl\n\t\t\t\t\t\tvalue={ rel || '' }\n\t\t\t\t\t\tonChange={ ( relValue ) => {\n\t\t\t\t\t\t\tsetAttributes( { rel: relValue } );\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tlabel={ __( 'Link rel' ) }\n\t\t\t\t\t\tautoComplete=\"off\"\n\t\t\t\t\t/>\n\t\t\t\t</PanelBody>\n\t\t\t</InspectorControls>\n\t\t\t<div { ...blockProps }>\n\t\t\t\t{ /* eslint-disable jsx-a11y/anchor-is-valid */ }\n\t\t\t\t<a className={ classes }>\n\t\t\t\t\t{ /* eslint-enable */ }\n\t\t\t\t\t{ ! url ? (\n\t\t\t\t\t\t<div className=\"wp-block-navigation-link__placeholder-text\">\n\t\t\t\t\t\t\t<Tooltip position=\"top center\" text={ tooltipText }>\n\t\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t\t<span>{ missingText }</span>\n\t\t\t\t\t\t\t\t\t<span className=\"wp-block-navigation-link__missing_text-tooltip\">\n\t\t\t\t\t\t\t\t\t\t{ tooltipText }\n\t\t\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t\t</>\n\t\t\t\t\t\t\t</Tooltip>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t) : (\n\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t{ ! isInvalid && ! isDraft && (\n\t\t\t\t\t\t\t\t<RichText\n\t\t\t\t\t\t\t\t\tref={ ref }\n\t\t\t\t\t\t\t\t\tidentifier=\"label\"\n\t\t\t\t\t\t\t\t\tclassName=\"wp-block-navigation-item__label\"\n\t\t\t\t\t\t\t\t\tvalue={ label }\n\t\t\t\t\t\t\t\t\tonChange={ ( labelValue ) =>\n\t\t\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\t\t\tlabel: labelValue,\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\tonMerge={ mergeBlocks }\n\t\t\t\t\t\t\t\t\tonReplace={ onReplace }\n\t\t\t\t\t\t\t\t\t__unstableOnSplitAtEnd={ () =>\n\t\t\t\t\t\t\t\t\t\tinsertBlocksAfter(\n\t\t\t\t\t\t\t\t\t\t\tcreateBlock(\n\t\t\t\t\t\t\t\t\t\t\t\t'core/navigation-link'\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\taria-label={ __( 'Navigation link text' ) }\n\t\t\t\t\t\t\t\t\tplaceholder={ itemLabelPlaceholder }\n\t\t\t\t\t\t\t\t\twithoutInteractiveFormatting\n\t\t\t\t\t\t\t\t\tallowedFormats={ [\n\t\t\t\t\t\t\t\t\t\t'core/bold',\n\t\t\t\t\t\t\t\t\t\t'core/italic',\n\t\t\t\t\t\t\t\t\t\t'core/image',\n\t\t\t\t\t\t\t\t\t\t'core/strikethrough',\n\t\t\t\t\t\t\t\t\t] }\n\t\t\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\t\t\tif ( ! url ) {\n\t\t\t\t\t\t\t\t\t\t\tsetIsLinkOpen( true );\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\t{ ( isInvalid || isDraft ) && (\n\t\t\t\t\t\t\t\t<div className=\"wp-block-navigation-link__placeholder-text wp-block-navigation-link__label\">\n\t\t\t\t\t\t\t\t\t<KeyboardShortcuts\n\t\t\t\t\t\t\t\t\t\tshortcuts={ {\n\t\t\t\t\t\t\t\t\t\t\tenter: () =>\n\t\t\t\t\t\t\t\t\t\t\t\tisSelected &&\n\t\t\t\t\t\t\t\t\t\t\t\tsetIsLinkOpen( true ),\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\t<Tooltip\n\t\t\t\t\t\t\t\t\t\tposition=\"top center\"\n\t\t\t\t\t\t\t\t\t\ttext={ tooltipText }\n\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<span>\n\t\t\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\t\t/* Trim to avoid trailing white space when the placeholder text is not present */\n\t\t\t\t\t\t\t\t\t\t\t\t\t`${ label } ${ placeholderText }`.trim()\n\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t\t\t\t\t<span className=\"wp-block-navigation-link__missing_text-tooltip\">\n\t\t\t\t\t\t\t\t\t\t\t\t{ tooltipText }\n\t\t\t\t\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t\t\t\t</>\n\t\t\t\t\t\t\t\t\t</Tooltip>\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</>\n\t\t\t\t\t) }\n\t\t\t\t\t{ isLinkOpen && (\n\t\t\t\t\t\t<Popover\n\t\t\t\t\t\t\tposition=\"bottom center\"\n\t\t\t\t\t\t\tonClose={ () => setIsLinkOpen( false ) }\n\t\t\t\t\t\t\tanchorRef={ listItemRef.current }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<LinkControl\n\t\t\t\t\t\t\t\thasTextControl\n\t\t\t\t\t\t\t\thasRichPreviews\n\t\t\t\t\t\t\t\tclassName=\"wp-block-navigation-link__inline-link-input\"\n\t\t\t\t\t\t\t\tvalue={ link }\n\t\t\t\t\t\t\t\tshowInitialSuggestions={ true }\n\t\t\t\t\t\t\t\twithCreateSuggestion={ userCanCreate }\n\t\t\t\t\t\t\t\tcreateSuggestion={ handleCreate }\n\t\t\t\t\t\t\t\tcreateSuggestionButtonText={ ( searchTerm ) => {\n\t\t\t\t\t\t\t\t\tlet format;\n\t\t\t\t\t\t\t\t\tif ( type === 'post' ) {\n\t\t\t\t\t\t\t\t\t\t/* translators: %s: search term. */\n\t\t\t\t\t\t\t\t\t\tformat = __(\n\t\t\t\t\t\t\t\t\t\t\t'Create draft post: <mark>%s</mark>'\n\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\t\t/* translators: %s: search term. */\n\t\t\t\t\t\t\t\t\t\tformat = __(\n\t\t\t\t\t\t\t\t\t\t\t'Create draft page: <mark>%s</mark>'\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\treturn createInterpolateElement(\n\t\t\t\t\t\t\t\t\t\tsprintf( format, searchTerm ),\n\t\t\t\t\t\t\t\t\t\t{ mark: <mark /> }\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\tnoDirectEntry={ !! type }\n\t\t\t\t\t\t\t\tnoURLSuggestion={ !! type }\n\t\t\t\t\t\t\t\tsuggestionsQuery={ getSuggestionsQuery(\n\t\t\t\t\t\t\t\t\ttype,\n\t\t\t\t\t\t\t\t\tkind\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\tonChange={ ( updatedValue ) =>\n\t\t\t\t\t\t\t\t\tupdateNavigationLinkBlockAttributes(\n\t\t\t\t\t\t\t\t\t\tupdatedValue,\n\t\t\t\t\t\t\t\t\t\tsetAttributes,\n\t\t\t\t\t\t\t\t\t\tattributes\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\tonRemove={ removeLink }\n\t\t\t\t\t\t\t\trenderControlBottom={\n\t\t\t\t\t\t\t\t\t! url\n\t\t\t\t\t\t\t\t\t\t? () => (\n\t\t\t\t\t\t\t\t\t\t\t\t<LinkControlTransforms\n\t\t\t\t\t\t\t\t\t\t\t\t\tblock={ thisBlock }\n\t\t\t\t\t\t\t\t\t\t\t\t\ttransforms={\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tfeaturedTransforms\n\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t\treplace={ replaceBlock }\n\t\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: null\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</Popover>\n\t\t\t\t\t) }\n\t\t\t\t</a>\n\t\t\t</div>\n\t\t</Fragment>\n\t);\n}\n"]}
|
package/build/post-date/edit.js
CHANGED
|
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
8
|
exports.default = PostDateEdit;
|
|
9
|
+
exports.is12HourFormat = is12HourFormat;
|
|
9
10
|
|
|
10
11
|
var _element = require("@wordpress/element");
|
|
11
12
|
|
|
@@ -25,6 +26,8 @@ var _icons = require("@wordpress/icons");
|
|
|
25
26
|
|
|
26
27
|
var _keycodes = require("@wordpress/keycodes");
|
|
27
28
|
|
|
29
|
+
var _data = require("@wordpress/data");
|
|
30
|
+
|
|
28
31
|
/**
|
|
29
32
|
* External dependencies
|
|
30
33
|
*/
|
|
@@ -41,36 +44,27 @@ function PostDateEdit(_ref) {
|
|
|
41
44
|
},
|
|
42
45
|
context: {
|
|
43
46
|
postId,
|
|
44
|
-
postType,
|
|
47
|
+
postType: postTypeSlug,
|
|
45
48
|
queryId
|
|
46
49
|
},
|
|
47
50
|
setAttributes
|
|
48
51
|
} = _ref;
|
|
49
|
-
const isDescendentOfQueryLoop = Number.isFinite(queryId);
|
|
50
|
-
const [siteFormat] = (0, _coreData.useEntityProp)('root', 'site', 'date_format');
|
|
51
|
-
const [date, setDate] = (0, _coreData.useEntityProp)('postType', postType, 'date', postId);
|
|
52
|
-
const settings = (0, _date.__experimentalGetSettings)(); // To know if the current time format is a 12 hour time, look for "a".
|
|
53
|
-
// Also make sure this "a" is not escaped by a "/".
|
|
54
|
-
|
|
55
|
-
const is12Hour = /a(?!\\)/i.test(settings.formats.time.toLowerCase() // Test only for the lower case "a".
|
|
56
|
-
.replace(/\\\\/g, '') // Replace "//" with empty strings.
|
|
57
|
-
.split('').reverse().join('') // Reverse the string and test for "a" not followed by a slash.
|
|
58
|
-
);
|
|
59
|
-
const formatOptions = Object.values(settings.formats).map(formatOption => ({
|
|
60
|
-
key: formatOption,
|
|
61
|
-
name: (0, _date.dateI18n)(formatOption, date)
|
|
62
|
-
}));
|
|
63
|
-
const resolvedFormat = format || siteFormat || settings.formats.date;
|
|
64
52
|
const blockProps = (0, _blockEditor.useBlockProps)({
|
|
65
53
|
className: (0, _classnames.default)({
|
|
66
54
|
[`has-text-align-${textAlign}`]: textAlign
|
|
67
55
|
})
|
|
68
56
|
});
|
|
69
57
|
const timeRef = (0, _element.useRef)();
|
|
58
|
+
const isDescendentOfQueryLoop = Number.isFinite(queryId);
|
|
59
|
+
const dateSettings = (0, _date.__experimentalGetSettings)();
|
|
60
|
+
const [siteFormat = dateSettings.formats.date] = (0, _coreData.useEntityProp)('root', 'site', 'date_format');
|
|
61
|
+
const [siteTimeFormat = dateSettings.formats.time] = (0, _coreData.useEntityProp)('root', 'site', 'time_format');
|
|
62
|
+
const [date, setDate] = (0, _coreData.useEntityProp)('postType', postTypeSlug, 'date', postId);
|
|
63
|
+
const postType = (0, _data.useSelect)(select => postTypeSlug ? select(_coreData.store).getPostType(postTypeSlug) : null, [postTypeSlug]);
|
|
70
64
|
let postDate = date ? (0, _element.createElement)("time", {
|
|
71
65
|
dateTime: (0, _date.dateI18n)('c', date),
|
|
72
66
|
ref: timeRef
|
|
73
|
-
}, (0, _date.dateI18n)(
|
|
67
|
+
}, (0, _date.dateI18n)(format || siteFormat, date)) : (0, _i18n.__)('Post Date');
|
|
74
68
|
|
|
75
69
|
if (isLink && date) {
|
|
76
70
|
postDate = (0, _element.createElement)("a", {
|
|
@@ -95,7 +89,7 @@ function PostDateEdit(_ref) {
|
|
|
95
89
|
renderContent: () => (0, _element.createElement)(_components.DateTimePicker, {
|
|
96
90
|
currentDate: date,
|
|
97
91
|
onChange: setDate,
|
|
98
|
-
is12Hour:
|
|
92
|
+
is12Hour: is12HourFormat(siteTimeFormat)
|
|
99
93
|
}),
|
|
100
94
|
renderToggle: _ref2 => {
|
|
101
95
|
let {
|
|
@@ -119,29 +113,29 @@ function PostDateEdit(_ref) {
|
|
|
119
113
|
});
|
|
120
114
|
}
|
|
121
115
|
}))), (0, _element.createElement)(_blockEditor.InspectorControls, null, (0, _element.createElement)(_components.PanelBody, {
|
|
122
|
-
title: (0, _i18n.__)('
|
|
123
|
-
}, (0, _element.createElement)(
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
format: selectedItem.key
|
|
133
|
-
});
|
|
134
|
-
},
|
|
135
|
-
value: formatOptions.find(option => option.key === resolvedFormat)
|
|
136
|
-
})), (0, _element.createElement)(_components.PanelBody, {
|
|
137
|
-
title: (0, _i18n.__)('Link settings')
|
|
138
|
-
}, (0, _element.createElement)(_components.ToggleControl, {
|
|
139
|
-
label: (0, _i18n.sprintf)( // translators: %s: Name of the post type e.g: "post".
|
|
140
|
-
(0, _i18n.__)('Link to %s'), postType),
|
|
116
|
+
title: (0, _i18n.__)('Settings')
|
|
117
|
+
}, (0, _element.createElement)(_blockEditor.__experimentalDateFormatPicker, {
|
|
118
|
+
format: format,
|
|
119
|
+
defaultFormat: siteFormat,
|
|
120
|
+
onChange: nextFormat => setAttributes({
|
|
121
|
+
format: nextFormat
|
|
122
|
+
})
|
|
123
|
+
}), (0, _element.createElement)(_components.ToggleControl, {
|
|
124
|
+
label: postType !== null && postType !== void 0 && postType.labels.singular_name ? (0, _i18n.sprintf)( // translators: %s: Name of the post type e.g: "post".
|
|
125
|
+
(0, _i18n.__)('Link to %s'), postType.labels.singular_name.toLowerCase()) : (0, _i18n.__)('Link to post'),
|
|
141
126
|
onChange: () => setAttributes({
|
|
142
127
|
isLink: !isLink
|
|
143
128
|
}),
|
|
144
129
|
checked: isLink
|
|
145
130
|
}))), (0, _element.createElement)("div", blockProps, postDate));
|
|
146
131
|
}
|
|
132
|
+
|
|
133
|
+
function is12HourFormat(format) {
|
|
134
|
+
// To know if the time format is a 12 hour time, look for any of the 12 hour
|
|
135
|
+
// format characters: 'a', 'A', 'g', and 'h'. The character must be
|
|
136
|
+
// unescaped, i.e. not preceded by a '\'. Coincidentally, 'aAgh' is how I
|
|
137
|
+
// feel when working with regular expressions.
|
|
138
|
+
// https://www.php.net/manual/en/datetime.format.php
|
|
139
|
+
return /(?:^|[^\\])[aAgh]/.test(format);
|
|
140
|
+
}
|
|
147
141
|
//# sourceMappingURL=edit.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-library/src/post-date/edit.js"],"names":["PostDateEdit","attributes","textAlign","format","isLink","context","postId","postType","
|
|
1
|
+
{"version":3,"sources":["@wordpress/block-library/src/post-date/edit.js"],"names":["PostDateEdit","attributes","textAlign","format","isLink","context","postId","postType","postTypeSlug","queryId","setAttributes","blockProps","className","timeRef","isDescendentOfQueryLoop","Number","isFinite","dateSettings","siteFormat","formats","date","siteTimeFormat","time","setDate","select","coreStore","getPostType","postDate","event","preventDefault","nextAlign","anchorRef","current","is12HourFormat","isOpen","onToggle","openOnArrowDown","keyCode","DOWN","edit","nextFormat","labels","singular_name","toLowerCase","test"],"mappings":";;;;;;;;;;AASA;;A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AAGK,WAFR;AAGC,QAAA,KAAK,EAAG,cAAI,aAAJ,CAHT;AAIC,QAAA,OAAO,EAAGJ,QAJX;AAKC,QAAA,SAAS,EAAGC;AALb,QADD;AASA;AA3BF,IADD,CARF,CADD,EA2CC,4BAAC,8BAAD,QACC,4BAAC,qBAAD;AAAW,IAAA,KAAK,EAAG,cAAI,UAAJ;AAAnB,KACC,4BAAC,2CAAD;AACC,IAAA,MAAM,EAAGjC,MADV;AAEC,IAAA,aAAa,EAAGe,UAFjB;AAGC,IAAA,QAAQ,EAAKsB,UAAF,IACV9B,aAAa,CAAE;AAAEP,MAAAA,MAAM,EAAEqC;AAAV,KAAF;AAJf,IADD,EAQC,4BAAC,yBAAD;AACC,IAAA,KAAK,EACJjC,QAAQ,SAAR,IAAAA,QAAQ,WAAR,IAAAA,QAAQ,CAAEkC,MAAV,CAAiBC,aAAjB,GACG,oBACA;AACA,kBAAI,YAAJ,CAFA,EAGAnC,QAAQ,CAACkC,MAAT,CAAgBC,aAAhB,CAA8BC,WAA9B,EAHA,CADH,GAMG,cAAI,cAAJ,CARL;AAUC,IAAA,QAAQ,EAAG,MAAMjC,aAAa,CAAE;AAAEN,MAAAA,MAAM,EAAE,CAAEA;AAAZ,KAAF,CAV/B;AAWC,IAAA,OAAO,EAAGA;AAXX,IARD,CADD,CA3CD,EAoEC,mCAAUO,UAAV,EAAyBgB,QAAzB,CApED,CADD;AAwEA;;AAEM,SAASM,cAAT,CAAyB9B,MAAzB,EAAkC;AACxC;AACA;AACA;AACA;AACA;AACA,SAAO,oBAAoByC,IAApB,CAA0BzC,MAA1B,CAAP;AACA","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { useEntityProp, store as coreStore } from '@wordpress/core-data';\nimport { useRef } from '@wordpress/element';\nimport {\n\tdateI18n,\n\t__experimentalGetSettings as getDateSettings,\n} from '@wordpress/date';\nimport {\n\tAlignmentControl,\n\tBlockControls,\n\tInspectorControls,\n\tuseBlockProps,\n\t__experimentalDateFormatPicker as DateFormatPicker,\n} from '@wordpress/block-editor';\nimport {\n\tDropdown,\n\tToolbarGroup,\n\tToolbarButton,\n\tToggleControl,\n\tDateTimePicker,\n\tPanelBody,\n} from '@wordpress/components';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { edit } from '@wordpress/icons';\nimport { DOWN } from '@wordpress/keycodes';\nimport { useSelect } from '@wordpress/data';\n\nexport default function PostDateEdit( {\n\tattributes: { textAlign, format, isLink },\n\tcontext: { postId, postType: postTypeSlug, queryId },\n\tsetAttributes,\n} ) {\n\tconst blockProps = useBlockProps( {\n\t\tclassName: classnames( {\n\t\t\t[ `has-text-align-${ textAlign }` ]: textAlign,\n\t\t} ),\n\t} );\n\tconst timeRef = useRef();\n\tconst isDescendentOfQueryLoop = Number.isFinite( queryId );\n\tconst dateSettings = getDateSettings();\n\tconst [ siteFormat = dateSettings.formats.date ] = useEntityProp(\n\t\t'root',\n\t\t'site',\n\t\t'date_format'\n\t);\n\tconst [ siteTimeFormat = dateSettings.formats.time ] = useEntityProp(\n\t\t'root',\n\t\t'site',\n\t\t'time_format'\n\t);\n\tconst [ date, setDate ] = useEntityProp(\n\t\t'postType',\n\t\tpostTypeSlug,\n\t\t'date',\n\t\tpostId\n\t);\n\tconst postType = useSelect(\n\t\t( select ) =>\n\t\t\tpostTypeSlug\n\t\t\t\t? select( coreStore ).getPostType( postTypeSlug )\n\t\t\t\t: null,\n\t\t[ postTypeSlug ]\n\t);\n\n\tlet postDate = date ? (\n\t\t<time dateTime={ dateI18n( 'c', date ) } ref={ timeRef }>\n\t\t\t{ dateI18n( format || siteFormat, date ) }\n\t\t</time>\n\t) : (\n\t\t__( 'Post Date' )\n\t);\n\n\tif ( isLink && date ) {\n\t\tpostDate = (\n\t\t\t<a\n\t\t\t\thref=\"#post-date-pseudo-link\"\n\t\t\t\tonClick={ ( event ) => event.preventDefault() }\n\t\t\t>\n\t\t\t\t{ postDate }\n\t\t\t</a>\n\t\t);\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t<BlockControls group=\"block\">\n\t\t\t\t<AlignmentControl\n\t\t\t\t\tvalue={ textAlign }\n\t\t\t\t\tonChange={ ( nextAlign ) => {\n\t\t\t\t\t\tsetAttributes( { textAlign: nextAlign } );\n\t\t\t\t\t} }\n\t\t\t\t/>\n\t\t\t\t{ date && ! isDescendentOfQueryLoop && (\n\t\t\t\t\t<ToolbarGroup>\n\t\t\t\t\t\t<Dropdown\n\t\t\t\t\t\t\tpopoverProps={ { anchorRef: timeRef.current } }\n\t\t\t\t\t\t\trenderContent={ () => (\n\t\t\t\t\t\t\t\t<DateTimePicker\n\t\t\t\t\t\t\t\t\tcurrentDate={ date }\n\t\t\t\t\t\t\t\t\tonChange={ setDate }\n\t\t\t\t\t\t\t\t\tis12Hour={ is12HourFormat(\n\t\t\t\t\t\t\t\t\t\tsiteTimeFormat\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\trenderToggle={ ( { isOpen, onToggle } ) => {\n\t\t\t\t\t\t\t\tconst openOnArrowDown = ( event ) => {\n\t\t\t\t\t\t\t\t\tif ( ! isOpen && event.keyCode === DOWN ) {\n\t\t\t\t\t\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\t\t\t\t\t\tonToggle();\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\treturn (\n\t\t\t\t\t\t\t\t\t<ToolbarButton\n\t\t\t\t\t\t\t\t\t\taria-expanded={ isOpen }\n\t\t\t\t\t\t\t\t\t\ticon={ edit }\n\t\t\t\t\t\t\t\t\t\ttitle={ __( 'Change Date' ) }\n\t\t\t\t\t\t\t\t\t\tonClick={ onToggle }\n\t\t\t\t\t\t\t\t\t\tonKeyDown={ openOnArrowDown }\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</ToolbarGroup>\n\t\t\t\t) }\n\t\t\t</BlockControls>\n\n\t\t\t<InspectorControls>\n\t\t\t\t<PanelBody title={ __( 'Settings' ) }>\n\t\t\t\t\t<DateFormatPicker\n\t\t\t\t\t\tformat={ format }\n\t\t\t\t\t\tdefaultFormat={ siteFormat }\n\t\t\t\t\t\tonChange={ ( nextFormat ) =>\n\t\t\t\t\t\t\tsetAttributes( { format: nextFormat } )\n\t\t\t\t\t\t}\n\t\t\t\t\t/>\n\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\tlabel={\n\t\t\t\t\t\t\tpostType?.labels.singular_name\n\t\t\t\t\t\t\t\t? sprintf(\n\t\t\t\t\t\t\t\t\t\t// translators: %s: Name of the post type e.g: \"post\".\n\t\t\t\t\t\t\t\t\t\t__( 'Link to %s' ),\n\t\t\t\t\t\t\t\t\t\tpostType.labels.singular_name.toLowerCase()\n\t\t\t\t\t\t\t\t )\n\t\t\t\t\t\t\t\t: __( 'Link to post' )\n\t\t\t\t\t\t}\n\t\t\t\t\t\tonChange={ () => setAttributes( { isLink: ! isLink } ) }\n\t\t\t\t\t\tchecked={ isLink }\n\t\t\t\t\t/>\n\t\t\t\t</PanelBody>\n\t\t\t</InspectorControls>\n\n\t\t\t<div { ...blockProps }>{ postDate }</div>\n\t\t</>\n\t);\n}\n\nexport function is12HourFormat( format ) {\n\t// To know if the time format is a 12 hour time, look for any of the 12 hour\n\t// format characters: 'a', 'A', 'g', and 'h'. The character must be\n\t// unescaped, i.e. not preceded by a '\\'. Coincidentally, 'aAgh' is how I\n\t// feel when working with regular expressions.\n\t// https://www.php.net/manual/en/datetime.format.php\n\treturn /(?:^|[^\\\\])[aAgh]/.test( format );\n}\n"]}
|
|
@@ -176,7 +176,8 @@ function PostFeaturedImageDisplay(_ref) {
|
|
|
176
176
|
// We have a Featured image so show a Placeholder if is loading.
|
|
177
177
|
image = !media ? placeholderChip : (0, _element.createElement)("img", {
|
|
178
178
|
src: mediaUrl,
|
|
179
|
-
alt: media.alt_text
|
|
179
|
+
alt: media.alt_text ? (0, _i18n.sprintf)( // translators: %s: The image's alt text.
|
|
180
|
+
(0, _i18n.__)('Featured image: %s'), media.alt_text) : (0, _i18n.__)('Featured image'),
|
|
180
181
|
style: {
|
|
181
182
|
height,
|
|
182
183
|
objectFit: height && scale
|