@wordpress/block-library 10.2.0 → 10.3.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 +16 -0
- package/build/accordion-panel/block.json +1 -0
- package/build/code/edit.cjs +3 -1
- package/build/code/edit.cjs.map +2 -2
- package/build/cover/block.json +1 -0
- package/build/cover/edit/block-controls.cjs +3 -1
- package/build/cover/edit/block-controls.cjs.map +2 -2
- package/build/cover/edit/index.cjs +75 -31
- package/build/cover/edit/index.cjs.map +2 -2
- package/build/embed/edit.cjs +1 -1
- package/build/embed/edit.cjs.map +2 -2
- package/build/embed/embed-placeholder.cjs +1 -1
- package/build/embed/embed-placeholder.cjs.map +2 -2
- package/build/gallery/dynamic-gallery.cjs +104 -61
- package/build/gallery/dynamic-gallery.cjs.map +3 -3
- package/build/gallery/use-dynamic-gallery.cjs +15 -8
- package/build/gallery/use-dynamic-gallery.cjs.map +2 -2
- package/build/heading/edit.cjs +1 -1
- package/build/heading/edit.cjs.map +2 -2
- package/build/html/modal.cjs +63 -54
- package/build/html/modal.cjs.map +3 -3
- package/build/icon/block.json +5 -3
- package/build/image/edit.cjs +1 -1
- package/build/image/edit.cjs.map +2 -2
- package/build/image/image.cjs +29 -5
- package/build/image/image.cjs.map +3 -3
- package/build/image/use-open-image-media-editor-modal.cjs +6 -2
- package/build/image/use-open-image-media-editor-modal.cjs.map +2 -2
- package/build/list-item/hooks/use-indent-list-item.cjs +10 -2
- package/build/list-item/hooks/use-indent-list-item.cjs.map +2 -2
- package/build/math/edit.cjs +39 -56
- package/build/math/edit.cjs.map +3 -3
- package/build/media-text/edit.cjs +2 -1
- package/build/media-text/edit.cjs.map +2 -2
- package/build/more/edit.cjs +2 -2
- package/build/more/edit.cjs.map +2 -2
- package/build/navigation/edit/index.cjs +30 -16
- package/build/navigation/edit/index.cjs.map +3 -3
- package/build/navigation/edit/use-layout-custom-properties.cjs +72 -0
- package/build/navigation/edit/use-layout-custom-properties.cjs.map +7 -0
- package/build/navigation/view.cjs +9 -6
- package/build/navigation/view.cjs.map +2 -2
- package/build/navigation-link/edit.cjs +3 -3
- package/build/navigation-link/edit.cjs.map +2 -2
- package/build/navigation-link/link-ui/index.cjs +2 -2
- package/build/navigation-link/link-ui/index.cjs.map +2 -2
- package/build/paragraph/block.json +0 -1
- package/build/paragraph/edit.cjs +5 -2
- package/build/paragraph/edit.cjs.map +3 -3
- package/build/paragraph/index.cjs +4 -1
- package/build/paragraph/index.cjs.map +2 -2
- package/build/playlist/context.cjs +2 -1
- package/build/playlist/context.cjs.map +2 -2
- package/build/playlist/edit.cjs +113 -26
- package/build/playlist/edit.cjs.map +2 -2
- package/build/playlist/utils.cjs +19 -4
- package/build/playlist/utils.cjs.map +2 -2
- package/build/playlist-track/edit.cjs +21 -6
- package/build/playlist-track/edit.cjs.map +2 -2
- package/build/post-content/edit.cjs +36 -15
- package/build/post-content/edit.cjs.map +2 -2
- package/build/post-featured-image/edit.cjs +3 -2
- package/build/post-featured-image/edit.cjs.map +2 -2
- package/build/post-terms/edit.cjs +2 -2
- package/build/post-terms/edit.cjs.map +2 -2
- package/build/post-title/edit.cjs +2 -2
- package/build/post-title/edit.cjs.map +2 -2
- package/build/preformatted/edit.cjs +3 -1
- package/build/preformatted/edit.cjs.map +2 -2
- package/build/pullquote/edit.cjs +5 -3
- package/build/pullquote/edit.cjs.map +2 -2
- package/build/query/edit/inspector-controls/index.cjs +4 -1
- package/build/query/edit/inspector-controls/index.cjs.map +2 -2
- package/build/query/edit/inspector-controls/offset-controls.cjs +1 -1
- package/build/query/edit/inspector-controls/offset-controls.cjs.map +2 -2
- package/build/read-more/edit.cjs +3 -1
- package/build/read-more/edit.cjs.map +2 -2
- package/build/site-tagline/edit.cjs +3 -1
- package/build/site-tagline/edit.cjs.map +2 -2
- package/build/site-title/edit.cjs +3 -1
- package/build/site-title/edit.cjs.map +2 -2
- package/build/social-links/edit.cjs +11 -4
- package/build/social-links/edit.cjs.map +2 -2
- package/build/tab-list/block.json +2 -1
- package/build/tab-list/edit.cjs +2 -0
- package/build/tab-list/edit.cjs.map +3 -3
- package/build/tab-list/tab-movers.cjs +87 -0
- package/build/tab-list/tab-movers.cjs.map +7 -0
- package/build/tab-panel/edit.cjs +1 -9
- package/build/tab-panel/edit.cjs.map +2 -2
- package/build/table/edit.cjs +1 -1
- package/build/table/edit.cjs.map +2 -2
- package/build/tabs/use-tab-actions.cjs +23 -1
- package/build/tabs/use-tab-actions.cjs.map +2 -2
- package/build/utils/caption.cjs +2 -2
- package/build/utils/caption.cjs.map +2 -2
- package/build/verse/edit.cjs +3 -1
- package/build/verse/edit.cjs.map +2 -2
- package/build/video/tracks-editor.cjs +0 -1
- package/build/video/tracks-editor.cjs.map +2 -2
- package/build-module/accordion-panel/block.json +1 -0
- package/build-module/code/edit.mjs +3 -1
- package/build-module/code/edit.mjs.map +2 -2
- package/build-module/cover/block.json +1 -0
- package/build-module/cover/edit/block-controls.mjs +3 -1
- package/build-module/cover/edit/block-controls.mjs.map +2 -2
- package/build-module/cover/edit/index.mjs +78 -34
- package/build-module/cover/edit/index.mjs.map +2 -2
- package/build-module/embed/edit.mjs +1 -1
- package/build-module/embed/edit.mjs.map +2 -2
- package/build-module/embed/embed-placeholder.mjs +1 -1
- package/build-module/embed/embed-placeholder.mjs.map +2 -2
- package/build-module/gallery/dynamic-gallery.mjs +104 -61
- package/build-module/gallery/dynamic-gallery.mjs.map +2 -2
- package/build-module/gallery/use-dynamic-gallery.mjs +16 -9
- package/build-module/gallery/use-dynamic-gallery.mjs.map +2 -2
- package/build-module/heading/edit.mjs +1 -1
- package/build-module/heading/edit.mjs.map +2 -2
- package/build-module/html/modal.mjs +68 -55
- package/build-module/html/modal.mjs.map +2 -2
- package/build-module/icon/block.json +5 -3
- package/build-module/image/edit.mjs +1 -1
- package/build-module/image/edit.mjs.map +2 -2
- package/build-module/image/image.mjs +19 -5
- package/build-module/image/image.mjs.map +2 -2
- package/build-module/image/use-open-image-media-editor-modal.mjs +6 -2
- package/build-module/image/use-open-image-media-editor-modal.mjs.map +2 -2
- package/build-module/list-item/hooks/use-indent-list-item.mjs +10 -2
- package/build-module/list-item/hooks/use-indent-list-item.mjs.map +2 -2
- package/build-module/math/edit.mjs +41 -60
- package/build-module/math/edit.mjs.map +2 -2
- package/build-module/media-text/edit.mjs +2 -1
- package/build-module/media-text/edit.mjs.map +2 -2
- package/build-module/more/edit.mjs +2 -2
- package/build-module/more/edit.mjs.map +2 -2
- package/build-module/navigation/edit/index.mjs +30 -16
- package/build-module/navigation/edit/index.mjs.map +2 -2
- package/build-module/navigation/edit/use-layout-custom-properties.mjs +51 -0
- package/build-module/navigation/edit/use-layout-custom-properties.mjs.map +7 -0
- package/build-module/navigation/view.mjs +9 -6
- package/build-module/navigation/view.mjs.map +2 -2
- package/build-module/navigation-link/edit.mjs +3 -3
- package/build-module/navigation-link/edit.mjs.map +2 -2
- package/build-module/navigation-link/link-ui/index.mjs +2 -2
- package/build-module/navigation-link/link-ui/index.mjs.map +2 -2
- package/build-module/paragraph/block.json +0 -1
- package/build-module/paragraph/edit.mjs +6 -2
- package/build-module/paragraph/edit.mjs.map +2 -2
- package/build-module/paragraph/index.mjs +4 -1
- package/build-module/paragraph/index.mjs.map +2 -2
- package/build-module/playlist/context.mjs +2 -1
- package/build-module/playlist/context.mjs.map +2 -2
- package/build-module/playlist/edit.mjs +113 -27
- package/build-module/playlist/edit.mjs.map +2 -2
- package/build-module/playlist/utils.mjs +19 -4
- package/build-module/playlist/utils.mjs.map +2 -2
- package/build-module/playlist-track/edit.mjs +21 -6
- package/build-module/playlist-track/edit.mjs.map +2 -2
- package/build-module/post-content/edit.mjs +37 -15
- package/build-module/post-content/edit.mjs.map +2 -2
- package/build-module/post-featured-image/edit.mjs +3 -2
- package/build-module/post-featured-image/edit.mjs.map +2 -2
- package/build-module/post-terms/edit.mjs +2 -2
- package/build-module/post-terms/edit.mjs.map +2 -2
- package/build-module/post-title/edit.mjs +2 -2
- package/build-module/post-title/edit.mjs.map +2 -2
- package/build-module/preformatted/edit.mjs +3 -1
- package/build-module/preformatted/edit.mjs.map +2 -2
- package/build-module/pullquote/edit.mjs +5 -3
- package/build-module/pullquote/edit.mjs.map +2 -2
- package/build-module/query/edit/inspector-controls/index.mjs +5 -2
- package/build-module/query/edit/inspector-controls/index.mjs.map +2 -2
- package/build-module/query/edit/inspector-controls/offset-controls.mjs +2 -2
- package/build-module/query/edit/inspector-controls/offset-controls.mjs.map +2 -2
- package/build-module/read-more/edit.mjs +3 -1
- package/build-module/read-more/edit.mjs.map +2 -2
- package/build-module/site-tagline/edit.mjs +3 -1
- package/build-module/site-tagline/edit.mjs.map +2 -2
- package/build-module/site-title/edit.mjs +3 -1
- package/build-module/site-title/edit.mjs.map +2 -2
- package/build-module/social-links/edit.mjs +11 -4
- package/build-module/social-links/edit.mjs.map +2 -2
- package/build-module/tab-list/block.json +2 -1
- package/build-module/tab-list/edit.mjs +2 -0
- package/build-module/tab-list/edit.mjs.map +2 -2
- package/build-module/tab-list/tab-movers.mjs +59 -0
- package/build-module/tab-list/tab-movers.mjs.map +7 -0
- package/build-module/tab-panel/edit.mjs +1 -9
- package/build-module/tab-panel/edit.mjs.map +2 -2
- package/build-module/table/edit.mjs +1 -1
- package/build-module/table/edit.mjs.map +2 -2
- package/build-module/tabs/use-tab-actions.mjs +23 -1
- package/build-module/tabs/use-tab-actions.mjs.map +2 -2
- package/build-module/utils/caption.mjs +2 -2
- package/build-module/utils/caption.mjs.map +2 -2
- package/build-module/verse/edit.mjs +3 -1
- package/build-module/verse/edit.mjs.map +2 -2
- package/build-module/video/tracks-editor.mjs +0 -1
- package/build-module/video/tracks-editor.mjs.map +2 -2
- package/build-style/cover/editor-rtl.css +3 -0
- package/build-style/cover/editor.css +3 -0
- package/build-style/editor-rtl.css +18 -41
- package/build-style/editor.css +18 -41
- package/build-style/icon/editor-rtl.css +1 -4
- package/build-style/icon/editor.css +1 -4
- package/build-style/image/editor-rtl.css +3 -32
- package/build-style/image/editor.css +3 -32
- package/build-style/playlist/editor-rtl.css +0 -5
- package/build-style/playlist/editor.css +0 -5
- package/build-style/playlist/style-rtl.css +44 -4
- package/build-style/playlist/style.css +44 -4
- package/build-style/pullquote/editor-rtl.css +4 -0
- package/build-style/pullquote/editor.css +4 -0
- package/build-style/style-rtl.css +44 -4
- package/build-style/style.css +44 -4
- package/build-style/tab-list/editor-rtl.css +101 -0
- package/build-style/tab-list/editor.css +101 -0
- package/package.json +43 -43
- package/src/accordion-panel/block.json +1 -0
- package/src/breadcrumbs/index.php +3 -1
- package/src/button/index.php +1 -1
- package/src/code/edit.js +7 -2
- package/src/cover/block.json +1 -0
- package/src/cover/edit/block-controls.js +5 -0
- package/src/cover/edit/index.js +100 -35
- package/src/cover/editor.scss +6 -0
- package/src/cover/index.php +9 -2
- package/src/editor.scss +1 -0
- package/src/embed/edit.js +3 -1
- package/src/embed/embed-placeholder.js +9 -7
- package/src/form/index.php +6 -4
- package/src/gallery/dynamic-gallery.js +133 -74
- package/src/gallery/use-dynamic-gallery.js +27 -12
- package/src/heading/edit.js +1 -1
- package/src/html/modal.js +13 -2
- package/src/icon/README.md +1 -3
- package/src/icon/block.json +5 -3
- package/src/icon/editor.scss +1 -4
- package/src/image/edit.js +1 -5
- package/src/image/editor.scss +6 -46
- package/src/image/image.js +37 -3
- package/src/image/test/use-open-image-media-editor-modal.js +37 -1
- package/src/image/use-open-image-media-editor-modal.js +8 -1
- package/src/latest-posts/index.php +3 -2
- package/src/list-item/hooks/use-indent-list-item.js +10 -1
- package/src/math/edit.js +42 -59
- package/src/media-text/edit.js +1 -0
- package/src/media-text/index.php +11 -2
- package/src/more/edit.js +7 -4
- package/src/navigation/edit/index.js +52 -36
- package/src/navigation/edit/test/layout-custom-properties.js +138 -0
- package/src/navigation/edit/use-layout-custom-properties.js +84 -0
- package/src/navigation/index.php +123 -12
- package/src/navigation/test/view.js +51 -0
- package/src/navigation/view.js +15 -14
- package/src/navigation-link/edit.js +11 -7
- package/src/navigation-link/index.php +64 -0
- package/src/navigation-link/link-ui/index.js +2 -1
- package/src/navigation-link/test/__snapshots__/hooks.js.snap +1 -1
- package/src/page-list/index.php +4 -3
- package/src/paragraph/README.md +0 -1
- package/src/paragraph/block.json +0 -1
- package/src/paragraph/edit.js +9 -2
- package/src/paragraph/index.js +4 -1
- package/src/pattern/index.php +5 -5
- package/src/playlist/context.js +1 -0
- package/src/playlist/edit.js +151 -47
- package/src/playlist/editor.scss +0 -7
- package/src/playlist/index.php +14 -9
- package/src/playlist/style.scss +3 -0
- package/src/playlist/test/edit-component.js +139 -0
- package/src/playlist/test/edit.js +30 -0
- package/src/playlist/utils.js +25 -4
- package/src/playlist-track/edit.js +22 -5
- package/src/playlist-track/index.php +8 -7
- package/src/playlist-track/test/edit.js +87 -3
- package/src/post-content/edit.js +45 -16
- package/src/post-excerpt/index.php +4 -1
- package/src/post-featured-image/edit.js +3 -2
- package/src/post-featured-image/index.php +4 -1
- package/src/post-terms/edit.js +7 -4
- package/src/post-title/edit.js +5 -3
- package/src/preformatted/edit.js +7 -2
- package/src/pullquote/edit.js +9 -4
- package/src/pullquote/editor.scss +6 -0
- package/src/query/edit/inspector-controls/index.js +5 -2
- package/src/query/edit/inspector-controls/offset-controls.js +2 -2
- package/src/read-more/edit.js +7 -2
- package/src/rss/index.php +9 -3
- package/src/site-tagline/edit.js +7 -2
- package/src/site-title/edit.js +7 -2
- package/src/social-link/index.php +19 -9
- package/src/social-links/edit.js +21 -12
- package/src/tab-list/block.json +2 -1
- package/src/tab-list/edit.js +2 -0
- package/src/tab-list/editor.scss +9 -0
- package/src/tab-list/tab-movers.js +72 -0
- package/src/tab-panel/edit.js +1 -9
- package/src/table/edit.js +1 -1
- package/src/table-of-contents/index.php +386 -1
- package/src/tabs/use-tab-actions.js +32 -3
- package/src/tag-cloud/index.php +3 -2
- package/src/template-part/index.php +2 -1
- package/src/utils/caption.js +7 -4
- package/src/utils/test/waveform-utils.js +63 -0
- package/src/verse/edit.js +7 -2
- package/src/video/index.php +2 -2
- package/src/video/tracks-editor.js +0 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/post-featured-image/edit.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { isBlobURL } from '@wordpress/blob';\nimport { useEntityProp, store as coreStore } from '@wordpress/core-data';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport {\n\tToggleControl,\n\tPlaceholder,\n\tButton,\n\tSpinner,\n\tTextControl,\n\tExternalLink,\n\t__experimentalToolsPanel as ToolsPanel,\n\t__experimentalToolsPanelItem as ToolsPanelItem,\n} from '@wordpress/components';\nimport {\n\tInspectorControls,\n\tBlockControls,\n\tMediaPlaceholder,\n\tMediaReplaceFlow,\n\tuseBlockProps,\n\t__experimentalUseBorderProps as useBorderProps,\n\t__experimentalGetShadowClassesAndStyles as getShadowClassesAndStyles,\n\tuseBlockEditingMode,\n\tprivateApis as blockEditorPrivateApis,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\nimport {\n\tuseMemo,\n\tuseEffect,\n\tuseState,\n\tcreateInterpolateElement,\n} from '@wordpress/element';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { upload } from '@wordpress/icons';\nimport { store as noticesStore } from '@wordpress/notices';\n\n/**\n * Internal dependencies\n */\nimport DimensionControls from './dimension-controls';\nimport OverlayControls from './overlay-controls';\nimport Overlay from './overlay';\nimport { useToolsPanelDropdownMenuProps } from '../utils/hooks';\nimport { unlock } from '../lock-unlock';\nimport { getDimensionResetAttributes } from '../utils/style-state';\n\nconst ALLOWED_MEDIA_TYPES = [ 'image' ];\nconst { isDefaultBlockStyleState, ResolutionTool } = unlock(\n\tblockEditorPrivateApis\n);\n\nconst hasDimensionValue = ( value ) =>\n\tvalue !== undefined && value !== null && value !== '';\nconst DEFAULT_MEDIA_SIZE_SLUG = 'full';\n\nfunction FeaturedImageResolutionTool( { image, value, onChange } ) {\n\tconst { imageSizes } = useSelect( ( select ) => {\n\t\tconst { getSettings } = select( blockEditorStore );\n\t\treturn {\n\t\t\timageSizes: getSettings().imageSizes,\n\t\t};\n\t}, [] );\n\n\tif ( ! imageSizes?.length ) {\n\t\treturn null;\n\t}\n\n\tconst imageSizeOptions = imageSizes\n\t\t.filter(\n\t\t\t( { slug } ) => image?.media_details?.sizes?.[ slug ]?.source_url\n\t\t)\n\t\t.map( ( { name, slug } ) => ( { value: slug, label: name } ) );\n\n\treturn (\n\t\t<ResolutionTool\n\t\t\tvalue={ value }\n\t\t\tdefaultValue={ DEFAULT_MEDIA_SIZE_SLUG }\n\t\t\toptions={ imageSizeOptions }\n\t\t\tonChange={ onChange }\n\t\t/>\n\t);\n}\n\nexport default function PostFeaturedImageEdit( {\n\tclientId,\n\tattributes,\n\tsetAttributes,\n\tcontext: { postId, postType: postTypeSlug, queryId },\n} ) {\n\tconst isDescendentOfQueryLoop = Number.isFinite( queryId );\n\tconst {\n\t\tisLink,\n\t\taspectRatio,\n\t\theight,\n\t\twidth,\n\t\tscale,\n\t\tsizeSlug,\n\t\trel,\n\t\tlinkTarget,\n\t\tuseFirstImageFromPost,\n\t} = attributes;\n\tconst [ temporaryURL, setTemporaryURL ] = useState();\n\n\tconst [ storedFeaturedImage, setFeaturedImage ] = useEntityProp(\n\t\t'postType',\n\t\tpostTypeSlug,\n\t\t'featured_media',\n\t\tpostId\n\t);\n\n\t// Fallback to post content if no featured image is set.\n\t// This is needed for the \"Use first image from post\" option.\n\tconst [ postContent ] = useEntityProp(\n\t\t'postType',\n\t\tpostTypeSlug,\n\t\t'content',\n\t\tpostId\n\t);\n\n\tconst featuredImage = useMemo( () => {\n\t\tif ( storedFeaturedImage ) {\n\t\t\treturn storedFeaturedImage;\n\t\t}\n\n\t\tif ( ! useFirstImageFromPost ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst imageOpener =\n\t\t\t/<!--\\s+wp:(?:core\\/)?image\\s+(?<attrs>{(?:(?:[^}]+|}+(?=})|(?!}\\s+\\/?-->).)*)?}\\s+)?-->/.exec(\n\t\t\t\tpostContent\n\t\t\t);\n\t\tconst imageId =\n\t\t\timageOpener?.groups?.attrs &&\n\t\t\tJSON.parse( imageOpener.groups.attrs )?.id;\n\t\treturn imageId;\n\t}, [ storedFeaturedImage, useFirstImageFromPost, postContent ] );\n\n\tconst { media, postType, postPermalink, selectedStyleState } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getEntityRecord, getPostType, getEditedEntityRecord } =\n\t\t\t\tselect( coreStore );\n\t\t\tconst { getSelectedBlockStyleState } = unlock(\n\t\t\t\tselect( blockEditorStore )\n\t\t\t);\n\t\t\treturn {\n\t\t\t\tmedia:\n\t\t\t\t\tfeaturedImage &&\n\t\t\t\t\tgetEntityRecord( 'postType', 'attachment', featuredImage, {\n\t\t\t\t\t\tcontext: 'view',\n\t\t\t\t\t} ),\n\t\t\t\tpostType: postTypeSlug && getPostType( postTypeSlug ),\n\t\t\t\tpostPermalink: getEditedEntityRecord(\n\t\t\t\t\t'postType',\n\t\t\t\t\tpostTypeSlug,\n\t\t\t\t\tpostId\n\t\t\t\t)?.link,\n\t\t\t\tselectedStyleState: getSelectedBlockStyleState( clientId ),\n\t\t\t};\n\t\t},\n\t\t[ clientId, featuredImage, postTypeSlug, postId ]\n\t);\n\tconst hasSelectedStyleState =\n\t\t! isDefaultBlockStyleState( selectedStyleState );\n\n\tconst mediaUrl =\n\t\tmedia?.media_details?.sizes?.[ sizeSlug ]?.source_url ||\n\t\tmedia?.source_url;\n\n\tconst blockProps = useBlockProps( {\n\t\tclassName: clsx( {\n\t\t\t'is-transient': temporaryURL,\n\t\t} ),\n\t} );\n\tconst borderProps = useBorderProps( attributes );\n\tconst shadowProps = getShadowClassesAndStyles( attributes );\n\tconst blockEditingMode = useBlockEditingMode();\n\n\tconst placeholder = ( content ) => {\n\t\treturn (\n\t\t\t<Placeholder\n\t\t\t\tclassName={ clsx(\n\t\t\t\t\t'block-editor-media-placeholder',\n\t\t\t\t\tborderProps.className\n\t\t\t\t) }\n\t\t\t\twithIllustration\n\t\t\t\tstyle={ {\n\t\t\t\t\taspectRatio,\n\t\t\t\t\theight: hasDimensionValue( height )\n\t\t\t\t\t\t? height\n\t\t\t\t\t\t: hasDimensionValue( width ) && 'auto',\n\t\t\t\t\twidth: hasDimensionValue( width )\n\t\t\t\t\t\t? width\n\t\t\t\t\t\t: !! aspectRatio && '100%',\n\t\t\t\t\t...borderProps.style,\n\t\t\t\t\t...shadowProps.style,\n\t\t\t\t} }\n\t\t\t>\n\t\t\t\t{ content }\n\t\t\t</Placeholder>\n\t\t);\n\t};\n\n\tconst onSelectImage = ( value ) => {\n\t\tif ( value?.id ) {\n\t\t\tsetFeaturedImage( value.id );\n\t\t}\n\n\t\tif ( value?.url && isBlobURL( value.url ) ) {\n\t\t\tsetTemporaryURL( value.url );\n\t\t}\n\t};\n\n\t// On reset image\n\tconst onResetImage = () => {\n\t\tsetAttributes( {\n\t\t\tisLink: false,\n\t\t\tlinkTarget: '_self',\n\t\t\trel: '',\n\t\t\tsizeSlug: undefined,\n\t\t} );\n\t\tsetFeaturedImage( 0 );\n\t};\n\n\t// Reset temporary url when media is available.\n\tuseEffect( () => {\n\t\tif ( mediaUrl && temporaryURL ) {\n\t\t\tsetTemporaryURL();\n\t\t}\n\t}, [ mediaUrl, temporaryURL ] );\n\n\tconst { createErrorNotice } = useDispatch( noticesStore );\n\tconst onUploadError = ( message ) => {\n\t\tcreateErrorNotice( message, { type: 'snackbar' } );\n\t\tsetTemporaryURL();\n\t};\n\n\tconst dropdownMenuProps = useToolsPanelDropdownMenuProps();\n\n\tconst controls = blockEditingMode === 'default' && (\n\t\t<>\n\t\t\t<InspectorControls group=\"color\">\n\t\t\t\t<OverlayControls\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<InspectorControls\n\t\t\t\tgroup=\"dimensions\"\n\t\t\t\tresetAllFilter={ ( attrs ) => {\n\t\t\t\t\treturn getDimensionResetAttributes( {\n\t\t\t\t\t\tattributes: attrs,\n\t\t\t\t\t\tselectedState: selectedStyleState,\n\t\t\t\t\t\thasSelectedStyleState,\n\t\t\t\t\t\tkeys: [ 'aspectRatio', 'height', 'objectFit', 'width' ],\n\t\t\t\t\t\tdefaultAttributes: {\n\t\t\t\t\t\t\taspectRatio: undefined,\n\t\t\t\t\t\t\theight: undefined,\n\t\t\t\t\t\t\tscale: undefined,\n\t\t\t\t\t\t\twidth: undefined,\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\t\t<DimensionControls\n\t\t\t\t\tclientId={ clientId }\n\t\t\t\t\tattributes={ attributes }\n\t\t\t\t\tsetAttributes={ setAttributes }\n\t\t\t\t\tmedia={ media }\n\t\t\t\t\tselectedStyleState={ selectedStyleState }\n\t\t\t\t\thasSelectedStyleState={ hasSelectedStyleState }\n\t\t\t\t/>\n\t\t\t</InspectorControls>\n\t\t\t{ ( featuredImage || isDescendentOfQueryLoop || ! postId ) && (\n\t\t\t\t<InspectorControls>\n\t\t\t\t\t<ToolsPanel\n\t\t\t\t\t\tlabel={ __( 'Settings' ) }\n\t\t\t\t\t\tresetAll={ () => {\n\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\tisLink: false,\n\t\t\t\t\t\t\t\tlinkTarget: '_self',\n\t\t\t\t\t\t\t\trel: '',\n\t\t\t\t\t\t\t\tsizeSlug: DEFAULT_MEDIA_SIZE_SLUG,\n\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tdropdownMenuProps={ dropdownMenuProps }\n\t\t\t\t\t>\n\t\t\t\t\t\t<ToolsPanelItem\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\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\tisShownByDefault\n\t\t\t\t\t\t\thasValue={ () => !! isLink }\n\t\t\t\t\t\t\tonDeselect={ () =>\n\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\tisLink: false,\n\t\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\t\t\tlabel={ __( 'Make image a link' ) }\n\t\t\t\t\t\t\t\tonChange={ () =>\n\t\t\t\t\t\t\t\t\tsetAttributes( { isLink: ! isLink } )\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tchecked={ isLink }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</ToolsPanelItem>\n\n\t\t\t\t\t\t{ isLink && (\n\t\t\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\t\t\tlabel={ __( 'Open in new tab' ) }\n\t\t\t\t\t\t\t\tisShownByDefault\n\t\t\t\t\t\t\t\thasValue={ () => '_self' !== linkTarget }\n\t\t\t\t\t\t\t\tonDeselect={ () =>\n\t\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\t\tlinkTarget: '_self',\n\t\t\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\t\t\t\tlabel={ __( 'Open in new tab' ) }\n\t\t\t\t\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\t\t\tlinkTarget: value\n\t\t\t\t\t\t\t\t\t\t\t\t? '_blank'\n\t\t\t\t\t\t\t\t\t\t\t\t: '_self',\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\tchecked={ linkTarget === '_blank' }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t</ToolsPanelItem>\n\t\t\t\t\t\t) }\n\t\t\t\t\t\t{ isLink && (\n\t\t\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\t\t\tlabel={ __( 'Link relation' ) }\n\t\t\t\t\t\t\t\tisShownByDefault\n\t\t\t\t\t\t\t\thasValue={ () => !! rel }\n\t\t\t\t\t\t\t\tonDeselect={ () =>\n\t\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\t\trel: '',\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\t\t<TextControl\n\t\t\t\t\t\t\t\t\tlabel={ __( 'Link relation' ) }\n\t\t\t\t\t\t\t\t\thelp={ createInterpolateElement(\n\t\t\t\t\t\t\t\t\t\t__(\n\t\t\t\t\t\t\t\t\t\t\t'The <a>Link Relation</a> attribute defines the relationship between a linked resource and the current document.'\n\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\t\ta: (\n\t\t\t\t\t\t\t\t\t\t\t\t<ExternalLink href=\"https://developer.mozilla.org/docs/Web/HTML/Attributes/rel\" />\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) }\n\t\t\t\t\t\t\t\t\tvalue={ rel }\n\t\t\t\t\t\t\t\t\tonChange={ ( newRel ) =>\n\t\t\t\t\t\t\t\t\t\tsetAttributes( { rel: newRel } )\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</ToolsPanelItem>\n\t\t\t\t\t\t) }\n\t\t\t\t\t\t{ !! media && (\n\t\t\t\t\t\t\t<FeaturedImageResolutionTool\n\t\t\t\t\t\t\t\timage={ media }\n\t\t\t\t\t\t\t\tvalue={ sizeSlug }\n\t\t\t\t\t\t\t\tonChange={ ( nextSizeSlug ) =>\n\t\t\t\t\t\t\t\t\tsetAttributes( { sizeSlug: nextSizeSlug } )\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</ToolsPanel>\n\t\t\t\t</InspectorControls>\n\t\t\t) }\n\t\t</>\n\t);\n\n\tlet image;\n\n\t/**\n\t * A Post Featured Image block should not have image replacement\n\t * or upload options in the following cases:\n\t * - Is placed in a Query Loop. This is a conscious decision to\n\t * prevent content editing of different posts in Query Loop, and\n\t * this could change in the future.\n\t * - Is in a context where it does not have a postId (for example\n\t * in a template or template part).\n\t */\n\tif ( ! featuredImage && ( isDescendentOfQueryLoop || ! postId ) ) {\n\t\treturn (\n\t\t\t<>\n\t\t\t\t{ controls }\n\t\t\t\t<div { ...blockProps }>\n\t\t\t\t\t{ !! isLink ? (\n\t\t\t\t\t\t<a href={ postPermalink } target={ linkTarget }>\n\t\t\t\t\t\t\t{ placeholder() }\n\t\t\t\t\t\t</a>\n\t\t\t\t\t) : (\n\t\t\t\t\t\tplaceholder()\n\t\t\t\t\t) }\n\t\t\t\t\t<Overlay\n\t\t\t\t\t\tattributes={ attributes }\n\t\t\t\t\t\tsetAttributes={ setAttributes }\n\t\t\t\t\t\tclientId={ clientId }\n\t\t\t\t\t/>\n\t\t\t\t</div>\n\t\t\t</>\n\t\t);\n\t}\n\n\tconst label = __( 'Add a featured image' );\n\tconst imageStyles = {\n\t\t...borderProps.style,\n\t\t...shadowProps.style,\n\t\taspectRatio,\n\t\theight: hasDimensionValue( height )\n\t\t\t? height\n\t\t\t: hasDimensionValue( width ) && 'auto',\n\t\twidth: hasDimensionValue( width ) ? width : !! aspectRatio && '100%',\n\t\tobjectFit: !! ( height || aspectRatio ) && scale,\n\t};\n\n\t/**\n\t * When the post featured image block is placed in a context where:\n\t * - It has a postId (for example in a single post)\n\t * - It is not inside a query loop\n\t * - It has no image assigned yet\n\t * Then display the placeholder with the image upload option.\n\t */\n\tif ( ! featuredImage && ! temporaryURL ) {\n\t\timage = (\n\t\t\t<MediaPlaceholder\n\t\t\t\tonSelect={ onSelectImage }\n\t\t\t\taccept=\"image/*\"\n\t\t\t\tallowedTypes={ ALLOWED_MEDIA_TYPES }\n\t\t\t\tonError={ onUploadError }\n\t\t\t\tplaceholder={ placeholder }\n\t\t\t\tmediaLibraryButton={ ( { open } ) => {\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\ticon={ upload }\n\t\t\t\t\t\t\tvariant=\"primary\"\n\t\t\t\t\t\t\tlabel={ label }\n\t\t\t\t\t\t\tshowTooltip\n\t\t\t\t\t\t\ttooltipPosition=\"top center\"\n\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\topen();\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} }\n\t\t\t/>\n\t\t);\n\t} else {\n\t\t// We have a Featured image so show a Placeholder if is loading.\n\t\timage =\n\t\t\t! media && ! temporaryURL ? (\n\t\t\t\tplaceholder()\n\t\t\t) : (\n\t\t\t\t<>\n\t\t\t\t\t<img\n\t\t\t\t\t\tclassName={ borderProps.className }\n\t\t\t\t\t\tsrc={ temporaryURL || mediaUrl }\n\t\t\t\t\t\talt={\n\t\t\t\t\t\t\tmedia && media?.alt_text\n\t\t\t\t\t\t\t\t? sprintf(\n\t\t\t\t\t\t\t\t\t\t// translators: %s: The image's alt text.\n\t\t\t\t\t\t\t\t\t\t__( 'Featured image: %s' ),\n\t\t\t\t\t\t\t\t\t\tmedia.alt_text\n\t\t\t\t\t\t\t\t )\n\t\t\t\t\t\t\t\t: __( 'Featured image' )\n\t\t\t\t\t\t}\n\t\t\t\t\t\tstyle={ imageStyles }\n\t\t\t\t\t/>\n\t\t\t\t\t{ temporaryURL && <Spinner /> }\n\t\t\t\t</>\n\t\t\t);\n\t}\n\n\t/**\n\t * When the post featured image block:\n\t * - Has an image assigned\n\t * - Is not inside a query loop\n\t * Then display the image and the image replacement option.\n\t */\n\treturn (\n\t\t<>\n\t\t\t{ ! temporaryURL && controls }\n\t\t\t{ !! media && ! isDescendentOfQueryLoop && (\n\t\t\t\t<BlockControls group=\"other\">\n\t\t\t\t\t<MediaReplaceFlow\n\t\t\t\t\t\tmediaId={ featuredImage }\n\t\t\t\t\t\tmediaURL={ mediaUrl }\n\t\t\t\t\t\tallowedTypes={ ALLOWED_MEDIA_TYPES }\n\t\t\t\t\t\taccept=\"image/*\"\n\t\t\t\t\t\tonSelect={ onSelectImage }\n\t\t\t\t\t\tonError={ onUploadError }\n\t\t\t\t\t\tonReset={ onResetImage }\n\t\t\t\t\t/>\n\t\t\t\t</BlockControls>\n\t\t\t) }\n\t\t\t<figure { ...blockProps }>\n\t\t\t\t{ /* If the featured image is linked, wrap in an <a /> tag to trigger any inherited link element styles */ }\n\t\t\t\t{ !! isLink ? (\n\t\t\t\t\t<a href={ postPermalink } target={ linkTarget }>\n\t\t\t\t\t\t{ image }\n\t\t\t\t\t</a>\n\t\t\t\t) : (\n\t\t\t\t\timage\n\t\t\t\t) }\n\t\t\t\t<Overlay\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</figure>\n\t\t</>\n\t);\n}\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,kBAAiB;AAKjB,kBAA0B;AAC1B,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AAE,SAAM;AAAA,MAChB,gBAAgB;AAAA,IACjB,CAAE;AAAA,EACH,CAAE;AACF,QAAM,kBAAc,oBAAAC,8BAAgB,UAAW;AAC/C,QAAM,kBAAc,oBAAAC,yCAA2B,UAAW;AAC1D,QAAM,uBAAmB,yCAAoB;
|
|
4
|
+
"sourcesContent": ["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { isBlobURL } from '@wordpress/blob';\nimport { useEntityProp, store as coreStore } from '@wordpress/core-data';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport {\n\tToggleControl,\n\tPlaceholder,\n\tButton,\n\tSpinner,\n\tTextControl,\n\tExternalLink,\n\t__experimentalToolsPanel as ToolsPanel,\n\t__experimentalToolsPanelItem as ToolsPanelItem,\n} from '@wordpress/components';\nimport {\n\tInspectorControls,\n\tBlockControls,\n\tMediaPlaceholder,\n\tMediaReplaceFlow,\n\tuseBlockProps,\n\t__experimentalUseBorderProps as useBorderProps,\n\t__experimentalGetShadowClassesAndStyles as getShadowClassesAndStyles,\n\tuseBlockEditingMode,\n\tprivateApis as blockEditorPrivateApis,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\nimport {\n\tuseMemo,\n\tuseEffect,\n\tuseState,\n\tcreateInterpolateElement,\n} from '@wordpress/element';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { upload } from '@wordpress/icons';\nimport { store as noticesStore } from '@wordpress/notices';\n\n/**\n * Internal dependencies\n */\nimport DimensionControls from './dimension-controls';\nimport OverlayControls from './overlay-controls';\nimport Overlay from './overlay';\nimport { useToolsPanelDropdownMenuProps } from '../utils/hooks';\nimport { unlock } from '../lock-unlock';\nimport { getDimensionResetAttributes } from '../utils/style-state';\n\nconst ALLOWED_MEDIA_TYPES = [ 'image' ];\nconst { isDefaultBlockStyleState, ResolutionTool } = unlock(\n\tblockEditorPrivateApis\n);\n\nconst hasDimensionValue = ( value ) =>\n\tvalue !== undefined && value !== null && value !== '';\nconst DEFAULT_MEDIA_SIZE_SLUG = 'full';\n\nfunction FeaturedImageResolutionTool( { image, value, onChange } ) {\n\tconst { imageSizes } = useSelect( ( select ) => {\n\t\tconst { getSettings } = select( blockEditorStore );\n\t\treturn {\n\t\t\timageSizes: getSettings().imageSizes,\n\t\t};\n\t}, [] );\n\n\tif ( ! imageSizes?.length ) {\n\t\treturn null;\n\t}\n\n\tconst imageSizeOptions = imageSizes\n\t\t.filter(\n\t\t\t( { slug } ) => image?.media_details?.sizes?.[ slug ]?.source_url\n\t\t)\n\t\t.map( ( { name, slug } ) => ( { value: slug, label: name } ) );\n\n\treturn (\n\t\t<ResolutionTool\n\t\t\tvalue={ value }\n\t\t\tdefaultValue={ DEFAULT_MEDIA_SIZE_SLUG }\n\t\t\toptions={ imageSizeOptions }\n\t\t\tonChange={ onChange }\n\t\t/>\n\t);\n}\n\nexport default function PostFeaturedImageEdit( {\n\tclientId,\n\tattributes,\n\tsetAttributes,\n\tcontext: { postId, postType: postTypeSlug, queryId },\n} ) {\n\tconst isDescendentOfQueryLoop = Number.isFinite( queryId );\n\tconst {\n\t\tisLink,\n\t\taspectRatio,\n\t\theight,\n\t\twidth,\n\t\tscale,\n\t\tsizeSlug,\n\t\trel,\n\t\tlinkTarget,\n\t\tuseFirstImageFromPost,\n\t} = attributes;\n\tconst [ temporaryURL, setTemporaryURL ] = useState();\n\n\tconst [ storedFeaturedImage, setFeaturedImage ] = useEntityProp(\n\t\t'postType',\n\t\tpostTypeSlug,\n\t\t'featured_media',\n\t\tpostId\n\t);\n\n\t// Fallback to post content if no featured image is set.\n\t// This is needed for the \"Use first image from post\" option.\n\tconst [ postContent ] = useEntityProp(\n\t\t'postType',\n\t\tpostTypeSlug,\n\t\t'content',\n\t\tpostId\n\t);\n\n\tconst featuredImage = useMemo( () => {\n\t\tif ( storedFeaturedImage ) {\n\t\t\treturn storedFeaturedImage;\n\t\t}\n\n\t\tif ( ! useFirstImageFromPost ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst imageOpener =\n\t\t\t/<!--\\s+wp:(?:core\\/)?image\\s+(?<attrs>{(?:(?:[^}]+|}+(?=})|(?!}\\s+\\/?-->).)*)?}\\s+)?-->/.exec(\n\t\t\t\tpostContent\n\t\t\t);\n\t\tconst imageId =\n\t\t\timageOpener?.groups?.attrs &&\n\t\t\tJSON.parse( imageOpener.groups.attrs )?.id;\n\t\treturn imageId;\n\t}, [ storedFeaturedImage, useFirstImageFromPost, postContent ] );\n\n\tconst { media, postType, postPermalink, selectedStyleState } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getEntityRecord, getPostType, getEditedEntityRecord } =\n\t\t\t\tselect( coreStore );\n\t\t\tconst { getSelectedBlockStyleState } = unlock(\n\t\t\t\tselect( blockEditorStore )\n\t\t\t);\n\t\t\treturn {\n\t\t\t\tmedia:\n\t\t\t\t\tfeaturedImage &&\n\t\t\t\t\tgetEntityRecord( 'postType', 'attachment', featuredImage, {\n\t\t\t\t\t\tcontext: 'view',\n\t\t\t\t\t} ),\n\t\t\t\tpostType: postTypeSlug && getPostType( postTypeSlug ),\n\t\t\t\tpostPermalink: getEditedEntityRecord(\n\t\t\t\t\t'postType',\n\t\t\t\t\tpostTypeSlug,\n\t\t\t\t\tpostId\n\t\t\t\t)?.link,\n\t\t\t\tselectedStyleState: getSelectedBlockStyleState( clientId ),\n\t\t\t};\n\t\t},\n\t\t[ clientId, featuredImage, postTypeSlug, postId ]\n\t);\n\tconst hasSelectedStyleState =\n\t\t! isDefaultBlockStyleState( selectedStyleState );\n\n\tconst mediaUrl =\n\t\tmedia?.media_details?.sizes?.[ sizeSlug ]?.source_url ||\n\t\tmedia?.source_url;\n\n\tconst blockProps = useBlockProps( {\n\t\tclassName: clsx( {\n\t\t\t'is-transient': temporaryURL,\n\t\t} ),\n\t} );\n\tconst borderProps = useBorderProps( attributes );\n\tconst shadowProps = getShadowClassesAndStyles( attributes );\n\tconst blockEditingMode = useBlockEditingMode();\n\tconst aspectRatioStyle = aspectRatio === 'auto' ? undefined : aspectRatio;\n\n\tconst placeholder = ( content ) => {\n\t\treturn (\n\t\t\t<Placeholder\n\t\t\t\tclassName={ clsx(\n\t\t\t\t\t'block-editor-media-placeholder',\n\t\t\t\t\tborderProps.className\n\t\t\t\t) }\n\t\t\t\twithIllustration\n\t\t\t\tstyle={ {\n\t\t\t\t\taspectRatio: aspectRatioStyle,\n\t\t\t\t\theight: hasDimensionValue( height )\n\t\t\t\t\t\t? height\n\t\t\t\t\t\t: hasDimensionValue( width ) && 'auto',\n\t\t\t\t\twidth: hasDimensionValue( width )\n\t\t\t\t\t\t? width\n\t\t\t\t\t\t: !! aspectRatio && '100%',\n\t\t\t\t\t...borderProps.style,\n\t\t\t\t\t...shadowProps.style,\n\t\t\t\t} }\n\t\t\t>\n\t\t\t\t{ content }\n\t\t\t</Placeholder>\n\t\t);\n\t};\n\n\tconst onSelectImage = ( value ) => {\n\t\tif ( value?.id ) {\n\t\t\tsetFeaturedImage( value.id );\n\t\t}\n\n\t\tif ( value?.url && isBlobURL( value.url ) ) {\n\t\t\tsetTemporaryURL( value.url );\n\t\t}\n\t};\n\n\t// On reset image\n\tconst onResetImage = () => {\n\t\tsetAttributes( {\n\t\t\tisLink: false,\n\t\t\tlinkTarget: '_self',\n\t\t\trel: '',\n\t\t\tsizeSlug: undefined,\n\t\t} );\n\t\tsetFeaturedImage( 0 );\n\t};\n\n\t// Reset temporary url when media is available.\n\tuseEffect( () => {\n\t\tif ( mediaUrl && temporaryURL ) {\n\t\t\tsetTemporaryURL();\n\t\t}\n\t}, [ mediaUrl, temporaryURL ] );\n\n\tconst { createErrorNotice } = useDispatch( noticesStore );\n\tconst onUploadError = ( message ) => {\n\t\tcreateErrorNotice( message, { type: 'snackbar' } );\n\t\tsetTemporaryURL();\n\t};\n\n\tconst dropdownMenuProps = useToolsPanelDropdownMenuProps();\n\n\tconst controls = blockEditingMode === 'default' && (\n\t\t<>\n\t\t\t<InspectorControls group=\"color\">\n\t\t\t\t<OverlayControls\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<InspectorControls\n\t\t\t\tgroup=\"dimensions\"\n\t\t\t\tresetAllFilter={ ( attrs ) => {\n\t\t\t\t\treturn getDimensionResetAttributes( {\n\t\t\t\t\t\tattributes: attrs,\n\t\t\t\t\t\tselectedState: selectedStyleState,\n\t\t\t\t\t\thasSelectedStyleState,\n\t\t\t\t\t\tkeys: [ 'aspectRatio', 'height', 'objectFit', 'width' ],\n\t\t\t\t\t\tdefaultAttributes: {\n\t\t\t\t\t\t\taspectRatio: undefined,\n\t\t\t\t\t\t\theight: undefined,\n\t\t\t\t\t\t\tscale: undefined,\n\t\t\t\t\t\t\twidth: undefined,\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\t\t<DimensionControls\n\t\t\t\t\tclientId={ clientId }\n\t\t\t\t\tattributes={ attributes }\n\t\t\t\t\tsetAttributes={ setAttributes }\n\t\t\t\t\tmedia={ media }\n\t\t\t\t\tselectedStyleState={ selectedStyleState }\n\t\t\t\t\thasSelectedStyleState={ hasSelectedStyleState }\n\t\t\t\t/>\n\t\t\t</InspectorControls>\n\t\t\t{ ( featuredImage || isDescendentOfQueryLoop || ! postId ) && (\n\t\t\t\t<InspectorControls>\n\t\t\t\t\t<ToolsPanel\n\t\t\t\t\t\tlabel={ __( 'Settings' ) }\n\t\t\t\t\t\tresetAll={ () => {\n\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\tisLink: false,\n\t\t\t\t\t\t\t\tlinkTarget: '_self',\n\t\t\t\t\t\t\t\trel: '',\n\t\t\t\t\t\t\t\tsizeSlug: DEFAULT_MEDIA_SIZE_SLUG,\n\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tdropdownMenuProps={ dropdownMenuProps }\n\t\t\t\t\t>\n\t\t\t\t\t\t<ToolsPanelItem\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\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\tisShownByDefault\n\t\t\t\t\t\t\thasValue={ () => !! isLink }\n\t\t\t\t\t\t\tonDeselect={ () =>\n\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\tisLink: false,\n\t\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\t\t\tlabel={ __( 'Make image a link' ) }\n\t\t\t\t\t\t\t\tonChange={ () =>\n\t\t\t\t\t\t\t\t\tsetAttributes( { isLink: ! isLink } )\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tchecked={ isLink }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</ToolsPanelItem>\n\n\t\t\t\t\t\t{ isLink && (\n\t\t\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\t\t\tlabel={ __( 'Open in new tab' ) }\n\t\t\t\t\t\t\t\tisShownByDefault\n\t\t\t\t\t\t\t\thasValue={ () => '_self' !== linkTarget }\n\t\t\t\t\t\t\t\tonDeselect={ () =>\n\t\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\t\tlinkTarget: '_self',\n\t\t\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\t\t\t\tlabel={ __( 'Open in new tab' ) }\n\t\t\t\t\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\t\t\tlinkTarget: value\n\t\t\t\t\t\t\t\t\t\t\t\t? '_blank'\n\t\t\t\t\t\t\t\t\t\t\t\t: '_self',\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\tchecked={ linkTarget === '_blank' }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t</ToolsPanelItem>\n\t\t\t\t\t\t) }\n\t\t\t\t\t\t{ isLink && (\n\t\t\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\t\t\tlabel={ __( 'Link relation' ) }\n\t\t\t\t\t\t\t\tisShownByDefault\n\t\t\t\t\t\t\t\thasValue={ () => !! rel }\n\t\t\t\t\t\t\t\tonDeselect={ () =>\n\t\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\t\trel: '',\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\t\t<TextControl\n\t\t\t\t\t\t\t\t\tlabel={ __( 'Link relation' ) }\n\t\t\t\t\t\t\t\t\thelp={ createInterpolateElement(\n\t\t\t\t\t\t\t\t\t\t__(\n\t\t\t\t\t\t\t\t\t\t\t'The <a>Link Relation</a> attribute defines the relationship between a linked resource and the current document.'\n\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\t\ta: (\n\t\t\t\t\t\t\t\t\t\t\t\t<ExternalLink href=\"https://developer.mozilla.org/docs/Web/HTML/Attributes/rel\" />\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) }\n\t\t\t\t\t\t\t\t\tvalue={ rel }\n\t\t\t\t\t\t\t\t\tonChange={ ( newRel ) =>\n\t\t\t\t\t\t\t\t\t\tsetAttributes( { rel: newRel } )\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</ToolsPanelItem>\n\t\t\t\t\t\t) }\n\t\t\t\t\t\t{ !! media && (\n\t\t\t\t\t\t\t<FeaturedImageResolutionTool\n\t\t\t\t\t\t\t\timage={ media }\n\t\t\t\t\t\t\t\tvalue={ sizeSlug }\n\t\t\t\t\t\t\t\tonChange={ ( nextSizeSlug ) =>\n\t\t\t\t\t\t\t\t\tsetAttributes( { sizeSlug: nextSizeSlug } )\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</ToolsPanel>\n\t\t\t\t</InspectorControls>\n\t\t\t) }\n\t\t</>\n\t);\n\n\tlet image;\n\n\t/**\n\t * A Post Featured Image block should not have image replacement\n\t * or upload options in the following cases:\n\t * - Is placed in a Query Loop. This is a conscious decision to\n\t * prevent content editing of different posts in Query Loop, and\n\t * this could change in the future.\n\t * - Is in a context where it does not have a postId (for example\n\t * in a template or template part).\n\t */\n\tif ( ! featuredImage && ( isDescendentOfQueryLoop || ! postId ) ) {\n\t\treturn (\n\t\t\t<>\n\t\t\t\t{ controls }\n\t\t\t\t<div { ...blockProps }>\n\t\t\t\t\t{ !! isLink ? (\n\t\t\t\t\t\t<a href={ postPermalink } target={ linkTarget }>\n\t\t\t\t\t\t\t{ placeholder() }\n\t\t\t\t\t\t</a>\n\t\t\t\t\t) : (\n\t\t\t\t\t\tplaceholder()\n\t\t\t\t\t) }\n\t\t\t\t\t<Overlay\n\t\t\t\t\t\tattributes={ attributes }\n\t\t\t\t\t\tsetAttributes={ setAttributes }\n\t\t\t\t\t\tclientId={ clientId }\n\t\t\t\t\t/>\n\t\t\t\t</div>\n\t\t\t</>\n\t\t);\n\t}\n\n\tconst label = __( 'Add a featured image' );\n\tconst imageStyles = {\n\t\t...borderProps.style,\n\t\t...shadowProps.style,\n\t\taspectRatio: aspectRatioStyle,\n\t\theight: hasDimensionValue( height )\n\t\t\t? height\n\t\t\t: hasDimensionValue( width ) && 'auto',\n\t\twidth: hasDimensionValue( width ) ? width : !! aspectRatio && '100%',\n\t\tobjectFit: !! ( height || aspectRatio ) && scale,\n\t};\n\n\t/**\n\t * When the post featured image block is placed in a context where:\n\t * - It has a postId (for example in a single post)\n\t * - It is not inside a query loop\n\t * - It has no image assigned yet\n\t * Then display the placeholder with the image upload option.\n\t */\n\tif ( ! featuredImage && ! temporaryURL ) {\n\t\timage = (\n\t\t\t<MediaPlaceholder\n\t\t\t\tonSelect={ onSelectImage }\n\t\t\t\taccept=\"image/*\"\n\t\t\t\tallowedTypes={ ALLOWED_MEDIA_TYPES }\n\t\t\t\tonError={ onUploadError }\n\t\t\t\tplaceholder={ placeholder }\n\t\t\t\tmediaLibraryButton={ ( { open } ) => {\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\ticon={ upload }\n\t\t\t\t\t\t\tvariant=\"primary\"\n\t\t\t\t\t\t\tlabel={ label }\n\t\t\t\t\t\t\tshowTooltip\n\t\t\t\t\t\t\ttooltipPosition=\"top center\"\n\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\topen();\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} }\n\t\t\t/>\n\t\t);\n\t} else {\n\t\t// We have a Featured image so show a Placeholder if is loading.\n\t\timage =\n\t\t\t! media && ! temporaryURL ? (\n\t\t\t\tplaceholder()\n\t\t\t) : (\n\t\t\t\t<>\n\t\t\t\t\t<img\n\t\t\t\t\t\tclassName={ borderProps.className }\n\t\t\t\t\t\tsrc={ temporaryURL || mediaUrl }\n\t\t\t\t\t\talt={\n\t\t\t\t\t\t\tmedia && media?.alt_text\n\t\t\t\t\t\t\t\t? sprintf(\n\t\t\t\t\t\t\t\t\t\t// translators: %s: The image's alt text.\n\t\t\t\t\t\t\t\t\t\t__( 'Featured image: %s' ),\n\t\t\t\t\t\t\t\t\t\tmedia.alt_text\n\t\t\t\t\t\t\t\t )\n\t\t\t\t\t\t\t\t: __( 'Featured image' )\n\t\t\t\t\t\t}\n\t\t\t\t\t\tstyle={ imageStyles }\n\t\t\t\t\t/>\n\t\t\t\t\t{ temporaryURL && <Spinner /> }\n\t\t\t\t</>\n\t\t\t);\n\t}\n\n\t/**\n\t * When the post featured image block:\n\t * - Has an image assigned\n\t * - Is not inside a query loop\n\t * Then display the image and the image replacement option.\n\t */\n\treturn (\n\t\t<>\n\t\t\t{ ! temporaryURL && controls }\n\t\t\t{ !! media && ! isDescendentOfQueryLoop && (\n\t\t\t\t<BlockControls group=\"other\">\n\t\t\t\t\t<MediaReplaceFlow\n\t\t\t\t\t\tmediaId={ featuredImage }\n\t\t\t\t\t\tmediaURL={ mediaUrl }\n\t\t\t\t\t\tallowedTypes={ ALLOWED_MEDIA_TYPES }\n\t\t\t\t\t\taccept=\"image/*\"\n\t\t\t\t\t\tonSelect={ onSelectImage }\n\t\t\t\t\t\tonError={ onUploadError }\n\t\t\t\t\t\tonReset={ onResetImage }\n\t\t\t\t\t/>\n\t\t\t\t</BlockControls>\n\t\t\t) }\n\t\t\t<figure { ...blockProps }>\n\t\t\t\t{ /* If the featured image is linked, wrap in an <a /> tag to trigger any inherited link element styles */ }\n\t\t\t\t{ !! isLink ? (\n\t\t\t\t\t<a href={ postPermalink } target={ linkTarget }>\n\t\t\t\t\t\t{ image }\n\t\t\t\t\t</a>\n\t\t\t\t) : (\n\t\t\t\t\timage\n\t\t\t\t) }\n\t\t\t\t<Overlay\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</figure>\n\t\t</>\n\t);\n}\n"],
|
|
5
|
+
"mappings": ";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;AAAA,IACD;AAAA,EAEF,OAAO;AAEN,YACC,CAAE,SAAS,CAAE,eACZ,YAAY,IAEZ,4EACC;AAAA;AAAA,QAAC;AAAA;AAAA,UACA,WAAY,YAAY;AAAA,UACxB,KAAM,gBAAgB;AAAA,UACtB,KACC,SAAS,OAAO,eACb;AAAA;AAAA,gBAEA,gBAAI,oBAAqB;AAAA,YACzB,MAAM;AAAA,UACN,QACA,gBAAI,gBAAiB;AAAA,UAEzB,OAAQ;AAAA;AAAA,MACT;AAAA,MACE,gBAAgB,4CAAC,6BAAQ;AAAA,OAC5B;AAAA,EAEH;AAQA,SACC,4EACG;AAAA,KAAE,gBAAgB;AAAA,IAClB,CAAC,CAAE,SAAS,CAAE,2BACf,4CAAC,qCAAc,OAAM,SACpB;AAAA,MAAC;AAAA;AAAA,QACA,SAAU;AAAA,QACV,UAAW;AAAA,QACX,cAAe;AAAA,QACf,QAAO;AAAA,QACP,UAAW;AAAA,QACX,SAAU;AAAA,QACV,SAAU;AAAA;AAAA,IACX,GACD;AAAA,IAED,6CAAC,YAAS,GAAG,YAEV;AAAA,OAAC,CAAE,SACJ,4CAAC,OAAE,MAAO,eAAgB,QAAS,YAChC,iBACH,IAEA;AAAA,MAED;AAAA,QAAC,eAAAA;AAAA,QAAA;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA;AAAA,MACD;AAAA,OACD;AAAA,KACD;AAEF;",
|
|
6
6
|
"names": ["blockEditorPrivateApis", "blockEditorStore", "coreStore", "clsx", "useBorderProps", "getShadowClassesAndStyles", "noticesStore", "OverlayControls", "DimensionControls", "ToolsPanel", "ToolsPanelItem", "Overlay"]
|
|
7
7
|
}
|
|
@@ -135,9 +135,9 @@ function PostTermsEdit({
|
|
|
135
135
|
value: suffix,
|
|
136
136
|
onChange: (value) => setAttributes({ suffix: value }),
|
|
137
137
|
tagName: "span",
|
|
138
|
-
__unstableOnSplitAtEnd: () => insertBlocksAfter(
|
|
138
|
+
__unstableOnSplitAtEnd: insertBlocksAfter ? () => insertBlocksAfter(
|
|
139
139
|
(0, import_blocks.createBlock)((0, import_blocks.getDefaultBlockName)())
|
|
140
|
-
)
|
|
140
|
+
) : void 0
|
|
141
141
|
}
|
|
142
142
|
)
|
|
143
143
|
] })
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/post-terms/edit.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport {\n\tInspectorControls,\n\tuseBlockProps,\n\tuseBlockDisplayInformation,\n\tRichText,\n} from '@wordpress/block-editor';\nimport { createBlock, getDefaultBlockName } from '@wordpress/blocks';\nimport { Spinner, TextControl } from '@wordpress/components';\nimport { useSelect } from '@wordpress/data';\nimport { decodeEntities } from '@wordpress/html-entities';\nimport { __ } from '@wordpress/i18n';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport usePostTerms from './use-post-terms';\n\n// Allowed formats for the prefix and suffix fields.\nconst ALLOWED_FORMATS = [\n\t'core/bold',\n\t'core/image',\n\t'core/italic',\n\t'core/link',\n\t'core/strikethrough',\n\t'core/text-color',\n];\n\nexport default function PostTermsEdit( {\n\tattributes,\n\tclientId,\n\tcontext,\n\tisSelected,\n\tsetAttributes,\n\tinsertBlocksAfter,\n} ) {\n\tconst { term, separator, prefix, suffix } = attributes;\n\tconst { postId, postType } = context;\n\n\tconst selectedTerm = useSelect(\n\t\t( select ) => {\n\t\t\tif ( ! term ) {\n\t\t\t\treturn {};\n\t\t\t}\n\t\t\tconst { getTaxonomy } = select( coreStore );\n\t\t\tconst taxonomy = getTaxonomy( term );\n\t\t\treturn taxonomy?.visibility?.publicly_queryable ? taxonomy : {};\n\t\t},\n\t\t[ term ]\n\t);\n\tconst { postTerms, hasPostTerms, isLoading } = usePostTerms( {\n\t\tpostId,\n\t\tterm: selectedTerm,\n\t} );\n\tconst hasPost = postId && postType;\n\tconst blockInformation = useBlockDisplayInformation( clientId );\n\tconst blockProps = useBlockProps( {\n\t\tclassName: term && `taxonomy-${ term }`,\n\t} );\n\n\treturn (\n\t\t<>\n\t\t\t<InspectorControls group=\"advanced\">\n\t\t\t\t<TextControl\n\t\t\t\t\tautoComplete=\"off\"\n\t\t\t\t\tlabel={ __( 'Separator' ) }\n\t\t\t\t\tvalue={ separator || '' }\n\t\t\t\t\tonChange={ ( nextValue ) => {\n\t\t\t\t\t\tsetAttributes( { separator: nextValue } );\n\t\t\t\t\t} }\n\t\t\t\t\thelp={ __( 'Enter character(s) used to separate terms.' ) }\n\t\t\t\t/>\n\t\t\t</InspectorControls>\n\t\t\t<div { ...blockProps }>\n\t\t\t\t{ isLoading && hasPost && <Spinner /> }\n\t\t\t\t{ ! isLoading && ( isSelected || prefix ) && (\n\t\t\t\t\t<RichText\n\t\t\t\t\t\tidentifier=\"prefix\"\n\t\t\t\t\t\tallowedFormats={ ALLOWED_FORMATS }\n\t\t\t\t\t\tclassName=\"wp-block-post-terms__prefix\"\n\t\t\t\t\t\taria-label={ __( 'Prefix' ) }\n\t\t\t\t\t\tplaceholder={ __( 'Prefix' ) + ' ' }\n\t\t\t\t\t\tvalue={ prefix }\n\t\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\t\tsetAttributes( { prefix: value } )\n\t\t\t\t\t\t}\n\t\t\t\t\t\ttagName=\"span\"\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t\t{ ( ! hasPost || ! term ) && (\n\t\t\t\t\t<span>{ blockInformation.title }</span>\n\t\t\t\t) }\n\t\t\t\t{ hasPost &&\n\t\t\t\t\t! isLoading &&\n\t\t\t\t\thasPostTerms &&\n\t\t\t\t\tpostTerms\n\t\t\t\t\t\t.map( ( postTerm ) => (\n\t\t\t\t\t\t\t<a\n\t\t\t\t\t\t\t\tkey={ postTerm.id }\n\t\t\t\t\t\t\t\thref={ postTerm.link }\n\t\t\t\t\t\t\t\tonClick={ ( event ) => event.preventDefault() }\n\t\t\t\t\t\t\t\trel=\"tag\"\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{ decodeEntities( postTerm.name ) }\n\t\t\t\t\t\t\t</a>\n\t\t\t\t\t\t) )\n\t\t\t\t\t\t.reduce( ( prev, curr ) => (\n\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t{ prev }\n\t\t\t\t\t\t\t\t<span className=\"wp-block-post-terms__separator\">\n\t\t\t\t\t\t\t\t\t{ separator || ' ' }\n\t\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t\t{ curr }\n\t\t\t\t\t\t\t</>\n\t\t\t\t\t\t) ) }\n\t\t\t\t{ hasPost &&\n\t\t\t\t\t! isLoading &&\n\t\t\t\t\t! hasPostTerms &&\n\t\t\t\t\t( selectedTerm?.labels?.no_terms ||\n\t\t\t\t\t\t__( 'Term items not found.' ) ) }\n\t\t\t\t{ ! isLoading && ( isSelected || suffix ) && (\n\t\t\t\t\t<RichText\n\t\t\t\t\t\tidentifier=\"suffix\"\n\t\t\t\t\t\tallowedFormats={ ALLOWED_FORMATS }\n\t\t\t\t\t\tclassName=\"wp-block-post-terms__suffix\"\n\t\t\t\t\t\taria-label={ __( 'Suffix' ) }\n\t\t\t\t\t\tplaceholder={ ' ' + __( 'Suffix' ) }\n\t\t\t\t\t\tvalue={ suffix }\n\t\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\t\tsetAttributes( { suffix: value } )\n\t\t\t\t\t\t}\n\t\t\t\t\t\ttagName=\"span\"\n\t\t\t\t\t\t__unstableOnSplitAtEnd={ () =>\n\t\t\t\t\t\t\tinsertBlocksAfter(\n\t\t\t\t\t\t\t\tcreateBlock( getDefaultBlockName() )\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) }\n\t\t\t</div>\n\t\t</>\n\t);\n}\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;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;AAAA,mBAAa,WAAW,4CAAC,6BAAQ;AAAA,MACjC,CAAE,cAAe,cAAc,WAChC;AAAA,QAAC;AAAA;AAAA,UACA,YAAW;AAAA,UACX,gBAAiB;AAAA,UACjB,WAAU;AAAA,UACV,kBAAa,gBAAI,QAAS;AAAA,UAC1B,iBAAc,gBAAI,QAAS,IAAI;AAAA,UAC/B,OAAQ;AAAA,UACR,UAAW,CAAE,UACZ,cAAe,EAAE,QAAQ,MAAM,CAAE;AAAA,UAElC,SAAQ;AAAA;AAAA,MACT;AAAA,OAEG,CAAE,WAAW,CAAE,SAClB,4CAAC,UAAO,2BAAiB,OAAO;AAAA,MAE/B,WACD,CAAE,aACF,gBACA,UACE,IAAK,CAAE,aACP;AAAA,QAAC;AAAA;AAAA,UAEA,MAAO,SAAS;AAAA,UAChB,SAAU,CAAE,UAAW,MAAM,eAAe;AAAA,UAC5C,KAAI;AAAA,UAEF,mDAAgB,SAAS,IAAK;AAAA;AAAA,QAL1B,SAAS;AAAA,MAMhB,CACC,EACD,OAAQ,CAAE,MAAM,SAChB,4EACG;AAAA;AAAA,QACF,4CAAC,UAAK,WAAU,kCACb,uBAAa,KAChB;AAAA,QACE;AAAA,SACH,CACC;AAAA,MACF,WACD,CAAE,aACF,CAAE,iBACA,cAAc,QAAQ,gBACvB,gBAAI,uBAAwB;AAAA,MAC5B,CAAE,cAAe,cAAc,WAChC;AAAA,QAAC;AAAA;AAAA,UACA,YAAW;AAAA,UACX,gBAAiB;AAAA,UACjB,WAAU;AAAA,UACV,kBAAa,gBAAI,QAAS;AAAA,UAC1B,aAAc,UAAM,gBAAI,QAAS;AAAA,UACjC,OAAQ;AAAA,UACR,UAAW,CAAE,UACZ,cAAe,EAAE,QAAQ,MAAM,CAAE;AAAA,UAElC,SAAQ;AAAA,UACR,
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport {\n\tInspectorControls,\n\tuseBlockProps,\n\tuseBlockDisplayInformation,\n\tRichText,\n} from '@wordpress/block-editor';\nimport { createBlock, getDefaultBlockName } from '@wordpress/blocks';\nimport { Spinner, TextControl } from '@wordpress/components';\nimport { useSelect } from '@wordpress/data';\nimport { decodeEntities } from '@wordpress/html-entities';\nimport { __ } from '@wordpress/i18n';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport usePostTerms from './use-post-terms';\n\n// Allowed formats for the prefix and suffix fields.\nconst ALLOWED_FORMATS = [\n\t'core/bold',\n\t'core/image',\n\t'core/italic',\n\t'core/link',\n\t'core/strikethrough',\n\t'core/text-color',\n];\n\nexport default function PostTermsEdit( {\n\tattributes,\n\tclientId,\n\tcontext,\n\tisSelected,\n\tsetAttributes,\n\tinsertBlocksAfter,\n} ) {\n\tconst { term, separator, prefix, suffix } = attributes;\n\tconst { postId, postType } = context;\n\n\tconst selectedTerm = useSelect(\n\t\t( select ) => {\n\t\t\tif ( ! term ) {\n\t\t\t\treturn {};\n\t\t\t}\n\t\t\tconst { getTaxonomy } = select( coreStore );\n\t\t\tconst taxonomy = getTaxonomy( term );\n\t\t\treturn taxonomy?.visibility?.publicly_queryable ? taxonomy : {};\n\t\t},\n\t\t[ term ]\n\t);\n\tconst { postTerms, hasPostTerms, isLoading } = usePostTerms( {\n\t\tpostId,\n\t\tterm: selectedTerm,\n\t} );\n\tconst hasPost = postId && postType;\n\tconst blockInformation = useBlockDisplayInformation( clientId );\n\tconst blockProps = useBlockProps( {\n\t\tclassName: term && `taxonomy-${ term }`,\n\t} );\n\n\treturn (\n\t\t<>\n\t\t\t<InspectorControls group=\"advanced\">\n\t\t\t\t<TextControl\n\t\t\t\t\tautoComplete=\"off\"\n\t\t\t\t\tlabel={ __( 'Separator' ) }\n\t\t\t\t\tvalue={ separator || '' }\n\t\t\t\t\tonChange={ ( nextValue ) => {\n\t\t\t\t\t\tsetAttributes( { separator: nextValue } );\n\t\t\t\t\t} }\n\t\t\t\t\thelp={ __( 'Enter character(s) used to separate terms.' ) }\n\t\t\t\t/>\n\t\t\t</InspectorControls>\n\t\t\t<div { ...blockProps }>\n\t\t\t\t{ isLoading && hasPost && <Spinner /> }\n\t\t\t\t{ ! isLoading && ( isSelected || prefix ) && (\n\t\t\t\t\t<RichText\n\t\t\t\t\t\tidentifier=\"prefix\"\n\t\t\t\t\t\tallowedFormats={ ALLOWED_FORMATS }\n\t\t\t\t\t\tclassName=\"wp-block-post-terms__prefix\"\n\t\t\t\t\t\taria-label={ __( 'Prefix' ) }\n\t\t\t\t\t\tplaceholder={ __( 'Prefix' ) + ' ' }\n\t\t\t\t\t\tvalue={ prefix }\n\t\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\t\tsetAttributes( { prefix: value } )\n\t\t\t\t\t\t}\n\t\t\t\t\t\ttagName=\"span\"\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t\t{ ( ! hasPost || ! term ) && (\n\t\t\t\t\t<span>{ blockInformation.title }</span>\n\t\t\t\t) }\n\t\t\t\t{ hasPost &&\n\t\t\t\t\t! isLoading &&\n\t\t\t\t\thasPostTerms &&\n\t\t\t\t\tpostTerms\n\t\t\t\t\t\t.map( ( postTerm ) => (\n\t\t\t\t\t\t\t<a\n\t\t\t\t\t\t\t\tkey={ postTerm.id }\n\t\t\t\t\t\t\t\thref={ postTerm.link }\n\t\t\t\t\t\t\t\tonClick={ ( event ) => event.preventDefault() }\n\t\t\t\t\t\t\t\trel=\"tag\"\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{ decodeEntities( postTerm.name ) }\n\t\t\t\t\t\t\t</a>\n\t\t\t\t\t\t) )\n\t\t\t\t\t\t.reduce( ( prev, curr ) => (\n\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t{ prev }\n\t\t\t\t\t\t\t\t<span className=\"wp-block-post-terms__separator\">\n\t\t\t\t\t\t\t\t\t{ separator || ' ' }\n\t\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t\t{ curr }\n\t\t\t\t\t\t\t</>\n\t\t\t\t\t\t) ) }\n\t\t\t\t{ hasPost &&\n\t\t\t\t\t! isLoading &&\n\t\t\t\t\t! hasPostTerms &&\n\t\t\t\t\t( selectedTerm?.labels?.no_terms ||\n\t\t\t\t\t\t__( 'Term items not found.' ) ) }\n\t\t\t\t{ ! isLoading && ( isSelected || suffix ) && (\n\t\t\t\t\t<RichText\n\t\t\t\t\t\tidentifier=\"suffix\"\n\t\t\t\t\t\tallowedFormats={ ALLOWED_FORMATS }\n\t\t\t\t\t\tclassName=\"wp-block-post-terms__suffix\"\n\t\t\t\t\t\taria-label={ __( 'Suffix' ) }\n\t\t\t\t\t\tplaceholder={ ' ' + __( 'Suffix' ) }\n\t\t\t\t\t\tvalue={ suffix }\n\t\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\t\tsetAttributes( { suffix: value } )\n\t\t\t\t\t\t}\n\t\t\t\t\t\ttagName=\"span\"\n\t\t\t\t\t\t__unstableOnSplitAtEnd={\n\t\t\t\t\t\t\tinsertBlocksAfter\n\t\t\t\t\t\t\t\t? () =>\n\t\t\t\t\t\t\t\t\t\tinsertBlocksAfter(\n\t\t\t\t\t\t\t\t\t\t\tcreateBlock( getDefaultBlockName() )\n\t\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t: undefined\n\t\t\t\t\t\t}\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t</div>\n\t\t</>\n\t);\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,0BAKO;AACP,oBAAiD;AACjD,wBAAqC;AACrC,kBAA0B;AAC1B,2BAA+B;AAC/B,kBAAmB;AACnB,uBAAmC;AAKnC,4BAAyB;AA+CrB;AA5CJ,IAAM,kBAAkB;AAAA,EACvB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACD;AAEe,SAAR,cAAgC;AAAA,EACtC;AAAA,EACA;AAA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EAAE,QAAQ,MAAM,CAAE;AAAA,UAElC,SAAQ;AAAA;AAAA,MACT;AAAA,OAEG,CAAE,WAAW,CAAE,SAClB,4CAAC,UAAO,2BAAiB,OAAO;AAAA,MAE/B,WACD,CAAE,aACF,gBACA,UACE,IAAK,CAAE,aACP;AAAA,QAAC;AAAA;AAAA,UAEA,MAAO,SAAS;AAAA,UAChB,SAAU,CAAE,UAAW,MAAM,eAAe;AAAA,UAC5C,KAAI;AAAA,UAEF,mDAAgB,SAAS,IAAK;AAAA;AAAA,QAL1B,SAAS;AAAA,MAMhB,CACC,EACD,OAAQ,CAAE,MAAM,SAChB,4EACG;AAAA;AAAA,QACF,4CAAC,UAAK,WAAU,kCACb,uBAAa,KAChB;AAAA,QACE;AAAA,SACH,CACC;AAAA,MACF,WACD,CAAE,aACF,CAAE,iBACA,cAAc,QAAQ,gBACvB,gBAAI,uBAAwB;AAAA,MAC5B,CAAE,cAAe,cAAc,WAChC;AAAA,QAAC;AAAA;AAAA,UACA,YAAW;AAAA,UACX,gBAAiB;AAAA,UACjB,WAAU;AAAA,UACV,kBAAa,gBAAI,QAAS;AAAA,UAC1B,aAAc,UAAM,gBAAI,QAAS;AAAA,UACjC,OAAQ;AAAA,UACR,UAAW,CAAE,UACZ,cAAe,EAAE,QAAQ,MAAM,CAAE;AAAA,UAElC,SAAQ;AAAA,UACR,wBACC,oBACG,MACA;AAAA,gBACC,+BAAa,mCAAoB,CAAE;AAAA,UACpC,IACA;AAAA;AAAA,MAEL;AAAA,OAEF;AAAA,KACD;AAEF;",
|
|
6
6
|
"names": ["coreStore", "usePostTerms"]
|
|
7
7
|
}
|
|
@@ -60,9 +60,9 @@ function PostTitleEdit({
|
|
|
60
60
|
postId
|
|
61
61
|
);
|
|
62
62
|
const [link] = (0, import_core_data.useEntityProp)("postType", postType, "link", postId);
|
|
63
|
-
const onSplitAtEnd = () => {
|
|
63
|
+
const onSplitAtEnd = insertBlocksAfter ? () => {
|
|
64
64
|
insertBlocksAfter((0, import_blocks.createBlock)((0, import_blocks.getDefaultBlockName)()));
|
|
65
|
-
};
|
|
65
|
+
} : void 0;
|
|
66
66
|
const blockProps = (0, import_block_editor.useBlockProps)();
|
|
67
67
|
const blockEditingMode = (0, import_block_editor.useBlockEditingMode)();
|
|
68
68
|
const dropdownMenuProps = (0, import_hooks.useToolsPanelDropdownMenuProps)();
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/post-title/edit.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport {\n\tBlockControls,\n\tInspectorControls,\n\tuseBlockProps,\n\tPlainText,\n\tHeadingLevelDropdown,\n\tuseBlockEditingMode,\n} from '@wordpress/block-editor';\nimport {\n\tToggleControl,\n\tTextControl,\n\tExternalLink,\n\t__experimentalToolsPanel as ToolsPanel,\n\t__experimentalToolsPanelItem as ToolsPanelItem,\n} from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { createBlock, getDefaultBlockName } from '@wordpress/blocks';\nimport { useEntityProp, store as coreStore } from '@wordpress/core-data';\nimport { useSelect } from '@wordpress/data';\nimport { createInterpolateElement } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { useToolsPanelDropdownMenuProps } from '../utils/hooks';\n\nexport default function PostTitleEdit( {\n\tattributes: { level, levelOptions, isLink, rel, linkTarget, placeholder },\n\tsetAttributes,\n\tcontext: { postType, postId, queryId },\n\tinsertBlocksAfter,\n} ) {\n\tconst TagName = level === 0 ? 'p' : `h${ level }`;\n\tconst isDescendentOfQueryLoop = Number.isFinite( queryId );\n\tconst userCanEdit = useSelect(\n\t\t( select ) => {\n\t\t\t/**\n\t\t\t * useCanEditEntity may trigger an OPTIONS request to the REST API\n\t\t\t * via the canUser resolver. However, when the Post Title is a\n\t\t\t * descendant of a Query Loop block, the title cannot be edited. In\n\t\t\t * order to avoid these unnecessary requests, we call the hook\n\t\t\t * without the proper data, resulting in returning early without\n\t\t\t * making them.\n\t\t\t */\n\t\t\tif ( isDescendentOfQueryLoop ) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\treturn select( coreStore ).canUser( 'update', {\n\t\t\t\tkind: 'postType',\n\t\t\t\tname: postType,\n\t\t\t\tid: postId,\n\t\t\t} );\n\t\t},\n\t\t[ isDescendentOfQueryLoop, postType, postId ]\n\t);\n\tconst [ rawTitle = '', setTitle, fullTitle ] = useEntityProp(\n\t\t'postType',\n\t\tpostType,\n\t\t'title',\n\t\tpostId\n\t);\n\tconst [ link ] = useEntityProp( 'postType', postType, 'link', postId );\n\tconst onSplitAtEnd = () => {\n\t\tinsertBlocksAfter( createBlock( getDefaultBlockName() ) );\n\t};\n\tconst blockProps = useBlockProps();\n\tconst blockEditingMode = useBlockEditingMode();\n\tconst dropdownMenuProps = useToolsPanelDropdownMenuProps();\n\n\tlet titleElement = (\n\t\t<TagName { ...blockProps }>{ placeholder || __( 'Title' ) }</TagName>\n\t);\n\n\tif ( postType && postId ) {\n\t\ttitleElement = userCanEdit ? (\n\t\t\t<PlainText\n\t\t\t\ttagName={ TagName }\n\t\t\t\tplaceholder={ __( '(no title)' ) }\n\t\t\t\tvalue={ rawTitle }\n\t\t\t\tonChange={ setTitle }\n\t\t\t\t__experimentalVersion={ 2 }\n\t\t\t\t__unstableOnSplitAtEnd={ onSplitAtEnd }\n\t\t\t\t{ ...blockProps }\n\t\t\t/>\n\t\t) : (\n\t\t\t<TagName\n\t\t\t\t{ ...blockProps }\n\t\t\t\tdangerouslySetInnerHTML={ {\n\t\t\t\t\t__html: fullTitle?.rendered || __( '(no title)' ),\n\t\t\t\t} }\n\t\t\t/>\n\t\t);\n\t}\n\n\tif ( isLink && postType && postId ) {\n\t\ttitleElement = userCanEdit ? (\n\t\t\t<TagName { ...blockProps }>\n\t\t\t\t<PlainText\n\t\t\t\t\ttagName=\"a\"\n\t\t\t\t\thref={ link }\n\t\t\t\t\ttarget={ linkTarget }\n\t\t\t\t\trel={ rel }\n\t\t\t\t\tplaceholder={\n\t\t\t\t\t\t! rawTitle.length ? __( '(no title)' ) : null\n\t\t\t\t\t}\n\t\t\t\t\tvalue={ rawTitle }\n\t\t\t\t\tonChange={ setTitle }\n\t\t\t\t\t__experimentalVersion={ 2 }\n\t\t\t\t\t__unstableOnSplitAtEnd={ onSplitAtEnd }\n\t\t\t\t/>\n\t\t\t</TagName>\n\t\t) : (\n\t\t\t<TagName { ...blockProps }>\n\t\t\t\t<a\n\t\t\t\t\thref={ link }\n\t\t\t\t\ttarget={ linkTarget }\n\t\t\t\t\trel={ rel }\n\t\t\t\t\tonClick={ ( event ) => event.preventDefault() }\n\t\t\t\t\tdangerouslySetInnerHTML={ {\n\t\t\t\t\t\t__html: fullTitle?.rendered || __( '(no title)' ),\n\t\t\t\t\t} }\n\t\t\t\t/>\n\t\t\t</TagName>\n\t\t);\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t{ blockEditingMode === 'default' && (\n\t\t\t\t<>\n\t\t\t\t\t<BlockControls group=\"block\">\n\t\t\t\t\t\t<HeadingLevelDropdown\n\t\t\t\t\t\t\tvalue={ level }\n\t\t\t\t\t\t\toptions={ levelOptions }\n\t\t\t\t\t\t\tonChange={ ( newLevel ) =>\n\t\t\t\t\t\t\t\tsetAttributes( { level: newLevel } )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t/>\n\t\t\t\t\t</BlockControls>\n\t\t\t\t\t<InspectorControls>\n\t\t\t\t\t\t<ToolsPanel\n\t\t\t\t\t\t\tlabel={ __( 'Settings' ) }\n\t\t\t\t\t\t\tresetAll={ () => {\n\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\trel: '',\n\t\t\t\t\t\t\t\t\tlinkTarget: '_self',\n\t\t\t\t\t\t\t\t\tisLink: false,\n\t\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\tdropdownMenuProps={ dropdownMenuProps }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\t\t\tlabel={ __( 'Make title a link' ) }\n\t\t\t\t\t\t\t\tisShownByDefault\n\t\t\t\t\t\t\t\thasValue={ () => isLink }\n\t\t\t\t\t\t\t\tonDeselect={ () =>\n\t\t\t\t\t\t\t\t\tsetAttributes( { isLink: false } )\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\t\t\t\tlabel={ __( 'Make title a link' ) }\n\t\t\t\t\t\t\t\t\tonChange={ () =>\n\t\t\t\t\t\t\t\t\t\tsetAttributes( { isLink: ! isLink } )\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tchecked={ isLink }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t</ToolsPanelItem>\n\t\t\t\t\t\t\t{ isLink && (\n\t\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\t\t\t\t\tlabel={ __( 'Open in new tab' ) }\n\t\t\t\t\t\t\t\t\t\tisShownByDefault\n\t\t\t\t\t\t\t\t\t\thasValue={ () =>\n\t\t\t\t\t\t\t\t\t\t\tlinkTarget === '_blank'\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\tonDeselect={ () =>\n\t\t\t\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\t\t\t\tlinkTarget: '_self',\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>\n\t\t\t\t\t\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\t\t\t\t\t\tlabel={ __( 'Open in new tab' ) }\n\t\t\t\t\t\t\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\t\t\t\t\tlinkTarget: value\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t? '_blank'\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t: '_self',\n\t\t\t\t\t\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\tchecked={ linkTarget === '_blank' }\n\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t</ToolsPanelItem>\n\t\t\t\t\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\t\t\t\t\tlabel={ __( 'Link relation' ) }\n\t\t\t\t\t\t\t\t\t\tisShownByDefault\n\t\t\t\t\t\t\t\t\t\thasValue={ () => !! rel }\n\t\t\t\t\t\t\t\t\t\tonDeselect={ () =>\n\t\t\t\t\t\t\t\t\t\t\tsetAttributes( { rel: '' } )\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<TextControl\n\t\t\t\t\t\t\t\t\t\t\tlabel={ __( 'Link relation' ) }\n\t\t\t\t\t\t\t\t\t\t\thelp={ createInterpolateElement(\n\t\t\t\t\t\t\t\t\t\t\t\t__(\n\t\t\t\t\t\t\t\t\t\t\t\t\t'The <a>Link Relation</a> attribute defines the relationship between a linked resource and the current document.'\n\t\t\t\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\t\ta: (\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<ExternalLink href=\"https://developer.mozilla.org/docs/Web/HTML/Attributes/rel\" />\n\t\t\t\t\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t\tvalue={ rel }\n\t\t\t\t\t\t\t\t\t\t\tonChange={ ( newRel ) =>\n\t\t\t\t\t\t\t\t\t\t\t\tsetAttributes( { rel: newRel } )\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</ToolsPanelItem>\n\t\t\t\t\t\t\t\t</>\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t</ToolsPanel>\n\t\t\t\t\t</InspectorControls>\n\t\t\t\t</>\n\t\t\t) }\n\t\t\t{ titleElement }\n\t\t</>\n\t);\n}\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,0BAOO;AACP,wBAMO;AACP,kBAAmB;AACnB,oBAAiD;AACjD,uBAAkD;AAClD,kBAA0B;AAC1B,qBAAyC;AAKzC,mBAA+C;
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport {\n\tBlockControls,\n\tInspectorControls,\n\tuseBlockProps,\n\tPlainText,\n\tHeadingLevelDropdown,\n\tuseBlockEditingMode,\n} from '@wordpress/block-editor';\nimport {\n\tToggleControl,\n\tTextControl,\n\tExternalLink,\n\t__experimentalToolsPanel as ToolsPanel,\n\t__experimentalToolsPanelItem as ToolsPanelItem,\n} from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { createBlock, getDefaultBlockName } from '@wordpress/blocks';\nimport { useEntityProp, store as coreStore } from '@wordpress/core-data';\nimport { useSelect } from '@wordpress/data';\nimport { createInterpolateElement } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { useToolsPanelDropdownMenuProps } from '../utils/hooks';\n\nexport default function PostTitleEdit( {\n\tattributes: { level, levelOptions, isLink, rel, linkTarget, placeholder },\n\tsetAttributes,\n\tcontext: { postType, postId, queryId },\n\tinsertBlocksAfter,\n} ) {\n\tconst TagName = level === 0 ? 'p' : `h${ level }`;\n\tconst isDescendentOfQueryLoop = Number.isFinite( queryId );\n\tconst userCanEdit = useSelect(\n\t\t( select ) => {\n\t\t\t/**\n\t\t\t * useCanEditEntity may trigger an OPTIONS request to the REST API\n\t\t\t * via the canUser resolver. However, when the Post Title is a\n\t\t\t * descendant of a Query Loop block, the title cannot be edited. In\n\t\t\t * order to avoid these unnecessary requests, we call the hook\n\t\t\t * without the proper data, resulting in returning early without\n\t\t\t * making them.\n\t\t\t */\n\t\t\tif ( isDescendentOfQueryLoop ) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\treturn select( coreStore ).canUser( 'update', {\n\t\t\t\tkind: 'postType',\n\t\t\t\tname: postType,\n\t\t\t\tid: postId,\n\t\t\t} );\n\t\t},\n\t\t[ isDescendentOfQueryLoop, postType, postId ]\n\t);\n\tconst [ rawTitle = '', setTitle, fullTitle ] = useEntityProp(\n\t\t'postType',\n\t\tpostType,\n\t\t'title',\n\t\tpostId\n\t);\n\tconst [ link ] = useEntityProp( 'postType', postType, 'link', postId );\n\tconst onSplitAtEnd = insertBlocksAfter\n\t\t? () => {\n\t\t\t\tinsertBlocksAfter( createBlock( getDefaultBlockName() ) );\n\t\t }\n\t\t: undefined;\n\tconst blockProps = useBlockProps();\n\tconst blockEditingMode = useBlockEditingMode();\n\tconst dropdownMenuProps = useToolsPanelDropdownMenuProps();\n\n\tlet titleElement = (\n\t\t<TagName { ...blockProps }>{ placeholder || __( 'Title' ) }</TagName>\n\t);\n\n\tif ( postType && postId ) {\n\t\ttitleElement = userCanEdit ? (\n\t\t\t<PlainText\n\t\t\t\ttagName={ TagName }\n\t\t\t\tplaceholder={ __( '(no title)' ) }\n\t\t\t\tvalue={ rawTitle }\n\t\t\t\tonChange={ setTitle }\n\t\t\t\t__experimentalVersion={ 2 }\n\t\t\t\t__unstableOnSplitAtEnd={ onSplitAtEnd }\n\t\t\t\t{ ...blockProps }\n\t\t\t/>\n\t\t) : (\n\t\t\t<TagName\n\t\t\t\t{ ...blockProps }\n\t\t\t\tdangerouslySetInnerHTML={ {\n\t\t\t\t\t__html: fullTitle?.rendered || __( '(no title)' ),\n\t\t\t\t} }\n\t\t\t/>\n\t\t);\n\t}\n\n\tif ( isLink && postType && postId ) {\n\t\ttitleElement = userCanEdit ? (\n\t\t\t<TagName { ...blockProps }>\n\t\t\t\t<PlainText\n\t\t\t\t\ttagName=\"a\"\n\t\t\t\t\thref={ link }\n\t\t\t\t\ttarget={ linkTarget }\n\t\t\t\t\trel={ rel }\n\t\t\t\t\tplaceholder={\n\t\t\t\t\t\t! rawTitle.length ? __( '(no title)' ) : null\n\t\t\t\t\t}\n\t\t\t\t\tvalue={ rawTitle }\n\t\t\t\t\tonChange={ setTitle }\n\t\t\t\t\t__experimentalVersion={ 2 }\n\t\t\t\t\t__unstableOnSplitAtEnd={ onSplitAtEnd }\n\t\t\t\t/>\n\t\t\t</TagName>\n\t\t) : (\n\t\t\t<TagName { ...blockProps }>\n\t\t\t\t<a\n\t\t\t\t\thref={ link }\n\t\t\t\t\ttarget={ linkTarget }\n\t\t\t\t\trel={ rel }\n\t\t\t\t\tonClick={ ( event ) => event.preventDefault() }\n\t\t\t\t\tdangerouslySetInnerHTML={ {\n\t\t\t\t\t\t__html: fullTitle?.rendered || __( '(no title)' ),\n\t\t\t\t\t} }\n\t\t\t\t/>\n\t\t\t</TagName>\n\t\t);\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t{ blockEditingMode === 'default' && (\n\t\t\t\t<>\n\t\t\t\t\t<BlockControls group=\"block\">\n\t\t\t\t\t\t<HeadingLevelDropdown\n\t\t\t\t\t\t\tvalue={ level }\n\t\t\t\t\t\t\toptions={ levelOptions }\n\t\t\t\t\t\t\tonChange={ ( newLevel ) =>\n\t\t\t\t\t\t\t\tsetAttributes( { level: newLevel } )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t/>\n\t\t\t\t\t</BlockControls>\n\t\t\t\t\t<InspectorControls>\n\t\t\t\t\t\t<ToolsPanel\n\t\t\t\t\t\t\tlabel={ __( 'Settings' ) }\n\t\t\t\t\t\t\tresetAll={ () => {\n\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\trel: '',\n\t\t\t\t\t\t\t\t\tlinkTarget: '_self',\n\t\t\t\t\t\t\t\t\tisLink: false,\n\t\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\tdropdownMenuProps={ dropdownMenuProps }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\t\t\tlabel={ __( 'Make title a link' ) }\n\t\t\t\t\t\t\t\tisShownByDefault\n\t\t\t\t\t\t\t\thasValue={ () => isLink }\n\t\t\t\t\t\t\t\tonDeselect={ () =>\n\t\t\t\t\t\t\t\t\tsetAttributes( { isLink: false } )\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\t\t\t\tlabel={ __( 'Make title a link' ) }\n\t\t\t\t\t\t\t\t\tonChange={ () =>\n\t\t\t\t\t\t\t\t\t\tsetAttributes( { isLink: ! isLink } )\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tchecked={ isLink }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t</ToolsPanelItem>\n\t\t\t\t\t\t\t{ isLink && (\n\t\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\t\t\t\t\tlabel={ __( 'Open in new tab' ) }\n\t\t\t\t\t\t\t\t\t\tisShownByDefault\n\t\t\t\t\t\t\t\t\t\thasValue={ () =>\n\t\t\t\t\t\t\t\t\t\t\tlinkTarget === '_blank'\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\tonDeselect={ () =>\n\t\t\t\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\t\t\t\tlinkTarget: '_self',\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>\n\t\t\t\t\t\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\t\t\t\t\t\tlabel={ __( 'Open in new tab' ) }\n\t\t\t\t\t\t\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\t\t\t\t\tlinkTarget: value\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t? '_blank'\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t: '_self',\n\t\t\t\t\t\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\tchecked={ linkTarget === '_blank' }\n\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t</ToolsPanelItem>\n\t\t\t\t\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\t\t\t\t\tlabel={ __( 'Link relation' ) }\n\t\t\t\t\t\t\t\t\t\tisShownByDefault\n\t\t\t\t\t\t\t\t\t\thasValue={ () => !! rel }\n\t\t\t\t\t\t\t\t\t\tonDeselect={ () =>\n\t\t\t\t\t\t\t\t\t\t\tsetAttributes( { rel: '' } )\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<TextControl\n\t\t\t\t\t\t\t\t\t\t\tlabel={ __( 'Link relation' ) }\n\t\t\t\t\t\t\t\t\t\t\thelp={ createInterpolateElement(\n\t\t\t\t\t\t\t\t\t\t\t\t__(\n\t\t\t\t\t\t\t\t\t\t\t\t\t'The <a>Link Relation</a> attribute defines the relationship between a linked resource and the current document.'\n\t\t\t\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\t\ta: (\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<ExternalLink href=\"https://developer.mozilla.org/docs/Web/HTML/Attributes/rel\" />\n\t\t\t\t\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t) }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AC,kBAAAA;AAAA,gBAAA;AAAA,kBACA,WAAQ,gBAAI,eAAgB;AAAA,kBAC5B,kBAAgB;AAAA,kBAChB,UAAW,MAAM,CAAC,CAAE;AAAA,kBACpB,YAAa,MACZ,cAAe,EAAE,KAAK,GAAG,CAAE;AAAA,kBAG5B;AAAA,oBAAC;AAAA;AAAA,sBACA,WAAQ,gBAAI,eAAgB;AAAA,sBAC5B,UAAO;AAAA,4BACN;AAAA,0BACC;AAAA,wBACD;AAAA,wBACA;AAAA,0BACC,GACC,4CAAC,kCAAa,MAAK,8DAA6D;AAAA,wBAElF;AAAA,sBACD;AAAA,sBACA,OAAQ;AAAA,sBACR,UAAW,CAAE,WACZ,cAAe,EAAE,KAAK,OAAO,CAAE;AAAA;AAAA,kBAEjC;AAAA;AAAA,cACD;AAAA,eACD;AAAA;AAAA;AAAA,MAEF,GACD;AAAA,OACD;AAAA,IAEC;AAAA,KACH;AAEF;",
|
|
6
6
|
"names": ["coreStore", "ToolsPanel", "ToolsPanelItem"]
|
|
7
7
|
}
|
|
@@ -55,7 +55,9 @@ function PreformattedEdit({
|
|
|
55
55
|
onMerge: mergeBlocks,
|
|
56
56
|
...blockProps,
|
|
57
57
|
__unstablePastePlainText: true,
|
|
58
|
-
__unstableOnSplitAtDoubleLineEnd: () => insertBlocksAfter(
|
|
58
|
+
__unstableOnSplitAtDoubleLineEnd: insertBlocksAfter ? () => insertBlocksAfter(
|
|
59
|
+
(0, import_blocks.createBlock)((0, import_blocks.getDefaultBlockName)())
|
|
60
|
+
) : void 0
|
|
59
61
|
}
|
|
60
62
|
);
|
|
61
63
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/preformatted/edit.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { RichText, useBlockProps } from '@wordpress/block-editor';\nimport { createBlock, getDefaultBlockName } from '@wordpress/blocks';\n\nexport default function PreformattedEdit( {\n\tattributes,\n\tmergeBlocks,\n\tsetAttributes,\n\tonRemove,\n\tinsertBlocksAfter,\n\tstyle,\n} ) {\n\tconst { content } = attributes;\n\tconst blockProps = useBlockProps( { style } );\n\n\treturn (\n\t\t<RichText\n\t\t\ttagName=\"pre\"\n\t\t\tidentifier=\"content\"\n\t\t\tpreserveWhiteSpace\n\t\t\tvalue={ content }\n\t\t\tonChange={ ( nextContent ) => {\n\t\t\t\tsetAttributes( {\n\t\t\t\t\tcontent: nextContent,\n\t\t\t\t} );\n\t\t\t} }\n\t\t\tonRemove={ onRemove }\n\t\t\taria-label={ __( 'Preformatted text' ) }\n\t\t\tplaceholder={ __( 'Write preformatted text…' ) }\n\t\t\tonMerge={ mergeBlocks }\n\t\t\t{ ...blockProps }\n\t\t\t__unstablePastePlainText\n\t\t\t__unstableOnSplitAtDoubleLineEnd={ () =>\n\t\t\t\tinsertBlocksAfter(
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,kBAAmB;AACnB,0BAAwC;AACxC,oBAAiD;AAc/C;AAZa,SAAR,iBAAmC;AAAA,EACzC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACD,GAAI;AACH,QAAM,EAAE,QAAQ,IAAI;AACpB,QAAM,iBAAa,mCAAe,EAAE,MAAM,CAAE;AAE5C,SACC;AAAA,IAAC;AAAA;AAAA,MACA,SAAQ;AAAA,MACR,YAAW;AAAA,MACX,oBAAkB;AAAA,MAClB,OAAQ;AAAA,MACR,UAAW,CAAE,gBAAiB;AAC7B,sBAAe;AAAA,UACd,SAAS;AAAA,QACV,CAAE;AAAA,MACH;AAAA,MACA;AAAA,MACA,kBAAa,gBAAI,mBAAoB;AAAA,MACrC,iBAAc,gBAAI,0BAA2B;AAAA,MAC7C,SAAU;AAAA,MACR,GAAG;AAAA,MACL,0BAAwB;AAAA,MACxB,
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { RichText, useBlockProps } from '@wordpress/block-editor';\nimport { createBlock, getDefaultBlockName } from '@wordpress/blocks';\n\nexport default function PreformattedEdit( {\n\tattributes,\n\tmergeBlocks,\n\tsetAttributes,\n\tonRemove,\n\tinsertBlocksAfter,\n\tstyle,\n} ) {\n\tconst { content } = attributes;\n\tconst blockProps = useBlockProps( { style } );\n\n\treturn (\n\t\t<RichText\n\t\t\ttagName=\"pre\"\n\t\t\tidentifier=\"content\"\n\t\t\tpreserveWhiteSpace\n\t\t\tvalue={ content }\n\t\t\tonChange={ ( nextContent ) => {\n\t\t\t\tsetAttributes( {\n\t\t\t\t\tcontent: nextContent,\n\t\t\t\t} );\n\t\t\t} }\n\t\t\tonRemove={ onRemove }\n\t\t\taria-label={ __( 'Preformatted text' ) }\n\t\t\tplaceholder={ __( 'Write preformatted text…' ) }\n\t\t\tonMerge={ mergeBlocks }\n\t\t\t{ ...blockProps }\n\t\t\t__unstablePastePlainText\n\t\t\t__unstableOnSplitAtDoubleLineEnd={\n\t\t\t\tinsertBlocksAfter\n\t\t\t\t\t? () =>\n\t\t\t\t\t\t\tinsertBlocksAfter(\n\t\t\t\t\t\t\t\tcreateBlock( getDefaultBlockName() )\n\t\t\t\t\t\t\t)\n\t\t\t\t\t: undefined\n\t\t\t}\n\t\t/>\n\t);\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,kBAAmB;AACnB,0BAAwC;AACxC,oBAAiD;AAc/C;AAZa,SAAR,iBAAmC;AAAA,EACzC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACD,GAAI;AACH,QAAM,EAAE,QAAQ,IAAI;AACpB,QAAM,iBAAa,mCAAe,EAAE,MAAM,CAAE;AAE5C,SACC;AAAA,IAAC;AAAA;AAAA,MACA,SAAQ;AAAA,MACR,YAAW;AAAA,MACX,oBAAkB;AAAA,MAClB,OAAQ;AAAA,MACR,UAAW,CAAE,gBAAiB;AAC7B,sBAAe;AAAA,UACd,SAAS;AAAA,QACV,CAAE;AAAA,MACH;AAAA,MACA;AAAA,MACA,kBAAa,gBAAI,mBAAoB;AAAA,MACrC,iBAAc,gBAAI,0BAA2B;AAAA,MAC7C,SAAU;AAAA,MACR,GAAG;AAAA,MACL,0BAAwB;AAAA,MACxB,kCACC,oBACG,MACA;AAAA,YACC,+BAAa,mCAAoB,CAAE;AAAA,MACpC,IACA;AAAA;AAAA,EAEL;AAEF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/build/pullquote/edit.cjs
CHANGED
|
@@ -79,9 +79,11 @@ function PullQuoteEdit(props) {
|
|
|
79
79
|
citation: nextCitation
|
|
80
80
|
}),
|
|
81
81
|
className: "wp-block-pullquote__citation",
|
|
82
|
-
__unstableOnSplitAtEnd: () => insertBlocksAfter(
|
|
83
|
-
(0, import_blocks.createBlock)(
|
|
84
|
-
|
|
82
|
+
__unstableOnSplitAtEnd: insertBlocksAfter ? () => insertBlocksAfter(
|
|
83
|
+
(0, import_blocks.createBlock)(
|
|
84
|
+
(0, import_blocks.getDefaultBlockName)()
|
|
85
|
+
)
|
|
86
|
+
) : void 0
|
|
85
87
|
}
|
|
86
88
|
)
|
|
87
89
|
] }) }) });
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/pullquote/edit.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { RichText, useBlockProps } from '@wordpress/block-editor';\nimport { createBlock, getDefaultBlockName } from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport { Figure } from './figure';\nimport { BlockQuote } from './blockquote';\nimport useDeprecatedTextAlign from '../utils/deprecated-text-align-attributes';\n\nfunction PullQuoteEdit( props ) {\n\tconst { attributes, setAttributes, isSelected, insertBlocksAfter } = props;\n\tuseDeprecatedTextAlign( props );\n\tconst { citation, value } = attributes;\n\tconst blockProps = useBlockProps();\n\tconst shouldShowCitation = ! RichText.isEmpty( citation ) || isSelected;\n\n\treturn (\n\t\t<>\n\t\t\t<Figure { ...blockProps }>\n\t\t\t\t<BlockQuote>\n\t\t\t\t\t<RichText\n\t\t\t\t\t\tidentifier=\"value\"\n\t\t\t\t\t\ttagName=\"p\"\n\t\t\t\t\t\tvalue={ value }\n\t\t\t\t\t\tonChange={ ( nextValue ) =>\n\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\tvalue: nextValue,\n\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t}\n\t\t\t\t\t\taria-label={ __( 'Pullquote text' ) }\n\t\t\t\t\t\tplaceholder={\n\t\t\t\t\t\t\t// translators: placeholder text used for the quote\n\t\t\t\t\t\t\t__( 'Add quote' )\n\t\t\t\t\t\t}\n\t\t\t\t\t/>\n\t\t\t\t\t{ shouldShowCitation && (\n\t\t\t\t\t\t<RichText\n\t\t\t\t\t\t\tidentifier=\"citation\"\n\t\t\t\t\t\t\ttagName=\"cite\"\n\t\t\t\t\t\t\tstyle={ { display: 'block' } }\n\t\t\t\t\t\t\tvalue={ citation }\n\t\t\t\t\t\t\taria-label={ __( 'Pullquote citation text' ) }\n\t\t\t\t\t\t\tplaceholder={\n\t\t\t\t\t\t\t\t// translators: placeholder text used for the citation\n\t\t\t\t\t\t\t\t__( 'Add citation' )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tonChange={ ( nextCitation ) =>\n\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\tcitation: nextCitation,\n\t\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tclassName=\"wp-block-pullquote__citation\"\n\t\t\t\t\t\t\t__unstableOnSplitAtEnd={ () =>\n\t\t\t\t\t\t\t\tinsertBlocksAfter(\n\t\t\t\t\t\t\t\t\tcreateBlock(
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,kBAAmB;AACnB,0BAAwC;AACxC,oBAAiD;AAKjD,oBAAuB;AACvB,wBAA2B;AAC3B,8CAAmC;AAUjC;AARF,SAAS,cAAe,OAAQ;AAC/B,QAAM,EAAE,YAAY,eAAe,YAAY,kBAAkB,IAAI;AACrE,8CAAAA,SAAwB,KAAM;AAC9B,QAAM,EAAE,UAAU,MAAM,IAAI;AAC5B,QAAM,iBAAa,mCAAc;AACjC,QAAM,qBAAqB,CAAE,6BAAS,QAAS,QAAS,KAAK;AAE7D,SACC,2EACC,sDAAC,wBAAS,GAAG,YACZ,uDAAC,gCACA;AAAA;AAAA,MAAC;AAAA;AAAA,QACA,YAAW;AAAA,QACX,SAAQ;AAAA,QACR;AAAA,QACA,UAAW,CAAE,cACZ,cAAe;AAAA,UACd,OAAO;AAAA,QACR,CAAE;AAAA,QAEH,kBAAa,gBAAI,gBAAiB;AAAA,QAClC;AAAA;AAAA,cAEC,gBAAI,WAAY;AAAA;AAAA;AAAA,IAElB;AAAA,IACE,sBACD;AAAA,MAAC;AAAA;AAAA,QACA,YAAW;AAAA,QACX,SAAQ;AAAA,QACR,OAAQ,EAAE,SAAS,QAAQ;AAAA,QAC3B,OAAQ;AAAA,QACR,kBAAa,gBAAI,yBAA0B;AAAA,QAC3C;AAAA;AAAA,cAEC,gBAAI,cAAe;AAAA;AAAA,QAEpB,UAAW,CAAE,iBACZ,cAAe;AAAA,UACd,UAAU;AAAA,QACX,CAAE;AAAA,QAEH,WAAU;AAAA,QACV,
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { RichText, useBlockProps } from '@wordpress/block-editor';\nimport { createBlock, getDefaultBlockName } from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport { Figure } from './figure';\nimport { BlockQuote } from './blockquote';\nimport useDeprecatedTextAlign from '../utils/deprecated-text-align-attributes';\n\nfunction PullQuoteEdit( props ) {\n\tconst { attributes, setAttributes, isSelected, insertBlocksAfter } = props;\n\tuseDeprecatedTextAlign( props );\n\tconst { citation, value } = attributes;\n\tconst blockProps = useBlockProps();\n\tconst shouldShowCitation = ! RichText.isEmpty( citation ) || isSelected;\n\n\treturn (\n\t\t<>\n\t\t\t<Figure { ...blockProps }>\n\t\t\t\t<BlockQuote>\n\t\t\t\t\t<RichText\n\t\t\t\t\t\tidentifier=\"value\"\n\t\t\t\t\t\ttagName=\"p\"\n\t\t\t\t\t\tvalue={ value }\n\t\t\t\t\t\tonChange={ ( nextValue ) =>\n\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\tvalue: nextValue,\n\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t}\n\t\t\t\t\t\taria-label={ __( 'Pullquote text' ) }\n\t\t\t\t\t\tplaceholder={\n\t\t\t\t\t\t\t// translators: placeholder text used for the quote\n\t\t\t\t\t\t\t__( 'Add quote' )\n\t\t\t\t\t\t}\n\t\t\t\t\t/>\n\t\t\t\t\t{ shouldShowCitation && (\n\t\t\t\t\t\t<RichText\n\t\t\t\t\t\t\tidentifier=\"citation\"\n\t\t\t\t\t\t\ttagName=\"cite\"\n\t\t\t\t\t\t\tstyle={ { display: 'block' } }\n\t\t\t\t\t\t\tvalue={ citation }\n\t\t\t\t\t\t\taria-label={ __( 'Pullquote citation text' ) }\n\t\t\t\t\t\t\tplaceholder={\n\t\t\t\t\t\t\t\t// translators: placeholder text used for the citation\n\t\t\t\t\t\t\t\t__( 'Add citation' )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tonChange={ ( nextCitation ) =>\n\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\tcitation: nextCitation,\n\t\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tclassName=\"wp-block-pullquote__citation\"\n\t\t\t\t\t\t\t__unstableOnSplitAtEnd={\n\t\t\t\t\t\t\t\tinsertBlocksAfter\n\t\t\t\t\t\t\t\t\t? () =>\n\t\t\t\t\t\t\t\t\t\t\tinsertBlocksAfter(\n\t\t\t\t\t\t\t\t\t\t\t\tcreateBlock(\n\t\t\t\t\t\t\t\t\t\t\t\t\tgetDefaultBlockName()\n\t\t\t\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t\t: undefined\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</BlockQuote>\n\t\t\t</Figure>\n\t\t</>\n\t);\n}\n\nexport default PullQuoteEdit;\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,kBAAmB;AACnB,0BAAwC;AACxC,oBAAiD;AAKjD,oBAAuB;AACvB,wBAA2B;AAC3B,8CAAmC;AAUjC;AARF,SAAS,cAAe,OAAQ;AAC/B,QAAM,EAAE,YAAY,eAAe,YAAY,kBAAkB,IAAI;AACrE,8CAAAA,SAAwB,KAAM;AAC9B,QAAM,EAAE,UAAU,MAAM,IAAI;AAC5B,QAAM,iBAAa,mCAAc;AACjC,QAAM,qBAAqB,CAAE,6BAAS,QAAS,QAAS,KAAK;AAE7D,SACC,2EACC,sDAAC,wBAAS,GAAG,YACZ,uDAAC,gCACA;AAAA;AAAA,MAAC;AAAA;AAAA,QACA,YAAW;AAAA,QACX,SAAQ;AAAA,QACR;AAAA,QACA,UAAW,CAAE,cACZ,cAAe;AAAA,UACd,OAAO;AAAA,QACR,CAAE;AAAA,QAEH,kBAAa,gBAAI,gBAAiB;AAAA,QAClC;AAAA;AAAA,cAEC,gBAAI,WAAY;AAAA;AAAA;AAAA,IAElB;AAAA,IACE,sBACD;AAAA,MAAC;AAAA;AAAA,QACA,YAAW;AAAA,QACX,SAAQ;AAAA,QACR,OAAQ,EAAE,SAAS,QAAQ;AAAA,QAC3B,OAAQ;AAAA,QACR,kBAAa,gBAAI,yBAA0B;AAAA,QAC3C;AAAA;AAAA,cAEC,gBAAI,cAAe;AAAA;AAAA,QAEpB,UAAW,CAAE,iBACZ,cAAe;AAAA,UACd,UAAU;AAAA,QACX,CAAE;AAAA,QAEH,WAAU;AAAA,QACV,wBACC,oBACG,MACA;AAAA,cACC;AAAA,gBACC,mCAAoB;AAAA,UACrB;AAAA,QACD,IACA;AAAA;AAAA,IAEL;AAAA,KAEF,GACD,GACD;AAEF;AAEA,IAAO,eAAQ;",
|
|
6
6
|
"names": ["useDeprecatedTextAlign"]
|
|
7
7
|
}
|
|
@@ -335,7 +335,10 @@ function QueryInspectorControls(props) {
|
|
|
335
335
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
336
336
|
import_components.__experimentalToolsPanelItem,
|
|
337
337
|
{
|
|
338
|
-
label: (0, import_i18n.
|
|
338
|
+
label: (0, import_i18n._x)(
|
|
339
|
+
"Offset",
|
|
340
|
+
"Number of posts to skip in a query"
|
|
341
|
+
),
|
|
339
342
|
hasValue: () => offset > 0,
|
|
340
343
|
onDeselect: () => setQuery({ offset: 0 }),
|
|
341
344
|
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/query/edit/inspector-controls/index.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport {\n\tTextControl,\n\tSelectControl,\n\tNotice,\n\t__experimentalVStack as VStack,\n\t__experimentalToolsPanel as ToolsPanel,\n\t__experimentalToolsPanelItem as ToolsPanelItem,\n\tToggleControl,\n\t__experimentalToggleGroupControl as ToggleGroupControl,\n\t__experimentalToggleGroupControlOption as ToggleGroupControlOption,\n} from '@wordpress/components';\nimport { useSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { debounce } from '@wordpress/compose';\nimport { useState, useMemo } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport OrderControl from './order-control';\nimport AuthorControl from './author-control';\nimport ParentControl from './parent-control';\nimport { TaxonomyControls } from './taxonomy-controls';\nimport FormatControls from './format-controls';\nimport StickyControl from './sticky-control';\nimport PerPageControl from './per-page-control';\nimport OffsetControl from './offset-controls';\nimport PagesControl from './pages-control';\nimport {\n\tusePostTypes,\n\tuseIsPostTypeHierarchical,\n\tuseAllowedControls,\n\tisControlAllowed,\n\tuseTaxonomies,\n\tuseOrderByOptions,\n} from '../../utils';\nimport { useToolsPanelDropdownMenuProps } from '../../../utils/hooks';\n\nexport default function QueryInspectorControls( props ) {\n\tconst { attributes, setQuery, isSingular, shouldExcludeCurrentPost } =\n\t\tprops;\n\tconst { query } = attributes;\n\tconst {\n\t\torder,\n\t\torderBy,\n\t\tauthor: authorIds,\n\t\tpages,\n\t\tpostType,\n\t\tperPage,\n\t\toffset,\n\t\tsticky,\n\t\tinherit,\n\t\ttaxQuery,\n\t\tparents,\n\t\tformat,\n\t\texcludeCurrent,\n\t} = query;\n\tconst allowedControls = useAllowedControls( attributes );\n\tconst showSticky = postType === 'post';\n\tconst {\n\t\tpostTypesTaxonomiesMap,\n\t\tpostTypesSelectOptions,\n\t\tpostTypeFormatSupportMap,\n\t} = usePostTypes();\n\tconst taxonomies = useTaxonomies( postType );\n\tconst isPostTypeHierarchical = useIsPostTypeHierarchical( postType );\n\tconst onPostTypeChange = ( newValue ) => {\n\t\tconst updateQuery = { postType: newValue };\n\t\t// We need to dynamically update the `taxQuery` property,\n\t\t// by removing any not supported taxonomy from the query.\n\t\tconst supportedTaxonomies = postTypesTaxonomiesMap[ newValue ];\n\t\tif ( !! supportedTaxonomies?.length && !! taxQuery ) {\n\t\t\t// Shared utility to build taxQuery based on supported taxonomies.\n\t\t\tconst buildTaxQuery = ( _taxQuery ) => {\n\t\t\t\treturn Object.entries( _taxQuery || {} ).reduce(\n\t\t\t\t\t( accumulator, [ taxonomy, terms ] ) => {\n\t\t\t\t\t\tif ( supportedTaxonomies.includes( taxonomy ) ) {\n\t\t\t\t\t\t\taccumulator[ taxonomy ] = terms;\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn accumulator;\n\t\t\t\t\t},\n\t\t\t\t\t{}\n\t\t\t\t);\n\t\t\t};\n\t\t\tconst updatedTaxQuery = {};\n\t\t\tconst builtIncludeTaxQuery = buildTaxQuery( taxQuery.include );\n\t\t\tif ( !! Object.keys( builtIncludeTaxQuery ).length ) {\n\t\t\t\tupdatedTaxQuery.include = builtIncludeTaxQuery;\n\t\t\t}\n\t\t\tconst builtExcludeTaxQuery = buildTaxQuery( taxQuery.exclude );\n\t\t\tif ( !! Object.keys( builtExcludeTaxQuery ).length ) {\n\t\t\t\tupdatedTaxQuery.exclude = builtExcludeTaxQuery;\n\t\t\t}\n\t\t\tupdateQuery.taxQuery = !! Object.keys( updatedTaxQuery ).length\n\t\t\t\t? updatedTaxQuery\n\t\t\t\t: undefined;\n\t\t}\n\n\t\tif ( newValue !== 'post' ) {\n\t\t\tupdateQuery.sticky = '';\n\t\t}\n\t\t// We need to reset `parents` because they are tied to each post type.\n\t\tupdateQuery.parents = [];\n\t\t// Post types can register post format support with `add_post_type_support`.\n\t\t// But we need to reset the `format` property when switching to post types\n\t\t// that do not support post formats.\n\t\tconst hasFormatSupport = postTypeFormatSupportMap[ newValue ];\n\t\tif ( ! hasFormatSupport ) {\n\t\t\tupdateQuery.format = [];\n\t\t}\n\n\t\tsetQuery( updateQuery );\n\t};\n\tconst [ querySearch, setQuerySearch ] = useState( query.search );\n\tconst debouncedQuerySearch = useMemo( () => {\n\t\treturn debounce( ( newQuerySearch ) => {\n\t\t\tsetQuery( { search: newQuerySearch } );\n\t\t}, 250 );\n\t}, [ setQuery ] );\n\n\tconst orderByOptions = useOrderByOptions( postType );\n\tconst showInheritControl = isControlAllowed( allowedControls, 'inherit' );\n\tconst showPostTypeControl =\n\t\t! inherit && isControlAllowed( allowedControls, 'postType' );\n\tconst postTypeControlLabel = __( 'Post type' );\n\tconst postTypeControlHelp = __(\n\t\t'Select the type of content to display: posts, pages, or custom post types.'\n\t);\n\tconst showOrderControl =\n\t\t! inherit && isControlAllowed( allowedControls, 'order' );\n\tconst showStickyControl =\n\t\t! inherit &&\n\t\tshowSticky &&\n\t\tisControlAllowed( allowedControls, 'sticky' );\n\tconst showSettingsPanel =\n\t\tshowInheritControl ||\n\t\tshowPostTypeControl ||\n\t\tshowOrderControl ||\n\t\tshowStickyControl;\n\tconst showTaxControl =\n\t\t!! taxonomies?.length &&\n\t\tisControlAllowed( allowedControls, 'taxQuery' );\n\tconst showAuthorControl = isControlAllowed( allowedControls, 'author' );\n\tconst showSearchControl = isControlAllowed( allowedControls, 'search' );\n\tconst showParentControl =\n\t\tisControlAllowed( allowedControls, 'parents' ) &&\n\t\tisPostTypeHierarchical;\n\n\tconst postTypeHasFormatSupport = postTypeFormatSupportMap[ postType ];\n\tconst showFormatControl = useSelect(\n\t\t( select ) => {\n\t\t\t// Check if the post type supports post formats and if the control is allowed.\n\t\t\tif (\n\t\t\t\t! postTypeHasFormatSupport ||\n\t\t\t\t! isControlAllowed( allowedControls, 'format' )\n\t\t\t) {\n\t\t\t\treturn false;\n\t\t\t}\n\n\t\t\tconst themeSupports = select( coreStore ).getThemeSupports();\n\n\t\t\t// If there are no supported formats, getThemeSupports still includes the default 'standard' format,\n\t\t\t// and in this case the control should not be shown since the user has no other formats to choose from.\n\t\t\treturn (\n\t\t\t\tthemeSupports.formats &&\n\t\t\t\tthemeSupports.formats.length > 0 &&\n\t\t\t\tthemeSupports.formats.some( ( type ) => type !== 'standard' )\n\t\t\t);\n\t\t},\n\t\t[ allowedControls, postTypeHasFormatSupport ]\n\t);\n\n\tconst showExcludeCurrentControl =\n\t\tshouldExcludeCurrentPost &&\n\t\tisControlAllowed( allowedControls, 'excludeCurrent' );\n\tconst postTypeSingularName = useSelect(\n\t\t( select ) =>\n\t\t\tselect( coreStore ).getPostType( postType )?.labels.singular_name,\n\t\t[ postType ]\n\t);\n\n\tconst showFiltersPanel =\n\t\tshowTaxControl ||\n\t\tshowAuthorControl ||\n\t\tshowSearchControl ||\n\t\tshowParentControl ||\n\t\tshowFormatControl ||\n\t\tshowExcludeCurrentControl;\n\tconst dropdownMenuProps = useToolsPanelDropdownMenuProps();\n\n\tconst showPostCountControl = isControlAllowed(\n\t\tallowedControls,\n\t\t'postCount'\n\t);\n\tconst showOffSetControl = isControlAllowed( allowedControls, 'offset' );\n\tconst showPagesControl = isControlAllowed( allowedControls, 'pages' );\n\n\tconst showDisplayPanel =\n\t\tshowPostCountControl || showOffSetControl || showPagesControl;\n\n\t// The block cannot inherit a default WordPress query in singular content (e.g., post, page, 404, blank).\n\t// Warn users but still permit this type of query for exceptional cases in Classic and Hybrid themes.\n\tconst hasInheritanceWarning = isSingular && inherit;\n\n\treturn (\n\t\t<>\n\t\t\t{ showSettingsPanel && (\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\tsetQuery( {\n\t\t\t\t\t\t\tpostType: 'post',\n\t\t\t\t\t\t\torder: 'desc',\n\t\t\t\t\t\t\torderBy: 'date',\n\t\t\t\t\t\t\tsticky: '',\n\t\t\t\t\t\t\tinherit: true,\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{ showInheritControl && (\n\t\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\t\thasValue={ () => ! inherit }\n\t\t\t\t\t\t\tlabel={ __( 'Query type' ) }\n\t\t\t\t\t\t\tonDeselect={ () => setQuery( { inherit: true } ) }\n\t\t\t\t\t\t\tisShownByDefault\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<VStack spacing={ 4 }>\n\t\t\t\t\t\t\t\t<ToggleGroupControl\n\t\t\t\t\t\t\t\t\tlabel={ __( 'Query type' ) }\n\t\t\t\t\t\t\t\t\tisBlock\n\t\t\t\t\t\t\t\t\tonChange={ ( value ) => {\n\t\t\t\t\t\t\t\t\t\tsetQuery( {\n\t\t\t\t\t\t\t\t\t\t\tinherit: value === 'default',\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\thelp={\n\t\t\t\t\t\t\t\t\t\tinherit\n\t\t\t\t\t\t\t\t\t\t\t? __(\n\t\t\t\t\t\t\t\t\t\t\t\t\t'Display a list of posts or custom post types based on the current template.'\n\t\t\t\t\t\t\t\t\t\t\t )\n\t\t\t\t\t\t\t\t\t\t\t: __(\n\t\t\t\t\t\t\t\t\t\t\t\t\t'Display a list of posts or custom post types based on specific criteria.'\n\t\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\tvalue={ !! inherit ? 'default' : 'custom' }\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t<ToggleGroupControlOption\n\t\t\t\t\t\t\t\t\t\tvalue=\"default\"\n\t\t\t\t\t\t\t\t\t\tlabel={ __( 'Default' ) }\n\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t<ToggleGroupControlOption\n\t\t\t\t\t\t\t\t\t\tvalue=\"custom\"\n\t\t\t\t\t\t\t\t\t\tlabel={ __( 'Custom' ) }\n\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t</ToggleGroupControl>\n\t\t\t\t\t\t\t\t{ hasInheritanceWarning && (\n\t\t\t\t\t\t\t\t\t<Notice\n\t\t\t\t\t\t\t\t\t\tstatus=\"warning\"\n\t\t\t\t\t\t\t\t\t\tisDismissible={ false }\n\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\t\t'Cannot inherit the current template query when placed inside the singular content (e.g., post, page, 404, blank).'\n\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t</Notice>\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t</VStack>\n\t\t\t\t\t\t</ToolsPanelItem>\n\t\t\t\t\t) }\n\n\t\t\t\t\t{ showPostTypeControl && (\n\t\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\t\thasValue={ () => postType !== 'post' }\n\t\t\t\t\t\t\tlabel={ postTypeControlLabel }\n\t\t\t\t\t\t\tonDeselect={ () => onPostTypeChange( 'post' ) }\n\t\t\t\t\t\t\tisShownByDefault\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ postTypesSelectOptions.length > 2 ? (\n\t\t\t\t\t\t\t\t<SelectControl\n\t\t\t\t\t\t\t\t\toptions={ postTypesSelectOptions }\n\t\t\t\t\t\t\t\t\tvalue={ postType }\n\t\t\t\t\t\t\t\t\tlabel={ postTypeControlLabel }\n\t\t\t\t\t\t\t\t\tonChange={ onPostTypeChange }\n\t\t\t\t\t\t\t\t\thelp={ postTypeControlHelp }\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<ToggleGroupControl\n\t\t\t\t\t\t\t\t\tisBlock\n\t\t\t\t\t\t\t\t\tvalue={ postType }\n\t\t\t\t\t\t\t\t\tlabel={ postTypeControlLabel }\n\t\t\t\t\t\t\t\t\tonChange={ onPostTypeChange }\n\t\t\t\t\t\t\t\t\thelp={ postTypeControlHelp }\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t{ postTypesSelectOptions.map(\n\t\t\t\t\t\t\t\t\t\t( option ) => (\n\t\t\t\t\t\t\t\t\t\t\t<ToggleGroupControlOption\n\t\t\t\t\t\t\t\t\t\t\t\tkey={ option.value }\n\t\t\t\t\t\t\t\t\t\t\t\tvalue={ option.value }\n\t\t\t\t\t\t\t\t\t\t\t\tlabel={ option.label }\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) }\n\t\t\t\t\t\t\t\t</ToggleGroupControl>\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t</ToolsPanelItem>\n\t\t\t\t\t) }\n\n\t\t\t\t\t{ showOrderControl && (\n\t\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\t\thasValue={ () =>\n\t\t\t\t\t\t\t\torder !== 'desc' || orderBy !== 'date'\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tlabel={ __( 'Order by' ) }\n\t\t\t\t\t\t\tonDeselect={ () =>\n\t\t\t\t\t\t\t\tsetQuery( { order: 'desc', orderBy: 'date' } )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tisShownByDefault\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<OrderControl\n\t\t\t\t\t\t\t\t{ ...{ order, orderBy, orderByOptions } }\n\t\t\t\t\t\t\t\tonChange={ setQuery }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</ToolsPanelItem>\n\t\t\t\t\t) }\n\n\t\t\t\t\t{ showStickyControl && (\n\t\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\t\thasValue={ () => !! sticky }\n\t\t\t\t\t\t\tlabel={ __( 'Sticky posts' ) }\n\t\t\t\t\t\t\tonDeselect={ () => setQuery( { sticky: '' } ) }\n\t\t\t\t\t\t\tisShownByDefault\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<StickyControl\n\t\t\t\t\t\t\t\tvalue={ sticky }\n\t\t\t\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\t\t\t\tsetQuery( { sticky: value } )\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</ToolsPanelItem>\n\t\t\t\t\t) }\n\t\t\t\t</ToolsPanel>\n\t\t\t) }\n\t\t\t{ ! inherit && showDisplayPanel && (\n\t\t\t\t<ToolsPanel\n\t\t\t\t\tclassName=\"block-library-query-toolspanel__display\"\n\t\t\t\t\tlabel={ __( 'Display' ) }\n\t\t\t\t\tresetAll={ () => {\n\t\t\t\t\t\tsetQuery( {\n\t\t\t\t\t\t\toffset: 0,\n\t\t\t\t\t\t\tpages: 0,\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\tlabel={ __( 'Items per page' ) }\n\t\t\t\t\t\thasValue={ () => perPage > 0 }\n\t\t\t\t\t>\n\t\t\t\t\t\t<PerPageControl\n\t\t\t\t\t\t\tperPage={ perPage }\n\t\t\t\t\t\t\toffset={ offset }\n\t\t\t\t\t\t\tonChange={ setQuery }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</ToolsPanelItem>\n\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\tlabel={ __( 'Offset' ) }\n\t\t\t\t\t\thasValue={ () => offset > 0 }\n\t\t\t\t\t\tonDeselect={ () => setQuery( { offset: 0 } ) }\n\t\t\t\t\t>\n\t\t\t\t\t\t<OffsetControl\n\t\t\t\t\t\t\toffset={ offset }\n\t\t\t\t\t\t\tonChange={ setQuery }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</ToolsPanelItem>\n\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\tlabel={ __( 'Max pages to show' ) }\n\t\t\t\t\t\thasValue={ () => pages > 0 }\n\t\t\t\t\t\tonDeselect={ () => setQuery( { pages: 0 } ) }\n\t\t\t\t\t>\n\t\t\t\t\t\t<PagesControl pages={ pages } onChange={ setQuery } />\n\t\t\t\t\t</ToolsPanelItem>\n\t\t\t\t</ToolsPanel>\n\t\t\t) }\n\t\t\t{ ! inherit && showFiltersPanel && (\n\t\t\t\t<ToolsPanel\n\t\t\t\t\tclassName=\"block-library-query-toolspanel__filters\" // unused but kept for backward compatibility\n\t\t\t\t\tlabel={ __( 'Filters' ) }\n\t\t\t\t\tresetAll={ () => {\n\t\t\t\t\t\tsetQuery( {\n\t\t\t\t\t\t\tauthor: '',\n\t\t\t\t\t\t\tparents: [],\n\t\t\t\t\t\t\tsearch: '',\n\t\t\t\t\t\t\ttaxQuery: null,\n\t\t\t\t\t\t\tformat: [],\n\t\t\t\t\t\t\texcludeCurrent: null,\n\t\t\t\t\t\t} );\n\t\t\t\t\t\tsetQuerySearch( '' );\n\t\t\t\t\t} }\n\t\t\t\t\tdropdownMenuProps={ dropdownMenuProps }\n\t\t\t\t>\n\t\t\t\t\t{ showTaxControl && (\n\t\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\t\tlabel={ __( 'Taxonomies' ) }\n\t\t\t\t\t\t\thasValue={ () =>\n\t\t\t\t\t\t\t\tObject.values( taxQuery || {} ).some(\n\t\t\t\t\t\t\t\t\t( value ) =>\n\t\t\t\t\t\t\t\t\t\tObject.values( value || {} ).some(\n\t\t\t\t\t\t\t\t\t\t\t( termIds ) => !! termIds?.length\n\t\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\tonDeselect={ () => setQuery( { taxQuery: null } ) }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<TaxonomyControls\n\t\t\t\t\t\t\t\tonChange={ setQuery }\n\t\t\t\t\t\t\t\tquery={ query }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</ToolsPanelItem>\n\t\t\t\t\t) }\n\t\t\t\t\t{ showAuthorControl && (\n\t\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\t\thasValue={ () => !! authorIds }\n\t\t\t\t\t\t\tlabel={ __( 'Authors' ) }\n\t\t\t\t\t\t\tonDeselect={ () => setQuery( { author: '' } ) }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<AuthorControl\n\t\t\t\t\t\t\t\tvalue={ authorIds }\n\t\t\t\t\t\t\t\tonChange={ setQuery }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</ToolsPanelItem>\n\t\t\t\t\t) }\n\t\t\t\t\t{ showSearchControl && (\n\t\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\t\thasValue={ () => !! querySearch }\n\t\t\t\t\t\t\tlabel={ __( 'Keyword' ) }\n\t\t\t\t\t\t\tonDeselect={ () => {\n\t\t\t\t\t\t\t\tsetQuery( { search: '' } );\n\t\t\t\t\t\t\t\tsetQuerySearch( '' );\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<TextControl\n\t\t\t\t\t\t\t\tlabel={ __( 'Keyword' ) }\n\t\t\t\t\t\t\t\tvalue={ querySearch }\n\t\t\t\t\t\t\t\tonChange={ ( newQuerySearch ) => {\n\t\t\t\t\t\t\t\t\tdebouncedQuerySearch( newQuerySearch );\n\t\t\t\t\t\t\t\t\tsetQuerySearch( newQuerySearch );\n\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</ToolsPanelItem>\n\t\t\t\t\t) }\n\t\t\t\t\t{ showParentControl && (\n\t\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\t\thasValue={ () => !! parents?.length }\n\t\t\t\t\t\t\tlabel={ __( 'Parents' ) }\n\t\t\t\t\t\t\tonDeselect={ () => setQuery( { parents: [] } ) }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<ParentControl\n\t\t\t\t\t\t\t\tparents={ parents }\n\t\t\t\t\t\t\t\tpostType={ postType }\n\t\t\t\t\t\t\t\tonChange={ setQuery }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</ToolsPanelItem>\n\t\t\t\t\t) }\n\t\t\t\t\t{ showFormatControl && (\n\t\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\t\thasValue={ () => !! format?.length }\n\t\t\t\t\t\t\tlabel={ __( 'Formats' ) }\n\t\t\t\t\t\t\tonDeselect={ () => setQuery( { format: [] } ) }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<FormatControls\n\t\t\t\t\t\t\t\tonChange={ setQuery }\n\t\t\t\t\t\t\t\tquery={ query }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</ToolsPanelItem>\n\t\t\t\t\t) }\n\t\t\t\t\t{ showExcludeCurrentControl && (\n\t\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\t\tlabel={ __( 'Exclude' ) }\n\t\t\t\t\t\t\thasValue={ () => excludeCurrent !== null }\n\t\t\t\t\t\t\tonDeselect={ () =>\n\t\t\t\t\t\t\t\tsetQuery( { excludeCurrent: null } )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\t\t\tlabel={ __( 'Exclude current' ) }\n\t\t\t\t\t\t\t\thelp={ sprintf(\n\t\t\t\t\t\t\t\t\t/* translators: %s: the post type singular name */\n\t\t\t\t\t\t\t\t\t__(\n\t\t\t\t\t\t\t\t\t\t'Exclude the current %s from the query.'\n\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t\tpostTypeSingularName\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\tchecked={ !! excludeCurrent }\n\t\t\t\t\t\t\t\tonChange={ ( value ) => {\n\t\t\t\t\t\t\t\t\tsetQuery( {\n\t\t\t\t\t\t\t\t\t\texcludeCurrent: !! value,\n\t\t\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</ToolsPanelItem>\n\t\t\t\t\t) }\n\t\t\t\t</ToolsPanel>\n\t\t\t) }\n\t\t</>\n\t);\n}\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,wBAUO;AACP,kBAA0B;AAC1B,uBAAmC;AACnC,
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport {\n\tTextControl,\n\tSelectControl,\n\tNotice,\n\t__experimentalVStack as VStack,\n\t__experimentalToolsPanel as ToolsPanel,\n\t__experimentalToolsPanelItem as ToolsPanelItem,\n\tToggleControl,\n\t__experimentalToggleGroupControl as ToggleGroupControl,\n\t__experimentalToggleGroupControlOption as ToggleGroupControlOption,\n} from '@wordpress/components';\nimport { useSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { __, _x, sprintf } from '@wordpress/i18n';\nimport { debounce } from '@wordpress/compose';\nimport { useState, useMemo } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport OrderControl from './order-control';\nimport AuthorControl from './author-control';\nimport ParentControl from './parent-control';\nimport { TaxonomyControls } from './taxonomy-controls';\nimport FormatControls from './format-controls';\nimport StickyControl from './sticky-control';\nimport PerPageControl from './per-page-control';\nimport OffsetControl from './offset-controls';\nimport PagesControl from './pages-control';\nimport {\n\tusePostTypes,\n\tuseIsPostTypeHierarchical,\n\tuseAllowedControls,\n\tisControlAllowed,\n\tuseTaxonomies,\n\tuseOrderByOptions,\n} from '../../utils';\nimport { useToolsPanelDropdownMenuProps } from '../../../utils/hooks';\n\nexport default function QueryInspectorControls( props ) {\n\tconst { attributes, setQuery, isSingular, shouldExcludeCurrentPost } =\n\t\tprops;\n\tconst { query } = attributes;\n\tconst {\n\t\torder,\n\t\torderBy,\n\t\tauthor: authorIds,\n\t\tpages,\n\t\tpostType,\n\t\tperPage,\n\t\toffset,\n\t\tsticky,\n\t\tinherit,\n\t\ttaxQuery,\n\t\tparents,\n\t\tformat,\n\t\texcludeCurrent,\n\t} = query;\n\tconst allowedControls = useAllowedControls( attributes );\n\tconst showSticky = postType === 'post';\n\tconst {\n\t\tpostTypesTaxonomiesMap,\n\t\tpostTypesSelectOptions,\n\t\tpostTypeFormatSupportMap,\n\t} = usePostTypes();\n\tconst taxonomies = useTaxonomies( postType );\n\tconst isPostTypeHierarchical = useIsPostTypeHierarchical( postType );\n\tconst onPostTypeChange = ( newValue ) => {\n\t\tconst updateQuery = { postType: newValue };\n\t\t// We need to dynamically update the `taxQuery` property,\n\t\t// by removing any not supported taxonomy from the query.\n\t\tconst supportedTaxonomies = postTypesTaxonomiesMap[ newValue ];\n\t\tif ( !! supportedTaxonomies?.length && !! taxQuery ) {\n\t\t\t// Shared utility to build taxQuery based on supported taxonomies.\n\t\t\tconst buildTaxQuery = ( _taxQuery ) => {\n\t\t\t\treturn Object.entries( _taxQuery || {} ).reduce(\n\t\t\t\t\t( accumulator, [ taxonomy, terms ] ) => {\n\t\t\t\t\t\tif ( supportedTaxonomies.includes( taxonomy ) ) {\n\t\t\t\t\t\t\taccumulator[ taxonomy ] = terms;\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn accumulator;\n\t\t\t\t\t},\n\t\t\t\t\t{}\n\t\t\t\t);\n\t\t\t};\n\t\t\tconst updatedTaxQuery = {};\n\t\t\tconst builtIncludeTaxQuery = buildTaxQuery( taxQuery.include );\n\t\t\tif ( !! Object.keys( builtIncludeTaxQuery ).length ) {\n\t\t\t\tupdatedTaxQuery.include = builtIncludeTaxQuery;\n\t\t\t}\n\t\t\tconst builtExcludeTaxQuery = buildTaxQuery( taxQuery.exclude );\n\t\t\tif ( !! Object.keys( builtExcludeTaxQuery ).length ) {\n\t\t\t\tupdatedTaxQuery.exclude = builtExcludeTaxQuery;\n\t\t\t}\n\t\t\tupdateQuery.taxQuery = !! Object.keys( updatedTaxQuery ).length\n\t\t\t\t? updatedTaxQuery\n\t\t\t\t: undefined;\n\t\t}\n\n\t\tif ( newValue !== 'post' ) {\n\t\t\tupdateQuery.sticky = '';\n\t\t}\n\t\t// We need to reset `parents` because they are tied to each post type.\n\t\tupdateQuery.parents = [];\n\t\t// Post types can register post format support with `add_post_type_support`.\n\t\t// But we need to reset the `format` property when switching to post types\n\t\t// that do not support post formats.\n\t\tconst hasFormatSupport = postTypeFormatSupportMap[ newValue ];\n\t\tif ( ! hasFormatSupport ) {\n\t\t\tupdateQuery.format = [];\n\t\t}\n\n\t\tsetQuery( updateQuery );\n\t};\n\tconst [ querySearch, setQuerySearch ] = useState( query.search );\n\tconst debouncedQuerySearch = useMemo( () => {\n\t\treturn debounce( ( newQuerySearch ) => {\n\t\t\tsetQuery( { search: newQuerySearch } );\n\t\t}, 250 );\n\t}, [ setQuery ] );\n\n\tconst orderByOptions = useOrderByOptions( postType );\n\tconst showInheritControl = isControlAllowed( allowedControls, 'inherit' );\n\tconst showPostTypeControl =\n\t\t! inherit && isControlAllowed( allowedControls, 'postType' );\n\tconst postTypeControlLabel = __( 'Post type' );\n\tconst postTypeControlHelp = __(\n\t\t'Select the type of content to display: posts, pages, or custom post types.'\n\t);\n\tconst showOrderControl =\n\t\t! inherit && isControlAllowed( allowedControls, 'order' );\n\tconst showStickyControl =\n\t\t! inherit &&\n\t\tshowSticky &&\n\t\tisControlAllowed( allowedControls, 'sticky' );\n\tconst showSettingsPanel =\n\t\tshowInheritControl ||\n\t\tshowPostTypeControl ||\n\t\tshowOrderControl ||\n\t\tshowStickyControl;\n\tconst showTaxControl =\n\t\t!! taxonomies?.length &&\n\t\tisControlAllowed( allowedControls, 'taxQuery' );\n\tconst showAuthorControl = isControlAllowed( allowedControls, 'author' );\n\tconst showSearchControl = isControlAllowed( allowedControls, 'search' );\n\tconst showParentControl =\n\t\tisControlAllowed( allowedControls, 'parents' ) &&\n\t\tisPostTypeHierarchical;\n\n\tconst postTypeHasFormatSupport = postTypeFormatSupportMap[ postType ];\n\tconst showFormatControl = useSelect(\n\t\t( select ) => {\n\t\t\t// Check if the post type supports post formats and if the control is allowed.\n\t\t\tif (\n\t\t\t\t! postTypeHasFormatSupport ||\n\t\t\t\t! isControlAllowed( allowedControls, 'format' )\n\t\t\t) {\n\t\t\t\treturn false;\n\t\t\t}\n\n\t\t\tconst themeSupports = select( coreStore ).getThemeSupports();\n\n\t\t\t// If there are no supported formats, getThemeSupports still includes the default 'standard' format,\n\t\t\t// and in this case the control should not be shown since the user has no other formats to choose from.\n\t\t\treturn (\n\t\t\t\tthemeSupports.formats &&\n\t\t\t\tthemeSupports.formats.length > 0 &&\n\t\t\t\tthemeSupports.formats.some( ( type ) => type !== 'standard' )\n\t\t\t);\n\t\t},\n\t\t[ allowedControls, postTypeHasFormatSupport ]\n\t);\n\n\tconst showExcludeCurrentControl =\n\t\tshouldExcludeCurrentPost &&\n\t\tisControlAllowed( allowedControls, 'excludeCurrent' );\n\tconst postTypeSingularName = useSelect(\n\t\t( select ) =>\n\t\t\tselect( coreStore ).getPostType( postType )?.labels.singular_name,\n\t\t[ postType ]\n\t);\n\n\tconst showFiltersPanel =\n\t\tshowTaxControl ||\n\t\tshowAuthorControl ||\n\t\tshowSearchControl ||\n\t\tshowParentControl ||\n\t\tshowFormatControl ||\n\t\tshowExcludeCurrentControl;\n\tconst dropdownMenuProps = useToolsPanelDropdownMenuProps();\n\n\tconst showPostCountControl = isControlAllowed(\n\t\tallowedControls,\n\t\t'postCount'\n\t);\n\tconst showOffSetControl = isControlAllowed( allowedControls, 'offset' );\n\tconst showPagesControl = isControlAllowed( allowedControls, 'pages' );\n\n\tconst showDisplayPanel =\n\t\tshowPostCountControl || showOffSetControl || showPagesControl;\n\n\t// The block cannot inherit a default WordPress query in singular content (e.g., post, page, 404, blank).\n\t// Warn users but still permit this type of query for exceptional cases in Classic and Hybrid themes.\n\tconst hasInheritanceWarning = isSingular && inherit;\n\n\treturn (\n\t\t<>\n\t\t\t{ showSettingsPanel && (\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\tsetQuery( {\n\t\t\t\t\t\t\tpostType: 'post',\n\t\t\t\t\t\t\torder: 'desc',\n\t\t\t\t\t\t\torderBy: 'date',\n\t\t\t\t\t\t\tsticky: '',\n\t\t\t\t\t\t\tinherit: true,\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{ showInheritControl && (\n\t\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\t\thasValue={ () => ! inherit }\n\t\t\t\t\t\t\tlabel={ __( 'Query type' ) }\n\t\t\t\t\t\t\tonDeselect={ () => setQuery( { inherit: true } ) }\n\t\t\t\t\t\t\tisShownByDefault\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<VStack spacing={ 4 }>\n\t\t\t\t\t\t\t\t<ToggleGroupControl\n\t\t\t\t\t\t\t\t\tlabel={ __( 'Query type' ) }\n\t\t\t\t\t\t\t\t\tisBlock\n\t\t\t\t\t\t\t\t\tonChange={ ( value ) => {\n\t\t\t\t\t\t\t\t\t\tsetQuery( {\n\t\t\t\t\t\t\t\t\t\t\tinherit: value === 'default',\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\thelp={\n\t\t\t\t\t\t\t\t\t\tinherit\n\t\t\t\t\t\t\t\t\t\t\t? __(\n\t\t\t\t\t\t\t\t\t\t\t\t\t'Display a list of posts or custom post types based on the current template.'\n\t\t\t\t\t\t\t\t\t\t\t )\n\t\t\t\t\t\t\t\t\t\t\t: __(\n\t\t\t\t\t\t\t\t\t\t\t\t\t'Display a list of posts or custom post types based on specific criteria.'\n\t\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\tvalue={ !! inherit ? 'default' : 'custom' }\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t<ToggleGroupControlOption\n\t\t\t\t\t\t\t\t\t\tvalue=\"default\"\n\t\t\t\t\t\t\t\t\t\tlabel={ __( 'Default' ) }\n\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t<ToggleGroupControlOption\n\t\t\t\t\t\t\t\t\t\tvalue=\"custom\"\n\t\t\t\t\t\t\t\t\t\tlabel={ __( 'Custom' ) }\n\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t</ToggleGroupControl>\n\t\t\t\t\t\t\t\t{ hasInheritanceWarning && (\n\t\t\t\t\t\t\t\t\t<Notice\n\t\t\t\t\t\t\t\t\t\tstatus=\"warning\"\n\t\t\t\t\t\t\t\t\t\tisDismissible={ false }\n\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\t\t'Cannot inherit the current template query when placed inside the singular content (e.g., post, page, 404, blank).'\n\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t</Notice>\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t</VStack>\n\t\t\t\t\t\t</ToolsPanelItem>\n\t\t\t\t\t) }\n\n\t\t\t\t\t{ showPostTypeControl && (\n\t\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\t\thasValue={ () => postType !== 'post' }\n\t\t\t\t\t\t\tlabel={ postTypeControlLabel }\n\t\t\t\t\t\t\tonDeselect={ () => onPostTypeChange( 'post' ) }\n\t\t\t\t\t\t\tisShownByDefault\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ postTypesSelectOptions.length > 2 ? (\n\t\t\t\t\t\t\t\t<SelectControl\n\t\t\t\t\t\t\t\t\toptions={ postTypesSelectOptions }\n\t\t\t\t\t\t\t\t\tvalue={ postType }\n\t\t\t\t\t\t\t\t\tlabel={ postTypeControlLabel }\n\t\t\t\t\t\t\t\t\tonChange={ onPostTypeChange }\n\t\t\t\t\t\t\t\t\thelp={ postTypeControlHelp }\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<ToggleGroupControl\n\t\t\t\t\t\t\t\t\tisBlock\n\t\t\t\t\t\t\t\t\tvalue={ postType }\n\t\t\t\t\t\t\t\t\tlabel={ postTypeControlLabel }\n\t\t\t\t\t\t\t\t\tonChange={ onPostTypeChange }\n\t\t\t\t\t\t\t\t\thelp={ postTypeControlHelp }\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t{ postTypesSelectOptions.map(\n\t\t\t\t\t\t\t\t\t\t( option ) => (\n\t\t\t\t\t\t\t\t\t\t\t<ToggleGroupControlOption\n\t\t\t\t\t\t\t\t\t\t\t\tkey={ option.value }\n\t\t\t\t\t\t\t\t\t\t\t\tvalue={ option.value }\n\t\t\t\t\t\t\t\t\t\t\t\tlabel={ option.label }\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) }\n\t\t\t\t\t\t\t\t</ToggleGroupControl>\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t</ToolsPanelItem>\n\t\t\t\t\t) }\n\n\t\t\t\t\t{ showOrderControl && (\n\t\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\t\thasValue={ () =>\n\t\t\t\t\t\t\t\torder !== 'desc' || orderBy !== 'date'\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tlabel={ __( 'Order by' ) }\n\t\t\t\t\t\t\tonDeselect={ () =>\n\t\t\t\t\t\t\t\tsetQuery( { order: 'desc', orderBy: 'date' } )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tisShownByDefault\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<OrderControl\n\t\t\t\t\t\t\t\t{ ...{ order, orderBy, orderByOptions } }\n\t\t\t\t\t\t\t\tonChange={ setQuery }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</ToolsPanelItem>\n\t\t\t\t\t) }\n\n\t\t\t\t\t{ showStickyControl && (\n\t\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\t\thasValue={ () => !! sticky }\n\t\t\t\t\t\t\tlabel={ __( 'Sticky posts' ) }\n\t\t\t\t\t\t\tonDeselect={ () => setQuery( { sticky: '' } ) }\n\t\t\t\t\t\t\tisShownByDefault\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<StickyControl\n\t\t\t\t\t\t\t\tvalue={ sticky }\n\t\t\t\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\t\t\t\tsetQuery( { sticky: value } )\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</ToolsPanelItem>\n\t\t\t\t\t) }\n\t\t\t\t</ToolsPanel>\n\t\t\t) }\n\t\t\t{ ! inherit && showDisplayPanel && (\n\t\t\t\t<ToolsPanel\n\t\t\t\t\tclassName=\"block-library-query-toolspanel__display\"\n\t\t\t\t\tlabel={ __( 'Display' ) }\n\t\t\t\t\tresetAll={ () => {\n\t\t\t\t\t\tsetQuery( {\n\t\t\t\t\t\t\toffset: 0,\n\t\t\t\t\t\t\tpages: 0,\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\tlabel={ __( 'Items per page' ) }\n\t\t\t\t\t\thasValue={ () => perPage > 0 }\n\t\t\t\t\t>\n\t\t\t\t\t\t<PerPageControl\n\t\t\t\t\t\t\tperPage={ perPage }\n\t\t\t\t\t\t\toffset={ offset }\n\t\t\t\t\t\t\tonChange={ setQuery }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</ToolsPanelItem>\n\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\tlabel={ _x(\n\t\t\t\t\t\t\t'Offset',\n\t\t\t\t\t\t\t'Number of posts to skip in a query'\n\t\t\t\t\t\t) }\n\t\t\t\t\t\thasValue={ () => offset > 0 }\n\t\t\t\t\t\tonDeselect={ () => setQuery( { offset: 0 } ) }\n\t\t\t\t\t>\n\t\t\t\t\t\t<OffsetControl\n\t\t\t\t\t\t\toffset={ offset }\n\t\t\t\t\t\t\tonChange={ setQuery }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</ToolsPanelItem>\n\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\tlabel={ __( 'Max pages to show' ) }\n\t\t\t\t\t\thasValue={ () => pages > 0 }\n\t\t\t\t\t\tonDeselect={ () => setQuery( { pages: 0 } ) }\n\t\t\t\t\t>\n\t\t\t\t\t\t<PagesControl pages={ pages } onChange={ setQuery } />\n\t\t\t\t\t</ToolsPanelItem>\n\t\t\t\t</ToolsPanel>\n\t\t\t) }\n\t\t\t{ ! inherit && showFiltersPanel && (\n\t\t\t\t<ToolsPanel\n\t\t\t\t\tclassName=\"block-library-query-toolspanel__filters\" // unused but kept for backward compatibility\n\t\t\t\t\tlabel={ __( 'Filters' ) }\n\t\t\t\t\tresetAll={ () => {\n\t\t\t\t\t\tsetQuery( {\n\t\t\t\t\t\t\tauthor: '',\n\t\t\t\t\t\t\tparents: [],\n\t\t\t\t\t\t\tsearch: '',\n\t\t\t\t\t\t\ttaxQuery: null,\n\t\t\t\t\t\t\tformat: [],\n\t\t\t\t\t\t\texcludeCurrent: null,\n\t\t\t\t\t\t} );\n\t\t\t\t\t\tsetQuerySearch( '' );\n\t\t\t\t\t} }\n\t\t\t\t\tdropdownMenuProps={ dropdownMenuProps }\n\t\t\t\t>\n\t\t\t\t\t{ showTaxControl && (\n\t\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\t\tlabel={ __( 'Taxonomies' ) }\n\t\t\t\t\t\t\thasValue={ () =>\n\t\t\t\t\t\t\t\tObject.values( taxQuery || {} ).some(\n\t\t\t\t\t\t\t\t\t( value ) =>\n\t\t\t\t\t\t\t\t\t\tObject.values( value || {} ).some(\n\t\t\t\t\t\t\t\t\t\t\t( termIds ) => !! termIds?.length\n\t\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\tonDeselect={ () => setQuery( { taxQuery: null } ) }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<TaxonomyControls\n\t\t\t\t\t\t\t\tonChange={ setQuery }\n\t\t\t\t\t\t\t\tquery={ query }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</ToolsPanelItem>\n\t\t\t\t\t) }\n\t\t\t\t\t{ showAuthorControl && (\n\t\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\t\thasValue={ () => !! authorIds }\n\t\t\t\t\t\t\tlabel={ __( 'Authors' ) }\n\t\t\t\t\t\t\tonDeselect={ () => setQuery( { author: '' } ) }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<AuthorControl\n\t\t\t\t\t\t\t\tvalue={ authorIds }\n\t\t\t\t\t\t\t\tonChange={ setQuery }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</ToolsPanelItem>\n\t\t\t\t\t) }\n\t\t\t\t\t{ showSearchControl && (\n\t\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\t\thasValue={ () => !! querySearch }\n\t\t\t\t\t\t\tlabel={ __( 'Keyword' ) }\n\t\t\t\t\t\t\tonDeselect={ () => {\n\t\t\t\t\t\t\t\tsetQuery( { search: '' } );\n\t\t\t\t\t\t\t\tsetQuerySearch( '' );\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<TextControl\n\t\t\t\t\t\t\t\tlabel={ __( 'Keyword' ) }\n\t\t\t\t\t\t\t\tvalue={ querySearch }\n\t\t\t\t\t\t\t\tonChange={ ( newQuerySearch ) => {\n\t\t\t\t\t\t\t\t\tdebouncedQuerySearch( newQuerySearch );\n\t\t\t\t\t\t\t\t\tsetQuerySearch( newQuerySearch );\n\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</ToolsPanelItem>\n\t\t\t\t\t) }\n\t\t\t\t\t{ showParentControl && (\n\t\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\t\thasValue={ () => !! parents?.length }\n\t\t\t\t\t\t\tlabel={ __( 'Parents' ) }\n\t\t\t\t\t\t\tonDeselect={ () => setQuery( { parents: [] } ) }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<ParentControl\n\t\t\t\t\t\t\t\tparents={ parents }\n\t\t\t\t\t\t\t\tpostType={ postType }\n\t\t\t\t\t\t\t\tonChange={ setQuery }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</ToolsPanelItem>\n\t\t\t\t\t) }\n\t\t\t\t\t{ showFormatControl && (\n\t\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\t\thasValue={ () => !! format?.length }\n\t\t\t\t\t\t\tlabel={ __( 'Formats' ) }\n\t\t\t\t\t\t\tonDeselect={ () => setQuery( { format: [] } ) }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<FormatControls\n\t\t\t\t\t\t\t\tonChange={ setQuery }\n\t\t\t\t\t\t\t\tquery={ query }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</ToolsPanelItem>\n\t\t\t\t\t) }\n\t\t\t\t\t{ showExcludeCurrentControl && (\n\t\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\t\tlabel={ __( 'Exclude' ) }\n\t\t\t\t\t\t\thasValue={ () => excludeCurrent !== null }\n\t\t\t\t\t\t\tonDeselect={ () =>\n\t\t\t\t\t\t\t\tsetQuery( { excludeCurrent: null } )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\t\t\tlabel={ __( 'Exclude current' ) }\n\t\t\t\t\t\t\t\thelp={ sprintf(\n\t\t\t\t\t\t\t\t\t/* translators: %s: the post type singular name */\n\t\t\t\t\t\t\t\t\t__(\n\t\t\t\t\t\t\t\t\t\t'Exclude the current %s from the query.'\n\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t\tpostTypeSingularName\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\tchecked={ !! excludeCurrent }\n\t\t\t\t\t\t\t\tonChange={ ( value ) => {\n\t\t\t\t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,gBAAgB,CAAC,CAAE;AAAA,oBACpB,CAAE;AAAA,kBACH;AAAA;AAAA,cACD;AAAA;AAAA,UACD;AAAA;AAAA;AAAA,IAEF;AAAA,KAEF;AAEF;",
|
|
6
6
|
"names": ["coreStore", "ToolsPanel", "ToolsPanelItem", "VStack", "ToggleGroupControl", "ToggleGroupControlOption", "OrderControl", "StickyControl", "PerPageControl", "OffsetControl", "PagesControl", "AuthorControl", "ParentControl", "FormatControls"]
|
|
7
7
|
}
|
|
@@ -33,7 +33,7 @@ var OffsetControl = ({ offset = 0, onChange }) => {
|
|
|
33
33
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
34
34
|
import_components.__experimentalNumberControl,
|
|
35
35
|
{
|
|
36
|
-
label: (0, import_i18n.
|
|
36
|
+
label: (0, import_i18n._x)("Offset", "Number of posts to skip in a query"),
|
|
37
37
|
value: offset,
|
|
38
38
|
min: MIN_OFFSET,
|
|
39
39
|
onChange: (newOffset) => {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/query/edit/inspector-controls/offset-controls.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { __experimentalNumberControl as NumberControl } from '@wordpress/components';\nimport {
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,wBAA6D;AAC7D,kBAAmB;AAOjB;AALF,IAAM,aAAa;AACnB,IAAM,aAAa;AAEZ,IAAM,gBAAgB,CAAE,EAAE,SAAS,GAAG,SAAS,MAAO;AAC5D,SACC;AAAA,IAAC,kBAAAA;AAAA,IAAA;AAAA,MACA,WAAQ,gBAAI,
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { __experimentalNumberControl as NumberControl } from '@wordpress/components';\nimport { _x } from '@wordpress/i18n';\n\nconst MIN_OFFSET = 0;\nconst MAX_OFFSET = 100;\n\nexport const OffsetControl = ( { offset = 0, onChange } ) => {\n\treturn (\n\t\t<NumberControl\n\t\t\tlabel={ _x( 'Offset', 'Number of posts to skip in a query' ) }\n\t\t\tvalue={ offset }\n\t\t\tmin={ MIN_OFFSET }\n\t\t\tonChange={ ( newOffset ) => {\n\t\t\t\tif (\n\t\t\t\t\tisNaN( newOffset ) ||\n\t\t\t\t\tnewOffset < MIN_OFFSET ||\n\t\t\t\t\tnewOffset > MAX_OFFSET\n\t\t\t\t) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tonChange( { offset: newOffset } );\n\t\t\t} }\n\t\t/>\n\t);\n};\n\nexport default OffsetControl;\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,wBAA6D;AAC7D,kBAAmB;AAOjB;AALF,IAAM,aAAa;AACnB,IAAM,aAAa;AAEZ,IAAM,gBAAgB,CAAE,EAAE,SAAS,GAAG,SAAS,MAAO;AAC5D,SACC;AAAA,IAAC,kBAAAA;AAAA,IAAA;AAAA,MACA,WAAQ,gBAAI,UAAU,oCAAqC;AAAA,MAC3D,OAAQ;AAAA,MACR,KAAM;AAAA,MACN,UAAW,CAAE,cAAe;AAC3B,YACC,MAAO,SAAU,KACjB,YAAY,cACZ,YAAY,YACX;AACD;AAAA,QACD;AACA,iBAAU,EAAE,QAAQ,UAAU,CAAE;AAAA,MACjC;AAAA;AAAA,EACD;AAEF;AAEA,IAAO,0BAAQ;",
|
|
6
6
|
"names": ["NumberControl"]
|
|
7
7
|
}
|
package/build/read-more/edit.cjs
CHANGED
|
@@ -73,7 +73,9 @@ function ReadMore({
|
|
|
73
73
|
placeholder: (0, import_i18n.__)("Read more"),
|
|
74
74
|
value: content,
|
|
75
75
|
onChange: (newValue) => setAttributes({ content: newValue }),
|
|
76
|
-
__unstableOnSplitAtEnd: () => insertBlocksAfter(
|
|
76
|
+
__unstableOnSplitAtEnd: insertBlocksAfter ? () => insertBlocksAfter(
|
|
77
|
+
(0, import_blocks.createBlock)((0, import_blocks.getDefaultBlockName)())
|
|
78
|
+
) : void 0,
|
|
77
79
|
withoutInteractiveFormatting: true,
|
|
78
80
|
...blockProps
|
|
79
81
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/read-more/edit.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport {\n\tInspectorControls,\n\tRichText,\n\tuseBlockProps,\n} from '@wordpress/block-editor';\nimport {\n\tToggleControl,\n\t__experimentalToolsPanel as ToolsPanel,\n\t__experimentalToolsPanelItem as ToolsPanelItem,\n} from '@wordpress/components';\nimport { createBlock, getDefaultBlockName } from '@wordpress/blocks';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport { useToolsPanelDropdownMenuProps } from '../utils/hooks';\n\nexport default function ReadMore( {\n\tattributes: { content, linkTarget },\n\tsetAttributes,\n\tinsertBlocksAfter,\n} ) {\n\tconst blockProps = useBlockProps();\n\tconst dropdownMenuProps = useToolsPanelDropdownMenuProps();\n\n\treturn (\n\t\t<>\n\t\t\t<InspectorControls>\n\t\t\t\t<ToolsPanel\n\t\t\t\t\tlabel={ __( 'Settings' ) }\n\t\t\t\t\tresetAll={ () => setAttributes( { linkTarget: '_self' } ) }\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\tlabel={ __( 'Open in new tab' ) }\n\t\t\t\t\t\tisShownByDefault\n\t\t\t\t\t\thasValue={ () => linkTarget !== '_self' }\n\t\t\t\t\t\tonDeselect={ () =>\n\t\t\t\t\t\t\tsetAttributes( { linkTarget: '_self' } )\n\t\t\t\t\t\t}\n\t\t\t\t\t>\n\t\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\t\tlabel={ __( 'Open in new tab' ) }\n\t\t\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\tlinkTarget: value ? '_blank' : '_self',\n\t\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tchecked={ linkTarget === '_blank' }\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\t\t\t<RichText\n\t\t\t\tidentifier=\"content\"\n\t\t\t\ttagName=\"a\"\n\t\t\t\taria-label={ __( '“Read more” link text' ) }\n\t\t\t\tplaceholder={ __( 'Read more' ) }\n\t\t\t\tvalue={ content }\n\t\t\t\tonChange={ ( newValue ) =>\n\t\t\t\t\tsetAttributes( { content: newValue } )\n\t\t\t\t}\n\t\t\t\t__unstableOnSplitAtEnd={ () =>\n\t\t\t\t\tinsertBlocksAfter(
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,0BAIO;AACP,wBAIO;AACP,oBAAiD;AACjD,kBAAmB;AAKnB,mBAA+C;AAW7C;AATa,SAAR,SAA2B;AAAA,EACjC,YAAY,EAAE,SAAS,WAAW;AAAA,EAClC;AAAA,EACA;AACD,GAAI;AACH,QAAM,iBAAa,mCAAc;AACjC,QAAM,wBAAoB,6CAA+B;AAEzD,SACC,4EACC;AAAA,gDAAC,yCACA;AAAA,MAAC,kBAAAA;AAAA,MAAA;AAAA,QACA,WAAQ,gBAAI,UAAW;AAAA,QACvB,UAAW,MAAM,cAAe,EAAE,YAAY,QAAQ,CAAE;AAAA,QACxD;AAAA,QAEA;AAAA,UAAC,kBAAAC;AAAA,UAAA;AAAA,YACA,WAAQ,gBAAI,iBAAkB;AAAA,YAC9B,kBAAgB;AAAA,YAChB,UAAW,MAAM,eAAe;AAAA,YAChC,YAAa,MACZ,cAAe,EAAE,YAAY,QAAQ,CAAE;AAAA,YAGxC;AAAA,cAAC;AAAA;AAAA,gBACA,WAAQ,gBAAI,iBAAkB;AAAA,gBAC9B,UAAW,CAAE,UACZ,cAAe;AAAA,kBACd,YAAY,QAAQ,WAAW;AAAA,gBAChC,CAAE;AAAA,gBAEH,SAAU,eAAe;AAAA;AAAA,YAC1B;AAAA;AAAA,QACD;AAAA;AAAA,IACD,GACD;AAAA,IACA;AAAA,MAAC;AAAA;AAAA,QACA,YAAW;AAAA,QACX,SAAQ;AAAA,QACR,kBAAa,gBAAI,uBAAwB;AAAA,QACzC,iBAAc,gBAAI,WAAY;AAAA,QAC9B,OAAQ;AAAA,QACR,UAAW,CAAE,aACZ,cAAe,EAAE,SAAS,SAAS,CAAE;AAAA,QAEtC,
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport {\n\tInspectorControls,\n\tRichText,\n\tuseBlockProps,\n} from '@wordpress/block-editor';\nimport {\n\tToggleControl,\n\t__experimentalToolsPanel as ToolsPanel,\n\t__experimentalToolsPanelItem as ToolsPanelItem,\n} from '@wordpress/components';\nimport { createBlock, getDefaultBlockName } from '@wordpress/blocks';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport { useToolsPanelDropdownMenuProps } from '../utils/hooks';\n\nexport default function ReadMore( {\n\tattributes: { content, linkTarget },\n\tsetAttributes,\n\tinsertBlocksAfter,\n} ) {\n\tconst blockProps = useBlockProps();\n\tconst dropdownMenuProps = useToolsPanelDropdownMenuProps();\n\n\treturn (\n\t\t<>\n\t\t\t<InspectorControls>\n\t\t\t\t<ToolsPanel\n\t\t\t\t\tlabel={ __( 'Settings' ) }\n\t\t\t\t\tresetAll={ () => setAttributes( { linkTarget: '_self' } ) }\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\tlabel={ __( 'Open in new tab' ) }\n\t\t\t\t\t\tisShownByDefault\n\t\t\t\t\t\thasValue={ () => linkTarget !== '_self' }\n\t\t\t\t\t\tonDeselect={ () =>\n\t\t\t\t\t\t\tsetAttributes( { linkTarget: '_self' } )\n\t\t\t\t\t\t}\n\t\t\t\t\t>\n\t\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\t\tlabel={ __( 'Open in new tab' ) }\n\t\t\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\tlinkTarget: value ? '_blank' : '_self',\n\t\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tchecked={ linkTarget === '_blank' }\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\t\t\t<RichText\n\t\t\t\tidentifier=\"content\"\n\t\t\t\ttagName=\"a\"\n\t\t\t\taria-label={ __( '“Read more” link text' ) }\n\t\t\t\tplaceholder={ __( 'Read more' ) }\n\t\t\t\tvalue={ content }\n\t\t\t\tonChange={ ( newValue ) =>\n\t\t\t\t\tsetAttributes( { content: newValue } )\n\t\t\t\t}\n\t\t\t\t__unstableOnSplitAtEnd={\n\t\t\t\t\tinsertBlocksAfter\n\t\t\t\t\t\t? () =>\n\t\t\t\t\t\t\t\tinsertBlocksAfter(\n\t\t\t\t\t\t\t\t\tcreateBlock( getDefaultBlockName() )\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t: undefined\n\t\t\t\t}\n\t\t\t\twithoutInteractiveFormatting\n\t\t\t\t{ ...blockProps }\n\t\t\t/>\n\t\t</>\n\t);\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,0BAIO;AACP,wBAIO;AACP,oBAAiD;AACjD,kBAAmB;AAKnB,mBAA+C;AAW7C;AATa,SAAR,SAA2B;AAAA,EACjC,YAAY,EAAE,SAAS,WAAW;AAAA,EAClC;AAAA,EACA;AACD,GAAI;AACH,QAAM,iBAAa,mCAAc;AACjC,QAAM,wBAAoB,6CAA+B;AAEzD,SACC,4EACC;AAAA,gDAAC,yCACA;AAAA,MAAC,kBAAAA;AAAA,MAAA;AAAA,QACA,WAAQ,gBAAI,UAAW;AAAA,QACvB,UAAW,MAAM,cAAe,EAAE,YAAY,QAAQ,CAAE;AAAA,QACxD;AAAA,QAEA;AAAA,UAAC,kBAAAC;AAAA,UAAA;AAAA,YACA,WAAQ,gBAAI,iBAAkB;AAAA,YAC9B,kBAAgB;AAAA,YAChB,UAAW,MAAM,eAAe;AAAA,YAChC,YAAa,MACZ,cAAe,EAAE,YAAY,QAAQ,CAAE;AAAA,YAGxC;AAAA,cAAC;AAAA;AAAA,gBACA,WAAQ,gBAAI,iBAAkB;AAAA,gBAC9B,UAAW,CAAE,UACZ,cAAe;AAAA,kBACd,YAAY,QAAQ,WAAW;AAAA,gBAChC,CAAE;AAAA,gBAEH,SAAU,eAAe;AAAA;AAAA,YAC1B;AAAA;AAAA,QACD;AAAA;AAAA,IACD,GACD;AAAA,IACA;AAAA,MAAC;AAAA;AAAA,QACA,YAAW;AAAA,QACX,SAAQ;AAAA,QACR,kBAAa,gBAAI,uBAAwB;AAAA,QACzC,iBAAc,gBAAI,WAAY;AAAA,QAC9B,OAAQ;AAAA,QACR,UAAW,CAAE,aACZ,cAAe,EAAE,SAAS,SAAS,CAAE;AAAA,QAEtC,wBACC,oBACG,MACA;AAAA,cACC,+BAAa,mCAAoB,CAAE;AAAA,QACpC,IACA;AAAA,QAEJ,8BAA4B;AAAA,QAC1B,GAAG;AAAA;AAAA,IACN;AAAA,KACD;AAEF;",
|
|
6
6
|
"names": ["ToolsPanel", "ToolsPanelItem"]
|
|
7
7
|
}
|
|
@@ -77,7 +77,9 @@ function SiteTaglineEdit(props) {
|
|
|
77
77
|
tagName: TagName,
|
|
78
78
|
value: tagline,
|
|
79
79
|
disableLineBreaks: true,
|
|
80
|
-
__unstableOnSplitAtEnd: () => insertBlocksAfter(
|
|
80
|
+
__unstableOnSplitAtEnd: insertBlocksAfter ? () => insertBlocksAfter(
|
|
81
|
+
(0, import_blocks.createBlock)((0, import_blocks.getDefaultBlockName)())
|
|
82
|
+
) : void 0,
|
|
81
83
|
...blockProps
|
|
82
84
|
}
|
|
83
85
|
) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TagName, { ...blockProps, children: tagline || (0, import_i18n.__)("Site Tagline placeholder") });
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/site-tagline/edit.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\nimport {\n\tuseBlockProps,\n\tBlockControls,\n\tHeadingLevelDropdown,\n\tRichText,\n} from '@wordpress/block-editor';\nimport { __ } from '@wordpress/i18n';\nimport { createBlock, getDefaultBlockName } from '@wordpress/blocks';\nimport useDeprecatedTextAlign from '../utils/deprecated-text-align-attributes';\n\nexport default function SiteTaglineEdit( props ) {\n\tuseDeprecatedTextAlign( props );\n\n\tconst { attributes, setAttributes, insertBlocksAfter } = props;\n\tconst { level, levelOptions } = attributes;\n\tconst { canUserEdit, tagline } = useSelect( ( select ) => {\n\t\tconst { canUser, getEntityRecord, getEditedEntityRecord } =\n\t\t\tselect( coreStore );\n\t\tconst canEdit = canUser( 'update', {\n\t\t\tkind: 'root',\n\t\t\tname: 'site',\n\t\t} );\n\t\tconst settings = canEdit ? getEditedEntityRecord( 'root', 'site' ) : {};\n\t\tconst readOnlySettings = getEntityRecord( 'root', '__unstableBase' );\n\n\t\treturn {\n\t\t\tcanUserEdit: canEdit,\n\t\t\ttagline: canEdit\n\t\t\t\t? settings?.description\n\t\t\t\t: readOnlySettings?.description,\n\t\t};\n\t}, [] );\n\n\tconst TagName = level === 0 ? 'p' : `h${ level }`;\n\tconst { editEntityRecord } = useDispatch( coreStore );\n\n\tfunction setTagline( newTagline ) {\n\t\teditEntityRecord( 'root', 'site', undefined, {\n\t\t\tdescription: newTagline,\n\t\t} );\n\t}\n\n\tconst blockProps = useBlockProps( {\n\t\tclassName:\n\t\t\t! canUserEdit && ! tagline && 'wp-block-site-tagline__placeholder',\n\t} );\n\n\tconst siteTaglineContent = canUserEdit ? (\n\t\t<RichText\n\t\t\tallowedFormats={ [] }\n\t\t\tonChange={ setTagline }\n\t\t\taria-label={ __( 'Site tagline text' ) }\n\t\t\tplaceholder={ __( 'Write site tagline…' ) }\n\t\t\ttagName={ TagName }\n\t\t\tvalue={ tagline }\n\t\t\tdisableLineBreaks\n\t\t\t__unstableOnSplitAtEnd={ () =>\n\t\t\t\tinsertBlocksAfter(
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,kBAAuC;AACvC,uBAAmC;AACnC,0BAKO;AACP,kBAAmB;AACnB,oBAAiD;AACjD,8CAAmC;AAwCjC;AAtCa,SAAR,gBAAkC,OAAQ;AAChD,8CAAAA,SAAwB,KAAM;AAE9B,QAAM,EAAE,YAAY,eAAe,kBAAkB,IAAI;AACzD,QAAM,EAAE,OAAO,aAAa,IAAI;AAChC,QAAM,EAAE,aAAa,QAAQ,QAAI,uBAAW,CAAE,WAAY;AACzD,UAAM,EAAE,SAAS,iBAAiB,sBAAsB,IACvD,OAAQ,iBAAAC,KAAU;AACnB,UAAM,UAAU,QAAS,UAAU;AAAA,MAClC,MAAM;AAAA,MACN,MAAM;AAAA,IACP,CAAE;AACF,UAAM,WAAW,UAAU,sBAAuB,QAAQ,MAAO,IAAI,CAAC;AACtE,UAAM,mBAAmB,gBAAiB,QAAQ,gBAAiB;AAEnE,WAAO;AAAA,MACN,aAAa;AAAA,MACb,SAAS,UACN,UAAU,cACV,kBAAkB;AAAA,IACtB;AAAA,EACD,GAAG,CAAC,CAAE;AAEN,QAAM,UAAU,UAAU,IAAI,MAAM,IAAK,KAAM;AAC/C,QAAM,EAAE,iBAAiB,QAAI,yBAAa,iBAAAA,KAAU;AAEpD,WAAS,WAAY,YAAa;AACjC,qBAAkB,QAAQ,QAAQ,QAAW;AAAA,MAC5C,aAAa;AAAA,IACd,CAAE;AAAA,EACH;AAEA,QAAM,iBAAa,mCAAe;AAAA,IACjC,WACC,CAAE,eAAe,CAAE,WAAW;AAAA,EAChC,CAAE;AAEF,QAAM,qBAAqB,cAC1B;AAAA,IAAC;AAAA;AAAA,MACA,gBAAiB,CAAC;AAAA,MAClB,UAAW;AAAA,MACX,kBAAa,gBAAI,mBAAoB;AAAA,MACrC,iBAAc,gBAAI,qBAAsB;AAAA,MACxC,SAAU;AAAA,MACV,OAAQ;AAAA,MACR,mBAAiB;AAAA,MACjB,
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\nimport {\n\tuseBlockProps,\n\tBlockControls,\n\tHeadingLevelDropdown,\n\tRichText,\n} from '@wordpress/block-editor';\nimport { __ } from '@wordpress/i18n';\nimport { createBlock, getDefaultBlockName } from '@wordpress/blocks';\nimport useDeprecatedTextAlign from '../utils/deprecated-text-align-attributes';\n\nexport default function SiteTaglineEdit( props ) {\n\tuseDeprecatedTextAlign( props );\n\n\tconst { attributes, setAttributes, insertBlocksAfter } = props;\n\tconst { level, levelOptions } = attributes;\n\tconst { canUserEdit, tagline } = useSelect( ( select ) => {\n\t\tconst { canUser, getEntityRecord, getEditedEntityRecord } =\n\t\t\tselect( coreStore );\n\t\tconst canEdit = canUser( 'update', {\n\t\t\tkind: 'root',\n\t\t\tname: 'site',\n\t\t} );\n\t\tconst settings = canEdit ? getEditedEntityRecord( 'root', 'site' ) : {};\n\t\tconst readOnlySettings = getEntityRecord( 'root', '__unstableBase' );\n\n\t\treturn {\n\t\t\tcanUserEdit: canEdit,\n\t\t\ttagline: canEdit\n\t\t\t\t? settings?.description\n\t\t\t\t: readOnlySettings?.description,\n\t\t};\n\t}, [] );\n\n\tconst TagName = level === 0 ? 'p' : `h${ level }`;\n\tconst { editEntityRecord } = useDispatch( coreStore );\n\n\tfunction setTagline( newTagline ) {\n\t\teditEntityRecord( 'root', 'site', undefined, {\n\t\t\tdescription: newTagline,\n\t\t} );\n\t}\n\n\tconst blockProps = useBlockProps( {\n\t\tclassName:\n\t\t\t! canUserEdit && ! tagline && 'wp-block-site-tagline__placeholder',\n\t} );\n\n\tconst siteTaglineContent = canUserEdit ? (\n\t\t<RichText\n\t\t\tallowedFormats={ [] }\n\t\t\tonChange={ setTagline }\n\t\t\taria-label={ __( 'Site tagline text' ) }\n\t\t\tplaceholder={ __( 'Write site tagline…' ) }\n\t\t\ttagName={ TagName }\n\t\t\tvalue={ tagline }\n\t\t\tdisableLineBreaks\n\t\t\t__unstableOnSplitAtEnd={\n\t\t\t\tinsertBlocksAfter\n\t\t\t\t\t? () =>\n\t\t\t\t\t\t\tinsertBlocksAfter(\n\t\t\t\t\t\t\t\tcreateBlock( getDefaultBlockName() )\n\t\t\t\t\t\t\t)\n\t\t\t\t\t: undefined\n\t\t\t}\n\t\t\t{ ...blockProps }\n\t\t/>\n\t) : (\n\t\t<TagName { ...blockProps }>\n\t\t\t{ tagline || __( 'Site Tagline placeholder' ) }\n\t\t</TagName>\n\t);\n\treturn (\n\t\t<>\n\t\t\t<BlockControls group=\"block\">\n\t\t\t\t<HeadingLevelDropdown\n\t\t\t\t\tvalue={ level }\n\t\t\t\t\toptions={ levelOptions }\n\t\t\t\t\tonChange={ ( newLevel ) =>\n\t\t\t\t\t\tsetAttributes( { level: newLevel } )\n\t\t\t\t\t}\n\t\t\t\t/>\n\t\t\t</BlockControls>\n\t\t\t{ siteTaglineContent }\n\t\t</>\n\t);\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,kBAAuC;AACvC,uBAAmC;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