@wordpress/block-library 7.0.1 → 7.0.2
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/README.md +16 -0
- package/build/button/edit.native.js +2 -2
- package/build/button/edit.native.js.map +1 -1
- package/build/columns/index.js +12 -0
- package/build/columns/index.js.map +1 -1
- package/build/comment-author-avatar/edit.js +17 -4
- package/build/comment-author-avatar/edit.js.map +1 -1
- package/build/comment-template/edit.js +94 -36
- package/build/comment-template/edit.js.map +1 -1
- package/build/comment-template/hooks.js +175 -0
- package/build/comment-template/hooks.js.map +1 -0
- package/build/comment-template/index.js +1 -1
- package/build/comment-template/util.js.map +1 -1
- package/build/comments-pagination-next/index.js +1 -1
- package/build/comments-pagination-numbers/index.js +1 -1
- package/build/comments-query-loop/edit/comments-inspector-controls.js +20 -9
- package/build/comments-query-loop/edit/comments-inspector-controls.js.map +1 -1
- package/build/comments-query-loop/edit.js +1 -19
- package/build/comments-query-loop/edit.js.map +1 -1
- package/build/comments-query-loop/index.js +5 -0
- package/build/comments-query-loop/index.js.map +1 -1
- package/build/cover/edit.js +21 -22
- package/build/cover/edit.js.map +1 -1
- package/build/cover/edit.native.js +7 -5
- package/build/cover/edit.native.js.map +1 -1
- package/build/cover/overlay-color-settings.native.js +4 -3
- package/build/cover/overlay-color-settings.native.js.map +1 -1
- package/build/cover/transforms.js +4 -2
- package/build/cover/transforms.js.map +1 -1
- package/build/group/index.js +1 -0
- package/build/group/index.js.map +1 -1
- package/build/heading/edit.js +14 -2
- package/build/heading/edit.js.map +1 -1
- package/build/image/deprecated.js +89 -5
- package/build/image/deprecated.js.map +1 -1
- package/build/image/save.js +0 -7
- package/build/image/save.js.map +1 -1
- package/build/latest-posts/edit.js +1 -0
- package/build/latest-posts/edit.js.map +1 -1
- package/build/navigation/edit/index.js +17 -15
- package/build/navigation/edit/index.js.map +1 -1
- package/build/navigation/edit/navigation-menu-selector.js +44 -27
- package/build/navigation/edit/navigation-menu-selector.js.map +1 -1
- package/build/navigation/edit/placeholder/index.js +8 -22
- package/build/navigation/edit/placeholder/index.js.map +1 -1
- package/build/navigation/use-navigation-menu.js +6 -6
- package/build/navigation/use-navigation-menu.js.map +1 -1
- package/build/navigation-submenu/edit.js +41 -9
- package/build/navigation-submenu/edit.js.map +1 -1
- package/build/page-list/edit.js +11 -17
- package/build/page-list/edit.js.map +1 -1
- package/build/social-links/deprecated.js +1 -62
- package/build/social-links/deprecated.js.map +1 -1
- package/build/template-part/edit/index.js +36 -64
- package/build/template-part/edit/index.js.map +1 -1
- package/build/template-part/edit/placeholder.js +64 -0
- package/build/template-part/edit/placeholder.js.map +1 -0
- package/build/template-part/edit/selection-modal.js +103 -0
- package/build/template-part/edit/selection-modal.js.map +1 -0
- package/build/template-part/edit/title-modal.js +54 -0
- package/build/template-part/edit/title-modal.js.map +1 -0
- package/build/template-part/edit/utils/hooks.js +156 -0
- package/build/template-part/edit/utils/hooks.js.map +1 -0
- package/build/template-part/index.js +3 -1
- package/build/template-part/index.js.map +1 -1
- package/build-module/button/edit.native.js +4 -4
- package/build-module/button/edit.native.js.map +1 -1
- package/build-module/columns/index.js +12 -0
- package/build-module/columns/index.js.map +1 -1
- package/build-module/comment-author-avatar/edit.js +18 -6
- package/build-module/comment-author-avatar/edit.js.map +1 -1
- package/build-module/comment-template/edit.js +95 -37
- package/build-module/comment-template/edit.js.map +1 -1
- package/build-module/comment-template/hooks.js +156 -0
- package/build-module/comment-template/hooks.js.map +1 -0
- package/build-module/comment-template/index.js +1 -1
- package/build-module/comment-template/util.js.map +1 -1
- package/build-module/comments-pagination-next/index.js +1 -1
- package/build-module/comments-pagination-numbers/index.js +1 -1
- package/build-module/comments-query-loop/edit/comments-inspector-controls.js +20 -9
- package/build-module/comments-query-loop/edit/comments-inspector-controls.js.map +1 -1
- package/build-module/comments-query-loop/edit.js +2 -19
- package/build-module/comments-query-loop/edit.js.map +1 -1
- package/build-module/comments-query-loop/index.js +5 -0
- package/build-module/comments-query-loop/index.js.map +1 -1
- package/build-module/cover/edit.js +23 -24
- package/build-module/cover/edit.js.map +1 -1
- package/build-module/cover/edit.native.js +10 -8
- package/build-module/cover/edit.native.js.map +1 -1
- package/build-module/cover/overlay-color-settings.native.js +4 -4
- package/build-module/cover/overlay-color-settings.native.js.map +1 -1
- package/build-module/cover/transforms.js +4 -2
- package/build-module/cover/transforms.js.map +1 -1
- package/build-module/group/index.js +1 -0
- package/build-module/group/index.js.map +1 -1
- package/build-module/heading/edit.js +15 -3
- package/build-module/heading/edit.js.map +1 -1
- package/build-module/image/deprecated.js +90 -7
- package/build-module/image/deprecated.js.map +1 -1
- package/build-module/image/save.js +0 -7
- package/build-module/image/save.js.map +1 -1
- package/build-module/latest-posts/edit.js +1 -0
- package/build-module/latest-posts/edit.js.map +1 -1
- package/build-module/navigation/edit/index.js +17 -15
- package/build-module/navigation/edit/index.js.map +1 -1
- package/build-module/navigation/edit/navigation-menu-selector.js +45 -27
- package/build-module/navigation/edit/navigation-menu-selector.js.map +1 -1
- package/build-module/navigation/edit/placeholder/index.js +8 -21
- package/build-module/navigation/edit/placeholder/index.js.map +1 -1
- package/build-module/navigation/use-navigation-menu.js +6 -6
- package/build-module/navigation/use-navigation-menu.js.map +1 -1
- package/build-module/navigation-submenu/edit.js +41 -10
- package/build-module/navigation-submenu/edit.js.map +1 -1
- package/build-module/page-list/edit.js +12 -18
- package/build-module/page-list/edit.js.map +1 -1
- package/build-module/social-links/deprecated.js +1 -62
- package/build-module/social-links/deprecated.js.map +1 -1
- package/build-module/template-part/edit/index.js +37 -65
- package/build-module/template-part/edit/index.js.map +1 -1
- package/build-module/template-part/edit/placeholder.js +52 -0
- package/build-module/template-part/edit/placeholder.js.map +1 -0
- package/build-module/template-part/edit/selection-modal.js +89 -0
- package/build-module/template-part/edit/selection-modal.js.map +1 -0
- package/build-module/template-part/edit/title-modal.js +46 -0
- package/build-module/template-part/edit/title-modal.js.map +1 -0
- package/build-module/template-part/edit/utils/hooks.js +135 -0
- package/build-module/template-part/edit/utils/hooks.js.map +1 -0
- package/build-module/template-part/index.js +2 -1
- package/build-module/template-part/index.js.map +1 -1
- package/build-style/comment-author-avatar/editor-rtl.css +83 -0
- package/build-style/comment-author-avatar/editor.css +83 -0
- package/build-style/cover/style-rtl.css +4 -0
- package/build-style/cover/style.css +4 -0
- package/build-style/editor-rtl.css +27 -81
- package/build-style/editor.css +27 -81
- package/build-style/image/editor-rtl.css +0 -16
- package/build-style/image/editor.css +0 -16
- package/build-style/image/style-rtl.css +2 -0
- package/build-style/image/style.css +2 -0
- package/build-style/navigation/style-rtl.css +14 -3
- package/build-style/navigation/style.css +14 -3
- package/build-style/page-list/editor-rtl.css +0 -9
- package/build-style/page-list/editor.css +0 -9
- package/build-style/style-rtl.css +20 -3
- package/build-style/style.css +20 -3
- package/build-style/template-part/editor-rtl.css +19 -56
- package/build-style/template-part/editor.css +19 -56
- package/package.json +15 -15
- package/src/archives/index.php +1 -1
- package/src/button/edit.native.js +3 -3
- package/src/columns/block.json +12 -0
- package/src/comment-author-avatar/edit.js +13 -8
- package/src/comment-author-avatar/editor.scss +7 -0
- package/src/comment-template/block.json +7 -1
- package/src/comment-template/edit.js +102 -40
- package/src/comment-template/hooks.js +151 -0
- package/src/comment-template/index.php +8 -0
- package/src/comment-template/util.js +1 -0
- package/src/comments-pagination-next/block.json +8 -1
- package/src/comments-pagination-next/index.php +6 -8
- package/src/comments-pagination-numbers/block.json +7 -1
- package/src/comments-pagination-numbers/index.php +3 -10
- package/src/comments-query-loop/block.json +5 -0
- package/src/comments-query-loop/edit/comments-inspector-controls.js +22 -4
- package/src/comments-query-loop/edit.js +1 -16
- package/src/cover/edit.js +15 -28
- package/src/cover/edit.native.js +15 -7
- package/src/cover/overlay-color-settings.native.js +3 -4
- package/src/cover/style.scss +4 -0
- package/src/cover/transforms.js +2 -0
- package/src/editor.scss +1 -0
- package/src/gallery/index.php +1 -8
- package/src/group/block.json +1 -0
- package/src/heading/edit.js +18 -5
- package/src/home-link/index.php +1 -19
- package/src/image/deprecated.js +105 -1
- package/src/image/editor.scss +0 -18
- package/src/image/save.js +0 -8
- package/src/image/style.scss +3 -0
- package/src/image/test/edit.native.js +0 -10
- package/src/latest-posts/edit.js +1 -0
- package/src/latest-posts/index.php +1 -1
- package/src/navigation/edit/index.js +25 -26
- package/src/navigation/edit/navigation-menu-selector.js +73 -28
- package/src/navigation/edit/placeholder/index.js +8 -32
- package/src/navigation/index.php +4 -4
- package/src/navigation/style.scss +22 -3
- package/src/navigation/use-navigation-menu.js +6 -6
- package/src/navigation-link/index.php +3 -22
- package/src/navigation-submenu/edit.js +50 -12
- package/src/navigation-submenu/index.php +3 -21
- package/src/page-list/edit.js +21 -25
- package/src/page-list/editor.scss +0 -10
- package/src/page-list/index.php +4 -4
- package/src/post-navigation-link/index.php +3 -3
- package/src/search/index.php +6 -3
- package/src/site-logo/index.php +1 -1
- package/src/social-links/deprecated.js +0 -59
- package/src/template-part/edit/index.js +61 -71
- package/src/template-part/edit/placeholder.js +78 -0
- package/src/template-part/edit/selection-modal.js +115 -0
- package/src/template-part/edit/title-modal.js +59 -0
- package/src/template-part/edit/utils/hooks.js +158 -0
- package/src/template-part/editor.scss +16 -74
- package/src/template-part/index.js +4 -1
- package/build/navigation/edit/existing-menus-options.js +0 -62
- package/build/navigation/edit/existing-menus-options.js.map +0 -1
- package/build/template-part/edit/placeholder/index.js +0 -141
- package/build/template-part/edit/placeholder/index.js.map +0 -1
- package/build/template-part/edit/placeholder/patterns-setup.js +0 -100
- package/build/template-part/edit/placeholder/patterns-setup.js.map +0 -1
- package/build/template-part/edit/selection/index.js +0 -45
- package/build/template-part/edit/selection/index.js.map +0 -1
- package/build/template-part/edit/selection/template-part-previews.js +0 -317
- package/build/template-part/edit/selection/template-part-previews.js.map +0 -1
- package/build-module/navigation/edit/existing-menus-options.js +0 -53
- package/build-module/navigation/edit/existing-menus-options.js.map +0 -1
- package/build-module/template-part/edit/placeholder/index.js +0 -124
- package/build-module/template-part/edit/placeholder/index.js.map +0 -1
- package/build-module/template-part/edit/placeholder/patterns-setup.js +0 -91
- package/build-module/template-part/edit/placeholder/patterns-setup.js.map +0 -1
- package/build-module/template-part/edit/selection/index.js +0 -35
- package/build-module/template-part/edit/selection/index.js.map +0 -1
- package/build-module/template-part/edit/selection/template-part-previews.js +0 -298
- package/build-module/template-part/edit/selection/template-part-previews.js.map +0 -1
- package/src/navigation/edit/existing-menus-options.js +0 -70
- package/src/template-part/edit/placeholder/index.js +0 -172
- package/src/template-part/edit/placeholder/patterns-setup.js +0 -124
- package/src/template-part/edit/selection/index.js +0 -37
- package/src/template-part/edit/selection/template-part-previews.js +0 -372
|
@@ -17,9 +17,10 @@ import { BlockControls, InnerBlocks, useInnerBlocksProps, InspectorControls, Ric
|
|
|
17
17
|
import { isURL, prependHTTP, safeDecodeURI } from '@wordpress/url';
|
|
18
18
|
import { Fragment, useState, useEffect, useRef, createInterpolateElement } from '@wordpress/element';
|
|
19
19
|
import { placeCaretAtHorizontalEdge } from '@wordpress/dom';
|
|
20
|
-
import { link as linkIcon } from '@wordpress/icons';
|
|
20
|
+
import { link as linkIcon, removeSubmenu } from '@wordpress/icons';
|
|
21
21
|
import { store as coreStore } from '@wordpress/core-data';
|
|
22
22
|
import { speak } from '@wordpress/a11y';
|
|
23
|
+
import { createBlock } from '@wordpress/blocks';
|
|
23
24
|
/**
|
|
24
25
|
* Internal dependencies
|
|
25
26
|
*/
|
|
@@ -351,7 +352,8 @@ export default function NavigationSubmenuEdit(_ref) {
|
|
|
351
352
|
saveEntityRecord
|
|
352
353
|
} = useDispatch(coreStore);
|
|
353
354
|
const {
|
|
354
|
-
__unstableMarkNextChangeAsNotPersistent
|
|
355
|
+
__unstableMarkNextChangeAsNotPersistent,
|
|
356
|
+
replaceBlock
|
|
355
357
|
} = useDispatch(blockEditorStore);
|
|
356
358
|
const [isLinkOpen, setIsLinkOpen] = useState(false);
|
|
357
359
|
const listItemRef = useRef(null);
|
|
@@ -368,27 +370,42 @@ export default function NavigationSubmenuEdit(_ref) {
|
|
|
368
370
|
hasDescendants,
|
|
369
371
|
selectedBlockHasDescendants,
|
|
370
372
|
userCanCreatePages,
|
|
371
|
-
userCanCreatePosts
|
|
373
|
+
userCanCreatePosts,
|
|
374
|
+
onlyDescendantIsEmptyLink
|
|
372
375
|
} = useSelect(select => {
|
|
373
|
-
var _getClientIdsOfDescen;
|
|
374
|
-
|
|
375
376
|
const {
|
|
376
377
|
getClientIdsOfDescendants,
|
|
377
378
|
hasSelectedInnerBlock,
|
|
378
379
|
getSelectedBlockClientId,
|
|
379
|
-
getBlockParentsByBlockName
|
|
380
|
+
getBlockParentsByBlockName,
|
|
381
|
+
getBlock
|
|
380
382
|
} = select(blockEditorStore);
|
|
383
|
+
|
|
384
|
+
let _onlyDescendantIsEmptyLink;
|
|
385
|
+
|
|
381
386
|
const selectedBlockId = getSelectedBlockClientId();
|
|
382
387
|
const descendants = getClientIdsOfDescendants([clientId]).length;
|
|
388
|
+
const selectedBlockDescendants = getClientIdsOfDescendants([selectedBlockId]); // Check for a single descendant in the submenu. If that block
|
|
389
|
+
// is a link block in a "placeholder" state with no label then
|
|
390
|
+
// we can consider as an "empty" link.
|
|
391
|
+
|
|
392
|
+
if ((selectedBlockDescendants === null || selectedBlockDescendants === void 0 ? void 0 : selectedBlockDescendants.length) === 1) {
|
|
393
|
+
var _singleBlock$attribut;
|
|
394
|
+
|
|
395
|
+
const singleBlock = getBlock(selectedBlockDescendants[0]);
|
|
396
|
+
_onlyDescendantIsEmptyLink = (singleBlock === null || singleBlock === void 0 ? void 0 : singleBlock.name) === 'core/navigation-link' && !(singleBlock !== null && singleBlock !== void 0 && (_singleBlock$attribut = singleBlock.attributes) !== null && _singleBlock$attribut !== void 0 && _singleBlock$attribut.label);
|
|
397
|
+
}
|
|
398
|
+
|
|
383
399
|
return {
|
|
384
400
|
isAtMaxNesting: getBlockParentsByBlockName(clientId, name).length >= MAX_NESTING,
|
|
385
401
|
isTopLevelItem: getBlockParentsByBlockName(clientId, name).length === 0,
|
|
386
402
|
isParentOfSelectedBlock: hasSelectedInnerBlock(clientId, true),
|
|
387
403
|
isImmediateParentOfSelectedBlock: hasSelectedInnerBlock(clientId, false),
|
|
388
404
|
hasDescendants: !!descendants,
|
|
389
|
-
selectedBlockHasDescendants: !!(
|
|
405
|
+
selectedBlockHasDescendants: !!(selectedBlockDescendants !== null && selectedBlockDescendants !== void 0 && selectedBlockDescendants.length),
|
|
390
406
|
userCanCreatePages: select(coreStore).canUser('create', 'pages'),
|
|
391
|
-
userCanCreatePosts: select(coreStore).canUser('create', 'posts')
|
|
407
|
+
userCanCreatePosts: select(coreStore).canUser('create', 'posts'),
|
|
408
|
+
onlyDescendantIsEmptyLink: _onlyDescendantIsEmptyLink
|
|
392
409
|
};
|
|
393
410
|
}, [clientId]); // Show the LinkControl on mount if the URL is empty
|
|
394
411
|
// ( When adding a new menu item)
|
|
@@ -541,12 +558,26 @@ export default function NavigationSubmenuEdit(_ref) {
|
|
|
541
558
|
hasDescendants ? InnerBlocks.ButtonBlockAppender : false
|
|
542
559
|
});
|
|
543
560
|
const ParentElement = openSubmenusOnClick ? 'button' : 'a';
|
|
561
|
+
|
|
562
|
+
function transformToLink() {
|
|
563
|
+
const newLinkBlock = createBlock('core/navigation-link', attributes);
|
|
564
|
+
replaceBlock(clientId, newLinkBlock);
|
|
565
|
+
}
|
|
566
|
+
|
|
567
|
+
const canConvertToLink = !selectedBlockHasDescendants || onlyDescendantIsEmptyLink;
|
|
544
568
|
return createElement(Fragment, null, createElement(BlockControls, null, createElement(ToolbarGroup, null, !openSubmenusOnClick && createElement(ToolbarButton, {
|
|
545
569
|
name: "link",
|
|
546
570
|
icon: linkIcon,
|
|
547
571
|
title: __('Link'),
|
|
548
572
|
shortcut: displayShortcut.primary('k'),
|
|
549
573
|
onClick: () => setIsLinkOpen(true)
|
|
574
|
+
}), createElement(ToolbarButton, {
|
|
575
|
+
name: "revert",
|
|
576
|
+
icon: removeSubmenu,
|
|
577
|
+
title: __('Convert to Link'),
|
|
578
|
+
onClick: transformToLink,
|
|
579
|
+
className: "wp-block-navigation__submenu__revert",
|
|
580
|
+
isDisabled: !canConvertToLink
|
|
550
581
|
}))), createElement(InspectorControls, null, createElement(PanelBody, {
|
|
551
582
|
title: __('Link settings')
|
|
552
583
|
}, createElement(TextareaControl, {
|
|
@@ -632,8 +663,8 @@ export default function NavigationSubmenuEdit(_ref) {
|
|
|
632
663
|
});
|
|
633
664
|
speak(__('Link removed.'), 'assertive');
|
|
634
665
|
}
|
|
635
|
-
})), (showSubmenuIcon || openSubmenusOnClick) && createElement("span", {
|
|
666
|
+
}))), (showSubmenuIcon || openSubmenusOnClick) && createElement("span", {
|
|
636
667
|
className: "wp-block-navigation__submenu-icon"
|
|
637
|
-
}, createElement(ItemSubmenuIcon, null))
|
|
668
|
+
}, createElement(ItemSubmenuIcon, null)), createElement("div", innerBlocksProps)));
|
|
638
669
|
}
|
|
639
670
|
//# sourceMappingURL=edit.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-library/src/navigation-submenu/edit.js"],"names":["classnames","escape","pull","useSelect","useDispatch","PanelBody","Popover","TextControl","TextareaControl","ToolbarButton","ToolbarGroup","displayShortcut","isKeyboardEvent","__","sprintf","BlockControls","InnerBlocks","useInnerBlocksProps","InspectorControls","RichText","__experimentalLinkControl","LinkControl","useBlockProps","store","blockEditorStore","getColorClassName","isURL","prependHTTP","safeDecodeURI","Fragment","useState","useEffect","useRef","createInterpolateElement","placeCaretAtHorizontalEdge","link","linkIcon","coreStore","speak","ItemSubmenuIcon","ALLOWED_BLOCKS","DEFAULT_BLOCK","name","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","NavigationSubmenuEdit","attributes","isSelected","mergeBlocks","onReplace","clientId","description","rel","showSubmenuIcon","openSubmenusOnClick","saveEntityRecord","__unstableMarkNextChangeAsNotPersistent","isLinkOpen","setIsLinkOpen","listItemRef","itemLabelPlaceholder","ref","isAtMaxNesting","isTopLevelItem","isParentOfSelectedBlock","isImmediateParentOfSelectedBlock","hasDescendants","selectedBlockHasDescendants","userCanCreatePages","userCanCreatePosts","select","getClientIdsOfDescendants","hasSelectedInnerBlock","getSelectedBlockClientId","getBlockParentsByBlockName","selectedBlockId","descendants","length","canUser","test","selectLabelText","focus","defaultView","selection","getSelection","range","createRange","selectNodeContents","removeAllRanges","addRange","userCanCreate","handleCreate","pageTitle","postType","page","status","rendered","onKeyDown","primary","blockProps","className","innerBlocksColors","innerBlocksProps","allowedBlocks","__experimentalDefaultBlock","__experimentalDirectInsert","__experimentalCaptureToolbars","renderAppender","ButtonBlockAppender","ParentElement","descriptionValue","titleValue","relValue","labelValue","searchTerm","format","mark"],"mappings":";;AAAA;AACA;AACA;AACA,OAAOA,UAAP,MAAuB,YAAvB;AACA,SAASC,MAAT,EAAiBC,IAAjB,QAA6B,QAA7B;AAEA;AACA;AACA;;AACA,SAASC,SAAT,EAAoBC,WAApB,QAAuC,iBAAvC;AACA,SACCC,SADD,EAECC,OAFD,EAGCC,WAHD,EAICC,eAJD,EAKCC,aALD,EAMCC,YAND,QAOO,uBAPP;AAQA,SAASC,eAAT,EAA0BC,eAA1B,QAAiD,qBAAjD;AACA,SAASC,EAAT,EAAaC,OAAb,QAA4B,iBAA5B;AACA,SACCC,aADD,EAECC,WAFD,EAGCC,mBAHD,E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AAa,CAAE;AAAEO,QAAAA,GAAG,EAAE;AAAP,OAAF,CAAb;AACAjD,MAAAA,KAAK,CAAEzB,EAAE,CAAE,eAAF,CAAJ,EAAyB,WAAzB,CAAL;AACA;AAxCF,IALD,CA9BF,EA+EG,CAAEkG,eAAe,IAAIC,mBAArB,KACD;AAAM,IAAA,SAAS,EAAC;AAAhB,KACC,cAAC,eAAD,OADD,CAhFF,CAFD,EAuFC,qBAAUgD,gBAAV,CAvFD,CA9CD,CADD;AA0IA","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\nimport { escape, pull } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport {\n\tPanelBody,\n\tPopover,\n\tTextControl,\n\tTextareaControl,\n\tToolbarButton,\n\tToolbarGroup,\n} from '@wordpress/components';\nimport { displayShortcut, isKeyboardEvent } from '@wordpress/keycodes';\nimport { __, sprintf } from '@wordpress/i18n';\nimport {\n\tBlockControls,\n\tInnerBlocks,\n\tuseInnerBlocksProps,\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 } from '@wordpress/icons';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { speak } from '@wordpress/a11y';\n\n/**\n * Internal dependencies\n */\nimport { ItemSubmenuIcon } from './icons';\nimport { name } from './block.json';\n\nconst ALLOWED_BLOCKS = [ 'core/navigation-link', 'core/navigation-submenu' ];\n\nconst DEFAULT_BLOCK = {\n\tname: 'core/navigation-link',\n};\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\tconst {\n\t\ttitle = '',\n\t\turl = '',\n\t\topensInNewTab,\n\t\tid,\n\t\tkind: newKind = originalKind,\n\t\ttype: newType = originalType,\n\t} = updatedValue;\n\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\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\nexport default function NavigationSubmenuEdit( {\n\tattributes,\n\tisSelected,\n\tsetAttributes,\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\tconst link = {\n\t\turl,\n\t\topensInNewTab,\n\t};\n\tconst { showSubmenuIcon, openSubmenusOnClick } = context;\n\tconst { saveEntityRecord } = useDispatch( coreStore );\n\tconst { __unstableMarkNextChangeAsNotPersistent } = useDispatch(\n\t\tblockEditorStore\n\t);\n\tconst [ isLinkOpen, setIsLinkOpen ] = useState( false );\n\tconst listItemRef = useRef( null );\n\tconst isDraggingWithin = useIsDraggingWithin( listItemRef );\n\tconst itemLabelPlaceholder = __( 'Add text…' );\n\tconst ref = useRef();\n\n\tconst {\n\t\tisAtMaxNesting,\n\t\tisTopLevelItem,\n\t\tisParentOfSelectedBlock,\n\t\tisImmediateParentOfSelectedBlock,\n\t\thasDescendants,\n\t\tselectedBlockHasDescendants,\n\t\tuserCanCreatePages,\n\t\tuserCanCreatePosts,\n\t} = useSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\tgetClientIdsOfDescendants,\n\t\t\t\thasSelectedInnerBlock,\n\t\t\t\tgetSelectedBlockClientId,\n\t\t\t\tgetBlockParentsByBlockName,\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\tisAtMaxNesting:\n\t\t\t\t\tgetBlockParentsByBlockName( clientId, name ).length >=\n\t\t\t\t\tMAX_NESTING,\n\t\t\t\tisTopLevelItem:\n\t\t\t\t\tgetBlockParentsByBlockName( clientId, name ).length === 0,\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};\n\t\t},\n\t\t[ clientId ]\n\t);\n\n\t// Show the LinkControl on mount if the URL is empty\n\t// ( When adding a new menu item)\n\t// This can't be done in the useState call because it conflicts\n\t// with the autofocus behavior of the BlockListBlock component.\n\tuseEffect( () => {\n\t\tif ( ! openSubmenusOnClick && ! url ) {\n\t\t\tsetIsLinkOpen( true );\n\t\t}\n\t}, [] );\n\n\t// Store the colors from context as attributes for rendering\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( { isTopLevelItem } );\n\t}, [ isTopLevelItem ] );\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\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, ! isTopLevelItem );\n\n\tfunction onKeyDown( event ) {\n\t\tif ( isKeyboardEvent.primary( event, 'k' ) ) {\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\t'open-on-click': openSubmenusOnClick,\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\t// Always use overlay colors for submenus\n\tconst innerBlocksColors = getColors( context, true );\n\n\tif ( isAtMaxNesting ) {\n\t\tpull( ALLOWED_BLOCKS, 'core/navigation-submenu' );\n\t}\n\n\tconst innerBlocksProps = useInnerBlocksProps(\n\t\t{\n\t\t\tclassName: classnames( 'wp-block-navigation__submenu-container', {\n\t\t\t\t'is-parent-of-selected-block': isParentOfSelectedBlock,\n\t\t\t\t'has-text-color': !! (\n\t\t\t\t\tinnerBlocksColors.textColor ||\n\t\t\t\t\tinnerBlocksColors.customTextColor\n\t\t\t\t),\n\t\t\t\t[ `has-${ innerBlocksColors.textColor }-color` ]: !! innerBlocksColors.textColor,\n\t\t\t\t'has-background': !! (\n\t\t\t\t\tinnerBlocksColors.backgroundColor ||\n\t\t\t\t\tinnerBlocksColors.customBackgroundColor\n\t\t\t\t),\n\t\t\t\t[ `has-${ innerBlocksColors.backgroundColor }-background-color` ]: !! innerBlocksColors.backgroundColor,\n\t\t\t} ),\n\t\t\tstyle: {\n\t\t\t\tcolor: innerBlocksColors.customTextColor,\n\t\t\t\tbackgroundColor: innerBlocksColors.customBackgroundColor,\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tallowedBlocks: ALLOWED_BLOCKS,\n\t\t\t__experimentalDefaultBlock: DEFAULT_BLOCK,\n\t\t\t__experimentalDirectInsert: true,\n\n\t\t\t// Ensure block toolbar is not too far removed from item\n\t\t\t// being edited.\n\t\t\t// see: https://github.com/WordPress/gutenberg/pull/34615.\n\t\t\t__experimentalCaptureToolbars: true,\n\n\t\t\trenderAppender:\n\t\t\t\tisSelected ||\n\t\t\t\t( isImmediateParentOfSelectedBlock &&\n\t\t\t\t\t! selectedBlockHasDescendants ) ||\n\t\t\t\t// Show the appender while dragging to allow inserting element between item and the appender.\n\t\t\t\thasDescendants\n\t\t\t\t\t? InnerBlocks.ButtonBlockAppender\n\t\t\t\t\t: false,\n\t\t}\n\t);\n\n\tconst ParentElement = openSubmenusOnClick ? 'button' : 'a';\n\n\treturn (\n\t\t<Fragment>\n\t\t\t<BlockControls>\n\t\t\t\t<ToolbarGroup>\n\t\t\t\t\t{ ! openSubmenusOnClick && (\n\t\t\t\t\t\t<ToolbarButton\n\t\t\t\t\t\t\tname=\"link\"\n\t\t\t\t\t\t\ticon={ linkIcon }\n\t\t\t\t\t\t\ttitle={ __( 'Link' ) }\n\t\t\t\t\t\t\tshortcut={ displayShortcut.primary( 'k' ) }\n\t\t\t\t\t\t\tonClick={ () => setIsLinkOpen( true ) }\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( {\n\t\t\t\t\t\t\t\tdescription: descriptionValue,\n\t\t\t\t\t\t\t} );\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<ParentElement className=\"wp-block-navigation-item__content\">\n\t\t\t\t\t{ /* eslint-enable */ }\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( { label: labelValue } )\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\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 ( ! openSubmenusOnClick && ! 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{ ! openSubmenusOnClick && 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\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={ () => {\n\t\t\t\t\t\t\t\t\tsetAttributes( { url: '' } );\n\t\t\t\t\t\t\t\t\tspeak( __( 'Link removed.' ), 'assertive' );\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\t{ ( showSubmenuIcon || openSubmenusOnClick ) && (\n\t\t\t\t\t\t<span className=\"wp-block-navigation__submenu-icon\">\n\t\t\t\t\t\t\t<ItemSubmenuIcon />\n\t\t\t\t\t\t</span>\n\t\t\t\t\t) }\n\t\t\t\t</ParentElement>\n\t\t\t\t<div { ...innerBlocksProps } />\n\t\t\t</div>\n\t\t</Fragment>\n\t);\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["@wordpress/block-library/src/navigation-submenu/edit.js"],"names":["classnames","escape","pull","useSelect","useDispatch","PanelBody","Popover","TextControl","TextareaControl","ToolbarButton","ToolbarGroup","displayShortcut","isKeyboardEvent","__","sprintf","BlockControls","InnerBlocks","useInnerBlocksProps","InspectorControls","RichText","__experimentalLinkControl","LinkControl","useBlockProps","store","blockEditorStore","getColorClassName","isURL","prependHTTP","safeDecodeURI","Fragment","useState","useEffect","useRef","createInterpolateElement","placeCaretAtHorizontalEdge","link","linkIcon","removeSubmenu","coreStore","speak","createBlock","ItemSubmenuIcon","ALLOWED_BLOCKS","DEFAULT_BLOCK","name","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","NavigationSubmenuEdit","attributes","isSelected","mergeBlocks","onReplace","clientId","description","rel","showSubmenuIcon","openSubmenusOnClick","saveEntityRecord","__unstableMarkNextChangeAsNotPersistent","replaceBlock","isLinkOpen","setIsLinkOpen","listItemRef","itemLabelPlaceholder","ref","isAtMaxNesting","isTopLevelItem","isParentOfSelectedBlock","isImmediateParentOfSelectedBlock","hasDescendants","selectedBlockHasDescendants","userCanCreatePages","userCanCreatePosts","onlyDescendantIsEmptyLink","select","getClientIdsOfDescendants","hasSelectedInnerBlock","getSelectedBlockClientId","getBlockParentsByBlockName","getBlock","_onlyDescendantIsEmptyLink","selectedBlockId","descendants","length","selectedBlockDescendants","singleBlock","canUser","test","selectLabelText","focus","defaultView","selection","getSelection","range","createRange","selectNodeContents","removeAllRanges","addRange","userCanCreate","handleCreate","pageTitle","postType","page","status","rendered","onKeyDown","primary","blockProps","className","innerBlocksColors","innerBlocksProps","allowedBlocks","__experimentalDefaultBlock","__experimentalDirectInsert","__experimentalCaptureToolbars","renderAppender","ButtonBlockAppender","ParentElement","transformToLink","newLinkBlock","canConvertToLink","descriptionValue","titleValue","relValue","labelValue","searchTerm","format","mark"],"mappings":";;AAAA;AACA;AACA;AACA,OAAOA,UAAP,MAAuB,YAAvB;AACA,SAASC,MAAT,EAAiBC,IAAjB,QAA6B,QAA7B;AAEA;AACA;AACA;;AACA,SAASC,SAAT,EAAoBC,WAApB,QAAuC,iBAAvC;AACA,SACCC,SADD,EAECC,OAFD,EAGCC,WAHD,EAICC,eAJD,EAKCC,aALD,EAMCC,YAND,QAOO,uBAPP;AAQA,SAASC,eAAT,EAA0BC,eAA1B,QAAiD,qBAAjD;AACA,SAASC,EAAT,EAAaC,OAAb,QAA4B,iBAA5B;AACA,SACCC,aADD,EAECC,WAFD,EAGCC,mBAHD,EAICC,iBAJD,EAKCC,QALD,EAMCC,yBAAyB,IAAIC,WAN9B,EAOCC,aAPD,EAQCC,KAAK,IAAIC,gBARV,EASCC,iBATD,QAUO,yBAVP;AAWA,SAASC,KAAT,EAAgBC,WAAhB,EAA6BC,aAA7B,QAAkD,gBAAlD;AACA,SACCC,QADD,EAECC,QAFD,EAGCC,SAHD,EAICC,MAJD,EAKCC,wBALD,QAMO,oBANP;AAOA,SAASC,0BAAT,QAA2C,gBAA3C;AACA,SAASC,IAAI,IAAIC,QAAjB,EAA2BC,aAA3B,QAAgD,kBAAhD;AACA,SAASd,KAAK,IAAIe,SAAlB,QAAmC,sBAAnC;AACA,SAASC,KAAT,Q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UAAF,IAAkB;AAC9C,UAAIC,MAAJ;;AACA,UAAK3H,IAAI,KAAK,MAAd,EAAuB;AACtB;AACA2H,QAAAA,MAAM,GAAG3K,EAAE,CACV,oCADU,CAAX;AAGA,OALD,MAKO;AACN;AACA2K,QAAAA,MAAM,GAAG3K,EAAE,CACV,oCADU,CAAX;AAGA;;AACD,aAAOoB,wBAAwB,CAC9BnB,OAAO,CAAE0K,MAAF,EAAUD,UAAV,CADuB,EAE9B;AAAEE,QAAAA,IAAI,EAAE;AAAR,OAF8B,CAA/B;AAIA,KAvBF;AAwBC,IAAA,aAAa,EAAG,CAAC,CAAE5H,IAxBpB;AAyBC,IAAA,eAAe,EAAG,CAAC,CAAEA,IAzBtB;AA0BC,IAAA,gBAAgB,EAAGD,mBAAmB,CACrCC,IADqC,EAErCC,IAFqC,CA1BvC;AA8BC,IAAA,QAAQ,EAAKmB,YAAF,IACVD,mCAAmC,CAClCC,YADkC,EAElCC,aAFkC,EAGlCwB,UAHkC,CA/BrC;AAqCC,IAAA,QAAQ,EAAG,MAAM;AAChBxB,MAAAA,aAAa,CAAE;AAAEO,QAAAA,GAAG,EAAE;AAAP,OAAF,CAAb;AACAlD,MAAAA,KAAK,CAAE1B,EAAE,CAAE,eAAF,CAAJ,EAAyB,WAAzB,CAAL;AACA;AAxCF,IALD,CA9BF,CAFD,EAkFG,CAAEoG,eAAe,IAAIC,mBAArB,KACD;AAAM,IAAA,SAAS,EAAC;AAAhB,KACC,cAAC,eAAD,OADD,CAnFF,EAuFC,qBAAUsD,gBAAV,CAvFD,CAvDD,CADD;AAmJA","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\nimport { escape, pull } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport {\n\tPanelBody,\n\tPopover,\n\tTextControl,\n\tTextareaControl,\n\tToolbarButton,\n\tToolbarGroup,\n} from '@wordpress/components';\nimport { displayShortcut, isKeyboardEvent } from '@wordpress/keycodes';\nimport { __, sprintf } from '@wordpress/i18n';\nimport {\n\tBlockControls,\n\tInnerBlocks,\n\tuseInnerBlocksProps,\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, removeSubmenu } from '@wordpress/icons';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { speak } from '@wordpress/a11y';\nimport { createBlock } from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport { ItemSubmenuIcon } from './icons';\nimport { name } from './block.json';\n\nconst ALLOWED_BLOCKS = [ 'core/navigation-link', 'core/navigation-submenu' ];\n\nconst DEFAULT_BLOCK = {\n\tname: 'core/navigation-link',\n};\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\tconst {\n\t\ttitle = '',\n\t\turl = '',\n\t\topensInNewTab,\n\t\tid,\n\t\tkind: newKind = originalKind,\n\t\ttype: newType = originalType,\n\t} = updatedValue;\n\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\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\nexport default function NavigationSubmenuEdit( {\n\tattributes,\n\tisSelected,\n\tsetAttributes,\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\tconst link = {\n\t\turl,\n\t\topensInNewTab,\n\t};\n\tconst { showSubmenuIcon, openSubmenusOnClick } = context;\n\tconst { saveEntityRecord } = useDispatch( coreStore );\n\n\tconst {\n\t\t__unstableMarkNextChangeAsNotPersistent,\n\t\treplaceBlock,\n\t} = useDispatch( blockEditorStore );\n\tconst [ isLinkOpen, setIsLinkOpen ] = useState( false );\n\tconst listItemRef = useRef( null );\n\tconst isDraggingWithin = useIsDraggingWithin( listItemRef );\n\tconst itemLabelPlaceholder = __( 'Add text…' );\n\tconst ref = useRef();\n\n\tconst {\n\t\tisAtMaxNesting,\n\t\tisTopLevelItem,\n\t\tisParentOfSelectedBlock,\n\t\tisImmediateParentOfSelectedBlock,\n\t\thasDescendants,\n\t\tselectedBlockHasDescendants,\n\t\tuserCanCreatePages,\n\t\tuserCanCreatePosts,\n\t\tonlyDescendantIsEmptyLink,\n\t} = useSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\tgetClientIdsOfDescendants,\n\t\t\t\thasSelectedInnerBlock,\n\t\t\t\tgetSelectedBlockClientId,\n\t\t\t\tgetBlockParentsByBlockName,\n\t\t\t\tgetBlock,\n\t\t\t} = select( blockEditorStore );\n\n\t\t\tlet _onlyDescendantIsEmptyLink;\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\tconst selectedBlockDescendants = getClientIdsOfDescendants( [\n\t\t\t\tselectedBlockId,\n\t\t\t] );\n\n\t\t\t// Check for a single descendant in the submenu. If that block\n\t\t\t// is a link block in a \"placeholder\" state with no label then\n\t\t\t// we can consider as an \"empty\" link.\n\t\t\tif ( selectedBlockDescendants?.length === 1 ) {\n\t\t\t\tconst singleBlock = getBlock( selectedBlockDescendants[ 0 ] );\n\n\t\t\t\t_onlyDescendantIsEmptyLink =\n\t\t\t\t\tsingleBlock?.name === 'core/navigation-link' &&\n\t\t\t\t\t! singleBlock?.attributes?.label;\n\t\t\t}\n\n\t\t\treturn {\n\t\t\t\tisAtMaxNesting:\n\t\t\t\t\tgetBlockParentsByBlockName( clientId, name ).length >=\n\t\t\t\t\tMAX_NESTING,\n\t\t\t\tisTopLevelItem:\n\t\t\t\t\tgetBlockParentsByBlockName( clientId, name ).length === 0,\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: !! selectedBlockDescendants?.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\tonlyDescendantIsEmptyLink: _onlyDescendantIsEmptyLink,\n\t\t\t};\n\t\t},\n\t\t[ clientId ]\n\t);\n\n\t// Show the LinkControl on mount if the URL is empty\n\t// ( When adding a new menu item)\n\t// This can't be done in the useState call because it conflicts\n\t// with the autofocus behavior of the BlockListBlock component.\n\tuseEffect( () => {\n\t\tif ( ! openSubmenusOnClick && ! url ) {\n\t\t\tsetIsLinkOpen( true );\n\t\t}\n\t}, [] );\n\n\t// Store the colors from context as attributes for rendering\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( { isTopLevelItem } );\n\t}, [ isTopLevelItem ] );\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\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, ! isTopLevelItem );\n\n\tfunction onKeyDown( event ) {\n\t\tif ( isKeyboardEvent.primary( event, 'k' ) ) {\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\t'open-on-click': openSubmenusOnClick,\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\t// Always use overlay colors for submenus\n\tconst innerBlocksColors = getColors( context, true );\n\n\tif ( isAtMaxNesting ) {\n\t\tpull( ALLOWED_BLOCKS, 'core/navigation-submenu' );\n\t}\n\n\tconst innerBlocksProps = useInnerBlocksProps(\n\t\t{\n\t\t\tclassName: classnames( 'wp-block-navigation__submenu-container', {\n\t\t\t\t'is-parent-of-selected-block': isParentOfSelectedBlock,\n\t\t\t\t'has-text-color': !! (\n\t\t\t\t\tinnerBlocksColors.textColor ||\n\t\t\t\t\tinnerBlocksColors.customTextColor\n\t\t\t\t),\n\t\t\t\t[ `has-${ innerBlocksColors.textColor }-color` ]: !! innerBlocksColors.textColor,\n\t\t\t\t'has-background': !! (\n\t\t\t\t\tinnerBlocksColors.backgroundColor ||\n\t\t\t\t\tinnerBlocksColors.customBackgroundColor\n\t\t\t\t),\n\t\t\t\t[ `has-${ innerBlocksColors.backgroundColor }-background-color` ]: !! innerBlocksColors.backgroundColor,\n\t\t\t} ),\n\t\t\tstyle: {\n\t\t\t\tcolor: innerBlocksColors.customTextColor,\n\t\t\t\tbackgroundColor: innerBlocksColors.customBackgroundColor,\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tallowedBlocks: ALLOWED_BLOCKS,\n\t\t\t__experimentalDefaultBlock: DEFAULT_BLOCK,\n\t\t\t__experimentalDirectInsert: true,\n\n\t\t\t// Ensure block toolbar is not too far removed from item\n\t\t\t// being edited.\n\t\t\t// see: https://github.com/WordPress/gutenberg/pull/34615.\n\t\t\t__experimentalCaptureToolbars: true,\n\n\t\t\trenderAppender:\n\t\t\t\tisSelected ||\n\t\t\t\t( isImmediateParentOfSelectedBlock &&\n\t\t\t\t\t! selectedBlockHasDescendants ) ||\n\t\t\t\t// Show the appender while dragging to allow inserting element between item and the appender.\n\t\t\t\thasDescendants\n\t\t\t\t\t? InnerBlocks.ButtonBlockAppender\n\t\t\t\t\t: false,\n\t\t}\n\t);\n\n\tconst ParentElement = openSubmenusOnClick ? 'button' : 'a';\n\n\tfunction transformToLink() {\n\t\tconst newLinkBlock = createBlock( 'core/navigation-link', attributes );\n\t\treplaceBlock( clientId, newLinkBlock );\n\t}\n\n\tconst canConvertToLink =\n\t\t! selectedBlockHasDescendants || onlyDescendantIsEmptyLink;\n\n\treturn (\n\t\t<Fragment>\n\t\t\t<BlockControls>\n\t\t\t\t<ToolbarGroup>\n\t\t\t\t\t{ ! openSubmenusOnClick && (\n\t\t\t\t\t\t<ToolbarButton\n\t\t\t\t\t\t\tname=\"link\"\n\t\t\t\t\t\t\ticon={ linkIcon }\n\t\t\t\t\t\t\ttitle={ __( 'Link' ) }\n\t\t\t\t\t\t\tshortcut={ displayShortcut.primary( 'k' ) }\n\t\t\t\t\t\t\tonClick={ () => setIsLinkOpen( true ) }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\n\t\t\t\t\t<ToolbarButton\n\t\t\t\t\t\tname=\"revert\"\n\t\t\t\t\t\ticon={ removeSubmenu }\n\t\t\t\t\t\ttitle={ __( 'Convert to Link' ) }\n\t\t\t\t\t\tonClick={ transformToLink }\n\t\t\t\t\t\tclassName=\"wp-block-navigation__submenu__revert\"\n\t\t\t\t\t\tisDisabled={ ! canConvertToLink }\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( {\n\t\t\t\t\t\t\t\tdescription: descriptionValue,\n\t\t\t\t\t\t\t} );\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<ParentElement className=\"wp-block-navigation-item__content\">\n\t\t\t\t\t{ /* eslint-enable */ }\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( { label: labelValue } )\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\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 ( ! openSubmenusOnClick && ! 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{ ! openSubmenusOnClick && 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\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={ () => {\n\t\t\t\t\t\t\t\t\tsetAttributes( { url: '' } );\n\t\t\t\t\t\t\t\t\tspeak( __( 'Link removed.' ), 'assertive' );\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</ParentElement>\n\t\t\t\t{ ( showSubmenuIcon || openSubmenusOnClick ) && (\n\t\t\t\t\t<span className=\"wp-block-navigation__submenu-icon\">\n\t\t\t\t\t\t<ItemSubmenuIcon />\n\t\t\t\t\t</span>\n\t\t\t\t) }\n\t\t\t\t<div { ...innerBlocksProps } />\n\t\t\t</div>\n\t\t</Fragment>\n\t);\n}\n"]}
|
|
@@ -10,7 +10,7 @@ import { sortBy } from 'lodash';
|
|
|
10
10
|
*/
|
|
11
11
|
|
|
12
12
|
import { BlockControls, useBlockProps, getColorClassName } from '@wordpress/block-editor';
|
|
13
|
-
import { ToolbarButton,
|
|
13
|
+
import { ToolbarButton, Spinner, Notice } from '@wordpress/components';
|
|
14
14
|
import { __ } from '@wordpress/i18n';
|
|
15
15
|
import { useMemo, useState, memo } from '@wordpress/element';
|
|
16
16
|
import { useSelect } from '@wordpress/data';
|
|
@@ -62,7 +62,7 @@ export default function PageListEdit(_ref) {
|
|
|
62
62
|
}, __('Edit'))), allowConvertToLinks && isOpen && createElement(ConvertToLinksModal, {
|
|
63
63
|
onClose: closeModal,
|
|
64
64
|
clientId: clientId
|
|
65
|
-
}), !hasResolvedPages && createElement("div", blockProps, createElement(
|
|
65
|
+
}), !hasResolvedPages && createElement("div", blockProps, createElement(Spinner, null)), hasResolvedPages && totalPages === null && createElement("div", blockProps, createElement("div", blockProps, createElement(Notice, {
|
|
66
66
|
status: 'warning',
|
|
67
67
|
isDismissible: false
|
|
68
68
|
}, __('Page List: Cannot retrieve Pages.')))), totalPages === 0 && createElement("div", blockProps, createElement(Notice, {
|
|
@@ -161,14 +161,20 @@ const PageItems = memo(function PageItems(_ref2) {
|
|
|
161
161
|
'open-on-hover-click': !context.openSubmenusOnClick && context.showSubmenuIcon,
|
|
162
162
|
'menu-item-home': page.id === frontPageId
|
|
163
163
|
})
|
|
164
|
-
}, hasChildren && context.openSubmenusOnClick ? createElement(
|
|
165
|
-
|
|
166
|
-
|
|
164
|
+
}, hasChildren && context.openSubmenusOnClick ? createElement(Fragment, null, createElement("button", {
|
|
165
|
+
className: "wp-block-navigation-item__content wp-block-navigation-submenu__toggle",
|
|
166
|
+
"aria-expanded": "false"
|
|
167
|
+
}, (_page$title = page.title) === null || _page$title === void 0 ? void 0 : _page$title.rendered), createElement("span", {
|
|
168
|
+
className: "wp-block-page-list__submenu-icon wp-block-navigation__submenu-icon"
|
|
169
|
+
}, createElement(ItemSubmenuIcon, null))) : createElement("a", {
|
|
167
170
|
className: classnames('wp-block-pages-list__item__link', {
|
|
168
171
|
'wp-block-navigation-item__content': isNavigationChild
|
|
169
172
|
}),
|
|
170
173
|
href: page.link
|
|
171
|
-
}, (_page$title2 = page.title) === null || _page$title2 === void 0 ? void 0 : _page$title2.rendered), hasChildren && createElement(Fragment, null, !context.openSubmenusOnClick && context.showSubmenuIcon && createElement(
|
|
174
|
+
}, (_page$title2 = page.title) === null || _page$title2 === void 0 ? void 0 : _page$title2.rendered), hasChildren && createElement(Fragment, null, !context.openSubmenusOnClick && context.showSubmenuIcon && createElement("button", {
|
|
175
|
+
className: "wp-block-navigation-item__content wp-block-navigation-submenu__toggle wp-block-page-list__submenu-icon wp-block-navigation__submenu-icon",
|
|
176
|
+
"aria-expanded": "false"
|
|
177
|
+
}, createElement(ItemSubmenuIcon, null)), createElement("ul", {
|
|
172
178
|
className: classnames('submenu-container', {
|
|
173
179
|
'wp-block-navigation__submenu-container': isNavigationChild
|
|
174
180
|
})
|
|
@@ -180,16 +186,4 @@ const PageItems = memo(function PageItems(_ref2) {
|
|
|
180
186
|
}))));
|
|
181
187
|
});
|
|
182
188
|
});
|
|
183
|
-
|
|
184
|
-
function ItemSubmenuToggle(_ref3) {
|
|
185
|
-
let {
|
|
186
|
-
title
|
|
187
|
-
} = _ref3;
|
|
188
|
-
return createElement("button", {
|
|
189
|
-
className: "wp-block-navigation-item__content wp-block-navigation-submenu__toggle",
|
|
190
|
-
"aria-expanded": "false"
|
|
191
|
-
}, title, createElement("span", {
|
|
192
|
-
className: "wp-block-page-list__submenu-icon wp-block-navigation__submenu-icon"
|
|
193
|
-
}, createElement(ItemSubmenuIcon, null)));
|
|
194
|
-
}
|
|
195
189
|
//# sourceMappingURL=edit.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-library/src/page-list/edit.js"],"names":["classnames","sortBy","BlockControls","useBlockProps","getColorClassName","ToolbarButton","Placeholder","Spinner","Notice","__","useMemo","useState","memo","useSelect","store","coreStore","ConvertToLinksModal","ItemSubmenuIcon","MAX_PAGE_COUNT","PageListEdit","context","clientId","pagesByParentId","totalPages","hasResolvedPages","usePageData","isNavigationChild","allowConvertToLinks","isOpen","setOpen","openModal","closeModal","blockProps","className","textColor","backgroundColor","style","color","useFrontPageId","select","site","getEntityRecord","show_on_front","page_on_front","pages","getEntityRecords","hasFinishedResolution","orderby","order","_fields","per_page","sortedPages","reduce","accumulator","page","parent","has","get","push","set","Map","length","PageItems","parentId","depth","frontPageId","map","hasChildren","id","openSubmenusOnClick","showSubmenuIcon","title","rendered","link","ItemSubmenuToggle"],"mappings":";;AAAA;AACA;AACA;AACA,OAAOA,UAAP,MAAuB,YAAvB;AACA,SAASC,MAAT,QAAuB,QAAvB;AAEA;AACA;AACA;;AACA,SACCC,aADD,EAECC,aAFD,EAGCC,iBAHD,QAIO,yBAJP;AAKA,SACCC,aADD,EAECC,WAFD,EAGCC,OAHD,EAICC,MAJD,QAKO,uBALP;AAMA,SAASC,EAAT,QAAmB,iBAAnB;AACA,SAASC,OAAT,EAAkBC,QAAlB,EAA4BC,IAA5B,QAAwC,oBAAxC;AACA,SAASC,SAAT,QA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encies\n */\nimport classnames from 'classnames';\nimport { sortBy } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tBlockControls,\n\tuseBlockProps,\n\tgetColorClassName,\n} from '@wordpress/block-editor';\nimport {\n\tToolbarButton,\n\tPlaceholder,\n\tSpinner,\n\tNotice,\n} from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { useMemo, useState, memo } from '@wordpress/element';\nimport { useSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport ConvertToLinksModal from './convert-to-links-modal';\nimport { ItemSubmenuIcon } from '../navigation-link/icons';\n\n// We only show the edit option when page count is <= MAX_PAGE_COUNT\n// Performance of Navigation Links is not good past this value.\nconst MAX_PAGE_COUNT = 100;\n\nexport default function PageListEdit( { context, clientId } ) {\n\tconst { pagesByParentId, totalPages, hasResolvedPages } = usePageData();\n\n\tconst isNavigationChild = 'showSubmenuIcon' in context;\n\tconst allowConvertToLinks =\n\t\tisNavigationChild && totalPages <= MAX_PAGE_COUNT;\n\n\tconst [ isOpen, setOpen ] = useState( false );\n\tconst openModal = () => setOpen( true );\n\tconst closeModal = () => setOpen( false );\n\n\tconst blockProps = useBlockProps( {\n\t\tclassName: classnames( 'wp-block-page-list', {\n\t\t\t'has-text-color': !! context.textColor,\n\t\t\t[ getColorClassName(\n\t\t\t\t'color',\n\t\t\t\tcontext.textColor\n\t\t\t) ]: !! context.textColor,\n\t\t\t'has-background': !! context.backgroundColor,\n\t\t\t[ getColorClassName(\n\t\t\t\t'background-color',\n\t\t\t\tcontext.backgroundColor\n\t\t\t) ]: !! context.backgroundColor,\n\t\t} ),\n\t\tstyle: { ...context.style?.color },\n\t} );\n\n\treturn (\n\t\t<>\n\t\t\t{ allowConvertToLinks && (\n\t\t\t\t<BlockControls group=\"other\">\n\t\t\t\t\t<ToolbarButton title={ __( 'Edit' ) } onClick={ openModal }>\n\t\t\t\t\t\t{ __( 'Edit' ) }\n\t\t\t\t\t</ToolbarButton>\n\t\t\t\t</BlockControls>\n\t\t\t) }\n\t\t\t{ allowConvertToLinks && isOpen && (\n\t\t\t\t<ConvertToLinksModal\n\t\t\t\t\tonClose={ closeModal }\n\t\t\t\t\tclientId={ clientId }\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ ! hasResolvedPages && (\n\t\t\t\t<div { ...blockProps }>\n\t\t\t\t\t<Placeholder>\n\t\t\t\t\t\t<Spinner />\n\t\t\t\t\t</Placeholder>\n\t\t\t\t</div>\n\t\t\t) }\n\n\t\t\t{ hasResolvedPages && totalPages === null && (\n\t\t\t\t<div { ...blockProps }>\n\t\t\t\t\t<div { ...blockProps }>\n\t\t\t\t\t\t<Notice status={ 'warning' } isDismissible={ false }>\n\t\t\t\t\t\t\t{ __( 'Page List: Cannot retrieve Pages.' ) }\n\t\t\t\t\t\t</Notice>\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t) }\n\n\t\t\t{ totalPages === 0 && (\n\t\t\t\t<div { ...blockProps }>\n\t\t\t\t\t<Notice status={ 'info' } isDismissible={ false }>\n\t\t\t\t\t\t{ __( 'Page List: Cannot retrieve Pages.' ) }\n\t\t\t\t\t</Notice>\n\t\t\t\t</div>\n\t\t\t) }\n\t\t\t{ totalPages > 0 && (\n\t\t\t\t<ul { ...blockProps }>\n\t\t\t\t\t<PageItems\n\t\t\t\t\t\tcontext={ context }\n\t\t\t\t\t\tpagesByParentId={ pagesByParentId }\n\t\t\t\t\t/>\n\t\t\t\t</ul>\n\t\t\t) }\n\t\t</>\n\t);\n}\n\nfunction useFrontPageId() {\n\treturn useSelect( ( select ) => {\n\t\tconst site = select( coreStore ).getEntityRecord( 'root', 'site' );\n\t\treturn site?.show_on_front === 'page' && site?.page_on_front;\n\t}, [] );\n}\n\nfunction usePageData() {\n\tconst { pages, hasResolvedPages } = useSelect( ( select ) => {\n\t\tconst { getEntityRecords, hasFinishedResolution } = select( coreStore );\n\n\t\treturn {\n\t\t\tpages: getEntityRecords( 'postType', 'page', {\n\t\t\t\torderby: 'menu_order',\n\t\t\t\torder: 'asc',\n\t\t\t\t_fields: [ 'id', 'link', 'parent', 'title', 'menu_order' ],\n\t\t\t\tper_page: -1,\n\t\t\t} ),\n\t\t\thasResolvedPages: hasFinishedResolution( 'getEntityRecords', [\n\t\t\t\t'postType',\n\t\t\t\t'page',\n\t\t\t\t{\n\t\t\t\t\torderby: 'menu_order',\n\t\t\t\t\torder: 'asc',\n\t\t\t\t\t_fields: [ 'id', 'link', 'parent', 'title', 'menu_order' ],\n\t\t\t\t\tper_page: -1,\n\t\t\t\t},\n\t\t\t] ),\n\t\t};\n\t}, [] );\n\n\treturn useMemo( () => {\n\t\t// TODO: Once the REST API supports passing multiple values to\n\t\t// 'orderby', this can be removed.\n\t\t// https://core.trac.wordpress.org/ticket/39037\n\t\tconst sortedPages = sortBy( pages, [ 'menu_order', 'title.rendered' ] );\n\t\tconst pagesByParentId = sortedPages.reduce( ( accumulator, page ) => {\n\t\t\tconst { parent } = page;\n\t\t\tif ( accumulator.has( parent ) ) {\n\t\t\t\taccumulator.get( parent ).push( page );\n\t\t\t} else {\n\t\t\t\taccumulator.set( parent, [ page ] );\n\t\t\t}\n\t\t\treturn accumulator;\n\t\t}, new Map() );\n\n\t\treturn {\n\t\t\tpagesByParentId,\n\t\t\thasResolvedPages,\n\t\t\ttotalPages: pages?.length ?? null,\n\t\t};\n\t}, [ pages, hasResolvedPages ] );\n}\n\nconst PageItems = memo( function PageItems( {\n\tcontext,\n\tpagesByParentId,\n\tparentId = 0,\n\tdepth = 0,\n} ) {\n\tconst pages = pagesByParentId.get( parentId );\n\tconst frontPageId = useFrontPageId();\n\n\tif ( ! pages?.length ) {\n\t\treturn [];\n\t}\n\n\treturn pages.map( ( page ) => {\n\t\tconst hasChildren = pagesByParentId.has( page.id );\n\t\tconst isNavigationChild = 'showSubmenuIcon' in context;\n\t\treturn (\n\t\t\t<li\n\t\t\t\tkey={ page.id }\n\t\t\t\tclassName={ classnames( 'wp-block-pages-list__item', {\n\t\t\t\t\t'has-child': hasChildren,\n\t\t\t\t\t'wp-block-navigation-item': isNavigationChild,\n\t\t\t\t\t'open-on-click': context.openSubmenusOnClick,\n\t\t\t\t\t'open-on-hover-click':\n\t\t\t\t\t\t! context.openSubmenusOnClick &&\n\t\t\t\t\t\tcontext.showSubmenuIcon,\n\t\t\t\t\t'menu-item-home': page.id === frontPageId,\n\t\t\t\t} ) }\n\t\t\t>\n\t\t\t\t{ hasChildren && context.openSubmenusOnClick ? (\n\t\t\t\t\t<ItemSubmenuToggle title={ page.title?.rendered } />\n\t\t\t\t) : (\n\t\t\t\t\t<a\n\t\t\t\t\t\tclassName={ classnames(\n\t\t\t\t\t\t\t'wp-block-pages-list__item__link',\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t'wp-block-navigation-item__content': isNavigationChild,\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t) }\n\t\t\t\t\t\thref={ page.link }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ page.title?.rendered }\n\t\t\t\t\t</a>\n\t\t\t\t) }\n\t\t\t\t{ hasChildren && (\n\t\t\t\t\t<>\n\t\t\t\t\t\t{ ! context.openSubmenusOnClick &&\n\t\t\t\t\t\t\tcontext.showSubmenuIcon && <ItemSubmenuToggle /> }\n\t\t\t\t\t\t<ul\n\t\t\t\t\t\t\tclassName={ classnames( 'submenu-container', {\n\t\t\t\t\t\t\t\t'wp-block-navigation__submenu-container': isNavigationChild,\n\t\t\t\t\t\t\t} ) }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<PageItems\n\t\t\t\t\t\t\t\tcontext={ context }\n\t\t\t\t\t\t\t\tpagesByParentId={ pagesByParentId }\n\t\t\t\t\t\t\t\tparentId={ page.id }\n\t\t\t\t\t\t\t\tdepth={ depth + 1 }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</ul>\n\t\t\t\t\t</>\n\t\t\t\t) }\n\t\t\t</li>\n\t\t);\n\t} );\n} );\n\nfunction ItemSubmenuToggle( { title } ) {\n\treturn (\n\t\t<button\n\t\t\tclassName=\"wp-block-navigation-item__content wp-block-navigation-submenu__toggle\"\n\t\t\taria-expanded=\"false\"\n\t\t>\n\t\t\t{ title }\n\t\t\t<span className=\"wp-block-page-list__submenu-icon wp-block-navigation__submenu-icon\">\n\t\t\t\t<ItemSubmenuIcon />\n\t\t\t</span>\n\t\t</button>\n\t);\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["@wordpress/block-library/src/page-list/edit.js"],"names":["classnames","sortBy","BlockControls","useBlockProps","getColorClassName","ToolbarButton","Spinner","Notice","__","useMemo","useState","memo","useSelect","store","coreStore","ConvertToLinksModal","ItemSubmenuIcon","MAX_PAGE_COUNT","PageListEdit","context","clientId","pagesByParentId","totalPages","hasResolvedPages","usePageData","isNavigationChild","allowConvertToLinks","isOpen","setOpen","openModal","closeModal","blockProps","className","textColor","backgroundColor","style","color","useFrontPageId","select","site","getEntityRecord","show_on_front","page_on_front","pages","getEntityRecords","hasFinishedResolution","orderby","order","_fields","per_page","sortedPages","reduce","accumulator","page","parent","has","get","push","set","Map","length","PageItems","parentId","depth","frontPageId","map","hasChildren","id","openSubmenusOnClick","showSubmenuIcon","title","rendered","link"],"mappings":";;AAAA;AACA;AACA;AACA,OAAOA,UAAP,MAAuB,YAAvB;AACA,SAASC,MAAT,QAAuB,QAAvB;AAEA;AACA;AACA;;AACA,SACCC,aADD,EAECC,aAFD,EAGCC,iBAHD,QAIO,yBAJP;AAKA,SAASC,aAAT,EAAwBC,OAAxB,EAAiCC,MAAjC,QAA+C,uBAA/C;AACA,SAASC,EAAT,QAAmB,iBAAnB;AACA,SAASC,OAAT,EAAkBC,QAAlB,EAA4BC,IAA5B,QAAwC,oBAAxC;AACA,SAASC,SAAT,QAA0B,iBAA1B;AACA,SAASC,KAAK,IAAIC,SAAlB,QAAmC,sBAAnC;AAEA;AACA;AACA;;AACA,OAAOC,mBAAP,MAAgC,0BAAhC;AACA,SA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AjD,OAAO,CAACkD,eAN2C;AAOpD,0BAAkBhB,IAAI,CAACc,EAAL,KAAYH;AAPsB,OAA/B;AAFvB,OAYGE,WAAW,IAAI/C,OAAO,CAACiD,mBAAvB,GACD,8BACC;AACC,MAAA,SAAS,EAAC,uEADX;AAEC,uBAAc;AAFf,sBAIGf,IAAI,CAACiB,KAJR,gDAIG,YAAYC,QAJf,CADD,EAOC;AAAM,MAAA,SAAS,EAAC;AAAhB,OACC,cAAC,eAAD,OADD,CAPD,CADC,GAaD;AACC,MAAA,SAAS,EAAGvE,UAAU,CACrB,iCADqB,EAErB;AACC,6CAAqCyB;AADtC,OAFqB,CADvB;AAOC,MAAA,IAAI,EAAG4B,IAAI,CAACmB;AAPb,uBASGnB,IAAI,CAACiB,KATR,iDASG,aAAYC,QATf,CAzBF,EAqCGL,WAAW,IACZ,8BACG,CAAE/C,OAAO,CAACiD,mBAAV,IACDjD,OAAO,CAACkD,eADP,IAEA;AACC,MAAA,SAAS,EAAC,0IADX;AAEC,uBAAc;AAFf,OAIC,cAAC,eAAD,OAJD,CAHH,EAUC;AACC,MAAA,SAAS,EAAGrE,UAAU,CAAE,mBAAF,EAAuB;AAC5C,kDAA0CyB;AADE,OAAvB;AADvB,OAKC,cAAC,SAAD;AACC,MAAA,OAAO,EAAGN,OADX;AAEC,MAAA,eAAe,EAAGE,eAFnB;AAGC,MAAA,QAAQ,EAAGgC,IAAI,CAACc,EAHjB;AAIC,MAAA,KAAK,EAAGJ,KAAK,GAAG;AAJjB,MALD,CAVD,CAtCF,CADD;AAiEA,GApEM,CAAP;AAqEA,CAlFqB,CAAtB","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\nimport { sortBy } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tBlockControls,\n\tuseBlockProps,\n\tgetColorClassName,\n} from '@wordpress/block-editor';\nimport { ToolbarButton, Spinner, Notice } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { useMemo, useState, memo } from '@wordpress/element';\nimport { useSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport ConvertToLinksModal from './convert-to-links-modal';\nimport { ItemSubmenuIcon } from '../navigation-link/icons';\n\n// We only show the edit option when page count is <= MAX_PAGE_COUNT\n// Performance of Navigation Links is not good past this value.\nconst MAX_PAGE_COUNT = 100;\n\nexport default function PageListEdit( { context, clientId } ) {\n\tconst { pagesByParentId, totalPages, hasResolvedPages } = usePageData();\n\n\tconst isNavigationChild = 'showSubmenuIcon' in context;\n\tconst allowConvertToLinks =\n\t\tisNavigationChild && totalPages <= MAX_PAGE_COUNT;\n\n\tconst [ isOpen, setOpen ] = useState( false );\n\tconst openModal = () => setOpen( true );\n\tconst closeModal = () => setOpen( false );\n\n\tconst blockProps = useBlockProps( {\n\t\tclassName: classnames( 'wp-block-page-list', {\n\t\t\t'has-text-color': !! context.textColor,\n\t\t\t[ getColorClassName(\n\t\t\t\t'color',\n\t\t\t\tcontext.textColor\n\t\t\t) ]: !! context.textColor,\n\t\t\t'has-background': !! context.backgroundColor,\n\t\t\t[ getColorClassName(\n\t\t\t\t'background-color',\n\t\t\t\tcontext.backgroundColor\n\t\t\t) ]: !! context.backgroundColor,\n\t\t} ),\n\t\tstyle: { ...context.style?.color },\n\t} );\n\n\treturn (\n\t\t<>\n\t\t\t{ allowConvertToLinks && (\n\t\t\t\t<BlockControls group=\"other\">\n\t\t\t\t\t<ToolbarButton title={ __( 'Edit' ) } onClick={ openModal }>\n\t\t\t\t\t\t{ __( 'Edit' ) }\n\t\t\t\t\t</ToolbarButton>\n\t\t\t\t</BlockControls>\n\t\t\t) }\n\t\t\t{ allowConvertToLinks && isOpen && (\n\t\t\t\t<ConvertToLinksModal\n\t\t\t\t\tonClose={ closeModal }\n\t\t\t\t\tclientId={ clientId }\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ ! hasResolvedPages && (\n\t\t\t\t<div { ...blockProps }>\n\t\t\t\t\t<Spinner />\n\t\t\t\t</div>\n\t\t\t) }\n\n\t\t\t{ hasResolvedPages && totalPages === null && (\n\t\t\t\t<div { ...blockProps }>\n\t\t\t\t\t<div { ...blockProps }>\n\t\t\t\t\t\t<Notice status={ 'warning' } isDismissible={ false }>\n\t\t\t\t\t\t\t{ __( 'Page List: Cannot retrieve Pages.' ) }\n\t\t\t\t\t\t</Notice>\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t) }\n\n\t\t\t{ totalPages === 0 && (\n\t\t\t\t<div { ...blockProps }>\n\t\t\t\t\t<Notice status={ 'info' } isDismissible={ false }>\n\t\t\t\t\t\t{ __( 'Page List: Cannot retrieve Pages.' ) }\n\t\t\t\t\t</Notice>\n\t\t\t\t</div>\n\t\t\t) }\n\t\t\t{ totalPages > 0 && (\n\t\t\t\t<ul { ...blockProps }>\n\t\t\t\t\t<PageItems\n\t\t\t\t\t\tcontext={ context }\n\t\t\t\t\t\tpagesByParentId={ pagesByParentId }\n\t\t\t\t\t/>\n\t\t\t\t</ul>\n\t\t\t) }\n\t\t</>\n\t);\n}\n\nfunction useFrontPageId() {\n\treturn useSelect( ( select ) => {\n\t\tconst site = select( coreStore ).getEntityRecord( 'root', 'site' );\n\t\treturn site?.show_on_front === 'page' && site?.page_on_front;\n\t}, [] );\n}\n\nfunction usePageData() {\n\tconst { pages, hasResolvedPages } = useSelect( ( select ) => {\n\t\tconst { getEntityRecords, hasFinishedResolution } = select( coreStore );\n\n\t\treturn {\n\t\t\tpages: getEntityRecords( 'postType', 'page', {\n\t\t\t\torderby: 'menu_order',\n\t\t\t\torder: 'asc',\n\t\t\t\t_fields: [ 'id', 'link', 'parent', 'title', 'menu_order' ],\n\t\t\t\tper_page: -1,\n\t\t\t} ),\n\t\t\thasResolvedPages: hasFinishedResolution( 'getEntityRecords', [\n\t\t\t\t'postType',\n\t\t\t\t'page',\n\t\t\t\t{\n\t\t\t\t\torderby: 'menu_order',\n\t\t\t\t\torder: 'asc',\n\t\t\t\t\t_fields: [ 'id', 'link', 'parent', 'title', 'menu_order' ],\n\t\t\t\t\tper_page: -1,\n\t\t\t\t},\n\t\t\t] ),\n\t\t};\n\t}, [] );\n\n\treturn useMemo( () => {\n\t\t// TODO: Once the REST API supports passing multiple values to\n\t\t// 'orderby', this can be removed.\n\t\t// https://core.trac.wordpress.org/ticket/39037\n\t\tconst sortedPages = sortBy( pages, [ 'menu_order', 'title.rendered' ] );\n\t\tconst pagesByParentId = sortedPages.reduce( ( accumulator, page ) => {\n\t\t\tconst { parent } = page;\n\t\t\tif ( accumulator.has( parent ) ) {\n\t\t\t\taccumulator.get( parent ).push( page );\n\t\t\t} else {\n\t\t\t\taccumulator.set( parent, [ page ] );\n\t\t\t}\n\t\t\treturn accumulator;\n\t\t}, new Map() );\n\n\t\treturn {\n\t\t\tpagesByParentId,\n\t\t\thasResolvedPages,\n\t\t\ttotalPages: pages?.length ?? null,\n\t\t};\n\t}, [ pages, hasResolvedPages ] );\n}\n\nconst PageItems = memo( function PageItems( {\n\tcontext,\n\tpagesByParentId,\n\tparentId = 0,\n\tdepth = 0,\n} ) {\n\tconst pages = pagesByParentId.get( parentId );\n\tconst frontPageId = useFrontPageId();\n\n\tif ( ! pages?.length ) {\n\t\treturn [];\n\t}\n\n\treturn pages.map( ( page ) => {\n\t\tconst hasChildren = pagesByParentId.has( page.id );\n\t\tconst isNavigationChild = 'showSubmenuIcon' in context;\n\t\treturn (\n\t\t\t<li\n\t\t\t\tkey={ page.id }\n\t\t\t\tclassName={ classnames( 'wp-block-pages-list__item', {\n\t\t\t\t\t'has-child': hasChildren,\n\t\t\t\t\t'wp-block-navigation-item': isNavigationChild,\n\t\t\t\t\t'open-on-click': context.openSubmenusOnClick,\n\t\t\t\t\t'open-on-hover-click':\n\t\t\t\t\t\t! context.openSubmenusOnClick &&\n\t\t\t\t\t\tcontext.showSubmenuIcon,\n\t\t\t\t\t'menu-item-home': page.id === frontPageId,\n\t\t\t\t} ) }\n\t\t\t>\n\t\t\t\t{ hasChildren && context.openSubmenusOnClick ? (\n\t\t\t\t\t<>\n\t\t\t\t\t\t<button\n\t\t\t\t\t\t\tclassName=\"wp-block-navigation-item__content wp-block-navigation-submenu__toggle\"\n\t\t\t\t\t\t\taria-expanded=\"false\"\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ page.title?.rendered }\n\t\t\t\t\t\t</button>\n\t\t\t\t\t\t<span className=\"wp-block-page-list__submenu-icon wp-block-navigation__submenu-icon\">\n\t\t\t\t\t\t\t<ItemSubmenuIcon />\n\t\t\t\t\t\t</span>\n\t\t\t\t\t</>\n\t\t\t\t) : (\n\t\t\t\t\t<a\n\t\t\t\t\t\tclassName={ classnames(\n\t\t\t\t\t\t\t'wp-block-pages-list__item__link',\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t'wp-block-navigation-item__content': isNavigationChild,\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t) }\n\t\t\t\t\t\thref={ page.link }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ page.title?.rendered }\n\t\t\t\t\t</a>\n\t\t\t\t) }\n\t\t\t\t{ hasChildren && (\n\t\t\t\t\t<>\n\t\t\t\t\t\t{ ! context.openSubmenusOnClick &&\n\t\t\t\t\t\t\tcontext.showSubmenuIcon && (\n\t\t\t\t\t\t\t\t<button\n\t\t\t\t\t\t\t\t\tclassName=\"wp-block-navigation-item__content wp-block-navigation-submenu__toggle wp-block-page-list__submenu-icon wp-block-navigation__submenu-icon\"\n\t\t\t\t\t\t\t\t\taria-expanded=\"false\"\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t<ItemSubmenuIcon />\n\t\t\t\t\t\t\t\t</button>\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t<ul\n\t\t\t\t\t\t\tclassName={ classnames( 'submenu-container', {\n\t\t\t\t\t\t\t\t'wp-block-navigation__submenu-container': isNavigationChild,\n\t\t\t\t\t\t\t} ) }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<PageItems\n\t\t\t\t\t\t\t\tcontext={ context }\n\t\t\t\t\t\t\t\tpagesByParentId={ pagesByParentId }\n\t\t\t\t\t\t\t\tparentId={ page.id }\n\t\t\t\t\t\t\t\tdepth={ depth + 1 }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</ul>\n\t\t\t\t\t</>\n\t\t\t\t) }\n\t\t\t</li>\n\t\t);\n\t} );\n} );\n"]}
|
|
@@ -55,68 +55,7 @@ const migrateWithLayout = attributes => {
|
|
|
55
55
|
}; // Social Links block deprecations.
|
|
56
56
|
|
|
57
57
|
|
|
58
|
-
const deprecated = [//
|
|
59
|
-
{
|
|
60
|
-
attributes: {
|
|
61
|
-
iconColor: {
|
|
62
|
-
type: 'string'
|
|
63
|
-
},
|
|
64
|
-
customIconColor: {
|
|
65
|
-
type: 'string'
|
|
66
|
-
},
|
|
67
|
-
iconColorValue: {
|
|
68
|
-
type: 'string'
|
|
69
|
-
},
|
|
70
|
-
iconBackgroundColor: {
|
|
71
|
-
type: 'string'
|
|
72
|
-
},
|
|
73
|
-
customIconBackgroundColor: {
|
|
74
|
-
type: 'string'
|
|
75
|
-
},
|
|
76
|
-
iconBackgroundColorValue: {
|
|
77
|
-
type: 'string'
|
|
78
|
-
},
|
|
79
|
-
openInNewTab: {
|
|
80
|
-
type: 'boolean',
|
|
81
|
-
default: false
|
|
82
|
-
},
|
|
83
|
-
size: {
|
|
84
|
-
type: 'string'
|
|
85
|
-
}
|
|
86
|
-
},
|
|
87
|
-
supports: {
|
|
88
|
-
align: ['left', 'center', 'right'],
|
|
89
|
-
anchor: true,
|
|
90
|
-
__experimentalExposeControlsToChildren: true
|
|
91
|
-
},
|
|
92
|
-
isEligible: _ref => {
|
|
93
|
-
let {
|
|
94
|
-
layout
|
|
95
|
-
} = _ref;
|
|
96
|
-
return !layout;
|
|
97
|
-
},
|
|
98
|
-
migrate: migrateWithLayout,
|
|
99
|
-
|
|
100
|
-
save(props) {
|
|
101
|
-
const {
|
|
102
|
-
attributes: {
|
|
103
|
-
iconBackgroundColorValue,
|
|
104
|
-
iconColorValue,
|
|
105
|
-
itemsJustification,
|
|
106
|
-
size
|
|
107
|
-
}
|
|
108
|
-
} = props;
|
|
109
|
-
const className = classNames(size, {
|
|
110
|
-
'has-icon-color': iconColorValue,
|
|
111
|
-
'has-icon-background-color': iconBackgroundColorValue,
|
|
112
|
-
[`items-justified-${itemsJustification}`]: itemsJustification
|
|
113
|
-
});
|
|
114
|
-
return createElement("ul", useBlockProps.save({
|
|
115
|
-
className
|
|
116
|
-
}), createElement(InnerBlocks.Content, null));
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
}, // V1. Remove CSS variable use for colors.
|
|
58
|
+
const deprecated = [// V1. Remove CSS variable use for colors.
|
|
120
59
|
{
|
|
121
60
|
attributes: {
|
|
122
61
|
iconColor: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-library/src/social-links/deprecated.js"],"names":["classNames","InnerBlocks","useBlockProps","migrateWithLayout","attributes","layout","className","prefix","justifiedItemsRegex","RegExp","newAttributes","replace","trim","justifyContent","match","Object","assign","type","slice","length","deprecated","iconColor","customIconColor","iconColorValue","iconBackgroundColor","customIconBackgroundColor","iconBackgroundColorValue","openInNewTab","default","size","supports","align","anchor","
|
|
1
|
+
{"version":3,"sources":["@wordpress/block-library/src/social-links/deprecated.js"],"names":["classNames","InnerBlocks","useBlockProps","migrateWithLayout","attributes","layout","className","prefix","justifiedItemsRegex","RegExp","newAttributes","replace","trim","justifyContent","match","Object","assign","type","slice","length","deprecated","iconColor","customIconColor","iconColorValue","iconBackgroundColor","customIconBackgroundColor","iconBackgroundColorValue","openInNewTab","default","size","providesContext","supports","align","anchor","migrate","save","props","itemsJustification","style"],"mappings":";;AAAA;AACA;AACA;AACA,OAAOA,UAAP,MAAuB,YAAvB;AAEA;AACA;AACA;;AACA,SAASC,WAAT,EAAsBC,aAAtB,QAA2C,yBAA3C;AAEA;AACA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["/**\n * External dependencies\n */\nimport classNames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { InnerBlocks, useBlockProps } from '@wordpress/block-editor';\n\n/**\n * The specific handling by `className` below is needed because `itemsJustification`\n * was introduced in https://github.com/WordPress/gutenberg/pull/28980/files and wasn't\n * declared in block.json.\n *\n * @param {Object} attributes Block's attributes.\n */\nconst migrateWithLayout = ( attributes ) => {\n\tif ( !! attributes.layout ) {\n\t\treturn attributes;\n\t}\n\tconst { className } = attributes;\n\t// Matches classes with `items-justified-` prefix.\n\tconst prefix = `items-justified-`;\n\tconst justifiedItemsRegex = new RegExp( `\\\\b${ prefix }[^ ]*[ ]?\\\\b`, 'g' );\n\tconst newAttributes = {\n\t\t...attributes,\n\t\tclassName: className?.replace( justifiedItemsRegex, '' ).trim(),\n\t};\n\t/**\n\t * Add `layout` prop only if `justifyContent` is defined, for backwards\n\t * compatibility. In other cases the block's default layout will be used.\n\t * Also noting that due to the missing attribute, it's possible for a block\n\t * to have more than one of `justified` classes.\n\t */\n\tconst justifyContent = className\n\t\t?.match( justifiedItemsRegex )?.[ 0 ]\n\t\t?.trim();\n\tif ( justifyContent ) {\n\t\tObject.assign( newAttributes, {\n\t\t\tlayout: {\n\t\t\t\ttype: 'flex',\n\t\t\t\tjustifyContent: justifyContent.slice( prefix.length ),\n\t\t\t},\n\t\t} );\n\t}\n\treturn newAttributes;\n};\n\n// Social Links block deprecations.\nconst deprecated = [\n\t// V1. Remove CSS variable use for colors.\n\t{\n\t\tattributes: {\n\t\t\ticonColor: {\n\t\t\t\ttype: 'string',\n\t\t\t},\n\t\t\tcustomIconColor: {\n\t\t\t\ttype: 'string',\n\t\t\t},\n\t\t\ticonColorValue: {\n\t\t\t\ttype: 'string',\n\t\t\t},\n\t\t\ticonBackgroundColor: {\n\t\t\t\ttype: 'string',\n\t\t\t},\n\t\t\tcustomIconBackgroundColor: {\n\t\t\t\ttype: 'string',\n\t\t\t},\n\t\t\ticonBackgroundColorValue: {\n\t\t\t\ttype: 'string',\n\t\t\t},\n\t\t\topenInNewTab: {\n\t\t\t\ttype: 'boolean',\n\t\t\t\tdefault: false,\n\t\t\t},\n\t\t\tsize: {\n\t\t\t\ttype: 'string',\n\t\t\t},\n\t\t},\n\t\tprovidesContext: {\n\t\t\topenInNewTab: 'openInNewTab',\n\t\t},\n\t\tsupports: {\n\t\t\talign: [ 'left', 'center', 'right' ],\n\t\t\tanchor: true,\n\t\t},\n\t\tmigrate: migrateWithLayout,\n\t\tsave: ( props ) => {\n\t\t\tconst {\n\t\t\t\tattributes: {\n\t\t\t\t\ticonBackgroundColorValue,\n\t\t\t\t\ticonColorValue,\n\t\t\t\t\titemsJustification,\n\t\t\t\t\tsize,\n\t\t\t\t},\n\t\t\t} = props;\n\n\t\t\tconst className = classNames( size, {\n\t\t\t\t'has-icon-color': iconColorValue,\n\t\t\t\t'has-icon-background-color': iconBackgroundColorValue,\n\t\t\t\t[ `items-justified-${ itemsJustification }` ]: itemsJustification,\n\t\t\t} );\n\n\t\t\tconst style = {\n\t\t\t\t'--wp--social-links--icon-color': iconColorValue,\n\t\t\t\t'--wp--social-links--icon-background-color': iconBackgroundColorValue,\n\t\t\t};\n\n\t\t\treturn (\n\t\t\t\t<ul { ...useBlockProps.save( { className, style } ) }>\n\t\t\t\t\t<InnerBlocks.Content />\n\t\t\t\t</ul>\n\t\t\t);\n\t\t},\n\t},\n];\n\nexport default deprecated;\n"]}
|