@wordpress/block-library 9.31.1-next.233ccab9b.0 → 9.32.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/accordion/edit.js +62 -12
- package/build/accordion/edit.js.map +1 -1
- package/build/accordion/index.js +15 -7
- package/build/accordion/index.js.map +1 -1
- package/build/accordion/view.js +15 -15
- package/build/accordion/view.js.map +1 -1
- package/build/accordion-heading/edit.js +68 -0
- package/build/accordion-heading/edit.js.map +1 -0
- package/build/accordion-heading/icon.js.map +1 -0
- package/build/{accordion-header → accordion-heading}/index.js +9 -12
- package/build/accordion-heading/index.js.map +1 -0
- package/build/{accordion-content → accordion-heading}/init.js.map +1 -1
- package/build/{accordion-header → accordion-heading}/save.js +6 -8
- package/build/accordion-heading/save.js.map +1 -0
- package/build/{accordion-content → accordion-item}/edit.js +8 -2
- package/build/accordion-item/edit.js.map +1 -0
- package/build/accordion-item/icon.js.map +1 -0
- package/build/{accordion-content → accordion-item}/index.js +5 -5
- package/build/accordion-item/index.js.map +1 -0
- package/build/accordion-item/init.js.map +1 -0
- package/build/accordion-item/save.js.map +1 -0
- package/build/accordion-panel/index.js +3 -2
- package/build/accordion-panel/index.js.map +1 -1
- package/build/block/index.js +1 -0
- package/build/block/index.js.map +1 -1
- package/build/index.js +24 -4
- package/build/index.js.map +1 -1
- package/build/navigation-link/edit.js +3 -140
- package/build/navigation-link/edit.js.map +1 -1
- package/build/navigation-link/shared/controls.js +171 -0
- package/build/navigation-link/shared/controls.js.map +1 -0
- package/build/navigation-link/shared/index.js +13 -0
- package/build/navigation-link/shared/index.js.map +1 -0
- package/build/navigation-submenu/edit.js +5 -110
- package/build/navigation-submenu/edit.js.map +1 -1
- package/build/pattern/index.js +1 -0
- package/build/pattern/index.js.map +1 -1
- package/build/post-time-to-read/edit.js +16 -61
- package/build/post-time-to-read/edit.js.map +1 -1
- package/build/post-time-to-read/index.js +5 -7
- package/build/post-time-to-read/index.js.map +1 -1
- package/build/post-time-to-read/variations.js +41 -0
- package/build/post-time-to-read/variations.js.map +1 -0
- package/build/query-title/edit.js +1 -1
- package/build/query-title/edit.js.map +1 -1
- package/build/template-part/index.js +1 -0
- package/build/template-part/index.js.map +1 -1
- package/build/utils/get-transformed-metadata.js +7 -0
- package/build/utils/get-transformed-metadata.js.map +1 -1
- package/build-module/accordion/edit.js +66 -16
- package/build-module/accordion/edit.js.map +1 -1
- package/build-module/accordion/index.js +15 -7
- package/build-module/accordion/index.js.map +1 -1
- package/build-module/accordion/view.js +15 -15
- package/build-module/accordion/view.js.map +1 -1
- package/build-module/accordion-heading/edit.js +61 -0
- package/build-module/accordion-heading/edit.js.map +1 -0
- package/build-module/accordion-heading/icon.js.map +1 -0
- package/build-module/{accordion-header → accordion-heading}/index.js +9 -12
- package/build-module/accordion-heading/index.js.map +1 -0
- package/build-module/{accordion-content → accordion-heading}/init.js.map +1 -1
- package/build-module/{accordion-header → accordion-heading}/save.js +6 -8
- package/build-module/accordion-heading/save.js.map +1 -0
- package/build-module/{accordion-content → accordion-item}/edit.js +8 -2
- package/build-module/accordion-item/edit.js.map +1 -0
- package/build-module/accordion-item/icon.js.map +1 -0
- package/build-module/{accordion-content → accordion-item}/index.js +5 -5
- package/build-module/accordion-item/index.js.map +1 -0
- package/build-module/accordion-item/init.js.map +1 -0
- package/build-module/accordion-item/save.js.map +1 -0
- package/build-module/accordion-panel/index.js +3 -2
- package/build-module/accordion-panel/index.js.map +1 -1
- package/build-module/block/index.js +1 -0
- package/build-module/block/index.js.map +1 -1
- package/build-module/index.js +25 -5
- package/build-module/index.js.map +1 -1
- package/build-module/navigation-link/edit.js +4 -141
- package/build-module/navigation-link/edit.js.map +1 -1
- package/build-module/navigation-link/shared/controls.js +165 -0
- package/build-module/navigation-link/shared/controls.js.map +1 -0
- package/build-module/navigation-link/shared/index.js +9 -0
- package/build-module/navigation-link/shared/index.js.map +1 -0
- package/build-module/navigation-submenu/edit.js +6 -111
- package/build-module/navigation-submenu/edit.js.map +1 -1
- package/build-module/pattern/index.js +1 -0
- package/build-module/pattern/index.js.map +1 -1
- package/build-module/post-time-to-read/edit.js +17 -62
- package/build-module/post-time-to-read/edit.js.map +1 -1
- package/build-module/post-time-to-read/index.js +5 -7
- package/build-module/post-time-to-read/index.js.map +1 -1
- package/build-module/post-time-to-read/variations.js +33 -0
- package/build-module/post-time-to-read/variations.js.map +1 -0
- package/build-module/query-title/edit.js +1 -1
- package/build-module/query-title/edit.js.map +1 -1
- package/build-module/template-part/index.js +1 -0
- package/build-module/template-part/index.js.map +1 -1
- package/build-module/utils/get-transformed-metadata.js +7 -0
- package/build-module/utils/get-transformed-metadata.js.map +1 -1
- package/build-style/{accordion-header → accordion-heading}/style-rtl.css +8 -7
- package/build-style/{accordion-header → accordion-heading}/style.css +8 -7
- package/build-style/{accordion-content → accordion-item}/style-rtl.css +5 -5
- package/build-style/{accordion-content → accordion-item}/style.css +5 -5
- package/build-style/style-rtl.css +13 -12
- package/build-style/style.css +13 -12
- package/package.json +35 -35
- package/src/accordion/block.json +11 -3
- package/src/accordion/edit.js +70 -13
- package/src/accordion/index.js +4 -4
- package/src/accordion/index.php +1 -1
- package/src/accordion/view.js +15 -15
- package/src/{accordion-header → accordion-heading}/block.json +10 -12
- package/src/accordion-heading/edit.js +70 -0
- package/src/{accordion-header → accordion-heading}/save.js +6 -8
- package/src/{accordion-header → accordion-heading}/style.scss +11 -7
- package/src/{accordion-content → accordion-item}/block.json +5 -5
- package/src/{accordion-content → accordion-item}/edit.js +12 -2
- package/src/{accordion-content → accordion-item}/index.php +11 -11
- package/src/{accordion-content → accordion-item}/style.scss +3 -3
- package/src/accordion-panel/block.json +3 -2
- package/src/block/block.json +1 -0
- package/src/index.js +23 -4
- package/src/navigation-link/edit.js +3 -142
- package/src/navigation-link/shared/README.md +47 -0
- package/src/navigation-link/shared/controls.js +167 -0
- package/src/navigation-link/shared/index.js +8 -0
- package/src/navigation-link/shared/test/controls.js +210 -0
- package/src/navigation-submenu/edit.js +7 -125
- package/src/pattern/block.json +1 -0
- package/src/post-time-to-read/block.json +3 -7
- package/src/post-time-to-read/edit.js +36 -94
- package/src/post-time-to-read/index.js +2 -0
- package/src/post-time-to-read/index.php +12 -7
- package/src/post-time-to-read/variations.js +39 -0
- package/src/query-title/edit.js +2 -1
- package/src/query-title/index.php +3 -1
- package/src/style.scss +2 -2
- package/src/template-part/block.json +1 -0
- package/src/utils/get-transformed-metadata.js +8 -0
- package/build/accordion-content/edit.js.map +0 -1
- package/build/accordion-content/icon.js.map +0 -1
- package/build/accordion-content/index.js.map +0 -1
- package/build/accordion-content/save.js.map +0 -1
- package/build/accordion-header/edit.js +0 -84
- package/build/accordion-header/edit.js.map +0 -1
- package/build/accordion-header/icon.js.map +0 -1
- package/build/accordion-header/index.js.map +0 -1
- package/build/accordion-header/init.js.map +0 -1
- package/build/accordion-header/save.js.map +0 -1
- package/build-module/accordion-content/edit.js.map +0 -1
- package/build-module/accordion-content/icon.js.map +0 -1
- package/build-module/accordion-content/index.js.map +0 -1
- package/build-module/accordion-content/save.js.map +0 -1
- package/build-module/accordion-header/edit.js +0 -77
- package/build-module/accordion-header/edit.js.map +0 -1
- package/build-module/accordion-header/icon.js.map +0 -1
- package/build-module/accordion-header/index.js.map +0 -1
- package/build-module/accordion-header/init.js.map +0 -1
- package/build-module/accordion-header/save.js.map +0 -1
- package/src/accordion-header/edit.js +0 -87
- /package/build/{accordion-header → accordion-heading}/icon.js +0 -0
- /package/build/{accordion-content → accordion-heading}/init.js +0 -0
- /package/build/{accordion-content → accordion-item}/icon.js +0 -0
- /package/build/{accordion-header → accordion-item}/init.js +0 -0
- /package/build/{accordion-content → accordion-item}/save.js +0 -0
- /package/build-module/{accordion-header → accordion-heading}/icon.js +0 -0
- /package/build-module/{accordion-content → accordion-heading}/init.js +0 -0
- /package/build-module/{accordion-content → accordion-item}/icon.js +0 -0
- /package/build-module/{accordion-header → accordion-item}/init.js +0 -0
- /package/build-module/{accordion-content → accordion-item}/save.js +0 -0
- /package/src/{accordion-header → accordion-heading}/icon.js +0 -0
- /package/src/{accordion-content → accordion-heading}/index.js +0 -0
- /package/src/{accordion-content → accordion-heading}/init.js +0 -0
- /package/src/{accordion-content → accordion-item}/icon.js +0 -0
- /package/src/{accordion-header → accordion-item}/index.js +0 -0
- /package/src/{accordion-header → accordion-item}/init.js +0 -0
- /package/src/{accordion-content → accordion-item}/save.js +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_clsx","_interopRequireDefault","require","_blocks","_data","_components","_keycodes","_i18n","_blockEditor","_url","_element","_dom","_htmlEntities","_icons","_coreData","_compose","_linkUi","_updateAttributes","_utils","_hooks","_jsxRuntime","DEFAULT_BLOCK","name","NESTING_BLOCK_NAMES","useIsDraggingWithin","elementRef","isDraggingWithin","setIsDraggingWithin","useState","useEffect","ownerDocument","current","handleDragStart","event","handleDragEnter","handleDragEnd","contains","target","addEventListener","removeEventListener","useIsInvalidLink","kind","type","id","enabled","isPostType","hasId","Number","isInteger","blockEditingMode","useBlockEditingMode","postStatus","useSelect","select","getEntityRecord","coreStore","status","isInvalid","isDraft","getMissingText","missingText","__","Controls","attributes","setAttributes","setIsEditingControl","label","url","description","rel","opensInNewTab","lastURLRef","useRef","dropdownMenuProps","useToolsPanelDropdownMenuProps","jsxs","__experimentalToolsPanel","resetAll","children","jsx","__experimentalToolsPanelItem","hasValue","onDeselect","isShownByDefault","TextControl","__nextHasNoMarginBottom","__next40pxDefaultSize","value","stripHTML","onChange","labelValue","autoComplete","onFocus","onBlur","safeDecodeURI","urlValue","encodeURI","updateAttributes","CheckboxControl","checked","TextareaControl","descriptionValue","help","relValue","NavigationLinkEdit","isSelected","insertBlocksAfter","mergeBlocks","onReplace","context","clientId","maxNestingLevel","replaceBlock","__unstableMarkNextChangeAsNotPersistent","selectBlock","selectPreviousBlock","useDispatch","blockEditorStore","isLinkOpen","setIsLinkOpen","openedBy","setOpenedBy","popoverAnchor","setPopoverAnchor","listItemRef","itemLabelPlaceholder","ref","linkUIref","prevUrl","usePrevious","isEditingControl","isAtMaxNesting","isTopLevelLink","isParentOfSelectedBlock","hasChildren","validateLinkStatus","getBlockCount","getBlockName","getBlockRootClientId","hasSelectedInnerBlock","getBlockParentsByBlockName","getSelectedBlockClientId","rootClientId","isTopLevel","selectedBlockClientId","rootNavigationClientId","enableLinkStatusValidation","length","getBlocks","transformToSubmenu","innerBlocks","createBlock","newSubmenu","isURL","prependHTTP","test","selectLabelText","focus","defaultView","selection","getSelection","range","createRange","selectNodeContents","removeAllRanges","addRange","removeLink","undefined","textColor","customTextColor","backgroundColor","customBackgroundColor","getColors","onKeyDown","isKeyboardEvent","primary","preventDefault","stopPropagation","blockProps","useBlockProps","useMergeRefs","className","clsx","getColorClassName","style","color","innerBlocksProps","useInnerBlocksProps","defaultBlock","directInsert","renderAppender","onClick","classes","placeholderText","Fragment","BlockControls","ToolbarGroup","ToolbarButton","icon","linkIcon","title","shortcut","displayShortcut","currentTarget","addSubmenu","InspectorControls","RichText","identifier","onMerge","__unstableOnSplitAtEnd","placeholder","withoutInteractiveFormatting","decodeEntities","trim","LinkUI","link","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\tCheckboxControl,\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, setIsEditingControl } ) {\n\tconst { label, url, description, rel, opensInNewTab } = attributes;\n\tconst lastURLRef = useRef( url );\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\topensInNewTab: false,\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={ () => setIsEditingControl( true ) }\n\t\t\t\t\tonBlur={ () => setIsEditingControl( 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\tsetAttributes( {\n\t\t\t\t\t\t\turl: encodeURI( safeDecodeURI( urlValue ) ),\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\tonFocus={ () => {\n\t\t\t\t\t\tlastURLRef.current = url;\n\t\t\t\t\t\tsetIsEditingControl( true );\n\t\t\t\t\t} }\n\t\t\t\t\tonBlur={ () => {\n\t\t\t\t\t\t// Defer the updateAttributes call to ensure entity connection isn't severed by accident.\n\t\t\t\t\t\tupdateAttributes(\n\t\t\t\t\t\t\t{ url: ! url ? lastURLRef.current : url },\n\t\t\t\t\t\t\tsetAttributes,\n\t\t\t\t\t\t\t{ ...attributes, url: lastURLRef.current }\n\t\t\t\t\t\t);\n\t\t\t\t\t\tsetIsEditingControl( false );\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={ () => !! opensInNewTab }\n\t\t\t\tlabel={ __( 'Open in new tab' ) }\n\t\t\t\tonDeselect={ () => setAttributes( { opensInNewTab: false } ) }\n\t\t\t\tisShownByDefault\n\t\t\t>\n\t\t\t\t<CheckboxControl\n\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\tlabel={ __( 'Open in new tab' ) }\n\t\t\t\t\tchecked={ opensInNewTab }\n\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\tsetAttributes( { opensInNewTab: value } )\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={ () => !! 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` and `url` using inspector causes RichText to change focus.\n\t// This is a workaround to keep the focus on the field when it's focused we don't render the RichText.\n\t// See: https://github.com/WordPress/gutenberg/pull/61374.\n\tconst [ isEditingControl, setIsEditingControl ] = 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\tsetIsEditingControl={ setIsEditingControl }\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 && ! isEditingControl ? (\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! isEditingControl && (\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 || isDraft || isEditingControl ) && (\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":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,sBAAA,CAAAC,OAAA;AAKA,IAAAC,OAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,WAAA,GAAAH,OAAA;AASA,IAAAI,SAAA,GAAAJ,OAAA;AACA,IAAAK,KAAA,GAAAL,OAAA;AACA,IAAAM,YAAA,GAAAN,OAAA;AAUA,IAAAO,IAAA,GAAAP,OAAA;AACA,IAAAQ,QAAA,GAAAR,OAAA;AACA,IAAAS,IAAA,GAAAT,OAAA;AACA,IAAAU,aAAA,GAAAV,OAAA;AACA,IAAAW,MAAA,GAAAX,OAAA;AACA,IAAAY,SAAA,GAAAZ,OAAA;AACA,IAAAa,QAAA,GAAAb,OAAA;AAKA,IAAAc,OAAA,GAAAd,OAAA;AACA,IAAAe,iBAAA,GAAAf,OAAA;AACA,IAAAgB,MAAA,GAAAhB,OAAA;AACA,IAAAiB,MAAA,GAAAjB,OAAA;AAAgE,IAAAkB,WAAA,GAAAlB,OAAA;AA7ChE;A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AAA,CAC3B,CAAC;EAAA,CACL,CAAC;AAEL","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["_clsx","_interopRequireDefault","require","_blocks","_data","_components","_keycodes","_i18n","_blockEditor","_url","_element","_htmlEntities","_icons","_coreData","_compose","_linkUi","_updateAttributes","_utils","_shared","_jsxRuntime","DEFAULT_BLOCK","name","NESTING_BLOCK_NAMES","useIsDraggingWithin","elementRef","isDraggingWithin","setIsDraggingWithin","useState","useEffect","ownerDocument","current","handleDragStart","event","handleDragEnter","handleDragEnd","contains","target","addEventListener","removeEventListener","useIsInvalidLink","kind","type","id","enabled","isPostType","hasId","Number","isInteger","blockEditingMode","useBlockEditingMode","postStatus","useSelect","select","getEntityRecord","coreStore","status","isInvalid","isDraft","getMissingText","missingText","__","NavigationLinkEdit","attributes","isSelected","setAttributes","insertBlocksAfter","mergeBlocks","onReplace","context","clientId","label","url","description","maxNestingLevel","replaceBlock","__unstableMarkNextChangeAsNotPersistent","selectBlock","selectPreviousBlock","useDispatch","blockEditorStore","isLinkOpen","setIsLinkOpen","openedBy","setOpenedBy","popoverAnchor","setPopoverAnchor","listItemRef","useRef","itemLabelPlaceholder","ref","linkUIref","prevUrl","usePrevious","isEditingControl","setIsEditingControl","isAtMaxNesting","isTopLevelLink","isParentOfSelectedBlock","hasChildren","validateLinkStatus","getBlockCount","getBlockName","getBlockRootClientId","hasSelectedInnerBlock","getBlockParentsByBlockName","getSelectedBlockClientId","rootClientId","isTopLevel","selectedBlockClientId","rootNavigationClientId","enableLinkStatusValidation","length","getBlocks","transformToSubmenu","innerBlocks","createBlock","newSubmenu","isURL","prependHTTP","test","selectLabelText","focus","defaultView","selection","getSelection","range","createRange","selectNodeContents","removeAllRanges","addRange","removeLink","undefined","opensInNewTab","textColor","customTextColor","backgroundColor","customBackgroundColor","getColors","onKeyDown","isKeyboardEvent","primary","preventDefault","stopPropagation","blockProps","useBlockProps","useMergeRefs","className","clsx","getColorClassName","style","color","innerBlocksProps","useInnerBlocksProps","defaultBlock","directInsert","renderAppender","onClick","classes","placeholderText","jsxs","Fragment","children","jsx","BlockControls","ToolbarGroup","ToolbarButton","icon","linkIcon","title","shortcut","displayShortcut","currentTarget","addSubmenu","InspectorControls","Controls","RichText","identifier","value","onChange","labelValue","onMerge","__unstableOnSplitAtEnd","placeholder","withoutInteractiveFormatting","decodeEntities","trim","LinkUI","link","onClose","window","document","activeElement","anchor","onRemove","updatedValue","updateAttributes"],"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 { ToolbarButton, ToolbarGroup } 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 } from '@wordpress/url';\nimport { useState, useEffect, useRef } from '@wordpress/element';\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 { Controls } from './shared';\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 */\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` and `url` using inspector causes RichText to change focus.\n\t// This is a workaround to keep the focus on the field when it's focused we don't render the RichText.\n\t// See: https://github.com/WordPress/gutenberg/pull/61374.\n\tconst [ isEditingControl, setIsEditingControl ] = 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\tsetIsEditingControl={ setIsEditingControl }\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 && ! isEditingControl ? (\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! isEditingControl && (\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 || isDraft || isEditingControl ) && (\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":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,sBAAA,CAAAC,OAAA;AAKA,IAAAC,OAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,WAAA,GAAAH,OAAA;AACA,IAAAI,SAAA,GAAAJ,OAAA;AACA,IAAAK,KAAA,GAAAL,OAAA;AACA,IAAAM,YAAA,GAAAN,OAAA;AAUA,IAAAO,IAAA,GAAAP,OAAA;AACA,IAAAQ,QAAA,GAAAR,OAAA;AACA,IAAAS,aAAA,GAAAT,OAAA;AACA,IAAAU,MAAA,GAAAV,OAAA;AACA,IAAAW,SAAA,GAAAX,OAAA;AACA,IAAAY,QAAA,GAAAZ,OAAA;AAKA,IAAAa,OAAA,GAAAb,OAAA;AACA,IAAAc,iBAAA,GAAAd,OAAA;AACA,IAAAe,MAAA,GAAAf,OAAA;AACA,IAAAgB,OAAA,GAAAhB,OAAA;AAAoC,IAAAiB,WAAA,GAAAjB,OAAA;AApCpC;AACA;AACA;;AAGA;AACA;AACA;;AAuBA;AACA;AACA;;AAMA,MAAMkB,aAAa,GAAG;EAAEC,IAAI,EAAE;AAAuB,CAAC;AACtD,MAAMC,mBAAmB,GAAG,CAC3B,sBAAsB,EACtB,yBAAyB,CACzB;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMC,mBAAmB,GAAKC,UAAU,IAAM;EAC7C,MAAM,CAAEC,gBAAgB,EAAEC,mBAAmB,CA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Aa,EACbF,UACD,CAAC;UACF;QAAG,CACH,CACD;MAAA,CACC,CAAC,eACJ,IAAA3C,WAAA,CAAA+I,GAAA;QAAA,GAAUX;MAAgB,CAAI,CAAC;IAAA,CAC3B,CAAC;EAAA,CACL,CAAC;AAEL","ignoreList":[]}
|
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.Controls = Controls;
|
|
7
|
+
var _components = require("@wordpress/components");
|
|
8
|
+
var _i18n = require("@wordpress/i18n");
|
|
9
|
+
var _element = require("@wordpress/element");
|
|
10
|
+
var _url = require("@wordpress/url");
|
|
11
|
+
var _dom = require("@wordpress/dom");
|
|
12
|
+
var _hooks = require("../../utils/hooks");
|
|
13
|
+
var _updateAttributes = require("../update-attributes");
|
|
14
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
15
|
+
/**
|
|
16
|
+
* WordPress dependencies
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Internal dependencies
|
|
21
|
+
*/
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Shared Controls component for Navigation Link and Navigation Submenu blocks.
|
|
25
|
+
*
|
|
26
|
+
* This component provides the inspector controls (ToolsPanel) that are identical
|
|
27
|
+
* between both navigation blocks.
|
|
28
|
+
*
|
|
29
|
+
* @param {Object} props - Component props
|
|
30
|
+
* @param {Object} props.attributes - Block attributes
|
|
31
|
+
* @param {Function} props.setAttributes - Function to update block attributes
|
|
32
|
+
* @param {Function} props.setIsEditingControl - Function to set editing state (optional)
|
|
33
|
+
*/
|
|
34
|
+
function Controls({
|
|
35
|
+
attributes,
|
|
36
|
+
setAttributes,
|
|
37
|
+
setIsEditingControl = () => {}
|
|
38
|
+
}) {
|
|
39
|
+
const {
|
|
40
|
+
label,
|
|
41
|
+
url,
|
|
42
|
+
description,
|
|
43
|
+
rel,
|
|
44
|
+
opensInNewTab
|
|
45
|
+
} = attributes;
|
|
46
|
+
const lastURLRef = (0, _element.useRef)(url);
|
|
47
|
+
const dropdownMenuProps = (0, _hooks.useToolsPanelDropdownMenuProps)();
|
|
48
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_components.__experimentalToolsPanel, {
|
|
49
|
+
label: (0, _i18n.__)('Settings'),
|
|
50
|
+
resetAll: () => {
|
|
51
|
+
setAttributes({
|
|
52
|
+
label: '',
|
|
53
|
+
url: '',
|
|
54
|
+
description: '',
|
|
55
|
+
rel: '',
|
|
56
|
+
opensInNewTab: false
|
|
57
|
+
});
|
|
58
|
+
},
|
|
59
|
+
dropdownMenuProps: dropdownMenuProps,
|
|
60
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_components.__experimentalToolsPanelItem, {
|
|
61
|
+
hasValue: () => !!label,
|
|
62
|
+
label: (0, _i18n.__)('Text'),
|
|
63
|
+
onDeselect: () => setAttributes({
|
|
64
|
+
label: ''
|
|
65
|
+
}),
|
|
66
|
+
isShownByDefault: true,
|
|
67
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.TextControl, {
|
|
68
|
+
__nextHasNoMarginBottom: true,
|
|
69
|
+
__next40pxDefaultSize: true,
|
|
70
|
+
label: (0, _i18n.__)('Text'),
|
|
71
|
+
value: label ? (0, _dom.__unstableStripHTML)(label) : '',
|
|
72
|
+
onChange: labelValue => {
|
|
73
|
+
setAttributes({
|
|
74
|
+
label: labelValue
|
|
75
|
+
});
|
|
76
|
+
},
|
|
77
|
+
autoComplete: "off",
|
|
78
|
+
onFocus: () => setIsEditingControl(true),
|
|
79
|
+
onBlur: () => setIsEditingControl(false)
|
|
80
|
+
})
|
|
81
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.__experimentalToolsPanelItem, {
|
|
82
|
+
hasValue: () => !!url,
|
|
83
|
+
label: (0, _i18n.__)('Link'),
|
|
84
|
+
onDeselect: () => setAttributes({
|
|
85
|
+
url: ''
|
|
86
|
+
}),
|
|
87
|
+
isShownByDefault: true,
|
|
88
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.TextControl, {
|
|
89
|
+
__nextHasNoMarginBottom: true,
|
|
90
|
+
__next40pxDefaultSize: true,
|
|
91
|
+
label: (0, _i18n.__)('Link'),
|
|
92
|
+
value: url ? (0, _url.safeDecodeURI)(url) : '',
|
|
93
|
+
onChange: urlValue => {
|
|
94
|
+
setAttributes({
|
|
95
|
+
url: encodeURI((0, _url.safeDecodeURI)(urlValue))
|
|
96
|
+
});
|
|
97
|
+
},
|
|
98
|
+
autoComplete: "off",
|
|
99
|
+
type: "url",
|
|
100
|
+
onFocus: () => {
|
|
101
|
+
lastURLRef.current = url;
|
|
102
|
+
setIsEditingControl(true);
|
|
103
|
+
},
|
|
104
|
+
onBlur: () => {
|
|
105
|
+
// Defer the updateAttributes call to ensure entity connection isn't severed by accident.
|
|
106
|
+
(0, _updateAttributes.updateAttributes)({
|
|
107
|
+
url: !url ? lastURLRef.current : url
|
|
108
|
+
}, setAttributes, {
|
|
109
|
+
...attributes,
|
|
110
|
+
url: lastURLRef.current
|
|
111
|
+
});
|
|
112
|
+
setIsEditingControl(false);
|
|
113
|
+
}
|
|
114
|
+
})
|
|
115
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.__experimentalToolsPanelItem, {
|
|
116
|
+
hasValue: () => !!opensInNewTab,
|
|
117
|
+
label: (0, _i18n.__)('Open in new tab'),
|
|
118
|
+
onDeselect: () => setAttributes({
|
|
119
|
+
opensInNewTab: false
|
|
120
|
+
}),
|
|
121
|
+
isShownByDefault: true,
|
|
122
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.CheckboxControl, {
|
|
123
|
+
__nextHasNoMarginBottom: true,
|
|
124
|
+
label: (0, _i18n.__)('Open in new tab'),
|
|
125
|
+
checked: opensInNewTab,
|
|
126
|
+
onChange: value => setAttributes({
|
|
127
|
+
opensInNewTab: value
|
|
128
|
+
})
|
|
129
|
+
})
|
|
130
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.__experimentalToolsPanelItem, {
|
|
131
|
+
hasValue: () => !!description,
|
|
132
|
+
label: (0, _i18n.__)('Description'),
|
|
133
|
+
onDeselect: () => setAttributes({
|
|
134
|
+
description: ''
|
|
135
|
+
}),
|
|
136
|
+
isShownByDefault: true,
|
|
137
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.TextareaControl, {
|
|
138
|
+
__nextHasNoMarginBottom: true,
|
|
139
|
+
label: (0, _i18n.__)('Description'),
|
|
140
|
+
value: description || '',
|
|
141
|
+
onChange: descriptionValue => {
|
|
142
|
+
setAttributes({
|
|
143
|
+
description: descriptionValue
|
|
144
|
+
});
|
|
145
|
+
},
|
|
146
|
+
help: (0, _i18n.__)('The description will be displayed in the menu if the current theme supports it.')
|
|
147
|
+
})
|
|
148
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.__experimentalToolsPanelItem, {
|
|
149
|
+
hasValue: () => !!rel,
|
|
150
|
+
label: (0, _i18n.__)('Rel attribute'),
|
|
151
|
+
onDeselect: () => setAttributes({
|
|
152
|
+
rel: ''
|
|
153
|
+
}),
|
|
154
|
+
isShownByDefault: true,
|
|
155
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.TextControl, {
|
|
156
|
+
__nextHasNoMarginBottom: true,
|
|
157
|
+
__next40pxDefaultSize: true,
|
|
158
|
+
label: (0, _i18n.__)('Rel attribute'),
|
|
159
|
+
value: rel || '',
|
|
160
|
+
onChange: relValue => {
|
|
161
|
+
setAttributes({
|
|
162
|
+
rel: relValue
|
|
163
|
+
});
|
|
164
|
+
},
|
|
165
|
+
autoComplete: "off",
|
|
166
|
+
help: (0, _i18n.__)('The relationship of the linked URL as space-separated link types.')
|
|
167
|
+
})
|
|
168
|
+
})]
|
|
169
|
+
});
|
|
170
|
+
}
|
|
171
|
+
//# sourceMappingURL=controls.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_components","require","_i18n","_element","_url","_dom","_hooks","_updateAttributes","_jsxRuntime","Controls","attributes","setAttributes","setIsEditingControl","label","url","description","rel","opensInNewTab","lastURLRef","useRef","dropdownMenuProps","useToolsPanelDropdownMenuProps","jsxs","__experimentalToolsPanel","__","resetAll","children","jsx","__experimentalToolsPanelItem","hasValue","onDeselect","isShownByDefault","TextControl","__nextHasNoMarginBottom","__next40pxDefaultSize","value","stripHTML","onChange","labelValue","autoComplete","onFocus","onBlur","safeDecodeURI","urlValue","encodeURI","type","current","updateAttributes","CheckboxControl","checked","TextareaControl","descriptionValue","help","relValue"],"sources":["@wordpress/block-library/src/navigation-link/shared/controls.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\t__experimentalToolsPanel as ToolsPanel,\n\t__experimentalToolsPanelItem as ToolsPanelItem,\n\tCheckboxControl,\n\tTextControl,\n\tTextareaControl,\n} from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { useRef } from '@wordpress/element';\nimport { safeDecodeURI } from '@wordpress/url';\nimport { __unstableStripHTML as stripHTML } from '@wordpress/dom';\n\n/**\n * Internal dependencies\n */\nimport { useToolsPanelDropdownMenuProps } from '../../utils/hooks';\nimport { updateAttributes } from '../update-attributes';\n\n/**\n * Shared Controls component for Navigation Link and Navigation Submenu blocks.\n *\n * This component provides the inspector controls (ToolsPanel) that are identical\n * between both navigation blocks.\n *\n * @param {Object} props - Component props\n * @param {Object} props.attributes - Block attributes\n * @param {Function} props.setAttributes - Function to update block attributes\n * @param {Function} props.setIsEditingControl - Function to set editing state (optional)\n */\nexport function Controls( {\n\tattributes,\n\tsetAttributes,\n\tsetIsEditingControl = () => {},\n} ) {\n\tconst { label, url, description, rel, opensInNewTab } = attributes;\n\tconst lastURLRef = useRef( url );\n\tconst dropdownMenuProps = useToolsPanelDropdownMenuProps();\n\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\topensInNewTab: false,\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={ () => setIsEditingControl( true ) }\n\t\t\t\t\tonBlur={ () => setIsEditingControl( 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\tsetAttributes( {\n\t\t\t\t\t\t\turl: encodeURI( safeDecodeURI( urlValue ) ),\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\tonFocus={ () => {\n\t\t\t\t\t\tlastURLRef.current = url;\n\t\t\t\t\t\tsetIsEditingControl( true );\n\t\t\t\t\t} }\n\t\t\t\t\tonBlur={ () => {\n\t\t\t\t\t\t// Defer the updateAttributes call to ensure entity connection isn't severed by accident.\n\t\t\t\t\t\tupdateAttributes(\n\t\t\t\t\t\t\t{ url: ! url ? lastURLRef.current : url },\n\t\t\t\t\t\t\tsetAttributes,\n\t\t\t\t\t\t\t{ ...attributes, url: lastURLRef.current }\n\t\t\t\t\t\t);\n\t\t\t\t\t\tsetIsEditingControl( false );\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={ () => !! opensInNewTab }\n\t\t\t\tlabel={ __( 'Open in new tab' ) }\n\t\t\t\tonDeselect={ () => setAttributes( { opensInNewTab: false } ) }\n\t\t\t\tisShownByDefault\n\t\t\t>\n\t\t\t\t<CheckboxControl\n\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\tlabel={ __( 'Open in new tab' ) }\n\t\t\t\t\tchecked={ opensInNewTab }\n\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\tsetAttributes( { opensInNewTab: value } )\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={ () => !! 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"],"mappings":";;;;;;AAGA,IAAAA,WAAA,GAAAC,OAAA;AAOA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,QAAA,GAAAF,OAAA;AACA,IAAAG,IAAA,GAAAH,OAAA;AACA,IAAAI,IAAA,GAAAJ,OAAA;AAKA,IAAAK,MAAA,GAAAL,OAAA;AACA,IAAAM,iBAAA,GAAAN,OAAA;AAAwD,IAAAO,WAAA,GAAAP,OAAA;AAnBxD;AACA;AACA;;AAaA;AACA;AACA;;AAIA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASQ,QAAQA,CAAE;EACzBC,UAAU;EACVC,aAAa;EACbC,mBAAmB,GAAGA,CAAA,KAAM,CAAC;AAC9B,CAAC,EAAG;EACH,MAAM;IAAEC,KAAK;IAAEC,GAAG;IAAEC,WAAW;IAAEC,GAAG;IAAEC;EAAc,CAAC,GAA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AAQ,EAAGA,CAAA,KAAM,CAAC,CAAEb,GAAK;MACzBH,KAAK,EAAG,IAAAW,QAAE,EAAE,eAAgB,CAAG;MAC/BM,UAAU,EAAGA,CAAA,KAAMnB,aAAa,CAAE;QAAEK,GAAG,EAAE;MAAG,CAAE,CAAG;MACjDe,gBAAgB;MAAAL,QAAA,eAEhB,IAAAlB,WAAA,CAAAmB,GAAA,EAAC3B,WAAA,CAAAgC,WAAW;QACXC,uBAAuB;QACvBC,qBAAqB;QACrBrB,KAAK,EAAG,IAAAW,QAAE,EAAE,eAAgB,CAAG;QAC/BW,KAAK,EAAGnB,GAAG,IAAI,EAAI;QACnBqB,QAAQ,EAAKgB,QAAQ,IAAM;UAC1B1C,aAAa,CAAE;YAAEK,GAAG,EAAEqC;UAAS,CAAE,CAAC;QACnC,CAAG;QACHd,YAAY,EAAC,KAAK;QAClBa,IAAI,EAAG,IAAA5B,QAAE,EACR,mEACD;MAAG,CACH;IAAC,CACa,CAAC;EAAA,CACN,CAAC;AAEf","ignoreList":[]}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
Object.defineProperty(exports, "Controls", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function () {
|
|
9
|
+
return _controls.Controls;
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
var _controls = require("./controls");
|
|
13
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_controls","require"],"sources":["@wordpress/block-library/src/navigation-link/shared/index.js"],"sourcesContent":["/**\n * Shared components for Navigation Link and Navigation Submenu blocks.\n *\n * This module provides common functionality that can be used by both blocks\n * to reduce code duplication and ensure consistent behavior.\n */\n\nexport { Controls } from './controls';\n"],"mappings":";;;;;;;;;;;AAOA,IAAAA,SAAA,GAAAC,OAAA","ignoreList":[]}
|
|
@@ -20,8 +20,8 @@ var _compose = require("@wordpress/compose");
|
|
|
20
20
|
var _icons2 = require("./icons");
|
|
21
21
|
var _linkUi = require("../navigation-link/link-ui");
|
|
22
22
|
var _updateAttributes = require("../navigation-link/update-attributes");
|
|
23
|
+
var _shared = require("../navigation-link/shared");
|
|
23
24
|
var _utils = require("../navigation/edit/utils");
|
|
24
|
-
var _hooks = require("../utils/hooks");
|
|
25
25
|
var _constants = require("../navigation/constants");
|
|
26
26
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
27
27
|
/**
|
|
@@ -116,9 +116,7 @@ function NavigationSubmenuEdit({
|
|
|
116
116
|
const {
|
|
117
117
|
label,
|
|
118
118
|
url,
|
|
119
|
-
description
|
|
120
|
-
rel,
|
|
121
|
-
opensInNewTab
|
|
119
|
+
description
|
|
122
120
|
} = attributes;
|
|
123
121
|
const {
|
|
124
122
|
showSubmenuIcon,
|
|
@@ -140,7 +138,6 @@ function NavigationSubmenuEdit({
|
|
|
140
138
|
const isDraggingWithin = useIsDraggingWithin(listItemRef);
|
|
141
139
|
const itemLabelPlaceholder = (0, _i18n.__)('Add text…');
|
|
142
140
|
const ref = (0, _element.useRef)();
|
|
143
|
-
const dropdownMenuProps = (0, _hooks.useToolsPanelDropdownMenuProps)();
|
|
144
141
|
const {
|
|
145
142
|
parentCount,
|
|
146
143
|
isParentOfSelectedBlock,
|
|
@@ -319,111 +316,9 @@ function NavigationSubmenuEdit({
|
|
|
319
316
|
})]
|
|
320
317
|
})
|
|
321
318
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_blockEditor.InspectorControls, {
|
|
322
|
-
children: /*#__PURE__*/(0, _jsxRuntime.
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
setAttributes({
|
|
326
|
-
label: '',
|
|
327
|
-
url: '',
|
|
328
|
-
description: '',
|
|
329
|
-
rel: '',
|
|
330
|
-
opensInNewTab: false
|
|
331
|
-
});
|
|
332
|
-
},
|
|
333
|
-
dropdownMenuProps: dropdownMenuProps,
|
|
334
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_components.__experimentalToolsPanelItem, {
|
|
335
|
-
label: (0, _i18n.__)('Text'),
|
|
336
|
-
isShownByDefault: true,
|
|
337
|
-
hasValue: () => !!label,
|
|
338
|
-
onDeselect: () => setAttributes({
|
|
339
|
-
label: ''
|
|
340
|
-
}),
|
|
341
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.TextControl, {
|
|
342
|
-
__nextHasNoMarginBottom: true,
|
|
343
|
-
__next40pxDefaultSize: true,
|
|
344
|
-
value: label || '',
|
|
345
|
-
onChange: labelValue => {
|
|
346
|
-
setAttributes({
|
|
347
|
-
label: labelValue
|
|
348
|
-
});
|
|
349
|
-
},
|
|
350
|
-
label: (0, _i18n.__)('Text'),
|
|
351
|
-
autoComplete: "off"
|
|
352
|
-
})
|
|
353
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.__experimentalToolsPanelItem, {
|
|
354
|
-
label: (0, _i18n.__)('Link'),
|
|
355
|
-
isShownByDefault: true,
|
|
356
|
-
hasValue: () => !!url,
|
|
357
|
-
onDeselect: () => setAttributes({
|
|
358
|
-
url: ''
|
|
359
|
-
}),
|
|
360
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.TextControl, {
|
|
361
|
-
__nextHasNoMarginBottom: true,
|
|
362
|
-
__next40pxDefaultSize: true,
|
|
363
|
-
value: url || '',
|
|
364
|
-
onChange: urlValue => {
|
|
365
|
-
setAttributes({
|
|
366
|
-
url: urlValue
|
|
367
|
-
});
|
|
368
|
-
},
|
|
369
|
-
label: (0, _i18n.__)('Link'),
|
|
370
|
-
autoComplete: "off",
|
|
371
|
-
type: "url"
|
|
372
|
-
})
|
|
373
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.__experimentalToolsPanelItem, {
|
|
374
|
-
hasValue: () => !!opensInNewTab,
|
|
375
|
-
label: (0, _i18n.__)('Open in new tab'),
|
|
376
|
-
onDeselect: () => setAttributes({
|
|
377
|
-
opensInNewTab: false
|
|
378
|
-
}),
|
|
379
|
-
isShownByDefault: true,
|
|
380
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.CheckboxControl, {
|
|
381
|
-
__nextHasNoMarginBottom: true,
|
|
382
|
-
label: (0, _i18n.__)('Open in new tab'),
|
|
383
|
-
checked: opensInNewTab,
|
|
384
|
-
onChange: value => setAttributes({
|
|
385
|
-
opensInNewTab: value
|
|
386
|
-
})
|
|
387
|
-
})
|
|
388
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.__experimentalToolsPanelItem, {
|
|
389
|
-
label: (0, _i18n.__)('Description'),
|
|
390
|
-
isShownByDefault: true,
|
|
391
|
-
hasValue: () => !!description,
|
|
392
|
-
onDeselect: () => setAttributes({
|
|
393
|
-
description: ''
|
|
394
|
-
}),
|
|
395
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.TextareaControl, {
|
|
396
|
-
__nextHasNoMarginBottom: true,
|
|
397
|
-
value: description || '',
|
|
398
|
-
onChange: descriptionValue => {
|
|
399
|
-
setAttributes({
|
|
400
|
-
description: descriptionValue
|
|
401
|
-
});
|
|
402
|
-
},
|
|
403
|
-
label: (0, _i18n.__)('Description'),
|
|
404
|
-
help: (0, _i18n.__)('The description will be displayed in the menu if the current theme supports it.')
|
|
405
|
-
})
|
|
406
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.__experimentalToolsPanelItem, {
|
|
407
|
-
label: (0, _i18n.__)('Rel attribute'),
|
|
408
|
-
isShownByDefault: true,
|
|
409
|
-
hasValue: () => !!rel,
|
|
410
|
-
onDeselect: () => setAttributes({
|
|
411
|
-
rel: ''
|
|
412
|
-
}),
|
|
413
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.TextControl, {
|
|
414
|
-
__nextHasNoMarginBottom: true,
|
|
415
|
-
__next40pxDefaultSize: true,
|
|
416
|
-
value: rel || '',
|
|
417
|
-
onChange: relValue => {
|
|
418
|
-
setAttributes({
|
|
419
|
-
rel: relValue
|
|
420
|
-
});
|
|
421
|
-
},
|
|
422
|
-
label: (0, _i18n.__)('Rel attribute'),
|
|
423
|
-
autoComplete: "off",
|
|
424
|
-
help: (0, _i18n.__)('The relationship of the linked URL as space-separated link types.')
|
|
425
|
-
})
|
|
426
|
-
})]
|
|
319
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_shared.Controls, {
|
|
320
|
+
attributes: attributes,
|
|
321
|
+
setAttributes: setAttributes
|
|
427
322
|
})
|
|
428
323
|
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
429
324
|
...blockProps,
|