@wordpress/block-library 9.41.1-next.v.202603161435.0 → 9.43.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 +4 -0
- package/build/form-input/edit.cjs +36 -29
- package/build/form-input/edit.cjs.map +2 -2
- package/build/form-input/variations.cjs +10 -0
- package/build/form-input/variations.cjs.map +2 -2
- package/build/group/block.json +3 -1
- package/build/html/modal.cjs +151 -229
- package/build/html/modal.cjs.map +2 -2
- package/build/image/image.cjs +13 -4
- package/build/image/image.cjs.map +2 -2
- package/build/latest-comments/deprecated.cjs +33 -0
- package/build/latest-comments/deprecated.cjs.map +2 -2
- package/build/list-item/block.json +1 -0
- package/build/navigation/edit/index.cjs +123 -119
- package/build/navigation/edit/index.cjs.map +3 -3
- package/build/navigation/edit/navigation-menu-selector.cjs +2 -1
- package/build/navigation/edit/navigation-menu-selector.cjs.map +2 -2
- package/build/post-date/block.json +1 -3
- package/build/post-date/deprecated.cjs +82 -6
- package/build/post-date/deprecated.cjs.map +3 -3
- package/build/post-date/edit.cjs +49 -62
- package/build/post-date/edit.cjs.map +3 -3
- package/build/site-logo/edit.cjs +19 -13
- package/build/site-logo/edit.cjs.map +3 -3
- package/build/site-tagline/deprecated.cjs +2 -1
- package/build/site-tagline/deprecated.cjs.map +2 -2
- package/build/site-title/index.cjs +5 -1
- package/build/site-title/index.cjs.map +2 -2
- package/build/tab/save.cjs +2 -4
- package/build/tab/save.cjs.map +2 -2
- package/build/tabs/save.cjs +2 -4
- package/build/tabs/save.cjs.map +2 -2
- package/build/utils/media-control.cjs +1 -1
- package/build/utils/media-control.cjs.map +2 -2
- package/build-module/form-input/edit.mjs +36 -29
- package/build-module/form-input/edit.mjs.map +2 -2
- package/build-module/form-input/variations.mjs +10 -0
- package/build-module/form-input/variations.mjs.map +2 -2
- package/build-module/group/block.json +3 -1
- package/build-module/html/modal.mjs +151 -229
- package/build-module/html/modal.mjs.map +2 -2
- package/build-module/image/image.mjs +13 -4
- package/build-module/image/image.mjs.map +2 -2
- package/build-module/latest-comments/deprecated.mjs +33 -0
- package/build-module/latest-comments/deprecated.mjs.map +2 -2
- package/build-module/list-item/block.json +1 -0
- package/build-module/navigation/edit/index.mjs +123 -119
- package/build-module/navigation/edit/index.mjs.map +2 -2
- package/build-module/navigation/edit/navigation-menu-selector.mjs +2 -1
- package/build-module/navigation/edit/navigation-menu-selector.mjs.map +2 -2
- package/build-module/post-date/block.json +1 -3
- package/build-module/post-date/deprecated.mjs +82 -6
- package/build-module/post-date/deprecated.mjs.map +2 -2
- package/build-module/post-date/edit.mjs +49 -63
- package/build-module/post-date/edit.mjs.map +2 -2
- package/build-module/site-logo/edit.mjs +21 -14
- package/build-module/site-logo/edit.mjs.map +2 -2
- package/build-module/site-tagline/deprecated.mjs +2 -1
- package/build-module/site-tagline/deprecated.mjs.map +2 -2
- package/build-module/site-title/index.mjs +5 -1
- package/build-module/site-title/index.mjs.map +2 -2
- package/build-module/tab/save.mjs +2 -4
- package/build-module/tab/save.mjs.map +2 -2
- package/build-module/tabs/save.mjs +2 -4
- package/build-module/tabs/save.mjs.map +2 -2
- package/build-module/utils/media-control.mjs +1 -1
- package/build-module/utils/media-control.mjs.map +2 -2
- package/build-style/editor-rtl.css +15 -5
- package/build-style/editor.css +15 -5
- package/build-style/form-input/editor-rtl.css +6 -5
- package/build-style/form-input/editor.css +6 -5
- package/build-style/icon/editor-rtl.css +5 -0
- package/build-style/icon/editor.css +5 -0
- package/build-style/image/editor-rtl.css +4 -0
- package/build-style/image/editor.css +4 -0
- package/build-style/navigation/style-rtl.css +4 -1
- package/build-style/navigation/style.css +4 -1
- package/build-style/style-rtl.css +4 -1
- package/build-style/style.css +4 -1
- package/package.json +38 -38
- package/src/form-input/edit.js +19 -15
- package/src/form-input/editor.scss +6 -6
- package/src/form-input/variations.js +10 -0
- package/src/group/block.json +3 -1
- package/src/home-link/index.php +14 -33
- package/src/html/modal.js +6 -77
- package/src/icon/editor.scss +5 -0
- package/src/image/editor.scss +5 -0
- package/src/image/image.js +18 -3
- package/src/latest-comments/deprecated.js +33 -0
- package/src/list-item/block.json +1 -0
- package/src/loginout/index.php +13 -0
- package/src/navigation/edit/index.js +134 -130
- package/src/navigation/edit/navigation-menu-selector.js +2 -1
- package/src/navigation/index.php +24 -6
- package/src/navigation/style.scss +5 -3
- package/src/navigation-link/index.php +10 -38
- package/src/navigation-link/shared/build-css-font-sizes.php +43 -0
- package/src/navigation-submenu/index.php +10 -38
- package/src/page-list/index.php +14 -41
- package/src/post-date/block.json +1 -3
- package/src/post-date/deprecated.js +86 -6
- package/src/post-date/edit.js +65 -82
- package/src/site-logo/edit.js +24 -13
- package/src/site-tagline/deprecated.js +1 -0
- package/src/site-title/index.js +5 -1
- package/src/tab/save.js +2 -6
- package/src/tabs/save.js +2 -6
- package/src/utils/media-control.js +3 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/navigation/edit/navigation-menu-selector.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport {\n\tMenuGroup,\n\tMenuItem,\n\tMenuItemsChoice,\n\tDropdownMenu,\n} from '@wordpress/components';\nimport { moreVertical } from '@wordpress/icons';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { decodeEntities } from '@wordpress/html-entities';\nimport { useEffect, useMemo, useState } from '@wordpress/element';\nimport { useEntityRecords, useEntityProp } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport useNavigationMenu from '../use-navigation-menu';\n\nfunction buildMenuLabel( title, id, status ) {\n\tif ( ! title ) {\n\t\t/* translators: %s: the index of the menu in the list of menus. */\n\t\treturn sprintf( __( '(no title %s)' ), id );\n\t}\n\n\tif ( status === 'publish' ) {\n\t\treturn decodeEntities( title );\n\t}\n\n\treturn sprintf(\n\t\t// translators: 1: title of the menu. 2: status of the menu (draft, pending, etc.).\n\t\t__( '%1$s (%2$s)' ),\n\t\tdecodeEntities( title ),\n\t\tstatus\n\t);\n}\n\nfunction NavigationMenuSelector( {\n\tcurrentMenuId,\n\tonSelectNavigationMenu,\n\tonSelectClassicMenu,\n\tonCreateNew,\n\tactionLabel,\n\tcreateNavigationMenuIsSuccess,\n\tcreateNavigationMenuIsError,\n} ) {\n\t/* translators: %s: The name of a menu. */\n\tconst createActionLabel = __( \"Create from '%s'\" );\n\n\tconst [ isUpdatingMenuRef, setIsUpdatingMenuRef ] = useState( false );\n\n\tactionLabel = actionLabel || createActionLabel;\n\n\tconst { records: classicMenus } = useEntityRecords( 'root', 'menu', {\n\t\tper_page: -1,\n\t\tcontext: 'view',\n\t} );\n\n\tconst {\n\t\tnavigationMenus,\n\t\tisResolvingNavigationMenus,\n\t\thasResolvedNavigationMenus,\n\t\tcanUserCreateNavigationMenus,\n\t\tcanSwitchNavigationMenu,\n\t\tisNavigationMenuMissing,\n\t} = useNavigationMenu( currentMenuId );\n\n\tconst [ currentTitle ] = useEntityProp(\n\t\t'postType',\n\t\t'wp_navigation',\n\t\t'title'\n\t);\n\n\tconst menuChoices = useMemo( () => {\n\t\treturn (\n\t\t\tnavigationMenus?.map( ( { id, title, status }, index ) => {\n\t\t\t\tconst label = buildMenuLabel(\n\t\t\t\t\ttitle?.rendered,\n\t\t\t\t\tindex + 1,\n\t\t\t\t\tstatus\n\t\t\t\t);\n\n\t\t\t\treturn {\n\t\t\t\t\tvalue: id,\n\t\t\t\t\tlabel,\n\t\t\t\t\tariaLabel: sprintf( actionLabel, label ),\n\t\t\t\t\tdisabled:\n\t\t\t\t\t\tisUpdatingMenuRef ||\n\t\t\t\t\t\tisResolvingNavigationMenus ||\n\t\t\t\t\t\t! hasResolvedNavigationMenus,\n\t\t\t\t};\n\t\t\t} ) || []\n\t\t);\n\t}, [\n\t\tnavigationMenus,\n\t\tactionLabel,\n\t\tisResolvingNavigationMenus,\n\t\thasResolvedNavigationMenus,\n\t\tisUpdatingMenuRef,\n\t] );\n\n\tconst hasNavigationMenus = !! navigationMenus?.length;\n\tconst hasClassicMenus = !! classicMenus?.length;\n\tconst showNavigationMenus = !! canSwitchNavigationMenu;\n\tconst showClassicMenus = !! canUserCreateNavigationMenus;\n\n\tconst noMenuSelected = hasNavigationMenus && ! currentMenuId;\n\tconst noBlockMenus = ! hasNavigationMenus && hasResolvedNavigationMenus;\n\tconst menuUnavailable =\n\t\thasResolvedNavigationMenus && currentMenuId === null;\n\tconst navMenuHasBeenDeleted = currentMenuId && isNavigationMenuMissing;\n\n\tlet selectorLabel = '';\n\n\tif ( isResolvingNavigationMenus ) {\n\t\tselectorLabel = __( 'Loading\u2026' );\n\t} else if (\n\t\tnoMenuSelected ||\n\t\tnoBlockMenus ||\n\t\tmenuUnavailable ||\n\t\tnavMenuHasBeenDeleted\n\t) {\n\t\t// Note: classic Menus may be available.\n\t\tselectorLabel = __( 'Choose or create a Navigation Menu' );\n\t} else {\n\t\t// Current Menu's title.\n\t\tselectorLabel = currentTitle;\n\t}\n\n\tuseEffect( () => {\n\t\tif (\n\t\t\tisUpdatingMenuRef &&\n\t\t\t( createNavigationMenuIsSuccess || createNavigationMenuIsError )\n\t\t) {\n\t\t\tsetIsUpdatingMenuRef( false );\n\t\t}\n\t}, [\n\t\thasResolvedNavigationMenus,\n\t\tcreateNavigationMenuIsSuccess,\n\t\tcanUserCreateNavigationMenus,\n\t\tcreateNavigationMenuIsError,\n\t\tisUpdatingMenuRef,\n\t\tmenuUnavailable,\n\t\tnoBlockMenus,\n\t\tnoMenuSelected,\n\t] );\n\n\tconst NavigationMenuSelectorDropdown = (\n\t\t<DropdownMenu\n\t\t\tlabel={ selectorLabel }\n\t\t\ticon={ moreVertical }\n\t\t\ttoggleProps={ { size: 'small' } }\n\t\t>\n\t\t\t{ ( { onClose } ) => (\n\t\t\t\t<>\n\t\t\t\t\t{ showNavigationMenus && hasNavigationMenus && (\n\t\t\t\t\t\t<MenuGroup label={ __( 'Menus' ) }>\n\t\t\t\t\t\t\t<MenuItemsChoice\n\t\t\t\t\t\t\t\tvalue={ currentMenuId }\n\t\t\t\t\t\t\t\tonSelect={ ( menuId ) => {\n\t\t\t\t\t\t\t\t\tonSelectNavigationMenu( menuId );\n\t\t\t\t\t\t\t\t\tonClose();\n\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\tchoices={ menuChoices }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</MenuGroup>\n\t\t\t\t\t) }\n\t\t\t\t\t{ showClassicMenus && hasClassicMenus && (\n\t\t\t\t\t\t<MenuGroup label={ __( 'Import Classic Menus' ) }>\n\t\t\t\t\t\t\t{ classicMenus?.map( ( menu ) => {\n\t\t\t\t\t\t\t\tconst label = decodeEntities( menu.name );\n\t\t\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\t\t\t\tonClick={ async () => {\n\t\t\t\t\t\t\t\t\t\t\tsetIsUpdatingMenuRef( true );\n\t\t\t\t\t\t\t\t\t\t\tawait onSelectClassicMenu( menu );\n\t\t\t\t\t\t\t\t\t\t\tsetIsUpdatingMenuRef( false );\n\t\t\t\t\t\t\t\t\t\t\tonClose();\n\t\t\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\t\t\tkey={ menu.id }\n\t\t\t\t\t\t\t\t\t\taria-label={ sprintf(\n\t\t\t\t\t\t\t\t\t\t\tcreateActionLabel,\n\t\t\t\t\t\t\t\t\t\t\tlabel\n\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\tdisabled={\n\t\t\t\t\t\t\t\t\t\t\tisUpdatingMenuRef ||\n\t\t\t\t\t\t\t\t\t\t\tisResolvingNavigationMenus ||\n\t\t\t\t\t\t\t\t\t\t\t! hasResolvedNavigationMenus\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{ label }\n\t\t\t\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t} ) }\n\t\t\t\t\t\t</MenuGroup>\n\t\t\t\t\t) }\n\n\t\t\t\t\t{ canUserCreateNavigationMenus && (\n\t\t\t\t\t\t<MenuGroup label={ __( 'Tools' ) }>\n\t\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\t\tonClick={ async () => {\n\t\t\t\t\t\t\t\t\tsetIsUpdatingMenuRef( true );\n\t\t\t\t\t\t\t\t\tawait onCreateNew();\n\t\t\t\t\t\t\t\t\tsetIsUpdatingMenuRef( false );\n\t\t\t\t\t\t\t\t\tonClose();\n\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\tdisabled={\n\t\t\t\t\t\t\t\t\tisUpdatingMenuRef ||\n\t\t\t\t\t\t\t\t\tisResolvingNavigationMenus ||\n\t\t\t\t\t\t\t\t\t! hasResolvedNavigationMenus\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{ __( 'Create new Menu' ) }\n\t\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t\t</MenuGroup>\n\t\t\t\t\t) }\n\t\t\t\t</>\n\t\t\t) }\n\t\t</DropdownMenu>\n\t);\n\n\treturn NavigationMenuSelectorDropdown;\n}\n\nexport default NavigationMenuSelector;\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,wBAKO;AACP,mBAA6B;AAC7B,kBAA4B;AAC5B,2BAA+B;AAC/B,qBAA6C;AAC7C,uBAAgD;AAKhD,iCAA8B;
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport {\n\tMenuGroup,\n\tMenuItem,\n\tMenuItemsChoice,\n\tDropdownMenu,\n} from '@wordpress/components';\nimport { moreVertical } from '@wordpress/icons';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { decodeEntities } from '@wordpress/html-entities';\nimport { useEffect, useMemo, useState } from '@wordpress/element';\nimport { useEntityRecords, useEntityProp } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport useNavigationMenu from '../use-navigation-menu';\n\nfunction buildMenuLabel( title, id, status ) {\n\tif ( ! title ) {\n\t\t/* translators: %s: the index of the menu in the list of menus. */\n\t\treturn sprintf( __( '(no title %s)' ), id );\n\t}\n\n\tif ( status === 'publish' ) {\n\t\treturn decodeEntities( title );\n\t}\n\n\treturn sprintf(\n\t\t// translators: 1: title of the menu. 2: status of the menu (draft, pending, etc.).\n\t\t__( '%1$s (%2$s)' ),\n\t\tdecodeEntities( title ),\n\t\tstatus\n\t);\n}\n\nfunction NavigationMenuSelector( {\n\tcurrentMenuId,\n\tonSelectNavigationMenu,\n\tonSelectClassicMenu,\n\tonCreateNew,\n\tactionLabel,\n\tcreateNavigationMenuIsSuccess,\n\tcreateNavigationMenuIsError,\n} ) {\n\t/* translators: %s: The name of a menu. */\n\tconst createActionLabel = __( \"Create from '%s'\" );\n\n\tconst [ isUpdatingMenuRef, setIsUpdatingMenuRef ] = useState( false );\n\n\tactionLabel = actionLabel || createActionLabel;\n\n\tconst { records: classicMenus } = useEntityRecords( 'root', 'menu', {\n\t\tper_page: -1,\n\t\tcontext: 'view',\n\t} );\n\n\tconst {\n\t\tnavigationMenus,\n\t\tisResolvingNavigationMenus,\n\t\thasResolvedNavigationMenus,\n\t\tcanUserCreateNavigationMenus,\n\t\tcanSwitchNavigationMenu,\n\t\tisNavigationMenuMissing,\n\t} = useNavigationMenu( currentMenuId );\n\n\tconst [ currentTitle ] = useEntityProp(\n\t\t'postType',\n\t\t'wp_navigation',\n\t\t'title',\n\t\tcurrentMenuId\n\t);\n\n\tconst menuChoices = useMemo( () => {\n\t\treturn (\n\t\t\tnavigationMenus?.map( ( { id, title, status }, index ) => {\n\t\t\t\tconst label = buildMenuLabel(\n\t\t\t\t\ttitle?.rendered,\n\t\t\t\t\tindex + 1,\n\t\t\t\t\tstatus\n\t\t\t\t);\n\n\t\t\t\treturn {\n\t\t\t\t\tvalue: id,\n\t\t\t\t\tlabel,\n\t\t\t\t\tariaLabel: sprintf( actionLabel, label ),\n\t\t\t\t\tdisabled:\n\t\t\t\t\t\tisUpdatingMenuRef ||\n\t\t\t\t\t\tisResolvingNavigationMenus ||\n\t\t\t\t\t\t! hasResolvedNavigationMenus,\n\t\t\t\t};\n\t\t\t} ) || []\n\t\t);\n\t}, [\n\t\tnavigationMenus,\n\t\tactionLabel,\n\t\tisResolvingNavigationMenus,\n\t\thasResolvedNavigationMenus,\n\t\tisUpdatingMenuRef,\n\t] );\n\n\tconst hasNavigationMenus = !! navigationMenus?.length;\n\tconst hasClassicMenus = !! classicMenus?.length;\n\tconst showNavigationMenus = !! canSwitchNavigationMenu;\n\tconst showClassicMenus = !! canUserCreateNavigationMenus;\n\n\tconst noMenuSelected = hasNavigationMenus && ! currentMenuId;\n\tconst noBlockMenus = ! hasNavigationMenus && hasResolvedNavigationMenus;\n\tconst menuUnavailable =\n\t\thasResolvedNavigationMenus && currentMenuId === null;\n\tconst navMenuHasBeenDeleted = currentMenuId && isNavigationMenuMissing;\n\n\tlet selectorLabel = '';\n\n\tif ( isResolvingNavigationMenus ) {\n\t\tselectorLabel = __( 'Loading\u2026' );\n\t} else if (\n\t\tnoMenuSelected ||\n\t\tnoBlockMenus ||\n\t\tmenuUnavailable ||\n\t\tnavMenuHasBeenDeleted\n\t) {\n\t\t// Note: classic Menus may be available.\n\t\tselectorLabel = __( 'Choose or create a Navigation Menu' );\n\t} else {\n\t\t// Current Menu's title.\n\t\tselectorLabel = currentTitle;\n\t}\n\n\tuseEffect( () => {\n\t\tif (\n\t\t\tisUpdatingMenuRef &&\n\t\t\t( createNavigationMenuIsSuccess || createNavigationMenuIsError )\n\t\t) {\n\t\t\tsetIsUpdatingMenuRef( false );\n\t\t}\n\t}, [\n\t\thasResolvedNavigationMenus,\n\t\tcreateNavigationMenuIsSuccess,\n\t\tcanUserCreateNavigationMenus,\n\t\tcreateNavigationMenuIsError,\n\t\tisUpdatingMenuRef,\n\t\tmenuUnavailable,\n\t\tnoBlockMenus,\n\t\tnoMenuSelected,\n\t] );\n\n\tconst NavigationMenuSelectorDropdown = (\n\t\t<DropdownMenu\n\t\t\tlabel={ selectorLabel }\n\t\t\ticon={ moreVertical }\n\t\t\ttoggleProps={ { size: 'small' } }\n\t\t>\n\t\t\t{ ( { onClose } ) => (\n\t\t\t\t<>\n\t\t\t\t\t{ showNavigationMenus && hasNavigationMenus && (\n\t\t\t\t\t\t<MenuGroup label={ __( 'Menus' ) }>\n\t\t\t\t\t\t\t<MenuItemsChoice\n\t\t\t\t\t\t\t\tvalue={ currentMenuId }\n\t\t\t\t\t\t\t\tonSelect={ ( menuId ) => {\n\t\t\t\t\t\t\t\t\tonSelectNavigationMenu( menuId );\n\t\t\t\t\t\t\t\t\tonClose();\n\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\tchoices={ menuChoices }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</MenuGroup>\n\t\t\t\t\t) }\n\t\t\t\t\t{ showClassicMenus && hasClassicMenus && (\n\t\t\t\t\t\t<MenuGroup label={ __( 'Import Classic Menus' ) }>\n\t\t\t\t\t\t\t{ classicMenus?.map( ( menu ) => {\n\t\t\t\t\t\t\t\tconst label = decodeEntities( menu.name );\n\t\t\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\t\t\t\tonClick={ async () => {\n\t\t\t\t\t\t\t\t\t\t\tsetIsUpdatingMenuRef( true );\n\t\t\t\t\t\t\t\t\t\t\tawait onSelectClassicMenu( menu );\n\t\t\t\t\t\t\t\t\t\t\tsetIsUpdatingMenuRef( false );\n\t\t\t\t\t\t\t\t\t\t\tonClose();\n\t\t\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\t\t\tkey={ menu.id }\n\t\t\t\t\t\t\t\t\t\taria-label={ sprintf(\n\t\t\t\t\t\t\t\t\t\t\tcreateActionLabel,\n\t\t\t\t\t\t\t\t\t\t\tlabel\n\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\tdisabled={\n\t\t\t\t\t\t\t\t\t\t\tisUpdatingMenuRef ||\n\t\t\t\t\t\t\t\t\t\t\tisResolvingNavigationMenus ||\n\t\t\t\t\t\t\t\t\t\t\t! hasResolvedNavigationMenus\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{ label }\n\t\t\t\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t} ) }\n\t\t\t\t\t\t</MenuGroup>\n\t\t\t\t\t) }\n\n\t\t\t\t\t{ canUserCreateNavigationMenus && (\n\t\t\t\t\t\t<MenuGroup label={ __( 'Tools' ) }>\n\t\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\t\tonClick={ async () => {\n\t\t\t\t\t\t\t\t\tsetIsUpdatingMenuRef( true );\n\t\t\t\t\t\t\t\t\tawait onCreateNew();\n\t\t\t\t\t\t\t\t\tsetIsUpdatingMenuRef( false );\n\t\t\t\t\t\t\t\t\tonClose();\n\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\tdisabled={\n\t\t\t\t\t\t\t\t\tisUpdatingMenuRef ||\n\t\t\t\t\t\t\t\t\tisResolvingNavigationMenus ||\n\t\t\t\t\t\t\t\t\t! hasResolvedNavigationMenus\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{ __( 'Create new Menu' ) }\n\t\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t\t</MenuGroup>\n\t\t\t\t\t) }\n\t\t\t\t</>\n\t\t\t) }\n\t\t</DropdownMenu>\n\t);\n\n\treturn NavigationMenuSelectorDropdown;\n}\n\nexport default NavigationMenuSelector;\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;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BAAuB,GAC3C,wBAAc,IAAK,CAAE,SAAU;AAChC,gBAAM,YAAQ,qCAAgB,KAAK,IAAK;AACxC,iBACC;AAAA,YAAC;AAAA;AAAA,cACA,SAAU,YAAY;AACrB,qCAAsB,IAAK;AAC3B,sBAAM,oBAAqB,IAAK;AAChC,qCAAsB,KAAM;AAC5B,wBAAQ;AAAA,cACT;AAAA,cAEA,kBAAa;AAAA,gBACZ;AAAA,gBACA;AAAA,cACD;AAAA,cACA,UACC,qBACA,8BACA,CAAE;AAAA,cAGD;AAAA;AAAA,YAXI,KAAK;AAAA,UAYZ;AAAA,QAEF,CAAE,GACH;AAAA,QAGC,gCACD,4CAAC,+BAAU,WAAQ,gBAAI,OAAQ,GAC9B;AAAA,UAAC;AAAA;AAAA,YACA,SAAU,YAAY;AACrB,mCAAsB,IAAK;AAC3B,oBAAM,YAAY;AAClB,mCAAsB,KAAM;AAC5B,sBAAQ;AAAA,YACT;AAAA,YACA,UACC,qBACA,8BACA,CAAE;AAAA,YAGD,8BAAI,iBAAkB;AAAA;AAAA,QACzB,GACD;AAAA,SAEF;AAAA;AAAA,EAEF;AAGD,SAAO;AACR;AAEA,IAAO,mCAAQ;",
|
|
6
6
|
"names": ["useNavigationMenu"]
|
|
7
7
|
}
|
|
@@ -11,9 +11,6 @@
|
|
|
11
11
|
"type": "string",
|
|
12
12
|
"role": "content"
|
|
13
13
|
},
|
|
14
|
-
"textAlign": {
|
|
15
|
-
"type": "string"
|
|
16
|
-
},
|
|
17
14
|
"format": {
|
|
18
15
|
"type": "string"
|
|
19
16
|
},
|
|
@@ -46,6 +43,7 @@
|
|
|
46
43
|
"typography": {
|
|
47
44
|
"fontSize": true,
|
|
48
45
|
"lineHeight": true,
|
|
46
|
+
"textAlign": true,
|
|
49
47
|
"__experimentalFontFamily": true,
|
|
50
48
|
"__experimentalFontWeight": true,
|
|
51
49
|
"__experimentalFontStyle": true,
|
|
@@ -35,6 +35,80 @@ __export(deprecated_exports, {
|
|
|
35
35
|
module.exports = __toCommonJS(deprecated_exports);
|
|
36
36
|
var import_clsx = __toESM(require("clsx"));
|
|
37
37
|
var import_migrate_font_family = __toESM(require("../utils/migrate-font-family.cjs"));
|
|
38
|
+
var import_migrate_text_align = __toESM(require("../utils/migrate-text-align.cjs"));
|
|
39
|
+
var v4 = {
|
|
40
|
+
attributes: {
|
|
41
|
+
datetime: {
|
|
42
|
+
type: "string",
|
|
43
|
+
role: "content"
|
|
44
|
+
},
|
|
45
|
+
textAlign: {
|
|
46
|
+
type: "string"
|
|
47
|
+
},
|
|
48
|
+
format: {
|
|
49
|
+
type: "string"
|
|
50
|
+
},
|
|
51
|
+
isLink: {
|
|
52
|
+
type: "boolean",
|
|
53
|
+
default: false,
|
|
54
|
+
role: "content"
|
|
55
|
+
}
|
|
56
|
+
},
|
|
57
|
+
supports: {
|
|
58
|
+
anchor: true,
|
|
59
|
+
html: false,
|
|
60
|
+
color: {
|
|
61
|
+
gradients: true,
|
|
62
|
+
link: true,
|
|
63
|
+
__experimentalDefaultControls: {
|
|
64
|
+
background: true,
|
|
65
|
+
text: true,
|
|
66
|
+
link: true
|
|
67
|
+
}
|
|
68
|
+
},
|
|
69
|
+
spacing: {
|
|
70
|
+
margin: true,
|
|
71
|
+
padding: true
|
|
72
|
+
},
|
|
73
|
+
typography: {
|
|
74
|
+
fontSize: true,
|
|
75
|
+
lineHeight: true,
|
|
76
|
+
__experimentalFontFamily: true,
|
|
77
|
+
__experimentalFontWeight: true,
|
|
78
|
+
__experimentalFontStyle: true,
|
|
79
|
+
__experimentalTextTransform: true,
|
|
80
|
+
__experimentalTextDecoration: true,
|
|
81
|
+
__experimentalLetterSpacing: true,
|
|
82
|
+
__experimentalDefaultControls: {
|
|
83
|
+
fontSize: true
|
|
84
|
+
}
|
|
85
|
+
},
|
|
86
|
+
interactivity: {
|
|
87
|
+
clientNavigation: true
|
|
88
|
+
},
|
|
89
|
+
__experimentalBorder: {
|
|
90
|
+
radius: true,
|
|
91
|
+
color: true,
|
|
92
|
+
width: true,
|
|
93
|
+
style: true,
|
|
94
|
+
__experimentalDefaultControls: {
|
|
95
|
+
radius: true,
|
|
96
|
+
color: true,
|
|
97
|
+
width: true,
|
|
98
|
+
style: true
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
},
|
|
102
|
+
save() {
|
|
103
|
+
return null;
|
|
104
|
+
},
|
|
105
|
+
migrate: import_migrate_text_align.default,
|
|
106
|
+
isEligible(attributes) {
|
|
107
|
+
return !!attributes.textAlign || !!attributes.className?.match(
|
|
108
|
+
/\bhas-text-align-(left|center|right)\b/
|
|
109
|
+
);
|
|
110
|
+
}
|
|
111
|
+
};
|
|
38
112
|
var v3 = {
|
|
39
113
|
attributes: {
|
|
40
114
|
datetime: {
|
|
@@ -113,7 +187,7 @@ var v3 = {
|
|
|
113
187
|
},
|
|
114
188
|
...otherAttributes
|
|
115
189
|
}) {
|
|
116
|
-
return {
|
|
190
|
+
return (0, import_migrate_text_align.default)({
|
|
117
191
|
metadata: {
|
|
118
192
|
bindings: {
|
|
119
193
|
datetime: {
|
|
@@ -125,7 +199,7 @@ var v3 = {
|
|
|
125
199
|
...otherMetadata
|
|
126
200
|
},
|
|
127
201
|
...otherAttributes
|
|
128
|
-
};
|
|
202
|
+
});
|
|
129
203
|
},
|
|
130
204
|
isEligible(attributes) {
|
|
131
205
|
return attributes?.metadata?.bindings?.datetime?.source === "core/post-data" && !!attributes?.metadata?.bindings?.datetime?.args?.key;
|
|
@@ -204,7 +278,7 @@ var v2 = {
|
|
|
204
278
|
"wp-block-post-date__modified-date"
|
|
205
279
|
);
|
|
206
280
|
}
|
|
207
|
-
return {
|
|
281
|
+
return (0, import_migrate_text_align.default)({
|
|
208
282
|
...otherAttributes,
|
|
209
283
|
className,
|
|
210
284
|
metadata: {
|
|
@@ -216,7 +290,7 @@ var v2 = {
|
|
|
216
290
|
}
|
|
217
291
|
}
|
|
218
292
|
}
|
|
219
|
-
};
|
|
293
|
+
});
|
|
220
294
|
}
|
|
221
295
|
},
|
|
222
296
|
isEligible(attributes) {
|
|
@@ -255,10 +329,12 @@ var v1 = {
|
|
|
255
329
|
save() {
|
|
256
330
|
return null;
|
|
257
331
|
},
|
|
258
|
-
migrate
|
|
332
|
+
migrate(attributes) {
|
|
333
|
+
return (0, import_migrate_text_align.default)((0, import_migrate_font_family.default)(attributes));
|
|
334
|
+
},
|
|
259
335
|
isEligible({ style }) {
|
|
260
336
|
return style?.typography?.fontFamily;
|
|
261
337
|
}
|
|
262
338
|
};
|
|
263
|
-
var deprecated_default = [v3, v2, v1];
|
|
339
|
+
var deprecated_default = [v4, v3, v2, v1];
|
|
264
340
|
//# sourceMappingURL=deprecated.cjs.map
|
|
@@ -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 (\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
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,kBAAiB;AAKjB,iCAA8B;
|
|
6
|
-
"names": ["clsx", "migrateFontFamily"]
|
|
4
|
+
"sourcesContent": ["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * Internal dependencies\n */\nimport migrateFontFamily from '../utils/migrate-font-family';\nimport migrateTextAlign from '../utils/migrate-text-align';\n\nconst v4 = {\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\tanchor: true,\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: migrateTextAlign,\n\tisEligible( attributes ) {\n\t\treturn (\n\t\t\t!! attributes.textAlign ||\n\t\t\t!! attributes.className?.match(\n\t\t\t\t/\\bhas-text-align-(left|center|right)\\b/\n\t\t\t)\n\t\t);\n\t},\n};\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 migrateTextAlign( {\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 migrateTextAlign( {\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( attributes ) {\n\t\treturn migrateTextAlign( migrateFontFamily( attributes ) );\n\t},\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 [ v4, v3, v2, v1 ];\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,kBAAiB;AAKjB,iCAA8B;AAC9B,gCAA6B;AAE7B,IAAM,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,QAAQ;AAAA,IACR,MAAM;AAAA,IACN,OAAO;AAAA,MACN,WAAW;AAAA,MACX,MAAM;AAAA,MACN,+BAA+B;AAAA,QAC9B,YAAY;AAAA,QACZ,MAAM;AAAA,QACN,MAAM;AAAA,MACP;AAAA,IACD;AAAA,IACA,SAAS;AAAA,MACR,QAAQ;AAAA,MACR,SAAS;AAAA,IACV;AAAA,IACA,YAAY;AAAA,MACX,UAAU;AAAA,MACV,YAAY;AAAA,MACZ,0BAA0B;AAAA,MAC1B,0BAA0B;AAAA,MAC1B,yBAAyB;AAAA,MACzB,6BAA6B;AAAA,MAC7B,8BAA8B;AAAA,MAC9B,6BAA6B;AAAA,MAC7B,+BAA+B;AAAA,QAC9B,UAAU;AAAA,MACX;AAAA,IACD;AAAA,IACA,eAAe;AAAA,MACd,kBAAkB;AAAA,IACnB;AAAA,IACA,sBAAsB;AAAA,MACrB,QAAQ;AAAA,MACR,OAAO;AAAA,MACP,OAAO;AAAA,MACP,OAAO;AAAA,MACP,+BAA+B;AAAA,QAC9B,QAAQ;AAAA,QACR,OAAO;AAAA,QACP,OAAO;AAAA,QACP,O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AU;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,QAAS,YAAa;AACrB,eAAO,0BAAAA,aAAkB,2BAAAE,SAAmB,UAAW,CAAE;AAAA,EAC1D;AAAA,EACA,WAAY,EAAE,MAAM,GAAI;AACvB,WAAO,OAAO,YAAY;AAAA,EAC3B;AACD;AAUA,IAAO,qBAAQ,CAAE,IAAI,IAAI,IAAI,EAAG;",
|
|
6
|
+
"names": ["migrateTextAlign", "clsx", "migrateFontFamily"]
|
|
7
7
|
}
|
package/build/post-date/edit.cjs
CHANGED
|
@@ -34,7 +34,6 @@ __export(edit_exports, {
|
|
|
34
34
|
is12HourFormat: () => is12HourFormat
|
|
35
35
|
});
|
|
36
36
|
module.exports = __toCommonJS(edit_exports);
|
|
37
|
-
var import_clsx = __toESM(require("clsx"));
|
|
38
37
|
var import_core_data = require("@wordpress/core-data");
|
|
39
38
|
var import_element = require("@wordpress/element");
|
|
40
39
|
var import_date = require("@wordpress/date");
|
|
@@ -46,19 +45,18 @@ var import_keycodes = require("@wordpress/keycodes");
|
|
|
46
45
|
var import_data = require("@wordpress/data");
|
|
47
46
|
var import_blocks = require("@wordpress/blocks");
|
|
48
47
|
var import_hooks = require("../utils/hooks.cjs");
|
|
48
|
+
var import_deprecated_text_align_attributes = __toESM(require("../utils/deprecated-text-align-attributes.cjs"));
|
|
49
49
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
50
|
-
function PostDateEdit({
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
})
|
|
61
|
-
});
|
|
50
|
+
function PostDateEdit(props) {
|
|
51
|
+
const {
|
|
52
|
+
attributes,
|
|
53
|
+
context: { postType: postTypeSlug, queryId },
|
|
54
|
+
setAttributes,
|
|
55
|
+
name
|
|
56
|
+
} = props;
|
|
57
|
+
(0, import_deprecated_text_align_attributes.default)(props);
|
|
58
|
+
const { datetime, format, isLink } = attributes;
|
|
59
|
+
const blockProps = (0, import_block_editor.useBlockProps)();
|
|
62
60
|
const dropdownMenuProps = (0, import_hooks.useToolsPanelDropdownMenuProps)();
|
|
63
61
|
const [popoverAnchor, setPopoverAnchor] = (0, import_element.useState)(null);
|
|
64
62
|
const popoverProps = (0, import_element.useMemo)(
|
|
@@ -107,59 +105,48 @@ function PostDateEdit({
|
|
|
107
105
|
);
|
|
108
106
|
}
|
|
109
107
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
110
|
-
(blockEditingMode === "default" || !isDescendentOfQueryLoop) && /* @__PURE__ */ (0, import_jsx_runtime.
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
108
|
+
(blockEditingMode === "default" || !isDescendentOfQueryLoop) && activeBlockVariationName !== "post-date-modified" && (!isDescendentOfQueryLoop || !activeBlockVariationName) && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_block_editor.BlockControls, { group: "block", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_components.ToolbarGroup, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
109
|
+
import_components.Dropdown,
|
|
110
|
+
{
|
|
111
|
+
popoverProps,
|
|
112
|
+
renderContent: ({ onClose }) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
113
|
+
import_block_editor.__experimentalPublishDateTimePicker,
|
|
114
|
+
{
|
|
115
|
+
title: activeBlockVariationName === "post-date" ? (0, import_i18n.__)("Publish Date") : (0, import_i18n.__)("Date"),
|
|
116
|
+
currentDate: datetime,
|
|
117
|
+
onChange: (newDatetime) => setAttributes({
|
|
118
|
+
datetime: newDatetime
|
|
119
|
+
}),
|
|
120
|
+
is12Hour: is12HourFormat(
|
|
121
|
+
siteTimeFormat
|
|
122
|
+
),
|
|
123
|
+
onClose,
|
|
124
|
+
dateOrder: (
|
|
125
|
+
/* translators: Order of day, month, and year. Available formats are 'dmy', 'mdy', and 'ymd'. */
|
|
126
|
+
(0, import_i18n._x)("dmy", "date order")
|
|
127
|
+
)
|
|
117
128
|
}
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
129
|
+
),
|
|
130
|
+
renderToggle: ({ isOpen, onToggle }) => {
|
|
131
|
+
const openOnArrowDown = (event) => {
|
|
132
|
+
if (!isOpen && event.keyCode === import_keycodes.DOWN) {
|
|
133
|
+
event.preventDefault();
|
|
134
|
+
onToggle();
|
|
135
|
+
}
|
|
136
|
+
};
|
|
137
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
138
|
+
import_components.ToolbarButton,
|
|
126
139
|
{
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
is12Hour: is12HourFormat(
|
|
133
|
-
siteTimeFormat
|
|
134
|
-
),
|
|
135
|
-
onClose,
|
|
136
|
-
dateOrder: (
|
|
137
|
-
/* translators: Order of day, month, and year. Available formats are 'dmy', 'mdy', and 'ymd'. */
|
|
138
|
-
(0, import_i18n._x)("dmy", "date order")
|
|
139
|
-
)
|
|
140
|
+
"aria-expanded": isOpen,
|
|
141
|
+
icon: import_icons.pencil,
|
|
142
|
+
title: (0, import_i18n.__)("Change Date"),
|
|
143
|
+
onClick: onToggle,
|
|
144
|
+
onKeyDown: openOnArrowDown
|
|
140
145
|
}
|
|
141
|
-
)
|
|
142
|
-
renderToggle: ({ isOpen, onToggle }) => {
|
|
143
|
-
const openOnArrowDown = (event) => {
|
|
144
|
-
if (!isOpen && event.keyCode === import_keycodes.DOWN) {
|
|
145
|
-
event.preventDefault();
|
|
146
|
-
onToggle();
|
|
147
|
-
}
|
|
148
|
-
};
|
|
149
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
150
|
-
import_components.ToolbarButton,
|
|
151
|
-
{
|
|
152
|
-
"aria-expanded": isOpen,
|
|
153
|
-
icon: import_icons.pencil,
|
|
154
|
-
title: (0, import_i18n.__)("Change Date"),
|
|
155
|
-
onClick: onToggle,
|
|
156
|
-
onKeyDown: openOnArrowDown
|
|
157
|
-
}
|
|
158
|
-
);
|
|
159
|
-
}
|
|
146
|
+
);
|
|
160
147
|
}
|
|
161
|
-
|
|
162
|
-
|
|
148
|
+
}
|
|
149
|
+
) }) }),
|
|
163
150
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_block_editor.InspectorControls, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
164
151
|
import_components.__experimentalToolsPanel,
|
|
165
152
|
{
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/post-date/edit.js"],
|
|
4
|
-
"sourcesContent": ["/**\n *
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,
|
|
6
|
-
"names": ["
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { store as coreStore } from '@wordpress/core-data';\nimport { useEffect, useMemo, useState } from '@wordpress/element';\nimport {\n\tdateI18n,\n\thumanTimeDiff,\n\tgetSettings as getDateSettings,\n} from '@wordpress/date';\nimport {\n\tBlockControls,\n\tInspectorControls,\n\tstore as blockEditorStore,\n\tuseBlockProps,\n\tuseBlockEditingMode,\n\t__experimentalDateFormatPicker as DateFormatPicker,\n\t__experimentalPublishDateTimePicker as PublishDateTimePicker,\n} from '@wordpress/block-editor';\nimport {\n\tDropdown,\n\tToolbarGroup,\n\tToolbarButton,\n\tToggleControl,\n\t__experimentalToolsPanel as ToolsPanel,\n\t__experimentalToolsPanelItem as ToolsPanelItem,\n} from '@wordpress/components';\nimport { __, _x, sprintf } from '@wordpress/i18n';\nimport { pencil } from '@wordpress/icons';\nimport { DOWN } from '@wordpress/keycodes';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { store as blocksStore } from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport { useToolsPanelDropdownMenuProps } from '../utils/hooks';\nimport useDeprecatedTextAlign from '../utils/deprecated-text-align-attributes';\n\nexport default function PostDateEdit( props ) {\n\tconst {\n\t\tattributes,\n\t\tcontext: { postType: postTypeSlug, queryId },\n\t\tsetAttributes,\n\t\tname,\n\t} = props;\n\tuseDeprecatedTextAlign( props );\n\tconst { datetime, format, isLink } = attributes;\n\tconst blockProps = useBlockProps();\n\tconst dropdownMenuProps = useToolsPanelDropdownMenuProps();\n\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\t// Memoize popoverProps to avoid returning a new object every time.\n\tconst popoverProps = useMemo(\n\t\t() => ( { anchor: popoverAnchor } ),\n\t\t[ popoverAnchor ]\n\t);\n\n\tconst { __unstableMarkNextChangeAsNotPersistent } =\n\t\tuseDispatch( blockEditorStore );\n\n\t// We need to set the datetime to a default value upon first loading\n\t// to discern the block from its legacy version (which would default\n\t// to the containing post's publish date).\n\tuseEffect( () => {\n\t\tif ( datetime === undefined ) {\n\t\t\t__unstableMarkNextChangeAsNotPersistent();\n\t\t\tsetAttributes( { datetime: new Date() } );\n\t\t}\n\t}, [ datetime ] );\n\n\tconst isDescendentOfQueryLoop = Number.isFinite( queryId );\n\tconst dateSettings = getDateSettings();\n\n\tconst {\n\t\tpostType,\n\t\tsiteFormat = dateSettings.formats.date,\n\t\tsiteTimeFormat = dateSettings.formats.time,\n\t} = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getPostType, getEntityRecord } = select( coreStore );\n\t\t\tconst siteSettings = getEntityRecord( 'root', 'site' );\n\t\t\treturn {\n\t\t\t\tsiteFormat: siteSettings?.date_format,\n\t\t\t\tsiteTimeFormat: siteSettings?.time_format,\n\t\t\t\tpostType: postTypeSlug ? getPostType( postTypeSlug ) : null,\n\t\t\t};\n\t\t},\n\t\t[ postTypeSlug ]\n\t);\n\tconst activeBlockVariationName = useSelect(\n\t\t( select ) =>\n\t\t\tselect( blocksStore ).getActiveBlockVariation( name, attributes )\n\t\t\t\t?.name,\n\t\t[ name, attributes ]\n\t);\n\n\tconst blockEditingMode = useBlockEditingMode();\n\n\tlet postDate = (\n\t\t<time dateTime={ dateI18n( 'c', datetime ) } ref={ setPopoverAnchor }>\n\t\t\t{ format === 'human-diff'\n\t\t\t\t? humanTimeDiff( datetime )\n\t\t\t\t: dateI18n( format || siteFormat, datetime ) }\n\t\t</time>\n\t);\n\n\tif ( isLink && datetime ) {\n\t\tpostDate = (\n\t\t\t<a\n\t\t\t\thref=\"#post-date-pseudo-link\"\n\t\t\t\tonClick={ ( event ) => event.preventDefault() }\n\t\t\t>\n\t\t\t\t{ postDate }\n\t\t\t</a>\n\t\t);\n\t}\n\treturn (\n\t\t<>\n\t\t\t{ ( blockEditingMode === 'default' || ! isDescendentOfQueryLoop ) &&\n\t\t\t\tactiveBlockVariationName !== 'post-date-modified' &&\n\t\t\t\t( ! isDescendentOfQueryLoop || ! activeBlockVariationName ) && (\n\t\t\t\t\t<BlockControls group=\"block\">\n\t\t\t\t\t\t<ToolbarGroup>\n\t\t\t\t\t\t\t<Dropdown\n\t\t\t\t\t\t\t\tpopoverProps={ popoverProps }\n\t\t\t\t\t\t\t\trenderContent={ ( { onClose } ) => (\n\t\t\t\t\t\t\t\t\t<PublishDateTimePicker\n\t\t\t\t\t\t\t\t\t\ttitle={\n\t\t\t\t\t\t\t\t\t\t\tactiveBlockVariationName ===\n\t\t\t\t\t\t\t\t\t\t\t'post-date'\n\t\t\t\t\t\t\t\t\t\t\t\t? __( 'Publish Date' )\n\t\t\t\t\t\t\t\t\t\t\t\t: __( 'Date' )\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\tcurrentDate={ datetime }\n\t\t\t\t\t\t\t\t\t\tonChange={ ( newDatetime ) =>\n\t\t\t\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\t\t\t\tdatetime: newDatetime,\n\t\t\t\t\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\tis12Hour={ is12HourFormat(\n\t\t\t\t\t\t\t\t\t\t\tsiteTimeFormat\n\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\tonClose={ onClose }\n\t\t\t\t\t\t\t\t\t\tdateOrder={\n\t\t\t\t\t\t\t\t\t\t\t/* translators: Order of day, month, and year. Available formats are 'dmy', 'mdy', and 'ymd'. */\n\t\t\t\t\t\t\t\t\t\t\t_x( 'dmy', 'date order' )\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\trenderToggle={ ( { isOpen, onToggle } ) => {\n\t\t\t\t\t\t\t\t\tconst openOnArrowDown = ( event ) => {\n\t\t\t\t\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t\t\t\t\t! isOpen &&\n\t\t\t\t\t\t\t\t\t\t\tevent.keyCode === DOWN\n\t\t\t\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\t\t\t\t\t\t\tonToggle();\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t};\n\t\t\t\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t\t\t\t<ToolbarButton\n\t\t\t\t\t\t\t\t\t\t\taria-expanded={ isOpen }\n\t\t\t\t\t\t\t\t\t\t\ticon={ pencil }\n\t\t\t\t\t\t\t\t\t\t\ttitle={ __( 'Change Date' ) }\n\t\t\t\t\t\t\t\t\t\t\tonClick={ onToggle }\n\t\t\t\t\t\t\t\t\t\t\tonKeyDown={ openOnArrowDown }\n\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</ToolbarGroup>\n\t\t\t\t\t</BlockControls>\n\t\t\t\t) }\n\n\t\t\t<InspectorControls>\n\t\t\t\t<ToolsPanel\n\t\t\t\t\tlabel={ __( 'Settings' ) }\n\t\t\t\t\tresetAll={ () => {\n\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\tdatetime: undefined,\n\t\t\t\t\t\t\tformat: undefined,\n\t\t\t\t\t\t\tisLink: false,\n\t\t\t\t\t\t} );\n\t\t\t\t\t} }\n\t\t\t\t\tdropdownMenuProps={ dropdownMenuProps }\n\t\t\t\t>\n\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\thasValue={ () => !! format }\n\t\t\t\t\t\tlabel={ __( 'Date Format' ) }\n\t\t\t\t\t\tonDeselect={ () =>\n\t\t\t\t\t\t\tsetAttributes( { format: undefined } )\n\t\t\t\t\t\t}\n\t\t\t\t\t\tisShownByDefault\n\t\t\t\t\t>\n\t\t\t\t\t\t<DateFormatPicker\n\t\t\t\t\t\t\tformat={ format }\n\t\t\t\t\t\t\tdefaultFormat={ siteFormat }\n\t\t\t\t\t\t\tonChange={ ( nextFormat ) =>\n\t\t\t\t\t\t\t\tsetAttributes( { format: nextFormat } )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t/>\n\t\t\t\t\t</ToolsPanelItem>\n\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\thasValue={ () => isLink !== false }\n\t\t\t\t\t\tlabel={\n\t\t\t\t\t\t\tpostType?.labels.singular_name\n\t\t\t\t\t\t\t\t? sprintf(\n\t\t\t\t\t\t\t\t\t\t// translators: %s: Name of the post type e.g: \"post\".\n\t\t\t\t\t\t\t\t\t\t__( 'Link to %s' ),\n\t\t\t\t\t\t\t\t\t\tpostType.labels.singular_name.toLowerCase()\n\t\t\t\t\t\t\t\t )\n\t\t\t\t\t\t\t\t: __( 'Link to post' )\n\t\t\t\t\t\t}\n\t\t\t\t\t\tonDeselect={ () => setAttributes( { isLink: false } ) }\n\t\t\t\t\t\tisShownByDefault\n\t\t\t\t\t>\n\t\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\t\tlabel={\n\t\t\t\t\t\t\t\tpostType?.labels.singular_name\n\t\t\t\t\t\t\t\t\t? sprintf(\n\t\t\t\t\t\t\t\t\t\t\t// translators: %s: Name of the post type e.g: \"post\".\n\t\t\t\t\t\t\t\t\t\t\t__( 'Link to %s' ),\n\t\t\t\t\t\t\t\t\t\t\tpostType.labels.singular_name.toLowerCase()\n\t\t\t\t\t\t\t\t\t )\n\t\t\t\t\t\t\t\t\t: __( 'Link to post' )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tonChange={ () =>\n\t\t\t\t\t\t\t\tsetAttributes( { isLink: ! isLink } )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tchecked={ isLink }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</ToolsPanelItem>\n\t\t\t\t</ToolsPanel>\n\t\t\t</InspectorControls>\n\n\t\t\t<div { ...blockProps }>{ postDate }</div>\n\t\t</>\n\t);\n}\n\nexport function is12HourFormat( format ) {\n\t// To know if the time format is a 12 hour time, look for any of the 12 hour\n\t// format characters: 'a', 'A', 'g', and 'h'. The character must be\n\t// unescaped, i.e. not preceded by a '\\'. Coincidentally, 'aAgh' is how I\n\t// feel when working with regular expressions.\n\t// https://www.php.net/manual/en/datetime.format.php\n\treturn /(?:^|[^\\\\])[a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a;AAAA,oBACjB,SAAS,OAAO,cAAc,YAAY;AAAA,kBAC1C,QACA,gBAAI,cAAe;AAAA,kBAEvB,UAAW,MACV,cAAe,EAAE,QAAQ,CAAE,OAAO,CAAE;AAAA,kBAErC,SAAU;AAAA;AAAA,cACX;AAAA;AAAA,UACD;AAAA;AAAA;AAAA,IACD,GACD;AAAA,IAEA,4CAAC,SAAM,GAAG,YAAe,oBAAU;AAAA,KACpC;AAEF;AAEO,SAAS,eAAgB,QAAS;AAMxC,SAAO,oBAAoB,KAAM,MAAO;AACzC;",
|
|
6
|
+
"names": ["useDeprecatedTextAlign", "blockEditorStore", "getDateSettings", "coreStore", "blocksStore", "PublishDateTimePicker", "ToolsPanel", "ToolsPanelItem", "DateFormatPicker"]
|
|
7
7
|
}
|
package/build/site-logo/edit.cjs
CHANGED
|
@@ -46,9 +46,11 @@ var import_icons = require("@wordpress/icons");
|
|
|
46
46
|
var import_notices = require("@wordpress/notices");
|
|
47
47
|
var import_constants = require("../image/constants.cjs");
|
|
48
48
|
var import_media_control = require("../utils/media-control.cjs");
|
|
49
|
+
var import_lock_unlock = require("../lock-unlock.cjs");
|
|
49
50
|
var import_hooks = require("../utils/hooks.cjs");
|
|
50
51
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
51
52
|
var ALLOWED_MEDIA_TYPES = ["image"];
|
|
53
|
+
var { mediaEditKey } = (0, import_lock_unlock.unlock)(import_block_editor.privateApis);
|
|
52
54
|
var SiteLogo = ({
|
|
53
55
|
alt,
|
|
54
56
|
attributes: { align, width, height, isLink, linkTarget, shouldSyncIcon },
|
|
@@ -71,18 +73,22 @@ var SiteLogo = ({
|
|
|
71
73
|
const dropdownMenuProps = (0, import_hooks.useToolsPanelDropdownMenuProps)();
|
|
72
74
|
const blockEditingMode = (0, import_block_editor.useBlockEditingMode)();
|
|
73
75
|
const isContentOnlyMode = blockEditingMode === "contentOnly";
|
|
74
|
-
const { imageEditing, maxWidth, title } = (0, import_data.useSelect)(
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
76
|
+
const { imageEditing, maxWidth, title, editMediaEntity } = (0, import_data.useSelect)(
|
|
77
|
+
(select) => {
|
|
78
|
+
const settings = select(import_block_editor.store).getSettings();
|
|
79
|
+
const siteEntities = select(import_core_data.store).getEntityRecord(
|
|
80
|
+
"root",
|
|
81
|
+
"__unstableBase"
|
|
82
|
+
);
|
|
83
|
+
return {
|
|
84
|
+
title: siteEntities?.name,
|
|
85
|
+
imageEditing: settings.imageEditing,
|
|
86
|
+
maxWidth: settings.maxWidth,
|
|
87
|
+
editMediaEntity: settings?.[mediaEditKey]
|
|
88
|
+
};
|
|
89
|
+
},
|
|
90
|
+
[]
|
|
91
|
+
);
|
|
86
92
|
(0, import_element.useEffect)(() => {
|
|
87
93
|
if (shouldSyncIcon && logoId !== iconId) {
|
|
88
94
|
setAttributes({ shouldSyncIcon: false });
|
|
@@ -158,7 +164,7 @@ var SiteLogo = ({
|
|
|
158
164
|
showRightHandle = true;
|
|
159
165
|
}
|
|
160
166
|
}
|
|
161
|
-
const canEditImage = logoId && naturalWidth && naturalHeight && imageEditing;
|
|
167
|
+
const canEditImage = logoId && naturalWidth && naturalHeight && imageEditing && !!editMediaEntity;
|
|
162
168
|
const shouldShowCropAndDimensions = !isContentOnlyMode;
|
|
163
169
|
let imgEdit;
|
|
164
170
|
if (canEditImage && isEditingImage) {
|