@wordpress/block-library 9.25.0 → 9.26.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +2 -0
- package/build/avatar/edit.js +84 -39
- package/build/avatar/edit.js.map +1 -1
- package/build/avatar/user-control.js +32 -17
- package/build/avatar/user-control.js.map +1 -1
- package/build/embed/variations.js +0 -10
- package/build/embed/variations.js.map +1 -1
- package/build/form/edit.js +0 -1
- package/build/form/edit.js.map +1 -1
- package/build/form/index.js +3 -3
- package/build/form/index.js.map +1 -1
- package/build/form-input/index.js +2 -1
- package/build/form-input/index.js.map +1 -1
- package/build/form-submission-notification/index.js +2 -1
- package/build/form-submission-notification/index.js.map +1 -1
- package/build/form-submit-button/index.js +2 -1
- package/build/form-submit-button/index.js.map +1 -1
- package/build/image/image.js +1 -0
- package/build/image/image.js.map +1 -1
- package/build/image/view.js +0 -3
- package/build/image/view.js.map +1 -1
- package/build/navigation-link/edit.js +11 -0
- package/build/navigation-link/edit.js.map +1 -1
- package/build/post-author/edit.js +75 -18
- package/build/post-author/edit.js.map +1 -1
- package/build/post-navigation-link/edit.js +72 -33
- package/build/post-navigation-link/edit.js.map +1 -1
- package/build/site-logo/edit.js +53 -19
- package/build/site-logo/edit.js.map +1 -1
- package/build/social-link/edit.js +21 -5
- package/build/social-link/edit.js.map +1 -1
- package/build/social-link/edit.native.js +13 -5
- package/build/social-link/edit.native.js.map +1 -1
- package/build/social-link/social-list.js +17 -25
- package/build/social-link/social-list.js.map +1 -1
- package/build/social-links/edit.js +8 -5
- package/build/social-links/edit.js.map +1 -1
- package/build/video/tracks-editor.js +23 -9
- package/build/video/tracks-editor.js.map +1 -1
- package/build-module/avatar/edit.js +83 -38
- package/build-module/avatar/edit.js.map +1 -1
- package/build-module/avatar/user-control.js +33 -18
- package/build-module/avatar/user-control.js.map +1 -1
- package/build-module/embed/variations.js +0 -10
- package/build-module/embed/variations.js.map +1 -1
- package/build-module/form/edit.js +0 -1
- package/build-module/form/edit.js.map +1 -1
- package/build-module/form/index.js +3 -3
- package/build-module/form/index.js.map +1 -1
- package/build-module/form-input/index.js +2 -1
- package/build-module/form-input/index.js.map +1 -1
- package/build-module/form-submission-notification/index.js +2 -1
- package/build-module/form-submission-notification/index.js.map +1 -1
- package/build-module/form-submit-button/index.js +2 -1
- package/build-module/form-submit-button/index.js.map +1 -1
- package/build-module/image/image.js +1 -0
- package/build-module/image/image.js.map +1 -1
- package/build-module/image/view.js +0 -3
- package/build-module/image/view.js.map +1 -1
- package/build-module/navigation-link/edit.js +11 -0
- package/build-module/navigation-link/edit.js.map +1 -1
- package/build-module/post-author/edit.js +76 -19
- package/build-module/post-author/edit.js.map +1 -1
- package/build-module/post-navigation-link/edit.js +73 -34
- package/build-module/post-navigation-link/edit.js.map +1 -1
- package/build-module/site-logo/edit.js +54 -20
- package/build-module/site-logo/edit.js.map +1 -1
- package/build-module/social-link/edit.js +24 -8
- package/build-module/social-link/edit.js.map +1 -1
- package/build-module/social-link/edit.native.js +15 -6
- package/build-module/social-link/edit.native.js.map +1 -1
- package/build-module/social-link/social-list.js +16 -21
- package/build-module/social-link/social-list.js.map +1 -1
- package/build-module/social-links/edit.js +8 -5
- package/build-module/social-links/edit.js.map +1 -1
- package/build-module/video/tracks-editor.js +24 -10
- package/build-module/video/tracks-editor.js.map +1 -1
- package/build-style/calendar/style-rtl.css +7 -7
- package/build-style/calendar/style.css +7 -7
- package/build-style/comments-pagination/editor-rtl.css +0 -12
- package/build-style/comments-pagination/editor.css +0 -14
- package/build-style/comments-pagination/style-rtl.css +0 -7
- package/build-style/comments-pagination/style.css +0 -9
- package/build-style/editor-rtl.css +0 -17
- package/build-style/editor.css +0 -19
- package/build-style/navigation/style-rtl.css +4 -0
- package/build-style/navigation/style.css +4 -0
- package/build-style/style-rtl.css +11 -14
- package/build-style/style.css +11 -16
- package/package.json +35 -35
- package/src/avatar/edit.js +99 -51
- package/src/avatar/user-control.js +34 -29
- package/src/calendar/style.scss +10 -10
- package/src/comments-pagination/editor.scss +0 -15
- package/src/comments-pagination/style.scss +0 -8
- package/src/editor.scss +0 -1
- package/src/embed/variations.js +0 -8
- package/src/form/block.json +1 -2
- package/src/form/edit.js +0 -1
- package/src/form/index.js +1 -0
- package/src/form-input/index.js +1 -0
- package/src/form-submission-notification/index.js +1 -0
- package/src/form-submit-button/index.js +1 -0
- package/src/image/image.js +1 -0
- package/src/image/index.php +4 -1
- package/src/image/view.js +0 -3
- package/src/navigation/style.scss +8 -0
- package/src/navigation-link/edit.js +14 -1
- package/src/post-author/edit.js +91 -27
- package/src/post-navigation-link/edit.js +96 -51
- package/src/site-logo/edit.js +69 -26
- package/src/social-link/edit.js +18 -7
- package/src/social-link/edit.native.js +10 -4
- package/src/social-link/index.php +13 -0
- package/src/social-link/social-list.js +15 -20
- package/src/social-links/edit.js +6 -7
- package/src/video/tracks-editor.js +18 -6
- package/build-style/post-author/editor-rtl.css +0 -140
- package/build-style/post-author/editor.css +0 -140
- package/src/post-author/editor.scss +0 -7
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["clsx","createBlock","useSelect","useDispatch","__experimentalToolsPanel","ToolsPanel","__experimentalToolsPanelItem","ToolsPanelItem","TextControl","TextareaControl","ToolbarButton","ToolbarGroup","displayShortcut","isKeyboardEvent","__","BlockControls","InspectorControls","RichText","useBlockProps","store","blockEditorStore","getColorClassName","useInnerBlocksProps","useBlockEditingMode","isURL","prependHTTP","safeDecodeURI","useState","useEffect","useRef","__unstableStripHTML","stripHTML","decodeEntities","link","linkIcon","addSubmenu","coreStore","useMergeRefs","usePrevious","LinkUI","updateAttributes","getColors","jsx","_jsx","jsxs","_jsxs","Fragment","_Fragment","DEFAULT_BLOCK","name","NESTING_BLOCK_NAMES","useIsDraggingWithin","elementRef","isDraggingWithin","setIsDraggingWithin","ownerDocument","current","handleDragStart","event","handleDragEnter","handleDragEnd","contains","target","addEventListener","removeEventListener","useIsInvalidLink","kind","type","id","enabled","isPostType","hasId","Number","isInteger","blockEditingMode","postStatus","select","getEntityRecord","status","isInvalid","isDraft","getMissingText","missingText","Controls","attributes","setAttributes","setIsLabelFieldFocused","label","url","description","rel","children","hasValue","onDeselect","isShownByDefault","__nextHasNoMarginBottom","__next40pxDefaultSize","value","onChange","labelValue","autoComplete","onFocus","onBlur","urlValue","descriptionValue","help","relValue","NavigationLinkEdit","isSelected","insertBlocksAfter","mergeBlocks","onReplace","context","clientId","maxNestingLevel","replaceBlock","__unstableMarkNextChangeAsNotPersistent","selectBlock","selectPreviousBlock","isLinkOpen","setIsLinkOpen","openedBy","setOpenedBy","popoverAnchor","setPopoverAnchor","listItemRef","itemLabelPlaceholder","ref","linkUIref","prevUrl","isLabelFieldFocused","isAtMaxNesting","isTopLevelLink","isParentOfSelectedBlock","hasChildren","validateLinkStatus","getBlockCount","getBlockName","getBlockRootClientId","hasSelectedInnerBlock","getBlockParentsByBlockName","getSelectedBlockClientId","rootClientId","isTopLevel","selectedBlockClientId","rootNavigationClientId","enableLinkStatusValidation","length","getBlocks","transformToSubmenu","innerBlocks","newSubmenu","test","selectLabelText","focus","defaultView","selection","getSelection","range","createRange","selectNodeContents","removeAllRanges","addRange","removeLink","undefined","opensInNewTab","textColor","customTextColor","backgroundColor","customBackgroundColor","onKeyDown","primary","preventDefault","stopPropagation","blockProps","className","style","color","innerBlocksProps","defaultBlock","directInsert","renderAppender","onClick","classes","placeholderText","icon","title","shortcut","currentTarget","identifier","onMerge","__unstableOnSplitAtEnd","placeholder","withoutInteractiveFormatting","trim","onClose","window","document","activeElement","anchor","onRemove","updatedValue"],"sources":["@wordpress/block-library/src/navigation-link/edit.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { createBlock } from '@wordpress/blocks';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport {\n\t__experimentalToolsPanel as ToolsPanel,\n\t__experimentalToolsPanelItem as ToolsPanelItem,\n\tTextControl,\n\tTextareaControl,\n\tToolbarButton,\n\tToolbarGroup,\n} from '@wordpress/components';\nimport { displayShortcut, isKeyboardEvent } from '@wordpress/keycodes';\nimport { __ } from '@wordpress/i18n';\nimport {\n\tBlockControls,\n\tInspectorControls,\n\tRichText,\n\tuseBlockProps,\n\tstore as blockEditorStore,\n\tgetColorClassName,\n\tuseInnerBlocksProps,\n\tuseBlockEditingMode,\n} from '@wordpress/block-editor';\nimport { isURL, prependHTTP, safeDecodeURI } from '@wordpress/url';\nimport { useState, useEffect, useRef } from '@wordpress/element';\nimport { __unstableStripHTML as stripHTML } from '@wordpress/dom';\nimport { decodeEntities } from '@wordpress/html-entities';\nimport { link as linkIcon, addSubmenu } from '@wordpress/icons';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { useMergeRefs, usePrevious } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport { LinkUI } from './link-ui';\nimport { updateAttributes } from './update-attributes';\nimport { getColors } from '../navigation/edit/utils';\n\nconst DEFAULT_BLOCK = { name: 'core/navigation-link' };\nconst NESTING_BLOCK_NAMES = [\n\t'core/navigation-link',\n\t'core/navigation-submenu',\n];\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}, [ elementRef ] );\n\n\treturn isDraggingWithin;\n};\n\nconst useIsInvalidLink = ( kind, type, id, enabled ) => {\n\tconst isPostType =\n\t\tkind === 'post-type' || type === 'post' || type === 'page';\n\tconst hasId = Number.isInteger( id );\n\tconst blockEditingMode = useBlockEditingMode();\n\n\tconst postStatus = useSelect(\n\t\t( select ) => {\n\t\t\tif ( ! isPostType ) {\n\t\t\t\treturn null;\n\t\t\t}\n\n\t\t\t// Fetching the posts status is an \"expensive\" operation. Especially for sites with large navigations.\n\t\t\t// When the block is rendered in a template or other disabled contexts we can skip this check in order\n\t\t\t// to avoid all these additional requests that don't really add any value in that mode.\n\t\t\tif ( blockEditingMode === 'disabled' || ! enabled ) {\n\t\t\t\treturn null;\n\t\t\t}\n\n\t\t\tconst { getEntityRecord } = select( coreStore );\n\t\t\treturn getEntityRecord( 'postType', type, id )?.status;\n\t\t},\n\t\t[ isPostType, blockEditingMode, enabled, type, id ]\n\t);\n\n\t// Check Navigation Link validity if:\n\t// 1. Link is 'post-type'.\n\t// 2. It has an id.\n\t// 3. It's neither null, nor undefined, as valid items might be either of those while loading.\n\t// If those conditions are met, check if\n\t// 1. The post status is published.\n\t// 2. The Navigation Link item has no label.\n\t// If either of those is true, invalidate.\n\tconst isInvalid =\n\t\tisPostType && hasId && postStatus && 'trash' === postStatus;\n\tconst isDraft = 'draft' === postStatus;\n\n\treturn [ isInvalid, isDraft ];\n};\n\nfunction getMissingText( type ) {\n\tlet missingText = '';\n\n\tswitch ( type ) {\n\t\tcase 'post':\n\t\t\t/* translators: label for missing post in navigation link block */\n\t\t\tmissingText = __( 'Select post' );\n\t\t\tbreak;\n\t\tcase 'page':\n\t\t\t/* translators: label for missing page in navigation link block */\n\t\t\tmissingText = __( 'Select page' );\n\t\t\tbreak;\n\t\tcase 'category':\n\t\t\t/* translators: label for missing category in navigation link block */\n\t\t\tmissingText = __( 'Select category' );\n\t\t\tbreak;\n\t\tcase 'tag':\n\t\t\t/* translators: label for missing tag in navigation link block */\n\t\t\tmissingText = __( 'Select tag' );\n\t\t\tbreak;\n\t\tdefault:\n\t\t\t/* translators: label for missing values in navigation link block */\n\t\t\tmissingText = __( 'Add link' );\n\t}\n\n\treturn missingText;\n}\n\n/*\n * Warning, this duplicated in\n * packages/block-library/src/navigation-submenu/edit.js\n * Consider reusing this components for both blocks.\n */\nfunction Controls( { attributes, setAttributes, setIsLabelFieldFocused } ) {\n\tconst { label, url, description, rel } = attributes;\n\treturn (\n\t\t<ToolsPanel label={ __( 'Settings' ) }>\n\t\t\t<ToolsPanelItem\n\t\t\t\thasValue={ () => !! label }\n\t\t\t\tlabel={ __( 'Text' ) }\n\t\t\t\tonDeselect={ () => setAttributes( { label: '' } ) }\n\t\t\t\tisShownByDefault\n\t\t\t>\n\t\t\t\t<TextControl\n\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\tlabel={ __( 'Text' ) }\n\t\t\t\t\tvalue={ label ? stripHTML( label ) : '' }\n\t\t\t\t\tonChange={ ( labelValue ) => {\n\t\t\t\t\t\tsetAttributes( { label: labelValue } );\n\t\t\t\t\t} }\n\t\t\t\t\tautoComplete=\"off\"\n\t\t\t\t\tonFocus={ () => setIsLabelFieldFocused( true ) }\n\t\t\t\t\tonBlur={ () => setIsLabelFieldFocused( false ) }\n\t\t\t\t/>\n\t\t\t</ToolsPanelItem>\n\n\t\t\t<ToolsPanelItem\n\t\t\t\thasValue={ () => !! url }\n\t\t\t\tlabel={ __( 'Link' ) }\n\t\t\t\tonDeselect={ () => setAttributes( { url: '' } ) }\n\t\t\t\tisShownByDefault\n\t\t\t>\n\t\t\t\t<TextControl\n\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\tlabel={ __( 'Link' ) }\n\t\t\t\t\tvalue={ url ? safeDecodeURI( url ) : '' }\n\t\t\t\t\tonChange={ ( urlValue ) => {\n\t\t\t\t\t\tupdateAttributes(\n\t\t\t\t\t\t\t{ url: urlValue },\n\t\t\t\t\t\t\tsetAttributes,\n\t\t\t\t\t\t\tattributes\n\t\t\t\t\t\t);\n\t\t\t\t\t} }\n\t\t\t\t\tautoComplete=\"off\"\n\t\t\t\t\ttype=\"url\"\n\t\t\t\t/>\n\t\t\t</ToolsPanelItem>\n\n\t\t\t<ToolsPanelItem\n\t\t\t\thasValue={ () => !! description }\n\t\t\t\tlabel={ __( 'Description' ) }\n\t\t\t\tonDeselect={ () => setAttributes( { description: '' } ) }\n\t\t\t\tisShownByDefault\n\t\t\t>\n\t\t\t\t<TextareaControl\n\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\tlabel={ __( 'Description' ) }\n\t\t\t\t\tvalue={ description || '' }\n\t\t\t\t\tonChange={ ( descriptionValue ) => {\n\t\t\t\t\t\tsetAttributes( { description: descriptionValue } );\n\t\t\t\t\t} }\n\t\t\t\t\thelp={ __(\n\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) }\n\t\t\t\t/>\n\t\t\t</ToolsPanelItem>\n\n\t\t\t<ToolsPanelItem\n\t\t\t\thasValue={ () => !! rel }\n\t\t\t\tlabel={ __( 'Rel attribute' ) }\n\t\t\t\tonDeselect={ () => setAttributes( { rel: '' } ) }\n\t\t\t\tisShownByDefault\n\t\t\t>\n\t\t\t\t<TextControl\n\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\tlabel={ __( 'Rel attribute' ) }\n\t\t\t\t\tvalue={ rel || '' }\n\t\t\t\t\tonChange={ ( relValue ) => {\n\t\t\t\t\t\tsetAttributes( { rel: relValue } );\n\t\t\t\t\t} }\n\t\t\t\t\tautoComplete=\"off\"\n\t\t\t\t\thelp={ __(\n\t\t\t\t\t\t'The relationship of the linked URL as space-separated link types.'\n\t\t\t\t\t) }\n\t\t\t\t/>\n\t\t\t</ToolsPanelItem>\n\t\t</ToolsPanel>\n\t);\n}\n\nexport default function NavigationLinkEdit( {\n\tattributes,\n\tisSelected,\n\tsetAttributes,\n\tinsertBlocksAfter,\n\tmergeBlocks,\n\tonReplace,\n\tcontext,\n\tclientId,\n} ) {\n\tconst { id, label, type, url, description, kind } = attributes;\n\tconst { maxNestingLevel } = context;\n\n\tconst {\n\t\treplaceBlock,\n\t\t__unstableMarkNextChangeAsNotPersistent,\n\t\tselectBlock,\n\t\tselectPreviousBlock,\n\t} = useDispatch( blockEditorStore );\n\t// Have the link editing ui open on mount when lacking a url and selected.\n\tconst [ isLinkOpen, setIsLinkOpen ] = useState( isSelected && ! url );\n\t// Store what element opened the popover, so we know where to return focus to (toolbar button vs navigation link text)\n\tconst [ openedBy, setOpenedBy ] = useState( null );\n\t// Use internal state instead of a ref to make sure that the component\n\t// re-renders when the popover's anchor updates.\n\tconst [ popoverAnchor, setPopoverAnchor ] = useState( null );\n\tconst listItemRef = useRef( null );\n\tconst isDraggingWithin = useIsDraggingWithin( listItemRef );\n\tconst itemLabelPlaceholder = __( 'Add label…' );\n\tconst ref = useRef();\n\tconst linkUIref = useRef();\n\tconst prevUrl = usePrevious( url );\n\n\t// Change the label using inspector causes rich text to change focus on firefox.\n\t// This is a workaround to keep the focus on the label field when label filed is focused we don't render the rich text.\n\tconst [ isLabelFieldFocused, setIsLabelFieldFocused ] = useState( false );\n\n\tconst {\n\t\tisAtMaxNesting,\n\t\tisTopLevelLink,\n\t\tisParentOfSelectedBlock,\n\t\thasChildren,\n\t\tvalidateLinkStatus,\n\t} = useSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\tgetBlockCount,\n\t\t\t\tgetBlockName,\n\t\t\t\tgetBlockRootClientId,\n\t\t\t\thasSelectedInnerBlock,\n\t\t\t\tgetBlockParentsByBlockName,\n\t\t\t\tgetSelectedBlockClientId,\n\t\t\t} = select( blockEditorStore );\n\t\t\tconst rootClientId = getBlockRootClientId( clientId );\n\t\t\tconst isTopLevel =\n\t\t\t\tgetBlockName( rootClientId ) === 'core/navigation';\n\t\t\tconst selectedBlockClientId = getSelectedBlockClientId();\n\t\t\tconst rootNavigationClientId = isTopLevel\n\t\t\t\t? rootClientId\n\t\t\t\t: getBlockParentsByBlockName(\n\t\t\t\t\t\tclientId,\n\t\t\t\t\t\t'core/navigation'\n\t\t\t\t )[ 0 ];\n\n\t\t\t// Enable when the root Navigation block is selected or any of its inner blocks.\n\t\t\tconst enableLinkStatusValidation =\n\t\t\t\tselectedBlockClientId === rootNavigationClientId ||\n\t\t\t\thasSelectedInnerBlock( rootNavigationClientId, true );\n\n\t\t\treturn {\n\t\t\t\tisAtMaxNesting:\n\t\t\t\t\tgetBlockParentsByBlockName( clientId, NESTING_BLOCK_NAMES )\n\t\t\t\t\t\t.length >= maxNestingLevel,\n\t\t\t\tisTopLevelLink: isTopLevel,\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\thasChildren: !! getBlockCount( clientId ),\n\t\t\t\tvalidateLinkStatus: enableLinkStatusValidation,\n\t\t\t};\n\t\t},\n\t\t[ clientId, maxNestingLevel ]\n\t);\n\tconst { getBlocks } = useSelect( blockEditorStore );\n\n\tconst [ isInvalid, isDraft ] = useIsInvalidLink(\n\t\tkind,\n\t\ttype,\n\t\tid,\n\t\tvalidateLinkStatus\n\t);\n\n\t/**\n\t * Transform to submenu block.\n\t */\n\tconst transformToSubmenu = () => {\n\t\tlet innerBlocks = getBlocks( clientId );\n\t\tif ( innerBlocks.length === 0 ) {\n\t\t\tinnerBlocks = [ createBlock( 'core/navigation-link' ) ];\n\t\t\tselectBlock( innerBlocks[ 0 ].clientId );\n\t\t}\n\t\tconst newSubmenu = createBlock(\n\t\t\t'core/navigation-submenu',\n\t\t\tattributes,\n\t\t\tinnerBlocks\n\t\t);\n\t\treplaceBlock( clientId, newSubmenu );\n\t};\n\n\tuseEffect( () => {\n\t\t// If block has inner blocks, transform to Submenu.\n\t\tif ( hasChildren ) {\n\t\t\t// This side-effect should not create an undo level as those should\n\t\t\t// only be created via user interactions.\n\t\t\t__unstableMarkNextChangeAsNotPersistent();\n\t\t\ttransformToSubmenu();\n\t\t}\n\t}, [ hasChildren ] );\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\t// We only want to do this when the URL has gone from nothing to a new URL AND the label looks like a URL\n\t\tif (\n\t\t\t! prevUrl &&\n\t\t\turl &&\n\t\t\tisLinkOpen &&\n\t\t\tisURL( prependHTTP( label ) ) &&\n\t\t\t/^.+\\.[a-z]+/.test( label )\n\t\t) {\n\t\t\t// Focus and select the label text.\n\t\t\tselectLabelText();\n\t\t}\n\t}, [ prevUrl, url, isLinkOpen, label ] );\n\n\t/**\n\t * Focus the Link label text and select it.\n\t */\n\tfunction selectLabelText() {\n\t\tref.current.focus();\n\t\tconst { ownerDocument } = ref.current;\n\t\tconst { defaultView } = ownerDocument;\n\t\tconst selection = defaultView.getSelection();\n\t\tconst range = ownerDocument.createRange();\n\t\t// Get the range of the current ref contents so we can add this range to the selection.\n\t\trange.selectNodeContents( ref.current );\n\t\tselection.removeAllRanges();\n\t\tselection.addRange( range );\n\t}\n\n\t/**\n\t * Removes the current link if set.\n\t */\n\tfunction removeLink() {\n\t\t// Reset all attributes that comprise the link.\n\t\t// It is critical that all attributes are reset\n\t\t// to their default values otherwise this may\n\t\t// in advertently trigger side effects because\n\t\t// the values will have \"changed\".\n\t\tsetAttributes( {\n\t\t\turl: undefined,\n\t\t\tlabel: undefined,\n\t\t\tid: undefined,\n\t\t\tkind: undefined,\n\t\t\ttype: undefined,\n\t\t\topensInNewTab: false,\n\t\t} );\n\n\t\t// Close the link editing UI.\n\t\tsetIsLinkOpen( false );\n\t}\n\n\tconst {\n\t\ttextColor,\n\t\tcustomTextColor,\n\t\tbackgroundColor,\n\t\tcustomBackgroundColor,\n\t} = getColors( context, ! isTopLevelLink );\n\n\tfunction onKeyDown( event ) {\n\t\tif ( isKeyboardEvent.primary( event, 'k' ) ) {\n\t\t\t// Required to prevent the command center from opening,\n\t\t\t// as it shares the CMD+K shortcut.\n\t\t\t// See https://github.com/WordPress/gutenberg/pull/59845.\n\t\t\tevent.preventDefault();\n\t\t\t// If this link is a child of a parent submenu item, the parent submenu item event will also open, closing this popover\n\t\t\tevent.stopPropagation();\n\t\t\tsetIsLinkOpen( true );\n\t\t\tsetOpenedBy( ref.current );\n\t\t}\n\t}\n\n\tconst blockProps = useBlockProps( {\n\t\tref: useMergeRefs( [ setPopoverAnchor, listItemRef ] ),\n\t\tclassName: clsx( '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': hasChildren,\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( 'background-color', backgroundColor ) ]:\n\t\t\t\t!! backgroundColor,\n\t\t} ),\n\t\tstyle: {\n\t\t\tcolor: ! textColor && customTextColor,\n\t\t\tbackgroundColor: ! backgroundColor && customBackgroundColor,\n\t\t},\n\t\tonKeyDown,\n\t} );\n\n\tconst innerBlocksProps = useInnerBlocksProps(\n\t\t{\n\t\t\t...blockProps,\n\t\t\tclassName: 'remove-outline', // Remove the outline from the inner blocks container.\n\t\t},\n\t\t{\n\t\t\tdefaultBlock: DEFAULT_BLOCK,\n\t\t\tdirectInsert: true,\n\t\t\trenderAppender: false,\n\t\t}\n\t);\n\n\tif ( ! url || isInvalid || isDraft ) {\n\t\tblockProps.onClick = () => {\n\t\t\tsetIsLinkOpen( true );\n\t\t\tsetOpenedBy( ref.current );\n\t\t};\n\t}\n\n\tconst classes = clsx( 'wp-block-navigation-item__content', {\n\t\t'wp-block-navigation-link__placeholder': ! url || isInvalid || isDraft,\n\t} );\n\n\tconst missingText = getMissingText( type );\n\t/* translators: Whether the navigation link is Invalid or a Draft. */\n\tconst placeholderText = `(${\n\t\tisInvalid ? __( 'Invalid' ) : __( 'Draft' )\n\t})`;\n\n\treturn (\n\t\t<>\n\t\t\t<BlockControls>\n\t\t\t\t<ToolbarGroup>\n\t\t\t\t\t<ToolbarButton\n\t\t\t\t\t\tname=\"link\"\n\t\t\t\t\t\ticon={ linkIcon }\n\t\t\t\t\t\ttitle={ __( 'Link' ) }\n\t\t\t\t\t\tshortcut={ displayShortcut.primary( 'k' ) }\n\t\t\t\t\t\tonClick={ ( event ) => {\n\t\t\t\t\t\t\tsetIsLinkOpen( true );\n\t\t\t\t\t\t\tsetOpenedBy( event.currentTarget );\n\t\t\t\t\t\t} }\n\t\t\t\t\t/>\n\t\t\t\t\t{ ! isAtMaxNesting && (\n\t\t\t\t\t\t<ToolbarButton\n\t\t\t\t\t\t\tname=\"submenu\"\n\t\t\t\t\t\t\ticon={ addSubmenu }\n\t\t\t\t\t\t\ttitle={ __( 'Add submenu' ) }\n\t\t\t\t\t\t\tonClick={ transformToSubmenu }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t</ToolbarGroup>\n\t\t\t</BlockControls>\n\t\t\t{ /* Warning, this duplicated in packages/block-library/src/navigation-submenu/edit.js */ }\n\t\t\t<InspectorControls>\n\t\t\t\t<Controls\n\t\t\t\t\tattributes={ attributes }\n\t\t\t\t\tsetAttributes={ setAttributes }\n\t\t\t\t\tsetIsLabelFieldFocused={ setIsLabelFieldFocused }\n\t\t\t\t/>\n\t\t\t</InspectorControls>\n\t\t\t<div { ...blockProps }>\n\t\t\t\t{ /* eslint-disable jsx-a11y/anchor-is-valid */ }\n\t\t\t\t<a className={ classes }>\n\t\t\t\t\t{ /* eslint-enable */ }\n\t\t\t\t\t{ ! url ? (\n\t\t\t\t\t\t<div className=\"wp-block-navigation-link__placeholder-text\">\n\t\t\t\t\t\t\t<span>{ missingText }</span>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t) : (\n\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t{ ! isInvalid &&\n\t\t\t\t\t\t\t\t! isDraft &&\n\t\t\t\t\t\t\t\t! isLabelFieldFocused && (\n\t\t\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t\t\t<RichText\n\t\t\t\t\t\t\t\t\t\t\tref={ ref }\n\t\t\t\t\t\t\t\t\t\t\tidentifier=\"label\"\n\t\t\t\t\t\t\t\t\t\t\tclassName=\"wp-block-navigation-item__label\"\n\t\t\t\t\t\t\t\t\t\t\tvalue={ label }\n\t\t\t\t\t\t\t\t\t\t\tonChange={ ( labelValue ) =>\n\t\t\t\t\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\t\t\t\t\tlabel: labelValue,\n\t\t\t\t\t\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\tonMerge={ mergeBlocks }\n\t\t\t\t\t\t\t\t\t\t\tonReplace={ onReplace }\n\t\t\t\t\t\t\t\t\t\t\t__unstableOnSplitAtEnd={ () =>\n\t\t\t\t\t\t\t\t\t\t\t\tinsertBlocksAfter(\n\t\t\t\t\t\t\t\t\t\t\t\t\tcreateBlock(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t'core/navigation-link'\n\t\t\t\t\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\taria-label={ __(\n\t\t\t\t\t\t\t\t\t\t\t\t'Navigation link text'\n\t\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t\tplaceholder={ itemLabelPlaceholder }\n\t\t\t\t\t\t\t\t\t\t\twithoutInteractiveFormatting\n\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t{ description && (\n\t\t\t\t\t\t\t\t\t\t\t<span className=\"wp-block-navigation-item__description\">\n\t\t\t\t\t\t\t\t\t\t\t\t{ description }\n\t\t\t\t\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t</>\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t{ ( isInvalid ||\n\t\t\t\t\t\t\t\tisDraft ||\n\t\t\t\t\t\t\t\tisLabelFieldFocused ) && (\n\t\t\t\t\t\t\t\t<div\n\t\t\t\t\t\t\t\t\tclassName={ clsx(\n\t\t\t\t\t\t\t\t\t\t'wp-block-navigation-link__placeholder-text',\n\t\t\t\t\t\t\t\t\t\t'wp-block-navigation-link__label',\n\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t'is-invalid': isInvalid,\n\t\t\t\t\t\t\t\t\t\t\t'is-draft': isDraft,\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t<span>\n\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t// Some attributes are stored in an escaped form. It's a legacy issue.\n\t\t\t\t\t\t\t\t\t\t\t// Ideally they would be stored in a raw, unescaped form.\n\t\t\t\t\t\t\t\t\t\t\t// Unescape is used here to \"recover\" the escaped characters\n\t\t\t\t\t\t\t\t\t\t\t// so they display without encoding.\n\t\t\t\t\t\t\t\t\t\t\t// See `updateAttributes` for more details.\n\t\t\t\t\t\t\t\t\t\t\t`${ decodeEntities( label ) } ${\n\t\t\t\t\t\t\t\t\t\t\t\tisInvalid || isDraft\n\t\t\t\t\t\t\t\t\t\t\t\t\t? placeholderText\n\t\t\t\t\t\t\t\t\t\t\t\t\t: ''\n\t\t\t\t\t\t\t\t\t\t\t}`.trim()\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t</>\n\t\t\t\t\t) }\n\t\t\t\t\t{ isLinkOpen && (\n\t\t\t\t\t\t<LinkUI\n\t\t\t\t\t\t\tref={ linkUIref }\n\t\t\t\t\t\t\tclientId={ clientId }\n\t\t\t\t\t\t\tlink={ attributes }\n\t\t\t\t\t\t\tonClose={ () => {\n\t\t\t\t\t\t\t\t// If there is no link then remove the auto-inserted block.\n\t\t\t\t\t\t\t\t// This avoids empty blocks which can provided a poor UX.\n\t\t\t\t\t\t\t\tif ( ! url ) {\n\t\t\t\t\t\t\t\t\t// Fixes https://github.com/WordPress/gutenberg/issues/61361\n\t\t\t\t\t\t\t\t\t// There's a chance we're closing due to the user selecting the browse all button.\n\t\t\t\t\t\t\t\t\t// Only move focus if the focus is still within the popover ui. If it's not within\n\t\t\t\t\t\t\t\t\t// the popover, it's because something has taken the focus from the popover, and\n\t\t\t\t\t\t\t\t\t// we don't want to steal it back.\n\t\t\t\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t\t\t\tlinkUIref.current.contains(\n\t\t\t\t\t\t\t\t\t\t\twindow.document.activeElement\n\t\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\t\t\t// Select the previous block to keep focus nearby\n\t\t\t\t\t\t\t\t\t\tselectPreviousBlock( clientId, true );\n\t\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t\t// Remove the link.\n\t\t\t\t\t\t\t\t\tonReplace( [] );\n\t\t\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\tsetIsLinkOpen( false );\n\t\t\t\t\t\t\t\tif ( openedBy ) {\n\t\t\t\t\t\t\t\t\topenedBy.focus();\n\t\t\t\t\t\t\t\t\tsetOpenedBy( null );\n\t\t\t\t\t\t\t\t} else if ( ref.current ) {\n\t\t\t\t\t\t\t\t\t// select the ref when adding a new link\n\t\t\t\t\t\t\t\t\tref.current.focus();\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\t// Fallback\n\t\t\t\t\t\t\t\t\tselectPreviousBlock( clientId, 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\tanchor={ popoverAnchor }\n\t\t\t\t\t\t\tonRemove={ removeLink }\n\t\t\t\t\t\t\tonChange={ ( updatedValue ) => {\n\t\t\t\t\t\t\t\tupdateAttributes(\n\t\t\t\t\t\t\t\t\tupdatedValue,\n\t\t\t\t\t\t\t\t\tsetAttributes,\n\t\t\t\t\t\t\t\t\tattributes\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</a>\n\t\t\t\t<div { ...innerBlocksProps } />\n\t\t\t</div>\n\t\t</>\n\t);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,OAAOA,IAAI,MAAM,MAAM;;AAEvB;AACA;AACA;AACA,SAASC,WAAW,QAAQ,mBAAmB;AAC/C,SAASC,SAAS,EAAEC,WAAW,QAAQ,iBAAiB;AACxD,SACCC,wBAAwB,IAAIC,UAAU,EACtCC,4BAA4B,IAAIC,cAAc,EAC9CC,WAAW,EACXC,eAAe,EACfC,aAAa,EACbC,YAAY,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L,QAAQ,EAAE,IAAK,CAAC;cACtC;;cAEA;cACAF,SAAS,CAAE,EAAG,CAAC;cACf;YACD;YAEAS,aAAa,CAAE,KAAM,CAAC;YACtB,IAAKC,QAAQ,EAAG;cACfA,QAAQ,CAACiC,KAAK,CAAC,CAAC;cAChBhC,WAAW,CAAE,IAAK,CAAC;YACpB,CAAC,MAAM,IAAKK,GAAG,CAACvE,OAAO,EAAG;cACzB;cACAuE,GAAG,CAACvE,OAAO,CAACkG,KAAK,CAAC,CAAC;YACpB,CAAC,MAAM;cACN;cACApC,mBAAmB,CAAEL,QAAQ,EAAE,IAAK,CAAC;YACtC;UACD,CAAG;UACHsF,MAAM,EAAG5E,aAAe;UACxB6E,QAAQ,EAAGrC,UAAY;UACvBjE,QAAQ,EAAKuG,YAAY,IAAM;YAC9BjK,gBAAgB,CACfiK,YAAY,EACZpH,aAAa,EACbD,UACD,CAAC;UACF;QAAG,CACH,CACD;MAAA,CACC,CAAC,eACJzC,IAAA;QAAA,GAAUuI;MAAgB,CAAI,CAAC;IAAA,CAC3B,CAAC;EAAA,CACL,CAAC;AAEL","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["clsx","createBlock","useSelect","useDispatch","__experimentalToolsPanel","ToolsPanel","__experimentalToolsPanelItem","ToolsPanelItem","TextControl","TextareaControl","ToolbarButton","ToolbarGroup","displayShortcut","isKeyboardEvent","__","BlockControls","InspectorControls","RichText","useBlockProps","store","blockEditorStore","getColorClassName","useInnerBlocksProps","useBlockEditingMode","isURL","prependHTTP","safeDecodeURI","useState","useEffect","useRef","__unstableStripHTML","stripHTML","decodeEntities","link","linkIcon","addSubmenu","coreStore","useMergeRefs","usePrevious","LinkUI","updateAttributes","getColors","useToolsPanelDropdownMenuProps","jsx","_jsx","jsxs","_jsxs","Fragment","_Fragment","DEFAULT_BLOCK","name","NESTING_BLOCK_NAMES","useIsDraggingWithin","elementRef","isDraggingWithin","setIsDraggingWithin","ownerDocument","current","handleDragStart","event","handleDragEnter","handleDragEnd","contains","target","addEventListener","removeEventListener","useIsInvalidLink","kind","type","id","enabled","isPostType","hasId","Number","isInteger","blockEditingMode","postStatus","select","getEntityRecord","status","isInvalid","isDraft","getMissingText","missingText","Controls","attributes","setAttributes","setIsLabelFieldFocused","label","url","description","rel","dropdownMenuProps","resetAll","children","hasValue","onDeselect","isShownByDefault","__nextHasNoMarginBottom","__next40pxDefaultSize","value","onChange","labelValue","autoComplete","onFocus","onBlur","urlValue","descriptionValue","help","relValue","NavigationLinkEdit","isSelected","insertBlocksAfter","mergeBlocks","onReplace","context","clientId","maxNestingLevel","replaceBlock","__unstableMarkNextChangeAsNotPersistent","selectBlock","selectPreviousBlock","isLinkOpen","setIsLinkOpen","openedBy","setOpenedBy","popoverAnchor","setPopoverAnchor","listItemRef","itemLabelPlaceholder","ref","linkUIref","prevUrl","isLabelFieldFocused","isAtMaxNesting","isTopLevelLink","isParentOfSelectedBlock","hasChildren","validateLinkStatus","getBlockCount","getBlockName","getBlockRootClientId","hasSelectedInnerBlock","getBlockParentsByBlockName","getSelectedBlockClientId","rootClientId","isTopLevel","selectedBlockClientId","rootNavigationClientId","enableLinkStatusValidation","length","getBlocks","transformToSubmenu","innerBlocks","newSubmenu","test","selectLabelText","focus","defaultView","selection","getSelection","range","createRange","selectNodeContents","removeAllRanges","addRange","removeLink","undefined","opensInNewTab","textColor","customTextColor","backgroundColor","customBackgroundColor","onKeyDown","primary","preventDefault","stopPropagation","blockProps","className","style","color","innerBlocksProps","defaultBlock","directInsert","renderAppender","onClick","classes","placeholderText","icon","title","shortcut","currentTarget","identifier","onMerge","__unstableOnSplitAtEnd","placeholder","withoutInteractiveFormatting","trim","onClose","window","document","activeElement","anchor","onRemove","updatedValue"],"sources":["@wordpress/block-library/src/navigation-link/edit.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { createBlock } from '@wordpress/blocks';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport {\n\t__experimentalToolsPanel as ToolsPanel,\n\t__experimentalToolsPanelItem as ToolsPanelItem,\n\tTextControl,\n\tTextareaControl,\n\tToolbarButton,\n\tToolbarGroup,\n} from '@wordpress/components';\nimport { displayShortcut, isKeyboardEvent } from '@wordpress/keycodes';\nimport { __ } from '@wordpress/i18n';\nimport {\n\tBlockControls,\n\tInspectorControls,\n\tRichText,\n\tuseBlockProps,\n\tstore as blockEditorStore,\n\tgetColorClassName,\n\tuseInnerBlocksProps,\n\tuseBlockEditingMode,\n} from '@wordpress/block-editor';\nimport { isURL, prependHTTP, safeDecodeURI } from '@wordpress/url';\nimport { useState, useEffect, useRef } from '@wordpress/element';\nimport { __unstableStripHTML as stripHTML } from '@wordpress/dom';\nimport { decodeEntities } from '@wordpress/html-entities';\nimport { link as linkIcon, addSubmenu } from '@wordpress/icons';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { useMergeRefs, usePrevious } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport { LinkUI } from './link-ui';\nimport { updateAttributes } from './update-attributes';\nimport { getColors } from '../navigation/edit/utils';\nimport { useToolsPanelDropdownMenuProps } from '../utils/hooks';\n\nconst DEFAULT_BLOCK = { name: 'core/navigation-link' };\nconst NESTING_BLOCK_NAMES = [\n\t'core/navigation-link',\n\t'core/navigation-submenu',\n];\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}, [ elementRef ] );\n\n\treturn isDraggingWithin;\n};\n\nconst useIsInvalidLink = ( kind, type, id, enabled ) => {\n\tconst isPostType =\n\t\tkind === 'post-type' || type === 'post' || type === 'page';\n\tconst hasId = Number.isInteger( id );\n\tconst blockEditingMode = useBlockEditingMode();\n\n\tconst postStatus = useSelect(\n\t\t( select ) => {\n\t\t\tif ( ! isPostType ) {\n\t\t\t\treturn null;\n\t\t\t}\n\n\t\t\t// Fetching the posts status is an \"expensive\" operation. Especially for sites with large navigations.\n\t\t\t// When the block is rendered in a template or other disabled contexts we can skip this check in order\n\t\t\t// to avoid all these additional requests that don't really add any value in that mode.\n\t\t\tif ( blockEditingMode === 'disabled' || ! enabled ) {\n\t\t\t\treturn null;\n\t\t\t}\n\n\t\t\tconst { getEntityRecord } = select( coreStore );\n\t\t\treturn getEntityRecord( 'postType', type, id )?.status;\n\t\t},\n\t\t[ isPostType, blockEditingMode, enabled, type, id ]\n\t);\n\n\t// Check Navigation Link validity if:\n\t// 1. Link is 'post-type'.\n\t// 2. It has an id.\n\t// 3. It's neither null, nor undefined, as valid items might be either of those while loading.\n\t// If those conditions are met, check if\n\t// 1. The post status is published.\n\t// 2. The Navigation Link item has no label.\n\t// If either of those is true, invalidate.\n\tconst isInvalid =\n\t\tisPostType && hasId && postStatus && 'trash' === postStatus;\n\tconst isDraft = 'draft' === postStatus;\n\n\treturn [ isInvalid, isDraft ];\n};\n\nfunction getMissingText( type ) {\n\tlet missingText = '';\n\n\tswitch ( type ) {\n\t\tcase 'post':\n\t\t\t/* translators: label for missing post in navigation link block */\n\t\t\tmissingText = __( 'Select post' );\n\t\t\tbreak;\n\t\tcase 'page':\n\t\t\t/* translators: label for missing page in navigation link block */\n\t\t\tmissingText = __( 'Select page' );\n\t\t\tbreak;\n\t\tcase 'category':\n\t\t\t/* translators: label for missing category in navigation link block */\n\t\t\tmissingText = __( 'Select category' );\n\t\t\tbreak;\n\t\tcase 'tag':\n\t\t\t/* translators: label for missing tag in navigation link block */\n\t\t\tmissingText = __( 'Select tag' );\n\t\t\tbreak;\n\t\tdefault:\n\t\t\t/* translators: label for missing values in navigation link block */\n\t\t\tmissingText = __( 'Add link' );\n\t}\n\n\treturn missingText;\n}\n\n/*\n * Warning, this duplicated in\n * packages/block-library/src/navigation-submenu/edit.js\n * Consider reusing this components for both blocks.\n */\nfunction Controls( { attributes, setAttributes, setIsLabelFieldFocused } ) {\n\tconst { label, url, description, rel } = attributes;\n\tconst dropdownMenuProps = useToolsPanelDropdownMenuProps();\n\treturn (\n\t\t<ToolsPanel\n\t\t\tlabel={ __( 'Settings' ) }\n\t\t\tresetAll={ () => {\n\t\t\t\tsetAttributes( {\n\t\t\t\t\tlabel: '',\n\t\t\t\t\turl: '',\n\t\t\t\t\tdescription: '',\n\t\t\t\t\trel: '',\n\t\t\t\t} );\n\t\t\t} }\n\t\t\tdropdownMenuProps={ dropdownMenuProps }\n\t\t>\n\t\t\t<ToolsPanelItem\n\t\t\t\thasValue={ () => !! label }\n\t\t\t\tlabel={ __( 'Text' ) }\n\t\t\t\tonDeselect={ () => setAttributes( { label: '' } ) }\n\t\t\t\tisShownByDefault\n\t\t\t>\n\t\t\t\t<TextControl\n\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\tlabel={ __( 'Text' ) }\n\t\t\t\t\tvalue={ label ? stripHTML( label ) : '' }\n\t\t\t\t\tonChange={ ( labelValue ) => {\n\t\t\t\t\t\tsetAttributes( { label: labelValue } );\n\t\t\t\t\t} }\n\t\t\t\t\tautoComplete=\"off\"\n\t\t\t\t\tonFocus={ () => setIsLabelFieldFocused( true ) }\n\t\t\t\t\tonBlur={ () => setIsLabelFieldFocused( false ) }\n\t\t\t\t/>\n\t\t\t</ToolsPanelItem>\n\n\t\t\t<ToolsPanelItem\n\t\t\t\thasValue={ () => !! url }\n\t\t\t\tlabel={ __( 'Link' ) }\n\t\t\t\tonDeselect={ () => setAttributes( { url: '' } ) }\n\t\t\t\tisShownByDefault\n\t\t\t>\n\t\t\t\t<TextControl\n\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\tlabel={ __( 'Link' ) }\n\t\t\t\t\tvalue={ url ? safeDecodeURI( url ) : '' }\n\t\t\t\t\tonChange={ ( urlValue ) => {\n\t\t\t\t\t\tupdateAttributes(\n\t\t\t\t\t\t\t{ url: urlValue },\n\t\t\t\t\t\t\tsetAttributes,\n\t\t\t\t\t\t\tattributes\n\t\t\t\t\t\t);\n\t\t\t\t\t} }\n\t\t\t\t\tautoComplete=\"off\"\n\t\t\t\t\ttype=\"url\"\n\t\t\t\t/>\n\t\t\t</ToolsPanelItem>\n\n\t\t\t<ToolsPanelItem\n\t\t\t\thasValue={ () => !! description }\n\t\t\t\tlabel={ __( 'Description' ) }\n\t\t\t\tonDeselect={ () => setAttributes( { description: '' } ) }\n\t\t\t\tisShownByDefault\n\t\t\t>\n\t\t\t\t<TextareaControl\n\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\tlabel={ __( 'Description' ) }\n\t\t\t\t\tvalue={ description || '' }\n\t\t\t\t\tonChange={ ( descriptionValue ) => {\n\t\t\t\t\t\tsetAttributes( { description: descriptionValue } );\n\t\t\t\t\t} }\n\t\t\t\t\thelp={ __(\n\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) }\n\t\t\t\t/>\n\t\t\t</ToolsPanelItem>\n\n\t\t\t<ToolsPanelItem\n\t\t\t\thasValue={ () => !! rel }\n\t\t\t\tlabel={ __( 'Rel attribute' ) }\n\t\t\t\tonDeselect={ () => setAttributes( { rel: '' } ) }\n\t\t\t\tisShownByDefault\n\t\t\t>\n\t\t\t\t<TextControl\n\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\tlabel={ __( 'Rel attribute' ) }\n\t\t\t\t\tvalue={ rel || '' }\n\t\t\t\t\tonChange={ ( relValue ) => {\n\t\t\t\t\t\tsetAttributes( { rel: relValue } );\n\t\t\t\t\t} }\n\t\t\t\t\tautoComplete=\"off\"\n\t\t\t\t\thelp={ __(\n\t\t\t\t\t\t'The relationship of the linked URL as space-separated link types.'\n\t\t\t\t\t) }\n\t\t\t\t/>\n\t\t\t</ToolsPanelItem>\n\t\t</ToolsPanel>\n\t);\n}\n\nexport default function NavigationLinkEdit( {\n\tattributes,\n\tisSelected,\n\tsetAttributes,\n\tinsertBlocksAfter,\n\tmergeBlocks,\n\tonReplace,\n\tcontext,\n\tclientId,\n} ) {\n\tconst { id, label, type, url, description, kind } = attributes;\n\tconst { maxNestingLevel } = context;\n\n\tconst {\n\t\treplaceBlock,\n\t\t__unstableMarkNextChangeAsNotPersistent,\n\t\tselectBlock,\n\t\tselectPreviousBlock,\n\t} = useDispatch( blockEditorStore );\n\t// Have the link editing ui open on mount when lacking a url and selected.\n\tconst [ isLinkOpen, setIsLinkOpen ] = useState( isSelected && ! url );\n\t// Store what element opened the popover, so we know where to return focus to (toolbar button vs navigation link text)\n\tconst [ openedBy, setOpenedBy ] = useState( null );\n\t// Use internal state instead of a ref to make sure that the component\n\t// re-renders when the popover's anchor updates.\n\tconst [ popoverAnchor, setPopoverAnchor ] = useState( null );\n\tconst listItemRef = useRef( null );\n\tconst isDraggingWithin = useIsDraggingWithin( listItemRef );\n\tconst itemLabelPlaceholder = __( 'Add label…' );\n\tconst ref = useRef();\n\tconst linkUIref = useRef();\n\tconst prevUrl = usePrevious( url );\n\n\t// Change the label using inspector causes rich text to change focus on firefox.\n\t// This is a workaround to keep the focus on the label field when label filed is focused we don't render the rich text.\n\tconst [ isLabelFieldFocused, setIsLabelFieldFocused ] = useState( false );\n\n\tconst {\n\t\tisAtMaxNesting,\n\t\tisTopLevelLink,\n\t\tisParentOfSelectedBlock,\n\t\thasChildren,\n\t\tvalidateLinkStatus,\n\t} = useSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\tgetBlockCount,\n\t\t\t\tgetBlockName,\n\t\t\t\tgetBlockRootClientId,\n\t\t\t\thasSelectedInnerBlock,\n\t\t\t\tgetBlockParentsByBlockName,\n\t\t\t\tgetSelectedBlockClientId,\n\t\t\t} = select( blockEditorStore );\n\t\t\tconst rootClientId = getBlockRootClientId( clientId );\n\t\t\tconst isTopLevel =\n\t\t\t\tgetBlockName( rootClientId ) === 'core/navigation';\n\t\t\tconst selectedBlockClientId = getSelectedBlockClientId();\n\t\t\tconst rootNavigationClientId = isTopLevel\n\t\t\t\t? rootClientId\n\t\t\t\t: getBlockParentsByBlockName(\n\t\t\t\t\t\tclientId,\n\t\t\t\t\t\t'core/navigation'\n\t\t\t\t )[ 0 ];\n\n\t\t\t// Enable when the root Navigation block is selected or any of its inner blocks.\n\t\t\tconst enableLinkStatusValidation =\n\t\t\t\tselectedBlockClientId === rootNavigationClientId ||\n\t\t\t\thasSelectedInnerBlock( rootNavigationClientId, true );\n\n\t\t\treturn {\n\t\t\t\tisAtMaxNesting:\n\t\t\t\t\tgetBlockParentsByBlockName( clientId, NESTING_BLOCK_NAMES )\n\t\t\t\t\t\t.length >= maxNestingLevel,\n\t\t\t\tisTopLevelLink: isTopLevel,\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\thasChildren: !! getBlockCount( clientId ),\n\t\t\t\tvalidateLinkStatus: enableLinkStatusValidation,\n\t\t\t};\n\t\t},\n\t\t[ clientId, maxNestingLevel ]\n\t);\n\tconst { getBlocks } = useSelect( blockEditorStore );\n\n\tconst [ isInvalid, isDraft ] = useIsInvalidLink(\n\t\tkind,\n\t\ttype,\n\t\tid,\n\t\tvalidateLinkStatus\n\t);\n\n\t/**\n\t * Transform to submenu block.\n\t */\n\tconst transformToSubmenu = () => {\n\t\tlet innerBlocks = getBlocks( clientId );\n\t\tif ( innerBlocks.length === 0 ) {\n\t\t\tinnerBlocks = [ createBlock( 'core/navigation-link' ) ];\n\t\t\tselectBlock( innerBlocks[ 0 ].clientId );\n\t\t}\n\t\tconst newSubmenu = createBlock(\n\t\t\t'core/navigation-submenu',\n\t\t\tattributes,\n\t\t\tinnerBlocks\n\t\t);\n\t\treplaceBlock( clientId, newSubmenu );\n\t};\n\n\tuseEffect( () => {\n\t\t// If block has inner blocks, transform to Submenu.\n\t\tif ( hasChildren ) {\n\t\t\t// This side-effect should not create an undo level as those should\n\t\t\t// only be created via user interactions.\n\t\t\t__unstableMarkNextChangeAsNotPersistent();\n\t\t\ttransformToSubmenu();\n\t\t}\n\t}, [ hasChildren ] );\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\t// We only want to do this when the URL has gone from nothing to a new URL AND the label looks like a URL\n\t\tif (\n\t\t\t! prevUrl &&\n\t\t\turl &&\n\t\t\tisLinkOpen &&\n\t\t\tisURL( prependHTTP( label ) ) &&\n\t\t\t/^.+\\.[a-z]+/.test( label )\n\t\t) {\n\t\t\t// Focus and select the label text.\n\t\t\tselectLabelText();\n\t\t}\n\t}, [ prevUrl, url, isLinkOpen, label ] );\n\n\t/**\n\t * Focus the Link label text and select it.\n\t */\n\tfunction selectLabelText() {\n\t\tref.current.focus();\n\t\tconst { ownerDocument } = ref.current;\n\t\tconst { defaultView } = ownerDocument;\n\t\tconst selection = defaultView.getSelection();\n\t\tconst range = ownerDocument.createRange();\n\t\t// Get the range of the current ref contents so we can add this range to the selection.\n\t\trange.selectNodeContents( ref.current );\n\t\tselection.removeAllRanges();\n\t\tselection.addRange( range );\n\t}\n\n\t/**\n\t * Removes the current link if set.\n\t */\n\tfunction removeLink() {\n\t\t// Reset all attributes that comprise the link.\n\t\t// It is critical that all attributes are reset\n\t\t// to their default values otherwise this may\n\t\t// in advertently trigger side effects because\n\t\t// the values will have \"changed\".\n\t\tsetAttributes( {\n\t\t\turl: undefined,\n\t\t\tlabel: undefined,\n\t\t\tid: undefined,\n\t\t\tkind: undefined,\n\t\t\ttype: undefined,\n\t\t\topensInNewTab: false,\n\t\t} );\n\n\t\t// Close the link editing UI.\n\t\tsetIsLinkOpen( false );\n\t}\n\n\tconst {\n\t\ttextColor,\n\t\tcustomTextColor,\n\t\tbackgroundColor,\n\t\tcustomBackgroundColor,\n\t} = getColors( context, ! isTopLevelLink );\n\n\tfunction onKeyDown( event ) {\n\t\tif ( isKeyboardEvent.primary( event, 'k' ) ) {\n\t\t\t// Required to prevent the command center from opening,\n\t\t\t// as it shares the CMD+K shortcut.\n\t\t\t// See https://github.com/WordPress/gutenberg/pull/59845.\n\t\t\tevent.preventDefault();\n\t\t\t// If this link is a child of a parent submenu item, the parent submenu item event will also open, closing this popover\n\t\t\tevent.stopPropagation();\n\t\t\tsetIsLinkOpen( true );\n\t\t\tsetOpenedBy( ref.current );\n\t\t}\n\t}\n\n\tconst blockProps = useBlockProps( {\n\t\tref: useMergeRefs( [ setPopoverAnchor, listItemRef ] ),\n\t\tclassName: clsx( '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': hasChildren,\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( 'background-color', backgroundColor ) ]:\n\t\t\t\t!! backgroundColor,\n\t\t} ),\n\t\tstyle: {\n\t\t\tcolor: ! textColor && customTextColor,\n\t\t\tbackgroundColor: ! backgroundColor && customBackgroundColor,\n\t\t},\n\t\tonKeyDown,\n\t} );\n\n\tconst innerBlocksProps = useInnerBlocksProps(\n\t\t{\n\t\t\t...blockProps,\n\t\t\tclassName: 'remove-outline', // Remove the outline from the inner blocks container.\n\t\t},\n\t\t{\n\t\t\tdefaultBlock: DEFAULT_BLOCK,\n\t\t\tdirectInsert: true,\n\t\t\trenderAppender: false,\n\t\t}\n\t);\n\n\tif ( ! url || isInvalid || isDraft ) {\n\t\tblockProps.onClick = () => {\n\t\t\tsetIsLinkOpen( true );\n\t\t\tsetOpenedBy( ref.current );\n\t\t};\n\t}\n\n\tconst classes = clsx( 'wp-block-navigation-item__content', {\n\t\t'wp-block-navigation-link__placeholder': ! url || isInvalid || isDraft,\n\t} );\n\n\tconst missingText = getMissingText( type );\n\t/* translators: Whether the navigation link is Invalid or a Draft. */\n\tconst placeholderText = `(${\n\t\tisInvalid ? __( 'Invalid' ) : __( 'Draft' )\n\t})`;\n\n\treturn (\n\t\t<>\n\t\t\t<BlockControls>\n\t\t\t\t<ToolbarGroup>\n\t\t\t\t\t<ToolbarButton\n\t\t\t\t\t\tname=\"link\"\n\t\t\t\t\t\ticon={ linkIcon }\n\t\t\t\t\t\ttitle={ __( 'Link' ) }\n\t\t\t\t\t\tshortcut={ displayShortcut.primary( 'k' ) }\n\t\t\t\t\t\tonClick={ ( event ) => {\n\t\t\t\t\t\t\tsetIsLinkOpen( true );\n\t\t\t\t\t\t\tsetOpenedBy( event.currentTarget );\n\t\t\t\t\t\t} }\n\t\t\t\t\t/>\n\t\t\t\t\t{ ! isAtMaxNesting && (\n\t\t\t\t\t\t<ToolbarButton\n\t\t\t\t\t\t\tname=\"submenu\"\n\t\t\t\t\t\t\ticon={ addSubmenu }\n\t\t\t\t\t\t\ttitle={ __( 'Add submenu' ) }\n\t\t\t\t\t\t\tonClick={ transformToSubmenu }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t</ToolbarGroup>\n\t\t\t</BlockControls>\n\t\t\t{ /* Warning, this duplicated in packages/block-library/src/navigation-submenu/edit.js */ }\n\t\t\t<InspectorControls>\n\t\t\t\t<Controls\n\t\t\t\t\tattributes={ attributes }\n\t\t\t\t\tsetAttributes={ setAttributes }\n\t\t\t\t\tsetIsLabelFieldFocused={ setIsLabelFieldFocused }\n\t\t\t\t/>\n\t\t\t</InspectorControls>\n\t\t\t<div { ...blockProps }>\n\t\t\t\t{ /* eslint-disable jsx-a11y/anchor-is-valid */ }\n\t\t\t\t<a className={ classes }>\n\t\t\t\t\t{ /* eslint-enable */ }\n\t\t\t\t\t{ ! url ? (\n\t\t\t\t\t\t<div className=\"wp-block-navigation-link__placeholder-text\">\n\t\t\t\t\t\t\t<span>{ missingText }</span>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t) : (\n\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t{ ! isInvalid &&\n\t\t\t\t\t\t\t\t! isDraft &&\n\t\t\t\t\t\t\t\t! isLabelFieldFocused && (\n\t\t\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t\t\t<RichText\n\t\t\t\t\t\t\t\t\t\t\tref={ ref }\n\t\t\t\t\t\t\t\t\t\t\tidentifier=\"label\"\n\t\t\t\t\t\t\t\t\t\t\tclassName=\"wp-block-navigation-item__label\"\n\t\t\t\t\t\t\t\t\t\t\tvalue={ label }\n\t\t\t\t\t\t\t\t\t\t\tonChange={ ( labelValue ) =>\n\t\t\t\t\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\t\t\t\t\tlabel: labelValue,\n\t\t\t\t\t\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\tonMerge={ mergeBlocks }\n\t\t\t\t\t\t\t\t\t\t\tonReplace={ onReplace }\n\t\t\t\t\t\t\t\t\t\t\t__unstableOnSplitAtEnd={ () =>\n\t\t\t\t\t\t\t\t\t\t\t\tinsertBlocksAfter(\n\t\t\t\t\t\t\t\t\t\t\t\t\tcreateBlock(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t'core/navigation-link'\n\t\t\t\t\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\taria-label={ __(\n\t\t\t\t\t\t\t\t\t\t\t\t'Navigation link text'\n\t\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t\tplaceholder={ itemLabelPlaceholder }\n\t\t\t\t\t\t\t\t\t\t\twithoutInteractiveFormatting\n\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t{ description && (\n\t\t\t\t\t\t\t\t\t\t\t<span className=\"wp-block-navigation-item__description\">\n\t\t\t\t\t\t\t\t\t\t\t\t{ description }\n\t\t\t\t\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t</>\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t{ ( isInvalid ||\n\t\t\t\t\t\t\t\tisDraft ||\n\t\t\t\t\t\t\t\tisLabelFieldFocused ) && (\n\t\t\t\t\t\t\t\t<div\n\t\t\t\t\t\t\t\t\tclassName={ clsx(\n\t\t\t\t\t\t\t\t\t\t'wp-block-navigation-link__placeholder-text',\n\t\t\t\t\t\t\t\t\t\t'wp-block-navigation-link__label',\n\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t'is-invalid': isInvalid,\n\t\t\t\t\t\t\t\t\t\t\t'is-draft': isDraft,\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t<span>\n\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t// Some attributes are stored in an escaped form. It's a legacy issue.\n\t\t\t\t\t\t\t\t\t\t\t// Ideally they would be stored in a raw, unescaped form.\n\t\t\t\t\t\t\t\t\t\t\t// Unescape is used here to \"recover\" the escaped characters\n\t\t\t\t\t\t\t\t\t\t\t// so they display without encoding.\n\t\t\t\t\t\t\t\t\t\t\t// See `updateAttributes` for more details.\n\t\t\t\t\t\t\t\t\t\t\t`${ decodeEntities( label ) } ${\n\t\t\t\t\t\t\t\t\t\t\t\tisInvalid || isDraft\n\t\t\t\t\t\t\t\t\t\t\t\t\t? placeholderText\n\t\t\t\t\t\t\t\t\t\t\t\t\t: ''\n\t\t\t\t\t\t\t\t\t\t\t}`.trim()\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t</>\n\t\t\t\t\t) }\n\t\t\t\t\t{ isLinkOpen && (\n\t\t\t\t\t\t<LinkUI\n\t\t\t\t\t\t\tref={ linkUIref }\n\t\t\t\t\t\t\tclientId={ clientId }\n\t\t\t\t\t\t\tlink={ attributes }\n\t\t\t\t\t\t\tonClose={ () => {\n\t\t\t\t\t\t\t\t// If there is no link then remove the auto-inserted block.\n\t\t\t\t\t\t\t\t// This avoids empty blocks which can provided a poor UX.\n\t\t\t\t\t\t\t\tif ( ! url ) {\n\t\t\t\t\t\t\t\t\t// Fixes https://github.com/WordPress/gutenberg/issues/61361\n\t\t\t\t\t\t\t\t\t// There's a chance we're closing due to the user selecting the browse all button.\n\t\t\t\t\t\t\t\t\t// Only move focus if the focus is still within the popover ui. If it's not within\n\t\t\t\t\t\t\t\t\t// the popover, it's because something has taken the focus from the popover, and\n\t\t\t\t\t\t\t\t\t// we don't want to steal it back.\n\t\t\t\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t\t\t\tlinkUIref.current.contains(\n\t\t\t\t\t\t\t\t\t\t\twindow.document.activeElement\n\t\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\t\t\t// Select the previous block to keep focus nearby\n\t\t\t\t\t\t\t\t\t\tselectPreviousBlock( clientId, true );\n\t\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t\t// Remove the link.\n\t\t\t\t\t\t\t\t\tonReplace( [] );\n\t\t\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\tsetIsLinkOpen( false );\n\t\t\t\t\t\t\t\tif ( openedBy ) {\n\t\t\t\t\t\t\t\t\topenedBy.focus();\n\t\t\t\t\t\t\t\t\tsetOpenedBy( null );\n\t\t\t\t\t\t\t\t} else if ( ref.current ) {\n\t\t\t\t\t\t\t\t\t// select the ref when adding a new link\n\t\t\t\t\t\t\t\t\tref.current.focus();\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\t// Fallback\n\t\t\t\t\t\t\t\t\tselectPreviousBlock( clientId, 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\tanchor={ popoverAnchor }\n\t\t\t\t\t\t\tonRemove={ removeLink }\n\t\t\t\t\t\t\tonChange={ ( updatedValue ) => {\n\t\t\t\t\t\t\t\tupdateAttributes(\n\t\t\t\t\t\t\t\t\tupdatedValue,\n\t\t\t\t\t\t\t\t\tsetAttributes,\n\t\t\t\t\t\t\t\t\tattributes\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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AAC,eACJzC,IAAA;QAAA,GAAUyI;MAAgB,CAAI,CAAC;IAAA,CAC3B,CAAC;EAAA,CACL,CAAC;AAEL","ignoreList":[]}
|
|
@@ -7,10 +7,15 @@ import clsx from 'clsx';
|
|
|
7
7
|
* WordPress dependencies
|
|
8
8
|
*/
|
|
9
9
|
import { AlignmentControl, BlockControls, InspectorControls, RichText, useBlockProps } from '@wordpress/block-editor';
|
|
10
|
-
import { ComboboxControl,
|
|
10
|
+
import { ComboboxControl, SelectControl, ToggleControl, __experimentalToolsPanel as ToolsPanel, __experimentalToolsPanelItem as ToolsPanelItem } from '@wordpress/components';
|
|
11
11
|
import { useSelect, useDispatch } from '@wordpress/data';
|
|
12
12
|
import { __, sprintf } from '@wordpress/i18n';
|
|
13
13
|
import { store as coreStore } from '@wordpress/core-data';
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Internal dependencies
|
|
17
|
+
*/
|
|
18
|
+
import { useToolsPanelDropdownMenuProps } from '../utils/hooks';
|
|
14
19
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
15
20
|
const minimumUsersForCombobox = 25;
|
|
16
21
|
const AUTHORS_QUERY = {
|
|
@@ -28,6 +33,7 @@ function PostAuthorEdit({
|
|
|
28
33
|
setAttributes
|
|
29
34
|
}) {
|
|
30
35
|
const isDescendentOfQueryLoop = Number.isFinite(queryId);
|
|
36
|
+
const dropdownMenuProps = useToolsPanelDropdownMenuProps();
|
|
31
37
|
const {
|
|
32
38
|
authorId,
|
|
33
39
|
authorDetails,
|
|
@@ -58,7 +64,8 @@ function PostAuthorEdit({
|
|
|
58
64
|
showBio,
|
|
59
65
|
byline,
|
|
60
66
|
isLink,
|
|
61
|
-
linkTarget
|
|
67
|
+
linkTarget,
|
|
68
|
+
avatarSize
|
|
62
69
|
} = attributes;
|
|
63
70
|
const avatarSizes = [];
|
|
64
71
|
const authorName = authorDetails?.name || __('Post Author');
|
|
@@ -101,12 +108,22 @@ function PostAuthorEdit({
|
|
|
101
108
|
}
|
|
102
109
|
return /*#__PURE__*/_jsxs(_Fragment, {
|
|
103
110
|
children: [/*#__PURE__*/_jsx(InspectorControls, {
|
|
104
|
-
children: /*#__PURE__*/
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
111
|
+
children: /*#__PURE__*/_jsxs(ToolsPanel, {
|
|
112
|
+
label: __('Settings'),
|
|
113
|
+
resetAll: () => {
|
|
114
|
+
setAttributes({
|
|
115
|
+
avatarSize: 48,
|
|
116
|
+
showAvatar: true,
|
|
117
|
+
isLink: false,
|
|
118
|
+
linkTarget: '_self'
|
|
119
|
+
});
|
|
120
|
+
},
|
|
121
|
+
dropdownMenuProps: dropdownMenuProps,
|
|
122
|
+
children: [showAuthorControl && /*#__PURE__*/_jsx("div", {
|
|
123
|
+
style: {
|
|
124
|
+
gridColumn: '1 / -1'
|
|
125
|
+
},
|
|
126
|
+
children: showCombobox && /*#__PURE__*/_jsx(ComboboxControl, {
|
|
110
127
|
__next40pxDefaultSize: true,
|
|
111
128
|
__nextHasNoMarginBottom: true,
|
|
112
129
|
label: __('Author'),
|
|
@@ -121,47 +138,87 @@ function PostAuthorEdit({
|
|
|
121
138
|
value: authorId,
|
|
122
139
|
options: authorOptions,
|
|
123
140
|
onChange: handleSelect
|
|
124
|
-
})
|
|
141
|
+
})
|
|
142
|
+
}), /*#__PURE__*/_jsx(ToolsPanelItem, {
|
|
143
|
+
label: __('Show avatar'),
|
|
144
|
+
isShownByDefault: true,
|
|
145
|
+
hasValue: () => !showAvatar,
|
|
146
|
+
onDeselect: () => setAttributes({
|
|
147
|
+
showAvatar: true
|
|
148
|
+
}),
|
|
149
|
+
children: /*#__PURE__*/_jsx(ToggleControl, {
|
|
125
150
|
__nextHasNoMarginBottom: true,
|
|
126
151
|
label: __('Show avatar'),
|
|
127
152
|
checked: showAvatar,
|
|
128
153
|
onChange: () => setAttributes({
|
|
129
154
|
showAvatar: !showAvatar
|
|
130
155
|
})
|
|
131
|
-
})
|
|
156
|
+
})
|
|
157
|
+
}), showAvatar && /*#__PURE__*/_jsx(ToolsPanelItem, {
|
|
158
|
+
label: __('Avatar size'),
|
|
159
|
+
isShownByDefault: true,
|
|
160
|
+
hasValue: () => avatarSize !== 48,
|
|
161
|
+
onDeselect: () => setAttributes({
|
|
162
|
+
avatarSize: 48
|
|
163
|
+
}),
|
|
164
|
+
children: /*#__PURE__*/_jsx(SelectControl, {
|
|
132
165
|
__next40pxDefaultSize: true,
|
|
133
166
|
__nextHasNoMarginBottom: true,
|
|
134
167
|
label: __('Avatar size'),
|
|
135
|
-
value:
|
|
168
|
+
value: avatarSize,
|
|
136
169
|
options: avatarSizes,
|
|
137
170
|
onChange: size => {
|
|
138
171
|
setAttributes({
|
|
139
172
|
avatarSize: Number(size)
|
|
140
173
|
});
|
|
141
174
|
}
|
|
142
|
-
})
|
|
175
|
+
})
|
|
176
|
+
}), /*#__PURE__*/_jsx(ToolsPanelItem, {
|
|
177
|
+
label: __('Show bio'),
|
|
178
|
+
isShownByDefault: true,
|
|
179
|
+
hasValue: () => !!showBio,
|
|
180
|
+
onDeselect: () => setAttributes({
|
|
181
|
+
showBio: undefined
|
|
182
|
+
}),
|
|
183
|
+
children: /*#__PURE__*/_jsx(ToggleControl, {
|
|
143
184
|
__nextHasNoMarginBottom: true,
|
|
144
185
|
label: __('Show bio'),
|
|
145
|
-
checked: showBio,
|
|
186
|
+
checked: !!showBio,
|
|
146
187
|
onChange: () => setAttributes({
|
|
147
188
|
showBio: !showBio
|
|
148
189
|
})
|
|
149
|
-
})
|
|
190
|
+
})
|
|
191
|
+
}), /*#__PURE__*/_jsx(ToolsPanelItem, {
|
|
192
|
+
label: __('Link author name to author page'),
|
|
193
|
+
isShownByDefault: true,
|
|
194
|
+
hasValue: () => !!isLink,
|
|
195
|
+
onDeselect: () => setAttributes({
|
|
196
|
+
isLink: false
|
|
197
|
+
}),
|
|
198
|
+
children: /*#__PURE__*/_jsx(ToggleControl, {
|
|
150
199
|
__nextHasNoMarginBottom: true,
|
|
151
200
|
label: __('Link author name to author page'),
|
|
152
201
|
checked: isLink,
|
|
153
202
|
onChange: () => setAttributes({
|
|
154
203
|
isLink: !isLink
|
|
155
204
|
})
|
|
156
|
-
})
|
|
205
|
+
})
|
|
206
|
+
}), isLink && /*#__PURE__*/_jsx(ToolsPanelItem, {
|
|
207
|
+
label: __('Link target'),
|
|
208
|
+
isShownByDefault: true,
|
|
209
|
+
hasValue: () => linkTarget !== '_self',
|
|
210
|
+
onDeselect: () => setAttributes({
|
|
211
|
+
linkTarget: '_self'
|
|
212
|
+
}),
|
|
213
|
+
children: /*#__PURE__*/_jsx(ToggleControl, {
|
|
157
214
|
__nextHasNoMarginBottom: true,
|
|
158
215
|
label: __('Open in new tab'),
|
|
159
216
|
onChange: value => setAttributes({
|
|
160
217
|
linkTarget: value ? '_blank' : '_self'
|
|
161
218
|
}),
|
|
162
219
|
checked: linkTarget === '_blank'
|
|
163
|
-
})
|
|
164
|
-
})
|
|
220
|
+
})
|
|
221
|
+
})]
|
|
165
222
|
})
|
|
166
223
|
}), /*#__PURE__*/_jsx(BlockControls, {
|
|
167
224
|
group: "block",
|
|
@@ -178,8 +235,8 @@ function PostAuthorEdit({
|
|
|
178
235
|
children: [showAvatar && authorDetails?.avatar_urls && /*#__PURE__*/_jsx("div", {
|
|
179
236
|
className: "wp-block-post-author__avatar",
|
|
180
237
|
children: /*#__PURE__*/_jsx("img", {
|
|
181
|
-
width:
|
|
182
|
-
src: authorDetails.avatar_urls[
|
|
238
|
+
width: avatarSize,
|
|
239
|
+
src: authorDetails.avatar_urls[avatarSize],
|
|
183
240
|
alt: authorDetails.name
|
|
184
241
|
})
|
|
185
242
|
}), /*#__PURE__*/_jsxs("div", {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["clsx","AlignmentControl","BlockControls","InspectorControls","RichText","useBlockProps","ComboboxControl","PanelBody","SelectControl","ToggleControl","__experimentalVStack","VStack","useSelect","useDispatch","__","sprintf","store","coreStore","jsx","_jsx","jsxs","_jsxs","Fragment","_Fragment","minimumUsersForCombobox","AUTHORS_QUERY","who","per_page","PostAuthorEdit","isSelected","context","postType","postId","queryId","attributes","setAttributes","isDescendentOfQueryLoop","Number","isFinite","authorId","authorDetails","authors","supportsAuthor","select","_getPostType$supports","getEditedEntityRecord","getUser","getUsers","getPostType","_authorId","author","supports","editEntityRecord","textAlign","showAvatar","showBio","byline","isLink","linkTarget","avatarSizes","authorName","name","avatar_urls","Object","keys","forEach","size","push","value","label","blockProps","className","authorOptions","length","map","id","handleSelect","nextAuthorId","showCombobox","showAuthorControl","undefined","children","title","spacing","__next40pxDefaultSize","__nextHasNoMarginBottom","options","onChange","allowReset","checked","avatarSize","group","nextAlign","width","src","alt","isEmpty","identifier","placeholder","href","onClick","event","preventDefault","dangerouslySetInnerHTML","__html","description"],"sources":["@wordpress/block-library/src/post-author/edit.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tAlignmentControl,\n\tBlockControls,\n\tInspectorControls,\n\tRichText,\n\tuseBlockProps,\n} from '@wordpress/block-editor';\nimport {\n\tComboboxControl,\n\tPanelBody,\n\tSelectControl,\n\tToggleControl,\n\t__experimentalVStack as VStack,\n} from '@wordpress/components';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { store as coreStore } from '@wordpress/core-data';\n\nconst minimumUsersForCombobox = 25;\n\nconst AUTHORS_QUERY = {\n\twho: 'authors',\n\tper_page: 100,\n};\n\nfunction PostAuthorEdit( {\n\tisSelected,\n\tcontext: { postType, postId, queryId },\n\tattributes,\n\tsetAttributes,\n} ) {\n\tconst isDescendentOfQueryLoop = Number.isFinite( queryId );\n\tconst { authorId, authorDetails, authors, supportsAuthor } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getEditedEntityRecord, getUser, getUsers, getPostType } =\n\t\t\t\tselect( coreStore );\n\t\t\tconst _authorId = getEditedEntityRecord(\n\t\t\t\t'postType',\n\t\t\t\tpostType,\n\t\t\t\tpostId\n\t\t\t)?.author;\n\n\t\t\treturn {\n\t\t\t\tauthorId: _authorId,\n\t\t\t\tauthorDetails: _authorId ? getUser( _authorId ) : null,\n\t\t\t\tauthors: getUsers( AUTHORS_QUERY ),\n\t\t\t\tsupportsAuthor:\n\t\t\t\t\tgetPostType( postType )?.supports?.author ?? false,\n\t\t\t};\n\t\t},\n\t\t[ postType, postId ]\n\t);\n\n\tconst { editEntityRecord } = useDispatch( coreStore );\n\n\tconst { textAlign, showAvatar, showBio, byline, isLink, linkTarget } =\n\t\tattributes;\n\tconst avatarSizes = [];\n\tconst authorName = authorDetails?.name || __( 'Post Author' );\n\tif ( authorDetails?.avatar_urls ) {\n\t\tObject.keys( authorDetails.avatar_urls ).forEach( ( size ) => {\n\t\t\tavatarSizes.push( {\n\t\t\t\tvalue: size,\n\t\t\t\tlabel: `${ size } x ${ size }`,\n\t\t\t} );\n\t\t} );\n\t}\n\n\tconst blockProps = useBlockProps( {\n\t\tclassName: clsx( {\n\t\t\t[ `has-text-align-${ textAlign }` ]: textAlign,\n\t\t} ),\n\t} );\n\n\tconst authorOptions = authors?.length\n\t\t? authors.map( ( { id, name } ) => {\n\t\t\t\treturn {\n\t\t\t\t\tvalue: id,\n\t\t\t\t\tlabel: name,\n\t\t\t\t};\n\t\t } )\n\t\t: [];\n\n\tconst handleSelect = ( nextAuthorId ) => {\n\t\teditEntityRecord( 'postType', postType, postId, {\n\t\t\tauthor: nextAuthorId,\n\t\t} );\n\t};\n\n\tconst showCombobox = authorOptions.length >= minimumUsersForCombobox;\n\tconst showAuthorControl =\n\t\t!! postId && ! isDescendentOfQueryLoop && authorOptions.length > 0;\n\n\tif ( ! supportsAuthor && postType !== undefined ) {\n\t\treturn (\n\t\t\t<div { ...blockProps }>\n\t\t\t\t{ sprintf(\n\t\t\t\t\t// translators: %s: Name of the post type e.g: \"post\".\n\t\t\t\t\t__( 'This post type (%s) does not support the author.' ),\n\t\t\t\t\tpostType\n\t\t\t\t) }\n\t\t\t</div>\n\t\t);\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t<InspectorControls>\n\t\t\t\t<PanelBody title={ __( 'Settings' ) }>\n\t\t\t\t\t<VStack\n\t\t\t\t\t\tspacing={ 4 }\n\t\t\t\t\t\tclassName=\"wp-block-post-author__inspector-settings\"\n\t\t\t\t\t>\n\t\t\t\t\t\t{ showAuthorControl &&\n\t\t\t\t\t\t\t( ( showCombobox && (\n\t\t\t\t\t\t\t\t<ComboboxControl\n\t\t\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t\t\t\tlabel={ __( 'Author' ) }\n\t\t\t\t\t\t\t\t\toptions={ authorOptions }\n\t\t\t\t\t\t\t\t\tvalue={ authorId }\n\t\t\t\t\t\t\t\t\tonChange={ handleSelect }\n\t\t\t\t\t\t\t\t\tallowReset={ false }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t) ) || (\n\t\t\t\t\t\t\t\t<SelectControl\n\t\t\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t\t\t\tlabel={ __( 'Author' ) }\n\t\t\t\t\t\t\t\t\tvalue={ authorId }\n\t\t\t\t\t\t\t\t\toptions={ authorOptions }\n\t\t\t\t\t\t\t\t\tonChange={ handleSelect }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t) ) }\n\t\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t\tlabel={ __( 'Show avatar' ) }\n\t\t\t\t\t\t\tchecked={ showAvatar }\n\t\t\t\t\t\t\tonChange={ () =>\n\t\t\t\t\t\t\t\tsetAttributes( { showAvatar: ! showAvatar } )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t{ showAvatar && (\n\t\t\t\t\t\t\t<SelectControl\n\t\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t\t\tlabel={ __( 'Avatar size' ) }\n\t\t\t\t\t\t\t\tvalue={ attributes.avatarSize }\n\t\t\t\t\t\t\t\toptions={ avatarSizes }\n\t\t\t\t\t\t\t\tonChange={ ( size ) => {\n\t\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\t\tavatarSize: Number( size ),\n\t\t\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t) }\n\t\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t\tlabel={ __( 'Show bio' ) }\n\t\t\t\t\t\t\tchecked={ showBio }\n\t\t\t\t\t\t\tonChange={ () =>\n\t\t\t\t\t\t\t\tsetAttributes( { showBio: ! showBio } )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t\tlabel={ __( 'Link author name to author page' ) }\n\t\t\t\t\t\t\tchecked={ isLink }\n\t\t\t\t\t\t\tonChange={ () =>\n\t\t\t\t\t\t\t\tsetAttributes( { isLink: ! isLink } )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t{ isLink && (\n\t\t\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t\t\tlabel={ __( 'Open in new tab' ) }\n\t\t\t\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\t\tlinkTarget: value ? '_blank' : '_self',\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\tchecked={ linkTarget === '_blank' }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t) }\n\t\t\t\t\t</VStack>\n\t\t\t\t</PanelBody>\n\t\t\t</InspectorControls>\n\n\t\t\t<BlockControls group=\"block\">\n\t\t\t\t<AlignmentControl\n\t\t\t\t\tvalue={ textAlign }\n\t\t\t\t\tonChange={ ( nextAlign ) => {\n\t\t\t\t\t\tsetAttributes( { textAlign: nextAlign } );\n\t\t\t\t\t} }\n\t\t\t\t/>\n\t\t\t</BlockControls>\n\n\t\t\t<div { ...blockProps }>\n\t\t\t\t{ showAvatar && authorDetails?.avatar_urls && (\n\t\t\t\t\t<div className=\"wp-block-post-author__avatar\">\n\t\t\t\t\t\t<img\n\t\t\t\t\t\t\twidth={ attributes.avatarSize }\n\t\t\t\t\t\t\tsrc={\n\t\t\t\t\t\t\t\tauthorDetails.avatar_urls[\n\t\t\t\t\t\t\t\t\tattributes.avatarSize\n\t\t\t\t\t\t\t\t]\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\talt={ authorDetails.name }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</div>\n\t\t\t\t) }\n\t\t\t\t<div className=\"wp-block-post-author__content\">\n\t\t\t\t\t{ ( ! RichText.isEmpty( byline ) || isSelected ) && (\n\t\t\t\t\t\t<RichText\n\t\t\t\t\t\t\tidentifier=\"byline\"\n\t\t\t\t\t\t\tclassName=\"wp-block-post-author__byline\"\n\t\t\t\t\t\t\taria-label={ __( 'Post author byline text' ) }\n\t\t\t\t\t\t\tplaceholder={ __( 'Write byline…' ) }\n\t\t\t\t\t\t\tvalue={ byline }\n\t\t\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\t\t\tsetAttributes( { byline: value } )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t\t<p className=\"wp-block-post-author__name\">\n\t\t\t\t\t\t{ isLink ? (\n\t\t\t\t\t\t\t<a\n\t\t\t\t\t\t\t\thref=\"#post-author-pseudo-link\"\n\t\t\t\t\t\t\t\tonClick={ ( event ) => event.preventDefault() }\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{ authorName }\n\t\t\t\t\t\t\t</a>\n\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\tauthorName\n\t\t\t\t\t\t) }\n\t\t\t\t\t</p>\n\t\t\t\t\t{ showBio && (\n\t\t\t\t\t\t<p\n\t\t\t\t\t\t\tclassName=\"wp-block-post-author__bio\"\n\t\t\t\t\t\t\tdangerouslySetInnerHTML={ {\n\t\t\t\t\t\t\t\t__html: authorDetails?.description,\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</div>\n\t\t\t</div>\n\t\t</>\n\t);\n}\n\nexport default PostAuthorEdit;\n"],"mappings":"AAAA;AACA;AACA;AACA,OAAOA,IAAI,MAAM,MAAM;;AAEvB;AACA;AACA;AACA,SACCC,gBAAgB,EAChBC,aAAa,EACbC,iBAAiB,EACjBC,QAAQ,EACRC,aAAa,QACP,yBAAyB;AAChC,SACCC,eAAe,EACfC,SAAS,EACTC,aAAa,EACbC,aAAa,EACbC,oBAAoB,IAAIC,MAAM,QACxB,uBAAuB;AAC9B,SAASC,SAAS,EAAEC,WAAW,QAAQ,iBAAiB;AACxD,SAASC,EAAE,EAAEC,OAAO,QAAQ,iBAAiB;AAC7C,SAASC,KAAK,IAAIC,SAAS,QAAQ,sBAAsB;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA,EAAAC,QAAA,IAAAC,SAAA;AAE1D,MAAMC,uBAAuB,GAAG,EAAE;AAElC,MAAMC,aAAa,GAAG;EACrBC,GAAG,EAAE,SAAS;EACdC,QAAQ,EAAE;AACX,CAAC;AAED,SAASC,cAAcA,CAAE;EACxBC,UAAU;EACVC,OAAO,EAAE;IAAEC,QA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KAAA;QAAKkD,SAAS,EAAC,+BAA+B;QAAAU,QAAA,GAC3C,CAAE,CAAE7E,QAAQ,CAAC4F,OAAO,CAAExC,MAAO,CAAC,IAAI3B,UAAU,kBAC7CV,IAAA,CAACf,QAAQ;UACR6F,UAAU,EAAC,QAAQ;UACnB1B,SAAS,EAAC,8BAA8B;UACxC,cAAazD,EAAE,CAAE,yBAA0B,CAAG;UAC9CoF,WAAW,EAAGpF,EAAE,CAAE,eAAgB,CAAG;UACrCsD,KAAK,EAAGZ,MAAQ;UAChB+B,QAAQ,EAAKnB,KAAK,IACjBjC,aAAa,CAAE;YAAEqB,MAAM,EAAEY;UAAM,CAAE;QACjC,CACD,CACD,eACDjD,IAAA;UAAGoD,SAAS,EAAC,4BAA4B;UAAAU,QAAA,EACtCxB,MAAM,gBACPtC,IAAA;YACCgF,IAAI,EAAC,0BAA0B;YAC/BC,OAAO,EAAKC,KAAK,IAAMA,KAAK,CAACC,cAAc,CAAC,CAAG;YAAArB,QAAA,EAE7CrB;UAAU,CACV,CAAC,GAEJA;QACA,CACC,CAAC,EACFL,OAAO,iBACRpC,IAAA;UACCoD,SAAS,EAAC,2BAA2B;UACrCgC,uBAAuB,EAAG;YACzBC,MAAM,EAAEhE,aAAa,EAAEiE;UACxB;QAAG,CACH,CACD;MAAA,CACG,CAAC;IAAA,CACF,CAAC;EAAA,CACL,CAAC;AAEL;AAEA,eAAe7E,cAAc","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["clsx","AlignmentControl","BlockControls","InspectorControls","RichText","useBlockProps","ComboboxControl","SelectControl","ToggleControl","__experimentalToolsPanel","ToolsPanel","__experimentalToolsPanelItem","ToolsPanelItem","useSelect","useDispatch","__","sprintf","store","coreStore","useToolsPanelDropdownMenuProps","jsx","_jsx","jsxs","_jsxs","Fragment","_Fragment","minimumUsersForCombobox","AUTHORS_QUERY","who","per_page","PostAuthorEdit","isSelected","context","postType","postId","queryId","attributes","setAttributes","isDescendentOfQueryLoop","Number","isFinite","dropdownMenuProps","authorId","authorDetails","authors","supportsAuthor","select","_getPostType$supports","getEditedEntityRecord","getUser","getUsers","getPostType","_authorId","author","supports","editEntityRecord","textAlign","showAvatar","showBio","byline","isLink","linkTarget","avatarSize","avatarSizes","authorName","name","avatar_urls","Object","keys","forEach","size","push","value","label","blockProps","className","authorOptions","length","map","id","handleSelect","nextAuthorId","showCombobox","showAuthorControl","undefined","children","resetAll","style","gridColumn","__next40pxDefaultSize","__nextHasNoMarginBottom","options","onChange","allowReset","isShownByDefault","hasValue","onDeselect","checked","group","nextAlign","width","src","alt","isEmpty","identifier","placeholder","href","onClick","event","preventDefault","dangerouslySetInnerHTML","__html","description"],"sources":["@wordpress/block-library/src/post-author/edit.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tAlignmentControl,\n\tBlockControls,\n\tInspectorControls,\n\tRichText,\n\tuseBlockProps,\n} from '@wordpress/block-editor';\nimport {\n\tComboboxControl,\n\tSelectControl,\n\tToggleControl,\n\t__experimentalToolsPanel as ToolsPanel,\n\t__experimentalToolsPanelItem as ToolsPanelItem,\n} from '@wordpress/components';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport { useToolsPanelDropdownMenuProps } from '../utils/hooks';\n\nconst minimumUsersForCombobox = 25;\n\nconst AUTHORS_QUERY = {\n\twho: 'authors',\n\tper_page: 100,\n};\n\nfunction PostAuthorEdit( {\n\tisSelected,\n\tcontext: { postType, postId, queryId },\n\tattributes,\n\tsetAttributes,\n} ) {\n\tconst isDescendentOfQueryLoop = Number.isFinite( queryId );\n\tconst dropdownMenuProps = useToolsPanelDropdownMenuProps();\n\n\tconst { authorId, authorDetails, authors, supportsAuthor } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getEditedEntityRecord, getUser, getUsers, getPostType } =\n\t\t\t\tselect( coreStore );\n\t\t\tconst _authorId = getEditedEntityRecord(\n\t\t\t\t'postType',\n\t\t\t\tpostType,\n\t\t\t\tpostId\n\t\t\t)?.author;\n\n\t\t\treturn {\n\t\t\t\tauthorId: _authorId,\n\t\t\t\tauthorDetails: _authorId ? getUser( _authorId ) : null,\n\t\t\t\tauthors: getUsers( AUTHORS_QUERY ),\n\t\t\t\tsupportsAuthor:\n\t\t\t\t\tgetPostType( postType )?.supports?.author ?? false,\n\t\t\t};\n\t\t},\n\t\t[ postType, postId ]\n\t);\n\n\tconst { editEntityRecord } = useDispatch( coreStore );\n\n\tconst {\n\t\ttextAlign,\n\t\tshowAvatar,\n\t\tshowBio,\n\t\tbyline,\n\t\tisLink,\n\t\tlinkTarget,\n\t\tavatarSize,\n\t} = attributes;\n\tconst avatarSizes = [];\n\tconst authorName = authorDetails?.name || __( 'Post Author' );\n\tif ( authorDetails?.avatar_urls ) {\n\t\tObject.keys( authorDetails.avatar_urls ).forEach( ( size ) => {\n\t\t\tavatarSizes.push( {\n\t\t\t\tvalue: size,\n\t\t\t\tlabel: `${ size } x ${ size }`,\n\t\t\t} );\n\t\t} );\n\t}\n\n\tconst blockProps = useBlockProps( {\n\t\tclassName: clsx( {\n\t\t\t[ `has-text-align-${ textAlign }` ]: textAlign,\n\t\t} ),\n\t} );\n\n\tconst authorOptions = authors?.length\n\t\t? authors.map( ( { id, name } ) => {\n\t\t\t\treturn {\n\t\t\t\t\tvalue: id,\n\t\t\t\t\tlabel: name,\n\t\t\t\t};\n\t\t } )\n\t\t: [];\n\n\tconst handleSelect = ( nextAuthorId ) => {\n\t\teditEntityRecord( 'postType', postType, postId, {\n\t\t\tauthor: nextAuthorId,\n\t\t} );\n\t};\n\n\tconst showCombobox = authorOptions.length >= minimumUsersForCombobox;\n\tconst showAuthorControl =\n\t\t!! postId && ! isDescendentOfQueryLoop && authorOptions.length > 0;\n\n\tif ( ! supportsAuthor && postType !== undefined ) {\n\t\treturn (\n\t\t\t<div { ...blockProps }>\n\t\t\t\t{ sprintf(\n\t\t\t\t\t// translators: %s: Name of the post type e.g: \"post\".\n\t\t\t\t\t__( 'This post type (%s) does not support the author.' ),\n\t\t\t\t\tpostType\n\t\t\t\t) }\n\t\t\t</div>\n\t\t);\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t<InspectorControls>\n\t\t\t\t<ToolsPanel\n\t\t\t\t\tlabel={ __( 'Settings' ) }\n\t\t\t\t\tresetAll={ () => {\n\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\tavatarSize: 48,\n\t\t\t\t\t\t\tshowAvatar: true,\n\t\t\t\t\t\t\tisLink: false,\n\t\t\t\t\t\t\tlinkTarget: '_self',\n\t\t\t\t\t\t} );\n\t\t\t\t\t} }\n\t\t\t\t\tdropdownMenuProps={ dropdownMenuProps }\n\t\t\t\t>\n\t\t\t\t\t{ showAuthorControl && (\n\t\t\t\t\t\t<div style={ { gridColumn: '1 / -1' } }>\n\t\t\t\t\t\t\t{ ( showCombobox && (\n\t\t\t\t\t\t\t\t<ComboboxControl\n\t\t\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t\t\t\tlabel={ __( 'Author' ) }\n\t\t\t\t\t\t\t\t\toptions={ authorOptions }\n\t\t\t\t\t\t\t\t\tvalue={ authorId }\n\t\t\t\t\t\t\t\t\tonChange={ handleSelect }\n\t\t\t\t\t\t\t\t\tallowReset={ false }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t) ) || (\n\t\t\t\t\t\t\t\t<SelectControl\n\t\t\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t\t\t\tlabel={ __( 'Author' ) }\n\t\t\t\t\t\t\t\t\tvalue={ authorId }\n\t\t\t\t\t\t\t\t\toptions={ authorOptions }\n\t\t\t\t\t\t\t\t\tonChange={ handleSelect }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t</div>\n\t\t\t\t\t) }\n\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\tlabel={ __( 'Show avatar' ) }\n\t\t\t\t\t\tisShownByDefault\n\t\t\t\t\t\thasValue={ () => ! showAvatar }\n\t\t\t\t\t\tonDeselect={ () =>\n\t\t\t\t\t\t\tsetAttributes( { showAvatar: true } )\n\t\t\t\t\t\t}\n\t\t\t\t\t>\n\t\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t\tlabel={ __( 'Show avatar' ) }\n\t\t\t\t\t\t\tchecked={ showAvatar }\n\t\t\t\t\t\t\tonChange={ () =>\n\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\tshowAvatar: ! showAvatar,\n\t\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t/>\n\t\t\t\t\t</ToolsPanelItem>\n\t\t\t\t\t{ showAvatar && (\n\t\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\t\tlabel={ __( 'Avatar size' ) }\n\t\t\t\t\t\t\tisShownByDefault\n\t\t\t\t\t\t\thasValue={ () => avatarSize !== 48 }\n\t\t\t\t\t\t\tonDeselect={ () =>\n\t\t\t\t\t\t\t\tsetAttributes( { avatarSize: 48 } )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<SelectControl\n\t\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t\t\tlabel={ __( 'Avatar size' ) }\n\t\t\t\t\t\t\t\tvalue={ avatarSize }\n\t\t\t\t\t\t\t\toptions={ avatarSizes }\n\t\t\t\t\t\t\t\tonChange={ ( size ) => {\n\t\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\t\tavatarSize: Number( size ),\n\t\t\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</ToolsPanelItem>\n\t\t\t\t\t) }\n\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\tlabel={ __( 'Show bio' ) }\n\t\t\t\t\t\tisShownByDefault\n\t\t\t\t\t\thasValue={ () => !! showBio }\n\t\t\t\t\t\tonDeselect={ () =>\n\t\t\t\t\t\t\tsetAttributes( { showBio: undefined } )\n\t\t\t\t\t\t}\n\t\t\t\t\t>\n\t\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t\tlabel={ __( 'Show bio' ) }\n\t\t\t\t\t\t\tchecked={ !! showBio }\n\t\t\t\t\t\t\tonChange={ () =>\n\t\t\t\t\t\t\t\tsetAttributes( { showBio: ! showBio } )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t/>\n\t\t\t\t\t</ToolsPanelItem>\n\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\tlabel={ __( 'Link author name to author page' ) }\n\t\t\t\t\t\tisShownByDefault\n\t\t\t\t\t\thasValue={ () => !! isLink }\n\t\t\t\t\t\tonDeselect={ () => setAttributes( { isLink: false } ) }\n\t\t\t\t\t>\n\t\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t\tlabel={ __( 'Link author name to author page' ) }\n\t\t\t\t\t\t\tchecked={ isLink }\n\t\t\t\t\t\t\tonChange={ () =>\n\t\t\t\t\t\t\t\tsetAttributes( { isLink: ! isLink } )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t/>\n\t\t\t\t\t</ToolsPanelItem>\n\t\t\t\t\t{ isLink && (\n\t\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\t\tlabel={ __( 'Link target' ) }\n\t\t\t\t\t\t\tisShownByDefault\n\t\t\t\t\t\t\thasValue={ () => linkTarget !== '_self' }\n\t\t\t\t\t\t\tonDeselect={ () =>\n\t\t\t\t\t\t\t\tsetAttributes( { linkTarget: '_self' } )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t\t\tlabel={ __( 'Open in new tab' ) }\n\t\t\t\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\t\tlinkTarget: value ? '_blank' : '_self',\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\tchecked={ linkTarget === '_blank' }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</ToolsPanelItem>\n\t\t\t\t\t) }\n\t\t\t\t</ToolsPanel>\n\t\t\t</InspectorControls>\n\n\t\t\t<BlockControls group=\"block\">\n\t\t\t\t<AlignmentControl\n\t\t\t\t\tvalue={ textAlign }\n\t\t\t\t\tonChange={ ( nextAlign ) => {\n\t\t\t\t\t\tsetAttributes( { textAlign: nextAlign } );\n\t\t\t\t\t} }\n\t\t\t\t/>\n\t\t\t</BlockControls>\n\n\t\t\t<div { ...blockProps }>\n\t\t\t\t{ showAvatar && authorDetails?.avatar_urls && (\n\t\t\t\t\t<div className=\"wp-block-post-author__avatar\">\n\t\t\t\t\t\t<img\n\t\t\t\t\t\t\twidth={ avatarSize }\n\t\t\t\t\t\t\tsrc={ authorDetails.avatar_urls[ avatarSize ] }\n\t\t\t\t\t\t\talt={ authorDetails.name }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</div>\n\t\t\t\t) }\n\t\t\t\t<div className=\"wp-block-post-author__content\">\n\t\t\t\t\t{ ( ! RichText.isEmpty( byline ) || isSelected ) && (\n\t\t\t\t\t\t<RichText\n\t\t\t\t\t\t\tidentifier=\"byline\"\n\t\t\t\t\t\t\tclassName=\"wp-block-post-author__byline\"\n\t\t\t\t\t\t\taria-label={ __( 'Post author byline text' ) }\n\t\t\t\t\t\t\tplaceholder={ __( 'Write byline…' ) }\n\t\t\t\t\t\t\tvalue={ byline }\n\t\t\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\t\t\tsetAttributes( { byline: value } )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t\t<p className=\"wp-block-post-author__name\">\n\t\t\t\t\t\t{ isLink ? (\n\t\t\t\t\t\t\t<a\n\t\t\t\t\t\t\t\thref=\"#post-author-pseudo-link\"\n\t\t\t\t\t\t\t\tonClick={ ( event ) => event.preventDefault() }\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{ authorName }\n\t\t\t\t\t\t\t</a>\n\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\tauthorName\n\t\t\t\t\t\t) }\n\t\t\t\t\t</p>\n\t\t\t\t\t{ showBio && (\n\t\t\t\t\t\t<p\n\t\t\t\t\t\t\tclassName=\"wp-block-post-author__bio\"\n\t\t\t\t\t\t\tdangerouslySetInnerHTML={ {\n\t\t\t\t\t\t\t\t__html: authorDetails?.description,\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</div>\n\t\t\t</div>\n\t\t</>\n\t);\n}\n\nexport default PostAuthorEdit;\n"],"mappings":"AAAA;AACA;AACA;AACA,OAAOA,IAAI,MAAM,MAAM;;AAEvB;AACA;AACA;AACA,SACCC,gBAAgB,EAChBC,aAAa,EACbC,iBAAiB,EACjBC,QAAQ,EACRC,aAAa,QACP,yBAAyB;AAChC,SACCC,eAAe,EACfC,aAAa,EACbC,aAAa,EACbC,wBAAwB,IAAIC,UAAU,EACtCC,4BAA4B,IAAIC,cAAc,QACxC,uBAAuB;AAC9B,SAASC,SAAS,EAAEC,WAAW,QAAQ,iBAAiB;AACxD,SAASC,EAAE,EAAEC,OAAO,QAAQ,iBAAiB;AAC7C,SAASC,KAAK,IA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YAAAxB,QAAA,EAE7CrB;UAAU,CACV,CAAC,GAEJA;QACA,CACC,CAAC,EACFN,OAAO,iBACRrC,IAAA;UACCsD,SAAS,EAAC,2BAA2B;UACrCmC,uBAAuB,EAAG;YACzBC,MAAM,EAAEpE,aAAa,EAAEqE;UACxB;QAAG,CACH,CACD;MAAA,CACG,CAAC;IAAA,CACF,CAAC;EAAA,CACL,CAAC;AAEL;AAEA,eAAelF,cAAc","ignoreList":[]}
|
|
@@ -6,11 +6,16 @@ import clsx from 'clsx';
|
|
|
6
6
|
/**
|
|
7
7
|
* WordPress dependencies
|
|
8
8
|
*/
|
|
9
|
-
import { __experimentalToggleGroupControl as ToggleGroupControl, __experimentalToggleGroupControlOption as ToggleGroupControlOption, ToggleControl, SelectControl
|
|
9
|
+
import { __experimentalToggleGroupControl as ToggleGroupControl, __experimentalToggleGroupControlOption as ToggleGroupControlOption, __experimentalToolsPanel as ToolsPanel, __experimentalToolsPanelItem as ToolsPanelItem, ToggleControl, SelectControl } from '@wordpress/components';
|
|
10
10
|
import { InspectorControls, RichText, BlockControls, AlignmentToolbar, useBlockProps, useBlockEditingMode } from '@wordpress/block-editor';
|
|
11
11
|
import { __, _x } from '@wordpress/i18n';
|
|
12
12
|
import { useSelect } from '@wordpress/data';
|
|
13
13
|
import { store as coreStore } from '@wordpress/core-data';
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Internal dependencies
|
|
17
|
+
*/
|
|
18
|
+
import { useToolsPanelDropdownMenuProps } from '../utils/hooks';
|
|
14
19
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
15
20
|
export default function PostNavigationLinkEdit({
|
|
16
21
|
context: {
|
|
@@ -74,46 +79,80 @@ export default function PostNavigationLinkEdit({
|
|
|
74
79
|
});
|
|
75
80
|
return [selectOption, ...taxonomyOptions];
|
|
76
81
|
};
|
|
82
|
+
const dropdownMenuProps = useToolsPanelDropdownMenuProps();
|
|
77
83
|
return /*#__PURE__*/_jsxs(_Fragment, {
|
|
78
84
|
children: [/*#__PURE__*/_jsx(InspectorControls, {
|
|
79
|
-
children: /*#__PURE__*/_jsxs(
|
|
80
|
-
|
|
81
|
-
|
|
85
|
+
children: /*#__PURE__*/_jsxs(ToolsPanel, {
|
|
86
|
+
label: __('Settings'),
|
|
87
|
+
resetAll: () => {
|
|
88
|
+
setAttributes({
|
|
89
|
+
showTitle: false,
|
|
90
|
+
linkLabel: false,
|
|
91
|
+
arrow: 'none'
|
|
92
|
+
});
|
|
93
|
+
},
|
|
94
|
+
dropdownMenuProps: dropdownMenuProps,
|
|
95
|
+
children: [/*#__PURE__*/_jsx(ToolsPanelItem, {
|
|
82
96
|
label: __('Display the title as a link'),
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
showTitle:
|
|
97
|
+
isShownByDefault: true,
|
|
98
|
+
hasValue: () => showTitle,
|
|
99
|
+
onDeselect: () => setAttributes({
|
|
100
|
+
showTitle: false
|
|
101
|
+
}),
|
|
102
|
+
children: /*#__PURE__*/_jsx(ToggleControl, {
|
|
103
|
+
__nextHasNoMarginBottom: true,
|
|
104
|
+
label: __('Display the title as a link'),
|
|
105
|
+
help: __('If you have entered a custom label, it will be prepended before the title.'),
|
|
106
|
+
checked: !!showTitle,
|
|
107
|
+
onChange: () => setAttributes({
|
|
108
|
+
showTitle: !showTitle
|
|
109
|
+
})
|
|
87
110
|
})
|
|
88
|
-
}), showTitle && /*#__PURE__*/_jsx(
|
|
89
|
-
__nextHasNoMarginBottom: true,
|
|
111
|
+
}), showTitle && /*#__PURE__*/_jsx(ToolsPanelItem, {
|
|
90
112
|
label: __('Include the label as part of the link'),
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
113
|
+
isShownByDefault: true,
|
|
114
|
+
hasValue: () => !!linkLabel,
|
|
115
|
+
onDeselect: () => setAttributes({
|
|
116
|
+
linkLabel: false
|
|
117
|
+
}),
|
|
118
|
+
children: /*#__PURE__*/_jsx(ToggleControl, {
|
|
119
|
+
__nextHasNoMarginBottom: true,
|
|
120
|
+
label: __('Include the label as part of the link'),
|
|
121
|
+
checked: !!linkLabel,
|
|
122
|
+
onChange: () => setAttributes({
|
|
123
|
+
linkLabel: !linkLabel
|
|
124
|
+
})
|
|
94
125
|
})
|
|
95
|
-
}), /*#__PURE__*/
|
|
96
|
-
__next40pxDefaultSize: true,
|
|
97
|
-
__nextHasNoMarginBottom: true,
|
|
126
|
+
}), /*#__PURE__*/_jsx(ToolsPanelItem, {
|
|
98
127
|
label: __('Arrow'),
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
value:
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
128
|
+
isShownByDefault: true,
|
|
129
|
+
hasValue: () => arrow !== 'none',
|
|
130
|
+
onDeselect: () => setAttributes({
|
|
131
|
+
arrow: 'none'
|
|
132
|
+
}),
|
|
133
|
+
children: /*#__PURE__*/_jsxs(ToggleGroupControl, {
|
|
134
|
+
__next40pxDefaultSize: true,
|
|
135
|
+
__nextHasNoMarginBottom: true,
|
|
136
|
+
label: __('Arrow'),
|
|
137
|
+
value: arrow,
|
|
138
|
+
onChange: value => {
|
|
139
|
+
setAttributes({
|
|
140
|
+
arrow: value
|
|
141
|
+
});
|
|
142
|
+
},
|
|
143
|
+
help: __('A decorative arrow for the next and previous link.'),
|
|
144
|
+
isBlock: true,
|
|
145
|
+
children: [/*#__PURE__*/_jsx(ToggleGroupControlOption, {
|
|
146
|
+
value: "none",
|
|
147
|
+
label: _x('None', 'Arrow option for Next/Previous link')
|
|
148
|
+
}), /*#__PURE__*/_jsx(ToggleGroupControlOption, {
|
|
149
|
+
value: "arrow",
|
|
150
|
+
label: _x('Arrow', 'Arrow option for Next/Previous link')
|
|
151
|
+
}), /*#__PURE__*/_jsx(ToggleGroupControlOption, {
|
|
152
|
+
value: "chevron",
|
|
153
|
+
label: _x('Chevron', 'Arrow option for Next/Previous link')
|
|
154
|
+
})]
|
|
155
|
+
})
|
|
117
156
|
})]
|
|
118
157
|
})
|
|
119
158
|
}), /*#__PURE__*/_jsx(InspectorControls, {
|