@wordpress/block-library 7.11.0 → 7.13.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 +9 -1
- package/build/archives/edit.js +7 -0
- package/build/archives/edit.js.map +1 -1
- package/build/archives/index.js +9 -1
- package/build/archives/index.js.map +1 -1
- package/build/audio/index.js +4 -0
- package/build/audio/index.js.map +1 -1
- package/build/block/edit.js +4 -2
- package/build/block/edit.js.map +1 -1
- package/build/block/edit.native.js +4 -2
- package/build/block/edit.native.js.map +1 -1
- package/build/button/deprecated.js +14 -5
- package/build/button/deprecated.js.map +1 -1
- package/build/button/index.js +1 -1
- package/build/calendar/edit.js +12 -5
- package/build/calendar/edit.js.map +1 -1
- package/build/categories/edit.js +3 -1
- package/build/categories/edit.js.map +1 -1
- package/build/categories/index.js +14 -1
- package/build/categories/index.js.map +1 -1
- package/build/code/index.js +4 -2
- package/build/code/index.js.map +1 -1
- package/build/column/index.js +13 -0
- package/build/column/index.js.map +1 -1
- package/build/columns/deprecated.js +16 -5
- package/build/columns/deprecated.js.map +1 -1
- package/build/columns/edit.js +6 -2
- package/build/columns/edit.js.map +1 -1
- package/build/columns/edit.native.js +8 -3
- package/build/columns/edit.native.js.map +1 -1
- package/build/columns/index.js +13 -0
- package/build/columns/index.js.map +1 -1
- package/build/comment-author-name/index.js +5 -1
- package/build/comment-author-name/index.js.map +1 -1
- package/build/comment-content/index.js +5 -1
- package/build/comment-content/index.js.map +1 -1
- package/build/comment-date/index.js +1 -0
- package/build/comment-date/index.js.map +1 -1
- package/build/comment-edit-link/index.js +5 -1
- package/build/comment-edit-link/index.js.map +1 -1
- package/build/comment-reply-link/index.js +5 -1
- package/build/comment-reply-link/index.js.map +1 -1
- package/build/comment-template/index.js +14 -1
- package/build/comment-template/index.js.map +1 -1
- package/build/comments/index.js +13 -0
- package/build/comments/index.js.map +1 -1
- package/build/comments-pagination/index.js +13 -0
- package/build/comments-pagination/index.js.map +1 -1
- package/build/comments-pagination-next/index.js +4 -2
- package/build/comments-pagination-next/index.js.map +1 -1
- package/build/comments-pagination-numbers/edit.js +5 -1
- package/build/comments-pagination-numbers/edit.js.map +1 -1
- package/build/comments-pagination-numbers/index.js +14 -1
- package/build/comments-pagination-numbers/index.js.map +1 -1
- package/build/comments-pagination-previous/index.js +4 -2
- package/build/comments-pagination-previous/index.js.map +1 -1
- package/build/comments-title/deprecated.js +4 -2
- package/build/comments-title/deprecated.js.map +1 -1
- package/build/comments-title/index.js +4 -2
- package/build/comments-title/index.js.map +1 -1
- package/build/cover/deprecated.js +20 -5
- package/build/cover/deprecated.js.map +1 -1
- package/build/cover/edit/resizable-cover.js +6 -0
- package/build/cover/edit/resizable-cover.js.map +1 -1
- package/build/cover/index.js +13 -0
- package/build/cover/index.js.map +1 -1
- package/build/cover/shared.js +1 -1
- package/build/cover/shared.js.map +1 -1
- package/build/embed/icons.js +1 -1
- package/build/embed/icons.js.map +1 -1
- package/build/gallery/deprecated.js +6 -1
- package/build/gallery/deprecated.js.map +1 -1
- package/build/gallery/edit.js +15 -2
- package/build/gallery/edit.js.map +1 -1
- package/build/gallery/index.js +5 -0
- package/build/gallery/index.js.map +1 -1
- package/build/gallery/transforms.js +20 -7
- package/build/gallery/transforms.js.map +1 -1
- package/build/gallery/utils.js +7 -6
- package/build/gallery/utils.js.map +1 -1
- package/build/group/deprecated.js +108 -12
- package/build/group/deprecated.js.map +1 -1
- package/build/group/edit.js +23 -1
- package/build/group/edit.js.map +1 -1
- package/build/group/index.js +10 -2
- package/build/group/index.js.map +1 -1
- package/build/group/transforms.js +5 -0
- package/build/group/transforms.js.map +1 -1
- package/build/group/variations.js +8 -8
- package/build/group/variations.js.map +1 -1
- package/build/heading/deprecated.js +5 -3
- package/build/heading/deprecated.js.map +1 -1
- package/build/heading/index.js +3 -1
- package/build/heading/index.js.map +1 -1
- package/build/heading/transforms.js +3 -1
- package/build/heading/transforms.js.map +1 -1
- package/build/home-link/edit.js +8 -4
- package/build/home-link/edit.js.map +1 -1
- package/build/image/edit.js +13 -1
- package/build/image/edit.js.map +1 -1
- package/build/image/index.js +13 -7
- package/build/image/index.js.map +1 -1
- package/build/index.native.js +23 -7
- package/build/index.native.js.map +1 -1
- package/build/list/index.js +10 -0
- package/build/list/index.js.map +1 -1
- package/build/list/v2/edit.js +16 -5
- package/build/list/v2/edit.js.map +1 -1
- package/build/list/v2/tag-name.js +31 -0
- package/build/list/v2/tag-name.js.map +1 -0
- package/build/list/v2/tag-name.native.js +32 -0
- package/build/list/v2/tag-name.native.js.map +1 -0
- package/build/list/v2/transforms.js +1 -11
- package/build/list/v2/transforms.js.map +1 -1
- package/build/list-item/edit.js +4 -1
- package/build/list-item/edit.js.map +1 -1
- package/build/list-item/edit.native.js +158 -0
- package/build/list-item/edit.native.js.map +1 -0
- package/build/list-item/hooks/index.js +8 -0
- package/build/list-item/hooks/index.js.map +1 -1
- package/build/list-item/hooks/use-copy.js +42 -0
- package/build/list-item/hooks/use-copy.js.map +1 -0
- package/build/list-item/icons.native.js +53 -0
- package/build/list-item/icons.native.js.map +1 -0
- package/build/list-item/list-style-type.native.js +139 -0
- package/build/list-item/list-style-type.native.js.map +1 -0
- package/build/list-item/utils.js +4 -0
- package/build/list-item/utils.js.map +1 -1
- package/build/media-text/deprecated.js +193 -67
- package/build/media-text/deprecated.js.map +1 -1
- package/build/media-text/edit.js +2 -1
- package/build/media-text/edit.js.map +1 -1
- package/build/media-text/index.js +17 -0
- package/build/media-text/index.js.map +1 -1
- package/build/media-text/media-container.js +1 -1
- package/build/media-text/media-container.js.map +1 -1
- package/build/navigation/deprecated.js +6 -1
- package/build/navigation/deprecated.js.map +1 -1
- package/build/navigation/edit/index.js +180 -154
- package/build/navigation/edit/index.js.map +1 -1
- package/build/navigation/edit/navigation-menu-selector.js +11 -14
- package/build/navigation/edit/navigation-menu-selector.js.map +1 -1
- package/build/navigation/edit/placeholder/index.js +4 -2
- package/build/navigation/edit/placeholder/index.js.map +1 -1
- package/build/navigation/edit/responsive-wrapper.js +13 -3
- package/build/navigation/edit/responsive-wrapper.js.map +1 -1
- package/build/navigation/edit/unsaved-inner-blocks.js +2 -1
- package/build/navigation/edit/unsaved-inner-blocks.js.map +1 -1
- package/build/navigation/edit/use-convert-classic-menu-to-block-menu.js +4 -7
- package/build/navigation/edit/use-convert-classic-menu-to-block-menu.js.map +1 -1
- package/build/navigation/edit/use-create-navigation-menu.js +5 -1
- package/build/navigation/edit/use-create-navigation-menu.js.map +1 -1
- package/build/navigation/edit/use-inner-blocks.js +43 -0
- package/build/navigation/edit/use-inner-blocks.js.map +1 -0
- package/build/navigation/edit/utils.js +28 -0
- package/build/navigation/edit/utils.js.map +1 -0
- package/build/navigation/index.js +1 -0
- package/build/navigation/index.js.map +1 -1
- package/build/navigation/menu-items-to-blocks.js +1 -7
- package/build/navigation/menu-items-to-blocks.js.map +1 -1
- package/build/navigation/use-navigation-menu.js +15 -10
- package/build/navigation/use-navigation-menu.js.map +1 -1
- package/build/navigation-link/edit.js +6 -8
- package/build/navigation-link/edit.js.map +1 -1
- package/build/navigation-submenu/edit.js +4 -6
- package/build/navigation-submenu/edit.js.map +1 -1
- package/build/page-list/edit.js +7 -3
- package/build/page-list/edit.js.map +1 -1
- package/build/paragraph/deprecated.js +18 -10
- package/build/paragraph/deprecated.js.map +1 -1
- package/build/paragraph/edit.js +1 -0
- package/build/paragraph/edit.js.map +1 -1
- package/build/paragraph/index.js +7 -0
- package/build/paragraph/index.js.map +1 -1
- package/build/paragraph/transforms.js +7 -0
- package/build/paragraph/transforms.js.map +1 -1
- package/build/post-author/edit.js +5 -2
- package/build/post-author/edit.js.map +1 -1
- package/build/post-author/index.js +4 -2
- package/build/post-author/index.js.map +1 -1
- package/build/post-author-biography/edit.js +7 -1
- package/build/post-author-biography/edit.js.map +1 -1
- package/build/post-author-biography/index.js +1 -0
- package/build/post-author-biography/index.js.map +1 -1
- package/build/post-author-name/index.js +5 -1
- package/build/post-author-name/index.js.map +1 -1
- package/build/post-comments-count/edit.js +11 -1
- package/build/post-comments-count/edit.js.map +1 -1
- package/build/post-comments-count/index.js +4 -1
- package/build/post-comments-count/index.js.map +1 -1
- package/build/post-comments-link/index.js +4 -2
- package/build/post-comments-link/index.js.map +1 -1
- package/build/post-content/edit.js +4 -2
- package/build/post-content/edit.js.map +1 -1
- package/build/post-date/edit.js +9 -2
- package/build/post-date/edit.js.map +1 -1
- package/build/post-date/index.js +9 -0
- package/build/post-date/index.js.map +1 -1
- package/build/post-featured-image/edit.js +43 -14
- package/build/post-featured-image/edit.js.map +1 -1
- package/build/post-featured-image/index.js +21 -0
- package/build/post-featured-image/index.js.map +1 -1
- package/build/post-navigation-link/index.js +3 -2
- package/build/post-navigation-link/index.js.map +1 -1
- package/build/post-template/edit.js +8 -4
- package/build/post-template/edit.js.map +1 -1
- package/build/post-template/index.js +14 -1
- package/build/post-template/index.js.map +1 -1
- package/build/post-terms/index.js +5 -3
- package/build/post-terms/index.js.map +1 -1
- package/build/post-title/index.js +2 -1
- package/build/post-title/index.js.map +1 -1
- package/build/preformatted/index.js +4 -2
- package/build/preformatted/index.js.map +1 -1
- package/build/pullquote/deprecated.js +135 -25
- package/build/pullquote/deprecated.js.map +1 -1
- package/build/pullquote/edit.js +1 -1
- package/build/pullquote/edit.js.map +1 -1
- package/build/pullquote/edit.native.js +0 -1
- package/build/pullquote/edit.native.js.map +1 -1
- package/build/pullquote/index.js +13 -6
- package/build/pullquote/index.js.map +1 -1
- package/build/pullquote/save.js +2 -2
- package/build/pullquote/save.js.map +1 -1
- package/build/pullquote/transforms.js +14 -33
- package/build/pullquote/transforms.js.map +1 -1
- package/build/query/deprecated.js +10 -9
- package/build/query/deprecated.js.map +1 -1
- package/build/query/edit/index.js +19 -8
- package/build/query/edit/index.js.map +1 -1
- package/build/query/edit/inspector-controls/index.js +42 -9
- package/build/query/edit/inspector-controls/index.js.map +1 -1
- package/build/query/edit/inspector-controls/taxonomy-controls.js +22 -14
- package/build/query/edit/inspector-controls/taxonomy-controls.js.map +1 -1
- package/build/query/edit/query-placeholder.js +6 -1
- package/build/query/edit/query-placeholder.js.map +1 -1
- package/build/query/utils.js +35 -9
- package/build/query/utils.js.map +1 -1
- package/build/query-no-results/edit.js +1 -1
- package/build/query-no-results/edit.js.map +1 -1
- package/build/query-title/edit.js +30 -8
- package/build/query-title/edit.js.map +1 -1
- package/build/query-title/index.js +11 -2
- package/build/query-title/index.js.map +1 -1
- package/build/query-title/variations.js +10 -0
- package/build/query-title/variations.js.map +1 -1
- package/build/quote/deprecated.js +13 -6
- package/build/quote/deprecated.js.map +1 -1
- package/build/quote/transforms.js +24 -39
- package/build/quote/transforms.js.map +1 -1
- package/build/separator/deprecated.js +3 -4
- package/build/separator/deprecated.js.map +1 -1
- package/build/separator/edit.js +1 -1
- package/build/separator/edit.js.map +1 -1
- package/build/separator/index.js +1 -0
- package/build/separator/index.js.map +1 -1
- package/build/social-link/icons/reddit.js +1 -1
- package/build/social-link/icons/reddit.js.map +1 -1
- package/build/social-links/edit.js +44 -9
- package/build/social-links/edit.js.map +1 -1
- package/build/social-links/index.js +9 -0
- package/build/social-links/index.js.map +1 -1
- package/build/spacer/index.js +7 -1
- package/build/spacer/index.js.map +1 -1
- package/build/table/index.js +4 -0
- package/build/table/index.js.map +1 -1
- package/build/table/state.js +9 -3
- package/build/table/state.js.map +1 -1
- package/build/table-of-contents/index.js +24 -1
- package/build/table-of-contents/index.js.map +1 -1
- package/build/tag-cloud/index.js +5 -1
- package/build/tag-cloud/index.js.map +1 -1
- package/build/template-part/edit/index.js +4 -2
- package/build/template-part/edit/index.js.map +1 -1
- package/build/template-part/index.js +2 -2
- package/build/template-part/index.js.map +1 -1
- package/build/term-description/index.js +4 -0
- package/build/term-description/index.js.map +1 -1
- package/build/text-columns/edit.js +3 -1
- package/build/text-columns/edit.js.map +1 -1
- package/build/text-columns/save.js +3 -1
- package/build/text-columns/save.js.map +1 -1
- package/build/verse/index.js +1 -0
- package/build/verse/index.js.map +1 -1
- package/build/video/index.js +4 -0
- package/build/video/index.js.map +1 -1
- package/build-module/archives/edit.js +7 -0
- package/build-module/archives/edit.js.map +1 -1
- package/build-module/archives/index.js +9 -1
- package/build-module/archives/index.js.map +1 -1
- package/build-module/audio/index.js +4 -0
- package/build-module/audio/index.js.map +1 -1
- package/build-module/block/edit.js +5 -3
- package/build-module/block/edit.js.map +1 -1
- package/build-module/block/edit.native.js +5 -3
- package/build-module/block/edit.native.js.map +1 -1
- package/build-module/button/deprecated.js +14 -4
- package/build-module/button/deprecated.js.map +1 -1
- package/build-module/button/index.js +1 -1
- package/build-module/calendar/edit.js +12 -4
- package/build-module/calendar/edit.js.map +1 -1
- package/build-module/categories/edit.js +4 -2
- package/build-module/categories/edit.js.map +1 -1
- package/build-module/categories/index.js +14 -1
- package/build-module/categories/index.js.map +1 -1
- package/build-module/code/index.js +4 -2
- package/build-module/code/index.js.map +1 -1
- package/build-module/column/index.js +13 -0
- package/build-module/column/index.js.map +1 -1
- package/build-module/columns/deprecated.js +16 -4
- package/build-module/columns/deprecated.js.map +1 -1
- package/build-module/columns/edit.js +7 -3
- package/build-module/columns/edit.js.map +1 -1
- package/build-module/columns/edit.native.js +9 -4
- package/build-module/columns/edit.native.js.map +1 -1
- package/build-module/columns/index.js +13 -0
- package/build-module/columns/index.js.map +1 -1
- package/build-module/comment-author-name/index.js +5 -1
- package/build-module/comment-author-name/index.js.map +1 -1
- package/build-module/comment-content/index.js +5 -1
- package/build-module/comment-content/index.js.map +1 -1
- package/build-module/comment-date/index.js +1 -0
- package/build-module/comment-date/index.js.map +1 -1
- package/build-module/comment-edit-link/index.js +5 -1
- package/build-module/comment-edit-link/index.js.map +1 -1
- package/build-module/comment-reply-link/index.js +5 -1
- package/build-module/comment-reply-link/index.js.map +1 -1
- package/build-module/comment-template/index.js +14 -1
- package/build-module/comment-template/index.js.map +1 -1
- package/build-module/comments/index.js +13 -0
- package/build-module/comments/index.js.map +1 -1
- package/build-module/comments-pagination/index.js +13 -0
- package/build-module/comments-pagination/index.js.map +1 -1
- package/build-module/comments-pagination-next/index.js +4 -2
- package/build-module/comments-pagination-next/index.js.map +1 -1
- package/build-module/comments-pagination-numbers/edit.js +5 -1
- package/build-module/comments-pagination-numbers/edit.js.map +1 -1
- package/build-module/comments-pagination-numbers/index.js +14 -1
- package/build-module/comments-pagination-numbers/index.js.map +1 -1
- package/build-module/comments-pagination-previous/index.js +4 -2
- package/build-module/comments-pagination-previous/index.js.map +1 -1
- package/build-module/comments-title/deprecated.js +4 -2
- package/build-module/comments-title/deprecated.js.map +1 -1
- package/build-module/comments-title/index.js +4 -2
- package/build-module/comments-title/index.js.map +1 -1
- package/build-module/cover/deprecated.js +20 -4
- package/build-module/cover/deprecated.js.map +1 -1
- package/build-module/cover/edit/resizable-cover.js +6 -0
- package/build-module/cover/edit/resizable-cover.js.map +1 -1
- package/build-module/cover/index.js +13 -0
- package/build-module/cover/index.js.map +1 -1
- package/build-module/cover/shared.js +1 -1
- package/build-module/cover/shared.js.map +1 -1
- package/build-module/embed/icons.js +1 -1
- package/build-module/embed/icons.js.map +1 -1
- package/build-module/gallery/deprecated.js +7 -2
- package/build-module/gallery/deprecated.js.map +1 -1
- package/build-module/gallery/edit.js +15 -2
- package/build-module/gallery/edit.js.map +1 -1
- package/build-module/gallery/index.js +5 -0
- package/build-module/gallery/index.js.map +1 -1
- package/build-module/gallery/transforms.js +20 -7
- package/build-module/gallery/transforms.js.map +1 -1
- package/build-module/gallery/utils.js +7 -6
- package/build-module/gallery/utils.js.map +1 -1
- package/build-module/group/deprecated.js +109 -12
- package/build-module/group/deprecated.js.map +1 -1
- package/build-module/group/edit.js +25 -2
- package/build-module/group/edit.js.map +1 -1
- package/build-module/group/index.js +10 -2
- package/build-module/group/index.js.map +1 -1
- package/build-module/group/transforms.js +5 -0
- package/build-module/group/transforms.js.map +1 -1
- package/build-module/group/variations.js +8 -8
- package/build-module/group/variations.js.map +1 -1
- package/build-module/heading/deprecated.js +5 -2
- package/build-module/heading/deprecated.js.map +1 -1
- package/build-module/heading/index.js +3 -1
- package/build-module/heading/index.js.map +1 -1
- package/build-module/heading/transforms.js +3 -1
- package/build-module/heading/transforms.js.map +1 -1
- package/build-module/home-link/edit.js +10 -6
- package/build-module/home-link/edit.js.map +1 -1
- package/build-module/image/edit.js +14 -2
- package/build-module/image/edit.js.map +1 -1
- package/build-module/image/index.js +13 -7
- package/build-module/image/index.js.map +1 -1
- package/build-module/index.native.js +22 -6
- package/build-module/index.native.js.map +1 -1
- package/build-module/list/index.js +5 -1
- package/build-module/list/index.js.map +1 -1
- package/build-module/list/v2/edit.js +15 -5
- package/build-module/list/v2/edit.js.map +1 -1
- package/build-module/list/v2/tag-name.js +21 -0
- package/build-module/list/v2/tag-name.js.map +1 -0
- package/build-module/list/v2/tag-name.native.js +21 -0
- package/build-module/list/v2/tag-name.native.js.map +1 -0
- package/build-module/list/v2/transforms.js +1 -10
- package/build-module/list/v2/transforms.js.map +1 -1
- package/build-module/list-item/edit.js +5 -5
- package/build-module/list-item/edit.js.map +1 -1
- package/build-module/list-item/edit.native.js +141 -0
- package/build-module/list-item/edit.native.js.map +1 -0
- package/build-module/list-item/hooks/index.js +1 -0
- package/build-module/list-item/hooks/index.js.map +1 -1
- package/build-module/list-item/hooks/use-copy.js +32 -0
- package/build-module/list-item/hooks/use-copy.js.map +1 -0
- package/build-module/list-item/icons.native.js +37 -0
- package/build-module/list-item/icons.native.js.map +1 -0
- package/build-module/list-item/list-style-type.native.js +126 -0
- package/build-module/list-item/list-style-type.native.js.map +1 -0
- package/build-module/list-item/utils.js +4 -0
- package/build-module/list-item/utils.js.map +1 -1
- package/build-module/media-text/deprecated.js +195 -67
- package/build-module/media-text/deprecated.js.map +1 -1
- package/build-module/media-text/edit.js +2 -1
- package/build-module/media-text/edit.js.map +1 -1
- package/build-module/media-text/index.js +17 -0
- package/build-module/media-text/index.js.map +1 -1
- package/build-module/media-text/media-container.js +1 -1
- package/build-module/media-text/media-container.js.map +1 -1
- package/build-module/navigation/deprecated.js +7 -2
- package/build-module/navigation/deprecated.js.map +1 -1
- package/build-module/navigation/edit/index.js +178 -154
- package/build-module/navigation/edit/index.js.map +1 -1
- package/build-module/navigation/edit/navigation-menu-selector.js +12 -15
- package/build-module/navigation/edit/navigation-menu-selector.js.map +1 -1
- package/build-module/navigation/edit/placeholder/index.js +4 -2
- package/build-module/navigation/edit/placeholder/index.js.map +1 -1
- package/build-module/navigation/edit/responsive-wrapper.js +12 -3
- package/build-module/navigation/edit/responsive-wrapper.js.map +1 -1
- package/build-module/navigation/edit/unsaved-inner-blocks.js +2 -1
- package/build-module/navigation/edit/unsaved-inner-blocks.js.map +1 -1
- package/build-module/navigation/edit/use-convert-classic-menu-to-block-menu.js +4 -7
- package/build-module/navigation/edit/use-convert-classic-menu-to-block-menu.js.map +1 -1
- package/build-module/navigation/edit/use-create-navigation-menu.js +5 -1
- package/build-module/navigation/edit/use-create-navigation-menu.js.map +1 -1
- package/build-module/navigation/edit/use-inner-blocks.js +33 -0
- package/build-module/navigation/edit/use-inner-blocks.js.map +1 -0
- package/build-module/navigation/edit/utils.js +21 -0
- package/build-module/navigation/edit/utils.js.map +1 -0
- package/build-module/navigation/index.js +1 -0
- package/build-module/navigation/index.js.map +1 -1
- package/build-module/navigation/menu-items-to-blocks.js +1 -6
- package/build-module/navigation/menu-items-to-blocks.js.map +1 -1
- package/build-module/navigation/use-navigation-menu.js +15 -10
- package/build-module/navigation/use-navigation-menu.js.map +1 -1
- package/build-module/navigation-link/edit.js +7 -9
- package/build-module/navigation-link/edit.js.map +1 -1
- package/build-module/navigation-submenu/edit.js +5 -7
- package/build-module/navigation-submenu/edit.js.map +1 -1
- package/build-module/page-list/edit.js +7 -2
- package/build-module/page-list/edit.js.map +1 -1
- package/build-module/paragraph/deprecated.js +18 -9
- package/build-module/paragraph/deprecated.js.map +1 -1
- package/build-module/paragraph/edit.js +1 -0
- package/build-module/paragraph/edit.js.map +1 -1
- package/build-module/paragraph/index.js +7 -0
- package/build-module/paragraph/index.js.map +1 -1
- package/build-module/paragraph/transforms.js +7 -0
- package/build-module/paragraph/transforms.js.map +1 -1
- package/build-module/post-author/edit.js +5 -2
- package/build-module/post-author/edit.js.map +1 -1
- package/build-module/post-author/index.js +4 -2
- package/build-module/post-author/index.js.map +1 -1
- package/build-module/post-author-biography/edit.js +6 -1
- package/build-module/post-author-biography/edit.js.map +1 -1
- package/build-module/post-author-biography/index.js +1 -0
- package/build-module/post-author-biography/index.js.map +1 -1
- package/build-module/post-author-name/index.js +5 -1
- package/build-module/post-author-name/index.js.map +1 -1
- package/build-module/post-comments-count/edit.js +10 -1
- package/build-module/post-comments-count/edit.js.map +1 -1
- package/build-module/post-comments-count/index.js +4 -1
- package/build-module/post-comments-count/index.js.map +1 -1
- package/build-module/post-comments-link/index.js +4 -2
- package/build-module/post-comments-link/index.js.map +1 -1
- package/build-module/post-content/edit.js +5 -3
- package/build-module/post-content/edit.js.map +1 -1
- package/build-module/post-date/edit.js +9 -2
- package/build-module/post-date/edit.js.map +1 -1
- package/build-module/post-date/index.js +9 -0
- package/build-module/post-date/index.js.map +1 -1
- package/build-module/post-featured-image/edit.js +45 -16
- package/build-module/post-featured-image/edit.js.map +1 -1
- package/build-module/post-featured-image/index.js +21 -0
- package/build-module/post-featured-image/index.js.map +1 -1
- package/build-module/post-navigation-link/index.js +3 -2
- package/build-module/post-navigation-link/index.js.map +1 -1
- package/build-module/post-template/edit.js +8 -4
- package/build-module/post-template/edit.js.map +1 -1
- package/build-module/post-template/index.js +14 -1
- package/build-module/post-template/index.js.map +1 -1
- package/build-module/post-terms/index.js +5 -3
- package/build-module/post-terms/index.js.map +1 -1
- package/build-module/post-title/index.js +2 -1
- package/build-module/post-title/index.js.map +1 -1
- package/build-module/preformatted/index.js +4 -2
- package/build-module/preformatted/index.js.map +1 -1
- package/build-module/pullquote/deprecated.js +134 -25
- package/build-module/pullquote/deprecated.js.map +1 -1
- package/build-module/pullquote/edit.js +1 -1
- package/build-module/pullquote/edit.js.map +1 -1
- package/build-module/pullquote/edit.native.js +0 -1
- package/build-module/pullquote/edit.native.js.map +1 -1
- package/build-module/pullquote/index.js +13 -6
- package/build-module/pullquote/index.js.map +1 -1
- package/build-module/pullquote/save.js +2 -2
- package/build-module/pullquote/save.js.map +1 -1
- package/build-module/pullquote/transforms.js +15 -34
- package/build-module/pullquote/transforms.js.map +1 -1
- package/build-module/query/deprecated.js +10 -8
- package/build-module/query/deprecated.js.map +1 -1
- package/build-module/query/edit/index.js +23 -12
- package/build-module/query/edit/index.js.map +1 -1
- package/build-module/query/edit/inspector-controls/index.js +42 -9
- package/build-module/query/edit/inspector-controls/index.js.map +1 -1
- package/build-module/query/edit/inspector-controls/taxonomy-controls.js +17 -12
- package/build-module/query/edit/inspector-controls/taxonomy-controls.js.map +1 -1
- package/build-module/query/edit/query-placeholder.js +6 -1
- package/build-module/query/edit/query-placeholder.js.map +1 -1
- package/build-module/query/utils.js +32 -7
- package/build-module/query/utils.js.map +1 -1
- package/build-module/query-no-results/edit.js +1 -1
- package/build-module/query-no-results/edit.js.map +1 -1
- package/build-module/query-title/edit.js +30 -9
- package/build-module/query-title/edit.js.map +1 -1
- package/build-module/query-title/index.js +11 -2
- package/build-module/query-title/index.js.map +1 -1
- package/build-module/query-title/variations.js +10 -0
- package/build-module/query-title/variations.js.map +1 -1
- package/build-module/quote/deprecated.js +13 -5
- package/build-module/quote/deprecated.js.map +1 -1
- package/build-module/quote/transforms.js +25 -40
- package/build-module/quote/transforms.js.map +1 -1
- package/build-module/separator/deprecated.js +3 -3
- package/build-module/separator/deprecated.js.map +1 -1
- package/build-module/separator/edit.js +1 -1
- package/build-module/separator/edit.js.map +1 -1
- package/build-module/separator/index.js +1 -0
- package/build-module/separator/index.js.map +1 -1
- package/build-module/social-link/icons/reddit.js +1 -1
- package/build-module/social-link/icons/reddit.js.map +1 -1
- package/build-module/social-links/edit.js +46 -12
- package/build-module/social-links/edit.js.map +1 -1
- package/build-module/social-links/index.js +9 -0
- package/build-module/social-links/index.js.map +1 -1
- package/build-module/spacer/index.js +7 -1
- package/build-module/spacer/index.js.map +1 -1
- package/build-module/table/index.js +4 -0
- package/build-module/table/index.js.map +1 -1
- package/build-module/table/state.js +10 -4
- package/build-module/table/state.js.map +1 -1
- package/build-module/table-of-contents/index.js +24 -1
- package/build-module/table-of-contents/index.js.map +1 -1
- package/build-module/tag-cloud/index.js +5 -1
- package/build-module/tag-cloud/index.js.map +1 -1
- package/build-module/template-part/edit/index.js +5 -3
- package/build-module/template-part/edit/index.js.map +1 -1
- package/build-module/template-part/index.js +2 -2
- package/build-module/template-part/index.js.map +1 -1
- package/build-module/term-description/index.js +4 -0
- package/build-module/term-description/index.js.map +1 -1
- package/build-module/text-columns/edit.js +4 -2
- package/build-module/text-columns/edit.js.map +1 -1
- package/build-module/text-columns/save.js +4 -2
- package/build-module/text-columns/save.js.map +1 -1
- package/build-module/verse/index.js +1 -0
- package/build-module/verse/index.js.map +1 -1
- package/build-module/video/index.js +4 -0
- package/build-module/video/index.js.map +1 -1
- package/build-style/audio/style-rtl.css +3 -0
- package/build-style/audio/style.css +3 -0
- package/build-style/button/style-rtl.css +6 -6
- package/build-style/button/style.css +6 -6
- package/build-style/editor-rtl.css +115 -122
- package/build-style/editor.css +115 -122
- package/build-style/group/editor-rtl.css +27 -8
- package/build-style/group/editor.css +27 -8
- package/build-style/image/editor-rtl.css +21 -2
- package/build-style/image/editor.css +21 -2
- package/build-style/latest-posts/editor-rtl.css +3 -0
- package/build-style/latest-posts/editor.css +3 -0
- package/build-style/media-text/style-rtl.css +1 -0
- package/build-style/media-text/style.css +1 -0
- package/build-style/navigation/editor-rtl.css +8 -4
- package/build-style/navigation/editor.css +8 -4
- package/build-style/navigation/style-rtl.css +17 -19
- package/build-style/navigation/style.css +17 -19
- package/build-style/paragraph/editor-rtl.css +1 -1
- package/build-style/paragraph/editor.css +1 -1
- package/build-style/post-date/style-rtl.css +79 -0
- package/build-style/post-date/style.css +79 -0
- package/build-style/post-featured-image/editor-rtl.css +45 -43
- package/build-style/post-featured-image/editor.css +45 -43
- package/build-style/post-featured-image/style-rtl.css +1 -0
- package/build-style/post-featured-image/style.css +1 -0
- package/build-style/post-title/style-rtl.css +1 -0
- package/build-style/post-title/style.css +1 -0
- package/build-style/pullquote/editor-rtl.css +0 -12
- package/build-style/pullquote/editor.css +0 -12
- package/build-style/pullquote/style-rtl.css +1 -8
- package/build-style/pullquote/style.css +1 -8
- package/build-style/query/editor-rtl.css +7 -0
- package/build-style/query/editor.css +7 -0
- package/build-style/query-pagination/style-rtl.css +6 -0
- package/build-style/query-pagination/style.css +6 -0
- package/build-style/query-title/style-rtl.css +79 -0
- package/build-style/query-title/style.css +79 -0
- package/build-style/search/style-rtl.css +2 -0
- package/build-style/search/style.css +2 -0
- package/build-style/site-logo/editor-rtl.css +3 -52
- package/build-style/site-logo/editor.css +3 -52
- package/build-style/social-links/style-rtl.css +2 -2
- package/build-style/social-links/style.css +2 -2
- package/build-style/style-rtl.css +52 -35
- package/build-style/style.css +52 -35
- package/build-style/tag-cloud/style-rtl.css +1 -0
- package/build-style/tag-cloud/style.css +1 -0
- package/build-style/video/style-rtl.css +3 -0
- package/build-style/video/style.css +3 -0
- package/package.json +30 -30
- package/src/archives/block.json +9 -1
- package/src/archives/edit.js +12 -1
- package/src/archives/index.php +5 -3
- package/src/audio/block.json +4 -0
- package/src/audio/style.scss +2 -0
- package/src/audio/test/__snapshots__/edit.native.js.snap +16 -2
- package/src/block/edit.js +4 -4
- package/src/block/edit.native.js +4 -4
- package/src/button/block.json +1 -1
- package/src/button/deprecated.js +21 -22
- package/src/button/style.scss +6 -6
- package/src/calendar/edit.js +11 -4
- package/src/calendar/index.php +2 -2
- package/src/categories/block.json +14 -1
- package/src/categories/edit.js +2 -2
- package/src/code/block.json +4 -2
- package/src/column/block.json +13 -0
- package/src/columns/block.json +13 -0
- package/src/columns/deprecated.js +10 -4
- package/src/columns/edit.js +7 -3
- package/src/columns/edit.native.js +10 -4
- package/src/comment-author-name/block.json +5 -1
- package/src/comment-content/block.json +5 -1
- package/src/comment-date/block.json +1 -0
- package/src/comment-edit-link/block.json +5 -1
- package/src/comment-reply-link/block.json +5 -1
- package/src/comment-template/block.json +14 -1
- package/src/comments/block.json +13 -0
- package/src/comments/index.php +6 -5
- package/src/comments-pagination/block.json +13 -0
- package/src/comments-pagination-next/block.json +4 -2
- package/src/comments-pagination-numbers/block.json +14 -1
- package/src/comments-pagination-numbers/edit.js +12 -3
- package/src/comments-pagination-previous/block.json +4 -2
- package/src/comments-title/block.json +4 -2
- package/src/cover/block.json +13 -0
- package/src/cover/deprecated.js +11 -4
- package/src/cover/edit/resizable-cover.js +6 -0
- package/src/cover/index.php +2 -2
- package/src/cover/shared.js +2 -1
- package/src/embed/icons.js +1 -1
- package/src/file/test/__snapshots__/edit.native.js.snap +32 -4
- package/src/gallery/block.json +5 -0
- package/src/gallery/deprecated.js +4 -2
- package/src/gallery/edit.js +22 -2
- package/src/gallery/transforms.js +18 -5
- package/src/gallery/utils.js +11 -7
- package/src/group/block.json +10 -2
- package/src/group/deprecated.js +89 -2
- package/src/group/edit.js +15 -2
- package/src/group/editor.scss +28 -3
- package/src/group/transforms.js +7 -0
- package/src/group/variations.js +4 -3
- package/src/heading/block.json +3 -1
- package/src/heading/deprecated.js +4 -2
- package/src/home-link/edit.js +19 -20
- package/src/home-link/index.php +8 -17
- package/src/image/block.json +13 -7
- package/src/image/edit.js +19 -1
- package/src/image/editor.scss +39 -3
- package/src/image/index.php +1 -1
- package/src/image/test/edit.native.js +6 -10
- package/src/index.native.js +30 -12
- package/src/latest-posts/editor.scss +5 -0
- package/src/list/block.json +4 -0
- package/src/list/index.js +1 -1
- package/src/list/test/__snapshots__/edit.native.js.snap +133 -0
- package/src/list/test/edit.native.js +511 -7
- package/src/list/v2/edit.js +12 -4
- package/src/list/v2/tag-name.js +13 -0
- package/src/list/v2/tag-name.native.js +12 -0
- package/src/list/v2/transforms.js +1 -9
- package/src/list-item/edit.js +3 -2
- package/src/list-item/edit.native.js +148 -0
- package/src/list-item/hooks/index.js +1 -0
- package/src/list-item/hooks/use-copy.js +36 -0
- package/src/list-item/icons.native.js +34 -0
- package/src/list-item/list-style-type.native.js +146 -0
- package/src/list-item/style.native.scss +49 -0
- package/src/media-text/block.json +17 -0
- package/src/media-text/deprecated.js +564 -417
- package/src/media-text/edit.js +1 -0
- package/src/media-text/media-container.js +3 -1
- package/src/media-text/style.scss +2 -0
- package/src/media-text/test/media-container.js +24 -0
- package/src/navigation/block.json +1 -0
- package/src/navigation/deprecated.js +4 -2
- package/src/navigation/edit/index.js +234 -237
- package/src/navigation/edit/navigation-menu-selector.js +12 -26
- package/src/navigation/edit/placeholder/index.js +4 -2
- package/src/navigation/edit/responsive-wrapper.js +24 -3
- package/src/navigation/edit/unsaved-inner-blocks.js +3 -1
- package/src/navigation/edit/use-convert-classic-menu-to-block-menu.js +31 -37
- package/src/navigation/edit/use-create-navigation-menu.js +4 -0
- package/src/navigation/edit/use-inner-blocks.js +39 -0
- package/src/navigation/edit/utils.js +30 -0
- package/src/navigation/editor.scss +3 -2
- package/src/navigation/index.php +17 -16
- package/src/navigation/menu-items-to-blocks.js +3 -6
- package/src/navigation/style.scss +13 -22
- package/src/navigation/test/use-navigation-menu.js +18 -1
- package/src/navigation/use-navigation-menu.js +20 -13
- package/src/navigation-link/edit.js +9 -13
- package/src/navigation-link/index.php +1 -1
- package/src/navigation-submenu/edit.js +9 -13
- package/src/navigation-submenu/index.php +1 -1
- package/src/page-list/edit.js +6 -2
- package/src/page-list/index.php +4 -4
- package/src/paragraph/block.json +7 -0
- package/src/paragraph/deprecated.js +33 -35
- package/src/paragraph/edit.js +1 -0
- package/src/paragraph/editor.scss +5 -3
- package/src/post-author/block.json +4 -2
- package/src/post-author/edit.js +6 -3
- package/src/post-author-biography/block.json +1 -0
- package/src/post-author-biography/edit.js +4 -1
- package/src/post-author-name/block.json +5 -1
- package/src/post-comments-count/block.json +4 -1
- package/src/post-comments-count/edit.js +10 -2
- package/src/post-comments-link/block.json +4 -2
- package/src/post-content/edit.js +4 -4
- package/src/post-date/block.json +9 -0
- package/src/post-date/edit.js +12 -2
- package/src/post-date/index.php +10 -2
- package/src/post-date/style.scss +4 -0
- package/src/post-featured-image/block.json +21 -0
- package/src/post-featured-image/edit.js +66 -14
- package/src/post-featured-image/editor.scss +44 -53
- package/src/post-featured-image/index.php +64 -5
- package/src/post-featured-image/style.scss +1 -0
- package/src/post-navigation-link/block.json +3 -2
- package/src/post-template/block.json +15 -1
- package/src/post-template/edit.js +6 -1
- package/src/post-template/index.php +7 -4
- package/src/post-terms/block.json +5 -3
- package/src/post-title/block.json +2 -1
- package/src/post-title/index.php +2 -1
- package/src/post-title/style.scss +2 -0
- package/src/preformatted/block.json +4 -2
- package/src/preformatted/test/__snapshots__/edit.native.js.snap +16 -2
- package/src/pullquote/block.json +11 -4
- package/src/pullquote/deprecated.js +490 -412
- package/src/pullquote/edit.js +1 -1
- package/src/pullquote/edit.native.js +0 -1
- package/src/pullquote/editor.scss +0 -16
- package/src/pullquote/index.js +1 -3
- package/src/pullquote/save.js +1 -1
- package/src/pullquote/style.scss +0 -11
- package/src/pullquote/transforms.js +17 -33
- package/src/query/deprecated.js +4 -9
- package/src/query/edit/index.js +28 -15
- package/src/query/edit/inspector-controls/index.js +129 -65
- package/src/query/edit/inspector-controls/taxonomy-controls.js +18 -11
- package/src/query/edit/query-placeholder.js +17 -2
- package/src/query/editor.scss +9 -0
- package/src/query/utils.js +29 -7
- package/src/query-no-results/edit.js +1 -1
- package/src/query-pagination/style.scss +14 -0
- package/src/query-title/block.json +11 -2
- package/src/query-title/edit.js +51 -7
- package/src/query-title/index.php +28 -2
- package/src/query-title/style.scss +4 -0
- package/src/query-title/variations.js +13 -0
- package/src/quote/deprecated.js +6 -5
- package/src/quote/transforms.js +6 -24
- package/src/search/index.php +1 -1
- package/src/search/style.scss +2 -0
- package/src/search/test/__snapshots__/edit.native.js.snap +56 -7
- package/src/separator/block.json +1 -0
- package/src/separator/deprecated.js +2 -3
- package/src/separator/edit.js +1 -1
- package/src/separator/test/edit.js +5 -3
- package/src/site-logo/editor.scss +8 -66
- package/src/site-title/index.php +8 -9
- package/src/social-link/icons/reddit.js +1 -1
- package/src/social-link/index.php +2 -2
- package/src/social-link/socials-with-bg.scss +1 -1
- package/src/social-link/socials-without-bg.scss +1 -1
- package/src/social-links/block.json +9 -0
- package/src/social-links/edit.js +48 -19
- package/src/spacer/block.json +7 -1
- package/src/style.scss +2 -0
- package/src/table/block.json +4 -0
- package/src/table/state.js +21 -19
- package/src/table-of-contents/block.json +24 -1
- package/src/tag-cloud/block.json +5 -1
- package/src/tag-cloud/style.scss +1 -0
- package/src/template-part/edit/index.js +4 -4
- package/src/template-part/index.js +3 -2
- package/src/term-description/block.json +4 -0
- package/src/text-columns/edit.js +2 -2
- package/src/text-columns/save.js +2 -2
- package/src/verse/block.json +1 -0
- package/src/video/block.json +4 -0
- package/src/video/style.scss +2 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-library/src/query/edit/inspector-controls/index.js"],"names":["debounce","PanelBody","TextControl","SelectControl","RangeControl","ToggleControl","Notice","__","InspectorControls","useEffect","useState","useCallback","useSelect","store","coreStore","OrderControl","AuthorControl","ParentControl","TaxonomyControls","StickyControl","usePostTypes","useIsPostTypeHierarchical","postType","select","type","getPostType","viewable","hierarchical","QueryInspectorControls","attributes","query","displayLayout","setQuery","setDisplayLayout","order","orderBy","author","authorIds","sticky","inherit","taxQuery","parents","showSticky","setShowSticky","postTypesTaxonomiesMap","postTypesSelectOptions","isPostTypeHierarchical","onPostTypeChange","newValue","updateQuery","supportedTaxonomies","updatedTaxQuery","Object","entries","reduce","accumulator","taxonomySlug","terms","includes","keys","length","undefined","querySearch","setQuerySearch","search","onChangeDebounced","cancel","value","columns","Math","max"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,QAAT,QAAyB,QAAzB;AAEA;AACA;AACA;;AACA,SACCC,SADD,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AAC,aAAD;AACC,IAAA,OAAO,EAAGL,OADX;AAEC,IAAA,QAAQ,EAAGnB,QAFZ;AAGC,IAAA,QAAQ,EAAGU;AAHZ,IATF,CAvDF,CADD;AA2EA","sourcesContent":["/**\n * External dependencies\n */\nimport { debounce } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tPanelBody,\n\tTextControl,\n\tSelectControl,\n\tRangeControl,\n\tToggleControl,\n\tNotice,\n} from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { InspectorControls } from '@wordpress/block-editor';\nimport { useEffect, useState, useCallback } from '@wordpress/element';\nimport { useSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\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 StickyControl from './sticky-control';\nimport { usePostTypes } from '../../utils';\n\nfunction useIsPostTypeHierarchical( postType ) {\n\treturn useSelect(\n\t\t( select ) => {\n\t\t\tconst type = select( coreStore ).getPostType( postType );\n\t\t\treturn type?.viewable && type?.hierarchical;\n\t\t},\n\t\t[ postType ]\n\t);\n}\n\nexport default function QueryInspectorControls( {\n\tattributes: { query, displayLayout },\n\tsetQuery,\n\tsetDisplayLayout,\n} ) {\n\tconst {\n\t\torder,\n\t\torderBy,\n\t\tauthor: authorIds,\n\t\tpostType,\n\t\tsticky,\n\t\tinherit,\n\t\ttaxQuery,\n\t\tparents,\n\t} = query;\n\tconst [ showSticky, setShowSticky ] = useState( postType === 'post' );\n\tconst { postTypesTaxonomiesMap, postTypesSelectOptions } = usePostTypes();\n\tconst isPostTypeHierarchical = useIsPostTypeHierarchical( postType );\n\tuseEffect( () => {\n\t\tsetShowSticky( postType === 'post' );\n\t}, [ 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\tconst updatedTaxQuery = Object.entries( taxQuery || {} ).reduce(\n\t\t\t( accumulator, [ taxonomySlug, terms ] ) => {\n\t\t\t\tif ( supportedTaxonomies.includes( taxonomySlug ) ) {\n\t\t\t\t\taccumulator[ taxonomySlug ] = terms;\n\t\t\t\t}\n\t\t\t\treturn accumulator;\n\t\t\t},\n\t\t\t{}\n\t\t);\n\t\tupdateQuery.taxQuery = !! Object.keys( updatedTaxQuery ).length\n\t\t\t? updatedTaxQuery\n\t\t\t: undefined;\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\tsetQuery( updateQuery );\n\t};\n\tconst [ querySearch, setQuerySearch ] = useState( query.search );\n\tconst onChangeDebounced = useCallback(\n\t\tdebounce( () => {\n\t\t\tif ( query.search !== querySearch ) {\n\t\t\t\tsetQuery( { search: querySearch } );\n\t\t\t}\n\t\t}, 250 ),\n\t\t[ querySearch, query.search ]\n\t);\n\tuseEffect( () => {\n\t\tonChangeDebounced();\n\t\treturn onChangeDebounced.cancel;\n\t}, [ querySearch, onChangeDebounced ] );\n\treturn (\n\t\t<InspectorControls>\n\t\t\t<PanelBody title={ __( 'Settings' ) }>\n\t\t\t\t<ToggleControl\n\t\t\t\t\tlabel={ __( 'Inherit query from template' ) }\n\t\t\t\t\thelp={ __(\n\t\t\t\t\t\t'Toggle to use the global query context that is set with the current template, such as an archive or search. Disable to customize the settings independently.'\n\t\t\t\t\t) }\n\t\t\t\t\tchecked={ !! inherit }\n\t\t\t\t\tonChange={ ( value ) => setQuery( { inherit: !! value } ) }\n\t\t\t\t/>\n\t\t\t\t{ ! inherit && (\n\t\t\t\t\t<SelectControl\n\t\t\t\t\t\toptions={ postTypesSelectOptions }\n\t\t\t\t\t\tvalue={ postType }\n\t\t\t\t\t\tlabel={ __( 'Post type' ) }\n\t\t\t\t\t\tonChange={ onPostTypeChange }\n\t\t\t\t\t\thelp={ __(\n\t\t\t\t\t\t\t'WordPress contains different types of content and they are divided into collections called \"Post types\". By default there are a few different ones such as blog posts and pages, but plugins could add more.'\n\t\t\t\t\t\t) }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t\t{ displayLayout?.type === 'flex' && (\n\t\t\t\t\t<>\n\t\t\t\t\t\t<RangeControl\n\t\t\t\t\t\t\tlabel={ __( 'Columns' ) }\n\t\t\t\t\t\t\tvalue={ displayLayout.columns }\n\t\t\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\t\t\tsetDisplayLayout( { columns: value } )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tmin={ 2 }\n\t\t\t\t\t\t\tmax={ Math.max( 6, displayLayout.columns ) }\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t{ displayLayout.columns > 6 && (\n\t\t\t\t\t\t\t<Notice status=\"warning\" isDismissible={ false }>\n\t\t\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t\t\t'This column count exceeds the recommended amount and may cause visual breakage.'\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t</Notice>\n\t\t\t\t\t\t) }\n\t\t\t\t\t</>\n\t\t\t\t) }\n\t\t\t\t{ ! inherit && (\n\t\t\t\t\t<OrderControl\n\t\t\t\t\t\t{ ...{ order, orderBy } }\n\t\t\t\t\t\tonChange={ setQuery }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t\t{ ! inherit && showSticky && (\n\t\t\t\t\t<StickyControl\n\t\t\t\t\t\tvalue={ sticky }\n\t\t\t\t\t\tonChange={ ( value ) => setQuery( { sticky: value } ) }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t</PanelBody>\n\t\t\t{ ! inherit && (\n\t\t\t\t<PanelBody title={ __( 'Filters' ) }>\n\t\t\t\t\t<TaxonomyControls onChange={ setQuery } query={ query } />\n\t\t\t\t\t<AuthorControl value={ authorIds } onChange={ setQuery } />\n\t\t\t\t\t<TextControl\n\t\t\t\t\t\tlabel={ __( 'Keyword' ) }\n\t\t\t\t\t\tvalue={ querySearch }\n\t\t\t\t\t\tonChange={ setQuerySearch }\n\t\t\t\t\t/>\n\t\t\t\t\t{ isPostTypeHierarchical && (\n\t\t\t\t\t\t<ParentControl\n\t\t\t\t\t\t\tparents={ parents }\n\t\t\t\t\t\t\tpostType={ postType }\n\t\t\t\t\t\t\tonChange={ setQuery }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t</PanelBody>\n\t\t\t) }\n\t\t</InspectorControls>\n\t);\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["@wordpress/block-library/src/query/edit/inspector-controls/index.js"],"names":["debounce","PanelBody","TextControl","SelectControl","RangeControl","ToggleControl","Notice","__experimentalToolsPanel","ToolsPanel","__experimentalToolsPanelItem","ToolsPanelItem","__","InspectorControls","useEffect","useState","useCallback","useSelect","store","coreStore","OrderControl","AuthorControl","ParentControl","TaxonomyControls","useTaxonomiesInfo","StickyControl","usePostTypes","useIsPostTypeHierarchical","postType","select","type","getPostType","viewable","hierarchical","QueryInspectorControls","attributes","query","displayLayout","setQuery","setDisplayLayout","order","orderBy","author","authorIds","sticky","inherit","taxQuery","parents","showSticky","setShowSticky","postTypesTaxonomiesMap","postTypesSelectOptions","taxonomiesInfo","isPostTypeHierarchical","onPostTypeChange","newValue","updateQuery","supportedTaxonomies","updatedTaxQuery","Object","entries","reduce","accumulator","taxonomySlug","terms","includes","keys","length","undefined","querySearch","setQuerySearch","search","onChangeDebounced","cancel","value","columns","Math","max","values","some"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,QAAT,QAAyB,QAAzB;AAEA;AACA;AACA;;AACA,SACCC,SADD,EAECC,WAFD,EAGCC,aAHD,EAICC,YAJD,EAKCC,aALD,EAMCC,MAND,EAOCC,wBAAwB,IAAIC,UAP7B,EAQCC,4BAA4B,IAAIC,cAR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D,EAAE,CAAE,SAAF,CAFX;AAGC,IAAA,UAAU,EAAG,MAAM0B,QAAQ,CAAE;AAAES,MAAAA,OAAO,EAAE;AAAX,KAAF;AAH5B,KAKC,cAAC,aAAD;AACC,IAAA,OAAO,EAAGA,OADX;AAEC,IAAA,QAAQ,EAAGnB,QAFZ;AAGC,IAAA,QAAQ,EAAGU;AAHZ,IALD,CArDF,CADD,CAhEF,CADD;AAwIA","sourcesContent":["/**\n * External dependencies\n */\nimport { debounce } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tPanelBody,\n\tTextControl,\n\tSelectControl,\n\tRangeControl,\n\tToggleControl,\n\tNotice,\n\t__experimentalToolsPanel as ToolsPanel,\n\t__experimentalToolsPanelItem as ToolsPanelItem,\n} from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { InspectorControls } from '@wordpress/block-editor';\nimport { useEffect, useState, useCallback } from '@wordpress/element';\nimport { useSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport OrderControl from './order-control';\nimport AuthorControl from './author-control';\nimport ParentControl from './parent-control';\nimport { TaxonomyControls, useTaxonomiesInfo } from './taxonomy-controls';\nimport StickyControl from './sticky-control';\nimport { usePostTypes } from '../../utils';\n\nfunction useIsPostTypeHierarchical( postType ) {\n\treturn useSelect(\n\t\t( select ) => {\n\t\t\tconst type = select( coreStore ).getPostType( postType );\n\t\t\treturn type?.viewable && type?.hierarchical;\n\t\t},\n\t\t[ postType ]\n\t);\n}\n\nexport default function QueryInspectorControls( {\n\tattributes: { query, displayLayout },\n\tsetQuery,\n\tsetDisplayLayout,\n} ) {\n\tconst {\n\t\torder,\n\t\torderBy,\n\t\tauthor: authorIds,\n\t\tpostType,\n\t\tsticky,\n\t\tinherit,\n\t\ttaxQuery,\n\t\tparents,\n\t} = query;\n\tconst [ showSticky, setShowSticky ] = useState( postType === 'post' );\n\tconst { postTypesTaxonomiesMap, postTypesSelectOptions } = usePostTypes();\n\tconst taxonomiesInfo = useTaxonomiesInfo( postType );\n\tconst isPostTypeHierarchical = useIsPostTypeHierarchical( postType );\n\tuseEffect( () => {\n\t\tsetShowSticky( postType === 'post' );\n\t}, [ 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\tconst updatedTaxQuery = Object.entries( taxQuery || {} ).reduce(\n\t\t\t( accumulator, [ taxonomySlug, terms ] ) => {\n\t\t\t\tif ( supportedTaxonomies.includes( taxonomySlug ) ) {\n\t\t\t\t\taccumulator[ taxonomySlug ] = terms;\n\t\t\t\t}\n\t\t\t\treturn accumulator;\n\t\t\t},\n\t\t\t{}\n\t\t);\n\t\tupdateQuery.taxQuery = !! Object.keys( updatedTaxQuery ).length\n\t\t\t? updatedTaxQuery\n\t\t\t: undefined;\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\tsetQuery( updateQuery );\n\t};\n\tconst [ querySearch, setQuerySearch ] = useState( query.search );\n\tconst onChangeDebounced = useCallback(\n\t\tdebounce( () => {\n\t\t\tif ( query.search !== querySearch ) {\n\t\t\t\tsetQuery( { search: querySearch } );\n\t\t\t}\n\t\t}, 250 ),\n\t\t[ querySearch, query.search ]\n\t);\n\tuseEffect( () => {\n\t\tonChangeDebounced();\n\t\treturn onChangeDebounced.cancel;\n\t}, [ querySearch, onChangeDebounced ] );\n\treturn (\n\t\t<>\n\t\t\t<InspectorControls>\n\t\t\t\t<PanelBody title={ __( 'Settings' ) }>\n\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\tlabel={ __( 'Inherit query from template' ) }\n\t\t\t\t\t\thelp={ __(\n\t\t\t\t\t\t\t'Toggle to use the global query context that is set with the current template, such as an archive or search. Disable to customize the settings independently.'\n\t\t\t\t\t\t) }\n\t\t\t\t\t\tchecked={ !! inherit }\n\t\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\t\tsetQuery( { inherit: !! value } )\n\t\t\t\t\t\t}\n\t\t\t\t\t/>\n\t\t\t\t\t{ ! inherit && (\n\t\t\t\t\t\t<SelectControl\n\t\t\t\t\t\t\toptions={ postTypesSelectOptions }\n\t\t\t\t\t\t\tvalue={ postType }\n\t\t\t\t\t\t\tlabel={ __( 'Post type' ) }\n\t\t\t\t\t\t\tonChange={ onPostTypeChange }\n\t\t\t\t\t\t\thelp={ __(\n\t\t\t\t\t\t\t\t'WordPress contains different types of content and they are divided into collections called \"Post types\". By default there are a few different ones such as blog posts and pages, but plugins could add more.'\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t\t{ displayLayout?.type === 'flex' && (\n\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t<RangeControl\n\t\t\t\t\t\t\t\tlabel={ __( 'Columns' ) }\n\t\t\t\t\t\t\t\tvalue={ displayLayout.columns }\n\t\t\t\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\t\t\t\tsetDisplayLayout( { columns: value } )\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tmin={ 2 }\n\t\t\t\t\t\t\t\tmax={ Math.max( 6, displayLayout.columns ) }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t{ displayLayout.columns > 6 && (\n\t\t\t\t\t\t\t\t<Notice\n\t\t\t\t\t\t\t\t\tstatus=\"warning\"\n\t\t\t\t\t\t\t\t\tisDismissible={ false }\n\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'This column count exceeds the recommended amount and may cause visual breakage.'\n\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t</Notice>\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t</>\n\t\t\t\t\t) }\n\t\t\t\t\t{ ! inherit && (\n\t\t\t\t\t\t<OrderControl\n\t\t\t\t\t\t\t{ ...{ order, orderBy } }\n\t\t\t\t\t\t\tonChange={ setQuery }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t\t{ ! inherit && showSticky && (\n\t\t\t\t\t\t<StickyControl\n\t\t\t\t\t\t\tvalue={ sticky }\n\t\t\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\t\t\tsetQuery( { sticky: value } )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t</PanelBody>\n\t\t\t</InspectorControls>\n\t\t\t{ ! inherit && (\n\t\t\t\t<InspectorControls>\n\t\t\t\t\t<ToolsPanel\n\t\t\t\t\t\tclassName=\"block-library-query-toolspanel__filters\"\n\t\t\t\t\t\tlabel={ __( 'Filters' ) }\n\t\t\t\t\t\tresetAll={ () => {\n\t\t\t\t\t\t\tsetQuery( {\n\t\t\t\t\t\t\t\tauthor: '',\n\t\t\t\t\t\t\t\tparents: [],\n\t\t\t\t\t\t\t\tsearch: '',\n\t\t\t\t\t\t\t\ttaxQuery: null,\n\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\tsetQuerySearch( '' );\n\t\t\t\t\t\t} }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ !! taxonomiesInfo?.length && (\n\t\t\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\t\t\tlabel={ __( 'Taxonomies' ) }\n\t\t\t\t\t\t\t\thasValue={ () =>\n\t\t\t\t\t\t\t\t\tObject.values( taxQuery || {} ).some(\n\t\t\t\t\t\t\t\t\t\t( terms ) => !! terms.length\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\tonDeselect={ () =>\n\t\t\t\t\t\t\t\t\tsetQuery( { taxQuery: null } )\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<TaxonomyControls\n\t\t\t\t\t\t\t\t\tonChange={ setQuery }\n\t\t\t\t\t\t\t\t\tquery={ query }\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<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\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={ () => setQuerySearch( '' ) }\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={ setQuerySearch }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</ToolsPanelItem>\n\t\t\t\t\t\t{ isPostTypeHierarchical && (\n\t\t\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\t\t\thasValue={ () => !! parents?.length }\n\t\t\t\t\t\t\t\tlabel={ __( 'Parents' ) }\n\t\t\t\t\t\t\t\tonDeselect={ () => setQuery( { parents: [] } ) }\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t<ParentControl\n\t\t\t\t\t\t\t\t\tparents={ parents }\n\t\t\t\t\t\t\t\t\tpostType={ postType }\n\t\t\t\t\t\t\t\t\tonChange={ setQuery }\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</ToolsPanel>\n\t\t\t\t</InspectorControls>\n\t\t\t) }\n\t\t</>\n\t);\n}\n"]}
|
|
@@ -38,25 +38,22 @@ const getTermIdByTermValue = (termsMappedByName, termValue) => {
|
|
|
38
38
|
}
|
|
39
39
|
};
|
|
40
40
|
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
onChange,
|
|
44
|
-
query
|
|
45
|
-
} = _ref;
|
|
46
|
-
const taxonomies = useTaxonomies(query.postType);
|
|
41
|
+
export const useTaxonomiesInfo = postType => {
|
|
42
|
+
const taxonomies = useTaxonomies(postType);
|
|
47
43
|
const taxonomiesInfo = useSelect(select => {
|
|
48
44
|
const {
|
|
49
45
|
getEntityRecords
|
|
50
46
|
} = select(coreStore);
|
|
51
47
|
const termsQuery = {
|
|
48
|
+
context: 'view',
|
|
52
49
|
per_page: MAX_FETCHED_TERMS
|
|
53
50
|
};
|
|
54
51
|
|
|
55
|
-
const _taxonomiesInfo = taxonomies === null || taxonomies === void 0 ? void 0 : taxonomies.map(
|
|
52
|
+
const _taxonomiesInfo = taxonomies === null || taxonomies === void 0 ? void 0 : taxonomies.map(_ref => {
|
|
56
53
|
let {
|
|
57
54
|
slug,
|
|
58
55
|
name
|
|
59
|
-
} =
|
|
56
|
+
} = _ref;
|
|
60
57
|
|
|
61
58
|
const _terms = getEntityRecords('taxonomy', slug, termsQuery);
|
|
62
59
|
|
|
@@ -69,6 +66,14 @@ function TaxonomyControls(_ref) {
|
|
|
69
66
|
|
|
70
67
|
return _taxonomiesInfo;
|
|
71
68
|
}, [taxonomies]);
|
|
69
|
+
return taxonomiesInfo;
|
|
70
|
+
};
|
|
71
|
+
export function TaxonomyControls(_ref2) {
|
|
72
|
+
let {
|
|
73
|
+
onChange,
|
|
74
|
+
query
|
|
75
|
+
} = _ref2;
|
|
76
|
+
const taxonomiesInfo = useTaxonomiesInfo(query.postType);
|
|
72
77
|
|
|
73
78
|
const onTermsChange = taxonomySlug => newTermValues => {
|
|
74
79
|
const taxonomyInfo = taxonomiesInfo.find(_ref3 => {
|
|
@@ -131,15 +136,15 @@ function TaxonomyControls(_ref) {
|
|
|
131
136
|
return null;
|
|
132
137
|
}
|
|
133
138
|
|
|
134
|
-
return createElement(
|
|
139
|
+
return createElement("div", {
|
|
135
140
|
key: slug,
|
|
141
|
+
className: "block-library-query-inspector__taxonomy-control"
|
|
142
|
+
}, createElement(FormTokenField, {
|
|
136
143
|
label: name,
|
|
137
144
|
value: getExistingTaxQueryValue(slug),
|
|
138
145
|
suggestions: terms.names,
|
|
139
146
|
onChange: onTermsChange(slug)
|
|
140
|
-
});
|
|
147
|
+
}));
|
|
141
148
|
}));
|
|
142
149
|
}
|
|
143
|
-
|
|
144
|
-
export default TaxonomyControls;
|
|
145
150
|
//# sourceMappingURL=taxonomy-controls.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-library/src/query/edit/inspector-controls/taxonomy-controls.js"],"names":["FormTokenField","useSelect","store","coreStore","getEntitiesInfo","useTaxonomies","MAX_FETCHED_TERMS","getTermIdByTermValue","termsMappedByName","termValue","termId","id","termValueLower","toLocaleLowerCase","term","
|
|
1
|
+
{"version":3,"sources":["@wordpress/block-library/src/query/edit/inspector-controls/taxonomy-controls.js"],"names":["FormTokenField","useSelect","store","coreStore","getEntitiesInfo","useTaxonomies","MAX_FETCHED_TERMS","getTermIdByTermValue","termsMappedByName","termValue","termId","id","termValueLower","toLocaleLowerCase","term","useTaxonomiesInfo","postType","taxonomies","taxonomiesInfo","select","getEntityRecords","termsQuery","context","per_page","_taxonomiesInfo","map","slug","name","_terms","terms","TaxonomyControls","onChange","query","onTermsChange","taxonomySlug","newTermValues","taxonomyInfo","find","termIds","Array","from","reduce","accumulator","mapByName","add","Set","newTaxQuery","taxQuery","getExistingTaxQueryValue","mapById","push","value","length","names"],"mappings":";;AAAA;AAC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AAEtB,IAAF,CAFjC;AAGC,MAAA,WAAW,EAAGG,KAAK,CAACwB,KAHrB;AAIC,MAAA,QAAQ,EAAGpB,aAAa,CAAEP,IAAF;AAJzB,MAJD,CADD;AAaA,GAjBD,CAFF,CADD;AAuBA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { FormTokenField } from '@wordpress/components';\nimport { useSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport { getEntitiesInfo, useTaxonomies } from '../../utils';\nimport { MAX_FETCHED_TERMS } from '../../constants';\n\n// Helper function to get the term id based on user input in terms `FormTokenField`.\nconst getTermIdByTermValue = ( termsMappedByName, termValue ) => {\n\t// First we check for exact match by `term.id` or case sensitive `term.name` match.\n\tconst termId = termValue?.id || termsMappedByName[ termValue ]?.id;\n\tif ( termId ) return termId;\n\t/**\n\t * Here we make an extra check for entered terms in a non case sensitive way,\n\t * to match user expectations, due to `FormTokenField` behaviour that shows\n\t * suggestions which are case insensitive.\n\t *\n\t * Although WP tries to discourage users to add terms with the same name (case insensitive),\n\t * it's still possible if you manually change the name, as long as the terms have different slugs.\n\t * In this edge case we always apply the first match from the terms list.\n\t */\n\tconst termValueLower = termValue.toLocaleLowerCase();\n\tfor ( const term in termsMappedByName ) {\n\t\tif ( term.toLocaleLowerCase() === termValueLower ) {\n\t\t\treturn termsMappedByName[ term ].id;\n\t\t}\n\t}\n};\n\nexport const useTaxonomiesInfo = ( postType ) => {\n\tconst taxonomies = useTaxonomies( postType );\n\tconst taxonomiesInfo = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getEntityRecords } = select( coreStore );\n\t\t\tconst termsQuery = { context: 'view', per_page: MAX_FETCHED_TERMS };\n\t\t\tconst _taxonomiesInfo = taxonomies?.map( ( { slug, name } ) => {\n\t\t\t\tconst _terms = getEntityRecords( 'taxonomy', slug, termsQuery );\n\t\t\t\treturn {\n\t\t\t\t\tslug,\n\t\t\t\t\tname,\n\t\t\t\t\tterms: getEntitiesInfo( _terms ),\n\t\t\t\t};\n\t\t\t} );\n\t\t\treturn _taxonomiesInfo;\n\t\t},\n\t\t[ taxonomies ]\n\t);\n\treturn taxonomiesInfo;\n};\n\nexport function TaxonomyControls( { onChange, query } ) {\n\tconst taxonomiesInfo = useTaxonomiesInfo( query.postType );\n\tconst onTermsChange = ( taxonomySlug ) => ( newTermValues ) => {\n\t\tconst taxonomyInfo = taxonomiesInfo.find(\n\t\t\t( { slug } ) => slug === taxonomySlug\n\t\t);\n\t\tif ( ! taxonomyInfo ) return;\n\t\tconst termIds = Array.from(\n\t\t\tnewTermValues.reduce( ( accumulator, termValue ) => {\n\t\t\t\tconst termId = getTermIdByTermValue(\n\t\t\t\t\ttaxonomyInfo.terms.mapByName,\n\t\t\t\t\ttermValue\n\t\t\t\t);\n\t\t\t\tif ( termId ) accumulator.add( termId );\n\t\t\t\treturn accumulator;\n\t\t\t}, new Set() )\n\t\t);\n\t\tconst newTaxQuery = {\n\t\t\t...query.taxQuery,\n\t\t\t[ taxonomySlug ]: termIds,\n\t\t};\n\t\tonChange( { taxQuery: newTaxQuery } );\n\t};\n\t// Returns only the existing term ids in proper format to be\n\t// used in `FormTokenField`. This prevents the component from\n\t// crashing in the editor, when non existing term ids were provided.\n\tconst getExistingTaxQueryValue = ( taxonomySlug ) => {\n\t\tconst taxonomyInfo = taxonomiesInfo.find(\n\t\t\t( { slug } ) => slug === taxonomySlug\n\t\t);\n\t\tif ( ! taxonomyInfo ) return [];\n\t\treturn ( query.taxQuery?.[ taxonomySlug ] || [] ).reduce(\n\t\t\t( accumulator, termId ) => {\n\t\t\t\tconst term = taxonomyInfo.terms.mapById[ termId ];\n\t\t\t\tif ( term ) {\n\t\t\t\t\taccumulator.push( {\n\t\t\t\t\t\tid: termId,\n\t\t\t\t\t\tvalue: term.name,\n\t\t\t\t\t} );\n\t\t\t\t}\n\t\t\t\treturn accumulator;\n\t\t\t},\n\t\t\t[]\n\t\t);\n\t};\n\treturn (\n\t\t<>\n\t\t\t{ !! taxonomiesInfo?.length &&\n\t\t\t\ttaxonomiesInfo.map( ( { slug, name, terms } ) => {\n\t\t\t\t\tif ( ! terms?.names?.length ) {\n\t\t\t\t\t\treturn null;\n\t\t\t\t\t}\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<div\n\t\t\t\t\t\t\tkey={ slug }\n\t\t\t\t\t\t\tclassName=\"block-library-query-inspector__taxonomy-control\"\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<FormTokenField\n\t\t\t\t\t\t\t\tlabel={ name }\n\t\t\t\t\t\t\t\tvalue={ getExistingTaxQueryValue( slug ) }\n\t\t\t\t\t\t\t\tsuggestions={ terms.names }\n\t\t\t\t\t\t\t\tonChange={ onTermsChange( slug ) }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t);\n\t\t\t\t} ) }\n\t\t</>\n\t);\n}\n"]}
|
|
@@ -11,6 +11,7 @@ function QueryPlaceholder(_ref) {
|
|
|
11
11
|
let {
|
|
12
12
|
clientId,
|
|
13
13
|
name,
|
|
14
|
+
attributes,
|
|
14
15
|
setAttributes,
|
|
15
16
|
icon,
|
|
16
17
|
label
|
|
@@ -42,7 +43,11 @@ function QueryPlaceholder(_ref) {
|
|
|
42
43
|
let nextVariation = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : defaultVariation;
|
|
43
44
|
|
|
44
45
|
if (nextVariation.attributes) {
|
|
45
|
-
setAttributes(nextVariation.attributes
|
|
46
|
+
setAttributes({ ...nextVariation.attributes,
|
|
47
|
+
query: { ...nextVariation.attributes.query,
|
|
48
|
+
postType: attributes.query.postType || nextVariation.attributes.query.postType
|
|
49
|
+
}
|
|
50
|
+
});
|
|
46
51
|
}
|
|
47
52
|
|
|
48
53
|
if (nextVariation.innerBlocks) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-library/src/query/edit/query-placeholder.js"],"names":["useSelect","useDispatch","useBlockProps","__experimentalBlockVariationPicker","store","blockEditorStore","createBlocksFromInnerBlocksTemplate","blocksStore","QueryPlaceholder","clientId","name","setAttributes","icon","label","defaultVariation","scopeVariations","select","getBlockVariations","getBlockType","getDefaultBlockVariation","blockType","replaceInnerBlocks","blockProps","nextVariation","
|
|
1
|
+
{"version":3,"sources":["@wordpress/block-library/src/query/edit/query-placeholder.js"],"names":["useSelect","useDispatch","useBlockProps","__experimentalBlockVariationPicker","store","blockEditorStore","createBlocksFromInnerBlocksTemplate","blocksStore","QueryPlaceholder","clientId","name","attributes","setAttributes","icon","label","defaultVariation","scopeVariations","select","getBlockVariations","getBlockType","getDefaultBlockVariation","blockType","replaceInnerBlocks","blockProps","nextVariation","query","postType","innerBlocks"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,SAAT,EAAoBC,WAApB,QAAuC,iBAAvC;AACA,SACCC,aADD,EAECC,kCAFD,EAGCC,KAAK,IAAIC,gBAHV,QAIO,yBAJP;AAKA,SACCC,mCADD,EAECF,KAAK,IAAIG,WAFV,QAGO,mBAHP;;AAKA,SAASC,gBAAT,OAOI;AAAA,MAPuB;AAC1BC,IAAAA,QAD0B;AAE1BC,IAAAA,IAF0B;AAG1BC,IAAAA,UAH0B;AAI1BC,IAAAA,aAJ0B;AAK1BC,IAAAA,IAL0B;AAM1BC,IAAAA;AAN0B,GAOvB;AACH,QAAM;AAAEC,IAAAA,gBAAF;AAAoBC,IAAAA;AAApB,MAAwChB,SAAS,CACpDiB,MAAF,IAAc;AACb,UAAM;AACLC,MAAAA,kBADK;AAELC,MAAAA,YAFK;AAGLC,MAAAA;AAHK,QAIFH,MAAM,CAAEV,WAAF,CAJV;AAMA,WAAO;AACNc,MAAAA,SAAS,EAAEF,YAAY,CAAET,IAAF,CADjB;AAENK,MAAAA,gBAAgB,EAAEK,wBAAwB,CAAEV,IAAF,EAAQ,OAAR,CAFpC;AAGNM,MAAAA,eAAe,EAAEE,kBAAkB,CAAER,IAAF,EAAQ,OAAR;AAH7B,KAAP;AAKA,GAbqD,EActD,CAAEA,IAAF,CAdsD,CAAvD;AAgBA,QAAM;AAAEY,IAAAA;AAAF,MAAyBrB,WAAW,CAAEI,gBAAF,CAA1C;AACA,QAAMkB,UAAU,GAAGrB,aAAa,EAAhC;AACA,SACC,qBAAUqB,UAAV,EACC,cAAC,kCAAD;AACC,IAAA,IAAI,EAAGV,IADR;AAEC,IAAA,KAAK,EAAGC,KAFT;AAGC,IAAA,UAAU,EAAGE,eAHd;AAIC,IAAA,QAAQ,EAAG,YAAwC;AAAA,UAAtCQ,aAAsC,uEAAtBT,gBAAsB;;AAClD,UAAKS,aAAa,CAACb,UAAnB,EAAgC;AAC/BC,QAAAA,aAAa,CAAE,EACd,GAAGY,aAAa,CAACb,UADH;AAEdc,UAAAA,KAAK,EAAE,EACN,GAAGD,aAAa,CAACb,UAAd,CAAyBc,KADtB;AAENC,YAAAA,QAAQ,EACPf,UAAU,CAACc,KAAX,CAAiBC,QAAjB,IACAF,aAAa,CAACb,UAAd,CAAyBc,KAAzB,CAA+BC;AAJ1B;AAFO,SAAF,CAAb;AASA;;AACD,UAAKF,aAAa,CAACG,WAAnB,EAAiC;AAChCL,QAAAA,kBAAkB,CACjBb,QADiB,EAEjBH,mCAAmC,CAClCkB,aAAa,CAACG,WADoB,CAFlB,EAKjB,KALiB,CAAlB;AAOA;AACD;AAzBF,IADD,CADD;AA+BA;;AAED,eAAenB,gBAAf","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport {\n\tuseBlockProps,\n\t__experimentalBlockVariationPicker,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\nimport {\n\tcreateBlocksFromInnerBlocksTemplate,\n\tstore as blocksStore,\n} from '@wordpress/blocks';\n\nfunction QueryPlaceholder( {\n\tclientId,\n\tname,\n\tattributes,\n\tsetAttributes,\n\ticon,\n\tlabel,\n} ) {\n\tconst { defaultVariation, scopeVariations } = useSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\tgetBlockVariations,\n\t\t\t\tgetBlockType,\n\t\t\t\tgetDefaultBlockVariation,\n\t\t\t} = select( blocksStore );\n\n\t\t\treturn {\n\t\t\t\tblockType: getBlockType( name ),\n\t\t\t\tdefaultVariation: getDefaultBlockVariation( name, 'block' ),\n\t\t\t\tscopeVariations: getBlockVariations( name, 'block' ),\n\t\t\t};\n\t\t},\n\t\t[ name ]\n\t);\n\tconst { replaceInnerBlocks } = useDispatch( blockEditorStore );\n\tconst blockProps = useBlockProps();\n\treturn (\n\t\t<div { ...blockProps }>\n\t\t\t<__experimentalBlockVariationPicker\n\t\t\t\ticon={ icon }\n\t\t\t\tlabel={ label }\n\t\t\t\tvariations={ scopeVariations }\n\t\t\t\tonSelect={ ( nextVariation = defaultVariation ) => {\n\t\t\t\t\tif ( nextVariation.attributes ) {\n\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t...nextVariation.attributes,\n\t\t\t\t\t\t\tquery: {\n\t\t\t\t\t\t\t\t...nextVariation.attributes.query,\n\t\t\t\t\t\t\t\tpostType:\n\t\t\t\t\t\t\t\t\tattributes.query.postType ||\n\t\t\t\t\t\t\t\t\tnextVariation.attributes.query.postType,\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\tif ( nextVariation.innerBlocks ) {\n\t\t\t\t\t\treplaceInnerBlocks(\n\t\t\t\t\t\t\tclientId,\n\t\t\t\t\t\t\tcreateBlocksFromInnerBlocksTemplate(\n\t\t\t\t\t\t\t\tnextVariation.innerBlocks\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\tfalse\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</div>\n\t);\n}\n\nexport default QueryPlaceholder;\n"]}
|
|
@@ -10,6 +10,7 @@ import { useSelect } from '@wordpress/data';
|
|
|
10
10
|
import { useMemo } from '@wordpress/element';
|
|
11
11
|
import { store as coreStore } from '@wordpress/core-data';
|
|
12
12
|
import { decodeEntities } from '@wordpress/html-entities';
|
|
13
|
+
import { cloneBlock } from '@wordpress/blocks';
|
|
13
14
|
/**
|
|
14
15
|
* @typedef IHasNameAndId
|
|
15
16
|
* @property {string|number} id The entity's id.
|
|
@@ -143,15 +144,30 @@ export const useTaxonomies = postType => {
|
|
|
143
144
|
return taxonomies;
|
|
144
145
|
};
|
|
145
146
|
/**
|
|
146
|
-
*
|
|
147
|
-
*
|
|
147
|
+
* Clones a pattern's blocks and then recurses over that list of blocks,
|
|
148
|
+
* transforming them to retain some `query` attribute properties.
|
|
149
|
+
* For now we retain the `postType` and `inherit` properties as they are
|
|
150
|
+
* fundamental for the expected functionality of the block and don't affect
|
|
151
|
+
* its design and presentation.
|
|
148
152
|
*
|
|
149
|
-
*
|
|
150
|
-
*
|
|
153
|
+
* Returns the cloned/transformed blocks and array of existing Query Loop
|
|
154
|
+
* client ids for further manipulation, in order to avoid multiple recursions.
|
|
155
|
+
*
|
|
156
|
+
* @param {WPBlock[]} blocks The list of blocks to look through and transform(mutate).
|
|
157
|
+
* @param {Record<string,*>} queryBlockAttributes The existing Query Loop's attributes.
|
|
158
|
+
* @return {{ newBlocks: WPBlock[], queryClientIds: string[] }} An object with the cloned/transformed blocks and all the Query Loop clients from these blocks.
|
|
151
159
|
*/
|
|
152
160
|
|
|
153
|
-
export const
|
|
154
|
-
const
|
|
161
|
+
export const getTransformedBlocksFromPattern = (blocks, queryBlockAttributes) => {
|
|
162
|
+
const {
|
|
163
|
+
query: {
|
|
164
|
+
postType,
|
|
165
|
+
inherit
|
|
166
|
+
}
|
|
167
|
+
} = queryBlockAttributes;
|
|
168
|
+
const clonedBlocks = blocks.map(block => cloneBlock(block));
|
|
169
|
+
const queryClientIds = [];
|
|
170
|
+
const blocksQueue = [...clonedBlocks];
|
|
155
171
|
|
|
156
172
|
while (blocksQueue.length > 0) {
|
|
157
173
|
var _block$innerBlocks;
|
|
@@ -159,12 +175,21 @@ export const getFirstQueryClientIdFromBlocks = blocks => {
|
|
|
159
175
|
const block = blocksQueue.shift();
|
|
160
176
|
|
|
161
177
|
if (block.name === 'core/query') {
|
|
162
|
-
|
|
178
|
+
block.attributes.query = { ...block.attributes.query,
|
|
179
|
+
postType,
|
|
180
|
+
inherit
|
|
181
|
+
};
|
|
182
|
+
queryClientIds.push(block.clientId);
|
|
163
183
|
}
|
|
164
184
|
|
|
165
185
|
(_block$innerBlocks = block.innerBlocks) === null || _block$innerBlocks === void 0 ? void 0 : _block$innerBlocks.forEach(innerBlock => {
|
|
166
186
|
blocksQueue.push(innerBlock);
|
|
167
187
|
});
|
|
168
188
|
}
|
|
189
|
+
|
|
190
|
+
return {
|
|
191
|
+
newBlocks: clonedBlocks,
|
|
192
|
+
queryClientIds
|
|
193
|
+
};
|
|
169
194
|
};
|
|
170
195
|
//# sourceMappingURL=utils.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-library/src/query/utils.js"],"names":["get","useSelect","useMemo","store","coreStore","decodeEntities","getEntitiesInfo","entities","mapping","reduce","accumulator","entity","mapById","mapByName","names","id","name","push","mapToIHasNameAndId","path","map","usePostTypes","postTypes","select","getPostTypes","excludedPostTypes","filteredPostTypes","per_page","filter","viewable","slug","includes","postTypesTaxonomiesMap","length","type","taxonomies","postTypesSelectOptions","labels","label","singular_name","value","useTaxonomies","postType","getTaxonomies","filteredTaxonomies","context","getFirstQueryClientIdFromBlocks","blocks","blocksQueue","block","shift","clientId","innerBlocks","forEach","innerBlock"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,GAAT,QAAoB,QAApB;AAEA;AACA;AACA;;AACA,SAASC,SAAT,QAA0B,iBAA1B;AACA,SAASC,OAAT,QAAwB,oBAAxB;AACA,SAASC,KAAK,IAAIC,SAAlB,QAAmC,sBAAnC;AACA,SAASC,cAAT,QAA+B,0BAA/B;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA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C5C,QAAMP,UAAU,GAAGlC,SAAS,CACzBsB,MAAF,IAAc;AACb,UAAM;AAAEoB,MAAAA;AAAF,QAAoBpB,MAAM,CAAEnB,SAAF,CAAhC;AACA,UAAMwC,kBAAkB,GAAGD,aAAa,CAAE;AACzCT,MAAAA,IAAI,EAAEQ,QADmC;AAEzCf,MAAAA,QAAQ,EAAE,CAAC,CAF8B;AAGzCkB,MAAAA,OAAO,EAAE;AAHgC,KAAF,CAAxC;AAKA,WAAOD,kBAAP;AACA,GAT0B,EAU3B,CAAEF,QAAF,CAV2B,CAA5B;AAYA,SAAOP,UAAP;AACA,CAdM;AAgBP;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,MAAMW,+BAA+B,GAAKC,MAAF,IAAc;AAC5D,QAAMC,WAAW,GAAG,CAAE,GAAGD,MAAL,CAApB;;AACA,SAAQC,WAAW,CAACf,MAAZ,GAAqB,CAA7B,EAAiC;AAAA;;AAChC,UAAMgB,KAAK,GAAGD,WAAW,CAACE,KAAZ,EAAd;;AACA,QAAKD,KAAK,CAACjC,IAAN,KAAe,YAApB,EAAmC;AAClC,aAAOiC,KAAK,CAACE,QAAb;AACA;;AACD,0BAAAF,KAAK,CAACG,WAAN,0EAAmBC,OAAnB,CAA8BC,UAAF,IAAkB;AAC7CN,MAAAA,WAAW,CAAC/B,IAAZ,CAAkBqC,UAAlB;AACA,KAFD;AAGA;AACD,CAXM","sourcesContent":["/**\n * External dependencies\n */\nimport { get } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport { useMemo } from '@wordpress/element';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { decodeEntities } from '@wordpress/html-entities';\n\n/**\n * @typedef IHasNameAndId\n * @property {string|number} id The entity's id.\n * @property {string} name The entity's name.\n */\n\n/**\n * The object used in Query block that contains info and helper mappings\n * from an array of IHasNameAndId objects.\n *\n * @typedef {Object} QueryEntitiesInfo\n * @property {IHasNameAndId[]} entities The array of entities.\n * @property {Object<string, IHasNameAndId>} mapById Object mapping with the id as key and the entity as value.\n * @property {Object<string, IHasNameAndId>} mapByName Object mapping with the name as key and the entity as value.\n * @property {string[]} names Array with the entities' names.\n */\n\n/**\n * Returns a helper object with mapping from Objects that implement\n * the `IHasNameAndId` interface. The returned object is used for\n * integration with `FormTokenField` component.\n *\n * @param {IHasNameAndId[]} entities The entities to extract of helper object.\n * @return {QueryEntitiesInfo} The object with the entities information.\n */\nexport const getEntitiesInfo = ( entities ) => {\n\tconst mapping = entities?.reduce(\n\t\t( accumulator, entity ) => {\n\t\t\tconst { mapById, mapByName, names } = accumulator;\n\t\t\tmapById[ entity.id ] = entity;\n\t\t\tmapByName[ entity.name ] = entity;\n\t\t\tnames.push( entity.name );\n\t\t\treturn accumulator;\n\t\t},\n\t\t{ mapById: {}, mapByName: {}, names: [] }\n\t);\n\treturn {\n\t\tentities,\n\t\t...mapping,\n\t};\n};\n\n/**\n * Helper util to map records to add a `name` prop from a\n * provided path, in order to handle all entities in the same\n * fashion(implementing`IHasNameAndId` interface).\n *\n * @param {Object[]} entities The array of entities.\n * @param {string} path The path to map a `name` property from the entity.\n * @return {IHasNameAndId[]} An array of enitities that now implement the `IHasNameAndId` interface.\n */\nexport const mapToIHasNameAndId = ( entities, path ) => {\n\treturn ( entities || [] ).map( ( entity ) => ( {\n\t\t...entity,\n\t\tname: decodeEntities( get( entity, path ) ),\n\t} ) );\n};\n\n/**\n * Returns a helper object that contains:\n * 1. An `options` object from the available post types, to be passed to a `SelectControl`.\n * 2. A helper map with available taxonomies per post type.\n *\n * @return {Object} The helper object related to post types.\n */\nexport const usePostTypes = () => {\n\tconst postTypes = useSelect( ( select ) => {\n\t\tconst { getPostTypes } = select( coreStore );\n\t\tconst excludedPostTypes = [ 'attachment' ];\n\t\tconst filteredPostTypes = getPostTypes( { per_page: -1 } )?.filter(\n\t\t\t( { viewable, slug } ) =>\n\t\t\t\tviewable && ! excludedPostTypes.includes( slug )\n\t\t);\n\t\treturn filteredPostTypes;\n\t}, [] );\n\tconst postTypesTaxonomiesMap = useMemo( () => {\n\t\tif ( ! postTypes?.length ) return;\n\t\treturn postTypes.reduce( ( accumulator, type ) => {\n\t\t\taccumulator[ type.slug ] = type.taxonomies;\n\t\t\treturn accumulator;\n\t\t}, {} );\n\t}, [ postTypes ] );\n\tconst postTypesSelectOptions = useMemo(\n\t\t() =>\n\t\t\t( postTypes || [] ).map( ( { labels, slug } ) => ( {\n\t\t\t\tlabel: labels.singular_name,\n\t\t\t\tvalue: slug,\n\t\t\t} ) ),\n\t\t[ postTypes ]\n\t);\n\treturn { postTypesTaxonomiesMap, postTypesSelectOptions };\n};\n\n/**\n * Hook that returns the taxonomies associated with a specific post type.\n *\n * @param {string} postType The post type from which to retrieve the associated taxonomies.\n * @return {Object[]} An array of the associated taxonomies.\n */\nexport const useTaxonomies = ( postType ) => {\n\tconst taxonomies = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getTaxonomies } = select( coreStore );\n\t\t\tconst filteredTaxonomies = getTaxonomies( {\n\t\t\t\ttype: postType,\n\t\t\t\tper_page: -1,\n\t\t\t\tcontext: 'view',\n\t\t\t} );\n\t\t\treturn filteredTaxonomies;\n\t\t},\n\t\t[ postType ]\n\t);\n\treturn taxonomies;\n};\n\n/**\n * Recurses over a list of blocks and returns the first found\n * Query Loop block's clientId.\n *\n * @param {WPBlock[]} blocks The list of blocks to look through.\n * @return {string=} The first found Query Loop's clientId.\n */\nexport const getFirstQueryClientIdFromBlocks = ( blocks ) => {\n\tconst blocksQueue = [ ...blocks ];\n\twhile ( blocksQueue.length > 0 ) {\n\t\tconst block = blocksQueue.shift();\n\t\tif ( block.name === 'core/query' ) {\n\t\t\treturn block.clientId;\n\t\t}\n\t\tblock.innerBlocks?.forEach( ( innerBlock ) => {\n\t\t\tblocksQueue.push( innerBlock );\n\t\t} );\n\t}\n};\n"]}
|
|
1
|
+
{"version":3,"sources":["@wordpress/block-library/src/query/utils.js"],"names":["get","useSelect","useMemo","store","coreStore","decodeEntities","cloneBlock","getEntitiesInfo","entities","mapping","reduce","accumulator","entity","mapById","mapByName","names","id","name","push","mapToIHasNameAndId","path","map","usePostTypes","postTypes","select","getPostTypes","excludedPostTypes","filteredPostTypes","per_page","filter","viewable","slug","includes","postTypesTaxonomiesMap","length","type","taxonomies","postTypesSelectOptions","labels","label","singular_name","value","useTaxonomies","postType","getTaxonomies","filteredTaxonomies","context","getTransformedBlocksFromPattern","blocks","queryBlockAttributes","query","inherit","clonedBlocks","block","queryClientIds","blocksQueue","shift","attributes","clientId","innerBlocks","forEach","innerBlock","newBlocks"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,GAAT,QAAoB,QAApB;AAEA;AACA;AACA;;AACA,SAASC,SAAT,QAA0B,iBAA1B;AACA,SAASC,OAAT,QAAwB,oBAAxB;AACA,SAASC,KAAK,IAAIC,SAAlB,QAAmC,sBAAnC;AACA,SAASC,cAAT,QAA+B,0BAA/B;AACA,SAASC,UAAT,QAA2B,mBAA3B;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,MAAMC,eAAe,GAAKC,QAAF,IAAgB;AAC9C,QAAMC,OAAO,GAAGD,QAAH,aAAGA,QAAH,uBAAGA,QAAQ,CAAEE,MAAV,CACf,CAAEC,WAAF,EAAeC,MAAf,KAA2B;AAC1B,UAAM;AAAEC,MAAAA,OAAF;AAAWC,MAAAA,SAAX;AAAsBC,MAAAA;AAAtB,QAAgCJ,WAAtC;AACAE,IAAAA,OAAO,CAAED,MAAM,CAACI,EAAT,CAAP,GAAuBJ,MAAvB;AACAE,IAAAA,SAAS,CAAEF,MAAM,CAACK,IAAT,CAAT,GAA2BL,MAA3B;AACAG,IAAAA,KAAK,CAACG,IAAN,CAAYN,MAAM,CAACK,IAAnB;AACA,WAAON,WAAP;AACA,GAPc,EAQf;AAAEE,IAAAA,OA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LC,IAAAA,KAAK,EAAE;AAAEP,MAAAA,QAAF;AAAYQ,MAAAA;AAAZ;AADF,MAEFF,oBAFJ;AAGA,QAAMG,YAAY,GAAGJ,MAAM,CAAC3B,GAAP,CAAcgC,KAAF,IAAa/C,UAAU,CAAE+C,KAAF,CAAnC,CAArB;AACA,QAAMC,cAAc,GAAG,EAAvB;AACA,QAAMC,WAAW,GAAG,CAAE,GAAGH,YAAL,CAApB;;AACA,SAAQG,WAAW,CAACrB,MAAZ,GAAqB,CAA7B,EAAiC;AAAA;;AAChC,UAAMmB,KAAK,GAAGE,WAAW,CAACC,KAAZ,EAAd;;AACA,QAAKH,KAAK,CAACpC,IAAN,KAAe,YAApB,EAAmC;AAClCoC,MAAAA,KAAK,CAACI,UAAN,CAAiBP,KAAjB,GAAyB,EACxB,GAAGG,KAAK,CAACI,UAAN,CAAiBP,KADI;AAExBP,QAAAA,QAFwB;AAGxBQ,QAAAA;AAHwB,OAAzB;AAKAG,MAAAA,cAAc,CAACpC,IAAf,CAAqBmC,KAAK,CAACK,QAA3B;AACA;;AACD,0BAAAL,KAAK,CAACM,WAAN,0EAAmBC,OAAnB,CAA8BC,UAAF,IAAkB;AAC7CN,MAAAA,WAAW,CAACrC,IAAZ,CAAkB2C,UAAlB;AACA,KAFD;AAGA;;AACD,SAAO;AAAEC,IAAAA,SAAS,EAAEV,YAAb;AAA2BE,IAAAA;AAA3B,GAAP;AACA,CAzBM","sourcesContent":["/**\n * External dependencies\n */\nimport { get } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport { useMemo } from '@wordpress/element';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { decodeEntities } from '@wordpress/html-entities';\nimport { cloneBlock } from '@wordpress/blocks';\n\n/**\n * @typedef IHasNameAndId\n * @property {string|number} id The entity's id.\n * @property {string} name The entity's name.\n */\n\n/**\n * The object used in Query block that contains info and helper mappings\n * from an array of IHasNameAndId objects.\n *\n * @typedef {Object} QueryEntitiesInfo\n * @property {IHasNameAndId[]} entities The array of entities.\n * @property {Object<string, IHasNameAndId>} mapById Object mapping with the id as key and the entity as value.\n * @property {Object<string, IHasNameAndId>} mapByName Object mapping with the name as key and the entity as value.\n * @property {string[]} names Array with the entities' names.\n */\n\n/**\n * Returns a helper object with mapping from Objects that implement\n * the `IHasNameAndId` interface. The returned object is used for\n * integration with `FormTokenField` component.\n *\n * @param {IHasNameAndId[]} entities The entities to extract of helper object.\n * @return {QueryEntitiesInfo} The object with the entities information.\n */\nexport const getEntitiesInfo = ( entities ) => {\n\tconst mapping = entities?.reduce(\n\t\t( accumulator, entity ) => {\n\t\t\tconst { mapById, mapByName, names } = accumulator;\n\t\t\tmapById[ entity.id ] = entity;\n\t\t\tmapByName[ entity.name ] = entity;\n\t\t\tnames.push( entity.name );\n\t\t\treturn accumulator;\n\t\t},\n\t\t{ mapById: {}, mapByName: {}, names: [] }\n\t);\n\treturn {\n\t\tentities,\n\t\t...mapping,\n\t};\n};\n\n/**\n * Helper util to map records to add a `name` prop from a\n * provided path, in order to handle all entities in the same\n * fashion(implementing`IHasNameAndId` interface).\n *\n * @param {Object[]} entities The array of entities.\n * @param {string} path The path to map a `name` property from the entity.\n * @return {IHasNameAndId[]} An array of enitities that now implement the `IHasNameAndId` interface.\n */\nexport const mapToIHasNameAndId = ( entities, path ) => {\n\treturn ( entities || [] ).map( ( entity ) => ( {\n\t\t...entity,\n\t\tname: decodeEntities( get( entity, path ) ),\n\t} ) );\n};\n\n/**\n * Returns a helper object that contains:\n * 1. An `options` object from the available post types, to be passed to a `SelectControl`.\n * 2. A helper map with available taxonomies per post type.\n *\n * @return {Object} The helper object related to post types.\n */\nexport const usePostTypes = () => {\n\tconst postTypes = useSelect( ( select ) => {\n\t\tconst { getPostTypes } = select( coreStore );\n\t\tconst excludedPostTypes = [ 'attachment' ];\n\t\tconst filteredPostTypes = getPostTypes( { per_page: -1 } )?.filter(\n\t\t\t( { viewable, slug } ) =>\n\t\t\t\tviewable && ! excludedPostTypes.includes( slug )\n\t\t);\n\t\treturn filteredPostTypes;\n\t}, [] );\n\tconst postTypesTaxonomiesMap = useMemo( () => {\n\t\tif ( ! postTypes?.length ) return;\n\t\treturn postTypes.reduce( ( accumulator, type ) => {\n\t\t\taccumulator[ type.slug ] = type.taxonomies;\n\t\t\treturn accumulator;\n\t\t}, {} );\n\t}, [ postTypes ] );\n\tconst postTypesSelectOptions = useMemo(\n\t\t() =>\n\t\t\t( postTypes || [] ).map( ( { labels, slug } ) => ( {\n\t\t\t\tlabel: labels.singular_name,\n\t\t\t\tvalue: slug,\n\t\t\t} ) ),\n\t\t[ postTypes ]\n\t);\n\treturn { postTypesTaxonomiesMap, postTypesSelectOptions };\n};\n\n/**\n * Hook that returns the taxonomies associated with a specific post type.\n *\n * @param {string} postType The post type from which to retrieve the associated taxonomies.\n * @return {Object[]} An array of the associated taxonomies.\n */\nexport const useTaxonomies = ( postType ) => {\n\tconst taxonomies = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getTaxonomies } = select( coreStore );\n\t\t\tconst filteredTaxonomies = getTaxonomies( {\n\t\t\t\ttype: postType,\n\t\t\t\tper_page: -1,\n\t\t\t\tcontext: 'view',\n\t\t\t} );\n\t\t\treturn filteredTaxonomies;\n\t\t},\n\t\t[ postType ]\n\t);\n\treturn taxonomies;\n};\n\n/**\n * Clones a pattern's blocks and then recurses over that list of blocks,\n * transforming them to retain some `query` attribute properties.\n * For now we retain the `postType` and `inherit` properties as they are\n * fundamental for the expected functionality of the block and don't affect\n * its design and presentation.\n *\n * Returns the cloned/transformed blocks and array of existing Query Loop\n * client ids for further manipulation, in order to avoid multiple recursions.\n *\n * @param {WPBlock[]} blocks The list of blocks to look through and transform(mutate).\n * @param {Record<string,*>} queryBlockAttributes The existing Query Loop's attributes.\n * @return {{ newBlocks: WPBlock[], queryClientIds: string[] }} An object with the cloned/transformed blocks and all the Query Loop clients from these blocks.\n */\nexport const getTransformedBlocksFromPattern = (\n\tblocks,\n\tqueryBlockAttributes\n) => {\n\tconst {\n\t\tquery: { postType, inherit },\n\t} = queryBlockAttributes;\n\tconst clonedBlocks = blocks.map( ( block ) => cloneBlock( block ) );\n\tconst queryClientIds = [];\n\tconst blocksQueue = [ ...clonedBlocks ];\n\twhile ( blocksQueue.length > 0 ) {\n\t\tconst block = blocksQueue.shift();\n\t\tif ( block.name === 'core/query' ) {\n\t\t\tblock.attributes.query = {\n\t\t\t\t...block.attributes.query,\n\t\t\t\tpostType,\n\t\t\t\tinherit,\n\t\t\t};\n\t\t\tqueryClientIds.push( block.clientId );\n\t\t}\n\t\tblock.innerBlocks?.forEach( ( innerBlock ) => {\n\t\t\tblocksQueue.push( innerBlock );\n\t\t} );\n\t}\n\treturn { newBlocks: clonedBlocks, queryClientIds };\n};\n"]}
|
|
@@ -6,7 +6,7 @@ import { createElement } from "@wordpress/element";
|
|
|
6
6
|
import { useBlockProps, useInnerBlocksProps } from '@wordpress/block-editor';
|
|
7
7
|
import { __ } from '@wordpress/i18n';
|
|
8
8
|
const TEMPLATE = [['core/paragraph', {
|
|
9
|
-
placeholder: __('Add text or blocks that will display when
|
|
9
|
+
placeholder: __('Add text or blocks that will display when a query returns no results.')
|
|
10
10
|
}]];
|
|
11
11
|
export default function QueryNoResultsEdit() {
|
|
12
12
|
const blockProps = useBlockProps();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-library/src/query-no-results/edit.js"],"names":["useBlockProps","useInnerBlocksProps","__","TEMPLATE","placeholder","QueryNoResultsEdit","blockProps","innerBlocksProps","template"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,aAAT,EAAwBC,mBAAxB,QAAmD,yBAAnD;AACA,SAASC,EAAT,QAAmB,iBAAnB;AAEA,MAAMC,QAAQ,GAAG,CAChB,CACC,gBADD,EAEC;AACCC,EAAAA,WAAW,EAAEF,EAAE,CACd,
|
|
1
|
+
{"version":3,"sources":["@wordpress/block-library/src/query-no-results/edit.js"],"names":["useBlockProps","useInnerBlocksProps","__","TEMPLATE","placeholder","QueryNoResultsEdit","blockProps","innerBlocksProps","template"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,aAAT,EAAwBC,mBAAxB,QAAmD,yBAAnD;AACA,SAASC,EAAT,QAAmB,iBAAnB;AAEA,MAAMC,QAAQ,GAAG,CAChB,CACC,gBADD,EAEC;AACCC,EAAAA,WAAW,EAAEF,EAAE,CACd,uEADc;AADhB,CAFD,CADgB,CAAjB;AAWA,eAAe,SAASG,kBAAT,GAA8B;AAC5C,QAAMC,UAAU,GAAGN,aAAa,EAAhC;AACA,QAAMO,gBAAgB,GAAGN,mBAAmB,CAAEK,UAAF,EAAc;AACzDE,IAAAA,QAAQ,EAAEL;AAD+C,GAAd,CAA5C;AAIA,SAAO,qBAAUI,gBAAV,CAAP;AACA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useBlockProps, useInnerBlocksProps } from '@wordpress/block-editor';\nimport { __ } from '@wordpress/i18n';\n\nconst TEMPLATE = [\n\t[\n\t\t'core/paragraph',\n\t\t{\n\t\t\tplaceholder: __(\n\t\t\t\t'Add text or blocks that will display when a query returns no results.'\n\t\t\t),\n\t\t},\n\t],\n];\n\nexport default function QueryNoResultsEdit() {\n\tconst blockProps = useBlockProps();\n\tconst innerBlocksProps = useInnerBlocksProps( blockProps, {\n\t\ttemplate: TEMPLATE,\n\t} );\n\n\treturn <div { ...innerBlocksProps } />;\n}\n"]}
|
|
@@ -8,31 +8,32 @@ import classnames from 'classnames';
|
|
|
8
8
|
* WordPress dependencies
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
|
-
import { AlignmentControl, BlockControls, useBlockProps, Warning } from '@wordpress/block-editor';
|
|
11
|
+
import { AlignmentControl, BlockControls, InspectorControls, useBlockProps, Warning } from '@wordpress/block-editor';
|
|
12
|
+
import { ToggleControl, PanelBody } from '@wordpress/components';
|
|
12
13
|
import { __ } from '@wordpress/i18n';
|
|
13
14
|
/**
|
|
14
15
|
* Internal dependencies
|
|
15
16
|
*/
|
|
16
17
|
|
|
17
18
|
import HeadingLevelDropdown from '../heading/heading-level-dropdown';
|
|
18
|
-
const SUPPORTED_TYPES = ['archive'];
|
|
19
|
+
const SUPPORTED_TYPES = ['archive', 'search'];
|
|
19
20
|
export default function QueryTitleEdit(_ref) {
|
|
20
21
|
let {
|
|
21
22
|
attributes: {
|
|
22
23
|
type,
|
|
23
24
|
level,
|
|
24
|
-
textAlign
|
|
25
|
+
textAlign,
|
|
26
|
+
showPrefix,
|
|
27
|
+
showSearchTerm
|
|
25
28
|
},
|
|
26
29
|
setAttributes
|
|
27
30
|
} = _ref;
|
|
28
31
|
const TagName = `h${level}`;
|
|
29
32
|
const blockProps = useBlockProps({
|
|
30
|
-
className: classnames({
|
|
31
|
-
[`has-text-align-${textAlign}`]: textAlign
|
|
32
|
-
'wp-block-query-title__placeholder': type === 'archive'
|
|
33
|
+
className: classnames('wp-block-query-title__placeholder', {
|
|
34
|
+
[`has-text-align-${textAlign}`]: textAlign
|
|
33
35
|
})
|
|
34
|
-
});
|
|
35
|
-
// block variations like `Search Title`.
|
|
36
|
+
});
|
|
36
37
|
|
|
37
38
|
if (!SUPPORTED_TYPES.includes(type)) {
|
|
38
39
|
return createElement("div", blockProps, createElement(Warning, null, __('Provided type is not supported.')));
|
|
@@ -41,7 +42,27 @@ export default function QueryTitleEdit(_ref) {
|
|
|
41
42
|
let titleElement;
|
|
42
43
|
|
|
43
44
|
if (type === 'archive') {
|
|
44
|
-
titleElement = createElement(
|
|
45
|
+
titleElement = createElement(Fragment, null, createElement(InspectorControls, null, createElement(PanelBody, {
|
|
46
|
+
title: __('Settings')
|
|
47
|
+
}, createElement(ToggleControl, {
|
|
48
|
+
label: __('Show archive type in title'),
|
|
49
|
+
onChange: () => setAttributes({
|
|
50
|
+
showPrefix: !showPrefix
|
|
51
|
+
}),
|
|
52
|
+
checked: showPrefix
|
|
53
|
+
}))), createElement(TagName, blockProps, showPrefix ? __('Archive type: Name') : __('Archive title')));
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
if (type === 'search') {
|
|
57
|
+
titleElement = createElement(Fragment, null, createElement(InspectorControls, null, createElement(PanelBody, {
|
|
58
|
+
title: __('Settings')
|
|
59
|
+
}, createElement(ToggleControl, {
|
|
60
|
+
label: __('Show search term in title'),
|
|
61
|
+
onChange: () => setAttributes({
|
|
62
|
+
showSearchTerm: !showSearchTerm
|
|
63
|
+
}),
|
|
64
|
+
checked: showSearchTerm
|
|
65
|
+
}))), createElement(TagName, blockProps, showSearchTerm ? __('Search results for: "search term"') : __('Search results')));
|
|
45
66
|
}
|
|
46
67
|
|
|
47
68
|
return createElement(Fragment, null, createElement(BlockControls, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-library/src/query-title/edit.js"],"names":["classnames","AlignmentControl","BlockControls","useBlockProps","Warning","__","HeadingLevelDropdown","SUPPORTED_TYPES","QueryTitleEdit","attributes","type","level","textAlign","setAttributes","TagName","blockProps","className","includes","titleElement","newLevel","nextAlign"],"mappings":";;AAAA;AACA;AACA;AACA,OAAOA,UAAP,MAAuB,YAAvB;AAEA;AACA;AACA;;AACA,SACCC,gBADD,EAECC,aAFD,EAGCC,
|
|
1
|
+
{"version":3,"sources":["@wordpress/block-library/src/query-title/edit.js"],"names":["classnames","AlignmentControl","BlockControls","InspectorControls","useBlockProps","Warning","ToggleControl","PanelBody","__","HeadingLevelDropdown","SUPPORTED_TYPES","QueryTitleEdit","attributes","type","level","textAlign","showPrefix","showSearchTerm","setAttributes","TagName","blockProps","className","includes","titleElement","newLevel","nextAlign"],"mappings":";;AAAA;AACA;AACA;AACA,OAAOA,UAAP,MAAuB,YAAvB;AAEA;AACA;AACA;;AACA,SACCC,gBADD,EAECC,aAFD,EAGCC,iBAHD,EAICC,aAJD,EAKCC,OALD,QAMO,yBANP;AAOA,SAASC,aAAT,EAAwBC,SAAxB,QAAyC,uBAAzC;AACA,SAASC,EAAT,QAAmB,iBAAnB;AAEA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BU,IAAAA,YAAY,GACX,8BACC,cAAC,iBAAD,QACC,cAAC,SAAD;AAAW,MAAA,KAAK,EAAGf,EAAE,CAAE,UAAF;AAArB,OACC,cAAC,aAAD;AACC,MAAA,KAAK,EAAGA,EAAE,CAAE,2BAAF,CADX;AAEC,MAAA,QAAQ,EAAG,MACVU,aAAa,CAAE;AACdD,QAAAA,cAAc,EAAE,CAAEA;AADJ,OAAF,CAHf;AAOC,MAAA,OAAO,EAAGA;AAPX,MADD,CADD,CADD,EAeC,cAAC,OAAD,EAAcG,UAAd,EACGH,cAAc,GACbT,EAAE,CAAE,mCAAF,CADW,GAEbA,EAAE,CAAE,gBAAF,CAHN,CAfD,CADD;AAuBA;;AAED,SACC,8BACC,cAAC,aAAD;AAAe,IAAA,KAAK,EAAC;AAArB,KACC,cAAC,oBAAD;AACC,IAAA,aAAa,EAAGM,KADjB;AAEC,IAAA,QAAQ,EAAKU,QAAF,IACVN,aAAa,CAAE;AAAEJ,MAAAA,KAAK,EAAEU;AAAT,KAAF;AAHf,IADD,EAOC,cAAC,gBAAD;AACC,IAAA,KAAK,EAAGT,SADT;AAEC,IAAA,QAAQ,EAAKU,SAAF,IAAiB;AAC3BP,MAAAA,aAAa,CAAE;AAAEH,QAAAA,SAAS,EAAEU;AAAb,OAAF,CAAb;AACA;AAJF,IAPD,CADD,EAeGF,YAfH,CADD;AAmBA","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tAlignmentControl,\n\tBlockControls,\n\tInspectorControls,\n\tuseBlockProps,\n\tWarning,\n} from '@wordpress/block-editor';\nimport { ToggleControl, PanelBody } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport HeadingLevelDropdown from '../heading/heading-level-dropdown';\n\nconst SUPPORTED_TYPES = [ 'archive', 'search' ];\n\nexport default function QueryTitleEdit( {\n\tattributes: { type, level, textAlign, showPrefix, showSearchTerm },\n\tsetAttributes,\n} ) {\n\tconst TagName = `h${ level }`;\n\tconst blockProps = useBlockProps( {\n\t\tclassName: classnames( 'wp-block-query-title__placeholder', {\n\t\t\t[ `has-text-align-${ textAlign }` ]: textAlign,\n\t\t} ),\n\t} );\n\n\tif ( ! SUPPORTED_TYPES.includes( type ) ) {\n\t\treturn (\n\t\t\t<div { ...blockProps }>\n\t\t\t\t<Warning>{ __( 'Provided type is not supported.' ) }</Warning>\n\t\t\t</div>\n\t\t);\n\t}\n\n\tlet titleElement;\n\tif ( type === 'archive' ) {\n\t\ttitleElement = (\n\t\t\t<>\n\t\t\t\t<InspectorControls>\n\t\t\t\t\t<PanelBody title={ __( 'Settings' ) }>\n\t\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\t\tlabel={ __( 'Show archive type in title' ) }\n\t\t\t\t\t\t\tonChange={ () =>\n\t\t\t\t\t\t\t\tsetAttributes( { showPrefix: ! showPrefix } )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tchecked={ showPrefix }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</PanelBody>\n\t\t\t\t</InspectorControls>\n\t\t\t\t<TagName { ...blockProps }>\n\t\t\t\t\t{ showPrefix\n\t\t\t\t\t\t? __( 'Archive type: Name' )\n\t\t\t\t\t\t: __( 'Archive title' ) }\n\t\t\t\t</TagName>\n\t\t\t</>\n\t\t);\n\t}\n\n\tif ( type === 'search' ) {\n\t\ttitleElement = (\n\t\t\t<>\n\t\t\t\t<InspectorControls>\n\t\t\t\t\t<PanelBody title={ __( 'Settings' ) }>\n\t\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\t\tlabel={ __( 'Show search term in title' ) }\n\t\t\t\t\t\t\tonChange={ () =>\n\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\tshowSearchTerm: ! showSearchTerm,\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={ showSearchTerm }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</PanelBody>\n\t\t\t\t</InspectorControls>\n\n\t\t\t\t<TagName { ...blockProps }>\n\t\t\t\t\t{ showSearchTerm\n\t\t\t\t\t\t? __( 'Search results for: \"search term\"' )\n\t\t\t\t\t\t: __( 'Search results' ) }\n\t\t\t\t</TagName>\n\t\t\t</>\n\t\t);\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t<BlockControls group=\"block\">\n\t\t\t\t<HeadingLevelDropdown\n\t\t\t\t\tselectedLevel={ level }\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\t<AlignmentControl\n\t\t\t\t\tvalue={ textAlign }\n\t\t\t\t\tonChange={ ( nextAlign ) => {\n\t\t\t\t\t\tsetAttributes( { textAlign: nextAlign } );\n\t\t\t\t\t} }\n\t\t\t\t/>\n\t\t\t</BlockControls>\n\t\t\t{ titleElement }\n\t\t</>\n\t);\n}\n"]}
|
|
@@ -19,6 +19,14 @@ const metadata = {
|
|
|
19
19
|
level: {
|
|
20
20
|
type: "number",
|
|
21
21
|
"default": 1
|
|
22
|
+
},
|
|
23
|
+
showPrefix: {
|
|
24
|
+
type: "boolean",
|
|
25
|
+
"default": true
|
|
26
|
+
},
|
|
27
|
+
showSearchTerm: {
|
|
28
|
+
type: "boolean",
|
|
29
|
+
"default": true
|
|
22
30
|
}
|
|
23
31
|
},
|
|
24
32
|
supports: {
|
|
@@ -32,7 +40,8 @@ const metadata = {
|
|
|
32
40
|
}
|
|
33
41
|
},
|
|
34
42
|
spacing: {
|
|
35
|
-
margin: true
|
|
43
|
+
margin: true,
|
|
44
|
+
padding: true
|
|
36
45
|
},
|
|
37
46
|
typography: {
|
|
38
47
|
fontSize: true,
|
|
@@ -49,7 +58,7 @@ const metadata = {
|
|
|
49
58
|
}
|
|
50
59
|
}
|
|
51
60
|
},
|
|
52
|
-
|
|
61
|
+
style: "wp-block-query-title"
|
|
53
62
|
};
|
|
54
63
|
import edit from './edit';
|
|
55
64
|
import variations from './variations';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-library/src/query-title/index.js"],"names":["edit","variations","deprecated","title","icon","name","metadata","settings"],"mappings":"AAAA;AACA;AACA
|
|
1
|
+
{"version":3,"sources":["@wordpress/block-library/src/query-title/index.js"],"names":["edit","variations","deprecated","title","icon","name","metadata","settings"],"mappings":"AAAA;AACA;AACA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,OAAOA,IAAP,MAAiB,QAAjB;AACA,OAAOC,UAAP,MAAuB,cAAvB;AACA,OAAOC,UAAP,MAAuB,cAAvB;AAEA;AACA;AACA;;AACA,SAASC,KAAK,IAAIC,IAAlB,QAA8B,kBAA9B;AAEA,MAAM;AAAEC,EAAAA;AAAF,IAAWC,QAAjB;AACA,SAASA,QAAT,EAAmBD,IAAnB;AAEA,OAAO,MAAME,QAAQ,GAAG;AACvBH,EAAAA,IADuB;AAEvBJ,EAAAA,IAFuB;AAGvBC,EAAAA,UAHuB;AAIvBC,EAAAA;AAJuB,CAAjB","sourcesContent":["/**\n * Internal dependencies\n */\nimport metadata from './block.json';\nimport edit from './edit';\nimport variations from './variations';\nimport deprecated from './deprecated';\n\n/**\n * WordPress dependencies\n */\nimport { title as icon } from '@wordpress/icons';\n\nconst { name } = metadata;\nexport { metadata, name };\n\nexport const settings = {\n\ticon,\n\tedit,\n\tvariations,\n\tdeprecated,\n};\n"]}
|
|
@@ -13,6 +13,16 @@ const variations = [{
|
|
|
13
13
|
type: 'archive'
|
|
14
14
|
},
|
|
15
15
|
scope: ['inserter']
|
|
16
|
+
}, {
|
|
17
|
+
isDefault: false,
|
|
18
|
+
name: 'search-title',
|
|
19
|
+
title: __('Search Results Title'),
|
|
20
|
+
description: __('Display the search results title based on the queried object.'),
|
|
21
|
+
icon: title,
|
|
22
|
+
attributes: {
|
|
23
|
+
type: 'search'
|
|
24
|
+
},
|
|
25
|
+
scope: ['inserter']
|
|
16
26
|
}];
|
|
17
27
|
/**
|
|
18
28
|
* Add `isActive` function to all `query-title` variations, if not defined.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-library/src/query-title/variations.js"],"names":["__","title","variations","isDefault","name","description","icon","attributes","type","scope","forEach","variation","isActive","blockAttributes","variationAttributes"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,EAAT,QAAmB,iBAAnB;AACA,SAASC,KAAT,QAAsB,kBAAtB;AACA,MAAMC,UAAU,GAAG,CAClB;AACCC,EAAAA,SAAS,EAAE,IADZ;AAECC,EAAAA,IAAI,EAAE,eAFP;AAGCH,EAAAA,KAAK,EAAED,EAAE,CAAE,eAAF,CAHV;AAICK,EAAAA,WAAW,EAAEL,EAAE,CACd,wDADc,CAJhB;AAOCM,EAAAA,IAAI,EAAEL,KAPP;AAQCM,EAAAA,UAAU,EAAE;AACXC,IAAAA,IAAI,EAAE;AADK,GARb;AAWCC,EAAAA,KAAK,EAAE,CAAE,UAAF;AAXR,CADkB,CAAnB;
|
|
1
|
+
{"version":3,"sources":["@wordpress/block-library/src/query-title/variations.js"],"names":["__","title","variations","isDefault","name","description","icon","attributes","type","scope","forEach","variation","isActive","blockAttributes","variationAttributes"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,EAAT,QAAmB,iBAAnB;AACA,SAASC,KAAT,QAAsB,kBAAtB;AACA,MAAMC,UAAU,GAAG,CAClB;AACCC,EAAAA,SAAS,EAAE,IADZ;AAECC,EAAAA,IAAI,EAAE,eAFP;AAGCH,EAAAA,KAAK,EAAED,EAAE,CAAE,eAAF,CAHV;AAICK,EAAAA,WAAW,EAAEL,EAAE,CACd,wDADc,CAJhB;AAOCM,EAAAA,IAAI,EAAEL,KAPP;AAQCM,EAAAA,UAAU,EAAE;AACXC,IAAAA,IAAI,EAAE;AADK,GARb;AAWCC,EAAAA,KAAK,EAAE,CAAE,UAAF;AAXR,CADkB,EAclB;AACCN,EAAAA,SAAS,EAAE,KADZ;AAECC,EAAAA,IAAI,EAAE,cAFP;AAGCH,EAAAA,KAAK,EAAED,EAAE,CAAE,sBAAF,CAHV;AAICK,EAAAA,WAAW,EAAEL,EAAE,CACd,+DADc,CAJhB;AAOCM,EAAAA,IAAI,EAAEL,KAPP;AAQCM,EAAAA,UAAU,EAAE;AACXC,IAAAA,IAAI,EAAE;AADK,GARb;AAWCC,EAAAA,KAAK,EAAE,CAAE,UAAF;AAXR,CAdkB,CAAnB;AA6BA;AACA;AACA;AACA;AACA;;AACAP,UAAU,CAACQ,OAAX,CAAsBC,SAAF,IAAiB;AACpC,MAAKA,SAAS,CAACC,QAAf,EAA0B;;AAC1BD,EAAAA,SAAS,CAACC,QAAV,GAAqB,CAAEC,eAAF,EAAmBC,mBAAnB,KACpBD,eAAe,CAACL,IAAhB,KAAyBM,mBAAmB,CAACN,IAD9C;AAEA,CAJD;AAMA,eAAeN,UAAf","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { title } from '@wordpress/icons';\nconst variations = [\n\t{\n\t\tisDefault: true,\n\t\tname: 'archive-title',\n\t\ttitle: __( 'Archive Title' ),\n\t\tdescription: __(\n\t\t\t'Display the archive title based on the queried object.'\n\t\t),\n\t\ticon: title,\n\t\tattributes: {\n\t\t\ttype: 'archive',\n\t\t},\n\t\tscope: [ 'inserter' ],\n\t},\n\t{\n\t\tisDefault: false,\n\t\tname: 'search-title',\n\t\ttitle: __( 'Search Results Title' ),\n\t\tdescription: __(\n\t\t\t'Display the search results title based on the queried object.'\n\t\t),\n\t\ticon: title,\n\t\tattributes: {\n\t\t\ttype: 'search',\n\t\t},\n\t\tscope: [ 'inserter' ],\n\t},\n];\n\n/**\n * Add `isActive` function to all `query-title` variations, if not defined.\n * `isActive` function is used to find a variation match from a created\n * Block by providing its attributes.\n */\nvariations.forEach( ( variation ) => {\n\tif ( variation.isActive ) return;\n\tvariation.isActive = ( blockAttributes, variationAttributes ) =>\n\t\tblockAttributes.type === variationAttributes.type;\n} );\n\nexport default variations;\n"]}
|
|
@@ -4,7 +4,6 @@ import { createElement } from "@wordpress/element";
|
|
|
4
4
|
* External dependencies
|
|
5
5
|
*/
|
|
6
6
|
import classnames from 'classnames';
|
|
7
|
-
import { omit } from 'lodash';
|
|
8
7
|
/**
|
|
9
8
|
* WordPress dependencies
|
|
10
9
|
*/
|
|
@@ -13,9 +12,10 @@ import { createBlock, parseWithAttributeSchema } from '@wordpress/blocks';
|
|
|
13
12
|
import { RichText, useBlockProps } from '@wordpress/block-editor';
|
|
14
13
|
export const migrateToQuoteV2 = attributes => {
|
|
15
14
|
const {
|
|
16
|
-
value
|
|
15
|
+
value,
|
|
16
|
+
...restAttributes
|
|
17
17
|
} = attributes;
|
|
18
|
-
return [{ ...
|
|
18
|
+
return [{ ...restAttributes
|
|
19
19
|
}, value ? parseWithAttributeSchema(value, {
|
|
20
20
|
type: 'array',
|
|
21
21
|
source: 'query',
|
|
@@ -168,7 +168,11 @@ const v1 = {
|
|
|
168
168
|
|
|
169
169
|
migrate(attributes) {
|
|
170
170
|
if (attributes.style === 2) {
|
|
171
|
-
|
|
171
|
+
const {
|
|
172
|
+
style,
|
|
173
|
+
...restAttributes
|
|
174
|
+
} = attributes;
|
|
175
|
+
return migrateToQuoteV2({ ...restAttributes,
|
|
172
176
|
className: attributes.className ? attributes.className + ' is-style-large' : 'is-style-large'
|
|
173
177
|
});
|
|
174
178
|
}
|
|
@@ -227,7 +231,11 @@ const v0 = {
|
|
|
227
231
|
|
|
228
232
|
migrate(attributes) {
|
|
229
233
|
if (!isNaN(parseInt(attributes.style))) {
|
|
230
|
-
|
|
234
|
+
const {
|
|
235
|
+
style,
|
|
236
|
+
...restAttributes
|
|
237
|
+
} = attributes;
|
|
238
|
+
return migrateToQuoteV2({ ...restAttributes
|
|
231
239
|
});
|
|
232
240
|
}
|
|
233
241
|
|