@wordpress/block-library 9.33.1 → 9.33.2-next.36001005c.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/build/navigation/edit/menu-inspector-controls.js +1 -1
- package/build/navigation/edit/menu-inspector-controls.js.map +2 -2
- package/build/navigation-link/edit.js +1 -1
- package/build/navigation-link/edit.js.map +2 -2
- package/build/navigation-link/shared/controls.js +36 -16
- package/build/navigation-link/shared/controls.js.map +2 -2
- package/build/navigation-link/shared/use-entity-binding.js +1 -1
- package/build/navigation-link/shared/use-entity-binding.js.map +2 -2
- package/build/navigation-submenu/edit.js +1 -1
- package/build/navigation-submenu/edit.js.map +2 -2
- package/build/post-date/deprecated.js +1 -1
- package/build/post-date/deprecated.js.map +2 -2
- package/build-module/navigation/edit/menu-inspector-controls.js +1 -1
- package/build-module/navigation/edit/menu-inspector-controls.js.map +2 -2
- package/build-module/navigation-link/edit.js +1 -1
- package/build-module/navigation-link/edit.js.map +2 -2
- package/build-module/navigation-link/shared/controls.js +37 -17
- package/build-module/navigation-link/shared/controls.js.map +2 -2
- package/build-module/navigation-link/shared/use-entity-binding.js +1 -1
- package/build-module/navigation-link/shared/use-entity-binding.js.map +2 -2
- package/build-module/navigation-submenu/edit.js +1 -1
- package/build-module/navigation-submenu/edit.js.map +2 -2
- package/build-module/post-date/deprecated.js +1 -1
- package/build-module/post-date/deprecated.js.map +2 -2
- package/build-style/editor-rtl.css +2 -2
- package/build-style/editor.css +2 -2
- package/build-style/navigation-link/editor-rtl.css +1 -1
- package/build-style/navigation-link/editor.css +1 -1
- package/build-style/video/editor-rtl.css +1 -1
- package/build-style/video/editor.css +1 -1
- package/package.json +37 -37
- package/src/navigation/edit/menu-inspector-controls.js +1 -1
- package/src/navigation-link/edit.js +1 -1
- package/src/navigation-link/editor.scss +1 -1
- package/src/navigation-link/shared/controls.js +58 -18
- package/src/navigation-link/shared/test/controls.js +14 -9
- package/src/navigation-link/shared/use-entity-binding.js +1 -1
- package/src/navigation-submenu/edit.js +1 -1
- package/src/post-date/deprecated.js +5 -1
- package/src/video/editor.scss +1 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/navigation-submenu/edit.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\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\tInnerBlocks,\n\tuseInnerBlocksProps,\n\tInspectorControls,\n\tRichText,\n\tuseBlockProps,\n\tuseBlockEditingMode,\n\tstore as blockEditorStore,\n\tgetColorClassName,\n} from '@wordpress/block-editor';\nimport { isURL, prependHTTP } from '@wordpress/url';\nimport { useState, useEffect, useRef } from '@wordpress/element';\nimport { link as linkIcon, removeSubmenu } from '@wordpress/icons';\nimport { speak } from '@wordpress/a11y';\nimport { createBlock } from '@wordpress/blocks';\nimport { useMergeRefs, usePrevious } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport { ItemSubmenuIcon } from './icons';\nimport {\n\tControls,\n\tLinkUI,\n\tupdateAttributes,\n\tuseEntityBinding,\n} from '../navigation-link/shared';\nimport {\n\tgetColors,\n\tgetNavigationChildBlockProps,\n} from '../navigation/edit/utils';\nimport { DEFAULT_BLOCK } from '../navigation/constants';\n\nconst ALLOWED_BLOCKS = [\n\t'core/navigation-link',\n\t'core/navigation-submenu',\n\t'core/page-list',\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}, [] );\n\n\treturn isDraggingWithin;\n};\n\n/**\n * @typedef {'post-type'|'custom'|'taxonomy'|'post-type-archive'} WPNavigationLinkKind\n */\n\n/**\n * Navigation Link Block Attributes\n *\n * @typedef {Object} WPNavigationLinkBlockAttributes\n *\n * @property {string} [label] Link text.\n * @property {WPNavigationLinkKind} [kind] Kind is used to differentiate between term and post ids to check post draft status.\n * @property {string} [type] The type such as post, page, tag, category and other custom types.\n * @property {string} [rel] The relationship of the linked URL.\n * @property {number} [id] A post or term id.\n * @property {boolean} [opensInNewTab] Sets link target to _blank when true.\n * @property {string} [url] Link href.\n */\n\nexport default function NavigationSubmenuEdit( {\n\tattributes,\n\tisSelected,\n\tsetAttributes,\n\tmergeBlocks,\n\tonReplace,\n\tcontext,\n\tclientId,\n} ) {\n\tconst { label, url, description } = attributes;\n\n\tconst {\n\t\tshowSubmenuIcon,\n\t\tmaxNestingLevel,\n\t\topenSubmenusOnClick: contextOpenSubmenusOnClick,\n\t} = context;\n\tconst blockEditingMode = useBlockEditingMode();\n\n\t// Force click-only behavior in contentOnly mode to prevent hover dropdowns\n\tconst openSubmenusOnClick =\n\t\tblockEditingMode !== 'default' ? true : contextOpenSubmenusOnClick;\n\n\t// URL binding logic\n\tconst { clearBinding, createBinding } = useEntityBinding( {\n\t\tclientId,\n\t\tattributes,\n\t} );\n\n\tconst { __unstableMarkNextChangeAsNotPersistent, replaceBlock } =\n\t\tuseDispatch( blockEditorStore );\n\tconst [ isLinkOpen, setIsLinkOpen ] = useState( false );\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 text\u2026' );\n\tconst ref = useRef();\n\n\tconst {\n\t\tparentCount,\n\t\tisParentOfSelectedBlock,\n\t\tisImmediateParentOfSelectedBlock,\n\t\thasChildren,\n\t\tselectedBlockHasChildren,\n\t\tonlyDescendantIsEmptyLink,\n\t} = useSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\thasSelectedInnerBlock,\n\t\t\t\tgetSelectedBlockClientId,\n\t\t\t\tgetBlockParentsByBlockName,\n\t\t\t\tgetBlock,\n\t\t\t\tgetBlockCount,\n\t\t\t\tgetBlockOrder,\n\t\t\t} = select( blockEditorStore );\n\n\t\t\tlet _onlyDescendantIsEmptyLink;\n\n\t\t\tconst selectedBlockId = getSelectedBlockClientId();\n\n\t\t\tconst selectedBlockChildren = getBlockOrder( selectedBlockId );\n\n\t\t\t// Check for a single descendant in the submenu. If that block\n\t\t\t// is a link block in a \"placeholder\" state with no label then\n\t\t\t// we can consider as an \"empty\" link.\n\t\t\tif ( selectedBlockChildren?.length === 1 ) {\n\t\t\t\tconst singleBlock = getBlock( selectedBlockChildren[ 0 ] );\n\n\t\t\t\t_onlyDescendantIsEmptyLink =\n\t\t\t\t\tsingleBlock?.name === 'core/navigation-link' &&\n\t\t\t\t\t! singleBlock?.attributes?.label;\n\t\t\t}\n\n\t\t\treturn {\n\t\t\t\tparentCount: getBlockParentsByBlockName(\n\t\t\t\t\tclientId,\n\t\t\t\t\t'core/navigation-submenu'\n\t\t\t\t).length,\n\t\t\t\tisParentOfSelectedBlock: hasSelectedInnerBlock(\n\t\t\t\t\tclientId,\n\t\t\t\t\ttrue\n\t\t\t\t),\n\t\t\t\tisImmediateParentOfSelectedBlock: hasSelectedInnerBlock(\n\t\t\t\t\tclientId,\n\t\t\t\t\tfalse\n\t\t\t\t),\n\t\t\t\thasChildren: !! getBlockCount( clientId ),\n\t\t\t\tselectedBlockHasChildren: !! selectedBlockChildren?.length,\n\t\t\t\tonlyDescendantIsEmptyLink: _onlyDescendantIsEmptyLink,\n\t\t\t};\n\t\t},\n\t\t[ clientId ]\n\t);\n\n\tconst prevHasChildren = usePrevious( hasChildren );\n\n\t// Show the LinkControl on mount if the URL is empty\n\t// ( When adding a new menu item)\n\t// This can't be done in the useState call because it conflicts\n\t// with the autofocus behavior of the BlockListBlock component.\n\tuseEffect( () => {\n\t\tif ( ! openSubmenusOnClick && ! url ) {\n\t\t\tsetIsLinkOpen( true );\n\t\t}\n\t}, [] );\n\n\t/**\n\t * The hook shouldn't be necessary but due to a focus loss happening\n\t * when selecting a suggestion in the link popover, we force close on block unselection.\n\t */\n\tuseEffect( () => {\n\t\tif ( ! isSelected ) {\n\t\t\tsetIsLinkOpen( false );\n\t\t}\n\t}, [ isSelected ] );\n\n\t// If the LinkControl popover is open and the URL has changed, close the LinkControl and focus the label text.\n\tuseEffect( () => {\n\t\tif ( isLinkOpen && url ) {\n\t\t\t// Does this look like a URL and have something TLD-ish?\n\t\t\tif (\n\t\t\t\tisURL( prependHTTP( label ) ) &&\n\t\t\t\t/^.+\\.[a-z]+/.test( label )\n\t\t\t) {\n\t\t\t\t// Focus and select the label text.\n\t\t\t\tselectLabelText();\n\t\t\t}\n\t\t}\n\t}, [ url ] );\n\n\t/**\n\t * Focus the Link label text and select it.\n\t */\n\tfunction selectLabelText() {\n\t\tref.current.focus();\n\t\tconst { ownerDocument } = ref.current;\n\t\tconst { defaultView } = ownerDocument;\n\t\tconst selection = defaultView.getSelection();\n\t\tconst range = ownerDocument.createRange();\n\t\t// Get the range of the current ref contents so we can add this range to the selection.\n\t\trange.selectNodeContents( ref.current );\n\t\tselection.removeAllRanges();\n\t\tselection.addRange( range );\n\t}\n\n\tconst {\n\t\ttextColor,\n\t\tcustomTextColor,\n\t\tbackgroundColor,\n\t\tcustomBackgroundColor,\n\t} = getColors( context, parentCount > 0 );\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 we don't stop propagation, this event bubbles up to the parent submenu item\n\t\t\tevent.stopPropagation();\n\t\t\tsetIsLinkOpen( true );\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\t'open-on-click': openSubmenusOnClick,\n\t\t} ),\n\t\tstyle: {\n\t\t\tcolor: ! textColor && customTextColor,\n\t\t\tbackgroundColor: ! backgroundColor && customBackgroundColor,\n\t\t},\n\t\tonKeyDown,\n\t} );\n\n\t// Always use overlay colors for submenus.\n\tconst innerBlocksColors = getColors( context, true );\n\n\tconst allowedBlocks =\n\t\tparentCount >= maxNestingLevel\n\t\t\t? ALLOWED_BLOCKS.filter(\n\t\t\t\t\t( blockName ) => blockName !== 'core/navigation-submenu'\n\t\t\t )\n\t\t\t: ALLOWED_BLOCKS;\n\n\tconst navigationChildBlockProps =\n\t\tgetNavigationChildBlockProps( innerBlocksColors );\n\tconst innerBlocksProps = useInnerBlocksProps( navigationChildBlockProps, {\n\t\tallowedBlocks,\n\t\tdefaultBlock: DEFAULT_BLOCK,\n\t\tdirectInsert: true,\n\n\t\t// Ensure block toolbar is not too far removed from item\n\t\t// being edited.\n\t\t// see: https://github.com/WordPress/gutenberg/pull/34615.\n\t\t__experimentalCaptureToolbars: true,\n\n\t\trenderAppender:\n\t\t\tisSelected ||\n\t\t\t( isImmediateParentOfSelectedBlock &&\n\t\t\t\t! selectedBlockHasChildren ) ||\n\t\t\t// Show the appender while dragging to allow inserting element between item and the appender.\n\t\t\thasChildren\n\t\t\t\t? InnerBlocks.ButtonBlockAppender\n\t\t\t\t: false,\n\t} );\n\n\tconst ParentElement = openSubmenusOnClick ? 'button' : 'a';\n\n\tfunction transformToLink() {\n\t\tconst newLinkBlock = createBlock( 'core/navigation-link', attributes );\n\t\treplaceBlock( clientId, newLinkBlock );\n\t}\n\n\tuseEffect( () => {\n\t\t// If block becomes empty, transform to Navigation Link.\n\t\tif ( ! hasChildren && prevHasChildren ) {\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\ttransformToLink();\n\t\t}\n\t}, [ hasChildren, prevHasChildren ] );\n\n\tconst canConvertToLink =\n\t\t! selectedBlockHasChildren || onlyDescendantIsEmptyLink;\n\n\treturn (\n\t\t<>\n\t\t\t<BlockControls>\n\t\t\t\t<ToolbarGroup>\n\t\t\t\t\t{ ! openSubmenusOnClick && (\n\t\t\t\t\t\t<ToolbarButton\n\t\t\t\t\t\t\tname=\"link\"\n\t\t\t\t\t\t\ticon={ linkIcon }\n\t\t\t\t\t\t\ttitle={ __( 'Link' ) }\n\t\t\t\t\t\t\tshortcut={ displayShortcut.primary( 'k' ) }\n\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\tsetIsLinkOpen( true );\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\n\t\t\t\t\t<ToolbarButton\n\t\t\t\t\t\tname=\"revert\"\n\t\t\t\t\t\ticon={ removeSubmenu }\n\t\t\t\t\t\ttitle={ __( 'Convert to Link' ) }\n\t\t\t\t\t\tonClick={ transformToLink }\n\t\t\t\t\t\tclassName=\"wp-block-navigation__submenu__revert\"\n\t\t\t\t\t\tdisabled={ ! canConvertToLink }\n\t\t\t\t\t/>\n\t\t\t\t</ToolbarGroup>\n\t\t\t</BlockControls>\n\t\t\t<InspectorControls>\n\t\t\t\t<Controls\n\t\t\t\t\tattributes={ attributes }\n\t\t\t\t\tsetAttributes={ setAttributes }\n\t\t\t\t\tclientId={ clientId }\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<ParentElement className=\"wp-block-navigation-item__content\">\n\t\t\t\t\t{ /* eslint-enable */ }\n\t\t\t\t\t<RichText\n\t\t\t\t\t\tref={ ref }\n\t\t\t\t\t\tidentifier=\"label\"\n\t\t\t\t\t\tclassName=\"wp-block-navigation-item__label\"\n\t\t\t\t\t\tvalue={ label }\n\t\t\t\t\t\tonChange={ ( labelValue ) =>\n\t\t\t\t\t\t\tsetAttributes( { label: labelValue } )\n\t\t\t\t\t\t}\n\t\t\t\t\t\tonMerge={ mergeBlocks }\n\t\t\t\t\t\tonReplace={ onReplace }\n\t\t\t\t\t\taria-label={ __( 'Navigation link text' ) }\n\t\t\t\t\t\tplaceholder={ itemLabelPlaceholder }\n\t\t\t\t\t\twithoutInteractiveFormatting\n\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\tif ( ! openSubmenusOnClick && ! url ) {\n\t\t\t\t\t\t\t\tsetIsLinkOpen( true );\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{ description && (\n\t\t\t\t\t\t<span className=\"wp-block-navigation-item__description\">\n\t\t\t\t\t\t\t{ description }\n\t\t\t\t\t\t</span>\n\t\t\t\t\t) }\n\t\t\t\t\t{ ! openSubmenusOnClick && isLinkOpen && (\n\t\t\t\t\t\t<LinkUI\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\tsetIsLinkOpen( false );\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={ () => {\n\t\t\t\t\t\t\t\tsetAttributes( { url: '' } );\n\t\t\t\t\t\t\t\tspeak( __( 'Link removed.' ), 'assertive' );\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\tonChange={ ( updatedValue ) => {\n\t\t\t\t\t\t\t\t// updateAttributes determines the final state and returns metadata\n\t\t\t\t\t\t\t\tconst {\n\t\t\t\t\t\t\t\t\tisEntityLink,\n\t\t\t\t\t\t\t\t\tattributes: updatedAttributes,\n\t\t\t\t\t\t\t\t} = updateAttributes(\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\n\t\t\t\t\t\t\t\t// Handle URL binding based on the final computed state\n\t\t\t\t\t\t\t\t// Only create bindings for entity links (posts, pages, taxonomies)\n\t\t\t\t\t\t\t\t// Never create bindings for custom links (manual URLs)\n\t\t\t\t\t\t\t\tif ( isEntityLink ) {\n\t\t\t\t\t\t\t\t\tcreateBinding( updatedAttributes );\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\tclearBinding( updatedAttributes );\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</ParentElement>\n\t\t\t\t{ ( showSubmenuIcon || openSubmenusOnClick ) && (\n\t\t\t\t\t<span className=\"wp-block-navigation__submenu-icon\">\n\t\t\t\t\t\t<ItemSubmenuIcon />\n\t\t\t\t\t</span>\n\t\t\t\t) }\n\t\t\t\t<div { ...innerBlocksProps } />\n\t\t\t</div>\n\t\t</>\n\t);\n}\n"],
|
|
5
|
-
"mappings": "AAwWE,mBAII,KAFF,YAFF;AArWF,OAAO,UAAU;AAKjB,SAAS,WAAW,mBAAmB;AACvC,SAAS,eAAe,oBAAoB;AAC5C,SAAS,iBAAiB,uBAAuB;AACjD,SAAS,UAAU;AACnB;AAAA,EACC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,SAAS;AAAA,EACT;AAAA,OACM;AACP,SAAS,OAAO,mBAAmB;AACnC,SAAS,UAAU,WAAW,cAAc;AAC5C,SAAS,QAAQ,UAAU,qBAAqB;AAChD,SAAS,aAAa;AACtB,SAAS,mBAAmB;AAC5B,SAAS,cAAc,mBAAmB;AAK1C,SAAS,uBAAuB;AAChC;AAAA,EACC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACM;AACP;AAAA,EACC;AAAA,EACA;AAAA,OACM;AACP,SAAS,qBAAqB;AAE9B,MAAM,iBAAiB;AAAA,EACtB;AAAA,EACA;AAAA,EACA;AACD;AAWA,MAAM,sBAAsB,CAAE,eA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U,qCAExB;AAAA;AAAA,UAAC;AAAA;AAAA,YACA;AAAA,YACA,YAAW;AAAA,YACX,WAAU;AAAA,YACV,OAAQ;AAAA,YACR,UAAW,CAAE,eACZ,cAAe,EAAE,OAAO,WAAW,CAAE;AAAA,YAEtC,SAAU;AAAA,YACV;AAAA,YACA,cAAa,GAAI,sBAAuB;AAAA,YACxC,aAAc;AAAA,YACd,8BAA4B;AAAA,YAC5B,SAAU,MAAM;AACf,kBAAK,CAAE,uBAAuB,CAAE,KAAM;AACrC,8BAAe,IAAK;AAAA,cACrB;AAAA,YACD;AAAA;AAAA,QACD;AAAA,QACE,eACD,oBAAC,UAAK,WAAU,yCACb,uBACH;AAAA,QAEC,CAAE,uBAAuB,cAC1B;AAAA,UAAC;AAAA;AAAA,YACA;AAAA,YACA,MAAO;AAAA,YACP,SAAU,MAAM;AACf,4BAAe,KAAM;AAAA,YACtB;AAAA,YACA,QAAS;AAAA,YACT,UAAW,MAAM;AAChB,4BAAe,EAAE,KAAK,GAAG,CAAE;AAC3B,oBAAO,GAAI,eAAgB,GAAG,WAAY;AAAA,YAC3C;AAAA,YACA,UAAW,CAAE,iBAAkB;AAE9B,oBAAM;AAAA,gBACL;AAAA,gBACA,YAAY;AAAA,cACb,IAAI;AAAA,gBACH;AAAA,gBACA;AAAA,gBACA;AAAA,cACD;AAKA,kBAAK,cAAe;AACnB,8BAAe,iBAAkB;AAAA,cAClC,OAAO;AACN,
|
|
4
|
+
"sourcesContent": ["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\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\tInnerBlocks,\n\tuseInnerBlocksProps,\n\tInspectorControls,\n\tRichText,\n\tuseBlockProps,\n\tuseBlockEditingMode,\n\tstore as blockEditorStore,\n\tgetColorClassName,\n} from '@wordpress/block-editor';\nimport { isURL, prependHTTP } from '@wordpress/url';\nimport { useState, useEffect, useRef } from '@wordpress/element';\nimport { link as linkIcon, removeSubmenu } from '@wordpress/icons';\nimport { speak } from '@wordpress/a11y';\nimport { createBlock } from '@wordpress/blocks';\nimport { useMergeRefs, usePrevious } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport { ItemSubmenuIcon } from './icons';\nimport {\n\tControls,\n\tLinkUI,\n\tupdateAttributes,\n\tuseEntityBinding,\n} from '../navigation-link/shared';\nimport {\n\tgetColors,\n\tgetNavigationChildBlockProps,\n} from '../navigation/edit/utils';\nimport { DEFAULT_BLOCK } from '../navigation/constants';\n\nconst ALLOWED_BLOCKS = [\n\t'core/navigation-link',\n\t'core/navigation-submenu',\n\t'core/page-list',\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}, [] );\n\n\treturn isDraggingWithin;\n};\n\n/**\n * @typedef {'post-type'|'custom'|'taxonomy'|'post-type-archive'} WPNavigationLinkKind\n */\n\n/**\n * Navigation Link Block Attributes\n *\n * @typedef {Object} WPNavigationLinkBlockAttributes\n *\n * @property {string} [label] Link text.\n * @property {WPNavigationLinkKind} [kind] Kind is used to differentiate between term and post ids to check post draft status.\n * @property {string} [type] The type such as post, page, tag, category and other custom types.\n * @property {string} [rel] The relationship of the linked URL.\n * @property {number} [id] A post or term id.\n * @property {boolean} [opensInNewTab] Sets link target to _blank when true.\n * @property {string} [url] Link href.\n */\n\nexport default function NavigationSubmenuEdit( {\n\tattributes,\n\tisSelected,\n\tsetAttributes,\n\tmergeBlocks,\n\tonReplace,\n\tcontext,\n\tclientId,\n} ) {\n\tconst { label, url, description } = attributes;\n\n\tconst {\n\t\tshowSubmenuIcon,\n\t\tmaxNestingLevel,\n\t\topenSubmenusOnClick: contextOpenSubmenusOnClick,\n\t} = context;\n\tconst blockEditingMode = useBlockEditingMode();\n\n\t// Force click-only behavior in contentOnly mode to prevent hover dropdowns\n\tconst openSubmenusOnClick =\n\t\tblockEditingMode !== 'default' ? true : contextOpenSubmenusOnClick;\n\n\t// URL binding logic\n\tconst { clearBinding, createBinding } = useEntityBinding( {\n\t\tclientId,\n\t\tattributes,\n\t} );\n\n\tconst { __unstableMarkNextChangeAsNotPersistent, replaceBlock } =\n\t\tuseDispatch( blockEditorStore );\n\tconst [ isLinkOpen, setIsLinkOpen ] = useState( false );\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 text\u2026' );\n\tconst ref = useRef();\n\n\tconst {\n\t\tparentCount,\n\t\tisParentOfSelectedBlock,\n\t\tisImmediateParentOfSelectedBlock,\n\t\thasChildren,\n\t\tselectedBlockHasChildren,\n\t\tonlyDescendantIsEmptyLink,\n\t} = useSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\thasSelectedInnerBlock,\n\t\t\t\tgetSelectedBlockClientId,\n\t\t\t\tgetBlockParentsByBlockName,\n\t\t\t\tgetBlock,\n\t\t\t\tgetBlockCount,\n\t\t\t\tgetBlockOrder,\n\t\t\t} = select( blockEditorStore );\n\n\t\t\tlet _onlyDescendantIsEmptyLink;\n\n\t\t\tconst selectedBlockId = getSelectedBlockClientId();\n\n\t\t\tconst selectedBlockChildren = getBlockOrder( selectedBlockId );\n\n\t\t\t// Check for a single descendant in the submenu. If that block\n\t\t\t// is a link block in a \"placeholder\" state with no label then\n\t\t\t// we can consider as an \"empty\" link.\n\t\t\tif ( selectedBlockChildren?.length === 1 ) {\n\t\t\t\tconst singleBlock = getBlock( selectedBlockChildren[ 0 ] );\n\n\t\t\t\t_onlyDescendantIsEmptyLink =\n\t\t\t\t\tsingleBlock?.name === 'core/navigation-link' &&\n\t\t\t\t\t! singleBlock?.attributes?.label;\n\t\t\t}\n\n\t\t\treturn {\n\t\t\t\tparentCount: getBlockParentsByBlockName(\n\t\t\t\t\tclientId,\n\t\t\t\t\t'core/navigation-submenu'\n\t\t\t\t).length,\n\t\t\t\tisParentOfSelectedBlock: hasSelectedInnerBlock(\n\t\t\t\t\tclientId,\n\t\t\t\t\ttrue\n\t\t\t\t),\n\t\t\t\tisImmediateParentOfSelectedBlock: hasSelectedInnerBlock(\n\t\t\t\t\tclientId,\n\t\t\t\t\tfalse\n\t\t\t\t),\n\t\t\t\thasChildren: !! getBlockCount( clientId ),\n\t\t\t\tselectedBlockHasChildren: !! selectedBlockChildren?.length,\n\t\t\t\tonlyDescendantIsEmptyLink: _onlyDescendantIsEmptyLink,\n\t\t\t};\n\t\t},\n\t\t[ clientId ]\n\t);\n\n\tconst prevHasChildren = usePrevious( hasChildren );\n\n\t// Show the LinkControl on mount if the URL is empty\n\t// ( When adding a new menu item)\n\t// This can't be done in the useState call because it conflicts\n\t// with the autofocus behavior of the BlockListBlock component.\n\tuseEffect( () => {\n\t\tif ( ! openSubmenusOnClick && ! url ) {\n\t\t\tsetIsLinkOpen( true );\n\t\t}\n\t}, [] );\n\n\t/**\n\t * The hook shouldn't be necessary but due to a focus loss happening\n\t * when selecting a suggestion in the link popover, we force close on block unselection.\n\t */\n\tuseEffect( () => {\n\t\tif ( ! isSelected ) {\n\t\t\tsetIsLinkOpen( false );\n\t\t}\n\t}, [ isSelected ] );\n\n\t// If the LinkControl popover is open and the URL has changed, close the LinkControl and focus the label text.\n\tuseEffect( () => {\n\t\tif ( isLinkOpen && url ) {\n\t\t\t// Does this look like a URL and have something TLD-ish?\n\t\t\tif (\n\t\t\t\tisURL( prependHTTP( label ) ) &&\n\t\t\t\t/^.+\\.[a-z]+/.test( label )\n\t\t\t) {\n\t\t\t\t// Focus and select the label text.\n\t\t\t\tselectLabelText();\n\t\t\t}\n\t\t}\n\t}, [ url ] );\n\n\t/**\n\t * Focus the Link label text and select it.\n\t */\n\tfunction selectLabelText() {\n\t\tref.current.focus();\n\t\tconst { ownerDocument } = ref.current;\n\t\tconst { defaultView } = ownerDocument;\n\t\tconst selection = defaultView.getSelection();\n\t\tconst range = ownerDocument.createRange();\n\t\t// Get the range of the current ref contents so we can add this range to the selection.\n\t\trange.selectNodeContents( ref.current );\n\t\tselection.removeAllRanges();\n\t\tselection.addRange( range );\n\t}\n\n\tconst {\n\t\ttextColor,\n\t\tcustomTextColor,\n\t\tbackgroundColor,\n\t\tcustomBackgroundColor,\n\t} = getColors( context, parentCount > 0 );\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 we don't stop propagation, this event bubbles up to the parent submenu item\n\t\t\tevent.stopPropagation();\n\t\t\tsetIsLinkOpen( true );\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\t'open-on-click': openSubmenusOnClick,\n\t\t} ),\n\t\tstyle: {\n\t\t\tcolor: ! textColor && customTextColor,\n\t\t\tbackgroundColor: ! backgroundColor && customBackgroundColor,\n\t\t},\n\t\tonKeyDown,\n\t} );\n\n\t// Always use overlay colors for submenus.\n\tconst innerBlocksColors = getColors( context, true );\n\n\tconst allowedBlocks =\n\t\tparentCount >= maxNestingLevel\n\t\t\t? ALLOWED_BLOCKS.filter(\n\t\t\t\t\t( blockName ) => blockName !== 'core/navigation-submenu'\n\t\t\t )\n\t\t\t: ALLOWED_BLOCKS;\n\n\tconst navigationChildBlockProps =\n\t\tgetNavigationChildBlockProps( innerBlocksColors );\n\tconst innerBlocksProps = useInnerBlocksProps( navigationChildBlockProps, {\n\t\tallowedBlocks,\n\t\tdefaultBlock: DEFAULT_BLOCK,\n\t\tdirectInsert: true,\n\n\t\t// Ensure block toolbar is not too far removed from item\n\t\t// being edited.\n\t\t// see: https://github.com/WordPress/gutenberg/pull/34615.\n\t\t__experimentalCaptureToolbars: true,\n\n\t\trenderAppender:\n\t\t\tisSelected ||\n\t\t\t( isImmediateParentOfSelectedBlock &&\n\t\t\t\t! selectedBlockHasChildren ) ||\n\t\t\t// Show the appender while dragging to allow inserting element between item and the appender.\n\t\t\thasChildren\n\t\t\t\t? InnerBlocks.ButtonBlockAppender\n\t\t\t\t: false,\n\t} );\n\n\tconst ParentElement = openSubmenusOnClick ? 'button' : 'a';\n\n\tfunction transformToLink() {\n\t\tconst newLinkBlock = createBlock( 'core/navigation-link', attributes );\n\t\treplaceBlock( clientId, newLinkBlock );\n\t}\n\n\tuseEffect( () => {\n\t\t// If block becomes empty, transform to Navigation Link.\n\t\tif ( ! hasChildren && prevHasChildren ) {\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\ttransformToLink();\n\t\t}\n\t}, [ hasChildren, prevHasChildren ] );\n\n\tconst canConvertToLink =\n\t\t! selectedBlockHasChildren || onlyDescendantIsEmptyLink;\n\n\treturn (\n\t\t<>\n\t\t\t<BlockControls>\n\t\t\t\t<ToolbarGroup>\n\t\t\t\t\t{ ! openSubmenusOnClick && (\n\t\t\t\t\t\t<ToolbarButton\n\t\t\t\t\t\t\tname=\"link\"\n\t\t\t\t\t\t\ticon={ linkIcon }\n\t\t\t\t\t\t\ttitle={ __( 'Link' ) }\n\t\t\t\t\t\t\tshortcut={ displayShortcut.primary( 'k' ) }\n\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\tsetIsLinkOpen( true );\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\n\t\t\t\t\t<ToolbarButton\n\t\t\t\t\t\tname=\"revert\"\n\t\t\t\t\t\ticon={ removeSubmenu }\n\t\t\t\t\t\ttitle={ __( 'Convert to Link' ) }\n\t\t\t\t\t\tonClick={ transformToLink }\n\t\t\t\t\t\tclassName=\"wp-block-navigation__submenu__revert\"\n\t\t\t\t\t\tdisabled={ ! canConvertToLink }\n\t\t\t\t\t/>\n\t\t\t\t</ToolbarGroup>\n\t\t\t</BlockControls>\n\t\t\t<InspectorControls>\n\t\t\t\t<Controls\n\t\t\t\t\tattributes={ attributes }\n\t\t\t\t\tsetAttributes={ setAttributes }\n\t\t\t\t\tclientId={ clientId }\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<ParentElement className=\"wp-block-navigation-item__content\">\n\t\t\t\t\t{ /* eslint-enable */ }\n\t\t\t\t\t<RichText\n\t\t\t\t\t\tref={ ref }\n\t\t\t\t\t\tidentifier=\"label\"\n\t\t\t\t\t\tclassName=\"wp-block-navigation-item__label\"\n\t\t\t\t\t\tvalue={ label }\n\t\t\t\t\t\tonChange={ ( labelValue ) =>\n\t\t\t\t\t\t\tsetAttributes( { label: labelValue } )\n\t\t\t\t\t\t}\n\t\t\t\t\t\tonMerge={ mergeBlocks }\n\t\t\t\t\t\tonReplace={ onReplace }\n\t\t\t\t\t\taria-label={ __( 'Navigation link text' ) }\n\t\t\t\t\t\tplaceholder={ itemLabelPlaceholder }\n\t\t\t\t\t\twithoutInteractiveFormatting\n\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\tif ( ! openSubmenusOnClick && ! url ) {\n\t\t\t\t\t\t\t\tsetIsLinkOpen( true );\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{ description && (\n\t\t\t\t\t\t<span className=\"wp-block-navigation-item__description\">\n\t\t\t\t\t\t\t{ description }\n\t\t\t\t\t\t</span>\n\t\t\t\t\t) }\n\t\t\t\t\t{ ! openSubmenusOnClick && isLinkOpen && (\n\t\t\t\t\t\t<LinkUI\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\tsetIsLinkOpen( false );\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={ () => {\n\t\t\t\t\t\t\t\tsetAttributes( { url: '' } );\n\t\t\t\t\t\t\t\tspeak( __( 'Link removed.' ), 'assertive' );\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\tonChange={ ( updatedValue ) => {\n\t\t\t\t\t\t\t\t// updateAttributes determines the final state and returns metadata\n\t\t\t\t\t\t\t\tconst {\n\t\t\t\t\t\t\t\t\tisEntityLink,\n\t\t\t\t\t\t\t\t\tattributes: updatedAttributes,\n\t\t\t\t\t\t\t\t} = updateAttributes(\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\n\t\t\t\t\t\t\t\t// Handle URL binding based on the final computed state\n\t\t\t\t\t\t\t\t// Only create bindings for entity links (posts, pages, taxonomies)\n\t\t\t\t\t\t\t\t// Never create bindings for custom links (manual URLs)\n\t\t\t\t\t\t\t\tif ( isEntityLink ) {\n\t\t\t\t\t\t\t\t\tcreateBinding( updatedAttributes );\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\tclearBinding();\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</ParentElement>\n\t\t\t\t{ ( showSubmenuIcon || openSubmenusOnClick ) && (\n\t\t\t\t\t<span className=\"wp-block-navigation__submenu-icon\">\n\t\t\t\t\t\t<ItemSubmenuIcon />\n\t\t\t\t\t</span>\n\t\t\t\t) }\n\t\t\t\t<div { ...innerBlocksProps } />\n\t\t\t</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e,KAAM;AAAA,YACtB;AAAA,YACA,QAAS;AAAA,YACT,UAAW,MAAM;AAChB,4BAAe,EAAE,KAAK,GAAG,CAAE;AAC3B,oBAAO,GAAI,eAAgB,GAAG,WAAY;AAAA,YAC3C;AAAA,YACA,UAAW,CAAE,iBAAkB;AAE9B,oBAAM;AAAA,gBACL;AAAA,gBACA,YAAY;AAAA,cACb,IAAI;AAAA,gBACH;AAAA,gBACA;AAAA,gBACA;AAAA,cACD;AAKA,kBAAK,cAAe;AACnB,8BAAe,iBAAkB;AAAA,cAClC,OAAO;AACN,6BAAa;AAAA,cACd;AAAA,YACD;AAAA;AAAA,QACD;AAAA,SAEF;AAAA,OACI,mBAAmB,wBACtB,oBAAC,UAAK,WAAU,qCACf,8BAAC,mBAAgB,GAClB;AAAA,MAED,oBAAC,SAAM,GAAG,kBAAmB;AAAA,OAC9B;AAAA,KACD;AAEF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -93,7 +93,7 @@ const v3 = {
|
|
|
93
93
|
};
|
|
94
94
|
},
|
|
95
95
|
isEligible(attributes) {
|
|
96
|
-
return !!attributes?.metadata?.bindings?.datetime?.args?.key;
|
|
96
|
+
return attributes?.metadata?.bindings?.datetime?.source === "core/post-data" && !!attributes?.metadata?.bindings?.datetime?.args?.key;
|
|
97
97
|
}
|
|
98
98
|
};
|
|
99
99
|
const v2 = {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/post-date/deprecated.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * Internal dependencies\n */\nimport migrateFontFamily from '../utils/migrate-font-family';\n\nconst v3 = {\n\tattributes: {\n\t\tdatetime: {\n\t\t\ttype: 'string',\n\t\t\trole: 'content',\n\t\t},\n\t\ttextAlign: {\n\t\t\ttype: 'string',\n\t\t},\n\t\tformat: {\n\t\t\ttype: 'string',\n\t\t},\n\t\tisLink: {\n\t\t\ttype: 'boolean',\n\t\t\tdefault: false,\n\t\t\trole: 'content',\n\t\t},\n\t},\n\tsupports: {\n\t\thtml: false,\n\t\tcolor: {\n\t\t\tgradients: true,\n\t\t\tlink: true,\n\t\t\t__experimentalDefaultControls: {\n\t\t\t\tbackground: true,\n\t\t\t\ttext: true,\n\t\t\t\tlink: true,\n\t\t\t},\n\t\t},\n\t\tspacing: {\n\t\t\tmargin: true,\n\t\t\tpadding: true,\n\t\t},\n\t\ttypography: {\n\t\t\tfontSize: true,\n\t\t\tlineHeight: true,\n\t\t\t__experimentalFontFamily: true,\n\t\t\t__experimentalFontWeight: true,\n\t\t\t__experimentalFontStyle: true,\n\t\t\t__experimentalTextTransform: true,\n\t\t\t__experimentalTextDecoration: true,\n\t\t\t__experimentalLetterSpacing: true,\n\t\t\t__experimentalDefaultControls: {\n\t\t\t\tfontSize: true,\n\t\t\t},\n\t\t},\n\t\tinteractivity: {\n\t\t\tclientNavigation: true,\n\t\t},\n\t\t__experimentalBorder: {\n\t\t\tradius: true,\n\t\t\tcolor: true,\n\t\t\twidth: true,\n\t\t\tstyle: true,\n\t\t\t__experimentalDefaultControls: {\n\t\t\t\tradius: true,\n\t\t\t\tcolor: true,\n\t\t\t\twidth: true,\n\t\t\t\tstyle: true,\n\t\t\t},\n\t\t},\n\t},\n\tsave() {\n\t\treturn null;\n\t},\n\tmigrate( {\n\t\tmetadata: {\n\t\t\tbindings: {\n\t\t\t\tdatetime: {\n\t\t\t\t\tsource,\n\t\t\t\t\targs: { key, ...otherArgs },\n\t\t\t\t},\n\t\t\t\t...otherBindings\n\t\t\t},\n\t\t\t...otherMetadata\n\t\t},\n\t\t...otherAttributes\n\t} ) {\n\t\t// Change the block bindings source argument name from \"key\" to \"field\".\n\t\treturn {\n\t\t\tmetadata: {\n\t\t\t\tbindings: {\n\t\t\t\t\tdatetime: {\n\t\t\t\t\t\tsource,\n\t\t\t\t\t\targs: { field: key, ...otherArgs },\n\t\t\t\t\t},\n\t\t\t\t\t...otherBindings,\n\t\t\t\t},\n\t\t\t\t...otherMetadata,\n\t\t\t},\n\t\t\t...otherAttributes,\n\t\t};\n\t},\n\tisEligible( attributes ) {\n\t\treturn !! attributes?.metadata?.bindings?.datetime?.args?.key;\n\t},\n};\n\nconst v2 = {\n\tattributes: {\n\t\ttextAlign: {\n\t\t\ttype: 'string',\n\t\t},\n\t\tformat: {\n\t\t\ttype: 'string',\n\t\t},\n\t\tisLink: {\n\t\t\ttype: 'boolean',\n\t\t\tdefault: false,\n\t\t\trole: 'content',\n\t\t},\n\t\tdisplayType: {\n\t\t\ttype: 'string',\n\t\t\tdefault: 'date',\n\t\t},\n\t},\n\tsupports: {\n\t\thtml: false,\n\t\tcolor: {\n\t\t\tgradients: true,\n\t\t\tlink: true,\n\t\t\t__experimentalDefaultControls: {\n\t\t\t\tbackground: true,\n\t\t\t\ttext: true,\n\t\t\t\tlink: true,\n\t\t\t},\n\t\t},\n\t\tspacing: {\n\t\t\tmargin: true,\n\t\t\tpadding: true,\n\t\t},\n\t\ttypography: {\n\t\t\tfontSize: true,\n\t\t\tlineHeight: true,\n\t\t\t__experimentalFontFamily: true,\n\t\t\t__experimentalFontWeight: true,\n\t\t\t__experimentalFontStyle: true,\n\t\t\t__experimentalTextTransform: true,\n\t\t\t__experimentalTextDecoration: true,\n\t\t\t__experimentalLetterSpacing: true,\n\t\t\t__experimentalDefaultControls: {\n\t\t\t\tfontSize: true,\n\t\t\t},\n\t\t},\n\t\tinteractivity: {\n\t\t\tclientNavigation: true,\n\t\t},\n\t\t__experimentalBorder: {\n\t\t\tradius: true,\n\t\t\tcolor: true,\n\t\t\twidth: true,\n\t\t\tstyle: true,\n\t\t\t__experimentalDefaultControls: {\n\t\t\t\tradius: true,\n\t\t\t\tcolor: true,\n\t\t\t\twidth: true,\n\t\t\t\tstyle: true,\n\t\t\t},\n\t\t},\n\t},\n\tsave() {\n\t\treturn null;\n\t},\n\tmigrate( { className, displayType, metadata, ...otherAttributes } ) {\n\t\tif ( displayType === 'date' || displayType === 'modified' ) {\n\t\t\tif ( displayType === 'modified' ) {\n\t\t\t\tclassName = clsx(\n\t\t\t\t\tclassName,\n\t\t\t\t\t'wp-block-post-date__modified-date'\n\t\t\t\t);\n\t\t\t}\n\n\t\t\treturn {\n\t\t\t\t...otherAttributes,\n\t\t\t\tclassName,\n\t\t\t\tmetadata: {\n\t\t\t\t\t...metadata,\n\t\t\t\t\tbindings: {\n\t\t\t\t\t\tdatetime: {\n\t\t\t\t\t\t\tsource: 'core/post-data',\n\t\t\t\t\t\t\targs: { field: displayType },\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t};\n\t\t}\n\t},\n\tisEligible( attributes ) {\n\t\t// If there's neither an explicit `datetime` attribute nor a block binding for that attribute,\n\t\t// then we're dealing with an old version of the block.\n\t\treturn (\n\t\t\t! attributes.datetime && ! attributes?.metadata?.bindings?.datetime\n\t\t);\n\t},\n};\n\nconst v1 = {\n\tattributes: {\n\t\ttextAlign: {\n\t\t\ttype: 'string',\n\t\t},\n\t\tformat: {\n\t\t\ttype: 'string',\n\t\t},\n\t\tisLink: {\n\t\t\ttype: 'boolean',\n\t\t\tdefault: false,\n\t\t},\n\t},\n\tsupports: {\n\t\thtml: false,\n\t\tcolor: {\n\t\t\tgradients: true,\n\t\t\tlink: true,\n\t\t},\n\t\ttypography: {\n\t\t\tfontSize: true,\n\t\t\tlineHeight: true,\n\t\t\t__experimentalFontFamily: true,\n\t\t\t__experimentalFontWeight: true,\n\t\t\t__experimentalFontStyle: true,\n\t\t\t__experimentalTextTransform: true,\n\t\t\t__experimentalLetterSpacing: true,\n\t\t},\n\t},\n\tsave() {\n\t\treturn null;\n\t},\n\tmigrate: migrateFontFamily,\n\tisEligible( { style } ) {\n\t\treturn style?.typography?.fontFamily;\n\t},\n};\n\n/**\n * New deprecations need to be placed first\n * for them to have higher priority.\n *\n * Old deprecations may need to be updated as well.\n *\n * See block-deprecation.md\n */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A,MAAM,EAAE,KAAK,GAAG,UAAU;AAAA,QAC3B;AAAA,QACA,GAAG;AAAA,MACJ;AAAA,MACA,GAAG;AAAA,IACJ;AAAA,IACA,GAAG;AAAA,EACJ,GAAI;AAEH,WAAO;AAAA,MACN,UAAU;AAAA,QACT,UAAU;AAAA,UACT,UAAU;AAAA,YACT;AAAA,YACA,MAAM,EAAE,OAAO,KAAK,GAAG,UAAU;AAAA,UAClC;AAAA,UACA,GAAG;AAAA,QACJ;AAAA,QACA,GAAG;AAAA,MACJ;AAAA,MACA,GAAG;AAAA,IACJ;AAAA,EACD;AAAA,EACA,WAAY,YAAa;AACxB,
|
|
4
|
+
"sourcesContent": ["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * Internal dependencies\n */\nimport migrateFontFamily from '../utils/migrate-font-family';\n\nconst v3 = {\n\tattributes: {\n\t\tdatetime: {\n\t\t\ttype: 'string',\n\t\t\trole: 'content',\n\t\t},\n\t\ttextAlign: {\n\t\t\ttype: 'string',\n\t\t},\n\t\tformat: {\n\t\t\ttype: 'string',\n\t\t},\n\t\tisLink: {\n\t\t\ttype: 'boolean',\n\t\t\tdefault: false,\n\t\t\trole: 'content',\n\t\t},\n\t},\n\tsupports: {\n\t\thtml: false,\n\t\tcolor: {\n\t\t\tgradients: true,\n\t\t\tlink: true,\n\t\t\t__experimentalDefaultControls: {\n\t\t\t\tbackground: true,\n\t\t\t\ttext: true,\n\t\t\t\tlink: true,\n\t\t\t},\n\t\t},\n\t\tspacing: {\n\t\t\tmargin: true,\n\t\t\tpadding: true,\n\t\t},\n\t\ttypography: {\n\t\t\tfontSize: true,\n\t\t\tlineHeight: true,\n\t\t\t__experimentalFontFamily: true,\n\t\t\t__experimentalFontWeight: true,\n\t\t\t__experimentalFontStyle: true,\n\t\t\t__experimentalTextTransform: true,\n\t\t\t__experimentalTextDecoration: true,\n\t\t\t__experimentalLetterSpacing: true,\n\t\t\t__experimentalDefaultControls: {\n\t\t\t\tfontSize: true,\n\t\t\t},\n\t\t},\n\t\tinteractivity: {\n\t\t\tclientNavigation: true,\n\t\t},\n\t\t__experimentalBorder: {\n\t\t\tradius: true,\n\t\t\tcolor: true,\n\t\t\twidth: true,\n\t\t\tstyle: true,\n\t\t\t__experimentalDefaultControls: {\n\t\t\t\tradius: true,\n\t\t\t\tcolor: true,\n\t\t\t\twidth: true,\n\t\t\t\tstyle: true,\n\t\t\t},\n\t\t},\n\t},\n\tsave() {\n\t\treturn null;\n\t},\n\tmigrate( {\n\t\tmetadata: {\n\t\t\tbindings: {\n\t\t\t\tdatetime: {\n\t\t\t\t\tsource,\n\t\t\t\t\targs: { key, ...otherArgs },\n\t\t\t\t},\n\t\t\t\t...otherBindings\n\t\t\t},\n\t\t\t...otherMetadata\n\t\t},\n\t\t...otherAttributes\n\t} ) {\n\t\t// Change the block bindings source argument name from \"key\" to \"field\".\n\t\treturn {\n\t\t\tmetadata: {\n\t\t\t\tbindings: {\n\t\t\t\t\tdatetime: {\n\t\t\t\t\t\tsource,\n\t\t\t\t\t\targs: { field: key, ...otherArgs },\n\t\t\t\t\t},\n\t\t\t\t\t...otherBindings,\n\t\t\t\t},\n\t\t\t\t...otherMetadata,\n\t\t\t},\n\t\t\t...otherAttributes,\n\t\t};\n\t},\n\tisEligible( attributes ) {\n\t\treturn (\n\t\t\tattributes?.metadata?.bindings?.datetime?.source ===\n\t\t\t\t'core/post-data' &&\n\t\t\t!! attributes?.metadata?.bindings?.datetime?.args?.key\n\t\t);\n\t},\n};\n\nconst v2 = {\n\tattributes: {\n\t\ttextAlign: {\n\t\t\ttype: 'string',\n\t\t},\n\t\tformat: {\n\t\t\ttype: 'string',\n\t\t},\n\t\tisLink: {\n\t\t\ttype: 'boolean',\n\t\t\tdefault: false,\n\t\t\trole: 'content',\n\t\t},\n\t\tdisplayType: {\n\t\t\ttype: 'string',\n\t\t\tdefault: 'date',\n\t\t},\n\t},\n\tsupports: {\n\t\thtml: false,\n\t\tcolor: {\n\t\t\tgradients: true,\n\t\t\tlink: true,\n\t\t\t__experimentalDefaultControls: {\n\t\t\t\tbackground: true,\n\t\t\t\ttext: true,\n\t\t\t\tlink: true,\n\t\t\t},\n\t\t},\n\t\tspacing: {\n\t\t\tmargin: true,\n\t\t\tpadding: true,\n\t\t},\n\t\ttypography: {\n\t\t\tfontSize: true,\n\t\t\tlineHeight: true,\n\t\t\t__experimentalFontFamily: true,\n\t\t\t__experimentalFontWeight: true,\n\t\t\t__experimentalFontStyle: true,\n\t\t\t__experimentalTextTransform: true,\n\t\t\t__experimentalTextDecoration: true,\n\t\t\t__experimentalLetterSpacing: true,\n\t\t\t__experimentalDefaultControls: {\n\t\t\t\tfontSize: true,\n\t\t\t},\n\t\t},\n\t\tinteractivity: {\n\t\t\tclientNavigation: true,\n\t\t},\n\t\t__experimentalBorder: {\n\t\t\tradius: true,\n\t\t\tcolor: true,\n\t\t\twidth: true,\n\t\t\tstyle: true,\n\t\t\t__experimentalDefaultControls: {\n\t\t\t\tradius: true,\n\t\t\t\tcolor: true,\n\t\t\t\twidth: true,\n\t\t\t\tstyle: true,\n\t\t\t},\n\t\t},\n\t},\n\tsave() {\n\t\treturn null;\n\t},\n\tmigrate( { className, displayType, metadata, ...otherAttributes } ) {\n\t\tif ( displayType === 'date' || displayType === 'modified' ) {\n\t\t\tif ( displayType === 'modified' ) {\n\t\t\t\tclassName = clsx(\n\t\t\t\t\tclassName,\n\t\t\t\t\t'wp-block-post-date__modified-date'\n\t\t\t\t);\n\t\t\t}\n\n\t\t\treturn {\n\t\t\t\t...otherAttributes,\n\t\t\t\tclassName,\n\t\t\t\tmetadata: {\n\t\t\t\t\t...metadata,\n\t\t\t\t\tbindings: {\n\t\t\t\t\t\tdatetime: {\n\t\t\t\t\t\t\tsource: 'core/post-data',\n\t\t\t\t\t\t\targs: { field: displayType },\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t};\n\t\t}\n\t},\n\tisEligible( attributes ) {\n\t\t// If there's neither an explicit `datetime` attribute nor a block binding for that attribute,\n\t\t// then we're dealing with an old version of the block.\n\t\treturn (\n\t\t\t! attributes.datetime && ! attributes?.metadata?.bindings?.datetime\n\t\t);\n\t},\n};\n\nconst v1 = {\n\tattributes: {\n\t\ttextAlign: {\n\t\t\ttype: 'string',\n\t\t},\n\t\tformat: {\n\t\t\ttype: 'string',\n\t\t},\n\t\tisLink: {\n\t\t\ttype: 'boolean',\n\t\t\tdefault: false,\n\t\t},\n\t},\n\tsupports: {\n\t\thtml: false,\n\t\tcolor: {\n\t\t\tgradients: true,\n\t\t\tlink: true,\n\t\t},\n\t\ttypography: {\n\t\t\tfontSize: true,\n\t\t\tlineHeight: true,\n\t\t\t__experimentalFontFamily: true,\n\t\t\t__experimentalFontWeight: true,\n\t\t\t__experimentalFontStyle: true,\n\t\t\t__experimentalTextTransform: true,\n\t\t\t__experimentalLetterSpacing: true,\n\t\t},\n\t},\n\tsave() {\n\t\treturn null;\n\t},\n\tmigrate: migrateFontFamily,\n\tisEligible( { style } ) {\n\t\treturn style?.typography?.fontFamily;\n\t},\n};\n\n/**\n * New deprecations need to be placed first\n * for them to have higher priority.\n *\n * Old deprecations may need to be updated as well.\n *\n * See block-deprecation.md\n */\nexport default [ v3, v2, v1 ];\n"],
|
|
5
|
+
"mappings": "AAGA,OAAO,UAAU;AAKjB,OAAO,uBAAuB;AAE9B,MAAM,KAAK;AAAA,EACV,YAAY;AAAA,IACX,UAAU;AAAA,MACT,MAAM;AAAA,MACN,MAAM;AAAA,IACP;AAAA,IACA,WAAW;AAAA,MACV,MAAM;AAAA,IACP;AAAA,IACA,QAAQ;AAAA,MACP,MAAM;AAAA,IACP;AAAA,IACA,QAAQ;AAAA,MACP,MAAM;AAAA,MACN,SAAS;AAAA,MACT,MAAM;AAAA,IACP;AAAA,EACD;AAAA,EACA,UAAU;AAAA,IACT,MAAM;AAAA,IACN,OAAO;AAAA,MACN,WAAW;AAAA,MACX,MAAM;AAAA,MACN,+BAA+B;AAAA,QAC9B,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A,UACA;AAAA,QACD;AAAA,MACD;AAEA,aAAO;AAAA,QACN,GAAG;AAAA,QACH;AAAA,QACA,UAAU;AAAA,UACT,GAAG;AAAA,UACH,UAAU;AAAA,YACT,UAAU;AAAA,cACT,QAAQ;AAAA,cACR,MAAM,EAAE,OAAO,YAAY;AAAA,YAC5B;AAAA,UACD;AAAA,QACD;AAAA,MACD;AAAA,IACD;AAAA,EACD;AAAA,EACA,WAAY,YAAa;AAGxB,WACC,CAAE,WAAW,YAAY,CAAE,YAAY,UAAU,UAAU;AAAA,EAE7D;AACD;AAEA,MAAM,KAAK;AAAA,EACV,YAAY;AAAA,IACX,WAAW;AAAA,MACV,MAAM;AAAA,IACP;AAAA,IACA,QAAQ;AAAA,MACP,MAAM;AAAA,IACP;AAAA,IACA,QAAQ;AAAA,MACP,MAAM;AAAA,MACN,SAAS;AAAA,IACV;AAAA,EACD;AAAA,EACA,UAAU;AAAA,IACT,MAAM;AAAA,IACN,OAAO;AAAA,MACN,WAAW;AAAA,MACX,MAAM;AAAA,IACP;AAAA,IACA,YAAY;AAAA,MACX,UAAU;AAAA,MACV,YAAY;AAAA,MACZ,0BAA0B;AAAA,MAC1B,0BAA0B;AAAA,MAC1B,yBAAyB;AAAA,MACzB,6BAA6B;AAAA,MAC7B,6BAA6B;AAAA,IAC9B;AAAA,EACD;AAAA,EACA,OAAO;AACN,WAAO;AAAA,EACR;AAAA,EACA,SAAS;AAAA,EACT,WAAY,EAAE,MAAM,GAAI;AACvB,WAAO,OAAO,YAAY;AAAA,EAC3B;AACD;AAUA,IAAO,qBAAQ,CAAE,IAAI,IAAI,EAAG;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1950,7 +1950,7 @@ body.editor-styles-wrapper .wp-block-navigation__responsive-container.is-menu-op
|
|
|
1950
1950
|
.link-control-transform__subheading {
|
|
1951
1951
|
font-size: 11px;
|
|
1952
1952
|
text-transform: uppercase;
|
|
1953
|
-
font-weight:
|
|
1953
|
+
font-weight: 499;
|
|
1954
1954
|
color: #1e1e1e;
|
|
1955
1955
|
margin-bottom: 1.5em;
|
|
1956
1956
|
}
|
|
@@ -2597,7 +2597,7 @@ body.editor-styles-wrapper .wp-block-navigation__responsive-container.is-menu-op
|
|
|
2597
2597
|
color: #757575;
|
|
2598
2598
|
text-transform: uppercase;
|
|
2599
2599
|
font-size: 11px;
|
|
2600
|
-
font-weight:
|
|
2600
|
+
font-weight: 499;
|
|
2601
2601
|
display: block;
|
|
2602
2602
|
}
|
|
2603
2603
|
|
package/build-style/editor.css
CHANGED
|
@@ -1957,7 +1957,7 @@ body.editor-styles-wrapper .wp-block-navigation__responsive-container.is-menu-op
|
|
|
1957
1957
|
.link-control-transform__subheading {
|
|
1958
1958
|
font-size: 11px;
|
|
1959
1959
|
text-transform: uppercase;
|
|
1960
|
-
font-weight:
|
|
1960
|
+
font-weight: 499;
|
|
1961
1961
|
color: #1e1e1e;
|
|
1962
1962
|
margin-bottom: 1.5em;
|
|
1963
1963
|
}
|
|
@@ -2604,7 +2604,7 @@ body.editor-styles-wrapper .wp-block-navigation__responsive-container.is-menu-op
|
|
|
2604
2604
|
color: #757575;
|
|
2605
2605
|
text-transform: uppercase;
|
|
2606
2606
|
font-size: 11px;
|
|
2607
|
-
font-weight:
|
|
2607
|
+
font-weight: 499;
|
|
2608
2608
|
display: block;
|
|
2609
2609
|
}
|
|
2610
2610
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wordpress/block-library",
|
|
3
|
-
"version": "9.33.
|
|
3
|
+
"version": "9.33.2-next.36001005c.0",
|
|
4
4
|
"description": "Block library for the WordPress editor.",
|
|
5
5
|
"author": "The WordPress Contributors",
|
|
6
6
|
"license": "GPL-2.0-or-later",
|
|
@@ -81,41 +81,41 @@
|
|
|
81
81
|
"{src,build,build-module}/*/init.js"
|
|
82
82
|
],
|
|
83
83
|
"dependencies": {
|
|
84
|
-
"@wordpress/a11y": "^4.33.0",
|
|
85
|
-
"@wordpress/api-fetch": "^7.33.0",
|
|
86
|
-
"@wordpress/autop": "^4.33.0",
|
|
87
|
-
"@wordpress/base-styles": "^6.
|
|
88
|
-
"@wordpress/blob": "^4.33.0",
|
|
89
|
-
"@wordpress/block-editor": "^15.6.0",
|
|
90
|
-
"@wordpress/blocks": "^15.6.0",
|
|
91
|
-
"@wordpress/components": "^30.
|
|
92
|
-
"@wordpress/compose": "^7.33.0",
|
|
93
|
-
"@wordpress/core-data": "^7.33.0",
|
|
94
|
-
"@wordpress/data": "^10.33.0",
|
|
95
|
-
"@wordpress/date": "^5.33.0",
|
|
96
|
-
"@wordpress/deprecated": "^4.33.0",
|
|
97
|
-
"@wordpress/dom": "^4.33.0",
|
|
98
|
-
"@wordpress/element": "^6.33.0",
|
|
99
|
-
"@wordpress/escape-html": "^3.33.0",
|
|
100
|
-
"@wordpress/hooks": "^4.33.0",
|
|
101
|
-
"@wordpress/html-entities": "^4.33.0",
|
|
102
|
-
"@wordpress/i18n": "^6.6.0",
|
|
103
|
-
"@wordpress/icons": "^11.0.0",
|
|
104
|
-
"@wordpress/interactivity": "^6.33.0",
|
|
105
|
-
"@wordpress/interactivity-router": "^2.33.0",
|
|
106
|
-
"@wordpress/keyboard-shortcuts": "^5.33.0",
|
|
107
|
-
"@wordpress/keycodes": "^4.33.0",
|
|
108
|
-
"@wordpress/latex-to-mathml": "^1.1.0",
|
|
109
|
-
"@wordpress/notices": "^5.33.0",
|
|
110
|
-
"@wordpress/patterns": "^2.33.0",
|
|
111
|
-
"@wordpress/primitives": "^4.33.0",
|
|
112
|
-
"@wordpress/private-apis": "^1.33.0",
|
|
113
|
-
"@wordpress/reusable-blocks": "^5.33.0",
|
|
114
|
-
"@wordpress/rich-text": "^7.33.0",
|
|
115
|
-
"@wordpress/server-side-render": "^6.9.0",
|
|
116
|
-
"@wordpress/url": "^4.33.0",
|
|
117
|
-
"@wordpress/viewport": "^6.33.0",
|
|
118
|
-
"@wordpress/wordcount": "^4.33.0",
|
|
84
|
+
"@wordpress/a11y": "^4.33.1-next.36001005c.0",
|
|
85
|
+
"@wordpress/api-fetch": "^7.33.1-next.36001005c.0",
|
|
86
|
+
"@wordpress/autop": "^4.33.1-next.36001005c.0",
|
|
87
|
+
"@wordpress/base-styles": "^6.10.1-next.36001005c.0",
|
|
88
|
+
"@wordpress/blob": "^4.33.1-next.36001005c.0",
|
|
89
|
+
"@wordpress/block-editor": "^15.6.1-next.36001005c.0",
|
|
90
|
+
"@wordpress/blocks": "^15.6.1-next.36001005c.0",
|
|
91
|
+
"@wordpress/components": "^30.7.1-next.36001005c.0",
|
|
92
|
+
"@wordpress/compose": "^7.33.1-next.36001005c.0",
|
|
93
|
+
"@wordpress/core-data": "^7.33.1-next.36001005c.0",
|
|
94
|
+
"@wordpress/data": "^10.33.1-next.36001005c.0",
|
|
95
|
+
"@wordpress/date": "^5.33.1-next.36001005c.0",
|
|
96
|
+
"@wordpress/deprecated": "^4.33.1-next.36001005c.0",
|
|
97
|
+
"@wordpress/dom": "^4.33.1-next.36001005c.0",
|
|
98
|
+
"@wordpress/element": "^6.33.1-next.36001005c.0",
|
|
99
|
+
"@wordpress/escape-html": "^3.33.1-next.36001005c.0",
|
|
100
|
+
"@wordpress/hooks": "^4.33.1-next.36001005c.0",
|
|
101
|
+
"@wordpress/html-entities": "^4.33.1-next.36001005c.0",
|
|
102
|
+
"@wordpress/i18n": "^6.6.1-next.36001005c.0",
|
|
103
|
+
"@wordpress/icons": "^11.0.1-next.36001005c.0",
|
|
104
|
+
"@wordpress/interactivity": "^6.33.1-next.36001005c.0",
|
|
105
|
+
"@wordpress/interactivity-router": "^2.33.1-next.36001005c.0",
|
|
106
|
+
"@wordpress/keyboard-shortcuts": "^5.33.1-next.36001005c.0",
|
|
107
|
+
"@wordpress/keycodes": "^4.33.1-next.36001005c.0",
|
|
108
|
+
"@wordpress/latex-to-mathml": "^1.1.1-next.36001005c.0",
|
|
109
|
+
"@wordpress/notices": "^5.33.1-next.36001005c.0",
|
|
110
|
+
"@wordpress/patterns": "^2.33.1-next.36001005c.0",
|
|
111
|
+
"@wordpress/primitives": "^4.33.1-next.36001005c.0",
|
|
112
|
+
"@wordpress/private-apis": "^1.33.1-next.36001005c.0",
|
|
113
|
+
"@wordpress/reusable-blocks": "^5.33.1-next.36001005c.0",
|
|
114
|
+
"@wordpress/rich-text": "^7.33.1-next.36001005c.0",
|
|
115
|
+
"@wordpress/server-side-render": "^6.9.1-next.36001005c.0",
|
|
116
|
+
"@wordpress/url": "^4.33.1-next.36001005c.0",
|
|
117
|
+
"@wordpress/viewport": "^6.33.1-next.36001005c.0",
|
|
118
|
+
"@wordpress/wordcount": "^4.33.1-next.36001005c.0",
|
|
119
119
|
"change-case": "^4.1.2",
|
|
120
120
|
"clsx": "^2.1.1",
|
|
121
121
|
"colord": "^2.7.0",
|
|
@@ -133,5 +133,5 @@
|
|
|
133
133
|
"publishConfig": {
|
|
134
134
|
"access": "public"
|
|
135
135
|
},
|
|
136
|
-
"gitHead": "
|
|
136
|
+
"gitHead": "b73a8a22e779c59efb8f911e32b681652f237d60"
|
|
137
137
|
}
|
|
@@ -124,7 +124,7 @@ function AdditionalBlockContent( { block, insertedBlock, setInsertedBlock } ) {
|
|
|
124
124
|
if ( isEntityLink ) {
|
|
125
125
|
createBinding( updatedAttributes );
|
|
126
126
|
} else {
|
|
127
|
-
clearBinding(
|
|
127
|
+
clearBinding();
|
|
128
128
|
}
|
|
129
129
|
|
|
130
130
|
setInsertedBlock( null );
|
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
TextareaControl,
|
|
12
12
|
} from '@wordpress/components';
|
|
13
13
|
import { __, sprintf } from '@wordpress/i18n';
|
|
14
|
-
import { useRef } from '@wordpress/element';
|
|
14
|
+
import { useRef, useEffect, useState } from '@wordpress/element';
|
|
15
15
|
import { useInstanceId } from '@wordpress/compose';
|
|
16
16
|
import { safeDecodeURI } from '@wordpress/url';
|
|
17
17
|
import { __unstableStripHTML as stripHTML } from '@wordpress/dom';
|
|
@@ -72,9 +72,20 @@ export function Controls( { attributes, setAttributes, clientId } ) {
|
|
|
72
72
|
const { label, url, description, rel, opensInNewTab } = attributes;
|
|
73
73
|
const lastURLRef = useRef( url );
|
|
74
74
|
const dropdownMenuProps = useToolsPanelDropdownMenuProps();
|
|
75
|
+
const urlInputRef = useRef();
|
|
76
|
+
const shouldFocusURLInputRef = useRef( false );
|
|
75
77
|
const inputId = useInstanceId( Controls, 'link-input' );
|
|
76
78
|
const helpTextId = `${ inputId }__help`;
|
|
77
79
|
|
|
80
|
+
// Local state to control the input value
|
|
81
|
+
const [ inputValue, setInputValue ] = useState( url );
|
|
82
|
+
|
|
83
|
+
// Sync local state when url prop changes (e.g., from undo/redo or external updates)
|
|
84
|
+
useEffect( () => {
|
|
85
|
+
setInputValue( url );
|
|
86
|
+
lastURLRef.current = url;
|
|
87
|
+
}, [ url ] );
|
|
88
|
+
|
|
78
89
|
// Use the entity binding hook internally
|
|
79
90
|
const { hasUrlBinding, clearBinding } = useEntityBinding( {
|
|
80
91
|
clientId,
|
|
@@ -84,7 +95,7 @@ export function Controls( { attributes, setAttributes, clientId } ) {
|
|
|
84
95
|
// Get direct store dispatch to bypass setBoundAttributes wrapper
|
|
85
96
|
const { updateBlockAttributes } = useDispatch( blockEditorStore );
|
|
86
97
|
|
|
87
|
-
const
|
|
98
|
+
const unsyncBoundLink = () => {
|
|
88
99
|
// Clear the binding first
|
|
89
100
|
clearBinding();
|
|
90
101
|
|
|
@@ -93,9 +104,23 @@ export function Controls( { attributes, setAttributes, clientId } ) {
|
|
|
93
104
|
// setAttributes is actually setBoundAttributes, a wrapper function that
|
|
94
105
|
// processes attributes through the binding system.
|
|
95
106
|
// See: packages/block-editor/src/components/block-edit/edit.js
|
|
96
|
-
updateBlockAttributes( clientId, {
|
|
107
|
+
updateBlockAttributes( clientId, {
|
|
108
|
+
url: lastURLRef.current, // set the lastURLRef as the new editable value so we avoid bugs from empty link states
|
|
109
|
+
id: undefined,
|
|
110
|
+
} );
|
|
97
111
|
};
|
|
98
112
|
|
|
113
|
+
useEffect( () => {
|
|
114
|
+
// Checking for ! hasUrlBinding is a defensive check, as we would
|
|
115
|
+
// only want to focus the input if the url is not bound to an entity.
|
|
116
|
+
if ( ! hasUrlBinding && shouldFocusURLInputRef.current ) {
|
|
117
|
+
// focuses and highlights the url input value, giving the user
|
|
118
|
+
// the ability to delete the value quickly or edit it.
|
|
119
|
+
urlInputRef.current?.select();
|
|
120
|
+
}
|
|
121
|
+
shouldFocusURLInputRef.current = false;
|
|
122
|
+
}, [ hasUrlBinding ] );
|
|
123
|
+
|
|
99
124
|
return (
|
|
100
125
|
<ToolsPanel
|
|
101
126
|
label={ __( 'Settings' ) }
|
|
@@ -135,22 +160,25 @@ export function Controls( { attributes, setAttributes, clientId } ) {
|
|
|
135
160
|
isShownByDefault
|
|
136
161
|
>
|
|
137
162
|
<InputControl
|
|
163
|
+
ref={ urlInputRef }
|
|
138
164
|
__nextHasNoMarginBottom
|
|
139
165
|
__next40pxDefaultSize
|
|
140
166
|
id={ inputId }
|
|
141
167
|
label={ __( 'Link' ) }
|
|
142
|
-
value={
|
|
143
|
-
onChange={ ( urlValue ) => {
|
|
144
|
-
if ( hasUrlBinding ) {
|
|
145
|
-
return; // Prevent editing when URL is bound
|
|
146
|
-
}
|
|
147
|
-
setAttributes( {
|
|
148
|
-
url: encodeURI( safeDecodeURI( urlValue ) ),
|
|
149
|
-
} );
|
|
150
|
-
} }
|
|
168
|
+
value={ inputValue ? safeDecodeURI( inputValue ) : '' }
|
|
151
169
|
autoComplete="off"
|
|
152
170
|
type="url"
|
|
153
171
|
disabled={ hasUrlBinding }
|
|
172
|
+
onChange={ ( newValue ) => {
|
|
173
|
+
if ( hasUrlBinding ) {
|
|
174
|
+
return;
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
// Defer updating the url attribute until onBlur to prevent the canvas from
|
|
178
|
+
// treating a temporary empty value as a committed value, which replaces the
|
|
179
|
+
// label with placeholder text.
|
|
180
|
+
setInputValue( newValue );
|
|
181
|
+
} }
|
|
154
182
|
onFocus={ () => {
|
|
155
183
|
if ( hasUrlBinding ) {
|
|
156
184
|
return;
|
|
@@ -161,12 +189,19 @@ export function Controls( { attributes, setAttributes, clientId } ) {
|
|
|
161
189
|
if ( hasUrlBinding ) {
|
|
162
190
|
return;
|
|
163
191
|
}
|
|
192
|
+
|
|
193
|
+
const finalValue = ! inputValue
|
|
194
|
+
? lastURLRef.current
|
|
195
|
+
: inputValue;
|
|
196
|
+
|
|
197
|
+
// Update local state immediately so input reflects the reverted value if the value was cleared
|
|
198
|
+
setInputValue( finalValue );
|
|
199
|
+
|
|
164
200
|
// Defer the updateAttributes call to ensure entity connection isn't severed by accident.
|
|
165
|
-
updateAttributes(
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
);
|
|
201
|
+
updateAttributes( { url: finalValue }, setAttributes, {
|
|
202
|
+
...attributes,
|
|
203
|
+
url: lastURLRef.current,
|
|
204
|
+
} );
|
|
170
205
|
} }
|
|
171
206
|
help={
|
|
172
207
|
hasUrlBinding && (
|
|
@@ -180,7 +215,12 @@ export function Controls( { attributes, setAttributes, clientId } ) {
|
|
|
180
215
|
hasUrlBinding && (
|
|
181
216
|
<Button
|
|
182
217
|
icon={ unlinkIcon }
|
|
183
|
-
onClick={
|
|
218
|
+
onClick={ () => {
|
|
219
|
+
unsyncBoundLink();
|
|
220
|
+
// Focus management to send focus to the URL input
|
|
221
|
+
// on next render after disabled state is removed.
|
|
222
|
+
shouldFocusURLInputRef.current = true;
|
|
223
|
+
} }
|
|
184
224
|
aria-describedby={ helpTextId }
|
|
185
225
|
showTooltip
|
|
186
226
|
label={ __( 'Unsync and edit' ) }
|
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
* External dependencies
|
|
7
7
|
*/
|
|
8
8
|
import { render, screen, fireEvent } from '@testing-library/react';
|
|
9
|
+
import userEvent from '@testing-library/user-event';
|
|
9
10
|
|
|
10
11
|
/**
|
|
11
12
|
* Internal dependencies
|
|
@@ -95,18 +96,22 @@ describe( 'Controls', () => {
|
|
|
95
96
|
expect( urlInput.value ).toBe( 'https://example.com/test page' );
|
|
96
97
|
} );
|
|
97
98
|
|
|
98
|
-
it( '
|
|
99
|
+
it( 'calls updateAttributes with new URL on blur', async () => {
|
|
100
|
+
const user = userEvent.setup();
|
|
99
101
|
render( <Controls { ...defaultProps } /> );
|
|
100
102
|
|
|
101
103
|
const urlInput = screen.getByLabelText( 'Link' );
|
|
102
104
|
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
105
|
+
await user.click( urlInput );
|
|
106
|
+
await user.clear( urlInput );
|
|
107
|
+
await user.type( urlInput, 'https://example.com/test page' );
|
|
108
|
+
await user.tab();
|
|
106
109
|
|
|
107
|
-
expect(
|
|
108
|
-
url: 'https://example.com/test
|
|
109
|
-
|
|
110
|
+
expect( mockUpdateAttributes ).toHaveBeenCalledWith(
|
|
111
|
+
{ url: 'https://example.com/test page' },
|
|
112
|
+
defaultProps.setAttributes,
|
|
113
|
+
{ ...defaultProps.attributes, url: 'https://example.com' }
|
|
114
|
+
);
|
|
110
115
|
} );
|
|
111
116
|
|
|
112
117
|
it( 'calls updateAttributes on URL blur', () => {
|
|
@@ -143,11 +148,11 @@ describe( 'Controls', () => {
|
|
|
143
148
|
target: { value: 'https://new.com' },
|
|
144
149
|
} );
|
|
145
150
|
|
|
146
|
-
// Blur should call updateAttributes with the
|
|
151
|
+
// Blur should call updateAttributes with the new URL value from the input
|
|
147
152
|
fireEvent.blur( urlInput );
|
|
148
153
|
|
|
149
154
|
expect( mockUpdateAttributes ).toHaveBeenCalledWith(
|
|
150
|
-
{ url: 'https://
|
|
155
|
+
{ url: 'https://new.com' }, // New URL from input value
|
|
151
156
|
defaultProps.setAttributes,
|
|
152
157
|
{
|
|
153
158
|
...propsWithDifferentUrl.attributes,
|
|
@@ -69,7 +69,7 @@ export function useEntityBinding( { clientId, attributes } ) {
|
|
|
69
69
|
if ( hasUrlBinding ) {
|
|
70
70
|
updateBlockBindings( { url: undefined } );
|
|
71
71
|
}
|
|
72
|
-
}, [ updateBlockBindings, hasUrlBinding
|
|
72
|
+
}, [ updateBlockBindings, hasUrlBinding ] );
|
|
73
73
|
|
|
74
74
|
const createBinding = useCallback(
|
|
75
75
|
( updatedAttributes ) => {
|
|
@@ -102,7 +102,11 @@ const v3 = {
|
|
|
102
102
|
};
|
|
103
103
|
},
|
|
104
104
|
isEligible( attributes ) {
|
|
105
|
-
return
|
|
105
|
+
return (
|
|
106
|
+
attributes?.metadata?.bindings?.datetime?.source ===
|
|
107
|
+
'core/post-data' &&
|
|
108
|
+
!! attributes?.metadata?.bindings?.datetime?.args?.key
|
|
109
|
+
);
|
|
106
110
|
},
|
|
107
111
|
};
|
|
108
112
|
|