@wordpress/block-library 7.6.0 → 7.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +6 -0
- package/build/audio/edit.js +1 -0
- package/build/audio/edit.js.map +1 -1
- package/build/audio/index.js +6 -1
- package/build/audio/index.js.map +1 -1
- package/build/audio/save.js +2 -1
- package/build/audio/save.js.map +1 -1
- package/build/avatar/hooks.js +2 -2
- package/build/avatar/hooks.js.map +1 -1
- package/build/block/edit.js.map +1 -1
- package/build/block/edit.native.js.map +1 -1
- package/build/button/deprecated.js +175 -35
- package/build/button/deprecated.js.map +1 -1
- package/build/button/edit.js +1 -1
- package/build/button/edit.js.map +1 -1
- package/build/button/edit.native.js.map +1 -1
- package/build/button/save.js +1 -1
- package/build/button/save.js.map +1 -1
- package/build/buttons/deprecated.js.map +1 -1
- package/build/buttons/edit.js.map +1 -1
- package/build/buttons/edit.native.js.map +1 -1
- package/build/column/deprecated.js.map +1 -1
- package/build/column/edit.js.map +1 -1
- package/build/column/edit.native.js.map +1 -1
- package/build/columns/deprecated.js.map +1 -1
- package/build/columns/edit.js +1 -1
- package/build/columns/edit.js.map +1 -1
- package/build/columns/edit.native.js +1 -1
- package/build/columns/edit.native.js.map +1 -1
- package/build/columns/index.js +3 -1
- package/build/columns/index.js.map +1 -1
- package/build/columns/utils.js +1 -1
- package/build/columns/utils.js.map +1 -1
- package/build/columns/variations.js +2 -2
- package/build/columns/variations.js.map +1 -1
- package/build/comment-author-name/edit.js +3 -3
- package/build/comment-author-name/edit.js.map +1 -1
- package/build/comment-author-name/index.js +0 -4
- package/build/comment-author-name/index.js.map +1 -1
- package/build/comment-date/edit.js +4 -4
- package/build/comment-date/edit.js.map +1 -1
- package/build/comment-date/index.js +0 -4
- package/build/comment-date/index.js.map +1 -1
- package/build/comment-edit-link/index.js +0 -4
- package/build/comment-edit-link/index.js.map +1 -1
- package/build/comment-reply-link/index.js +0 -4
- package/build/comment-reply-link/index.js.map +1 -1
- package/build/comments/edit.js +10 -2
- package/build/comments/edit.js.map +1 -1
- package/build/comments-title/deprecated.js +0 -3
- package/build/comments-title/deprecated.js.map +1 -1
- package/build/comments-title/edit.js +1 -1
- package/build/comments-title/edit.js.map +1 -1
- package/build/cover/controls.native.js.map +1 -1
- package/build/cover/deprecated.js +212 -207
- package/build/cover/deprecated.js.map +1 -1
- package/build/cover/edit/block-controls.js +3 -10
- package/build/cover/edit/block-controls.js.map +1 -1
- package/build/cover/edit/index.js +34 -31
- package/build/cover/edit/index.js.map +1 -1
- package/build/cover/edit/inspector-controls.js +34 -6
- package/build/cover/edit/inspector-controls.js.map +1 -1
- package/build/cover/edit.native.js.map +1 -1
- package/build/cover/index.js +1 -0
- package/build/cover/index.js.map +1 -1
- package/build/cover/save.js +18 -5
- package/build/cover/save.js.map +1 -1
- package/build/cover/shared.js +14 -17
- package/build/cover/shared.js.map +1 -1
- package/build/cover/transforms.js.map +1 -1
- package/build/embed/deprecated.js +6 -1
- package/build/embed/deprecated.js.map +1 -1
- package/build/embed/edit.js.map +1 -1
- package/build/embed/edit.native.js.map +1 -1
- package/build/embed/embed-controls.native.js.map +1 -1
- package/build/embed/embed-preview.js +1 -0
- package/build/embed/embed-preview.js.map +1 -1
- package/build/embed/icons.js +21 -1
- package/build/embed/icons.js.map +1 -1
- package/build/embed/index.js +6 -1
- package/build/embed/index.js.map +1 -1
- package/build/embed/save.js +1 -0
- package/build/embed/save.js.map +1 -1
- package/build/embed/transforms.js +6 -1
- package/build/embed/transforms.js.map +1 -1
- package/build/embed/util.js +6 -1
- package/build/embed/util.js.map +1 -1
- package/build/embed/variations.js +11 -0
- package/build/embed/variations.js.map +1 -1
- package/build/file/edit.js +1 -1
- package/build/file/edit.js.map +1 -1
- package/build/file/edit.native.js.map +1 -1
- package/build/file/index.js.map +1 -1
- package/build/file/save.js +9 -1
- package/build/file/save.js.map +1 -1
- package/build/gallery/edit.js +1 -1
- 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/gallery.native.js.map +1 -1
- package/build/gallery/gap-styles.js +14 -4
- package/build/gallery/gap-styles.js.map +1 -1
- package/build/gallery/index.js +1 -1
- package/build/gallery/index.js.map +1 -1
- package/build/gallery/save.js +1 -1
- package/build/gallery/save.js.map +1 -1
- package/build/gallery/shared.js +27 -10
- package/build/gallery/shared.js.map +1 -1
- package/build/gallery/transforms.js +2 -2
- package/build/gallery/transforms.js.map +1 -1
- package/build/gallery/v1/edit.js +3 -3
- package/build/gallery/v1/edit.js.map +1 -1
- package/build/gallery/v1/gallery-image.js +1 -0
- package/build/gallery/v1/gallery-image.js.map +1 -1
- package/build/gallery/v1/gallery-image.native.js.map +1 -1
- package/build/gallery/v1/gallery.js +1 -1
- package/build/gallery/v1/gallery.js.map +1 -1
- package/build/gallery/v1/save.js +10 -2
- package/build/gallery/v1/save.js.map +1 -1
- package/build/group/index.js +1 -0
- package/build/group/index.js.map +1 -1
- package/build/heading/autogenerate-anchors.js +7 -2
- package/build/heading/autogenerate-anchors.js.map +1 -1
- package/build/heading/deprecated.js.map +1 -1
- package/build/heading/edit.js.map +1 -1
- package/build/html/edit.js +11 -20
- package/build/html/edit.js.map +1 -1
- package/build/html/preview.js +48 -0
- package/build/html/preview.js.map +1 -0
- package/build/image/deprecated.js.map +1 -1
- package/build/image/edit.js +5 -59
- package/build/image/edit.js.map +1 -1
- package/build/image/edit.native.js +58 -4
- package/build/image/edit.native.js.map +1 -1
- package/build/image/image.js +4 -13
- package/build/image/image.js.map +1 -1
- package/build/image/index.js +5 -0
- package/build/image/index.js.map +1 -1
- package/build/image/save.js +1 -0
- package/build/image/save.js.map +1 -1
- package/build/image/transforms.js.map +1 -1
- package/build/image/utils.js +2 -1
- package/build/image/utils.js.map +1 -1
- package/build/index.js +1 -1
- package/build/index.js.map +1 -1
- package/build/latest-comments/edit.js.map +1 -1
- package/build/latest-posts/edit.js +1 -1
- package/build/latest-posts/edit.js.map +1 -1
- package/build/latest-posts/edit.native.js.map +1 -1
- package/build/list/index.js.map +1 -1
- package/build/list/v2/edit.js.map +1 -1
- package/build/list/v2/transforms.js +33 -17
- package/build/list/v2/transforms.js.map +1 -1
- package/build/list-item/hooks/use-backspace.js.map +1 -1
- package/build/list-item/hooks/use-enter.js +7 -4
- package/build/list-item/hooks/use-enter.js.map +1 -1
- package/build/list-item/hooks/use-indent-list-item.js.map +1 -1
- package/build/list-item/hooks/use-outdent-list-item.js +36 -15
- package/build/list-item/hooks/use-outdent-list-item.js.map +1 -1
- package/build/list-item/hooks/use-space.js.map +1 -1
- package/build/list-item/hooks/use-split.js +17 -3
- package/build/list-item/hooks/use-split.js.map +1 -1
- package/build/media-text/deprecated.js +5 -3
- package/build/media-text/deprecated.js.map +1 -1
- package/build/media-text/edit.native.js.map +1 -1
- package/build/media-text/media-container.js +3 -3
- package/build/media-text/media-container.js.map +1 -1
- package/build/media-text/media-container.native.js.map +1 -1
- package/build/media-text/save.js +3 -1
- package/build/media-text/save.js.map +1 -1
- package/build/missing/edit.native.js.map +1 -1
- package/build/navigation/deprecated.js.map +1 -1
- package/build/navigation/edit/index.js +1 -1
- package/build/navigation/edit/index.js.map +1 -1
- package/build/navigation/edit/navigation-menu-delete-control.js.map +1 -1
- package/build/navigation/edit/unsaved-inner-blocks.js.map +1 -1
- package/build/navigation/edit/use-convert-classic-menu-to-block-menu.js.map +1 -1
- package/build/navigation/index.js +9 -0
- package/build/navigation/index.js.map +1 -1
- package/build/navigation/use-navigation-entities.js.map +1 -1
- package/build/navigation/use-navigation-menu.js +72 -38
- package/build/navigation/use-navigation-menu.js.map +1 -1
- package/build/navigation/use-template-part-area-label.js +4 -1
- package/build/navigation/use-template-part-area-label.js.map +1 -1
- package/build/navigation/view.js +5 -3
- package/build/navigation/view.js.map +1 -1
- package/build/navigation-link/edit.js +44 -12
- package/build/navigation-link/edit.js.map +1 -1
- package/build/navigation-submenu/edit.js.map +1 -1
- package/build/navigation-submenu/view.js +5 -3
- package/build/navigation-submenu/view.js.map +1 -1
- package/build/page-list/convert-to-links-modal.js.map +1 -1
- package/build/page-list/edit.js.map +1 -1
- package/build/paragraph/deprecated.js +1 -1
- package/build/paragraph/deprecated.js.map +1 -1
- package/build/pattern/edit.js.map +1 -1
- package/build/post-author/edit.js.map +1 -1
- package/build/post-author-name/index.js +3 -0
- package/build/post-author-name/index.js.map +1 -1
- package/build/post-author-name/transforms.js +41 -0
- package/build/post-author-name/transforms.js.map +1 -0
- package/build/post-comments-form/edit.js +12 -2
- package/build/post-comments-form/edit.js.map +1 -1
- package/build/post-comments-form/form.js +11 -1
- package/build/post-comments-form/form.js.map +1 -1
- package/build/post-content/edit.js.map +1 -1
- package/build/post-date/edit.js +13 -7
- package/build/post-date/edit.js.map +1 -1
- package/build/post-featured-image/edit.js +10 -24
- package/build/post-featured-image/edit.js.map +1 -1
- package/build/post-navigation-link/index.js +4 -0
- package/build/post-navigation-link/index.js.map +1 -1
- package/build/pullquote/deprecated.js.map +1 -1
- package/build/query/edit/index.js +5 -1
- package/build/query/edit/index.js.map +1 -1
- package/build/query/edit/inspector-controls/parent-control.js.map +1 -1
- package/build/query/edit/query-toolbar.js +16 -2
- package/build/query/edit/query-toolbar.js.map +1 -1
- package/build/quote/v2/edit.js.map +1 -1
- package/build/search/edit.js +1 -1
- package/build/search/edit.js.map +1 -1
- package/build/search/edit.native.js.map +1 -1
- package/build/search/index.js +4 -0
- package/build/search/index.js.map +1 -1
- package/build/separator/use-deprecated-opacity.js.map +1 -1
- package/build/shortcode/edit.native.js +16 -13
- package/build/shortcode/edit.native.js.map +1 -1
- package/build/site-logo/edit.js +3 -12
- package/build/site-logo/edit.js.map +1 -1
- package/build/social-links/deprecated.js.map +1 -1
- package/build/social-links/edit.js +2 -2
- package/build/social-links/edit.js.map +1 -1
- package/build/social-links/edit.native.js.map +1 -1
- package/build/spacer/controls.js.map +1 -1
- package/build/table/deprecated.js.map +1 -1
- package/build/table/edit.js +1 -0
- package/build/table/edit.js.map +1 -1
- package/build/table/index.js +6 -1
- package/build/table/index.js.map +1 -1
- package/build/table/save.js +2 -1
- package/build/table/save.js.map +1 -1
- package/build/table/state.js.map +1 -1
- package/build/table-of-contents/edit.js +11 -3
- package/build/table-of-contents/edit.js.map +1 -1
- package/build/tag-cloud/edit.js.map +1 -1
- package/build/template-part/edit/advanced-controls.js +4 -1
- package/build/template-part/edit/advanced-controls.js.map +1 -1
- package/build/template-part/edit/index.js.map +1 -1
- package/build/template-part/edit/utils/hooks.js +4 -1
- package/build/template-part/edit/utils/hooks.js.map +1 -1
- package/build/transformationCategories.native.js.map +1 -1
- package/build/video/edit-common-settings.js.map +1 -1
- package/build/video/edit.js +1 -0
- package/build/video/edit.js.map +1 -1
- package/build/video/edit.native.js +43 -0
- package/build/video/edit.native.js.map +1 -1
- package/build/video/index.js +6 -1
- package/build/video/index.js.map +1 -1
- package/build/video/save.js +1 -0
- package/build/video/save.js.map +1 -1
- package/build-module/audio/edit.js +2 -1
- package/build-module/audio/edit.js.map +1 -1
- package/build-module/audio/index.js +6 -1
- package/build-module/audio/index.js.map +1 -1
- package/build-module/audio/save.js +3 -2
- package/build-module/audio/save.js.map +1 -1
- package/build-module/avatar/hooks.js +2 -2
- package/build-module/avatar/hooks.js.map +1 -1
- package/build-module/block/edit.js.map +1 -1
- package/build-module/block/edit.native.js.map +1 -1
- package/build-module/button/deprecated.js +175 -35
- package/build-module/button/deprecated.js.map +1 -1
- package/build-module/button/edit.js +2 -2
- package/build-module/button/edit.js.map +1 -1
- package/build-module/button/edit.native.js.map +1 -1
- package/build-module/button/save.js +2 -2
- package/build-module/button/save.js.map +1 -1
- package/build-module/buttons/deprecated.js.map +1 -1
- package/build-module/buttons/edit.js.map +1 -1
- package/build-module/buttons/edit.native.js.map +1 -1
- package/build-module/column/deprecated.js.map +1 -1
- package/build-module/column/edit.js.map +1 -1
- package/build-module/column/edit.native.js.map +1 -1
- package/build-module/columns/deprecated.js.map +1 -1
- package/build-module/columns/edit.js +2 -2
- package/build-module/columns/edit.js.map +1 -1
- package/build-module/columns/edit.native.js +2 -2
- package/build-module/columns/edit.native.js.map +1 -1
- package/build-module/columns/index.js +3 -1
- package/build-module/columns/index.js.map +1 -1
- package/build-module/columns/utils.js +2 -2
- package/build-module/columns/utils.js.map +1 -1
- package/build-module/columns/variations.js +2 -2
- package/build-module/columns/variations.js.map +1 -1
- package/build-module/comment-author-name/edit.js +3 -3
- package/build-module/comment-author-name/edit.js.map +1 -1
- package/build-module/comment-author-name/index.js +0 -4
- package/build-module/comment-author-name/index.js.map +1 -1
- package/build-module/comment-date/edit.js +4 -4
- package/build-module/comment-date/edit.js.map +1 -1
- package/build-module/comment-date/index.js +0 -4
- package/build-module/comment-date/index.js.map +1 -1
- package/build-module/comment-edit-link/index.js +0 -4
- package/build-module/comment-edit-link/index.js.map +1 -1
- package/build-module/comment-reply-link/index.js +0 -4
- package/build-module/comment-reply-link/index.js.map +1 -1
- package/build-module/comments/edit.js +10 -2
- package/build-module/comments/edit.js.map +1 -1
- package/build-module/comments-title/deprecated.js +0 -3
- package/build-module/comments-title/deprecated.js.map +1 -1
- package/build-module/comments-title/edit.js +1 -1
- package/build-module/comments-title/edit.js.map +1 -1
- package/build-module/cover/controls.native.js.map +1 -1
- package/build-module/cover/deprecated.js +206 -198
- package/build-module/cover/deprecated.js.map +1 -1
- package/build-module/cover/edit/block-controls.js +3 -8
- package/build-module/cover/edit/block-controls.js.map +1 -1
- package/build-module/cover/edit/index.js +36 -33
- package/build-module/cover/edit/index.js.map +1 -1
- package/build-module/cover/edit/inspector-controls.js +32 -7
- package/build-module/cover/edit/inspector-controls.js.map +1 -1
- package/build-module/cover/edit.native.js.map +1 -1
- package/build-module/cover/index.js +1 -0
- package/build-module/cover/index.js.map +1 -1
- package/build-module/cover/save.js +19 -6
- package/build-module/cover/save.js.map +1 -1
- package/build-module/cover/shared.js +11 -12
- package/build-module/cover/shared.js.map +1 -1
- package/build-module/cover/transforms.js.map +1 -1
- package/build-module/embed/deprecated.js +6 -1
- package/build-module/embed/deprecated.js.map +1 -1
- package/build-module/embed/edit.js.map +1 -1
- package/build-module/embed/edit.native.js.map +1 -1
- package/build-module/embed/embed-controls.native.js.map +1 -1
- package/build-module/embed/embed-preview.js +2 -1
- package/build-module/embed/embed-preview.js.map +1 -1
- package/build-module/embed/icons.js +19 -0
- package/build-module/embed/icons.js.map +1 -1
- package/build-module/embed/index.js +6 -1
- package/build-module/embed/index.js.map +1 -1
- package/build-module/embed/save.js +2 -1
- package/build-module/embed/save.js.map +1 -1
- package/build-module/embed/transforms.js +6 -1
- package/build-module/embed/transforms.js.map +1 -1
- package/build-module/embed/util.js +6 -1
- package/build-module/embed/util.js.map +1 -1
- package/build-module/embed/variations.js +12 -1
- package/build-module/embed/variations.js.map +1 -1
- package/build-module/file/edit.js +2 -2
- package/build-module/file/edit.js.map +1 -1
- package/build-module/file/edit.native.js.map +1 -1
- package/build-module/file/index.js.map +1 -1
- package/build-module/file/save.js +7 -2
- package/build-module/file/save.js.map +1 -1
- package/build-module/gallery/edit.js +2 -2
- package/build-module/gallery/edit.js.map +1 -1
- package/build-module/gallery/gallery.js +2 -2
- package/build-module/gallery/gallery.js.map +1 -1
- package/build-module/gallery/gallery.native.js.map +1 -1
- package/build-module/gallery/gap-styles.js +14 -4
- package/build-module/gallery/gap-styles.js.map +1 -1
- package/build-module/gallery/index.js +1 -1
- package/build-module/gallery/index.js.map +1 -1
- package/build-module/gallery/save.js +2 -2
- package/build-module/gallery/save.js.map +1 -1
- package/build-module/gallery/shared.js +25 -8
- package/build-module/gallery/shared.js.map +1 -1
- package/build-module/gallery/transforms.js +3 -3
- package/build-module/gallery/transforms.js.map +1 -1
- package/build-module/gallery/v1/edit.js +4 -4
- package/build-module/gallery/v1/edit.js.map +1 -1
- package/build-module/gallery/v1/gallery-image.js +2 -1
- package/build-module/gallery/v1/gallery-image.js.map +1 -1
- package/build-module/gallery/v1/gallery-image.native.js.map +1 -1
- package/build-module/gallery/v1/gallery.js +2 -2
- package/build-module/gallery/v1/gallery.js.map +1 -1
- package/build-module/gallery/v1/save.js +8 -3
- package/build-module/gallery/v1/save.js.map +1 -1
- package/build-module/group/index.js +1 -0
- package/build-module/group/index.js.map +1 -1
- package/build-module/heading/autogenerate-anchors.js +5 -2
- package/build-module/heading/autogenerate-anchors.js.map +1 -1
- package/build-module/heading/deprecated.js.map +1 -1
- package/build-module/heading/edit.js.map +1 -1
- package/build-module/html/edit.js +12 -23
- package/build-module/html/edit.js.map +1 -1
- package/build-module/html/preview.js +38 -0
- package/build-module/html/preview.js.map +1 -0
- package/build-module/image/deprecated.js.map +1 -1
- package/build-module/image/edit.js +5 -56
- package/build-module/image/edit.js.map +1 -1
- package/build-module/image/edit.native.js +59 -6
- package/build-module/image/edit.native.js.map +1 -1
- package/build-module/image/image.js +6 -15
- package/build-module/image/image.js.map +1 -1
- package/build-module/image/index.js +5 -0
- package/build-module/image/index.js.map +1 -1
- package/build-module/image/save.js +2 -1
- package/build-module/image/save.js.map +1 -1
- package/build-module/image/transforms.js.map +1 -1
- package/build-module/image/utils.js +2 -2
- package/build-module/image/utils.js.map +1 -1
- package/build-module/index.js +1 -1
- package/build-module/index.js.map +1 -1
- package/build-module/latest-comments/edit.js.map +1 -1
- package/build-module/latest-posts/edit.js +2 -2
- package/build-module/latest-posts/edit.js.map +1 -1
- package/build-module/latest-posts/edit.native.js.map +1 -1
- package/build-module/list/index.js.map +1 -1
- package/build-module/list/v2/edit.js.map +1 -1
- package/build-module/list/v2/transforms.js +32 -17
- package/build-module/list/v2/transforms.js.map +1 -1
- package/build-module/list-item/hooks/use-backspace.js.map +1 -1
- package/build-module/list-item/hooks/use-enter.js +7 -4
- package/build-module/list-item/hooks/use-enter.js.map +1 -1
- package/build-module/list-item/hooks/use-indent-list-item.js.map +1 -1
- package/build-module/list-item/hooks/use-outdent-list-item.js +34 -15
- package/build-module/list-item/hooks/use-outdent-list-item.js.map +1 -1
- package/build-module/list-item/hooks/use-space.js.map +1 -1
- package/build-module/list-item/hooks/use-split.js +19 -5
- package/build-module/list-item/hooks/use-split.js.map +1 -1
- package/build-module/media-text/deprecated.js +3 -1
- package/build-module/media-text/deprecated.js.map +1 -1
- package/build-module/media-text/edit.native.js.map +1 -1
- package/build-module/media-text/media-container.js +3 -1
- package/build-module/media-text/media-container.js.map +1 -1
- package/build-module/media-text/media-container.native.js.map +1 -1
- package/build-module/media-text/save.js +4 -1
- package/build-module/media-text/save.js.map +1 -1
- package/build-module/missing/edit.native.js.map +1 -1
- package/build-module/navigation/deprecated.js.map +1 -1
- package/build-module/navigation/edit/index.js +1 -1
- package/build-module/navigation/edit/index.js.map +1 -1
- package/build-module/navigation/edit/navigation-menu-delete-control.js.map +1 -1
- package/build-module/navigation/edit/unsaved-inner-blocks.js.map +1 -1
- package/build-module/navigation/edit/use-convert-classic-menu-to-block-menu.js.map +1 -1
- package/build-module/navigation/index.js +9 -0
- package/build-module/navigation/index.js.map +1 -1
- package/build-module/navigation/use-navigation-entities.js.map +1 -1
- package/build-module/navigation/use-navigation-menu.js +73 -39
- package/build-module/navigation/use-navigation-menu.js.map +1 -1
- package/build-module/navigation/use-template-part-area-label.js +4 -1
- package/build-module/navigation/use-template-part-area-label.js.map +1 -1
- package/build-module/navigation/view.js +5 -3
- package/build-module/navigation/view.js.map +1 -1
- package/build-module/navigation-link/edit.js +44 -13
- package/build-module/navigation-link/edit.js.map +1 -1
- package/build-module/navigation-submenu/edit.js.map +1 -1
- package/build-module/navigation-submenu/view.js +5 -3
- package/build-module/navigation-submenu/view.js.map +1 -1
- package/build-module/page-list/convert-to-links-modal.js.map +1 -1
- package/build-module/page-list/edit.js.map +1 -1
- package/build-module/paragraph/deprecated.js +2 -2
- package/build-module/paragraph/deprecated.js.map +1 -1
- package/build-module/pattern/edit.js.map +1 -1
- package/build-module/post-author/edit.js.map +1 -1
- package/build-module/post-author-name/index.js +2 -0
- package/build-module/post-author-name/index.js.map +1 -1
- package/build-module/post-author-name/transforms.js +32 -0
- package/build-module/post-author-name/transforms.js.map +1 -0
- package/build-module/post-comments-form/edit.js +12 -3
- package/build-module/post-comments-form/edit.js.map +1 -1
- package/build-module/post-comments-form/form.js +7 -1
- package/build-module/post-comments-form/form.js.map +1 -1
- package/build-module/post-content/edit.js.map +1 -1
- package/build-module/post-date/edit.js +15 -9
- package/build-module/post-date/edit.js.map +1 -1
- package/build-module/post-featured-image/edit.js +10 -23
- package/build-module/post-featured-image/edit.js.map +1 -1
- package/build-module/post-navigation-link/index.js +4 -0
- package/build-module/post-navigation-link/index.js.map +1 -1
- package/build-module/pullquote/deprecated.js.map +1 -1
- package/build-module/query/edit/index.js +5 -1
- package/build-module/query/edit/index.js.map +1 -1
- package/build-module/query/edit/inspector-controls/parent-control.js.map +1 -1
- package/build-module/query/edit/query-toolbar.js +14 -2
- package/build-module/query/edit/query-toolbar.js.map +1 -1
- package/build-module/quote/v2/edit.js.map +1 -1
- package/build-module/search/edit.js +2 -2
- package/build-module/search/edit.js.map +1 -1
- package/build-module/search/edit.native.js.map +1 -1
- package/build-module/search/index.js +4 -0
- package/build-module/search/index.js.map +1 -1
- package/build-module/separator/use-deprecated-opacity.js.map +1 -1
- package/build-module/shortcode/edit.native.js +17 -13
- package/build-module/shortcode/edit.native.js.map +1 -1
- package/build-module/site-logo/edit.js +3 -11
- package/build-module/site-logo/edit.js.map +1 -1
- package/build-module/social-links/deprecated.js.map +1 -1
- package/build-module/social-links/edit.js +2 -2
- package/build-module/social-links/edit.js.map +1 -1
- package/build-module/social-links/edit.native.js.map +1 -1
- package/build-module/spacer/controls.js.map +1 -1
- package/build-module/table/deprecated.js.map +1 -1
- package/build-module/table/edit.js +2 -1
- package/build-module/table/edit.js.map +1 -1
- package/build-module/table/index.js +6 -1
- package/build-module/table/index.js.map +1 -1
- package/build-module/table/save.js +3 -2
- package/build-module/table/save.js.map +1 -1
- package/build-module/table/state.js.map +1 -1
- package/build-module/table-of-contents/edit.js +12 -4
- package/build-module/table-of-contents/edit.js.map +1 -1
- package/build-module/tag-cloud/edit.js.map +1 -1
- package/build-module/template-part/edit/advanced-controls.js +4 -1
- package/build-module/template-part/edit/advanced-controls.js.map +1 -1
- package/build-module/template-part/edit/index.js.map +1 -1
- package/build-module/template-part/edit/utils/hooks.js +4 -1
- package/build-module/template-part/edit/utils/hooks.js.map +1 -1
- package/build-module/transformationCategories.native.js.map +1 -1
- package/build-module/video/edit-common-settings.js.map +1 -1
- package/build-module/video/edit.js +2 -1
- package/build-module/video/edit.js.map +1 -1
- package/build-module/video/edit.native.js +42 -1
- package/build-module/video/edit.native.js.map +1 -1
- package/build-module/video/index.js +6 -1
- package/build-module/video/index.js.map +1 -1
- package/build-module/video/save.js +2 -1
- package/build-module/video/save.js.map +1 -1
- package/build-style/audio/style-rtl.css +0 -3
- package/build-style/audio/style.css +0 -3
- package/build-style/button/style-rtl.css +5 -5
- package/build-style/button/style.css +5 -5
- package/build-style/common-rtl.css +1 -3
- package/build-style/common.css +1 -3
- package/build-style/cover/editor-rtl.css +11 -0
- package/build-style/cover/editor.css +11 -0
- package/build-style/cover/style-rtl.css +33 -25
- package/build-style/cover/style.css +33 -25
- package/build-style/editor-rtl.css +14 -39
- package/build-style/editor.css +14 -39
- package/build-style/embed/style-rtl.css +0 -1
- package/build-style/embed/style.css +0 -1
- package/build-style/file/style-rtl.css +11 -12
- package/build-style/file/style.css +11 -12
- package/build-style/gallery/style-rtl.css +2 -4
- package/build-style/gallery/style.css +2 -4
- package/build-style/image/style-rtl.css +0 -3
- package/build-style/image/style.css +0 -3
- package/build-style/navigation/style-rtl.css +9 -1
- package/build-style/navigation/style.css +9 -1
- package/build-style/post-comments/style-rtl.css +2 -1
- package/build-style/post-comments/style.css +2 -1
- package/build-style/post-comments-form/editor-rtl.css +3 -0
- package/build-style/post-comments-form/editor.css +3 -0
- package/build-style/post-featured-image/editor-rtl.css +0 -27
- package/build-style/post-featured-image/editor.css +0 -27
- package/build-style/post-template/style-rtl.css +9 -18
- package/build-style/post-template/style.css +9 -18
- package/build-style/search/style-rtl.css +9 -11
- package/build-style/search/style.css +9 -11
- package/build-style/site-logo/editor-rtl.css +0 -12
- package/build-style/site-logo/editor.css +0 -12
- package/build-style/site-logo/style-rtl.css +4 -0
- package/build-style/site-logo/style.css +4 -0
- package/build-style/style-rtl.css +86 -93
- package/build-style/style.css +86 -93
- package/build-style/table/style-rtl.css +0 -1
- package/build-style/table/style.css +0 -1
- package/build-style/video/style-rtl.css +1 -5
- package/build-style/video/style.css +1 -5
- package/package.json +30 -29
- package/src/audio/block.json +6 -1
- package/src/audio/edit.js +4 -0
- package/src/audio/index.js +1 -2
- package/src/audio/save.js +12 -2
- package/src/audio/style.scss +0 -2
- package/src/avatar/hooks.js +2 -2
- package/src/block/edit.js +4 -6
- package/src/block/edit.native.js +12 -16
- package/src/block/test/edit.native.js +5 -8
- package/src/button/deprecated.js +145 -36
- package/src/button/edit.js +7 -11
- package/src/button/edit.native.js +2 -3
- package/src/button/save.js +5 -11
- package/src/button/style.scss +10 -5
- package/src/buttons/deprecated.js +4 -6
- package/src/buttons/edit.js +3 -3
- package/src/buttons/edit.native.js +7 -11
- package/src/buttons/test/__snapshots__/edit.native.js.snap +1 -1
- package/src/buttons/test/edit.native.js +1 -1
- package/src/column/deprecated.js +2 -1
- package/src/column/edit.js +2 -3
- package/src/column/edit.native.js +2 -2
- package/src/columns/block.json +3 -1
- package/src/columns/deprecated.js +4 -2
- package/src/columns/edit.js +6 -7
- package/src/columns/edit.native.js +12 -16
- package/src/columns/index.js +1 -2
- package/src/columns/utils.js +5 -3
- package/src/columns/variations.js +2 -2
- package/src/comment-author-name/block.json +0 -4
- package/src/comment-author-name/edit.js +3 -12
- package/src/comment-date/block.json +0 -4
- package/src/comment-date/edit.js +10 -14
- package/src/comment-date/index.php +0 -3
- package/src/comment-edit-link/block.json +0 -4
- package/src/comment-reply-link/block.json +0 -4
- package/src/comments/edit.js +24 -4
- package/src/comments-title/deprecated.js +0 -2
- package/src/comments-title/edit.js +1 -1
- package/src/comments-title/index.php +1 -1
- package/src/cover/block.json +1 -0
- package/src/cover/controls.native.js +2 -4
- package/src/cover/deprecated.js +237 -195
- package/src/cover/edit/block-controls.js +11 -20
- package/src/cover/edit/index.js +81 -66
- package/src/cover/edit/inspector-controls.js +38 -7
- package/src/cover/edit.native.js +8 -13
- package/src/cover/editor.scss +13 -0
- package/src/cover/index.php +21 -8
- package/src/cover/save.js +28 -16
- package/src/cover/shared.js +5 -7
- package/src/cover/style.scss +27 -22
- package/src/cover/test/edit.native.js +4 -7
- package/src/cover/transforms.js +2 -7
- package/src/embed/block.json +6 -1
- package/src/embed/edit.js +38 -40
- package/src/embed/edit.native.js +46 -49
- package/src/embed/embed-controls.native.js +2 -3
- package/src/embed/embed-preview.js +8 -1
- package/src/embed/icons.js +25 -0
- package/src/embed/save.js +10 -2
- package/src/embed/style.scss +0 -1
- package/src/embed/test/__snapshots__/index.native.js.snap +1 -1
- package/src/embed/test/index.native.js +24 -50
- package/src/embed/variations.js +10 -0
- package/src/file/edit.js +9 -5
- package/src/file/edit.native.js +14 -25
- package/src/file/index.js +1 -2
- package/src/file/save.js +14 -2
- package/src/file/style.scss +16 -15
- package/src/freeform/editor.scss +0 -2
- package/src/gallery/block.json +1 -1
- package/src/gallery/edit.js +8 -6
- package/src/gallery/gallery.js +9 -2
- package/src/gallery/gallery.native.js +2 -4
- package/src/gallery/gap-styles.js +21 -6
- package/src/gallery/index.js +2 -4
- package/src/gallery/index.php +27 -12
- package/src/gallery/save.js +5 -1
- package/src/gallery/shared.js +22 -9
- package/src/gallery/test/__snapshots__/index.native.js.snap +2 -2
- package/src/gallery/test/helpers.native.js +11 -198
- package/src/gallery/test/index.native.js +37 -63
- package/src/gallery/transforms.js +3 -3
- package/src/gallery/v1/edit.js +18 -24
- package/src/gallery/v1/gallery-image.js +10 -11
- package/src/gallery/v1/gallery-image.native.js +8 -17
- package/src/gallery/v1/gallery.js +8 -2
- package/src/gallery/v1/save.js +20 -3
- package/src/group/block.json +1 -0
- package/src/heading/autogenerate-anchors.js +8 -5
- package/src/heading/deprecated.js +6 -21
- package/src/heading/edit.js +2 -3
- package/src/html/edit.js +10 -40
- package/src/html/preview.js +46 -0
- package/src/image/block.json +5 -0
- package/src/image/deprecated.js +6 -29
- package/src/image/edit.js +1 -53
- package/src/image/edit.native.js +75 -24
- package/src/image/image.js +35 -49
- package/src/image/save.js +10 -2
- package/src/image/style.scss +0 -2
- package/src/image/styles.native.scss +11 -0
- package/src/image/test/edit.native.js +51 -19
- package/src/image/transforms.js +4 -3
- package/src/image/utils.js +2 -2
- package/src/index.js +1 -1
- package/src/latest-comments/edit.js +2 -6
- package/src/latest-posts/edit.js +6 -7
- package/src/latest-posts/edit.native.js +10 -15
- package/src/list/index.js +1 -2
- package/src/list/test/migrate.js +1 -2
- package/src/list/v2/edit.js +6 -9
- package/src/list/v2/transforms.js +22 -7
- package/src/list-item/hooks/use-backspace.js +2 -3
- package/src/list-item/hooks/use-enter.js +11 -9
- package/src/list-item/hooks/use-indent-list-item.js +2 -3
- package/src/list-item/hooks/use-outdent-list-item.js +50 -24
- package/src/list-item/hooks/use-space.js +2 -3
- package/src/list-item/hooks/use-split.js +18 -9
- package/src/media-text/deprecated.js +6 -3
- package/src/media-text/edit.native.js +2 -5
- package/src/media-text/media-container.js +1 -1
- package/src/media-text/media-container.native.js +6 -9
- package/src/media-text/save.js +2 -1
- package/src/missing/edit.native.js +2 -3
- package/src/missing/test/edit-integration.native.js +2 -3
- package/src/missing/test/edit.native.js +6 -9
- package/src/navigation/block.json +9 -0
- package/src/navigation/deprecated.js +2 -5
- package/src/navigation/edit/index.js +25 -36
- package/src/navigation/edit/navigation-menu-delete-control.js +2 -3
- package/src/navigation/edit/unsaved-inner-blocks.js +31 -30
- package/src/navigation/edit/use-convert-classic-menu-to-block-menu.js +2 -3
- package/src/navigation/style.scss +10 -1
- package/src/navigation/test/use-navigation-menu.js +241 -0
- package/src/navigation/use-navigation-entities.js +11 -13
- package/src/navigation/use-navigation-menu.js +95 -82
- package/src/navigation/use-template-part-area-label.js +8 -7
- package/src/navigation/view.js +7 -2
- package/src/navigation-link/edit.js +59 -25
- package/src/navigation-link/test/edit.js +2 -24
- package/src/navigation-submenu/edit.js +10 -20
- package/src/navigation-submenu/view.js +7 -2
- package/src/page-list/convert-to-links-modal.js +51 -54
- package/src/page-list/edit.js +6 -6
- package/src/page-list/test/convert-to-links-modal.js +6 -12
- package/src/paragraph/deprecated.js +2 -2
- package/src/pattern/edit.js +2 -4
- package/src/post-author/edit.js +2 -3
- package/src/post-author/index.php +3 -2
- package/src/post-author-name/index.js +2 -0
- package/src/post-author-name/index.php +1 -1
- package/src/post-author-name/transforms.js +25 -0
- package/src/post-comments/index.php +1 -1
- package/src/post-comments/style.scss +7 -3
- package/src/post-comments-form/edit.js +20 -3
- package/src/post-comments-form/editor.scss +4 -0
- package/src/post-comments-form/form.js +11 -1
- package/src/post-comments-form/index.php +1 -1
- package/src/post-content/edit.js +2 -3
- package/src/post-date/edit.js +4 -3
- package/src/post-featured-image/edit.js +14 -30
- package/src/post-featured-image/editor.scss +0 -29
- package/src/post-featured-image/index.php +4 -2
- package/src/post-navigation-link/block.json +4 -0
- package/src/post-template/index.php +15 -3
- package/src/post-template/style.scss +1 -7
- package/src/pullquote/deprecated.js +2 -1
- package/src/query/edit/index.js +10 -10
- package/src/query/edit/inspector-controls/parent-control.js +2 -3
- package/src/query/edit/query-toolbar.js +25 -5
- package/src/query-pagination/index.php +0 -1
- package/src/quote/v2/edit.js +4 -6
- package/src/quote/v2/test/migrate.js +1 -2
- package/src/search/block.json +4 -0
- package/src/search/edit.js +9 -13
- package/src/search/edit.native.js +4 -6
- package/src/search/index.php +38 -23
- package/src/search/style.scss +11 -9
- package/src/separator/use-deprecated-opacity.js +2 -4
- package/src/shortcode/edit.native.js +30 -15
- package/src/shortcode/style.native.scss +11 -4
- package/src/shortcode/test/__snapshots__/edit.native.js.snap +9 -0
- package/src/shortcode/test/edit.native.js +55 -40
- package/src/site-logo/edit.js +3 -17
- package/src/site-logo/editor.scss +0 -14
- package/src/site-logo/style.scss +6 -0
- package/src/social-links/deprecated.js +4 -2
- package/src/social-links/edit.js +11 -10
- package/src/social-links/edit.native.js +3 -5
- package/src/spacer/controls.js +2 -3
- package/src/spacer/test/index.native.js +10 -21
- package/src/table/block.json +6 -1
- package/src/table/deprecated.js +4 -8
- package/src/table/edit.js +2 -0
- package/src/table/save.js +6 -1
- package/src/table/state.js +2 -4
- package/src/table/style.scss +0 -1
- package/src/table-of-contents/edit.js +22 -13
- package/src/tag-cloud/edit.js +4 -7
- package/src/template-part/edit/advanced-controls.js +4 -4
- package/src/template-part/edit/index.js +6 -10
- package/src/template-part/edit/utils/hooks.js +8 -7
- package/src/transformationCategories.native.js +3 -3
- package/src/video/block.json +6 -1
- package/src/video/edit-common-settings.js +2 -8
- package/src/video/edit.js +4 -0
- package/src/video/edit.native.js +38 -16
- package/src/video/index.js +1 -2
- package/src/video/save.js +10 -2
- package/src/video/style.scss +0 -2
package/src/cover/edit/index.js
CHANGED
|
@@ -10,7 +10,7 @@ import namesPlugin from 'colord/plugins/names';
|
|
|
10
10
|
*/
|
|
11
11
|
import { useEntityProp, store as coreStore } from '@wordpress/core-data';
|
|
12
12
|
import { useEffect, useRef } from '@wordpress/element';
|
|
13
|
-
import { Spinner } from '@wordpress/components';
|
|
13
|
+
import { Placeholder, Spinner } from '@wordpress/components';
|
|
14
14
|
import { compose } from '@wordpress/compose';
|
|
15
15
|
import {
|
|
16
16
|
withColors,
|
|
@@ -33,7 +33,6 @@ import {
|
|
|
33
33
|
attributesFromMedia,
|
|
34
34
|
IMAGE_BACKGROUND_TYPE,
|
|
35
35
|
VIDEO_BACKGROUND_TYPE,
|
|
36
|
-
backgroundImageStyles,
|
|
37
36
|
dimRatioToClass,
|
|
38
37
|
isContentPositionCenter,
|
|
39
38
|
getPositionClassName,
|
|
@@ -121,9 +120,8 @@ function CoverEdit( {
|
|
|
121
120
|
? IMAGE_BACKGROUND_TYPE
|
|
122
121
|
: attributes.backgroundType;
|
|
123
122
|
|
|
124
|
-
const { __unstableMarkNextChangeAsNotPersistent } =
|
|
125
|
-
blockEditorStore
|
|
126
|
-
);
|
|
123
|
+
const { __unstableMarkNextChangeAsNotPersistent } =
|
|
124
|
+
useDispatch( blockEditorStore );
|
|
127
125
|
const { createErrorNotice } = useDispatch( noticesStore );
|
|
128
126
|
const { gradientClass, gradientValue } = __experimentalUseGradient();
|
|
129
127
|
const onSelectMedia = attributesFromMedia( setAttributes, dimRatio );
|
|
@@ -158,12 +156,13 @@ function CoverEdit( {
|
|
|
158
156
|
const isImgElement = ! ( hasParallax || isRepeated );
|
|
159
157
|
|
|
160
158
|
const style = {
|
|
161
|
-
...( isImageBackground && ! isImgElement
|
|
162
|
-
? backgroundImageStyles( url )
|
|
163
|
-
: undefined ),
|
|
164
159
|
minHeight: minHeightWithUnit || undefined,
|
|
165
160
|
};
|
|
166
161
|
|
|
162
|
+
const backgroundImage = url ? `url(${ url })` : undefined;
|
|
163
|
+
|
|
164
|
+
const backgroundPosition = mediaPosition( focalPoint );
|
|
165
|
+
|
|
167
166
|
const bgStyle = { backgroundColor: overlayColor.color };
|
|
168
167
|
const mediaStyle = {
|
|
169
168
|
objectPosition:
|
|
@@ -212,23 +211,31 @@ function CoverEdit( {
|
|
|
212
211
|
overlayColor,
|
|
213
212
|
};
|
|
214
213
|
|
|
215
|
-
|
|
214
|
+
const blockControls = (
|
|
215
|
+
<CoverBlockControls
|
|
216
|
+
attributes={ attributes }
|
|
217
|
+
setAttributes={ setAttributes }
|
|
218
|
+
onSelectMedia={ onSelectMedia }
|
|
219
|
+
currentSettings={ currentSettings }
|
|
220
|
+
/>
|
|
221
|
+
);
|
|
222
|
+
|
|
223
|
+
const inspectorControls = (
|
|
224
|
+
<CoverInspectorControls
|
|
225
|
+
attributes={ attributes }
|
|
226
|
+
setAttributes={ setAttributes }
|
|
227
|
+
clientId={ clientId }
|
|
228
|
+
setOverlayColor={ setOverlayColor }
|
|
229
|
+
coverRef={ ref }
|
|
230
|
+
currentSettings={ currentSettings }
|
|
231
|
+
/>
|
|
232
|
+
);
|
|
233
|
+
|
|
234
|
+
if ( ! useFeaturedImage && ! hasInnerBlocks && ! hasBackground ) {
|
|
216
235
|
return (
|
|
217
236
|
<>
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
setAttributes={ setAttributes }
|
|
221
|
-
onSelectMedia={ onSelectMedia }
|
|
222
|
-
currentSettings={ currentSettings }
|
|
223
|
-
/>
|
|
224
|
-
<CoverInspectorControls
|
|
225
|
-
attributes={ attributes }
|
|
226
|
-
setAttributes={ setAttributes }
|
|
227
|
-
clientId={ clientId }
|
|
228
|
-
setOverlayColor={ setOverlayColor }
|
|
229
|
-
coverRef={ ref }
|
|
230
|
-
currentSettings={ currentSettings }
|
|
231
|
-
/>
|
|
237
|
+
{ blockControls }
|
|
238
|
+
{ inspectorControls }
|
|
232
239
|
<div
|
|
233
240
|
{ ...blockProps }
|
|
234
241
|
className={ classnames(
|
|
@@ -279,29 +286,16 @@ function CoverEdit( {
|
|
|
279
286
|
'is-transient': isUploadingMedia,
|
|
280
287
|
'has-parallax': hasParallax,
|
|
281
288
|
'is-repeated': isRepeated,
|
|
282
|
-
'has-custom-content-position':
|
|
283
|
-
contentPosition
|
|
284
|
-
),
|
|
289
|
+
'has-custom-content-position':
|
|
290
|
+
! isContentPositionCenter( contentPosition ),
|
|
285
291
|
},
|
|
286
292
|
getPositionClassName( contentPosition )
|
|
287
293
|
);
|
|
288
294
|
|
|
289
295
|
return (
|
|
290
296
|
<>
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
setAttributes={ setAttributes }
|
|
294
|
-
onSelectMedia={ onSelectMedia }
|
|
295
|
-
currentSettings={ currentSettings }
|
|
296
|
-
/>
|
|
297
|
-
<CoverInspectorControls
|
|
298
|
-
attributes={ attributes }
|
|
299
|
-
setAttributes={ setAttributes }
|
|
300
|
-
clientId={ clientId }
|
|
301
|
-
setOverlayColor={ setOverlayColor }
|
|
302
|
-
coverRef={ ref }
|
|
303
|
-
currentSettings={ currentSettings }
|
|
304
|
-
/>
|
|
297
|
+
{ blockControls }
|
|
298
|
+
{ inspectorControls }
|
|
305
299
|
<div
|
|
306
300
|
{ ...blockProps }
|
|
307
301
|
className={ classnames( classes, blockProps.className ) }
|
|
@@ -324,35 +318,56 @@ function CoverEdit( {
|
|
|
324
318
|
showHandle={ isSelected }
|
|
325
319
|
/>
|
|
326
320
|
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
321
|
+
{ ( ! useFeaturedImage || url ) && (
|
|
322
|
+
<span
|
|
323
|
+
aria-hidden="true"
|
|
324
|
+
className={ classnames(
|
|
325
|
+
'wp-block-cover__background',
|
|
326
|
+
dimRatioToClass( dimRatio ),
|
|
327
|
+
{
|
|
328
|
+
[ overlayColor.class ]: overlayColor.class,
|
|
329
|
+
'has-background-dim': dimRatio !== undefined,
|
|
330
|
+
// For backwards compatibility. Former versions of the Cover Block applied
|
|
331
|
+
// `.wp-block-cover__gradient-background` in the presence of
|
|
332
|
+
// media, a gradient and a dim.
|
|
333
|
+
'wp-block-cover__gradient-background':
|
|
334
|
+
url && gradientValue && dimRatio !== 0,
|
|
335
|
+
'has-background-gradient': gradientValue,
|
|
336
|
+
[ gradientClass ]: gradientClass,
|
|
337
|
+
}
|
|
338
|
+
) }
|
|
339
|
+
style={ { backgroundImage: gradientValue, ...bgStyle } }
|
|
340
|
+
/>
|
|
341
|
+
) }
|
|
346
342
|
|
|
347
|
-
{ url &&
|
|
348
|
-
<
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
alt={ alt }
|
|
352
|
-
src={ url }
|
|
353
|
-
style={ mediaStyle }
|
|
343
|
+
{ ! url && useFeaturedImage && (
|
|
344
|
+
<Placeholder
|
|
345
|
+
className="wp-block-cover__image--placeholder-image"
|
|
346
|
+
withIllustration={ true }
|
|
354
347
|
/>
|
|
355
348
|
) }
|
|
349
|
+
|
|
350
|
+
{ url &&
|
|
351
|
+
isImageBackground &&
|
|
352
|
+
( isImgElement ? (
|
|
353
|
+
<img
|
|
354
|
+
ref={ mediaElement }
|
|
355
|
+
className="wp-block-cover__image-background"
|
|
356
|
+
alt={ alt }
|
|
357
|
+
src={ url }
|
|
358
|
+
style={ mediaStyle }
|
|
359
|
+
/>
|
|
360
|
+
) : (
|
|
361
|
+
<div
|
|
362
|
+
ref={ mediaElement }
|
|
363
|
+
role="img"
|
|
364
|
+
className={ classnames(
|
|
365
|
+
classes,
|
|
366
|
+
'wp-block-cover__image-background'
|
|
367
|
+
) }
|
|
368
|
+
style={ { backgroundImage, backgroundPosition } }
|
|
369
|
+
/>
|
|
370
|
+
) ) }
|
|
356
371
|
{ url && isVideoBackground && (
|
|
357
372
|
<video
|
|
358
373
|
ref={ mediaElement }
|
|
@@ -21,8 +21,9 @@ import { useInstanceId } from '@wordpress/compose';
|
|
|
21
21
|
import {
|
|
22
22
|
InspectorControls,
|
|
23
23
|
useSetting,
|
|
24
|
+
__experimentalColorGradientSettingsDropdown as ColorGradientSettingsDropdown,
|
|
24
25
|
__experimentalUseGradient,
|
|
25
|
-
|
|
26
|
+
__experimentalUseMultipleOriginColorsAndGradients as useMultipleOriginColorsAndGradients,
|
|
26
27
|
} from '@wordpress/block-editor';
|
|
27
28
|
import { __ } from '@wordpress/i18n';
|
|
28
29
|
|
|
@@ -138,6 +139,9 @@ export default function CoverInspectorControls( {
|
|
|
138
139
|
: [ coverRef.current.style, 'backgroundPosition' ];
|
|
139
140
|
styleOfRef[ property ] = mediaPosition( value );
|
|
140
141
|
};
|
|
142
|
+
|
|
143
|
+
const colorGradientSettings = useMultipleOriginColorsAndGradients();
|
|
144
|
+
|
|
141
145
|
return (
|
|
142
146
|
<>
|
|
143
147
|
<InspectorControls>
|
|
@@ -220,23 +224,50 @@ export default function CoverInspectorControls( {
|
|
|
220
224
|
</PanelRow>
|
|
221
225
|
</PanelBody>
|
|
222
226
|
) }
|
|
223
|
-
|
|
227
|
+
</InspectorControls>
|
|
228
|
+
<InspectorControls __experimentalGroup="color">
|
|
229
|
+
<ColorGradientSettingsDropdown
|
|
224
230
|
__experimentalHasMultipleOrigins
|
|
225
231
|
__experimentalIsRenderedInSidebar
|
|
226
|
-
title={ __( 'Overlay' ) }
|
|
227
|
-
initialOpen={ true }
|
|
228
232
|
settings={ [
|
|
229
233
|
{
|
|
230
234
|
colorValue: overlayColor.color,
|
|
231
235
|
gradientValue,
|
|
236
|
+
label: __( 'Overlay' ),
|
|
232
237
|
onColorChange: setOverlayColor,
|
|
233
238
|
onGradientChange: setGradient,
|
|
234
|
-
|
|
239
|
+
isShownByDefault: true,
|
|
240
|
+
resetAllFilter: () => ( {
|
|
241
|
+
overlayColor: undefined,
|
|
242
|
+
customOverlayColor: undefined,
|
|
243
|
+
gradient: undefined,
|
|
244
|
+
customGradient: undefined,
|
|
245
|
+
} ),
|
|
235
246
|
},
|
|
236
247
|
] }
|
|
248
|
+
panelId={ clientId }
|
|
249
|
+
{ ...colorGradientSettings }
|
|
250
|
+
/>
|
|
251
|
+
<ToolsPanelItem
|
|
252
|
+
hasValue={ () => {
|
|
253
|
+
// If there's a media background the dimRatio will be
|
|
254
|
+
// defaulted to 50 whereas it will be 100 for colors.
|
|
255
|
+
return dimRatio === undefined
|
|
256
|
+
? false
|
|
257
|
+
: dimRatio !== ( url ? 50 : 100 );
|
|
258
|
+
} }
|
|
259
|
+
label={ __( 'Overlay opacity' ) }
|
|
260
|
+
onDeselect={ () =>
|
|
261
|
+
setAttributes( { dimRatio: url ? 50 : 100 } )
|
|
262
|
+
}
|
|
263
|
+
resetAllFilter={ () => ( {
|
|
264
|
+
dimRatio: url ? 50 : 100,
|
|
265
|
+
} ) }
|
|
266
|
+
isShownByDefault
|
|
267
|
+
panelId={ clientId }
|
|
237
268
|
>
|
|
238
269
|
<RangeControl
|
|
239
|
-
label={ __( '
|
|
270
|
+
label={ __( 'Overlay opacity' ) }
|
|
240
271
|
value={ dimRatio }
|
|
241
272
|
onChange={ ( newDimRation ) =>
|
|
242
273
|
setAttributes( {
|
|
@@ -248,7 +279,7 @@ export default function CoverInspectorControls( {
|
|
|
248
279
|
step={ 10 }
|
|
249
280
|
required
|
|
250
281
|
/>
|
|
251
|
-
</
|
|
282
|
+
</ToolsPanelItem>
|
|
252
283
|
</InspectorControls>
|
|
253
284
|
<InspectorControls __experimentalGroup="dimensions">
|
|
254
285
|
<ToolsPanelItem
|
package/src/cover/edit.native.js
CHANGED
|
@@ -117,9 +117,8 @@ const Cover = ( {
|
|
|
117
117
|
overlayColor,
|
|
118
118
|
isDark,
|
|
119
119
|
} = attributes;
|
|
120
|
-
const [ isScreenReaderEnabled, setIsScreenReaderEnabled ] =
|
|
121
|
-
false
|
|
122
|
-
);
|
|
120
|
+
const [ isScreenReaderEnabled, setIsScreenReaderEnabled ] =
|
|
121
|
+
useState( false );
|
|
123
122
|
|
|
124
123
|
useEffect( () => {
|
|
125
124
|
let isCurrent = true;
|
|
@@ -176,10 +175,8 @@ const Cover = ( {
|
|
|
176
175
|
|
|
177
176
|
const hasOnlyColorBackground = ! url && ( hasBackground || hasInnerBlocks );
|
|
178
177
|
|
|
179
|
-
const [
|
|
180
|
-
|
|
181
|
-
setCustomColorPickerShowing,
|
|
182
|
-
] = useState( false );
|
|
178
|
+
const [ isCustomColorPickerShowing, setCustomColorPickerShowing ] =
|
|
179
|
+
useState( false );
|
|
183
180
|
|
|
184
181
|
const openMediaOptionsRef = useRef();
|
|
185
182
|
|
|
@@ -248,9 +245,8 @@ const Cover = ( {
|
|
|
248
245
|
openGeneralSidebar();
|
|
249
246
|
}
|
|
250
247
|
|
|
251
|
-
const { __unstableMarkNextChangeAsNotPersistent } =
|
|
252
|
-
blockEditorStore
|
|
253
|
-
);
|
|
248
|
+
const { __unstableMarkNextChangeAsNotPersistent } =
|
|
249
|
+
useDispatch( blockEditorStore );
|
|
254
250
|
const isCoverDark = useCoverIsDark(
|
|
255
251
|
isDark,
|
|
256
252
|
url,
|
|
@@ -622,9 +618,8 @@ const Cover = ( {
|
|
|
622
618
|
|
|
623
619
|
export default compose( [
|
|
624
620
|
withSelect( ( select, { clientId } ) => {
|
|
625
|
-
const { getSelectedBlockClientId, getBlock } =
|
|
626
|
-
blockEditorStore
|
|
627
|
-
);
|
|
621
|
+
const { getSelectedBlockClientId, getBlock } =
|
|
622
|
+
select( blockEditorStore );
|
|
628
623
|
|
|
629
624
|
const selectedBlockClientId = getSelectedBlockClientId();
|
|
630
625
|
|
package/src/cover/editor.scss
CHANGED
|
@@ -62,6 +62,15 @@
|
|
|
62
62
|
.wp-block-cover__placeholder-background-options {
|
|
63
63
|
width: 100%;
|
|
64
64
|
}
|
|
65
|
+
|
|
66
|
+
.wp-block-cover__image--placeholder-image {
|
|
67
|
+
position: absolute;
|
|
68
|
+
top: 0;
|
|
69
|
+
right: 0;
|
|
70
|
+
bottom: 0;
|
|
71
|
+
left: 0;
|
|
72
|
+
}
|
|
73
|
+
|
|
65
74
|
}
|
|
66
75
|
|
|
67
76
|
[data-align="left"] > .wp-block-cover,
|
|
@@ -98,3 +107,7 @@
|
|
|
98
107
|
.block-editor-block-patterns-list__list-item .has-parallax.wp-block-cover {
|
|
99
108
|
background-attachment: scroll;
|
|
100
109
|
}
|
|
110
|
+
|
|
111
|
+
.color-block-support-panel__inner-wrapper > :not(.block-editor-tools-panel-color-gradient-settings__item) {
|
|
112
|
+
margin-top: $grid-unit-30;
|
|
113
|
+
}
|
package/src/cover/index.php
CHANGED
|
@@ -32,20 +32,33 @@ function render_block_core_cover( $attributes, $content ) {
|
|
|
32
32
|
|
|
33
33
|
$image = get_the_post_thumbnail( null, 'post-thumbnail', $attr );
|
|
34
34
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
35
|
+
/*
|
|
36
|
+
* Inserts the featured image between the (1st) cover 'background' `span` and 'inner_container' `div`,
|
|
37
|
+
* and removes eventual withespace characters between the two (typically introduced at template level)
|
|
38
|
+
*/
|
|
39
|
+
$inner_container_start = '/<div\b[^>]+wp-block-cover__inner-container[\s|"][^>]*>/U';
|
|
40
|
+
if ( 1 === preg_match( $inner_container_start, $content, $matches, PREG_OFFSET_CAPTURE ) ) {
|
|
41
|
+
$offset = $matches[0][1];
|
|
42
|
+
$content = substr( $content, 0, $offset ) . $image . substr( $content, $offset );
|
|
43
|
+
}
|
|
41
44
|
} else {
|
|
42
45
|
if ( in_the_loop() ) {
|
|
43
46
|
update_post_thumbnail_cache();
|
|
44
47
|
}
|
|
45
48
|
$current_featured_image = get_the_post_thumbnail_url();
|
|
46
|
-
|
|
49
|
+
|
|
50
|
+
$styles = 'background-image:url(' . esc_url( $current_featured_image ) . '); ';
|
|
51
|
+
|
|
52
|
+
if ( isset( $attributes['minHeight'] ) ) {
|
|
53
|
+
$height_unit = empty( $attributes['minHeightUnit'] ) ? 'px' : $attributes['minHeightUnit'];
|
|
54
|
+
$height = " min-height:{$attributes['minHeight']}{$height_unit}";
|
|
55
|
+
|
|
56
|
+
$styles .= $height;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
$content = preg_replace(
|
|
47
60
|
'/class=\".*?\"/',
|
|
48
|
-
'${0} style="
|
|
61
|
+
'${0} style="' . $styles . '"',
|
|
49
62
|
$content,
|
|
50
63
|
1
|
|
51
64
|
);
|
package/src/cover/save.js
CHANGED
|
@@ -19,10 +19,10 @@ import {
|
|
|
19
19
|
import {
|
|
20
20
|
IMAGE_BACKGROUND_TYPE,
|
|
21
21
|
VIDEO_BACKGROUND_TYPE,
|
|
22
|
-
backgroundImageStyles,
|
|
23
22
|
dimRatioToClass,
|
|
24
23
|
isContentPositionCenter,
|
|
25
24
|
getPositionClassName,
|
|
25
|
+
mediaPosition,
|
|
26
26
|
} from './shared';
|
|
27
27
|
|
|
28
28
|
export default function save( { attributes } ) {
|
|
@@ -61,9 +61,6 @@ export default function save( { attributes } ) {
|
|
|
61
61
|
const isImgElement = ! ( hasParallax || isRepeated );
|
|
62
62
|
|
|
63
63
|
const style = {
|
|
64
|
-
...( isImageBackground && ! isImgElement && ! useFeaturedImage
|
|
65
|
-
? backgroundImageStyles( url )
|
|
66
|
-
: {} ),
|
|
67
64
|
minHeight: minHeight || undefined,
|
|
68
65
|
};
|
|
69
66
|
|
|
@@ -75,21 +72,33 @@ export default function save( { attributes } ) {
|
|
|
75
72
|
const objectPosition =
|
|
76
73
|
// prettier-ignore
|
|
77
74
|
focalPoint && isImgElement
|
|
78
|
-
|
|
79
|
-
|
|
75
|
+
? mediaPosition(focalPoint)
|
|
76
|
+
: undefined;
|
|
77
|
+
|
|
78
|
+
const backgroundImage = url ? `url(${ url })` : undefined;
|
|
79
|
+
|
|
80
|
+
const backgroundPosition = mediaPosition( focalPoint );
|
|
80
81
|
|
|
81
82
|
const classes = classnames(
|
|
82
83
|
{
|
|
83
84
|
'is-light': ! isDark,
|
|
84
85
|
'has-parallax': hasParallax,
|
|
85
86
|
'is-repeated': isRepeated,
|
|
86
|
-
'has-custom-content-position':
|
|
87
|
-
contentPosition
|
|
88
|
-
),
|
|
87
|
+
'has-custom-content-position':
|
|
88
|
+
! isContentPositionCenter( contentPosition ),
|
|
89
89
|
},
|
|
90
90
|
getPositionClassName( contentPosition )
|
|
91
91
|
);
|
|
92
92
|
|
|
93
|
+
const imgClasses = classnames(
|
|
94
|
+
'wp-block-cover__image-background',
|
|
95
|
+
id ? `wp-image-${ id }` : null,
|
|
96
|
+
{
|
|
97
|
+
'has-parallax': hasParallax,
|
|
98
|
+
'is-repeated': isRepeated,
|
|
99
|
+
}
|
|
100
|
+
);
|
|
101
|
+
|
|
93
102
|
const gradientValue = gradient || customGradient;
|
|
94
103
|
|
|
95
104
|
return (
|
|
@@ -116,20 +125,23 @@ export default function save( { attributes } ) {
|
|
|
116
125
|
|
|
117
126
|
{ ! useFeaturedImage &&
|
|
118
127
|
isImageBackground &&
|
|
119
|
-
|
|
120
|
-
|
|
128
|
+
url &&
|
|
129
|
+
( isImgElement ? (
|
|
121
130
|
<img
|
|
122
|
-
className={
|
|
123
|
-
'wp-block-cover__image-background',
|
|
124
|
-
id ? `wp-image-${ id }` : null
|
|
125
|
-
) }
|
|
131
|
+
className={ imgClasses }
|
|
126
132
|
alt={ alt }
|
|
127
133
|
src={ url }
|
|
128
134
|
style={ { objectPosition } }
|
|
129
135
|
data-object-fit="cover"
|
|
130
136
|
data-object-position={ objectPosition }
|
|
131
137
|
/>
|
|
132
|
-
)
|
|
138
|
+
) : (
|
|
139
|
+
<div
|
|
140
|
+
role="img"
|
|
141
|
+
className={ imgClasses }
|
|
142
|
+
style={ { backgroundPosition, backgroundImage } }
|
|
143
|
+
/>
|
|
144
|
+
) ) }
|
|
133
145
|
{ isVideoBackground && url && (
|
|
134
146
|
<video
|
|
135
147
|
className={ classnames(
|
package/src/cover/shared.js
CHANGED
|
@@ -21,11 +21,13 @@ export const VIDEO_BACKGROUND_TYPE = 'video';
|
|
|
21
21
|
export const COVER_MIN_HEIGHT = 50;
|
|
22
22
|
export const COVER_MAX_HEIGHT = 1000;
|
|
23
23
|
export const COVER_DEFAULT_HEIGHT = 300;
|
|
24
|
-
export
|
|
25
|
-
return url ? { backgroundImage: `url(${ url })` } : {};
|
|
26
|
-
}
|
|
24
|
+
export const DEFAULT_FOCAL_POINT = { x: 0.5, y: 0.5 };
|
|
27
25
|
export const ALLOWED_MEDIA_TYPES = [ 'image', 'video' ];
|
|
28
26
|
|
|
27
|
+
export function mediaPosition( { x, y } = DEFAULT_FOCAL_POINT ) {
|
|
28
|
+
return `${ Math.round( x * 100 ) }% ${ Math.round( y * 100 ) }%`;
|
|
29
|
+
}
|
|
30
|
+
|
|
29
31
|
export function dimRatioToClass( ratio ) {
|
|
30
32
|
return ratio === 50 || ! ratio === undefined
|
|
31
33
|
? null
|
|
@@ -106,7 +108,3 @@ export function getPositionClassName( contentPosition ) {
|
|
|
106
108
|
|
|
107
109
|
return POSITION_CLASSNAMES[ contentPosition ];
|
|
108
110
|
}
|
|
109
|
-
|
|
110
|
-
export function mediaPosition( { x, y } ) {
|
|
111
|
-
return `${ Math.round( x * 100 ) }% ${ Math.round( y * 100 ) }%`;
|
|
112
|
-
}
|
package/src/cover/style.scss
CHANGED
|
@@ -12,27 +12,6 @@
|
|
|
12
12
|
// This block has customizable padding, border-box makes that more predictable.
|
|
13
13
|
box-sizing: border-box;
|
|
14
14
|
|
|
15
|
-
&.has-parallax {
|
|
16
|
-
background-attachment: fixed;
|
|
17
|
-
|
|
18
|
-
// Mobile Safari does not support fixed background attachment properly.
|
|
19
|
-
// See also https://stackoverflow.com/questions/24154666/background-size-cover-not-working-on-ios
|
|
20
|
-
// Chrome on Android does not appear to support the attachment at all: https://issuetracker.google.com/issues/36908439
|
|
21
|
-
@supports (-webkit-touch-callout: inherit) {
|
|
22
|
-
background-attachment: scroll;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
// Remove the appearance of scrolling based on OS-level animation preferences.
|
|
26
|
-
@media (prefers-reduced-motion: reduce) {
|
|
27
|
-
background-attachment: scroll;
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
&.is-repeated {
|
|
32
|
-
background-repeat: repeat;
|
|
33
|
-
background-size: auto;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
15
|
/**
|
|
37
16
|
* Set a default background color for has-background-dim _unless_ it includes another
|
|
38
17
|
* background-color class (e.g. has-green-background-color). The presence of another
|
|
@@ -196,7 +175,7 @@
|
|
|
196
175
|
}
|
|
197
176
|
|
|
198
177
|
// Extra specificity for in edit mode where other styles would override it otherwise.
|
|
199
|
-
|
|
178
|
+
.wp-block-cover__image-background,
|
|
200
179
|
video.wp-block-cover__video-background {
|
|
201
180
|
position: absolute;
|
|
202
181
|
top: 0;
|
|
@@ -216,6 +195,32 @@
|
|
|
216
195
|
}
|
|
217
196
|
}
|
|
218
197
|
|
|
198
|
+
.wp-block-cover-image,
|
|
199
|
+
.wp-block-cover,
|
|
200
|
+
.wp-block-cover__image-background,
|
|
201
|
+
video.wp-block-cover__video-background {
|
|
202
|
+
&.has-parallax {
|
|
203
|
+
background-attachment: fixed;
|
|
204
|
+
|
|
205
|
+
// Mobile Safari does not support fixed background attachment properly.
|
|
206
|
+
// See also https://stackoverflow.com/questions/24154666/background-size-cover-not-working-on-ios
|
|
207
|
+
// Chrome on Android does not appear to support the attachment at all: https://issuetracker.google.com/issues/36908439
|
|
208
|
+
@supports (-webkit-overflow-scrolling: touch) {
|
|
209
|
+
background-attachment: scroll;
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
// Remove the appearance of scrolling based on OS-level animation preferences.
|
|
213
|
+
@media (prefers-reduced-motion: reduce) {
|
|
214
|
+
background-attachment: scroll;
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
&.is-repeated {
|
|
219
|
+
background-repeat: repeat;
|
|
220
|
+
background-size: auto;
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
|
|
219
224
|
.wp-block-cover__video-background {
|
|
220
225
|
z-index: z-index(".wp-block-cover__video-background");
|
|
221
226
|
}
|
|
@@ -493,13 +493,10 @@ describe( 'color settings', () => {
|
|
|
493
493
|
} );
|
|
494
494
|
|
|
495
495
|
it( 'clears the selected overlay color and mantains the inner blocks', async () => {
|
|
496
|
-
const {
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
} = await initializeEditor( {
|
|
501
|
-
initialHtml: COVER_BLOCK_SOLID_COLOR_HTML,
|
|
502
|
-
} );
|
|
496
|
+
const { getByTestId, getByA11yLabel, getByText } =
|
|
497
|
+
await initializeEditor( {
|
|
498
|
+
initialHtml: COVER_BLOCK_SOLID_COLOR_HTML,
|
|
499
|
+
} );
|
|
503
500
|
|
|
504
501
|
// Wait for the block to be created.
|
|
505
502
|
const coverBlock = await waitFor( () =>
|
package/src/cover/transforms.js
CHANGED
|
@@ -66,13 +66,8 @@ const transforms = {
|
|
|
66
66
|
type: 'block',
|
|
67
67
|
blocks: [ 'core/group' ],
|
|
68
68
|
transform: ( attributes, innerBlocks ) => {
|
|
69
|
-
const {
|
|
70
|
-
|
|
71
|
-
anchor,
|
|
72
|
-
backgroundColor,
|
|
73
|
-
gradient,
|
|
74
|
-
style,
|
|
75
|
-
} = attributes;
|
|
69
|
+
const { align, anchor, backgroundColor, gradient, style } =
|
|
70
|
+
attributes;
|
|
76
71
|
|
|
77
72
|
// If the Group block being transformed has a Cover block as its
|
|
78
73
|
// only child return that Cover block.
|
package/src/embed/block.json
CHANGED