@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
package/src/cover/edit.js
CHANGED
|
@@ -9,7 +9,14 @@ import namesPlugin from 'colord/plugins/names';
|
|
|
9
9
|
/**
|
|
10
10
|
* WordPress dependencies
|
|
11
11
|
*/
|
|
12
|
-
import {
|
|
12
|
+
import { useEntityProp, store as coreStore } from '@wordpress/core-data';
|
|
13
|
+
import {
|
|
14
|
+
Fragment,
|
|
15
|
+
useEffect,
|
|
16
|
+
useRef,
|
|
17
|
+
useState,
|
|
18
|
+
useMemo,
|
|
19
|
+
} from '@wordpress/element';
|
|
13
20
|
import {
|
|
14
21
|
BaseControl,
|
|
15
22
|
Button,
|
|
@@ -22,10 +29,12 @@ import {
|
|
|
22
29
|
Spinner,
|
|
23
30
|
TextareaControl,
|
|
24
31
|
ToggleControl,
|
|
25
|
-
|
|
32
|
+
ToolbarButton,
|
|
26
33
|
__experimentalUseCustomUnits as useCustomUnits,
|
|
27
34
|
__experimentalBoxControl as BoxControl,
|
|
28
35
|
__experimentalToolsPanelItem as ToolsPanelItem,
|
|
36
|
+
__experimentalUnitControl as UnitControl,
|
|
37
|
+
__experimentalParseQuantityAndUnitFromRawValue as parseQuantityAndUnitFromRawValue,
|
|
29
38
|
} from '@wordpress/components';
|
|
30
39
|
import { compose, useInstanceId } from '@wordpress/compose';
|
|
31
40
|
import {
|
|
@@ -41,15 +50,15 @@ import {
|
|
|
41
50
|
useInnerBlocksProps,
|
|
42
51
|
__experimentalUseGradient,
|
|
43
52
|
__experimentalPanelColorGradientSettings as PanelColorGradientSettings,
|
|
44
|
-
__experimentalUnitControl as UnitControl,
|
|
45
53
|
__experimentalBlockAlignmentMatrixControl as BlockAlignmentMatrixControl,
|
|
46
54
|
__experimentalBlockFullHeightAligmentControl as FullHeightAlignmentControl,
|
|
47
55
|
store as blockEditorStore,
|
|
48
56
|
} from '@wordpress/block-editor';
|
|
49
57
|
import { __ } from '@wordpress/i18n';
|
|
50
58
|
import { useSelect, useDispatch } from '@wordpress/data';
|
|
51
|
-
import { cover as icon } from '@wordpress/icons';
|
|
59
|
+
import { postFeaturedImage, cover as icon } from '@wordpress/icons';
|
|
52
60
|
import { isBlobURL } from '@wordpress/blob';
|
|
61
|
+
import { store as noticesStore } from '@wordpress/notices';
|
|
53
62
|
|
|
54
63
|
/**
|
|
55
64
|
* Internal dependencies
|
|
@@ -96,8 +105,6 @@ function CoverHeightInput( {
|
|
|
96
105
|
unit = 'px',
|
|
97
106
|
value = '',
|
|
98
107
|
} ) {
|
|
99
|
-
const [ temporaryInput, setTemporaryInput ] = useState( null );
|
|
100
|
-
|
|
101
108
|
const instanceId = useInstanceId( UnitControl );
|
|
102
109
|
const inputId = `block-cover-height-input-${ instanceId }`;
|
|
103
110
|
const isPx = unit === 'px';
|
|
@@ -120,20 +127,16 @@ function CoverHeightInput( {
|
|
|
120
127
|
: undefined;
|
|
121
128
|
|
|
122
129
|
if ( isNaN( inputValue ) && inputValue !== undefined ) {
|
|
123
|
-
setTemporaryInput( unprocessedValue );
|
|
124
130
|
return;
|
|
125
131
|
}
|
|
126
|
-
setTemporaryInput( null );
|
|
127
132
|
onChange( inputValue );
|
|
128
133
|
};
|
|
129
134
|
|
|
130
|
-
const
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
};
|
|
135
|
+
const computedValue = useMemo( () => {
|
|
136
|
+
const [ parsedQuantity ] = parseQuantityAndUnitFromRawValue( value );
|
|
137
|
+
return [ parsedQuantity, unit ].join( '' );
|
|
138
|
+
}, [ unit, value ] );
|
|
135
139
|
|
|
136
|
-
const inputValue = temporaryInput !== null ? temporaryInput : value;
|
|
137
140
|
const min = isPx ? COVER_MIN_HEIGHT : 0;
|
|
138
141
|
|
|
139
142
|
return (
|
|
@@ -142,13 +145,11 @@ function CoverHeightInput( {
|
|
|
142
145
|
id={ inputId }
|
|
143
146
|
isResetValueOnUnitChange
|
|
144
147
|
min={ min }
|
|
145
|
-
onBlur={ handleOnBlur }
|
|
146
148
|
onChange={ handleOnChange }
|
|
147
149
|
onUnitChange={ onUnitChange }
|
|
148
150
|
style={ { maxWidth: 80 } }
|
|
149
|
-
unit={ unit }
|
|
150
151
|
units={ units }
|
|
151
|
-
value={
|
|
152
|
+
value={ computedValue }
|
|
152
153
|
/>
|
|
153
154
|
</BaseControl>
|
|
154
155
|
);
|
|
@@ -266,12 +267,10 @@ const isTemporaryMedia = ( id, url ) => ! id && isBlobURL( url );
|
|
|
266
267
|
function CoverPlaceholder( {
|
|
267
268
|
disableMediaButtons = false,
|
|
268
269
|
children,
|
|
269
|
-
noticeUI,
|
|
270
|
-
noticeOperations,
|
|
271
270
|
onSelectMedia,
|
|
271
|
+
onError,
|
|
272
272
|
style,
|
|
273
273
|
} ) {
|
|
274
|
-
const { removeAllNotices, createErrorNotice } = noticeOperations;
|
|
275
274
|
return (
|
|
276
275
|
<MediaPlaceholder
|
|
277
276
|
icon={ <BlockIcon icon={ icon } /> }
|
|
@@ -284,12 +283,8 @@ function CoverPlaceholder( {
|
|
|
284
283
|
onSelect={ onSelectMedia }
|
|
285
284
|
accept="image/*,video/*"
|
|
286
285
|
allowedTypes={ ALLOWED_MEDIA_TYPES }
|
|
287
|
-
notices={ noticeUI }
|
|
288
286
|
disableMediaButtons={ disableMediaButtons }
|
|
289
|
-
onError={
|
|
290
|
-
removeAllNotices();
|
|
291
|
-
createErrorNotice( message );
|
|
292
|
-
} }
|
|
287
|
+
onError={ onError }
|
|
293
288
|
style={ style }
|
|
294
289
|
>
|
|
295
290
|
{ children }
|
|
@@ -301,17 +296,16 @@ function CoverEdit( {
|
|
|
301
296
|
attributes,
|
|
302
297
|
clientId,
|
|
303
298
|
isSelected,
|
|
304
|
-
noticeUI,
|
|
305
|
-
noticeOperations,
|
|
306
299
|
overlayColor,
|
|
307
300
|
setAttributes,
|
|
308
301
|
setOverlayColor,
|
|
309
302
|
toggleSelection,
|
|
303
|
+
context: { postId, postType },
|
|
310
304
|
} ) {
|
|
311
305
|
const {
|
|
312
306
|
contentPosition,
|
|
313
307
|
id,
|
|
314
|
-
|
|
308
|
+
useFeaturedImage,
|
|
315
309
|
dimRatio,
|
|
316
310
|
focalPoint,
|
|
317
311
|
hasParallax,
|
|
@@ -320,14 +314,39 @@ function CoverEdit( {
|
|
|
320
314
|
minHeight,
|
|
321
315
|
minHeightUnit,
|
|
322
316
|
style: styleAttribute,
|
|
323
|
-
url,
|
|
324
317
|
alt,
|
|
325
318
|
allowedBlocks,
|
|
326
319
|
templateLock,
|
|
327
320
|
} = attributes;
|
|
321
|
+
|
|
322
|
+
const [ featuredImage ] = useEntityProp(
|
|
323
|
+
'postType',
|
|
324
|
+
postType,
|
|
325
|
+
'featured_media',
|
|
326
|
+
postId
|
|
327
|
+
);
|
|
328
|
+
|
|
329
|
+
const media = useSelect(
|
|
330
|
+
( select ) =>
|
|
331
|
+
featuredImage &&
|
|
332
|
+
select( coreStore ).getMedia( featuredImage, { context: 'view' } ),
|
|
333
|
+
[ featuredImage ]
|
|
334
|
+
);
|
|
335
|
+
const mediaUrl = media?.source_url;
|
|
336
|
+
|
|
337
|
+
// instead of destructuring the attributes
|
|
338
|
+
// we define the url and background type
|
|
339
|
+
// depending on the value of the useFeaturedImage flag
|
|
340
|
+
// to preview in edit the dynamic featured image
|
|
341
|
+
const url = useFeaturedImage ? mediaUrl : attributes.url;
|
|
342
|
+
const backgroundType = useFeaturedImage
|
|
343
|
+
? IMAGE_BACKGROUND_TYPE
|
|
344
|
+
: attributes.backgroundType;
|
|
345
|
+
|
|
328
346
|
const { __unstableMarkNextChangeAsNotPersistent } = useDispatch(
|
|
329
347
|
blockEditorStore
|
|
330
348
|
);
|
|
349
|
+
const { createErrorNotice } = useDispatch( noticesStore );
|
|
331
350
|
const {
|
|
332
351
|
gradientClass,
|
|
333
352
|
gradientValue,
|
|
@@ -382,6 +401,19 @@ function CoverEdit( {
|
|
|
382
401
|
} );
|
|
383
402
|
};
|
|
384
403
|
|
|
404
|
+
const toggleUseFeaturedImage = () => {
|
|
405
|
+
setAttributes( {
|
|
406
|
+
useFeaturedImage: ! useFeaturedImage,
|
|
407
|
+
dimRatio: dimRatio === 100 ? 50 : dimRatio,
|
|
408
|
+
} );
|
|
409
|
+
};
|
|
410
|
+
|
|
411
|
+
const onUploadError = ( message ) => {
|
|
412
|
+
createErrorNotice( Array.isArray( message ) ? message[ 2 ] : message, {
|
|
413
|
+
type: 'snackbar',
|
|
414
|
+
} );
|
|
415
|
+
};
|
|
416
|
+
|
|
385
417
|
const isDarkElement = useRef();
|
|
386
418
|
const isCoverDark = useCoverIsDark(
|
|
387
419
|
url,
|
|
@@ -460,14 +492,22 @@ function CoverEdit( {
|
|
|
460
492
|
/>
|
|
461
493
|
</BlockControls>
|
|
462
494
|
<BlockControls group="other">
|
|
463
|
-
<
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
onSelect={ onSelectMedia }
|
|
469
|
-
name={ ! url ? __( 'Add Media' ) : __( 'Replace' ) }
|
|
495
|
+
<ToolbarButton
|
|
496
|
+
icon={ postFeaturedImage }
|
|
497
|
+
label={ __( 'Use featured image' ) }
|
|
498
|
+
isPressed={ useFeaturedImage }
|
|
499
|
+
onClick={ toggleUseFeaturedImage }
|
|
470
500
|
/>
|
|
501
|
+
{ ! useFeaturedImage && (
|
|
502
|
+
<MediaReplaceFlow
|
|
503
|
+
mediaId={ id }
|
|
504
|
+
mediaURL={ url }
|
|
505
|
+
allowedTypes={ ALLOWED_MEDIA_TYPES }
|
|
506
|
+
accept="image/*,video/*"
|
|
507
|
+
onSelect={ onSelectMedia }
|
|
508
|
+
name={ ! url ? __( 'Add Media' ) : __( 'Replace' ) }
|
|
509
|
+
/>
|
|
510
|
+
) }
|
|
471
511
|
</BlockControls>
|
|
472
512
|
<InspectorControls>
|
|
473
513
|
{ !! url && (
|
|
@@ -501,27 +541,32 @@ function CoverEdit( {
|
|
|
501
541
|
}
|
|
502
542
|
/>
|
|
503
543
|
) }
|
|
504
|
-
{
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
544
|
+
{ ! useFeaturedImage &&
|
|
545
|
+
url &&
|
|
546
|
+
isImageBackground &&
|
|
547
|
+
isImgElement && (
|
|
548
|
+
<TextareaControl
|
|
549
|
+
label={ __(
|
|
550
|
+
'Alt text (alternative text)'
|
|
551
|
+
) }
|
|
552
|
+
value={ alt }
|
|
553
|
+
onChange={ ( newAlt ) =>
|
|
554
|
+
setAttributes( { alt: newAlt } )
|
|
555
|
+
}
|
|
556
|
+
help={
|
|
557
|
+
<>
|
|
558
|
+
<ExternalLink href="https://www.w3.org/WAI/tutorials/images/decision-tree">
|
|
559
|
+
{ __(
|
|
560
|
+
'Describe the purpose of the image'
|
|
561
|
+
) }
|
|
562
|
+
</ExternalLink>
|
|
514
563
|
{ __(
|
|
515
|
-
'
|
|
564
|
+
'Leave empty if the image is purely decorative.'
|
|
516
565
|
) }
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
</>
|
|
522
|
-
}
|
|
523
|
-
/>
|
|
524
|
-
) }
|
|
566
|
+
</>
|
|
567
|
+
}
|
|
568
|
+
/>
|
|
569
|
+
) }
|
|
525
570
|
<PanelRow>
|
|
526
571
|
<Button
|
|
527
572
|
variant="secondary"
|
|
@@ -535,6 +580,7 @@ function CoverEdit( {
|
|
|
535
580
|
focalPoint: undefined,
|
|
536
581
|
hasParallax: undefined,
|
|
537
582
|
isRepeated: undefined,
|
|
583
|
+
useFeaturedImage: false,
|
|
538
584
|
} )
|
|
539
585
|
}
|
|
540
586
|
>
|
|
@@ -640,9 +686,8 @@ function CoverEdit( {
|
|
|
640
686
|
) }
|
|
641
687
|
>
|
|
642
688
|
<CoverPlaceholder
|
|
643
|
-
noticeUI={ noticeUI }
|
|
644
689
|
onSelectMedia={ onSelectMedia }
|
|
645
|
-
|
|
690
|
+
onError={ onUploadError }
|
|
646
691
|
style={ {
|
|
647
692
|
minHeight: minHeightWithUnit || undefined,
|
|
648
693
|
} }
|
|
@@ -763,9 +808,8 @@ function CoverEdit( {
|
|
|
763
808
|
{ isUploadingMedia && <Spinner /> }
|
|
764
809
|
<CoverPlaceholder
|
|
765
810
|
disableMediaButtons
|
|
766
|
-
noticeUI={ noticeUI }
|
|
767
811
|
onSelectMedia={ onSelectMedia }
|
|
768
|
-
|
|
812
|
+
onError={ onUploadError }
|
|
769
813
|
/>
|
|
770
814
|
<div { ...innerBlocksProps } />
|
|
771
815
|
</div>
|
|
@@ -775,5 +819,4 @@ function CoverEdit( {
|
|
|
775
819
|
|
|
776
820
|
export default compose( [
|
|
777
821
|
withColors( { overlayColor: 'background-color' } ),
|
|
778
|
-
withNotices,
|
|
779
822
|
] )( CoverEdit );
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
<?php
|
|
2
|
+
/**
|
|
3
|
+
* Server-side rendering of the `core/cover` block.
|
|
4
|
+
*
|
|
5
|
+
* @package WordPress
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Renders the `core/cover` block on server.
|
|
10
|
+
*
|
|
11
|
+
* @param array $attributes The block attributes.
|
|
12
|
+
* @param array $content The block rendered content.
|
|
13
|
+
*
|
|
14
|
+
* @return string Returns the cover block markup, if useFeaturedImage is true.
|
|
15
|
+
*/
|
|
16
|
+
function render_block_core_cover( $attributes, $content ) {
|
|
17
|
+
if ( false === $attributes['useFeaturedImage'] ) {
|
|
18
|
+
return $content;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
$current_featured_image = get_the_post_thumbnail_url();
|
|
22
|
+
|
|
23
|
+
if ( false === $current_featured_image ) {
|
|
24
|
+
return $content;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
$is_img_element = ! ( $attributes['hasParallax'] || $attributes['isRepeated'] );
|
|
28
|
+
$is_image_background = 'image' === $attributes['backgroundType'];
|
|
29
|
+
|
|
30
|
+
if ( $is_image_background && ! $is_img_element ) {
|
|
31
|
+
$content = preg_replace(
|
|
32
|
+
'/class=\".*?\"/',
|
|
33
|
+
'${0} style="background-image:url(' . esc_url( $current_featured_image ) . ')"',
|
|
34
|
+
$content,
|
|
35
|
+
1
|
|
36
|
+
);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
if ( $is_image_background && $is_img_element ) {
|
|
40
|
+
$object_position = '';
|
|
41
|
+
if ( isset( $attributes['focalPoint'] ) ) {
|
|
42
|
+
$object_position = round( $attributes['focalPoint']['x'] * 100 ) . '%' . ' ' .
|
|
43
|
+
round( $attributes['focalPoint']['x'] * 100 ) . '%';
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
$image_template = '<img
|
|
47
|
+
class="wp-block-cover__image-background"
|
|
48
|
+
alt="%s"
|
|
49
|
+
src="%s"
|
|
50
|
+
style="object-position: %s"
|
|
51
|
+
data-object-fit="cover"
|
|
52
|
+
data-object-position="%s"
|
|
53
|
+
/>';
|
|
54
|
+
|
|
55
|
+
$image = sprintf(
|
|
56
|
+
$image_template,
|
|
57
|
+
esc_attr( get_the_post_thumbnail_caption() ),
|
|
58
|
+
esc_url( $current_featured_image ),
|
|
59
|
+
esc_attr( $object_position ),
|
|
60
|
+
esc_attr( $object_position )
|
|
61
|
+
);
|
|
62
|
+
|
|
63
|
+
$content = str_replace(
|
|
64
|
+
'</span><div',
|
|
65
|
+
'</span>' . $image . '<div',
|
|
66
|
+
$content
|
|
67
|
+
);
|
|
68
|
+
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
return $content;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* Registers the `core/cover` block renderer on server.
|
|
76
|
+
*/
|
|
77
|
+
function register_block_core_cover() {
|
|
78
|
+
register_block_type_from_metadata(
|
|
79
|
+
__DIR__ . '/cover',
|
|
80
|
+
array(
|
|
81
|
+
'render_callback' => 'render_block_core_cover',
|
|
82
|
+
)
|
|
83
|
+
);
|
|
84
|
+
}
|
|
85
|
+
add_action( 'init', 'register_block_core_cover' );
|
package/src/cover/save.js
CHANGED
|
@@ -34,6 +34,7 @@ export default function save( { attributes } ) {
|
|
|
34
34
|
customOverlayColor,
|
|
35
35
|
dimRatio,
|
|
36
36
|
focalPoint,
|
|
37
|
+
useFeaturedImage,
|
|
37
38
|
hasParallax,
|
|
38
39
|
isDark,
|
|
39
40
|
isRepeated,
|
|
@@ -60,7 +61,7 @@ export default function save( { attributes } ) {
|
|
|
60
61
|
const isImgElement = ! ( hasParallax || isRepeated );
|
|
61
62
|
|
|
62
63
|
const style = {
|
|
63
|
-
...( isImageBackground && ! isImgElement
|
|
64
|
+
...( isImageBackground && ! isImgElement && ! useFeaturedImage
|
|
64
65
|
? backgroundImageStyles( url )
|
|
65
66
|
: {} ),
|
|
66
67
|
minHeight: minHeight || undefined,
|
|
@@ -113,19 +114,22 @@ export default function save( { attributes } ) {
|
|
|
113
114
|
style={ bgStyle }
|
|
114
115
|
/>
|
|
115
116
|
|
|
116
|
-
{
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
117
|
+
{ ! useFeaturedImage &&
|
|
118
|
+
isImageBackground &&
|
|
119
|
+
isImgElement &&
|
|
120
|
+
url && (
|
|
121
|
+
<img
|
|
122
|
+
className={ classnames(
|
|
123
|
+
'wp-block-cover__image-background',
|
|
124
|
+
id ? `wp-image-${ id }` : null
|
|
125
|
+
) }
|
|
126
|
+
alt={ alt }
|
|
127
|
+
src={ url }
|
|
128
|
+
style={ { objectPosition } }
|
|
129
|
+
data-object-fit="cover"
|
|
130
|
+
data-object-position={ objectPosition }
|
|
131
|
+
/>
|
|
132
|
+
) }
|
|
129
133
|
{ isVideoBackground && url && (
|
|
130
134
|
<video
|
|
131
135
|
className={ classnames(
|
package/src/editor.scss
CHANGED
package/src/embed/variations.js
CHANGED
|
@@ -344,9 +344,9 @@ const variations = [
|
|
|
344
344
|
},
|
|
345
345
|
{
|
|
346
346
|
name: 'wolfram-cloud',
|
|
347
|
-
title: 'Wolfram
|
|
347
|
+
title: 'Wolfram',
|
|
348
348
|
icon: embedWolframIcon,
|
|
349
|
-
description: __( 'Embed Wolfram
|
|
349
|
+
description: __( 'Embed Wolfram notebook content.' ),
|
|
350
350
|
patterns: [ /^https?:\/\/(www\.)?wolframcloud\.com\/obj\/.+/i ],
|
|
351
351
|
attributes: { providerNameSlug: 'wolfram-cloud', responsive: true },
|
|
352
352
|
},
|
package/src/gallery/block.json
CHANGED
|
@@ -106,7 +106,24 @@
|
|
|
106
106
|
},
|
|
107
107
|
"supports": {
|
|
108
108
|
"anchor": true,
|
|
109
|
-
"align": true
|
|
109
|
+
"align": true,
|
|
110
|
+
"html": false,
|
|
111
|
+
"units": [ "px", "em", "rem", "vh", "vw" ],
|
|
112
|
+
"spacing": {
|
|
113
|
+
"blockGap": true,
|
|
114
|
+
"__experimentalSkipSerialization": [ "blockGap" ],
|
|
115
|
+
"__experimentalDefaultControls": {
|
|
116
|
+
"blockGap": true
|
|
117
|
+
}
|
|
118
|
+
},
|
|
119
|
+
"__experimentalLayout": {
|
|
120
|
+
"allowSwitching": false,
|
|
121
|
+
"allowInheriting": false,
|
|
122
|
+
"allowEditing": false,
|
|
123
|
+
"default": {
|
|
124
|
+
"type": "flex"
|
|
125
|
+
}
|
|
126
|
+
}
|
|
110
127
|
},
|
|
111
128
|
"editorStyle": "wp-block-gallery-editor",
|
|
112
129
|
"style": "wp-block-gallery"
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// Deprecated gallery styles pre refactoring to use nested image blocks.
|
|
2
2
|
// https://github.com/WordPress/gutenberg/pull/25940.
|
|
3
|
-
.wp-block-gallery,
|
|
4
|
-
.blocks-gallery-grid {
|
|
3
|
+
.wp-block-gallery:not(.has-nested-images),
|
|
4
|
+
.blocks-gallery-grid:not(.has-nested-images) {
|
|
5
5
|
display: flex;
|
|
6
6
|
flex-wrap: wrap;
|
|
7
7
|
list-style-type: none;
|
package/src/gallery/edit.js
CHANGED
|
@@ -54,6 +54,7 @@ import useImageSizes from './use-image-sizes';
|
|
|
54
54
|
import useShortCodeTransform from './use-short-code-transform';
|
|
55
55
|
import useGetNewImages from './use-get-new-images';
|
|
56
56
|
import useGetMedia from './use-get-media';
|
|
57
|
+
import GapStyles from './gap-styles';
|
|
57
58
|
|
|
58
59
|
const MAX_COLUMNS = 8;
|
|
59
60
|
const linkOptions = [
|
|
@@ -99,7 +100,8 @@ function GalleryEdit( props ) {
|
|
|
99
100
|
__unstableMarkNextChangeAsNotPersistent,
|
|
100
101
|
replaceInnerBlocks,
|
|
101
102
|
updateBlockAttributes,
|
|
102
|
-
|
|
103
|
+
selectBlock,
|
|
104
|
+
clearSelectedBlock,
|
|
103
105
|
} = useDispatch( blockEditorStore );
|
|
104
106
|
const { createSuccessNotice } = useDispatch( noticesStore );
|
|
105
107
|
|
|
@@ -155,13 +157,8 @@ function GalleryEdit( props ) {
|
|
|
155
157
|
align: undefined,
|
|
156
158
|
} );
|
|
157
159
|
} );
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
if ( newImages?.length ) {
|
|
161
|
-
multiSelect(
|
|
162
|
-
newImages[ 0 ].clientId,
|
|
163
|
-
newImages[ newImages?.length - 1 ].clientId
|
|
164
|
-
);
|
|
160
|
+
if ( newImages?.length > 0 ) {
|
|
161
|
+
clearSelectedBlock();
|
|
165
162
|
}
|
|
166
163
|
}, [ newImages ] );
|
|
167
164
|
|
|
@@ -296,6 +293,10 @@ function GalleryEdit( props ) {
|
|
|
296
293
|
} );
|
|
297
294
|
} );
|
|
298
295
|
|
|
296
|
+
if ( newBlocks?.length > 0 ) {
|
|
297
|
+
selectBlock( newBlocks[ 0 ].clientId );
|
|
298
|
+
}
|
|
299
|
+
|
|
299
300
|
replaceInnerBlocks(
|
|
300
301
|
clientId,
|
|
301
302
|
concat( existingImageBlocks, newBlocks ).sort(
|
|
@@ -548,6 +549,12 @@ function GalleryEdit( props ) {
|
|
|
548
549
|
/>
|
|
549
550
|
</BlockControls>
|
|
550
551
|
{ noticeUI }
|
|
552
|
+
{ Platform.isWeb && (
|
|
553
|
+
<GapStyles
|
|
554
|
+
blockGap={ attributes.style?.spacing?.blockGap }
|
|
555
|
+
clientId={ clientId }
|
|
556
|
+
/>
|
|
557
|
+
) }
|
|
551
558
|
<Gallery
|
|
552
559
|
{ ...props }
|
|
553
560
|
images={ images }
|
package/src/gallery/editor.scss
CHANGED
package/src/gallery/gallery.js
CHANGED
|
@@ -69,13 +69,14 @@ export const Gallery = ( props ) => {
|
|
|
69
69
|
) }
|
|
70
70
|
>
|
|
71
71
|
{ children }
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
72
|
+
{ isSelected && ! children && (
|
|
73
|
+
<View
|
|
74
|
+
className="blocks-gallery-media-placeholder-wrapper"
|
|
75
|
+
onClick={ removeCaptionFocus }
|
|
76
|
+
>
|
|
77
|
+
{ mediaPlaceholder }
|
|
78
|
+
</View>
|
|
79
|
+
) }
|
|
79
80
|
<RichTextVisibilityHelper
|
|
80
81
|
isHidden={ ! isSelected && RichText.isEmpty( caption ) }
|
|
81
82
|
captionFocused={ captionFocused }
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WordPress dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { BlockList } from '@wordpress/block-editor';
|
|
5
|
+
import { useContext, createPortal } from '@wordpress/element';
|
|
6
|
+
|
|
7
|
+
export default function GapStyles( { blockGap, clientId } ) {
|
|
8
|
+
const styleElement = useContext( BlockList.__unstableElementContext );
|
|
9
|
+
// --gallery-block--gutter-size is deprecated. --wp--style--gallery-gap-default should be used by themes that want to set a default
|
|
10
|
+
// gap on the gallery.
|
|
11
|
+
const gapValue = blockGap
|
|
12
|
+
? blockGap
|
|
13
|
+
: `var( --wp--style--gallery-gap-default, var( --gallery-block--gutter-size, var( --wp--style--block-gap, 0.5em ) ) )`;
|
|
14
|
+
const gap = `#block-${ clientId } {
|
|
15
|
+
--wp--style--unstable-gallery-gap: ${ gapValue };
|
|
16
|
+
gap: ${ gapValue }
|
|
17
|
+
}`;
|
|
18
|
+
|
|
19
|
+
const GapStyle = () => {
|
|
20
|
+
return <style>{ gap }</style>;
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
return gap && styleElement
|
|
24
|
+
? createPortal( <GapStyle />, styleElement )
|
|
25
|
+
: null;
|
|
26
|
+
}
|
package/src/gallery/index.php
CHANGED
|
@@ -32,12 +32,54 @@ function block_core_gallery_data_id_backcompatibility( $parsed_block ) {
|
|
|
32
32
|
|
|
33
33
|
add_filter( 'render_block_data', 'block_core_gallery_data_id_backcompatibility' );
|
|
34
34
|
|
|
35
|
+
/**
|
|
36
|
+
* Adds a style tag for the --wp--style--unstable-gallery-gap var.
|
|
37
|
+
*
|
|
38
|
+
* The Gallery block needs to recalculate Image block width based on
|
|
39
|
+
* the current gap setting in order to maintain the number of flex columns
|
|
40
|
+
* so a css var is added to allow this.
|
|
41
|
+
*
|
|
42
|
+
* @param array $attributes Attributes of the block being rendered.
|
|
43
|
+
* @param string $content Content of the block being rendered.
|
|
44
|
+
* @return string The content of the block being rendered.
|
|
45
|
+
*/
|
|
46
|
+
function block_core_gallery_render( $attributes, $content ) {
|
|
47
|
+
$gap = _wp_array_get( $attributes, array( 'style', 'spacing', 'blockGap' ) );
|
|
48
|
+
// Skip if gap value contains unsupported characters.
|
|
49
|
+
// Regex for CSS value borrowed from `safecss_filter_attr`, and used here
|
|
50
|
+
// because we only want to match against the value, not the CSS attribute.
|
|
51
|
+
$gap = preg_match( '%[\\\(&=}]|/\*%', $gap ) ? null : $gap;
|
|
52
|
+
$class = wp_unique_id( 'wp-block-gallery-' );
|
|
53
|
+
$content = preg_replace(
|
|
54
|
+
'/' . preg_quote( 'class="', '/' ) . '/',
|
|
55
|
+
'class="' . $class . ' ',
|
|
56
|
+
$content,
|
|
57
|
+
1
|
|
58
|
+
);
|
|
59
|
+
// --gallery-block--gutter-size is deprecated. --wp--style--gallery-gap-default should be used by themes that want to set a default
|
|
60
|
+
// gap on the gallery.
|
|
61
|
+
$gap_value = $gap ? $gap : 'var( --wp--style--gallery-gap-default, var( --gallery-block--gutter-size, var( --wp--style--block-gap, 0.5em ) ) )';
|
|
62
|
+
$style = '.' . $class . '{ --wp--style--unstable-gallery-gap: ' . $gap_value . '; gap: ' . $gap_value . '}';
|
|
63
|
+
// Ideally styles should be loaded in the head, but blocks may be parsed
|
|
64
|
+
// after that, so loading in the footer for now.
|
|
65
|
+
// See https://core.trac.wordpress.org/ticket/53494.
|
|
66
|
+
add_action(
|
|
67
|
+
'wp_footer',
|
|
68
|
+
function () use ( $style ) {
|
|
69
|
+
echo '<style> ' . $style . '</style>';
|
|
70
|
+
}
|
|
71
|
+
);
|
|
72
|
+
return $content;
|
|
73
|
+
}
|
|
35
74
|
/**
|
|
36
75
|
* Registers the `core/gallery` block on server.
|
|
37
76
|
*/
|
|
38
77
|
function register_block_core_gallery() {
|
|
39
78
|
register_block_type_from_metadata(
|
|
40
|
-
__DIR__ . '/gallery'
|
|
79
|
+
__DIR__ . '/gallery',
|
|
80
|
+
array(
|
|
81
|
+
'render_callback' => 'block_core_gallery_render',
|
|
82
|
+
)
|
|
41
83
|
);
|
|
42
84
|
}
|
|
43
85
|
|