@wordpress/block-library 7.1.1 → 7.3.1
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 +13 -0
- package/README.md +1 -1
- package/build/archives/edit.js +21 -1
- package/build/archives/edit.js.map +1 -1
- package/build/archives/index.js +5 -1
- package/build/archives/index.js.map +1 -1
- package/build/audio/edit.native.js +0 -5
- package/build/audio/edit.native.js.map +1 -1
- package/build/avatar/edit.js +211 -0
- package/build/avatar/edit.js.map +1 -0
- package/build/avatar/hooks.js +111 -0
- package/build/avatar/hooks.js.map +1 -0
- package/build/avatar/index.js +83 -0
- package/build/avatar/index.js.map +1 -0
- package/build/avatar/user-control.js +63 -0
- package/build/avatar/user-control.js.map +1 -0
- package/build/block/edit.js +2 -1
- package/build/block/edit.js.map +1 -1
- package/build/column/index.js +3 -1
- package/build/column/index.js.map +1 -1
- package/build/comment-author-avatar/index.js +4 -3
- package/build/comment-author-avatar/index.js.map +1 -1
- package/build/comment-author-name/index.js +7 -3
- package/build/comment-author-name/index.js.map +1 -1
- package/build/comment-content/index.js +1 -1
- package/build/comment-date/edit.js +10 -25
- package/build/comment-date/edit.js.map +1 -1
- package/build/comment-date/index.js +7 -3
- 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/edit.js +86 -66
- package/build/comment-template/edit.js.map +1 -1
- package/build/comment-template/hooks.js +7 -23
- package/build/comment-template/hooks.js.map +1 -1
- package/build/comment-template/index.js +2 -2
- package/build/comments-pagination-next/index.js +2 -2
- package/build/comments-pagination-numbers/index.js +1 -1
- package/build/comments-pagination-previous/index.js +1 -1
- package/build/comments-query-loop/edit/comments-inspector-controls.js +2 -69
- package/build/comments-query-loop/edit/comments-inspector-controls.js.map +1 -1
- package/build/comments-query-loop/edit.js +22 -1
- package/build/comments-query-loop/edit.js.map +1 -1
- package/build/comments-query-loop/index.js +1 -23
- package/build/comments-query-loop/index.js.map +1 -1
- package/build/cover/edit.js +58 -39
- package/build/cover/edit.js.map +1 -1
- package/build/cover/index.js +5 -0
- package/build/cover/index.js.map +1 -1
- package/build/cover/save.js +3 -2
- package/build/cover/save.js.map +1 -1
- package/build/embed/variations.js +2 -2
- package/build/embed/variations.js.map +1 -1
- package/build/gallery/edit.js +18 -5
- package/build/gallery/edit.js.map +1 -1
- package/build/gallery/gallery.js +1 -1
- package/build/gallery/gallery.js.map +1 -1
- package/build/gallery/gap-styles.js +35 -0
- package/build/gallery/gap-styles.js.map +1 -0
- package/build/gallery/index.js +18 -1
- package/build/gallery/index.js.map +1 -1
- package/build/group/edit.js +3 -1
- package/build/group/edit.js.map +1 -1
- package/build/group/index.js +1 -1
- package/build/group/variations.js +30 -9
- package/build/group/variations.js.map +1 -1
- package/build/heading/edit.js +1 -1
- package/build/heading/edit.js.map +1 -1
- package/build/html/edit.js +3 -2
- package/build/html/edit.js.map +1 -1
- package/build/image/edit.native.js +8 -10
- package/build/image/edit.native.js.map +1 -1
- package/build/image/image.js +3 -1
- package/build/image/image.js.map +1 -1
- package/build/index.js +10 -4
- package/build/index.js.map +1 -1
- package/build/list/deprecated.js +2 -2
- package/build/list/deprecated.js.map +1 -1
- package/build/list/index.js +5 -7
- package/build/list/index.js.map +1 -1
- package/build/list/v2/deprecated.js +117 -0
- package/build/list/v2/deprecated.js.map +1 -0
- package/build/list/v2/edit.js +188 -0
- package/build/list/v2/edit.js.map +1 -0
- package/build/list/v2/index.js +36 -0
- package/build/list/v2/index.js.map +1 -0
- package/build/list/v2/migrate.js +85 -0
- package/build/list/v2/migrate.js.map +1 -0
- package/build/list/v2/save.js +34 -0
- package/build/list/v2/save.js.map +1 -0
- package/build/list/v2/transforms.js +121 -0
- package/build/list/v2/transforms.js.map +1 -0
- package/build/list-item/edit.js +96 -0
- package/build/list-item/edit.js.map +1 -0
- package/build/list-item/hooks/index.js +32 -0
- package/build/list-item/hooks/index.js.map +1 -0
- package/build/list-item/hooks/use-enter.js +93 -0
- package/build/list-item/hooks/use-enter.js.map +1 -0
- package/build/list-item/hooks/use-indent-list-item.js +74 -0
- package/build/list-item/hooks/use-indent-list-item.js.map +1 -0
- package/build/list-item/hooks/use-outdent-list-item.js +77 -0
- package/build/list-item/hooks/use-outdent-list-item.js.map +1 -0
- package/build/list-item/index.js +67 -0
- package/build/list-item/index.js.map +1 -0
- package/build/list-item/save.js +23 -0
- package/build/list-item/save.js.map +1 -0
- package/build/list-item/utils.js +16 -0
- package/build/list-item/utils.js.map +1 -0
- package/build/media-text/edit.js +3 -1
- package/build/media-text/edit.js.map +1 -1
- package/build/media-text/media-container.native.js +1 -16
- package/build/media-text/media-container.native.js.map +1 -1
- package/build/navigation/edit/index.js +36 -17
- package/build/navigation/edit/index.js.map +1 -1
- package/build/navigation/edit/navigation-menu-delete-control.js +1 -1
- package/build/navigation/edit/navigation-menu-delete-control.js.map +1 -1
- package/build/navigation/edit/unsaved-inner-blocks.js +34 -7
- package/build/navigation/edit/unsaved-inner-blocks.js.map +1 -1
- package/build/navigation/index.js +9 -1
- package/build/navigation/index.js.map +1 -1
- package/build/navigation/use-navigation-entities.js +26 -54
- package/build/navigation/use-navigation-entities.js.map +1 -1
- package/build/navigation/use-navigation-menu.js +1 -0
- package/build/navigation/use-navigation-menu.js.map +1 -1
- package/build/navigation-link/edit.js +95 -37
- package/build/navigation-link/edit.js.map +1 -1
- package/build/navigation-link/index.js +1 -1
- package/build/navigation-submenu/edit.js +5 -9
- package/build/navigation-submenu/edit.js.map +1 -1
- package/build/navigation-submenu/index.js +1 -1
- package/build/post-comment/edit.js +2 -2
- package/build/post-comment/edit.js.map +1 -1
- package/build/post-comments/index.js +4 -3
- package/build/post-comments/index.js.map +1 -1
- package/build/post-comments-form/edit.js +3 -2
- package/build/post-comments-form/edit.js.map +1 -1
- package/build/post-date/edit.js +31 -37
- package/build/post-date/edit.js.map +1 -1
- package/build/post-featured-image/edit.js +2 -1
- package/build/post-featured-image/edit.js.map +1 -1
- package/build/post-featured-image/index.js +1 -1
- package/build/post-template/edit.js +7 -2
- package/build/post-template/edit.js.map +1 -1
- package/build/post-terms/edit.js +3 -1
- package/build/post-terms/edit.js.map +1 -1
- package/build/post-terms/variations.js +1 -1
- package/build/post-terms/variations.js.map +1 -1
- package/build/pullquote/edit.js +5 -3
- package/build/pullquote/edit.js.map +1 -1
- package/build/query/edit/index.js +84 -22
- package/build/query/edit/index.js.map +1 -1
- package/build/query/edit/query-placeholder.js +7 -14
- package/build/query/edit/query-placeholder.js.map +1 -1
- package/build/query/edit/query-toolbar.js +6 -1
- package/build/query/edit/query-toolbar.js.map +1 -1
- package/build/query/variations.js +4 -4
- package/build/query/variations.js.map +1 -1
- package/build/query-no-results/edit.js +28 -0
- package/build/query-no-results/edit.js.map +1 -0
- package/build/query-no-results/index.js +54 -0
- package/build/query-no-results/index.js.map +1 -0
- package/build/query-no-results/save.js +18 -0
- package/build/query-no-results/save.js.map +1 -0
- package/build/query-pagination/edit.js +1 -1
- package/build/query-pagination/edit.js.map +1 -1
- package/build/query-pagination-numbers/index.js +19 -1
- package/build/query-pagination-numbers/index.js.map +1 -1
- package/build/quote/index.js +15 -8
- package/build/quote/index.js.map +1 -1
- package/build/quote/v2/deprecated.js +133 -0
- package/build/quote/v2/deprecated.js.map +1 -0
- package/build/quote/v2/edit.js +131 -0
- package/build/quote/v2/edit.js.map +1 -0
- package/build/quote/v2/index.js +49 -0
- package/build/quote/v2/index.js.map +1 -0
- package/build/quote/v2/save.js +43 -0
- package/build/quote/v2/save.js.map +1 -0
- package/build/quote/v2/transforms.js +156 -0
- package/build/quote/v2/transforms.js.map +1 -0
- package/build/read-more/index.js +1 -1
- package/build/rss/edit.js +6 -1
- package/build/rss/edit.js.map +1 -1
- package/build/search/edit.js +2 -3
- package/build/search/edit.js.map +1 -1
- package/build/separator/deprecated.js +83 -0
- package/build/separator/deprecated.js.map +1 -0
- package/build/separator/edit.js +31 -23
- package/build/separator/edit.js.map +1 -1
- package/build/separator/index.js +17 -7
- package/build/separator/index.js.map +1 -1
- package/build/separator/save.js +18 -13
- package/build/separator/save.js.map +1 -1
- package/build/separator/use-deprecated-opacity.js +39 -0
- package/build/separator/use-deprecated-opacity.js.map +1 -0
- package/build/site-logo/edit.js +3 -2
- package/build/site-logo/edit.js.map +1 -1
- package/build/site-logo/index.js +1 -1
- package/build/social-links/edit.js +14 -3
- package/build/social-links/edit.js.map +1 -1
- package/build/social-links/index.js +2 -1
- package/build/social-links/index.js.map +1 -1
- package/build/spacer/controls.js +6 -16
- package/build/spacer/controls.js.map +1 -1
- package/build/spacer/controls.native.js +3 -1
- package/build/spacer/controls.native.js.map +1 -1
- package/build/spacer/edit.js +4 -5
- package/build/spacer/edit.js.map +1 -1
- package/build/table/deprecated.js +1 -1
- package/build/table/deprecated.js.map +1 -1
- package/build/tag-cloud/edit.js +58 -2
- package/build/tag-cloud/edit.js.map +1 -1
- package/build/tag-cloud/index.js +8 -0
- package/build/tag-cloud/index.js.map +1 -1
- package/build/template-part/edit/utils/hooks.js +5 -2
- package/build/template-part/edit/utils/hooks.js.map +1 -1
- package/build-module/archives/edit.js +22 -2
- package/build-module/archives/edit.js.map +1 -1
- package/build-module/archives/index.js +5 -1
- package/build-module/archives/index.js.map +1 -1
- package/build-module/audio/edit.native.js +0 -5
- package/build-module/audio/edit.native.js.map +1 -1
- package/build-module/avatar/edit.js +195 -0
- package/build-module/avatar/edit.js.map +1 -0
- package/build-module/avatar/hooks.js +99 -0
- package/build-module/avatar/hooks.js.map +1 -0
- package/build-module/avatar/index.js +70 -0
- package/build-module/avatar/index.js.map +1 -0
- package/build-module/avatar/user-control.js +52 -0
- package/build-module/avatar/user-control.js.map +1 -0
- package/build-module/block/edit.js +4 -3
- package/build-module/block/edit.js.map +1 -1
- package/build-module/column/index.js +3 -1
- package/build-module/column/index.js.map +1 -1
- package/build-module/comment-author-avatar/index.js +4 -3
- package/build-module/comment-author-avatar/index.js.map +1 -1
- package/build-module/comment-author-name/index.js +7 -3
- package/build-module/comment-author-name/index.js.map +1 -1
- package/build-module/comment-content/index.js +1 -1
- package/build-module/comment-date/edit.js +13 -30
- package/build-module/comment-date/edit.js.map +1 -1
- package/build-module/comment-date/index.js +7 -3
- 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/edit.js +86 -66
- package/build-module/comment-template/edit.js.map +1 -1
- package/build-module/comment-template/hooks.js +7 -23
- package/build-module/comment-template/hooks.js.map +1 -1
- package/build-module/comment-template/index.js +2 -2
- package/build-module/comments-pagination-next/index.js +2 -2
- package/build-module/comments-pagination-numbers/index.js +1 -1
- package/build-module/comments-pagination-previous/index.js +1 -1
- package/build-module/comments-query-loop/edit/comments-inspector-controls.js +4 -70
- package/build-module/comments-query-loop/edit/comments-inspector-controls.js.map +1 -1
- package/build-module/comments-query-loop/edit.js +22 -1
- package/build-module/comments-query-loop/edit.js.map +1 -1
- package/build-module/comments-query-loop/index.js +1 -23
- package/build-module/comments-query-loop/index.js.map +1 -1
- package/build-module/cover/edit.js +58 -41
- package/build-module/cover/edit.js.map +1 -1
- package/build-module/cover/index.js +5 -0
- package/build-module/cover/index.js.map +1 -1
- package/build-module/cover/save.js +3 -2
- package/build-module/cover/save.js.map +1 -1
- package/build-module/embed/variations.js +2 -2
- package/build-module/embed/variations.js.map +1 -1
- package/build-module/gallery/edit.js +17 -5
- package/build-module/gallery/edit.js.map +1 -1
- package/build-module/gallery/gallery.js +1 -1
- package/build-module/gallery/gallery.js.map +1 -1
- package/build-module/gallery/gap-styles.js +28 -0
- package/build-module/gallery/gap-styles.js.map +1 -0
- package/build-module/gallery/index.js +18 -1
- package/build-module/gallery/index.js.map +1 -1
- package/build-module/group/edit.js +3 -1
- package/build-module/group/edit.js.map +1 -1
- package/build-module/group/index.js +1 -1
- package/build-module/group/variations.js +29 -9
- package/build-module/group/variations.js.map +1 -1
- package/build-module/heading/edit.js +1 -1
- package/build-module/heading/edit.js.map +1 -1
- package/build-module/html/edit.js +4 -3
- package/build-module/html/edit.js.map +1 -1
- package/build-module/image/edit.native.js +8 -10
- package/build-module/image/edit.native.js.map +1 -1
- package/build-module/image/image.js +3 -1
- package/build-module/image/image.js.map +1 -1
- package/build-module/index.js +7 -4
- package/build-module/index.js.map +1 -1
- package/build-module/list/deprecated.js +2 -2
- package/build-module/list/deprecated.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/deprecated.js +104 -0
- package/build-module/list/v2/deprecated.js.map +1 -0
- package/build-module/list/v2/edit.js +168 -0
- package/build-module/list/v2/edit.js.map +1 -0
- package/build-module/list/v2/index.js +21 -0
- package/build-module/list/v2/index.js.map +1 -0
- package/build-module/list/v2/migrate.js +77 -0
- package/build-module/list/v2/migrate.js.map +1 -0
- package/build-module/list/v2/save.js +23 -0
- package/build-module/list/v2/save.js.map +1 -0
- package/build-module/list/v2/transforms.js +111 -0
- package/build-module/list/v2/transforms.js.map +1 -0
- package/build-module/list-item/edit.js +83 -0
- package/build-module/list-item/edit.js.map +1 -0
- package/build-module/list-item/hooks/index.js +4 -0
- package/build-module/list-item/hooks/index.js.map +1 -0
- package/build-module/list-item/hooks/use-enter.js +77 -0
- package/build-module/list-item/hooks/use-enter.js.map +1 -0
- package/build-module/list-item/hooks/use-indent-list-item.js +62 -0
- package/build-module/list-item/hooks/use-indent-list-item.js.map +1 -0
- package/build-module/list-item/hooks/use-outdent-list-item.js +66 -0
- package/build-module/list-item/hooks/use-outdent-list-item.js.map +1 -0
- package/build-module/list-item/index.js +53 -0
- package/build-module/list-item/index.js.map +1 -0
- package/build-module/list-item/save.js +15 -0
- package/build-module/list-item/save.js.map +1 -0
- package/build-module/list-item/utils.js +8 -0
- package/build-module/list-item/utils.js.map +1 -0
- package/build-module/media-text/edit.js +3 -1
- package/build-module/media-text/edit.js.map +1 -1
- package/build-module/media-text/media-container.native.js +1 -14
- package/build-module/media-text/media-container.native.js.map +1 -1
- package/build-module/navigation/edit/index.js +37 -17
- package/build-module/navigation/edit/index.js.map +1 -1
- package/build-module/navigation/edit/navigation-menu-delete-control.js +1 -1
- package/build-module/navigation/edit/navigation-menu-delete-control.js.map +1 -1
- package/build-module/navigation/edit/unsaved-inner-blocks.js +35 -8
- package/build-module/navigation/edit/unsaved-inner-blocks.js.map +1 -1
- package/build-module/navigation/index.js +9 -1
- package/build-module/navigation/index.js.map +1 -1
- package/build-module/navigation/use-navigation-entities.js +27 -54
- package/build-module/navigation/use-navigation-entities.js.map +1 -1
- package/build-module/navigation/use-navigation-menu.js +1 -0
- package/build-module/navigation/use-navigation-menu.js.map +1 -1
- package/build-module/navigation-link/edit.js +95 -36
- package/build-module/navigation-link/edit.js.map +1 -1
- package/build-module/navigation-link/index.js +1 -1
- package/build-module/navigation-submenu/edit.js +6 -10
- package/build-module/navigation-submenu/edit.js.map +1 -1
- package/build-module/navigation-submenu/index.js +1 -1
- package/build-module/post-comment/edit.js +2 -2
- package/build-module/post-comment/edit.js.map +1 -1
- package/build-module/post-comments/index.js +4 -3
- package/build-module/post-comments/index.js.map +1 -1
- package/build-module/post-comments-form/edit.js +3 -2
- package/build-module/post-comments-form/edit.js.map +1 -1
- package/build-module/post-date/edit.js +32 -43
- package/build-module/post-date/edit.js.map +1 -1
- package/build-module/post-featured-image/edit.js +2 -1
- package/build-module/post-featured-image/edit.js.map +1 -1
- package/build-module/post-featured-image/index.js +1 -1
- package/build-module/post-template/edit.js +7 -2
- package/build-module/post-template/edit.js.map +1 -1
- package/build-module/post-terms/edit.js +4 -2
- package/build-module/post-terms/edit.js.map +1 -1
- package/build-module/post-terms/variations.js +3 -3
- package/build-module/post-terms/variations.js.map +1 -1
- package/build-module/pullquote/edit.js +6 -3
- package/build-module/pullquote/edit.js.map +1 -1
- package/build-module/query/edit/index.js +87 -26
- package/build-module/query/edit/index.js.map +1 -1
- package/build-module/query/edit/query-placeholder.js +8 -15
- package/build-module/query/edit/query-placeholder.js.map +1 -1
- package/build-module/query/edit/query-toolbar.js +6 -1
- package/build-module/query/edit/query-toolbar.js.map +1 -1
- package/build-module/query/variations.js +4 -4
- package/build-module/query/variations.js.map +1 -1
- package/build-module/query-no-results/edit.js +18 -0
- package/build-module/query-no-results/edit.js.map +1 -0
- package/build-module/query-no-results/index.js +40 -0
- package/build-module/query-no-results/index.js.map +1 -0
- package/build-module/query-no-results/save.js +10 -0
- package/build-module/query-no-results/save.js.map +1 -0
- package/build-module/query-pagination/edit.js +1 -1
- package/build-module/query-pagination/edit.js.map +1 -1
- package/build-module/query-pagination-numbers/index.js +19 -1
- package/build-module/query-pagination-numbers/index.js.map +1 -1
- package/build-module/quote/index.js +13 -1
- package/build-module/quote/index.js.map +1 -1
- package/build-module/quote/v2/deprecated.js +116 -0
- package/build-module/quote/v2/deprecated.js.map +1 -0
- package/build-module/quote/v2/edit.js +115 -0
- package/build-module/quote/v2/edit.js.map +1 -0
- package/build-module/quote/v2/index.js +33 -0
- package/build-module/quote/v2/index.js.map +1 -0
- package/build-module/quote/v2/save.js +30 -0
- package/build-module/quote/v2/save.js.map +1 -0
- package/build-module/quote/v2/transforms.js +147 -0
- package/build-module/quote/v2/transforms.js.map +1 -0
- package/build-module/read-more/index.js +1 -1
- package/build-module/rss/edit.js +5 -1
- package/build-module/rss/edit.js.map +1 -1
- package/build-module/search/edit.js +2 -3
- package/build-module/search/edit.js.map +1 -1
- package/build-module/separator/deprecated.js +70 -0
- package/build-module/separator/deprecated.js.map +1 -0
- package/build-module/separator/edit.js +31 -22
- package/build-module/separator/edit.js.map +1 -1
- package/build-module/separator/index.js +16 -7
- package/build-module/separator/index.js.map +1 -1
- package/build-module/separator/save.js +19 -14
- package/build-module/separator/save.js.map +1 -1
- package/build-module/separator/use-deprecated-opacity.js +30 -0
- package/build-module/separator/use-deprecated-opacity.js.map +1 -0
- package/build-module/site-logo/edit.js +3 -2
- package/build-module/site-logo/edit.js.map +1 -1
- package/build-module/site-logo/index.js +1 -1
- package/build-module/social-links/edit.js +15 -4
- package/build-module/social-links/edit.js.map +1 -1
- package/build-module/social-links/index.js +2 -1
- package/build-module/social-links/index.js.map +1 -1
- package/build-module/spacer/controls.js +8 -19
- package/build-module/spacer/controls.js.map +1 -1
- package/build-module/spacer/controls.native.js +2 -1
- package/build-module/spacer/controls.native.js.map +1 -1
- package/build-module/spacer/edit.js +3 -3
- package/build-module/spacer/edit.js.map +1 -1
- package/build-module/table/deprecated.js +1 -1
- package/build-module/table/deprecated.js.map +1 -1
- package/build-module/tag-cloud/edit.js +60 -4
- package/build-module/tag-cloud/edit.js.map +1 -1
- package/build-module/tag-cloud/index.js +8 -0
- package/build-module/tag-cloud/index.js.map +1 -1
- package/build-module/template-part/edit/utils/hooks.js +5 -2
- package/build-module/template-part/edit/utils/hooks.js.map +1 -1
- package/build-style/avatar/editor-rtl.css +83 -0
- package/build-style/avatar/editor.css +83 -0
- package/build-style/avatar/style-rtl.css +79 -0
- package/build-style/avatar/style.css +79 -0
- package/build-style/editor-rtl.css +92 -11
- package/build-style/editor.css +92 -11
- package/build-style/gallery/editor-rtl.css +0 -1
- package/build-style/gallery/editor.css +0 -1
- package/build-style/gallery/style-rtl.css +102 -169
- package/build-style/gallery/style.css +102 -169
- package/build-style/group/editor-rtl.css +26 -0
- package/build-style/group/editor.css +26 -0
- package/build-style/heading/style-rtl.css +0 -8
- package/build-style/heading/style.css +0 -8
- package/build-style/image/style-rtl.css +2 -0
- package/build-style/image/style.css +2 -0
- package/build-style/list/style-rtl.css +1 -1
- package/build-style/list/style.css +1 -1
- package/build-style/navigation/style-rtl.css +11 -9
- package/build-style/navigation/style.css +11 -9
- package/build-style/navigation-link/editor-rtl.css +13 -0
- package/build-style/navigation-link/editor.css +13 -0
- package/build-style/navigation-link/style-rtl.css +3 -0
- package/build-style/navigation-link/style.css +3 -0
- package/build-style/paragraph/style-rtl.css +0 -4
- package/build-style/paragraph/style.css +0 -4
- package/build-style/pullquote/style-rtl.css +0 -4
- package/build-style/pullquote/style.css +0 -4
- package/build-style/query/editor-rtl.css +39 -0
- package/build-style/query/editor.css +39 -0
- package/build-style/quote/style-rtl.css +1 -0
- package/build-style/quote/style.css +1 -0
- package/build-style/reset-rtl.css +1 -1
- package/build-style/reset.css +1 -1
- package/build-style/separator/editor-rtl.css +3 -0
- package/build-style/separator/editor.css +3 -0
- package/build-style/separator/theme-rtl.css +7 -1
- package/build-style/separator/theme.css +7 -1
- package/build-style/site-logo/editor-rtl.css +3 -1
- package/build-style/site-logo/editor.css +3 -1
- package/build-style/style-rtl.css +124 -195
- package/build-style/style.css +124 -195
- package/build-style/template-part/editor-rtl.css +0 -9
- package/build-style/template-part/editor.css +0 -9
- package/build-style/theme-rtl.css +7 -1
- package/build-style/theme.css +7 -1
- package/package.json +28 -28
- package/src/archives/block.json +5 -1
- package/src/archives/edit.js +20 -2
- package/src/archives/index.php +4 -4
- package/src/audio/edit.native.js +0 -5
- package/src/avatar/block.json +53 -0
- package/src/avatar/edit.js +230 -0
- package/src/avatar/editor.scss +9 -0
- package/src/avatar/hooks.js +96 -0
- package/src/avatar/index.js +18 -0
- package/src/avatar/index.php +146 -0
- package/src/avatar/style.scss +5 -0
- package/src/avatar/user-control.js +56 -0
- package/src/block/edit.js +21 -11
- package/src/column/block.json +3 -1
- package/src/comment-author-avatar/block.json +4 -3
- package/src/comment-author-name/block.json +7 -3
- package/src/comment-author-name/index.php +3 -0
- package/src/comment-content/block.json +1 -1
- package/src/comment-date/block.json +7 -3
- package/src/comment-date/edit.js +20 -30
- package/src/comment-date/index.php +6 -1
- package/src/comment-edit-link/block.json +5 -1
- package/src/comment-edit-link/index.php +3 -0
- package/src/comment-reply-link/block.json +5 -1
- package/src/comment-reply-link/index.php +4 -1
- package/src/comment-template/block.json +2 -8
- package/src/comment-template/edit.js +77 -64
- package/src/comment-template/hooks.js +8 -24
- package/src/comment-template/index.php +1 -3
- package/src/comments-pagination-next/block.json +2 -9
- package/src/comments-pagination-numbers/block.json +2 -8
- package/src/comments-pagination-previous/block.json +2 -2
- package/src/comments-query-loop/block.json +1 -23
- package/src/comments-query-loop/edit/comments-inspector-controls.js +2 -83
- package/src/comments-query-loop/edit.js +54 -1
- package/src/cover/block.json +5 -0
- package/src/cover/edit.js +103 -60
- package/src/cover/index.php +85 -0
- package/src/cover/save.js +18 -14
- package/src/editor.scss +1 -0
- package/src/embed/variations.js +2 -2
- package/src/gallery/block.json +18 -1
- package/src/gallery/deprecated.scss +2 -2
- package/src/gallery/edit.js +15 -8
- package/src/gallery/editor.scss +0 -1
- package/src/gallery/gallery.js +8 -7
- package/src/gallery/gap-styles.js +26 -0
- package/src/gallery/index.php +43 -1
- package/src/gallery/style.scss +11 -44
- package/src/group/block.json +1 -1
- package/src/group/edit.js +4 -1
- package/src/group/editor.scss +31 -0
- package/src/group/variations.js +21 -4
- package/src/heading/edit.js +1 -1
- package/src/heading/style.scss +0 -3
- package/src/html/edit.js +22 -30
- package/src/image/edit.native.js +7 -11
- package/src/image/image.js +4 -1
- package/src/image/style.scss +3 -0
- package/src/index.js +19 -14
- package/src/list/deprecated.js +2 -2
- package/src/list/index.js +6 -1
- package/src/list/style.scss +1 -2
- package/src/list/test/migrate.js +159 -0
- package/src/list/v2/deprecated.js +89 -0
- package/src/list/v2/edit.js +186 -0
- package/src/list/v2/index.js +22 -0
- package/src/list/v2/migrate.js +87 -0
- package/src/list/v2/save.js +18 -0
- package/src/list/v2/transforms.js +116 -0
- package/src/list-item/block.json +26 -0
- package/src/list-item/edit.js +93 -0
- package/src/list-item/hooks/index.js +3 -0
- package/src/list-item/hooks/use-enter.js +94 -0
- package/src/list-item/hooks/use-indent-list-item.js +89 -0
- package/src/list-item/hooks/use-outdent-list-item.js +95 -0
- package/src/list-item/index.js +27 -0
- package/src/list-item/save.js +13 -0
- package/src/list-item/utils.js +14 -0
- package/src/media-text/edit.js +1 -1
- package/src/media-text/media-container.native.js +1 -14
- package/src/navigation/block.json +9 -1
- package/src/navigation/edit/index.js +50 -14
- package/src/navigation/edit/navigation-menu-delete-control.js +1 -1
- package/src/navigation/edit/unsaved-inner-blocks.js +57 -8
- package/src/navigation/index.php +28 -3
- package/src/navigation/style.scss +15 -13
- package/src/navigation/use-navigation-entities.js +37 -73
- package/src/navigation/use-navigation-menu.js +4 -0
- package/src/navigation-link/block.json +1 -0
- package/src/navigation-link/edit.js +156 -64
- package/src/navigation-link/editor.scss +11 -0
- package/src/navigation-link/index.php +8 -0
- package/src/navigation-link/style.scss +6 -0
- package/src/navigation-submenu/block.json +1 -0
- package/src/navigation-submenu/edit.js +7 -9
- package/src/paragraph/style.scss +0 -5
- package/src/post-author/index.php +0 -1
- package/src/post-comment/edit.js +2 -2
- package/src/post-comments/block.json +4 -3
- package/src/post-comments-form/edit.js +6 -3
- package/src/post-date/edit.js +63 -52
- package/src/post-date/index.php +1 -1
- package/src/post-date/test/edit.js +17 -0
- package/src/post-featured-image/block.json +1 -1
- package/src/post-featured-image/edit.js +9 -1
- package/src/post-featured-image/index.php +2 -1
- package/src/post-template/edit.js +7 -1
- package/src/post-terms/edit.js +4 -1
- package/src/post-terms/variations.js +3 -3
- package/src/pullquote/edit.js +4 -3
- package/src/pullquote/style.scss +0 -5
- package/src/query/edit/index.js +125 -26
- package/src/query/edit/query-placeholder.js +3 -13
- package/src/query/edit/query-toolbar.js +6 -0
- package/src/query/editor.scss +38 -0
- package/src/query/variations.js +4 -0
- package/src/query-no-results/block.json +20 -0
- package/src/query-no-results/edit.js +28 -0
- package/src/query-no-results/index.js +20 -0
- package/src/query-no-results/index.php +59 -0
- package/src/query-no-results/save.js +8 -0
- package/src/query-pagination/edit.js +1 -1
- package/src/query-pagination/index.php +9 -2
- package/src/query-pagination-numbers/block.json +19 -1
- package/src/quote/block.json +8 -0
- package/src/quote/index.js +6 -1
- package/src/quote/style.scss +1 -0
- package/src/quote/v2/deprecated.js +107 -0
- package/src/quote/v2/edit.js +136 -0
- package/src/quote/v2/index.js +36 -0
- package/src/quote/v2/save.js +26 -0
- package/src/quote/v2/test/migrate.js +92 -0
- package/src/quote/v2/transforms.js +155 -0
- package/src/read-more/block.json +1 -1
- package/src/reset.scss +1 -1
- package/src/rss/edit.js +3 -1
- package/src/rss/index.php +14 -1
- package/src/search/edit.js +1 -2
- package/src/separator/block.json +13 -6
- package/src/separator/deprecated.js +57 -0
- package/src/separator/deprecated.scss +6 -0
- package/src/separator/edit.js +36 -14
- package/src/separator/editor.scss +6 -0
- package/src/separator/index.js +2 -0
- package/src/separator/save.js +22 -14
- package/src/separator/test/edit.js +113 -0
- package/src/separator/theme.scss +7 -1
- package/src/separator/use-deprecated-opacity.js +41 -0
- package/src/site-logo/block.json +1 -1
- package/src/site-logo/edit.js +2 -1
- package/src/site-logo/editor.scss +3 -1
- package/src/site-logo/index.php +0 -4
- package/src/social-link/index.php +1 -2
- package/src/social-links/block.json +2 -1
- package/src/social-links/edit.js +15 -5
- package/src/spacer/controls.js +12 -18
- package/src/spacer/controls.native.js +2 -1
- package/src/spacer/edit.js +3 -6
- package/src/spacer/test/__snapshots__/index.native.js.snap +31 -0
- package/src/spacer/test/index.native.js +180 -0
- package/src/style.scss +1 -0
- package/src/table/deprecated.js +5 -1
- package/src/tag-cloud/block.json +8 -0
- package/src/tag-cloud/edit.js +82 -2
- package/src/tag-cloud/index.php +6 -0
- package/src/template-part/edit/utils/hooks.js +6 -1
- package/src/template-part/editor.scss +0 -10
- package/build/navigation/edit/use-list-view-modal.js +0 -73
- package/build/navigation/edit/use-list-view-modal.js.map +0 -1
- package/build/separator/separator-settings.js +0 -36
- package/build/separator/separator-settings.js.map +0 -1
- package/build-module/navigation/edit/use-list-view-modal.js +0 -63
- package/build-module/navigation/edit/use-list-view-modal.js.map +0 -1
- package/build-module/separator/separator-settings.js +0 -27
- package/build-module/separator/separator-settings.js.map +0 -1
- package/src/navigation/edit/use-list-view-modal.js +0 -72
- package/src/separator/separator-settings.js +0 -24
|
@@ -37,7 +37,7 @@ const metadata = {
|
|
|
37
37
|
supports: {
|
|
38
38
|
align: ["left", "right", "center", "wide", "full"],
|
|
39
39
|
color: {
|
|
40
|
-
__experimentalDuotone: "img",
|
|
40
|
+
__experimentalDuotone: "img, .wp-block-post-featured-image__placeholder, .components-placeholder__illustration, .components-placeholder::before",
|
|
41
41
|
text: false,
|
|
42
42
|
background: false
|
|
43
43
|
},
|
|
@@ -18,7 +18,9 @@ import { store as coreStore } from '@wordpress/core-data';
|
|
|
18
18
|
const TEMPLATE = [['core/post-title'], ['core/post-date'], ['core/post-excerpt']];
|
|
19
19
|
|
|
20
20
|
function PostTemplateInnerBlocks() {
|
|
21
|
-
const innerBlocksProps = useInnerBlocksProps({
|
|
21
|
+
const innerBlocksProps = useInnerBlocksProps({
|
|
22
|
+
className: 'wp-block-post'
|
|
23
|
+
}, {
|
|
22
24
|
template: TEMPLATE
|
|
23
25
|
});
|
|
24
26
|
return createElement("li", innerBlocksProps);
|
|
@@ -32,7 +34,10 @@ function PostTemplateBlockPreview(_ref) {
|
|
|
32
34
|
setActiveBlockContextId
|
|
33
35
|
} = _ref;
|
|
34
36
|
const blockPreviewProps = useBlockPreview({
|
|
35
|
-
blocks
|
|
37
|
+
blocks,
|
|
38
|
+
props: {
|
|
39
|
+
className: 'wp-block-post'
|
|
40
|
+
}
|
|
36
41
|
});
|
|
37
42
|
|
|
38
43
|
const handleOnClick = () => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-library/src/post-template/edit.js"],"names":["classnames","memo","useMemo","useState","useSelect","__","BlockContextProvider","__experimentalUseBlockPreview","useBlockPreview","useBlockProps","useInnerBlocksProps","store","blockEditorStore","Spinner","coreStore","TEMPLATE","PostTemplateInnerBlocks","innerBlocksProps","template","PostTemplateBlockPreview","blocks","blockContextId","isHidden","setActiveBlockContextId","blockPreviewProps","handleOnClick","style","display","undefined","MemoizedPostTemplateBlockPreview","PostTemplateEdit","clientId","context","query","perPage","offset","postType","order","orderBy","author","search","exclude","sticky","inherit","taxQuery","queryContext","page","templateSlug","displayLayout","type","layoutType","columns","activeBlockContextId","posts","select","getEntityRecords","getTaxonomies","getBlocks","taxonomies","per_page","orderby","builtTaxQuery","Object","entries","reduce","accumulator","taxonomySlug","terms","taxonomy","find","slug","rest_base","keys","length","assign","startsWith","replace","blockContexts","map","post","postId","id","hasLayoutFlex","blockProps","className","blockContext"],"mappings":";;;AAAA;AACA;AACA;AACA,OAAOA,UAAP,MAAuB,YAAvB;AAEA;AACA;AACA;;AACA,SAASC,IAAT,EAAeC,OAAf,EAAwBC,QAAxB,QAAwC,oBAAxC;AACA,SAASC,SAAT,QAA0B,iBAA1B;AACA,SAASC,EAAT,QAAmB,iBAAnB;AACA,SACCC,oBADD,EAECC,6BAA6B,IAAIC,eAFlC,EAGCC,aAHD,EAICC,mBAJD,EAKCC,KAAK,IAAIC,gBALV,QAMO,yBANP;AAOA,SAASC,OAAT,QAAwB,uBAAxB;AACA,SAASF,KAAK,IAAIG,SAAlB,QAAmC,sBAAnC;AAEA,MAAMC,QAAQ,GAAG,CAChB,CAAE,iBAAF,CADgB,EAEhB,CAAE,gBAAF,CAFgB,EAGhB,CAAE,mBAAF,CAHgB,CAAjB;;AAMA,SAASC,uBAAT,GAAmC;AAClC,QAAMC,gBAAgB,GAAGP,mBAAmB,CAAE,EAAF,EAAM;AAAEQ,IAAAA,QAAQ,EAAEH;AAAZ,GAAN,CAA5C;AACA,SAAO,oBAASE,gBAAT,CAAP;AACA;;AAED,SAASE,wBAAT,OAKI;AAAA,MAL+B;AAClCC,IAAAA,MADkC;AAElCC,IAAAA,cAFkC;AAGlCC,IAAAA,QAHkC;AAIlCC,IAAAA;AAJkC,GAK/B;AACH,QAAMC,iBAAiB,GAAGhB,eAAe,CAAE;AAC1CY,IAAAA;AAD0C,GAAF,CAAzC;;AAIA,QAAMK,aAAa,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AoBG,MADC,CADtB;AALF,MATD,CADkB;AAAA,GAAnB,CAFF,CADD;AA2BA","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { memo, useMemo, useState } from '@wordpress/element';\nimport { useSelect } from '@wordpress/data';\nimport { __ } from '@wordpress/i18n';\nimport {\n\tBlockContextProvider,\n\t__experimentalUseBlockPreview as useBlockPreview,\n\tuseBlockProps,\n\tuseInnerBlocksProps,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\nimport { Spinner } from '@wordpress/components';\nimport { store as coreStore } from '@wordpress/core-data';\n\nconst TEMPLATE = [\n\t[ 'core/post-title' ],\n\t[ 'core/post-date' ],\n\t[ 'core/post-excerpt' ],\n];\n\nfunction PostTemplateInnerBlocks() {\n\tconst innerBlocksProps = useInnerBlocksProps( {}, { template: TEMPLATE } );\n\treturn <li { ...innerBlocksProps } />;\n}\n\nfunction PostTemplateBlockPreview( {\n\tblocks,\n\tblockContextId,\n\tisHidden,\n\tsetActiveBlockContextId,\n} ) {\n\tconst blockPreviewProps = useBlockPreview( {\n\t\tblocks,\n\t} );\n\n\tconst handleOnClick = () => {\n\t\tsetActiveBlockContextId( blockContextId );\n\t};\n\n\tconst style = {\n\t\tdisplay: isHidden ? 'none' : undefined,\n\t};\n\n\treturn (\n\t\t<li\n\t\t\t{ ...blockPreviewProps }\n\t\t\ttabIndex={ 0 }\n\t\t\t// eslint-disable-next-line jsx-a11y/no-noninteractive-element-to-interactive-role\n\t\t\trole=\"button\"\n\t\t\tonClick={ handleOnClick }\n\t\t\tonKeyPress={ handleOnClick }\n\t\t\tstyle={ style }\n\t\t/>\n\t);\n}\n\nconst MemoizedPostTemplateBlockPreview = memo( PostTemplateBlockPreview );\n\nexport default function PostTemplateEdit( {\n\tclientId,\n\tcontext: {\n\t\tquery: {\n\t\t\tperPage,\n\t\t\toffset,\n\t\t\tpostType,\n\t\t\torder,\n\t\t\torderBy,\n\t\t\tauthor,\n\t\t\tsearch,\n\t\t\texclude,\n\t\t\tsticky,\n\t\t\tinherit,\n\t\t\ttaxQuery,\n\t\t} = {},\n\t\tqueryContext = [ { page: 1 } ],\n\t\ttemplateSlug,\n\t\tdisplayLayout: { type: layoutType = 'flex', columns = 1 } = {},\n\t},\n} ) {\n\tconst [ { page } ] = queryContext;\n\tconst [ activeBlockContextId, setActiveBlockContextId ] = useState();\n\n\tconst { posts, blocks } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getEntityRecords, getTaxonomies } = select( coreStore );\n\t\t\tconst { getBlocks } = select( blockEditorStore );\n\t\t\tconst taxonomies = 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\tconst query = {\n\t\t\t\toffset: perPage ? perPage * ( page - 1 ) + offset : 0,\n\t\t\t\torder,\n\t\t\t\torderby: orderBy,\n\t\t\t};\n\t\t\tif ( taxQuery ) {\n\t\t\t\t// We have to build the tax query for the REST API and use as\n\t\t\t\t// keys the taxonomies `rest_base` with the `term ids` as values.\n\t\t\t\tconst builtTaxQuery = Object.entries( taxQuery ).reduce(\n\t\t\t\t\t( accumulator, [ taxonomySlug, terms ] ) => {\n\t\t\t\t\t\tconst taxonomy = taxonomies?.find(\n\t\t\t\t\t\t\t( { slug } ) => slug === taxonomySlug\n\t\t\t\t\t\t);\n\t\t\t\t\t\tif ( taxonomy?.rest_base ) {\n\t\t\t\t\t\t\taccumulator[ taxonomy?.rest_base ] = terms;\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn accumulator;\n\t\t\t\t\t},\n\t\t\t\t\t{}\n\t\t\t\t);\n\t\t\t\tif ( !! Object.keys( builtTaxQuery ).length ) {\n\t\t\t\t\tObject.assign( query, builtTaxQuery );\n\t\t\t\t}\n\t\t\t}\n\t\t\tif ( perPage ) {\n\t\t\t\tquery.per_page = perPage;\n\t\t\t}\n\t\t\tif ( author ) {\n\t\t\t\tquery.author = author;\n\t\t\t}\n\t\t\tif ( search ) {\n\t\t\t\tquery.search = search;\n\t\t\t}\n\t\t\tif ( exclude?.length ) {\n\t\t\t\tquery.exclude = exclude;\n\t\t\t}\n\t\t\t// If sticky is not set, it will return all posts in the results.\n\t\t\t// If sticky is set to `only`, it will limit the results to sticky posts only.\n\t\t\t// If it is anything else, it will exclude sticky posts from results. For the record the value stored is `exclude`.\n\t\t\tif ( sticky ) {\n\t\t\t\tquery.sticky = sticky === 'only';\n\t\t\t}\n\t\t\t// If `inherit` is truthy, adjust conditionally the query to create a better preview.\n\t\t\tif ( inherit ) {\n\t\t\t\t// Change the post-type if needed.\n\t\t\t\tif ( templateSlug?.startsWith( 'archive-' ) ) {\n\t\t\t\t\tquery.postType = templateSlug.replace( 'archive-', '' );\n\t\t\t\t\tpostType = query.postType;\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn {\n\t\t\t\tposts: getEntityRecords( 'postType', postType, query ),\n\t\t\t\tblocks: getBlocks( clientId ),\n\t\t\t};\n\t\t},\n\t\t[\n\t\t\tperPage,\n\t\t\tpage,\n\t\t\toffset,\n\t\t\torder,\n\t\t\torderBy,\n\t\t\tclientId,\n\t\t\tauthor,\n\t\t\tsearch,\n\t\t\tpostType,\n\t\t\texclude,\n\t\t\tsticky,\n\t\t\tinherit,\n\t\t\ttemplateSlug,\n\t\t\ttaxQuery,\n\t\t]\n\t);\n\tconst blockContexts = useMemo(\n\t\t() =>\n\t\t\tposts?.map( ( post ) => ( {\n\t\t\t\tpostType: post.type,\n\t\t\t\tpostId: post.id,\n\t\t\t} ) ),\n\t\t[ posts ]\n\t);\n\tconst hasLayoutFlex = layoutType === 'flex' && columns > 1;\n\tconst blockProps = useBlockProps( {\n\t\tclassName: classnames( {\n\t\t\t'is-flex-container': hasLayoutFlex,\n\t\t\t[ `columns-${ columns }` ]: hasLayoutFlex,\n\t\t} ),\n\t} );\n\n\tif ( ! posts ) {\n\t\treturn (\n\t\t\t<p { ...blockProps }>\n\t\t\t\t<Spinner />\n\t\t\t</p>\n\t\t);\n\t}\n\n\tif ( ! posts.length ) {\n\t\treturn <p { ...blockProps }> { __( 'No results found.' ) }</p>;\n\t}\n\n\t// To avoid flicker when switching active block contexts, a preview is rendered\n\t// for each block context, but the preview for the active block context is hidden.\n\t// This ensures that when it is displayed again, the cached rendering of the\n\t// block preview is used, instead of having to re-render the preview from scratch.\n\treturn (\n\t\t<ul { ...blockProps }>\n\t\t\t{ blockContexts &&\n\t\t\t\tblockContexts.map( ( blockContext ) => (\n\t\t\t\t\t<BlockContextProvider\n\t\t\t\t\t\tkey={ blockContext.postId }\n\t\t\t\t\t\tvalue={ blockContext }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ blockContext.postId ===\n\t\t\t\t\t\t( activeBlockContextId ||\n\t\t\t\t\t\t\tblockContexts[ 0 ]?.postId ) ? (\n\t\t\t\t\t\t\t<PostTemplateInnerBlocks />\n\t\t\t\t\t\t) : null }\n\t\t\t\t\t\t<MemoizedPostTemplateBlockPreview\n\t\t\t\t\t\t\tblocks={ blocks }\n\t\t\t\t\t\t\tblockContextId={ blockContext.postId }\n\t\t\t\t\t\t\tsetActiveBlockContextId={ setActiveBlockContextId }\n\t\t\t\t\t\t\tisHidden={\n\t\t\t\t\t\t\t\tblockContext.postId ===\n\t\t\t\t\t\t\t\t( activeBlockContextId ||\n\t\t\t\t\t\t\t\t\tblockContexts[ 0 ]?.postId )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t/>\n\t\t\t\t\t</BlockContextProvider>\n\t\t\t\t) ) }\n\t\t</ul>\n\t);\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["@wordpress/block-library/src/post-template/edit.js"],"names":["classnames","memo","useMemo","useState","useSelect","__","BlockContextProvider","__experimentalUseBlockPreview","useBlockPreview","useBlockProps","useInnerBlocksProps","store","blockEditorStore","Spinner","coreStore","TEMPLATE","PostTemplateInnerBlocks","innerBlocksProps","className","template","PostTemplateBlockPreview","blocks","blockContextId","isHidden","setActiveBlockContextId","blockPreviewProps","props","handleOnClick","style","display","undefined","MemoizedPostTemplateBlockPreview","PostTemplateEdit","clientId","context","query","perPage","offset","postType","order","orderBy","author","search","exclude","sticky","inherit","taxQuery","queryContext","page","templateSlug","displayLayout","type","layoutType","columns","activeBlockContextId","posts","select","getEntityRecords","getTaxonomies","getBlocks","taxonomies","per_page","orderby","builtTaxQuery","Object","entries","reduce","accumulator","taxonomySlug","terms","taxonomy","find","slug","rest_base","keys","length","assign","startsWith","replace","blockContexts","map","post","postId","id","hasLayoutFlex","blockProps","blockContext"],"mappings":";;;AAAA;AACA;AACA;AACA,OAAOA,UAAP,MAAuB,YAAvB;AAEA;AACA;AACA;;AACA,SAASC,IAAT,EAAeC,OAAf,EAAwBC,QAAxB,QAAwC,oBAAxC;AACA,SAASC,SAAT,QAA0B,iBAA1B;AACA,SAASC,EAAT,QAAmB,iBAAnB;AACA,SACCC,oBADD,EAECC,6BAA6B,IAAIC,eAFlC,EAGCC,aAHD,EAICC,mBAJD,EAKCC,KAAK,IAAIC,gBALV,QAMO,yBANP;AAOA,SAASC,OAAT,QAAwB,uBAAxB;AACA,SAASF,KAAK,IAAIG,SAAlB,QAAmC,sBAAnC;AAEA,MAAMC,QAAQ,GAAG,CAChB,CAAE,iBAAF,CADgB,EAEhB,CAAE,gBAAF,CAFgB,EAGhB,CAAE,mBAAF,CAHgB,CAAjB;;AAMA,SAASC,uBAAT,GAAmC;AAClC,QAAMC,gBAAgB,GAAGP,mBAAmB,CAC3C;AAAEQ,IAAAA,SAAS,EAAE;AAAb,GAD2C,EAE3C;AAAEC,IAAAA,QAAQ,EAAEJ;AAAZ,GAF2C,CAA5C;AAIA,SAAO,oBAASE,gBAAT,CAAP;AACA;;AAED,SAASG,wBAAT,OAKI;AAAA,MAL+B;AAClCC,IAAAA,MADkC;AAElCC,IAAAA,cAFkC;AAGlCC,IAAAA,QAHkC;AAIlCC,IAAAA;AAJkC,GAK/B;AACH,QAAMC,iBAAiB,GAAGjB,eAAe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uBAAuB,EAAG1D,uBAH3B;AAIC,MAAA,QAAQ,EACP8D,YAAY,CAACJ,MAAb,MACE5B,oBAAoB,yBACrByB,aAAa,CAAE,CAAF,CADQ,qDACrB,iBAAoBG,MADC,CADtB;AALF,MATD,CADkB;AAAA,GAAnB,CAFF,CADD;AA2BA","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { memo, useMemo, useState } from '@wordpress/element';\nimport { useSelect } from '@wordpress/data';\nimport { __ } from '@wordpress/i18n';\nimport {\n\tBlockContextProvider,\n\t__experimentalUseBlockPreview as useBlockPreview,\n\tuseBlockProps,\n\tuseInnerBlocksProps,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\nimport { Spinner } from '@wordpress/components';\nimport { store as coreStore } from '@wordpress/core-data';\n\nconst TEMPLATE = [\n\t[ 'core/post-title' ],\n\t[ 'core/post-date' ],\n\t[ 'core/post-excerpt' ],\n];\n\nfunction PostTemplateInnerBlocks() {\n\tconst innerBlocksProps = useInnerBlocksProps(\n\t\t{ className: 'wp-block-post' },\n\t\t{ template: TEMPLATE }\n\t);\n\treturn <li { ...innerBlocksProps } />;\n}\n\nfunction PostTemplateBlockPreview( {\n\tblocks,\n\tblockContextId,\n\tisHidden,\n\tsetActiveBlockContextId,\n} ) {\n\tconst blockPreviewProps = useBlockPreview( {\n\t\tblocks,\n\t\tprops: {\n\t\t\tclassName: 'wp-block-post',\n\t\t},\n\t} );\n\n\tconst handleOnClick = () => {\n\t\tsetActiveBlockContextId( blockContextId );\n\t};\n\n\tconst style = {\n\t\tdisplay: isHidden ? 'none' : undefined,\n\t};\n\n\treturn (\n\t\t<li\n\t\t\t{ ...blockPreviewProps }\n\t\t\ttabIndex={ 0 }\n\t\t\t// eslint-disable-next-line jsx-a11y/no-noninteractive-element-to-interactive-role\n\t\t\trole=\"button\"\n\t\t\tonClick={ handleOnClick }\n\t\t\tonKeyPress={ handleOnClick }\n\t\t\tstyle={ style }\n\t\t/>\n\t);\n}\n\nconst MemoizedPostTemplateBlockPreview = memo( PostTemplateBlockPreview );\n\nexport default function PostTemplateEdit( {\n\tclientId,\n\tcontext: {\n\t\tquery: {\n\t\t\tperPage,\n\t\t\toffset,\n\t\t\tpostType,\n\t\t\torder,\n\t\t\torderBy,\n\t\t\tauthor,\n\t\t\tsearch,\n\t\t\texclude,\n\t\t\tsticky,\n\t\t\tinherit,\n\t\t\ttaxQuery,\n\t\t} = {},\n\t\tqueryContext = [ { page: 1 } ],\n\t\ttemplateSlug,\n\t\tdisplayLayout: { type: layoutType = 'flex', columns = 1 } = {},\n\t},\n} ) {\n\tconst [ { page } ] = queryContext;\n\tconst [ activeBlockContextId, setActiveBlockContextId ] = useState();\n\n\tconst { posts, blocks } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getEntityRecords, getTaxonomies } = select( coreStore );\n\t\t\tconst { getBlocks } = select( blockEditorStore );\n\t\t\tconst taxonomies = 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\tconst query = {\n\t\t\t\toffset: perPage ? perPage * ( page - 1 ) + offset : 0,\n\t\t\t\torder,\n\t\t\t\torderby: orderBy,\n\t\t\t};\n\t\t\tif ( taxQuery ) {\n\t\t\t\t// We have to build the tax query for the REST API and use as\n\t\t\t\t// keys the taxonomies `rest_base` with the `term ids` as values.\n\t\t\t\tconst builtTaxQuery = Object.entries( taxQuery ).reduce(\n\t\t\t\t\t( accumulator, [ taxonomySlug, terms ] ) => {\n\t\t\t\t\t\tconst taxonomy = taxonomies?.find(\n\t\t\t\t\t\t\t( { slug } ) => slug === taxonomySlug\n\t\t\t\t\t\t);\n\t\t\t\t\t\tif ( taxonomy?.rest_base ) {\n\t\t\t\t\t\t\taccumulator[ taxonomy?.rest_base ] = terms;\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn accumulator;\n\t\t\t\t\t},\n\t\t\t\t\t{}\n\t\t\t\t);\n\t\t\t\tif ( !! Object.keys( builtTaxQuery ).length ) {\n\t\t\t\t\tObject.assign( query, builtTaxQuery );\n\t\t\t\t}\n\t\t\t}\n\t\t\tif ( perPage ) {\n\t\t\t\tquery.per_page = perPage;\n\t\t\t}\n\t\t\tif ( author ) {\n\t\t\t\tquery.author = author;\n\t\t\t}\n\t\t\tif ( search ) {\n\t\t\t\tquery.search = search;\n\t\t\t}\n\t\t\tif ( exclude?.length ) {\n\t\t\t\tquery.exclude = exclude;\n\t\t\t}\n\t\t\t// If sticky is not set, it will return all posts in the results.\n\t\t\t// If sticky is set to `only`, it will limit the results to sticky posts only.\n\t\t\t// If it is anything else, it will exclude sticky posts from results. For the record the value stored is `exclude`.\n\t\t\tif ( sticky ) {\n\t\t\t\tquery.sticky = sticky === 'only';\n\t\t\t}\n\t\t\t// If `inherit` is truthy, adjust conditionally the query to create a better preview.\n\t\t\tif ( inherit ) {\n\t\t\t\t// Change the post-type if needed.\n\t\t\t\tif ( templateSlug?.startsWith( 'archive-' ) ) {\n\t\t\t\t\tquery.postType = templateSlug.replace( 'archive-', '' );\n\t\t\t\t\tpostType = query.postType;\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn {\n\t\t\t\tposts: getEntityRecords( 'postType', postType, query ),\n\t\t\t\tblocks: getBlocks( clientId ),\n\t\t\t};\n\t\t},\n\t\t[\n\t\t\tperPage,\n\t\t\tpage,\n\t\t\toffset,\n\t\t\torder,\n\t\t\torderBy,\n\t\t\tclientId,\n\t\t\tauthor,\n\t\t\tsearch,\n\t\t\tpostType,\n\t\t\texclude,\n\t\t\tsticky,\n\t\t\tinherit,\n\t\t\ttemplateSlug,\n\t\t\ttaxQuery,\n\t\t]\n\t);\n\tconst blockContexts = useMemo(\n\t\t() =>\n\t\t\tposts?.map( ( post ) => ( {\n\t\t\t\tpostType: post.type,\n\t\t\t\tpostId: post.id,\n\t\t\t} ) ),\n\t\t[ posts ]\n\t);\n\tconst hasLayoutFlex = layoutType === 'flex' && columns > 1;\n\tconst blockProps = useBlockProps( {\n\t\tclassName: classnames( {\n\t\t\t'is-flex-container': hasLayoutFlex,\n\t\t\t[ `columns-${ columns }` ]: hasLayoutFlex,\n\t\t} ),\n\t} );\n\n\tif ( ! posts ) {\n\t\treturn (\n\t\t\t<p { ...blockProps }>\n\t\t\t\t<Spinner />\n\t\t\t</p>\n\t\t);\n\t}\n\n\tif ( ! posts.length ) {\n\t\treturn <p { ...blockProps }> { __( 'No results found.' ) }</p>;\n\t}\n\n\t// To avoid flicker when switching active block contexts, a preview is rendered\n\t// for each block context, but the preview for the active block context is hidden.\n\t// This ensures that when it is displayed again, the cached rendering of the\n\t// block preview is used, instead of having to re-render the preview from scratch.\n\treturn (\n\t\t<ul { ...blockProps }>\n\t\t\t{ blockContexts &&\n\t\t\t\tblockContexts.map( ( blockContext ) => (\n\t\t\t\t\t<BlockContextProvider\n\t\t\t\t\t\tkey={ blockContext.postId }\n\t\t\t\t\t\tvalue={ blockContext }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ blockContext.postId ===\n\t\t\t\t\t\t( activeBlockContextId ||\n\t\t\t\t\t\t\tblockContexts[ 0 ]?.postId ) ? (\n\t\t\t\t\t\t\t<PostTemplateInnerBlocks />\n\t\t\t\t\t\t) : null }\n\t\t\t\t\t\t<MemoizedPostTemplateBlockPreview\n\t\t\t\t\t\t\tblocks={ blocks }\n\t\t\t\t\t\t\tblockContextId={ blockContext.postId }\n\t\t\t\t\t\t\tsetActiveBlockContextId={ setActiveBlockContextId }\n\t\t\t\t\t\t\tisHidden={\n\t\t\t\t\t\t\t\tblockContext.postId ===\n\t\t\t\t\t\t\t\t( activeBlockContextId ||\n\t\t\t\t\t\t\t\t\tblockContexts[ 0 ]?.postId )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t/>\n\t\t\t\t\t</BlockContextProvider>\n\t\t\t\t) ) }\n\t\t</ul>\n\t);\n}\n"]}
|
|
@@ -9,7 +9,7 @@ import { unescape } from 'lodash';
|
|
|
9
9
|
* WordPress dependencies
|
|
10
10
|
*/
|
|
11
11
|
|
|
12
|
-
import { AlignmentToolbar, InspectorControls, BlockControls, useBlockProps } from '@wordpress/block-editor';
|
|
12
|
+
import { AlignmentToolbar, InspectorControls, BlockControls, useBlockProps, useBlockDisplayInformation } from '@wordpress/block-editor';
|
|
13
13
|
import { Spinner, TextControl } from '@wordpress/components';
|
|
14
14
|
import { useSelect } from '@wordpress/data';
|
|
15
15
|
import { __ } from '@wordpress/i18n';
|
|
@@ -24,6 +24,7 @@ export default function PostTermsEdit(_ref) {
|
|
|
24
24
|
|
|
25
25
|
let {
|
|
26
26
|
attributes,
|
|
27
|
+
clientId,
|
|
27
28
|
context,
|
|
28
29
|
setAttributes
|
|
29
30
|
} = _ref;
|
|
@@ -56,6 +57,7 @@ export default function PostTermsEdit(_ref) {
|
|
|
56
57
|
term: selectedTerm
|
|
57
58
|
});
|
|
58
59
|
const hasPost = postId && postType;
|
|
60
|
+
const blockInformation = useBlockDisplayInformation(clientId);
|
|
59
61
|
const blockProps = useBlockProps({
|
|
60
62
|
className: classnames({
|
|
61
63
|
[`has-text-align-${textAlign}`]: textAlign,
|
|
@@ -64,7 +66,7 @@ export default function PostTermsEdit(_ref) {
|
|
|
64
66
|
});
|
|
65
67
|
|
|
66
68
|
if (!hasPost || !term) {
|
|
67
|
-
return createElement("div", blockProps,
|
|
69
|
+
return createElement("div", blockProps, blockInformation.title);
|
|
68
70
|
}
|
|
69
71
|
|
|
70
72
|
return createElement(Fragment, null, createElement(BlockControls, null, createElement(AlignmentToolbar, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-library/src/post-terms/edit.js"],"names":["classnames","unescape","AlignmentToolbar","InspectorControls","BlockControls","useBlockProps","Spinner","TextControl","useSelect","__","store","coreStore","usePostTerms","PostTermsEdit","attributes","context","setAttributes","term","textAlign","separator","postId","postType","selectedTerm","select","getTaxonomy","taxonomy","visibility","publicly_queryable","postTerms","hasPostTerms","isLoading","hasPost","blockProps","className","nextAlign","nextValue","map","postTerm","id","link","event","preventDefault","name","reduce","prev","curr","labels","no_terms"],"mappings":";;AAAA;AACA;AACA;AACA,OAAOA,UAAP,MAAuB,YAAvB;AACA,SAASC,QAAT,QAAyB,QAAzB;AAEA;AACA;AACA;;AACA,SACCC,gBADD,EAECC,iBAFD,EAGCC,aAHD,EAICC,aAJD,
|
|
1
|
+
{"version":3,"sources":["@wordpress/block-library/src/post-terms/edit.js"],"names":["classnames","unescape","AlignmentToolbar","InspectorControls","BlockControls","useBlockProps","useBlockDisplayInformation","Spinner","TextControl","useSelect","__","store","coreStore","usePostTerms","PostTermsEdit","attributes","clientId","context","setAttributes","term","textAlign","separator","postId","postType","selectedTerm","select","getTaxonomy","taxonomy","visibility","publicly_queryable","postTerms","hasPostTerms","isLoading","hasPost","blockInformation","blockProps","className","title","nextAlign","nextValue","map","postTerm","id","link","event","preventDefault","name","reduce","prev","curr","labels","no_terms"],"mappings":";;AAAA;AACA;AACA;AACA,OAAOA,UAAP,MAAuB,YAAvB;AACA,SAASC,QAAT,QAAyB,QAAzB;AAEA;AACA;AACA;;AACA,SACCC,gBADD,EAECC,iBAFD,EAGCC,aAHD,EAICC,aAJD,EAKCC,0BALD,QAMO,yBANP;AAOA,SAASC,OAAT,EAAkBC,WAAlB,QAAqC,uBAArC;AACA,SAASC,SAAT,QAA0B,iBAA1B;AACA,SAASC,EAAT,QAAmB,iBAAnB;AACA,SAASC,KAAK,IAAIC,SAAlB,QAAmC,sBAAnC;AAEA;AACA;AACA;;AACA,OAAOC,YAAP,MAAyB,kBAAzB;AAEA,eAAe,SAASC,aAAT,OAKX;AAAA;;AAAA,MALmC;AACtCC,IAAAA,UADsC;AAEtCC,IAAAA,QAFsC;AAGtCC,IAAAA,OAHsC;AAItCC,IAAAA;AAJsC,GAKnC;AACH,QAAM;AAAEC,IAAAA,IAAF;AAAQC,IAAAA,SAAR;AAAmBC,IAAAA;AAAnB,MAAiCN,U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AE;AAAEE,QAAAA,SAAS,EAAEkB;AAAb,OAAF,CAAb;AACA;AAJF,IADD,CADD,EASC,cAAC,iBAAD;AAAmB,IAAA,mBAAmB,EAAC;AAAvC,KACC,cAAC,WAAD;AACC,IAAA,YAAY,EAAC,KADd;AAEC,IAAA,KAAK,EAAG5B,EAAE,CAAE,WAAF,CAFX;AAGC,IAAA,KAAK,EAAGW,SAAS,IAAI,EAHtB;AAIC,IAAA,QAAQ,EAAKkB,SAAF,IAAiB;AAC3BrB,MAAAA,aAAa,CAAE;AAAEG,QAAAA,SAAS,EAAEkB;AAAb,OAAF,CAAb;AACA,KANF;AAOC,IAAA,IAAI,EAAG7B,EAAE,CAAE,4CAAF;AAPV,IADD,CATD,EAoBC,qBAAUyB,UAAV,EACGH,SAAS,IAAI,cAAC,OAAD,OADhB,EAEG,CAAEA,SAAF,IACDD,YADC,IAEDD,SAAS,CACPU,GADF,CACSC,QAAF,IACL;AACC,IAAA,GAAG,EAAGA,QAAQ,CAACC,EADhB;AAEC,IAAA,IAAI,EAAGD,QAAQ,CAACE,IAFjB;AAGC,IAAA,OAAO,EAAKC,KAAF,IAAaA,KAAK,CAACC,cAAN;AAHxB,KAKG5C,QAAQ,CAAEwC,QAAQ,CAACK,IAAX,CALX,CAFF,EAUEC,MAVF,CAUU,CAAEC,IAAF,EAAQC,IAAR,KACR,8BACGD,IADH,EAEC;AAAM,IAAA,SAAS,EAAC;AAAhB,KACG3B,SAAS,IAAI,GADhB,CAFD,EAKG4B,IALH,CAXF,CAJF,EAuBG,CAAEjB,SAAF,IACD,CAAED,YADD,KAEC,CAAAP,YAAY,SAAZ,IAAAA,YAAY,WAAZ,oCAAAA,YAAY,CAAE0B,MAAd,8EAAsBC,QAAtB,KACDzC,EAAE,CAAE,uBAAF,CAHF,CAvBH,CApBD,CADD;AAmDA","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\nimport { unescape } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tAlignmentToolbar,\n\tInspectorControls,\n\tBlockControls,\n\tuseBlockProps,\n\tuseBlockDisplayInformation,\n} from '@wordpress/block-editor';\nimport { Spinner, TextControl } from '@wordpress/components';\nimport { useSelect } from '@wordpress/data';\nimport { __ } from '@wordpress/i18n';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport usePostTerms from './use-post-terms';\n\nexport default function PostTermsEdit( {\n\tattributes,\n\tclientId,\n\tcontext,\n\tsetAttributes,\n} ) {\n\tconst { term, textAlign, separator } = attributes;\n\tconst { postId, postType } = context;\n\n\tconst selectedTerm = useSelect(\n\t\t( select ) => {\n\t\t\tif ( ! term ) return {};\n\t\t\tconst { getTaxonomy } = select( coreStore );\n\t\t\tconst taxonomy = getTaxonomy( term );\n\t\t\treturn taxonomy?.visibility?.publicly_queryable ? taxonomy : {};\n\t\t},\n\t\t[ term ]\n\t);\n\tconst { postTerms, hasPostTerms, isLoading } = usePostTerms( {\n\t\tpostId,\n\t\tpostType,\n\t\tterm: selectedTerm,\n\t} );\n\tconst hasPost = postId && postType;\n\tconst blockInformation = useBlockDisplayInformation( clientId );\n\tconst blockProps = useBlockProps( {\n\t\tclassName: classnames( {\n\t\t\t[ `has-text-align-${ textAlign }` ]: textAlign,\n\t\t\t[ `taxonomy-${ term }` ]: term,\n\t\t} ),\n\t} );\n\n\tif ( ! hasPost || ! term ) {\n\t\treturn <div { ...blockProps }>{ blockInformation.title }</div>;\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t<BlockControls>\n\t\t\t\t<AlignmentToolbar\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<InspectorControls __experimentalGroup=\"advanced\">\n\t\t\t\t<TextControl\n\t\t\t\t\tautoComplete=\"off\"\n\t\t\t\t\tlabel={ __( 'Separator' ) }\n\t\t\t\t\tvalue={ separator || '' }\n\t\t\t\t\tonChange={ ( nextValue ) => {\n\t\t\t\t\t\tsetAttributes( { separator: nextValue } );\n\t\t\t\t\t} }\n\t\t\t\t\thelp={ __( 'Enter character(s) used to separate terms.' ) }\n\t\t\t\t/>\n\t\t\t</InspectorControls>\n\t\t\t<div { ...blockProps }>\n\t\t\t\t{ isLoading && <Spinner /> }\n\t\t\t\t{ ! isLoading &&\n\t\t\t\t\thasPostTerms &&\n\t\t\t\t\tpostTerms\n\t\t\t\t\t\t.map( ( postTerm ) => (\n\t\t\t\t\t\t\t<a\n\t\t\t\t\t\t\t\tkey={ postTerm.id }\n\t\t\t\t\t\t\t\thref={ postTerm.link }\n\t\t\t\t\t\t\t\tonClick={ ( event ) => event.preventDefault() }\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{ unescape( postTerm.name ) }\n\t\t\t\t\t\t\t</a>\n\t\t\t\t\t\t) )\n\t\t\t\t\t\t.reduce( ( prev, curr ) => (\n\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t{ prev }\n\t\t\t\t\t\t\t\t<span className=\"wp-block-post-terms__separator\">\n\t\t\t\t\t\t\t\t\t{ separator || ' ' }\n\t\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t\t{ curr }\n\t\t\t\t\t\t\t</>\n\t\t\t\t\t\t) ) }\n\t\t\t\t{ ! isLoading &&\n\t\t\t\t\t! hasPostTerms &&\n\t\t\t\t\t( selectedTerm?.labels?.no_terms ||\n\t\t\t\t\t\t__( 'Term items not found.' ) ) }\n\t\t\t</div>\n\t\t</>\n\t);\n}\n"]}
|
|
@@ -2,12 +2,12 @@
|
|
|
2
2
|
* WordPress dependencies
|
|
3
3
|
*/
|
|
4
4
|
import { __ } from '@wordpress/i18n';
|
|
5
|
-
import { postCategories
|
|
5
|
+
import { postCategories, postTerms } from '@wordpress/icons';
|
|
6
6
|
const variations = [{
|
|
7
7
|
name: 'category',
|
|
8
8
|
title: __('Post Categories'),
|
|
9
9
|
description: __("Display a post's categories."),
|
|
10
|
-
icon,
|
|
10
|
+
icon: postCategories,
|
|
11
11
|
isDefault: true,
|
|
12
12
|
attributes: {
|
|
13
13
|
term: 'category'
|
|
@@ -17,7 +17,7 @@ const variations = [{
|
|
|
17
17
|
name: 'post_tag',
|
|
18
18
|
title: __('Post Tags'),
|
|
19
19
|
description: __("Display a post's tags."),
|
|
20
|
-
icon,
|
|
20
|
+
icon: postTerms,
|
|
21
21
|
attributes: {
|
|
22
22
|
term: 'post_tag'
|
|
23
23
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-library/src/post-terms/variations.js"],"names":["__","postCategories","
|
|
1
|
+
{"version":3,"sources":["@wordpress/block-library/src/post-terms/variations.js"],"names":["__","postCategories","postTerms","variations","name","title","description","icon","isDefault","attributes","term","isActive","blockAttributes"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,EAAT,QAAmB,iBAAnB;AACA,SAASC,cAAT,EAAyBC,SAAzB,QAA0C,kBAA1C;AAEA,MAAMC,UAAU,GAAG,CAClB;AACCC,EAAAA,IAAI,EAAE,UADP;AAECC,EAAAA,KAAK,EAAEL,EAAE,CAAE,iBAAF,CAFV;AAGCM,EAAAA,WAAW,EAAEN,EAAE,CAAE,8BAAF,CAHhB;AAICO,EAAAA,IAAI,EAAEN,cAJP;AAKCO,EAAAA,SAAS,EAAE,IALZ;AAMCC,EAAAA,UAAU,EAAE;AAAEC,IAAAA,IAAI,EAAE;AAAR,GANb;AAOCC,EAAAA,QAAQ,EAAIC,eAAF,IAAuBA,eAAe,CAACF,IAAhB,KAAyB;AAP3D,CADkB,EAWlB;AACCN,EAAAA,IAAI,EAAE,UADP;AAECC,EAAAA,KAAK,EAAEL,EAAE,CAAE,WAAF,CAFV;AAGCM,EAAAA,WAAW,EAAEN,EAAE,CAAE,wBAAF,CAHhB;AAICO,EAAAA,IAAI,EAAEL,SAJP;AAKCO,EAAAA,UAAU,EAAE;AAAEC,IAAAA,IAAI,EAAE;AAAR,GALb;AAMCC,EAAAA,QAAQ,EAAIC,eAAF,IAAuBA,eAAe,CAACF,IAAhB,KAAyB;AAN3D,CAXkB,CAAnB;AAqBA,eAAeP,UAAf","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { postCategories, postTerms } from '@wordpress/icons';\n\nconst variations = [\n\t{\n\t\tname: 'category',\n\t\ttitle: __( 'Post Categories' ),\n\t\tdescription: __( \"Display a post's categories.\" ),\n\t\ticon: postCategories,\n\t\tisDefault: true,\n\t\tattributes: { term: 'category' },\n\t\tisActive: ( blockAttributes ) => blockAttributes.term === 'category',\n\t},\n\n\t{\n\t\tname: 'post_tag',\n\t\ttitle: __( 'Post Tags' ),\n\t\tdescription: __( \"Display a post's tags.\" ),\n\t\ticon: postTerms,\n\t\tattributes: { term: 'post_tag' },\n\t\tisActive: ( blockAttributes ) => blockAttributes.term === 'post_tag',\n\t},\n];\n\nexport default variations;\n"]}
|
|
@@ -11,15 +11,14 @@ import classnames from 'classnames';
|
|
|
11
11
|
import { __ } from '@wordpress/i18n';
|
|
12
12
|
import { AlignmentControl, BlockControls, RichText, useBlockProps } from '@wordpress/block-editor';
|
|
13
13
|
import { createBlock } from '@wordpress/blocks';
|
|
14
|
+
import { Platform } from '@wordpress/element';
|
|
14
15
|
/**
|
|
15
16
|
* Internal dependencies
|
|
16
17
|
*/
|
|
17
18
|
|
|
18
19
|
import { Figure } from './figure';
|
|
19
20
|
import { BlockQuote } from './blockquote';
|
|
20
|
-
|
|
21
|
-
* Internal dependencies
|
|
22
|
-
*/
|
|
21
|
+
const isWebPlatform = Platform.OS === 'web';
|
|
23
22
|
|
|
24
23
|
function PullQuoteEdit(_ref) {
|
|
25
24
|
let {
|
|
@@ -61,6 +60,10 @@ function PullQuoteEdit(_ref) {
|
|
|
61
60
|
textAlign: "center"
|
|
62
61
|
}), shouldShowCitation && createElement(RichText, {
|
|
63
62
|
identifier: "citation",
|
|
63
|
+
tagName: isWebPlatform ? 'cite' : undefined,
|
|
64
|
+
style: {
|
|
65
|
+
display: 'block'
|
|
66
|
+
},
|
|
64
67
|
value: citation,
|
|
65
68
|
"aria-label": __('Pullquote citation text'),
|
|
66
69
|
placeholder: // translators: placeholder text used for the citation
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-library/src/pullquote/edit.js"],"names":["classnames","__","AlignmentControl","BlockControls","RichText","useBlockProps","createBlock","Figure","BlockQuote","PullQuoteEdit","attributes","setAttributes","isSelected","insertBlocksAfter","textAlign","citation","value","blockProps","className","shouldShowCitation","isEmpty","nextAlign","nextValue","nextCitation"],"mappings":";;AAAA;AACA;AACA;AACA,OAAOA,UAAP,MAAuB,YAAvB;AAEA;AACA;AACA;;AACA,SAASC,EAAT,QAAmB,iBAAnB;AACA,SACCC,gBADD,EAECC,aAFD,EAGCC,QAHD,EAICC,aAJD,QAKO,yBALP;AAMA,SAASC,WAAT,QAA4B,mBAA5B;AAEA;AACA;AACA;;AACA,SAASC,MAAT,QAAuB,UAAvB;AACA,SAASC,UAAT,QAA2B,cAA3B;AAEA
|
|
1
|
+
{"version":3,"sources":["@wordpress/block-library/src/pullquote/edit.js"],"names":["classnames","__","AlignmentControl","BlockControls","RichText","useBlockProps","createBlock","Platform","Figure","BlockQuote","isWebPlatform","OS","PullQuoteEdit","attributes","setAttributes","isSelected","insertBlocksAfter","textAlign","citation","value","blockProps","className","shouldShowCitation","isEmpty","nextAlign","nextValue","undefined","display","nextCitation"],"mappings":";;AAAA;AACA;AACA;AACA,OAAOA,UAAP,MAAuB,YAAvB;AAEA;AACA;AACA;;AACA,SAASC,EAAT,QAAmB,iBAAnB;AACA,SACCC,gBADD,EAECC,aAFD,EAGCC,QAHD,EAICC,aAJD,QAKO,yBALP;AAMA,SAASC,WAAT,QAA4B,mBAA5B;AACA,SAASC,QAAT,QAAyB,oBAAzB;AAEA;AACA;AACA;;AACA,SAASC,MA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ACC,IAAA,UAAU,EAAC,UADZ;AAEC,IAAA,OAAO,EAAGZ,aAAa,GAAG,MAAH,GAAYgB,SAFpC;AAGC,IAAA,KAAK,EAAG;AAAEC,MAAAA,OAAO,EAAE;AAAX,KAHT;AAIC,IAAA,KAAK,EAAGT,QAJT;AAKC,kBAAajB,EAAE,CAAE,yBAAF,CALhB;AAMC,IAAA,WAAW,EACV;AACAA,IAAAA,EAAE,CAAE,cAAF,CARJ;AAUC,IAAA,QAAQ,EAAK2B,YAAF,IACVd,aAAa,CAAE;AACdI,MAAAA,QAAQ,EAAEU;AADI,KAAF,CAXf;AAeC,IAAA,SAAS,EAAC,8BAfX;AAgBC,IAAA,8BAA8B,MAhB/B;AAiBC,IAAA,SAAS,EAAC,QAjBX;AAkBC,IAAA,sBAAsB,EAAG,MACxBZ,iBAAiB,CAChBV,WAAW,CAAE,gBAAF,CADK;AAnBnB,IAlBF,CADD,CATD,CADD;AA0DA;;AAED,eAAeM,aAAf","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport {\n\tAlignmentControl,\n\tBlockControls,\n\tRichText,\n\tuseBlockProps,\n} from '@wordpress/block-editor';\nimport { createBlock } from '@wordpress/blocks';\nimport { Platform } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { Figure } from './figure';\nimport { BlockQuote } from './blockquote';\n\nconst isWebPlatform = Platform.OS === 'web';\n\nfunction PullQuoteEdit( {\n\tattributes,\n\tsetAttributes,\n\tisSelected,\n\tinsertBlocksAfter,\n} ) {\n\tconst { textAlign, citation, value } = attributes;\n\tconst blockProps = useBlockProps( {\n\t\tclassName: classnames( {\n\t\t\t[ `has-text-align-${ textAlign }` ]: textAlign,\n\t\t} ),\n\t} );\n\tconst shouldShowCitation = ! RichText.isEmpty( citation ) || isSelected;\n\n\treturn (\n\t\t<>\n\t\t\t<BlockControls group=\"block\">\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<Figure { ...blockProps }>\n\t\t\t\t<BlockQuote>\n\t\t\t\t\t<RichText\n\t\t\t\t\t\tidentifier=\"value\"\n\t\t\t\t\t\tmultiline\n\t\t\t\t\t\tvalue={ value }\n\t\t\t\t\t\tonChange={ ( nextValue ) =>\n\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\tvalue: nextValue,\n\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t}\n\t\t\t\t\t\taria-label={ __( 'Pullquote text' ) }\n\t\t\t\t\t\tplaceholder={\n\t\t\t\t\t\t\t// translators: placeholder text used for the quote\n\t\t\t\t\t\t\t__( 'Add quote' )\n\t\t\t\t\t\t}\n\t\t\t\t\t\ttextAlign=\"center\"\n\t\t\t\t\t/>\n\t\t\t\t\t{ shouldShowCitation && (\n\t\t\t\t\t\t<RichText\n\t\t\t\t\t\t\tidentifier=\"citation\"\n\t\t\t\t\t\t\ttagName={ isWebPlatform ? 'cite' : undefined }\n\t\t\t\t\t\t\tstyle={ { display: 'block' } }\n\t\t\t\t\t\t\tvalue={ citation }\n\t\t\t\t\t\t\taria-label={ __( 'Pullquote citation text' ) }\n\t\t\t\t\t\t\tplaceholder={\n\t\t\t\t\t\t\t\t// translators: placeholder text used for the citation\n\t\t\t\t\t\t\t\t__( 'Add citation' )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tonChange={ ( nextCitation ) =>\n\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\tcitation: nextCitation,\n\t\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tclassName=\"wp-block-pullquote__citation\"\n\t\t\t\t\t\t\t__unstableMobileNoFocusOnMount\n\t\t\t\t\t\t\ttextAlign=\"center\"\n\t\t\t\t\t\t\t__unstableOnSplitAtEnd={ () =>\n\t\t\t\t\t\t\t\tinsertBlocksAfter(\n\t\t\t\t\t\t\t\t\tcreateBlock( 'core/paragraph' )\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t</BlockQuote>\n\t\t\t</Figure>\n\t\t</>\n\t);\n}\n\nexport default PullQuoteEdit;\n"]}
|
|
@@ -1,14 +1,15 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
1
2
|
import { createElement, Fragment } from "@wordpress/element";
|
|
2
3
|
|
|
3
4
|
/**
|
|
4
5
|
* WordPress dependencies
|
|
5
6
|
*/
|
|
6
7
|
import { useSelect, useDispatch } from '@wordpress/data';
|
|
7
|
-
import { cloneBlock } from '@wordpress/blocks';
|
|
8
|
+
import { store as blocksStore, cloneBlock } from '@wordpress/blocks';
|
|
8
9
|
import { useInstanceId } from '@wordpress/compose';
|
|
9
|
-
import { useEffect } from '@wordpress/element';
|
|
10
|
-
import { BlockControls, InspectorControls, useBlockProps, useSetting, store as blockEditorStore, useInnerBlocksProps, __experimentalBlockPatternSetup as BlockPatternSetup } from '@wordpress/block-editor';
|
|
11
|
-
import { SelectControl } from '@wordpress/components';
|
|
10
|
+
import { useState, useEffect } from '@wordpress/element';
|
|
11
|
+
import { BlockControls, InspectorControls, useBlockProps, useSetting, store as blockEditorStore, useInnerBlocksProps, __experimentalGetMatchingVariation as getMatchingVariation, __experimentalBlockPatternSetup as BlockPatternSetup } from '@wordpress/block-editor';
|
|
12
|
+
import { Button, SelectControl, Placeholder, Modal } from '@wordpress/components';
|
|
12
13
|
import { __ } from '@wordpress/i18n';
|
|
13
14
|
/**
|
|
14
15
|
* Internal dependencies
|
|
@@ -23,7 +24,8 @@ const TEMPLATE = [['core/post-template']];
|
|
|
23
24
|
export function QueryContent(_ref) {
|
|
24
25
|
let {
|
|
25
26
|
attributes,
|
|
26
|
-
setAttributes
|
|
27
|
+
setAttributes,
|
|
28
|
+
openPatternSelectionModal
|
|
27
29
|
} = _ref;
|
|
28
30
|
const {
|
|
29
31
|
queryId,
|
|
@@ -117,7 +119,8 @@ export function QueryContent(_ref) {
|
|
|
117
119
|
}), createElement(BlockControls, null, createElement(QueryToolbar, {
|
|
118
120
|
attributes: attributes,
|
|
119
121
|
setQuery: updateQuery,
|
|
120
|
-
setDisplayLayout: updateDisplayLayout
|
|
122
|
+
setDisplayLayout: updateDisplayLayout,
|
|
123
|
+
openPatternSelectionModal: openPatternSelectionModal
|
|
121
124
|
})), createElement(InspectorControls, {
|
|
122
125
|
__experimentalGroup: "advanced"
|
|
123
126
|
}, createElement(SelectControl, {
|
|
@@ -142,16 +145,79 @@ export function QueryContent(_ref) {
|
|
|
142
145
|
})), createElement(TagName, innerBlocksProps));
|
|
143
146
|
}
|
|
144
147
|
|
|
145
|
-
function QueryPatternSetup(
|
|
148
|
+
function QueryPatternSetup(_ref2) {
|
|
149
|
+
var _blockType$icon;
|
|
150
|
+
|
|
151
|
+
let {
|
|
152
|
+
attributes,
|
|
153
|
+
clientId,
|
|
154
|
+
name,
|
|
155
|
+
openPatternSelectionModal,
|
|
156
|
+
setAttributes
|
|
157
|
+
} = _ref2;
|
|
158
|
+
const [isStartingBlank, setIsStartingBlank] = useState(false);
|
|
159
|
+
const blockProps = useBlockProps();
|
|
160
|
+
const {
|
|
161
|
+
blockType,
|
|
162
|
+
allVariations,
|
|
163
|
+
hasPatterns
|
|
164
|
+
} = useSelect(select => {
|
|
165
|
+
const {
|
|
166
|
+
getBlockVariations,
|
|
167
|
+
getBlockType
|
|
168
|
+
} = select(blocksStore);
|
|
169
|
+
const {
|
|
170
|
+
getBlockRootClientId,
|
|
171
|
+
__experimentalGetPatternsByBlockTypes
|
|
172
|
+
} = select(blockEditorStore);
|
|
173
|
+
const rootClientId = getBlockRootClientId(clientId);
|
|
174
|
+
return {
|
|
175
|
+
blockType: getBlockType(name),
|
|
176
|
+
allVariations: getBlockVariations(name),
|
|
177
|
+
hasPatterns: !!__experimentalGetPatternsByBlockTypes(name, rootClientId).length
|
|
178
|
+
};
|
|
179
|
+
}, [name, clientId]);
|
|
180
|
+
const matchingVariation = getMatchingVariation(attributes, allVariations);
|
|
181
|
+
const icon = (matchingVariation === null || matchingVariation === void 0 ? void 0 : matchingVariation.icon) || (blockType === null || blockType === void 0 ? void 0 : (_blockType$icon = blockType.icon) === null || _blockType$icon === void 0 ? void 0 : _blockType$icon.src);
|
|
182
|
+
const label = (matchingVariation === null || matchingVariation === void 0 ? void 0 : matchingVariation.title) || (blockType === null || blockType === void 0 ? void 0 : blockType.title);
|
|
183
|
+
|
|
184
|
+
if (isStartingBlank) {
|
|
185
|
+
return createElement(QueryPlaceholder, {
|
|
186
|
+
clientId: clientId,
|
|
187
|
+
name: name,
|
|
188
|
+
setAttributes: setAttributes,
|
|
189
|
+
icon: icon,
|
|
190
|
+
label: label
|
|
191
|
+
});
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
return createElement("div", blockProps, createElement(Placeholder, {
|
|
195
|
+
icon: icon,
|
|
196
|
+
label: label,
|
|
197
|
+
instructions: __('Choose a pattern for the query loop or start blank.')
|
|
198
|
+
}, !!hasPatterns && createElement(Button, {
|
|
199
|
+
variant: "primary",
|
|
200
|
+
onClick: openPatternSelectionModal
|
|
201
|
+
}, __('Choose')), createElement(Button, {
|
|
202
|
+
variant: "secondary",
|
|
203
|
+
onClick: () => {
|
|
204
|
+
setIsStartingBlank(true);
|
|
205
|
+
}
|
|
206
|
+
}, __('Start blank'))));
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
const QueryEdit = props => {
|
|
146
210
|
const {
|
|
147
211
|
clientId,
|
|
148
|
-
name
|
|
212
|
+
name
|
|
149
213
|
} = props;
|
|
150
|
-
const
|
|
214
|
+
const [isPatternSelectionModalOpen, setIsPatternSelectionModalOpen] = useState(false);
|
|
151
215
|
const {
|
|
152
216
|
replaceBlock,
|
|
153
217
|
selectBlock
|
|
154
218
|
} = useDispatch(blockEditorStore);
|
|
219
|
+
const hasInnerBlocks = useSelect(select => !!select(blockEditorStore).getBlocks(clientId).length, [clientId]);
|
|
220
|
+
const Component = hasInnerBlocks ? QueryContent : QueryPatternSetup;
|
|
155
221
|
|
|
156
222
|
const onBlockPatternSelect = blocks => {
|
|
157
223
|
const clonedBlocks = blocks.map(block => cloneBlock(block));
|
|
@@ -161,25 +227,20 @@ function QueryPatternSetup(props) {
|
|
|
161
227
|
if (firstQueryClientId) {
|
|
162
228
|
selectBlock(firstQueryClientId);
|
|
163
229
|
}
|
|
164
|
-
};
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
230
|
+
};
|
|
231
|
+
|
|
232
|
+
return createElement(Fragment, null, createElement(Component, _extends({}, props, {
|
|
233
|
+
openPatternSelectionModal: () => setIsPatternSelectionModalOpen(true)
|
|
234
|
+
})), isPatternSelectionModalOpen && createElement(Modal, {
|
|
235
|
+
className: "block-editor-query-pattern__selection-modal",
|
|
236
|
+
title: __('Choose a pattern'),
|
|
237
|
+
closeLabel: __('Cancel'),
|
|
238
|
+
onRequestClose: () => setIsPatternSelectionModalOpen(false)
|
|
239
|
+
}, createElement(BlockPatternSetup, {
|
|
240
|
+
blockName: name,
|
|
170
241
|
clientId: clientId,
|
|
171
|
-
startBlankComponent: createElement(QueryPlaceholder, props),
|
|
172
242
|
onBlockPatternSelect: onBlockPatternSelect
|
|
173
|
-
}));
|
|
174
|
-
}
|
|
175
|
-
|
|
176
|
-
const QueryEdit = props => {
|
|
177
|
-
const {
|
|
178
|
-
clientId
|
|
179
|
-
} = props;
|
|
180
|
-
const hasInnerBlocks = useSelect(select => !!select(blockEditorStore).getBlocks(clientId).length, [clientId]);
|
|
181
|
-
const Component = hasInnerBlocks ? QueryContent : QueryPatternSetup;
|
|
182
|
-
return createElement(Component, props);
|
|
243
|
+
})));
|
|
183
244
|
};
|
|
184
245
|
|
|
185
246
|
export default QueryEdit;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-library/src/query/edit/index.js"],"names":["useSelect","useDispatch","cloneBlock","useInstanceId","useEffect","BlockControls","InspectorControls","useBlockProps","useSetting","store","blockEditorStore","useInnerBlocksProps","__experimentalBlockPatternSetup","BlockPatternSetup","SelectControl","__","QueryToolbar","QueryInspectorControls","QueryPlaceholder","DEFAULTS_POSTS_PER_PAGE","getFirstQueryClientIdFromBlocks","TEMPLATE","QueryContent","attributes","setAttributes","queryId","query","displayLayout","tagName","TagName","layout","__unstableMarkNextChangeAsNotPersistent","instanceId","themeSupportsLayout","select","getSettings","supportsLayout","defaultLayout","usedLayout","inherit","blockProps","innerBlocksProps","template","__experimentalLayout","undefined","postsPerPage","newQuery","perPage","Object","keys","length","updateQuery","Number","isFinite","updateDisplayLayout","newDisplayLayout","label","value","QueryPatternSetup","props","clientId","name","blockName","replaceBlock","selectBlock","onBlockPatternSelect","blocks","clonedBlocks","map","block","firstQueryClientId","QueryEdit","hasInnerBlocks","getBlocks","Component"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,SAAT,EAAoBC,WAApB,QAAuC,iBAAvC;AACA,SAASC,UAAT,QAA2B,mBAA3B;AACA,SAASC,aAAT,QAA8B,oBAA9B;AACA,SAASC,SAAT,QAA0B,oBAA1B;AACA,SACCC,aADD,EAECC,iBAFD,EAGCC,aAHD,EAICC,UAJD,EAKCC,KAAK,IAAIC,gBALV,EAMCC,mBAND,EAOCC,+BAA+B,IAAIC,iBAPpC,QAQO,yBARP;AASA,SAASC,aAAT,QAA8B,uBAA9B;AACA,SAASC,EAAT,QAAmB,iBAAnB;AAEA;AACA;AACA;;AACA,OAAOC,YAAP,MAAyB,iBAAzB;AACA,OAAOC,sBAAP,MAAmC,sBAAnC;AACA,OAAOC,gBAAP,MAA6B,qBAA7B;AACA,SAASC,uBAAT,QAAwC,cAAxC;AACA,SAASC,+BAAT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AF,CAAnC,CAArB;AACA,UAAMC,kBAAkB,GAAGlD,+BAA+B,CACzD+C,YADyD,CAA1D;AAGAJ,IAAAA,YAAY,CAAEH,QAAF,EAAYO,YAAZ,CAAZ;;AACA,QAAKG,kBAAL,EAA0B;AACzBN,MAAAA,WAAW,CAAEM,kBAAF,CAAX;AACA;AACD,GATD,CAJmC,CAcnC;AACA;;;AACA,SACC,qBAAU9B,UAAV,EACC,cAAC,iBAAD;AACC,IAAA,SAAS,EAAGsB,SADb;AAEC,IAAA,QAAQ,EAAGF,QAFZ;AAGC,IAAA,mBAAmB,EAAG,cAAC,gBAAD,EAAuBD,KAAvB,CAHvB;AAIC,IAAA,oBAAoB,EAAGM;AAJxB,IADD,CADD;AAUA;;AAED,MAAMM,SAAS,GAAKZ,KAAF,IAAa;AAC9B,QAAM;AAAEC,IAAAA;AAAF,MAAeD,KAArB;AACA,QAAMa,cAAc,GAAGxE,SAAS,CAC7BkC,MAAF,IACC,CAAC,CAAEA,MAAM,CAAExB,gBAAF,CAAN,CAA2B+D,SAA3B,CAAsCb,QAAtC,EAAiDV,MAFtB,EAG/B,CAAEU,QAAF,CAH+B,CAAhC;AAKA,QAAMc,SAAS,GAAGF,cAAc,GAAGlD,YAAH,GAAkBoC,iBAAlD;AACA,SAAO,cAAC,SAAD,EAAgBC,KAAhB,CAAP;AACA,CATD;;AAWA,eAAeY,SAAf","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { cloneBlock } from '@wordpress/blocks';\nimport { useInstanceId } from '@wordpress/compose';\nimport { useEffect } from '@wordpress/element';\nimport {\n\tBlockControls,\n\tInspectorControls,\n\tuseBlockProps,\n\tuseSetting,\n\tstore as blockEditorStore,\n\tuseInnerBlocksProps,\n\t__experimentalBlockPatternSetup as BlockPatternSetup,\n} from '@wordpress/block-editor';\nimport { SelectControl } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport QueryToolbar from './query-toolbar';\nimport QueryInspectorControls from './inspector-controls';\nimport QueryPlaceholder from './query-placeholder';\nimport { DEFAULTS_POSTS_PER_PAGE } from '../constants';\nimport { getFirstQueryClientIdFromBlocks } from '../utils';\n\nconst TEMPLATE = [ [ 'core/post-template' ] ];\nexport function QueryContent( { attributes, setAttributes } ) {\n\tconst {\n\t\tqueryId,\n\t\tquery,\n\t\tdisplayLayout,\n\t\ttagName: TagName = 'div',\n\t\tlayout = {},\n\t} = attributes;\n\tconst { __unstableMarkNextChangeAsNotPersistent } = useDispatch(\n\t\tblockEditorStore\n\t);\n\tconst instanceId = useInstanceId( QueryContent );\n\tconst { themeSupportsLayout } = useSelect( ( select ) => {\n\t\tconst { getSettings } = select( blockEditorStore );\n\t\treturn { themeSupportsLayout: getSettings()?.supportsLayout };\n\t}, [] );\n\tconst defaultLayout = useSetting( 'layout' ) || {};\n\tconst usedLayout = !! layout && layout.inherit ? defaultLayout : layout;\n\tconst blockProps = useBlockProps();\n\tconst innerBlocksProps = useInnerBlocksProps( blockProps, {\n\t\ttemplate: TEMPLATE,\n\t\t__experimentalLayout: themeSupportsLayout ? usedLayout : undefined,\n\t} );\n\tconst { postsPerPage } = useSelect( ( select ) => {\n\t\tconst { getSettings } = select( blockEditorStore );\n\t\treturn {\n\t\t\tpostsPerPage:\n\t\t\t\t+getSettings().postsPerPage || DEFAULTS_POSTS_PER_PAGE,\n\t\t};\n\t}, [] );\n\t// There are some effects running where some initialization logic is\n\t// happening and setting some values to some attributes (ex. queryId).\n\t// These updates can cause an `undo trap` where undoing will result in\n\t// resetting again, so we need to mark these changes as not persistent\n\t// with `__unstableMarkNextChangeAsNotPersistent`.\n\n\t// Changes in query property (which is an object) need to be in the same callback,\n\t// because updates are batched after the render and changes in different query properties\n\t// would cause to override previous wanted changes.\n\tuseEffect( () => {\n\t\tconst newQuery = {};\n\t\tif ( ! query.perPage && postsPerPage ) {\n\t\t\tnewQuery.perPage = postsPerPage;\n\t\t}\n\t\tif ( !! Object.keys( newQuery ).length ) {\n\t\t\t__unstableMarkNextChangeAsNotPersistent();\n\t\t\tupdateQuery( newQuery );\n\t\t}\n\t}, [ query.perPage ] );\n\t// We need this for multi-query block pagination.\n\t// Query parameters for each block are scoped to their ID.\n\tuseEffect( () => {\n\t\tif ( ! Number.isFinite( queryId ) ) {\n\t\t\t__unstableMarkNextChangeAsNotPersistent();\n\t\t\tsetAttributes( { queryId: instanceId } );\n\t\t}\n\t}, [ queryId, instanceId ] );\n\tconst updateQuery = ( newQuery ) =>\n\t\tsetAttributes( { query: { ...query, ...newQuery } } );\n\tconst updateDisplayLayout = ( newDisplayLayout ) =>\n\t\tsetAttributes( {\n\t\t\tdisplayLayout: { ...displayLayout, ...newDisplayLayout },\n\t\t} );\n\treturn (\n\t\t<>\n\t\t\t<QueryInspectorControls\n\t\t\t\tattributes={ attributes }\n\t\t\t\tsetQuery={ updateQuery }\n\t\t\t\tsetDisplayLayout={ updateDisplayLayout }\n\t\t\t/>\n\t\t\t<BlockControls>\n\t\t\t\t<QueryToolbar\n\t\t\t\t\tattributes={ attributes }\n\t\t\t\t\tsetQuery={ updateQuery }\n\t\t\t\t\tsetDisplayLayout={ updateDisplayLayout }\n\t\t\t\t/>\n\t\t\t</BlockControls>\n\t\t\t<InspectorControls __experimentalGroup=\"advanced\">\n\t\t\t\t<SelectControl\n\t\t\t\t\tlabel={ __( 'HTML element' ) }\n\t\t\t\t\toptions={ [\n\t\t\t\t\t\t{ label: __( 'Default (<div>)' ), value: 'div' },\n\t\t\t\t\t\t{ label: '<main>', value: 'main' },\n\t\t\t\t\t\t{ label: '<section>', value: 'section' },\n\t\t\t\t\t\t{ label: '<aside>', value: 'aside' },\n\t\t\t\t\t] }\n\t\t\t\t\tvalue={ TagName }\n\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\tsetAttributes( { tagName: value } )\n\t\t\t\t\t}\n\t\t\t\t/>\n\t\t\t</InspectorControls>\n\t\t\t<TagName { ...innerBlocksProps } />\n\t\t</>\n\t);\n}\n\nfunction QueryPatternSetup( props ) {\n\tconst { clientId, name: blockName } = props;\n\tconst blockProps = useBlockProps();\n\tconst { replaceBlock, selectBlock } = useDispatch( blockEditorStore );\n\tconst onBlockPatternSelect = ( blocks ) => {\n\t\tconst clonedBlocks = blocks.map( ( block ) => cloneBlock( block ) );\n\t\tconst firstQueryClientId = getFirstQueryClientIdFromBlocks(\n\t\t\tclonedBlocks\n\t\t);\n\t\treplaceBlock( clientId, clonedBlocks );\n\t\tif ( firstQueryClientId ) {\n\t\t\tselectBlock( firstQueryClientId );\n\t\t}\n\t};\n\t// `startBlankComponent` is what to render when clicking `Start blank`\n\t// or if no matched patterns are found.\n\treturn (\n\t\t<div { ...blockProps }>\n\t\t\t<BlockPatternSetup\n\t\t\t\tblockName={ blockName }\n\t\t\t\tclientId={ clientId }\n\t\t\t\tstartBlankComponent={ <QueryPlaceholder { ...props } /> }\n\t\t\t\tonBlockPatternSelect={ onBlockPatternSelect }\n\t\t\t/>\n\t\t</div>\n\t);\n}\n\nconst QueryEdit = ( props ) => {\n\tconst { clientId } = props;\n\tconst hasInnerBlocks = useSelect(\n\t\t( select ) =>\n\t\t\t!! select( blockEditorStore ).getBlocks( clientId ).length,\n\t\t[ clientId ]\n\t);\n\tconst Component = hasInnerBlocks ? QueryContent : QueryPatternSetup;\n\treturn <Component { ...props } />;\n};\n\nexport default QueryEdit;\n"]}
|
|
1
|
+
{"version":3,"sources":["@wordpress/block-library/src/query/edit/index.js"],"names":["useSelect","useDispatch","store","blocksStore","cloneBlock","useInstanceId","useState","useEffect","BlockControls","InspectorControls","useBlockProps","useSetting","blockEditorStore","useInnerBlocksProps","__experimentalGetMatchingVariation","getMatchingVariation","__experimentalBlockPatternSetup","BlockPatternSetup","Button","SelectControl","Placeholder","Modal","__","QueryToolbar","QueryInspectorControls","QueryPlaceholder","DEFAULTS_POSTS_PER_PAGE","getFirstQueryClientIdFromBlocks","TEMPLATE","QueryContent","attributes","setAttributes","openPatternSelectionModal","queryId","query","displayLayout","tagName","TagName","layout","__unstableMarkNextChangeAsNotPersistent","instanceId","themeSupportsLayout","select","getSettings","supportsLayout","defaultLayout","usedLayout","inherit","blockProps","innerBlocksProps","template","__experimentalLayout","undefined","postsPerPage","newQuery","perPage","Object","keys","length","updateQuery","Number","isFinite","updateDisplayLayout","newDisplayLayout","label","value","QueryPatternSetup","clientId","name","isStartingBlank","setIsStartingBlank","blockType","allVariations","hasPatterns","getBlockVariations","getBlockType","getBlockRootClientId","__experimentalGetPatternsByBlockTypes","rootClientId","matchingVariation","icon","src","title","QueryEdit","props","isPatternSelectionModalOpen","setIsPatternSelectionModalOpen","replaceBlock","selectBlock","hasInnerBlocks","getBlocks","Component","onBlockPatternSelect","blocks","clonedBlocks","map","block","firstQueryClientId"],"mappings":";;;AAAA;AACA;AACA;AACA,SAASA,SAAT,EAAoBC,WAApB,QAAuC,iBAAvC;AACA,SAASC,KAAK,IAAIC,WAAlB,EAA+BC,UAA/B,QAAiD,mBAAjD;AACA,SAASC,aAAT,QAA8B,oBAA9B;AACA,SAASC,QAAT,EAAmBC,SAAnB,QAAoC,oBAApC;AACA,SACCC,aADD,EAECC,iBAFD,EAGCC,aAHD,EAICC,UAJD,EAKCT,KAAK,IAAIU,gBALV,EAMCC,mBAND,EAOCC,kCAAkC,IAAIC,oBAPvC,EAQCC,+BAA+B,IAAIC,iBARpC,QASO,yBATP;AAUA,SACCC,MADD,EAECC,aAFD,EAGCC,WAHD,EAICC,KAJD,QAKO,uBALP;AAMA,SAASC,EAAT,QAAmB,iBAAnB;AAEA;AACA;AACA;;AACA,OAAOC,YAAP,MAAyB,iBAAzB;AACA,OAAOC,sBAAP,MAAmC,sBAAnC;AACA,OAAOC,gBAAP,MAA6B,qBAA7B;AACA,SAASC,uBAAT,QAAwC,cAAxC;AACA,SAASC,+BAAT,QAAgD,UAAhD;AAEA,MAAMC,QAAQ,GAAG,CAAE,CAAE,oBAAF,CAAF,CAAjB;AACA,OAAO,SAASC,Y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T,MAAAA,WAAW,CAAES,kBAAF,CAAX;AACA;AACD,GATD;;AAUA,SACC,8BACC,cAAC,SAAD,eACMb,KADN;AAEC,IAAA,yBAAyB,EAAG,MAC3BE,8BAA8B,CAAE,IAAF;AAHhC,KADD,EAOGD,2BAA2B,IAC5B,cAAC,KAAD;AACC,IAAA,SAAS,EAAC,6CADX;AAEC,IAAA,KAAK,EAAG/D,EAAE,CAAE,kBAAF,CAFX;AAGC,IAAA,UAAU,EAAGA,EAAE,CAAE,QAAF,CAHhB;AAIC,IAAA,cAAc,EAAG,MAChBgE,8BAA8B,CAAE,KAAF;AALhC,KAQC,cAAC,iBAAD;AACC,IAAA,SAAS,EAAGlB,IADb;AAEC,IAAA,QAAQ,EAAGD,QAFZ;AAGC,IAAA,oBAAoB,EAAGyB;AAHxB,IARD,CARF,CADD;AA0BA,CAjDD;;AAmDA,eAAeT,SAAf","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { store as blocksStore, cloneBlock } from '@wordpress/blocks';\nimport { useInstanceId } from '@wordpress/compose';\nimport { useState, useEffect } from '@wordpress/element';\nimport {\n\tBlockControls,\n\tInspectorControls,\n\tuseBlockProps,\n\tuseSetting,\n\tstore as blockEditorStore,\n\tuseInnerBlocksProps,\n\t__experimentalGetMatchingVariation as getMatchingVariation,\n\t__experimentalBlockPatternSetup as BlockPatternSetup,\n} from '@wordpress/block-editor';\nimport {\n\tButton,\n\tSelectControl,\n\tPlaceholder,\n\tModal,\n} from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport QueryToolbar from './query-toolbar';\nimport QueryInspectorControls from './inspector-controls';\nimport QueryPlaceholder from './query-placeholder';\nimport { DEFAULTS_POSTS_PER_PAGE } from '../constants';\nimport { getFirstQueryClientIdFromBlocks } from '../utils';\n\nconst TEMPLATE = [ [ 'core/post-template' ] ];\nexport function QueryContent( {\n\tattributes,\n\tsetAttributes,\n\topenPatternSelectionModal,\n} ) {\n\tconst {\n\t\tqueryId,\n\t\tquery,\n\t\tdisplayLayout,\n\t\ttagName: TagName = 'div',\n\t\tlayout = {},\n\t} = attributes;\n\tconst { __unstableMarkNextChangeAsNotPersistent } = useDispatch(\n\t\tblockEditorStore\n\t);\n\tconst instanceId = useInstanceId( QueryContent );\n\tconst { themeSupportsLayout } = useSelect( ( select ) => {\n\t\tconst { getSettings } = select( blockEditorStore );\n\t\treturn { themeSupportsLayout: getSettings()?.supportsLayout };\n\t}, [] );\n\tconst defaultLayout = useSetting( 'layout' ) || {};\n\tconst usedLayout = !! layout && layout.inherit ? defaultLayout : layout;\n\tconst blockProps = useBlockProps();\n\tconst innerBlocksProps = useInnerBlocksProps( blockProps, {\n\t\ttemplate: TEMPLATE,\n\t\t__experimentalLayout: themeSupportsLayout ? usedLayout : undefined,\n\t} );\n\tconst { postsPerPage } = useSelect( ( select ) => {\n\t\tconst { getSettings } = select( blockEditorStore );\n\t\treturn {\n\t\t\tpostsPerPage:\n\t\t\t\t+getSettings().postsPerPage || DEFAULTS_POSTS_PER_PAGE,\n\t\t};\n\t}, [] );\n\t// There are some effects running where some initialization logic is\n\t// happening and setting some values to some attributes (ex. queryId).\n\t// These updates can cause an `undo trap` where undoing will result in\n\t// resetting again, so we need to mark these changes as not persistent\n\t// with `__unstableMarkNextChangeAsNotPersistent`.\n\n\t// Changes in query property (which is an object) need to be in the same callback,\n\t// because updates are batched after the render and changes in different query properties\n\t// would cause to override previous wanted changes.\n\tuseEffect( () => {\n\t\tconst newQuery = {};\n\t\tif ( ! query.perPage && postsPerPage ) {\n\t\t\tnewQuery.perPage = postsPerPage;\n\t\t}\n\t\tif ( !! Object.keys( newQuery ).length ) {\n\t\t\t__unstableMarkNextChangeAsNotPersistent();\n\t\t\tupdateQuery( newQuery );\n\t\t}\n\t}, [ query.perPage ] );\n\t// We need this for multi-query block pagination.\n\t// Query parameters for each block are scoped to their ID.\n\tuseEffect( () => {\n\t\tif ( ! Number.isFinite( queryId ) ) {\n\t\t\t__unstableMarkNextChangeAsNotPersistent();\n\t\t\tsetAttributes( { queryId: instanceId } );\n\t\t}\n\t}, [ queryId, instanceId ] );\n\tconst updateQuery = ( newQuery ) =>\n\t\tsetAttributes( { query: { ...query, ...newQuery } } );\n\tconst updateDisplayLayout = ( newDisplayLayout ) =>\n\t\tsetAttributes( {\n\t\t\tdisplayLayout: { ...displayLayout, ...newDisplayLayout },\n\t\t} );\n\treturn (\n\t\t<>\n\t\t\t<QueryInspectorControls\n\t\t\t\tattributes={ attributes }\n\t\t\t\tsetQuery={ updateQuery }\n\t\t\t\tsetDisplayLayout={ updateDisplayLayout }\n\t\t\t/>\n\t\t\t<BlockControls>\n\t\t\t\t<QueryToolbar\n\t\t\t\t\tattributes={ attributes }\n\t\t\t\t\tsetQuery={ updateQuery }\n\t\t\t\t\tsetDisplayLayout={ updateDisplayLayout }\n\t\t\t\t\topenPatternSelectionModal={ openPatternSelectionModal }\n\t\t\t\t/>\n\t\t\t</BlockControls>\n\t\t\t<InspectorControls __experimentalGroup=\"advanced\">\n\t\t\t\t<SelectControl\n\t\t\t\t\tlabel={ __( 'HTML element' ) }\n\t\t\t\t\toptions={ [\n\t\t\t\t\t\t{ label: __( 'Default (<div>)' ), value: 'div' },\n\t\t\t\t\t\t{ label: '<main>', value: 'main' },\n\t\t\t\t\t\t{ label: '<section>', value: 'section' },\n\t\t\t\t\t\t{ label: '<aside>', value: 'aside' },\n\t\t\t\t\t] }\n\t\t\t\t\tvalue={ TagName }\n\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\tsetAttributes( { tagName: value } )\n\t\t\t\t\t}\n\t\t\t\t/>\n\t\t\t</InspectorControls>\n\t\t\t<TagName { ...innerBlocksProps } />\n\t\t</>\n\t);\n}\n\nfunction QueryPatternSetup( {\n\tattributes,\n\tclientId,\n\tname,\n\topenPatternSelectionModal,\n\tsetAttributes,\n} ) {\n\tconst [ isStartingBlank, setIsStartingBlank ] = useState( false );\n\tconst blockProps = useBlockProps();\n\n\tconst { blockType, allVariations, hasPatterns } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getBlockVariations, getBlockType } = select( blocksStore );\n\t\t\tconst {\n\t\t\t\tgetBlockRootClientId,\n\t\t\t\t__experimentalGetPatternsByBlockTypes,\n\t\t\t} = select( blockEditorStore );\n\t\t\tconst rootClientId = getBlockRootClientId( clientId );\n\n\t\t\treturn {\n\t\t\t\tblockType: getBlockType( name ),\n\t\t\t\tallVariations: getBlockVariations( name ),\n\t\t\t\thasPatterns: !! __experimentalGetPatternsByBlockTypes(\n\t\t\t\t\tname,\n\t\t\t\t\trootClientId\n\t\t\t\t).length,\n\t\t\t};\n\t\t},\n\t\t[ name, clientId ]\n\t);\n\n\tconst matchingVariation = getMatchingVariation( attributes, allVariations );\n\tconst icon = matchingVariation?.icon || blockType?.icon?.src;\n\tconst label = matchingVariation?.title || blockType?.title;\n\tif ( isStartingBlank ) {\n\t\treturn (\n\t\t\t<QueryPlaceholder\n\t\t\t\tclientId={ clientId }\n\t\t\t\tname={ name }\n\t\t\t\tsetAttributes={ setAttributes }\n\t\t\t\ticon={ icon }\n\t\t\t\tlabel={ label }\n\t\t\t/>\n\t\t);\n\t}\n\treturn (\n\t\t<div { ...blockProps }>\n\t\t\t<Placeholder\n\t\t\t\ticon={ icon }\n\t\t\t\tlabel={ label }\n\t\t\t\tinstructions={ __(\n\t\t\t\t\t'Choose a pattern for the query loop or start blank.'\n\t\t\t\t) }\n\t\t\t>\n\t\t\t\t{ !! hasPatterns && (\n\t\t\t\t\t<Button\n\t\t\t\t\t\tvariant=\"primary\"\n\t\t\t\t\t\tonClick={ openPatternSelectionModal }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Choose' ) }\n\t\t\t\t\t</Button>\n\t\t\t\t) }\n\n\t\t\t\t<Button\n\t\t\t\t\tvariant=\"secondary\"\n\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\tsetIsStartingBlank( true );\n\t\t\t\t\t} }\n\t\t\t\t>\n\t\t\t\t\t{ __( 'Start blank' ) }\n\t\t\t\t</Button>\n\t\t\t</Placeholder>\n\t\t</div>\n\t);\n}\n\nconst QueryEdit = ( props ) => {\n\tconst { clientId, name } = props;\n\tconst [\n\t\tisPatternSelectionModalOpen,\n\t\tsetIsPatternSelectionModalOpen,\n\t] = useState( false );\n\tconst { replaceBlock, selectBlock } = useDispatch( blockEditorStore );\n\tconst hasInnerBlocks = useSelect(\n\t\t( select ) =>\n\t\t\t!! select( blockEditorStore ).getBlocks( clientId ).length,\n\t\t[ clientId ]\n\t);\n\tconst Component = hasInnerBlocks ? QueryContent : QueryPatternSetup;\n\tconst onBlockPatternSelect = ( blocks ) => {\n\t\tconst clonedBlocks = blocks.map( ( block ) => cloneBlock( block ) );\n\t\tconst firstQueryClientId = getFirstQueryClientIdFromBlocks(\n\t\t\tclonedBlocks\n\t\t);\n\t\treplaceBlock( clientId, clonedBlocks );\n\t\tif ( firstQueryClientId ) {\n\t\t\tselectBlock( firstQueryClientId );\n\t\t}\n\t};\n\treturn (\n\t\t<>\n\t\t\t<Component\n\t\t\t\t{ ...props }\n\t\t\t\topenPatternSelectionModal={ () =>\n\t\t\t\t\tsetIsPatternSelectionModalOpen( true )\n\t\t\t\t}\n\t\t\t/>\n\t\t\t{ isPatternSelectionModalOpen && (\n\t\t\t\t<Modal\n\t\t\t\t\tclassName=\"block-editor-query-pattern__selection-modal\"\n\t\t\t\t\ttitle={ __( 'Choose a pattern' ) }\n\t\t\t\t\tcloseLabel={ __( 'Cancel' ) }\n\t\t\t\t\tonRequestClose={ () =>\n\t\t\t\t\t\tsetIsPatternSelectionModalOpen( false )\n\t\t\t\t\t}\n\t\t\t\t>\n\t\t\t\t\t<BlockPatternSetup\n\t\t\t\t\t\tblockName={ name }\n\t\t\t\t\t\tclientId={ clientId }\n\t\t\t\t\t\tonBlockPatternSelect={ onBlockPatternSelect }\n\t\t\t\t\t/>\n\t\t\t\t</Modal>\n\t\t\t) }\n\t\t</>\n\t);\n};\n\nexport default QueryEdit;\n"]}
|
|
@@ -4,23 +4,20 @@ import { createElement } from "@wordpress/element";
|
|
|
4
4
|
* WordPress dependencies
|
|
5
5
|
*/
|
|
6
6
|
import { useSelect, useDispatch } from '@wordpress/data';
|
|
7
|
-
import { useBlockProps, __experimentalBlockVariationPicker,
|
|
7
|
+
import { useBlockProps, __experimentalBlockVariationPicker, store as blockEditorStore } from '@wordpress/block-editor';
|
|
8
8
|
import { createBlocksFromInnerBlocksTemplate, store as blocksStore } from '@wordpress/blocks';
|
|
9
9
|
|
|
10
|
-
|
|
11
|
-
var _blockType$icon;
|
|
12
|
-
|
|
10
|
+
function QueryPlaceholder(_ref) {
|
|
13
11
|
let {
|
|
14
12
|
clientId,
|
|
15
13
|
name,
|
|
16
|
-
|
|
17
|
-
|
|
14
|
+
setAttributes,
|
|
15
|
+
icon,
|
|
16
|
+
label
|
|
18
17
|
} = _ref;
|
|
19
18
|
const {
|
|
20
|
-
blockType,
|
|
21
19
|
defaultVariation,
|
|
22
|
-
scopeVariations
|
|
23
|
-
allVariations
|
|
20
|
+
scopeVariations
|
|
24
21
|
} = useSelect(select => {
|
|
25
22
|
const {
|
|
26
23
|
getBlockVariations,
|
|
@@ -30,17 +27,13 @@ const QueryPlaceholder = _ref => {
|
|
|
30
27
|
return {
|
|
31
28
|
blockType: getBlockType(name),
|
|
32
29
|
defaultVariation: getDefaultBlockVariation(name, 'block'),
|
|
33
|
-
scopeVariations: getBlockVariations(name, 'block')
|
|
34
|
-
allVariations: getBlockVariations(name)
|
|
30
|
+
scopeVariations: getBlockVariations(name, 'block')
|
|
35
31
|
};
|
|
36
32
|
}, [name]);
|
|
37
33
|
const {
|
|
38
34
|
replaceInnerBlocks
|
|
39
35
|
} = useDispatch(blockEditorStore);
|
|
40
36
|
const blockProps = useBlockProps();
|
|
41
|
-
const matchingVariation = getMatchingVariation(attributes, allVariations);
|
|
42
|
-
const icon = (matchingVariation === null || matchingVariation === void 0 ? void 0 : matchingVariation.icon) || (blockType === null || blockType === void 0 ? void 0 : (_blockType$icon = blockType.icon) === null || _blockType$icon === void 0 ? void 0 : _blockType$icon.src);
|
|
43
|
-
const label = (matchingVariation === null || matchingVariation === void 0 ? void 0 : matchingVariation.title) || (blockType === null || blockType === void 0 ? void 0 : blockType.title);
|
|
44
37
|
return createElement("div", blockProps, createElement(__experimentalBlockVariationPicker, {
|
|
45
38
|
icon: icon,
|
|
46
39
|
label: label,
|
|
@@ -57,7 +50,7 @@ const QueryPlaceholder = _ref => {
|
|
|
57
50
|
}
|
|
58
51
|
}
|
|
59
52
|
}));
|
|
60
|
-
}
|
|
53
|
+
}
|
|
61
54
|
|
|
62
55
|
export default QueryPlaceholder;
|
|
63
56
|
//# sourceMappingURL=query-placeholder.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-library/src/query/edit/query-placeholder.js"],"names":["useSelect","useDispatch","useBlockProps","__experimentalBlockVariationPicker","
|
|
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","attributes","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,OAA4E;AAAA,MAAjD;AAAEC,IAAAA,QAAF;AAAYC,IAAAA,IAAZ;AAAkBC,IAAAA,aAAlB;AAAiCC,IAAAA,IAAjC;AAAuCC,IAAAA;AAAvC,GAAiD;AAC3E,QAAM;AAAEC,IAAAA,gBAAF;AAAoBC,IAAAA;AAApB,MAAwCf,SAAS,CACpDgB,MAAF,IAAc;AACb,UAAM;AACLC,MAAAA,kBADK;AAELC,MAAAA,YAFK;AAGLC,MAAAA;AAHK,QAIFH,MAAM,CAAET,WAAF,CAJV;AAMA,WAAO;AACNa,MAAAA,SAAS,EAAEF,YAAY,CAAER,IAAF,CADjB;AAENI,MAAAA,gBAAgB,EAAEK,wBAAwB,CAAET,IAAF,EAAQ,OAAR,CAFpC;AAGNK,MAAAA,eAAe,EAAEE,kBAAkB,CAAEP,IAAF,EAAQ,OAAR;AAH7B,KAAP;AAKA,GAbqD,EActD,CAAEA,IAAF,CAdsD,CAAvD;AAgBA,QAAM;AAAEW,IAAAA;AAAF,MAAyBpB,WAAW,CAAEI,gBAAF,CAA1C;AACA,QAAMiB,UAAU,GAAGpB,aAAa,EAAhC;AACA,SACC,qBAAUoB,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,CAACC,UAAnB,EAAgC;AAC/Bb,QAAAA,aAAa,CAAEY,aAAa,CAACC,UAAhB,CAAb;AACA;;AACD,UAAKD,aAAa,CAACE,WAAnB,EAAiC;AAChCJ,QAAAA,kBAAkB,CACjBZ,QADiB,EAEjBH,mCAAmC,CAClCiB,aAAa,CAACE,WADoB,CAFlB,EAKjB,KALiB,CAAlB;AAOA;AACD;AAjBF,IADD,CADD;AAuBA;;AAED,eAAejB,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( { clientId, name, setAttributes, icon, label } ) {\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( nextVariation.attributes );\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"]}
|
|
@@ -14,7 +14,8 @@ export default function QueryToolbar(_ref) {
|
|
|
14
14
|
displayLayout
|
|
15
15
|
},
|
|
16
16
|
setQuery,
|
|
17
|
-
setDisplayLayout
|
|
17
|
+
setDisplayLayout,
|
|
18
|
+
openPatternSelectionModal
|
|
18
19
|
} = _ref;
|
|
19
20
|
const maxPageInputId = useInstanceId(QueryToolbar, 'blocks-query-pagination-max-page-input');
|
|
20
21
|
const displayLayoutControls = [{
|
|
@@ -104,6 +105,10 @@ export default function QueryToolbar(_ref) {
|
|
|
104
105
|
isDragEnabled: false
|
|
105
106
|
})))
|
|
106
107
|
})), createElement(ToolbarGroup, {
|
|
108
|
+
className: "wp-block-template-part__block-control-group"
|
|
109
|
+
}, createElement(ToolbarButton, {
|
|
110
|
+
onClick: openPatternSelectionModal
|
|
111
|
+
}, __('Replace'))), createElement(ToolbarGroup, {
|
|
107
112
|
controls: displayLayoutControls
|
|
108
113
|
}));
|
|
109
114
|
}
|