@wordpress/block-library 7.4.0 → 7.7.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 +10 -0
- package/README.md +3 -2
- package/babel-plugin.js +154 -0
- package/build/audio/edit.js +4 -16
- package/build/audio/edit.js.map +1 -1
- package/build/block/edit.js +10 -9
- package/build/block/edit.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 +7 -3
- package/build/button/edit.native.js.map +1 -1
- package/build/button/index.js +1 -0
- package/build/button/index.js.map +1 -1
- package/build/button/save.js +1 -1
- package/build/button/save.js.map +1 -1
- package/build/categories/edit.js +1 -1
- package/build/categories/edit.js.map +1 -1
- package/build/categories/index.js +1 -1
- package/build/columns/index.js +3 -1
- package/build/columns/index.js.map +1 -1
- package/build/comment-author-avatar/index.js +1 -0
- package/build/comment-author-avatar/index.js.map +1 -1
- package/build/comment-template/edit.js +1 -3
- package/build/comment-template/edit.js.map +1 -1
- package/build/{comments-query-loop → comments}/edit/comments-inspector-controls.js +0 -0
- package/{build-module/comments-query-loop → build/comments}/edit/comments-inspector-controls.js.map +1 -1
- package/build/{comments-query-loop → comments}/edit.js +3 -3
- package/build/comments/edit.js.map +1 -0
- package/build/{comments-query-loop → comments}/index.js +1 -1
- package/build/comments/index.js.map +1 -0
- package/build/{comments-query-loop → comments}/save.js +2 -2
- package/build/comments/save.js.map +1 -0
- package/build/comments-title/deprecated.js +110 -0
- package/build/comments-title/deprecated.js.map +1 -0
- package/build/comments-title/edit.js +35 -35
- package/build/comments-title/edit.js.map +1 -1
- package/build/comments-title/index.js +5 -8
- package/build/comments-title/index.js.map +1 -1
- package/build/cover/controls.native.js +2 -3
- 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 +115 -0
- package/build/cover/edit/block-controls.js.map +1 -0
- package/build/cover/edit/cover-placeholder.js +49 -0
- package/build/cover/edit/cover-placeholder.js.map +1 -0
- package/build/cover/edit/index.js +343 -0
- package/build/cover/edit/index.js.map +1 -0
- package/build/cover/edit/inspector-controls.js +224 -0
- package/build/cover/edit/inspector-controls.js.map +1 -0
- package/build/cover/edit/resizable-cover.js +67 -0
- package/build/cover/edit/resizable-cover.js.map +1 -0
- package/build/cover/edit/use-cover-is-dark.js +81 -0
- package/build/cover/edit/use-cover-is-dark.js.map +1 -0
- package/build/cover/edit.native.js +36 -16
- package/build/cover/edit.native.js.map +1 -1
- package/build/cover/focal-point-settings-button.native.js.map +1 -1
- package/build/cover/save.js +18 -5
- package/build/cover/save.js.map +1 -1
- package/build/cover/shared.js +15 -9
- package/build/cover/shared.js.map +1 -1
- package/build/cover/transforms.js +77 -6
- package/build/cover/transforms.js.map +1 -1
- package/build/cover/use-cover-is-dark.native.js +60 -0
- package/build/cover/use-cover-is-dark.native.js.map +1 -0
- package/build/embed/embed-preview.js +1 -1
- package/build/embed/embed-preview.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 +0 -1
- package/build/file/edit.native.js.map +1 -1
- package/build/file/save.js +9 -1
- package/build/file/save.js.map +1 -1
- package/build/gallery/edit.js +2 -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/gap-styles.js +14 -4
- package/build/gallery/gap-styles.js.map +1 -1
- package/build/gallery/index.js +1 -1
- package/build/gallery/shared.js +2 -2
- package/build/gallery/shared.js.map +1 -1
- package/build/gallery/use-get-media.js +2 -1
- package/build/gallery/use-get-media.js.map +1 -1
- package/build/gallery/use-short-code-transform.js +19 -18
- package/build/gallery/use-short-code-transform.js.map +1 -1
- package/build/gallery/v1/gallery.js +1 -1
- package/build/gallery/v1/gallery.js.map +1 -1
- package/build/group/index.js +1 -0
- package/build/group/index.js.map +1 -1
- package/build/heading/edit.js +6 -2
- package/build/heading/edit.js.map +1 -1
- package/build/heading/index.js +1 -0
- package/build/heading/index.js.map +1 -1
- package/build/heading/transforms.js +9 -4
- package/build/heading/transforms.js.map +1 -1
- package/build/image/edit.js +5 -56
- package/build/image/edit.js.map +1 -1
- package/build/image/edit.native.js +56 -4
- package/build/image/edit.native.js.map +1 -1
- package/build/image/image.js +4 -14
- package/build/image/image.js.map +1 -1
- package/build/index.js +48 -14
- package/build/index.js.map +1 -1
- package/build/is-block-metadata-experimental.js +18 -0
- package/build/is-block-metadata-experimental.js.map +1 -0
- package/build/latest-posts/edit.js +30 -4
- package/build/latest-posts/edit.js.map +1 -1
- package/build/latest-posts/edit.native.js +49 -0
- package/build/latest-posts/edit.native.js.map +1 -1
- package/build/list/transforms.js +6 -0
- package/build/list/transforms.js.map +1 -1
- package/build/list/v2/edit.js +2 -1
- package/build/list/v2/edit.js.map +1 -1
- package/build/list/v2/migrate.js +1 -0
- package/build/list/v2/migrate.js.map +1 -1
- package/build/list/v2/transforms.js +46 -9
- package/build/list/v2/transforms.js.map +1 -1
- package/build/list-item/edit.js +7 -9
- package/build/list-item/edit.js.map +1 -1
- package/build/list-item/hooks/index.js +24 -0
- package/build/list-item/hooks/index.js.map +1 -1
- package/build/list-item/hooks/use-backspace.js +59 -0
- package/build/list-item/hooks/use-backspace.js.map +1 -0
- package/build/list-item/hooks/use-enter.js +6 -9
- package/build/list-item/hooks/use-enter.js.map +1 -1
- package/build/list-item/hooks/use-indent-list-item.js +33 -39
- package/build/list-item/hooks/use-indent-list-item.js.map +1 -1
- package/build/list-item/hooks/use-space.js +54 -0
- package/build/list-item/hooks/use-space.js.map +1 -0
- package/build/list-item/hooks/use-split.js +44 -0
- package/build/list-item/hooks/use-split.js.map +1 -0
- package/build/list-item/index.js +1 -0
- package/build/list-item/index.js.map +1 -1
- package/build/list-item/utils.js +1 -1
- package/build/list-item/utils.js.map +1 -1
- package/build/media-text/edit.native.js +2 -1
- package/build/media-text/edit.native.js.map +1 -1
- package/build/media-text/media-container.native.js +2 -4
- package/build/media-text/media-container.native.js.map +1 -1
- package/build/media-text/transforms.js +137 -8
- package/build/media-text/transforms.js.map +1 -1
- package/build/navigation/edit/index.js +91 -109
- package/build/navigation/edit/index.js.map +1 -1
- package/build/navigation/edit/inner-blocks.js +6 -12
- package/build/navigation/edit/inner-blocks.js.map +1 -1
- package/build/navigation/index.js +0 -1
- package/build/navigation/index.js.map +1 -1
- package/build/navigation/use-navigation-entities.js +3 -3
- package/build/navigation/use-navigation-entities.js.map +1 -1
- package/build/navigation/view-modal.js +25 -0
- package/build/navigation/view-modal.js.map +1 -1
- package/build/navigation-link/edit.js +60 -35
- package/build/navigation-link/edit.js.map +1 -1
- package/build/navigation-link/fallback-variations.js +1 -1
- package/build/navigation-link/fallback-variations.js.map +1 -1
- package/build/navigation-link/hooks.js +1 -1
- package/build/navigation-link/hooks.js.map +1 -1
- package/build/navigation-submenu/edit.js +14 -14
- package/build/navigation-submenu/edit.js.map +1 -1
- package/build/page-list/convert-to-links-modal.js +1 -1
- package/build/page-list/convert-to-links-modal.js.map +1 -1
- package/build/page-list/edit.js +1 -1
- package/build/page-list/edit.js.map +1 -1
- package/build/paragraph/edit.js +10 -0
- package/build/paragraph/edit.js.map +1 -1
- package/build/paragraph/use-enter.js +94 -0
- package/build/paragraph/use-enter.js.map +1 -0
- package/build/post-author/edit.js +1 -1
- package/build/post-author/edit.js.map +1 -1
- package/build/post-author-name/index.js +4 -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-comment/index.js +2 -1
- package/build/post-comment/index.js.map +1 -1
- package/build/post-comments/edit.js +138 -35
- package/build/post-comments/edit.js.map +1 -1
- package/build/post-comments/index.js +3 -2
- package/build/post-comments/index.js.map +1 -1
- package/build/post-comments-count/index.js +1 -0
- package/build/post-comments-count/index.js.map +1 -1
- package/build/post-comments-form/edit.js +38 -4
- package/build/post-comments-form/edit.js.map +1 -1
- package/build/post-comments-form/form.js +58 -0
- package/build/post-comments-form/form.js.map +1 -0
- package/build/post-comments-form/index.js +1 -0
- package/build/post-comments-form/index.js.map +1 -1
- package/build/post-comments-link/index.js +1 -0
- package/build/post-comments-link/index.js.map +1 -1
- package/build/post-content/edit.js +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-excerpt/edit.js +1 -1
- package/build/post-excerpt/edit.js.map +1 -1
- package/build/post-featured-image/edit.js +1 -1
- package/build/post-featured-image/edit.js.map +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 +35 -4
- package/build/post-terms/edit.js.map +1 -1
- package/build/post-terms/hooks.js +33 -0
- package/build/post-terms/hooks.js.map +1 -0
- package/build/post-terms/index.js +20 -5
- package/build/post-terms/index.js.map +1 -1
- package/build/post-title/index.js +1 -1
- package/build/post-title/index.js.map +1 -1
- package/build/pullquote/edit.js +1 -1
- package/build/pullquote/edit.js.map +1 -1
- package/build/pullquote/edit.native.js +1 -1
- package/build/pullquote/edit.native.js.map +1 -1
- package/build/query/edit/inspector-controls/index.js +26 -17
- package/build/query/edit/inspector-controls/index.js.map +1 -1
- package/build/query/edit/inspector-controls/parent-control.js +148 -0
- package/build/query/edit/inspector-controls/parent-control.js.map +1 -0
- package/build/query/edit/inspector-controls/sticky-control.js +41 -0
- package/build/query/edit/inspector-controls/sticky-control.js.map +1 -0
- package/build/query/index.js +2 -1
- package/build/query/index.js.map +1 -1
- package/build/query/utils.js +28 -2
- package/build/query/utils.js.map +1 -1
- package/build/query-no-results/edit.js +1 -1
- package/build/query-no-results/edit.js.map +1 -1
- package/build/query-title/index.js +1 -1
- package/build/query-title/index.js.map +1 -1
- package/build/query-title/variations.js +1 -1
- package/build/query-title/variations.js.map +1 -1
- package/build/quote/edit.js +3 -2
- package/build/quote/edit.js.map +1 -1
- package/build/quote/index.js +1 -0
- package/build/quote/index.js.map +1 -1
- package/build/quote/v2/edit.js +1 -1
- package/build/quote/v2/edit.js.map +1 -1
- package/build/search/edit.js +2 -1
- package/build/search/edit.js.map +1 -1
- package/build/search/index.js +4 -0
- package/build/search/index.js.map +1 -1
- package/build/separator/index.js +3 -0
- package/build/separator/index.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 +1 -1
- package/build/site-logo/edit.js.map +1 -1
- package/build/social-links/edit.js +2 -2
- package/build/social-links/edit.js.map +1 -1
- package/build/table/edit.js +15 -2
- package/build/table/edit.js.map +1 -1
- package/build/table-of-contents/edit.js +145 -65
- package/build/table-of-contents/edit.js.map +1 -1
- package/build/table-of-contents/index.js +13 -3
- package/build/table-of-contents/index.js.map +1 -1
- package/build/table-of-contents/list.js +16 -9
- package/build/table-of-contents/list.js.map +1 -1
- package/build/table-of-contents/save.js +40 -0
- package/build/table-of-contents/save.js.map +1 -0
- package/build/table-of-contents/utils.js +11 -77
- package/build/table-of-contents/utils.js.map +1 -1
- package/build/template-part/edit/index.js +7 -3
- package/build/template-part/edit/index.js.map +1 -1
- package/build/template-part/edit/inner-blocks.js +3 -8
- package/build/template-part/edit/inner-blocks.js.map +1 -1
- package/build/video/edit.js +4 -8
- package/build/video/edit.js.map +1 -1
- package/build-module/audio/edit.js +5 -17
- package/build-module/audio/edit.js.map +1 -1
- package/build-module/block/edit.js +11 -10
- package/build-module/block/edit.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 +7 -3
- package/build-module/button/edit.native.js.map +1 -1
- package/build-module/button/index.js +1 -0
- package/build-module/button/index.js.map +1 -1
- package/build-module/button/save.js +2 -2
- package/build-module/button/save.js.map +1 -1
- package/build-module/categories/edit.js +1 -1
- package/build-module/categories/edit.js.map +1 -1
- package/build-module/categories/index.js +1 -1
- package/build-module/columns/index.js +3 -1
- package/build-module/columns/index.js.map +1 -1
- package/build-module/comment-author-avatar/index.js +1 -0
- package/build-module/comment-author-avatar/index.js.map +1 -1
- package/build-module/comment-template/edit.js +1 -3
- package/build-module/comment-template/edit.js.map +1 -1
- package/build-module/{comments-query-loop → comments}/edit/comments-inspector-controls.js +0 -0
- package/build-module/comments/edit/comments-inspector-controls.js.map +1 -0
- package/build-module/{comments-query-loop → comments}/edit.js +2 -2
- package/build-module/comments/edit.js.map +1 -0
- package/build-module/{comments-query-loop → comments}/index.js +1 -1
- package/build-module/comments/index.js.map +1 -0
- package/build-module/{comments-query-loop → comments}/save.js +1 -1
- package/build-module/comments/save.js.map +1 -0
- package/build-module/comments-title/deprecated.js +102 -0
- package/build-module/comments-title/deprecated.js.map +1 -0
- package/build-module/comments-title/edit.js +38 -38
- package/build-module/comments-title/edit.js.map +1 -1
- package/build-module/comments-title/index.js +4 -8
- package/build-module/comments-title/index.js.map +1 -1
- package/build-module/cover/controls.native.js +2 -3
- 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 +104 -0
- package/build-module/cover/edit/block-controls.js.map +1 -0
- package/build-module/cover/edit/cover-placeholder.js +38 -0
- package/build-module/cover/edit/cover-placeholder.js.map +1 -0
- package/build-module/cover/edit/index.js +317 -0
- package/build-module/cover/edit/index.js.map +1 -0
- package/build-module/cover/edit/inspector-controls.js +215 -0
- package/build-module/cover/edit/inspector-controls.js.map +1 -0
- package/build-module/cover/edit/resizable-cover.js +55 -0
- package/build-module/cover/edit/resizable-cover.js.map +1 -0
- package/build-module/cover/edit/use-cover-is-dark.js +70 -0
- package/build-module/cover/edit/use-cover-is-dark.js.map +1 -0
- package/build-module/cover/edit.native.js +35 -17
- package/build-module/cover/edit.native.js.map +1 -1
- package/build-module/cover/focal-point-settings-button.native.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 -5
- package/build-module/cover/shared.js.map +1 -1
- package/build-module/cover/transforms.js +74 -6
- package/build-module/cover/transforms.js.map +1 -1
- package/build-module/cover/use-cover-is-dark.native.js +51 -0
- package/build-module/cover/use-cover-is-dark.native.js.map +1 -0
- package/build-module/embed/embed-preview.js +2 -2
- package/build-module/embed/embed-preview.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 +0 -1
- package/build-module/file/edit.native.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 -1
- 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/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/shared.js +2 -2
- package/build-module/gallery/shared.js.map +1 -1
- package/build-module/gallery/use-get-media.js +2 -1
- package/build-module/gallery/use-get-media.js.map +1 -1
- package/build-module/gallery/use-short-code-transform.js +19 -18
- package/build-module/gallery/use-short-code-transform.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/group/index.js +1 -0
- package/build-module/group/index.js.map +1 -1
- package/build-module/heading/edit.js +6 -2
- package/build-module/heading/edit.js.map +1 -1
- package/build-module/heading/index.js +1 -0
- package/build-module/heading/index.js.map +1 -1
- package/build-module/heading/transforms.js +9 -4
- package/build-module/heading/transforms.js.map +1 -1
- package/build-module/image/edit.js +4 -52
- package/build-module/image/edit.js.map +1 -1
- package/build-module/image/edit.native.js +57 -6
- package/build-module/image/edit.native.js.map +1 -1
- package/build-module/image/image.js +6 -16
- package/build-module/image/image.js.map +1 -1
- package/build-module/index.js +43 -12
- package/build-module/index.js.map +1 -1
- package/build-module/is-block-metadata-experimental.js +16 -0
- package/build-module/is-block-metadata-experimental.js.map +1 -0
- package/build-module/latest-posts/edit.js +29 -5
- package/build-module/latest-posts/edit.js.map +1 -1
- package/build-module/latest-posts/edit.native.js +51 -2
- package/build-module/latest-posts/edit.native.js.map +1 -1
- package/build-module/list/transforms.js +6 -0
- package/build-module/list/transforms.js.map +1 -1
- package/build-module/list/v2/edit.js +2 -1
- package/build-module/list/v2/edit.js.map +1 -1
- package/build-module/list/v2/migrate.js +1 -3
- package/build-module/list/v2/migrate.js.map +1 -1
- package/build-module/list/v2/transforms.js +46 -9
- package/build-module/list/v2/transforms.js.map +1 -1
- package/build-module/list-item/edit.js +8 -9
- package/build-module/list-item/edit.js.map +1 -1
- package/build-module/list-item/hooks/index.js +3 -0
- package/build-module/list-item/hooks/index.js.map +1 -1
- package/build-module/list-item/hooks/use-backspace.js +44 -0
- package/build-module/list-item/hooks/use-backspace.js.map +1 -0
- package/build-module/list-item/hooks/use-enter.js +6 -9
- package/build-module/list-item/hooks/use-enter.js.map +1 -1
- package/build-module/list-item/hooks/use-indent-list-item.js +33 -38
- package/build-module/list-item/hooks/use-indent-list-item.js.map +1 -1
- package/build-module/list-item/hooks/use-space.js +40 -0
- package/build-module/list-item/hooks/use-space.js.map +1 -0
- package/build-module/list-item/hooks/use-split.js +33 -0
- package/build-module/list-item/hooks/use-split.js.map +1 -0
- package/build-module/list-item/index.js +1 -0
- package/build-module/list-item/index.js.map +1 -1
- package/build-module/list-item/utils.js +1 -1
- package/build-module/list-item/utils.js.map +1 -1
- package/build-module/media-text/edit.native.js +2 -1
- package/build-module/media-text/edit.native.js.map +1 -1
- package/build-module/media-text/media-container.native.js +2 -4
- package/build-module/media-text/media-container.native.js.map +1 -1
- package/build-module/media-text/transforms.js +137 -8
- package/build-module/media-text/transforms.js.map +1 -1
- package/build-module/navigation/edit/index.js +93 -110
- package/build-module/navigation/edit/index.js.map +1 -1
- package/build-module/navigation/edit/inner-blocks.js +7 -13
- package/build-module/navigation/edit/inner-blocks.js.map +1 -1
- package/build-module/navigation/index.js +0 -1
- package/build-module/navigation/index.js.map +1 -1
- package/build-module/navigation/use-navigation-entities.js +1 -1
- package/build-module/navigation/use-navigation-entities.js.map +1 -1
- package/build-module/navigation/view-modal.js +24 -0
- package/build-module/navigation/view-modal.js.map +1 -1
- package/build-module/navigation-link/edit.js +60 -36
- package/build-module/navigation-link/edit.js.map +1 -1
- package/build-module/navigation-link/fallback-variations.js +1 -1
- package/build-module/navigation-link/fallback-variations.js.map +1 -1
- package/build-module/navigation-link/hooks.js +2 -2
- package/build-module/navigation-link/hooks.js.map +1 -1
- package/build-module/navigation-submenu/edit.js +14 -14
- package/build-module/navigation-submenu/edit.js.map +1 -1
- package/build-module/page-list/convert-to-links-modal.js +1 -1
- package/build-module/page-list/convert-to-links-modal.js.map +1 -1
- package/build-module/page-list/edit.js +1 -1
- package/build-module/page-list/edit.js.map +1 -1
- package/build-module/paragraph/edit.js +9 -0
- package/build-module/paragraph/edit.js.map +1 -1
- package/build-module/paragraph/use-enter.js +81 -0
- package/build-module/paragraph/use-enter.js.map +1 -0
- package/build-module/post-author/edit.js +1 -1
- package/build-module/post-author/edit.js.map +1 -1
- package/build-module/post-author-name/index.js +3 -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-comment/index.js +2 -1
- package/build-module/post-comment/index.js.map +1 -1
- package/build-module/post-comments/edit.js +139 -37
- package/build-module/post-comments/edit.js.map +1 -1
- package/build-module/post-comments/index.js +3 -2
- package/build-module/post-comments/index.js.map +1 -1
- package/build-module/post-comments-count/index.js +1 -0
- package/build-module/post-comments-count/index.js.map +1 -1
- package/build-module/post-comments-form/edit.js +38 -6
- package/build-module/post-comments-form/edit.js.map +1 -1
- package/build-module/post-comments-form/form.js +45 -0
- package/build-module/post-comments-form/form.js.map +1 -0
- package/build-module/post-comments-form/index.js +1 -0
- package/build-module/post-comments-form/index.js.map +1 -1
- package/build-module/post-comments-link/index.js +1 -0
- package/build-module/post-comments-link/index.js.map +1 -1
- package/build-module/post-content/edit.js +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-excerpt/edit.js +1 -1
- package/build-module/post-excerpt/edit.js.map +1 -1
- package/build-module/post-featured-image/edit.js +1 -1
- package/build-module/post-featured-image/edit.js.map +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 +35 -6
- package/build-module/post-terms/edit.js.map +1 -1
- package/build-module/post-terms/hooks.js +25 -0
- package/build-module/post-terms/hooks.js.map +1 -0
- package/build-module/post-terms/index.js +18 -8
- package/build-module/post-terms/index.js.map +1 -1
- package/build-module/post-title/index.js +1 -1
- package/build-module/post-title/index.js.map +1 -1
- package/build-module/pullquote/edit.js +2 -2
- package/build-module/pullquote/edit.js.map +1 -1
- package/build-module/pullquote/edit.native.js +2 -2
- package/build-module/pullquote/edit.native.js.map +1 -1
- package/build-module/query/edit/inspector-controls/index.js +24 -17
- package/build-module/query/edit/inspector-controls/index.js.map +1 -1
- package/build-module/query/edit/inspector-controls/parent-control.js +135 -0
- package/build-module/query/edit/inspector-controls/parent-control.js.map +1 -0
- package/build-module/query/edit/inspector-controls/sticky-control.js +31 -0
- package/build-module/query/edit/inspector-controls/sticky-control.js.map +1 -0
- package/build-module/query/index.js +2 -1
- package/build-module/query/index.js.map +1 -1
- package/build-module/query/utils.js +21 -0
- package/build-module/query/utils.js.map +1 -1
- package/build-module/query-no-results/edit.js +1 -1
- package/build-module/query-no-results/edit.js.map +1 -1
- package/build-module/query-title/index.js +1 -1
- package/build-module/query-title/index.js.map +1 -1
- package/build-module/query-title/variations.js +2 -2
- package/build-module/query-title/variations.js.map +1 -1
- package/build-module/quote/edit.js +4 -3
- package/build-module/quote/edit.js.map +1 -1
- package/build-module/quote/index.js +1 -0
- package/build-module/quote/index.js.map +1 -1
- package/build-module/quote/v2/edit.js +2 -2
- package/build-module/quote/v2/edit.js.map +1 -1
- package/build-module/search/edit.js +3 -2
- package/build-module/search/edit.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/index.js +3 -0
- package/build-module/separator/index.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 +1 -1
- package/build-module/site-logo/edit.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/table/edit.js +17 -4
- package/build-module/table/edit.js.map +1 -1
- package/build-module/table-of-contents/edit.js +144 -68
- package/build-module/table-of-contents/edit.js.map +1 -1
- package/build-module/table-of-contents/index.js +12 -3
- package/build-module/table-of-contents/index.js.map +1 -1
- package/build-module/table-of-contents/list.js +18 -10
- package/build-module/table-of-contents/list.js.map +1 -1
- package/build-module/table-of-contents/save.js +28 -0
- package/build-module/table-of-contents/save.js.map +1 -0
- package/build-module/table-of-contents/utils.js +11 -73
- package/build-module/table-of-contents/utils.js.map +1 -1
- package/build-module/template-part/edit/index.js +8 -4
- package/build-module/template-part/edit/index.js.map +1 -1
- package/build-module/template-part/edit/inner-blocks.js +4 -9
- package/build-module/template-part/edit/inner-blocks.js.map +1 -1
- package/build-module/video/edit.js +5 -9
- package/build-module/video/edit.js.map +1 -1
- package/build-style/comment-content/style-rtl.css +81 -0
- package/build-style/comment-content/style.css +81 -0
- package/build-style/{comments-query-loop → comments}/editor-rtl.css +0 -0
- package/build-style/{comments-query-loop → comments}/editor.css +0 -0
- package/build-style/cover/style-rtl.css +32 -27
- package/build-style/cover/style.css +32 -27
- package/build-style/editor-rtl.css +16 -10
- package/build-style/editor.css +16 -10
- package/build-style/image/editor-rtl.css +1 -1
- package/build-style/image/editor.css +1 -1
- package/build-style/latest-posts/style-rtl.css +2 -0
- package/build-style/latest-posts/style.css +4 -0
- package/build-style/navigation/style-rtl.css +3 -0
- package/build-style/navigation/style.css +3 -0
- package/build-style/post-comments/editor-rtl.css +79 -0
- package/build-style/post-comments/editor.css +79 -0
- package/build-style/post-comments/style-rtl.css +27 -3
- package/build-style/post-comments/style.css +27 -3
- package/build-style/post-comments-form/editor-rtl.css +79 -0
- package/build-style/post-comments-form/editor.css +79 -0
- package/build-style/post-comments-form/style-rtl.css +1 -3
- package/build-style/post-comments-form/style.css +1 -3
- package/build-style/separator/editor-rtl.css +1 -0
- package/build-style/separator/editor.css +1 -0
- 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 +69 -33
- package/build-style/style.css +71 -33
- package/build-style/video/editor-rtl.css +2 -5
- package/build-style/video/editor.css +2 -5
- package/build-types/table-of-contents/list.d.ts +12 -0
- package/build-types/table-of-contents/list.d.ts.map +1 -0
- package/build-types/table-of-contents/utils.d.ts +24 -0
- package/build-types/table-of-contents/utils.d.ts.map +1 -0
- package/package.json +30 -29
- package/src/audio/edit.js +6 -9
- package/src/avatar/block.json +0 -1
- package/src/avatar/index.php +2 -2
- package/src/block/edit.js +39 -42
- package/src/block/test/edit.native.js +1 -1
- package/src/button/block.json +1 -0
- package/src/button/deprecated.js +145 -0
- package/src/button/edit.js +3 -1
- package/src/button/edit.native.js +6 -3
- package/src/button/save.js +3 -1
- package/src/buttons/test/__snapshots__/edit.native.js.snap +1 -1
- package/src/buttons/test/edit.native.js +1 -1
- package/src/categories/block.json +1 -1
- package/src/categories/edit.js +1 -1
- package/src/columns/block.json +3 -1
- package/src/comment-author-avatar/block.json +1 -0
- package/src/comment-author-name/index.php +7 -5
- package/src/comment-content/index.php +25 -3
- package/src/comment-content/style.scss +5 -0
- package/src/comment-edit-link/index.php +1 -4
- package/src/comment-reply-link/index.php +1 -4
- package/src/comment-template/edit.js +1 -5
- package/src/comment-template/index.php +4 -0
- package/src/{comments-query-loop → comments}/block.json +1 -1
- package/src/{comments-query-loop → comments}/edit/comments-inspector-controls.js +0 -0
- package/src/{comments-query-loop → comments}/edit.js +2 -1
- package/src/{comments-query-loop → comments}/editor.scss +0 -0
- package/src/{comments-query-loop → comments}/index.js +0 -0
- package/src/{comments-query-loop → comments}/save.js +1 -3
- package/src/comments-pagination/index.php +4 -0
- package/src/comments-title/block.json +0 -6
- package/src/comments-title/deprecated.js +34 -0
- package/src/comments-title/edit.js +44 -84
- package/src/comments-title/index.js +3 -1
- package/src/comments-title/index.php +51 -22
- package/src/cover/controls.native.js +1 -2
- package/src/cover/deprecated.js +230 -183
- package/src/cover/edit/block-controls.js +119 -0
- package/src/cover/edit/cover-placeholder.js +39 -0
- package/src/cover/edit/index.js +393 -0
- package/src/cover/edit/inspector-controls.js +286 -0
- package/src/cover/edit/resizable-cover.js +55 -0
- package/src/cover/edit/use-cover-is-dark.js +71 -0
- package/src/cover/edit.native.js +40 -14
- package/src/cover/editor.scss +1 -1
- package/src/cover/focal-point-settings-button.native.js +1 -1
- package/src/cover/index.php +20 -37
- package/src/cover/save.js +26 -13
- package/src/cover/shared.js +5 -3
- package/src/cover/style.native.scss +4 -0
- package/src/cover/style.scss +27 -26
- package/src/cover/test/__snapshots__/edit.native.js.snap +6 -6
- package/src/cover/test/block-controls.js +62 -0
- package/src/cover/test/transforms.js +301 -0
- package/src/cover/transforms.js +112 -7
- package/src/cover/use-cover-is-dark.native.js +51 -0
- package/src/editor.scss +3 -1
- package/src/embed/embed-preview.js +4 -2
- package/src/file/edit.js +5 -1
- package/src/file/edit.native.js +0 -1
- package/src/file/save.js +14 -2
- package/src/gallery/block.json +1 -1
- package/src/gallery/edit.js +2 -1
- package/src/gallery/gallery.js +2 -2
- package/src/gallery/gap-styles.js +21 -6
- package/src/gallery/index.php +23 -12
- package/src/gallery/shared.js +3 -2
- package/src/gallery/use-get-media.js +2 -1
- package/src/gallery/use-short-code-transform.js +19 -16
- package/src/gallery/v1/gallery.js +2 -2
- package/src/group/block.json +1 -0
- package/src/heading/block.json +1 -0
- package/src/heading/edit.js +5 -2
- package/src/heading/transforms.js +4 -3
- package/src/image/edit.js +0 -44
- package/src/image/edit.native.js +65 -4
- package/src/image/editor.scss +1 -1
- package/src/image/image.js +10 -13
- package/src/image/styles.native.scss +11 -0
- package/src/image/test/edit.native.js +7 -7
- package/src/index.js +53 -33
- package/src/is-block-metadata-experimental.js +19 -0
- package/src/latest-posts/edit.js +27 -2
- package/src/latest-posts/edit.native.js +56 -1
- package/src/latest-posts/index.php +12 -6
- package/src/latest-posts/style.scss +4 -0
- package/src/list/transforms.js +7 -0
- package/src/list/v2/edit.js +1 -0
- package/src/list/v2/migrate.js +1 -1
- package/src/list/v2/transforms.js +35 -0
- package/src/list-item/block.json +2 -1
- package/src/list-item/edit.js +17 -10
- package/src/list-item/hooks/index.js +3 -0
- package/src/list-item/hooks/use-backspace.js +52 -0
- package/src/list-item/hooks/use-enter.js +9 -16
- package/src/list-item/hooks/use-indent-list-item.js +50 -63
- package/src/list-item/hooks/use-space.js +48 -0
- package/src/list-item/hooks/use-split.js +33 -0
- package/src/list-item/utils.js +1 -1
- package/src/media-text/edit.native.js +3 -1
- package/src/media-text/media-container.native.js +2 -4
- package/src/media-text/transforms.js +154 -0
- package/src/navigation/block.json +0 -1
- package/src/navigation/edit/index.js +181 -205
- package/src/navigation/edit/inner-blocks.js +6 -15
- package/src/navigation/index.php +40 -0
- package/src/navigation/style.scss +3 -0
- package/src/navigation/use-navigation-entities.js +1 -1
- package/src/navigation/view-modal.js +32 -0
- package/src/navigation-link/edit.js +75 -48
- package/src/navigation-link/fallback-variations.js +1 -1
- package/src/navigation-link/hooks.js +2 -2
- package/src/navigation-link/test/__snapshots__/hooks.js.snap +4 -4
- package/src/navigation-link/test/edit.js +0 -20
- package/src/navigation-submenu/edit.js +13 -17
- package/src/page-list/convert-to-links-modal.js +1 -1
- package/src/page-list/edit.js +1 -4
- package/src/paragraph/edit.js +6 -0
- package/src/paragraph/use-enter.js +103 -0
- package/src/post-author/edit.js +24 -22
- package/src/post-author/index.php +4 -3
- package/src/post-author-name/block.json +1 -0
- 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-comment/block.json +2 -1
- package/src/post-comments/block.json +3 -2
- package/src/post-comments/edit.js +206 -44
- package/src/post-comments/editor.scss +3 -0
- package/src/post-comments/index.php +3 -1
- package/src/post-comments/style.scss +30 -5
- package/src/post-comments-count/block.json +1 -0
- package/src/post-comments-form/block.json +1 -0
- package/src/post-comments-form/edit.js +52 -23
- package/src/post-comments-form/editor.scss +3 -0
- package/src/post-comments-form/form.js +50 -0
- package/src/post-comments-form/index.php +10 -3
- package/src/post-comments-form/style.scss +1 -4
- package/src/post-comments-link/block.json +1 -0
- package/src/post-content/edit.js +15 -1
- package/src/post-date/edit.js +4 -3
- package/src/post-excerpt/edit.js +14 -1
- package/src/post-featured-image/edit.js +1 -1
- package/src/post-template/edit.js +5 -0
- package/src/post-template/index.php +30 -0
- package/src/post-terms/block.json +8 -0
- package/src/post-terms/edit.js +47 -1
- package/src/post-terms/hooks.js +27 -0
- package/src/post-terms/index.js +14 -7
- package/src/post-terms/index.php +50 -2
- package/src/post-title/index.js +1 -1
- package/src/pullquote/edit.js +2 -2
- package/src/pullquote/edit.native.js +2 -2
- package/src/query/block.json +2 -1
- package/src/query/edit/inspector-controls/index.js +25 -11
- package/src/query/edit/inspector-controls/parent-control.js +133 -0
- package/src/query/edit/inspector-controls/sticky-control.js +25 -0
- package/src/query/utils.js +22 -0
- package/src/query-no-results/edit.js +1 -1
- package/src/query-pagination/index.php +0 -1
- package/src/query-title/index.js +1 -1
- package/src/query-title/variations.js +2 -2
- package/src/quote/block.json +1 -0
- package/src/quote/edit.js +5 -2
- package/src/quote/v2/edit.js +4 -2
- package/src/search/block.json +4 -0
- package/src/search/edit.js +4 -1
- package/src/search/index.php +29 -16
- package/src/separator/block.json +3 -0
- package/src/separator/editor.scss +1 -0
- package/src/shortcode/edit.native.js +29 -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 +58 -40
- package/src/site-logo/edit.js +1 -1
- package/src/site-logo/style.scss +6 -0
- package/src/social-links/edit.js +11 -10
- package/src/table/edit.js +19 -4
- package/src/table-of-contents/block.json +9 -2
- package/src/table-of-contents/edit.js +170 -77
- package/src/table-of-contents/index.js +2 -0
- package/src/table-of-contents/list.tsx +46 -0
- package/src/table-of-contents/save.js +25 -0
- package/src/table-of-contents/utils.ts +71 -0
- package/src/tag-cloud/block.json +1 -1
- package/src/template-part/edit/index.js +25 -15
- package/src/template-part/edit/inner-blocks.js +2 -10
- package/src/video/edit.js +7 -6
- package/src/video/editor.scss +3 -6
- package/test/babel-plugin.js +67 -0
- package/tsconfig.json +11 -0
- package/tsconfig.tsbuildinfo +1 -0
- package/build/comments-query-loop/edit/comments-inspector-controls.js.map +0 -1
- package/build/comments-query-loop/edit.js.map +0 -1
- package/build/comments-query-loop/index.js.map +0 -1
- package/build/comments-query-loop/save.js.map +0 -1
- package/build/cover/edit.js +0 -665
- package/build/cover/edit.js.map +0 -1
- package/build/navigation-area/edit.js +0 -110
- package/build/navigation-area/edit.js.map +0 -1
- package/build/navigation-area/index.js +0 -62
- package/build/navigation-area/index.js.map +0 -1
- package/build/navigation-area/inner-blocks.js +0 -34
- package/build/navigation-area/inner-blocks.js.map +0 -1
- package/build/navigation-area/save.js +0 -18
- package/build/navigation-area/save.js.map +0 -1
- package/build/post-terms/variations.js +0 -37
- package/build/post-terms/variations.js.map +0 -1
- package/build-module/comments-query-loop/edit.js.map +0 -1
- package/build-module/comments-query-loop/index.js.map +0 -1
- package/build-module/comments-query-loop/save.js.map +0 -1
- package/build-module/cover/edit.js +0 -642
- package/build-module/cover/edit.js.map +0 -1
- package/build-module/navigation-area/edit.js +0 -94
- package/build-module/navigation-area/edit.js.map +0 -1
- package/build-module/navigation-area/index.js +0 -48
- package/build-module/navigation-area/index.js.map +0 -1
- package/build-module/navigation-area/inner-blocks.js +0 -26
- package/build-module/navigation-area/inner-blocks.js.map +0 -1
- package/build-module/navigation-area/save.js +0 -10
- package/build-module/navigation-area/save.js.map +0 -1
- package/build-module/post-terms/variations.js +0 -27
- package/build-module/post-terms/variations.js.map +0 -1
- package/src/cover/edit.js +0 -822
- package/src/navigation-area/block.json +0 -23
- package/src/navigation-area/edit.js +0 -111
- package/src/navigation-area/index.js +0 -26
- package/src/navigation-area/index.php +0 -22
- package/src/navigation-area/inner-blocks.js +0 -24
- package/src/navigation-area/save.js +0 -8
- package/src/post-terms/variations.js +0 -28
- package/src/table-of-contents/index.php +0 -346
- package/src/table-of-contents/list.js +0 -28
- package/src/table-of-contents/utils.js +0 -126
|
@@ -0,0 +1,393 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* External dependencies
|
|
3
|
+
*/
|
|
4
|
+
import classnames from 'classnames';
|
|
5
|
+
import { extend } from 'colord';
|
|
6
|
+
import namesPlugin from 'colord/plugins/names';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* WordPress dependencies
|
|
10
|
+
*/
|
|
11
|
+
import { useEntityProp, store as coreStore } from '@wordpress/core-data';
|
|
12
|
+
import { useEffect, useRef } from '@wordpress/element';
|
|
13
|
+
import { Spinner } from '@wordpress/components';
|
|
14
|
+
import { compose } from '@wordpress/compose';
|
|
15
|
+
import {
|
|
16
|
+
withColors,
|
|
17
|
+
ColorPalette,
|
|
18
|
+
useBlockProps,
|
|
19
|
+
useSetting,
|
|
20
|
+
useInnerBlocksProps,
|
|
21
|
+
__experimentalUseGradient,
|
|
22
|
+
store as blockEditorStore,
|
|
23
|
+
} from '@wordpress/block-editor';
|
|
24
|
+
import { __ } from '@wordpress/i18n';
|
|
25
|
+
import { useSelect, useDispatch } from '@wordpress/data';
|
|
26
|
+
import { isBlobURL } from '@wordpress/blob';
|
|
27
|
+
import { store as noticesStore } from '@wordpress/notices';
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Internal dependencies
|
|
31
|
+
*/
|
|
32
|
+
import {
|
|
33
|
+
attributesFromMedia,
|
|
34
|
+
IMAGE_BACKGROUND_TYPE,
|
|
35
|
+
VIDEO_BACKGROUND_TYPE,
|
|
36
|
+
dimRatioToClass,
|
|
37
|
+
isContentPositionCenter,
|
|
38
|
+
getPositionClassName,
|
|
39
|
+
mediaPosition,
|
|
40
|
+
} from '../shared';
|
|
41
|
+
import useCoverIsDark from './use-cover-is-dark';
|
|
42
|
+
import CoverInspectorControls from './inspector-controls';
|
|
43
|
+
import CoverBlockControls from './block-controls';
|
|
44
|
+
import CoverPlaceholder from './cover-placeholder';
|
|
45
|
+
import ResizableCover from './resizable-cover';
|
|
46
|
+
|
|
47
|
+
extend( [ namesPlugin ] );
|
|
48
|
+
|
|
49
|
+
function getInnerBlocksTemplate( attributes ) {
|
|
50
|
+
return [
|
|
51
|
+
[
|
|
52
|
+
'core/paragraph',
|
|
53
|
+
{
|
|
54
|
+
align: 'center',
|
|
55
|
+
placeholder: __( 'Write title…' ),
|
|
56
|
+
...attributes,
|
|
57
|
+
},
|
|
58
|
+
],
|
|
59
|
+
];
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* Is the URL a temporary blob URL? A blob URL is one that is used temporarily while
|
|
64
|
+
* the media (image or video) is being uploaded and will not have an id allocated yet.
|
|
65
|
+
*
|
|
66
|
+
* @param {number} id The id of the media.
|
|
67
|
+
* @param {string} url The url of the media.
|
|
68
|
+
*
|
|
69
|
+
* @return {boolean} Is the URL a Blob URL.
|
|
70
|
+
*/
|
|
71
|
+
const isTemporaryMedia = ( id, url ) => ! id && isBlobURL( url );
|
|
72
|
+
|
|
73
|
+
function CoverEdit( {
|
|
74
|
+
attributes,
|
|
75
|
+
clientId,
|
|
76
|
+
isSelected,
|
|
77
|
+
overlayColor,
|
|
78
|
+
setAttributes,
|
|
79
|
+
setOverlayColor,
|
|
80
|
+
toggleSelection,
|
|
81
|
+
context: { postId, postType },
|
|
82
|
+
} ) {
|
|
83
|
+
const {
|
|
84
|
+
contentPosition,
|
|
85
|
+
id,
|
|
86
|
+
useFeaturedImage,
|
|
87
|
+
dimRatio,
|
|
88
|
+
focalPoint,
|
|
89
|
+
hasParallax,
|
|
90
|
+
isDark,
|
|
91
|
+
isRepeated,
|
|
92
|
+
minHeight,
|
|
93
|
+
minHeightUnit,
|
|
94
|
+
alt,
|
|
95
|
+
allowedBlocks,
|
|
96
|
+
templateLock,
|
|
97
|
+
} = attributes;
|
|
98
|
+
|
|
99
|
+
const [ featuredImage ] = useEntityProp(
|
|
100
|
+
'postType',
|
|
101
|
+
postType,
|
|
102
|
+
'featured_media',
|
|
103
|
+
postId
|
|
104
|
+
);
|
|
105
|
+
|
|
106
|
+
const media = useSelect(
|
|
107
|
+
( select ) =>
|
|
108
|
+
featuredImage &&
|
|
109
|
+
select( coreStore ).getMedia( featuredImage, { context: 'view' } ),
|
|
110
|
+
[ featuredImage ]
|
|
111
|
+
);
|
|
112
|
+
const mediaUrl = media?.source_url;
|
|
113
|
+
|
|
114
|
+
// instead of destructuring the attributes
|
|
115
|
+
// we define the url and background type
|
|
116
|
+
// depending on the value of the useFeaturedImage flag
|
|
117
|
+
// to preview in edit the dynamic featured image
|
|
118
|
+
const url = useFeaturedImage ? mediaUrl : attributes.url;
|
|
119
|
+
const backgroundType = useFeaturedImage
|
|
120
|
+
? IMAGE_BACKGROUND_TYPE
|
|
121
|
+
: attributes.backgroundType;
|
|
122
|
+
|
|
123
|
+
const { __unstableMarkNextChangeAsNotPersistent } = useDispatch(
|
|
124
|
+
blockEditorStore
|
|
125
|
+
);
|
|
126
|
+
const { createErrorNotice } = useDispatch( noticesStore );
|
|
127
|
+
const { gradientClass, gradientValue } = __experimentalUseGradient();
|
|
128
|
+
const onSelectMedia = attributesFromMedia( setAttributes, dimRatio );
|
|
129
|
+
const isUploadingMedia = isTemporaryMedia( id, url );
|
|
130
|
+
|
|
131
|
+
const onUploadError = ( message ) => {
|
|
132
|
+
createErrorNotice( message, { type: 'snackbar' } );
|
|
133
|
+
};
|
|
134
|
+
|
|
135
|
+
const mediaElement = useRef();
|
|
136
|
+
const isCoverDark = useCoverIsDark(
|
|
137
|
+
url,
|
|
138
|
+
dimRatio,
|
|
139
|
+
overlayColor.color,
|
|
140
|
+
mediaElement
|
|
141
|
+
);
|
|
142
|
+
|
|
143
|
+
useEffect( () => {
|
|
144
|
+
// This side-effect should not create an undo level.
|
|
145
|
+
__unstableMarkNextChangeAsNotPersistent();
|
|
146
|
+
setAttributes( { isDark: isCoverDark } );
|
|
147
|
+
}, [ isCoverDark ] );
|
|
148
|
+
|
|
149
|
+
const isImageBackground = IMAGE_BACKGROUND_TYPE === backgroundType;
|
|
150
|
+
const isVideoBackground = VIDEO_BACKGROUND_TYPE === backgroundType;
|
|
151
|
+
|
|
152
|
+
const minHeightWithUnit =
|
|
153
|
+
minHeight && minHeightUnit
|
|
154
|
+
? `${ minHeight }${ minHeightUnit }`
|
|
155
|
+
: minHeight;
|
|
156
|
+
|
|
157
|
+
const isImgElement = ! ( hasParallax || isRepeated );
|
|
158
|
+
|
|
159
|
+
const style = {
|
|
160
|
+
minHeight: minHeightWithUnit || undefined,
|
|
161
|
+
};
|
|
162
|
+
|
|
163
|
+
const backgroundImage = url ? `url(${ url })` : undefined;
|
|
164
|
+
|
|
165
|
+
const backgroundPosition = mediaPosition( focalPoint );
|
|
166
|
+
|
|
167
|
+
const bgStyle = { backgroundColor: overlayColor.color };
|
|
168
|
+
const mediaStyle = {
|
|
169
|
+
objectPosition:
|
|
170
|
+
focalPoint && isImgElement
|
|
171
|
+
? mediaPosition( focalPoint )
|
|
172
|
+
: undefined,
|
|
173
|
+
};
|
|
174
|
+
|
|
175
|
+
const hasBackground = !! ( url || overlayColor.color || gradientValue );
|
|
176
|
+
|
|
177
|
+
const hasInnerBlocks = useSelect(
|
|
178
|
+
( select ) =>
|
|
179
|
+
select( blockEditorStore ).getBlock( clientId ).innerBlocks.length >
|
|
180
|
+
0,
|
|
181
|
+
[ clientId ]
|
|
182
|
+
);
|
|
183
|
+
|
|
184
|
+
const ref = useRef();
|
|
185
|
+
const blockProps = useBlockProps( { ref } );
|
|
186
|
+
|
|
187
|
+
// Check for fontSize support before we pass a fontSize attribute to the innerBlocks.
|
|
188
|
+
const hasFontSizes = !! useSetting( 'typography.fontSizes' )?.length;
|
|
189
|
+
const innerBlocksTemplate = getInnerBlocksTemplate( {
|
|
190
|
+
fontSize: hasFontSizes ? 'large' : undefined,
|
|
191
|
+
} );
|
|
192
|
+
|
|
193
|
+
const innerBlocksProps = useInnerBlocksProps(
|
|
194
|
+
{
|
|
195
|
+
className: 'wp-block-cover__inner-container',
|
|
196
|
+
},
|
|
197
|
+
{
|
|
198
|
+
template: innerBlocksTemplate,
|
|
199
|
+
templateInsertUpdatesSelection: true,
|
|
200
|
+
allowedBlocks,
|
|
201
|
+
templateLock,
|
|
202
|
+
}
|
|
203
|
+
);
|
|
204
|
+
|
|
205
|
+
const currentSettings = {
|
|
206
|
+
isVideoBackground,
|
|
207
|
+
isImageBackground,
|
|
208
|
+
mediaElement,
|
|
209
|
+
hasInnerBlocks,
|
|
210
|
+
url,
|
|
211
|
+
isImgElement,
|
|
212
|
+
overlayColor,
|
|
213
|
+
};
|
|
214
|
+
|
|
215
|
+
if ( ! hasInnerBlocks && ! hasBackground ) {
|
|
216
|
+
return (
|
|
217
|
+
<>
|
|
218
|
+
<CoverBlockControls
|
|
219
|
+
attributes={ attributes }
|
|
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
|
+
/>
|
|
232
|
+
<div
|
|
233
|
+
{ ...blockProps }
|
|
234
|
+
className={ classnames(
|
|
235
|
+
'is-placeholder',
|
|
236
|
+
blockProps.className
|
|
237
|
+
) }
|
|
238
|
+
>
|
|
239
|
+
<CoverPlaceholder
|
|
240
|
+
onSelectMedia={ onSelectMedia }
|
|
241
|
+
onError={ onUploadError }
|
|
242
|
+
style={ {
|
|
243
|
+
minHeight: minHeightWithUnit || undefined,
|
|
244
|
+
} }
|
|
245
|
+
>
|
|
246
|
+
<div className="wp-block-cover__placeholder-background-options">
|
|
247
|
+
<ColorPalette
|
|
248
|
+
disableCustomColors={ true }
|
|
249
|
+
value={ overlayColor.color }
|
|
250
|
+
onChange={ setOverlayColor }
|
|
251
|
+
clearable={ false }
|
|
252
|
+
/>
|
|
253
|
+
</div>
|
|
254
|
+
</CoverPlaceholder>
|
|
255
|
+
<ResizableCover
|
|
256
|
+
className="block-library-cover__resize-container"
|
|
257
|
+
onResizeStart={ () => {
|
|
258
|
+
setAttributes( { minHeightUnit: 'px' } );
|
|
259
|
+
toggleSelection( false );
|
|
260
|
+
} }
|
|
261
|
+
onResize={ ( value ) => {
|
|
262
|
+
setAttributes( { minHeight: value } );
|
|
263
|
+
} }
|
|
264
|
+
onResizeStop={ ( newMinHeight ) => {
|
|
265
|
+
toggleSelection( true );
|
|
266
|
+
setAttributes( { minHeight: newMinHeight } );
|
|
267
|
+
} }
|
|
268
|
+
showHandle={ isSelected }
|
|
269
|
+
/>
|
|
270
|
+
</div>
|
|
271
|
+
</>
|
|
272
|
+
);
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
const classes = classnames(
|
|
276
|
+
{
|
|
277
|
+
'is-dark-theme': isDark,
|
|
278
|
+
'is-light': ! isDark,
|
|
279
|
+
'is-transient': isUploadingMedia,
|
|
280
|
+
'has-parallax': hasParallax,
|
|
281
|
+
'is-repeated': isRepeated,
|
|
282
|
+
'has-custom-content-position': ! isContentPositionCenter(
|
|
283
|
+
contentPosition
|
|
284
|
+
),
|
|
285
|
+
},
|
|
286
|
+
getPositionClassName( contentPosition )
|
|
287
|
+
);
|
|
288
|
+
|
|
289
|
+
return (
|
|
290
|
+
<>
|
|
291
|
+
<CoverBlockControls
|
|
292
|
+
attributes={ attributes }
|
|
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
|
+
/>
|
|
305
|
+
<div
|
|
306
|
+
{ ...blockProps }
|
|
307
|
+
className={ classnames( classes, blockProps.className ) }
|
|
308
|
+
style={ { ...style, ...blockProps.style } }
|
|
309
|
+
data-url={ url }
|
|
310
|
+
>
|
|
311
|
+
<ResizableCover
|
|
312
|
+
className="block-library-cover__resize-container"
|
|
313
|
+
onResizeStart={ () => {
|
|
314
|
+
setAttributes( { minHeightUnit: 'px' } );
|
|
315
|
+
toggleSelection( false );
|
|
316
|
+
} }
|
|
317
|
+
onResize={ ( value ) => {
|
|
318
|
+
setAttributes( { minHeight: value } );
|
|
319
|
+
} }
|
|
320
|
+
onResizeStop={ ( newMinHeight ) => {
|
|
321
|
+
toggleSelection( true );
|
|
322
|
+
setAttributes( { minHeight: newMinHeight } );
|
|
323
|
+
} }
|
|
324
|
+
showHandle={ isSelected }
|
|
325
|
+
/>
|
|
326
|
+
|
|
327
|
+
<span
|
|
328
|
+
aria-hidden="true"
|
|
329
|
+
className={ classnames(
|
|
330
|
+
'wp-block-cover__background',
|
|
331
|
+
dimRatioToClass( dimRatio ),
|
|
332
|
+
{
|
|
333
|
+
[ overlayColor.class ]: overlayColor.class,
|
|
334
|
+
'has-background-dim': dimRatio !== undefined,
|
|
335
|
+
// For backwards compatibility. Former versions of the Cover Block applied
|
|
336
|
+
// `.wp-block-cover__gradient-background` in the presence of
|
|
337
|
+
// media, a gradient and a dim.
|
|
338
|
+
'wp-block-cover__gradient-background':
|
|
339
|
+
url && gradientValue && dimRatio !== 0,
|
|
340
|
+
'has-background-gradient': gradientValue,
|
|
341
|
+
[ gradientClass ]: gradientClass,
|
|
342
|
+
}
|
|
343
|
+
) }
|
|
344
|
+
style={ { backgroundImage: gradientValue, ...bgStyle } }
|
|
345
|
+
/>
|
|
346
|
+
|
|
347
|
+
{ url &&
|
|
348
|
+
isImageBackground &&
|
|
349
|
+
( isImgElement ? (
|
|
350
|
+
<img
|
|
351
|
+
ref={ mediaElement }
|
|
352
|
+
className="wp-block-cover__image-background"
|
|
353
|
+
alt={ alt }
|
|
354
|
+
src={ url }
|
|
355
|
+
style={ mediaStyle }
|
|
356
|
+
/>
|
|
357
|
+
) : (
|
|
358
|
+
<div
|
|
359
|
+
ref={ mediaElement }
|
|
360
|
+
role="img"
|
|
361
|
+
className={ classnames(
|
|
362
|
+
classes,
|
|
363
|
+
'wp-block-cover__image-background'
|
|
364
|
+
) }
|
|
365
|
+
style={ { backgroundImage, backgroundPosition } }
|
|
366
|
+
/>
|
|
367
|
+
) ) }
|
|
368
|
+
{ url && isVideoBackground && (
|
|
369
|
+
<video
|
|
370
|
+
ref={ mediaElement }
|
|
371
|
+
className="wp-block-cover__video-background"
|
|
372
|
+
autoPlay
|
|
373
|
+
muted
|
|
374
|
+
loop
|
|
375
|
+
src={ url }
|
|
376
|
+
style={ mediaStyle }
|
|
377
|
+
/>
|
|
378
|
+
) }
|
|
379
|
+
{ isUploadingMedia && <Spinner /> }
|
|
380
|
+
<CoverPlaceholder
|
|
381
|
+
disableMediaButtons
|
|
382
|
+
onSelectMedia={ onSelectMedia }
|
|
383
|
+
onError={ onUploadError }
|
|
384
|
+
/>
|
|
385
|
+
<div { ...innerBlocksProps } />
|
|
386
|
+
</div>
|
|
387
|
+
</>
|
|
388
|
+
);
|
|
389
|
+
}
|
|
390
|
+
|
|
391
|
+
export default compose( [
|
|
392
|
+
withColors( { overlayColor: 'background-color' } ),
|
|
393
|
+
] )( CoverEdit );
|
|
@@ -0,0 +1,286 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WordPress dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { Fragment, useMemo } from '@wordpress/element';
|
|
5
|
+
import {
|
|
6
|
+
BaseControl,
|
|
7
|
+
Button,
|
|
8
|
+
ExternalLink,
|
|
9
|
+
FocalPointPicker,
|
|
10
|
+
PanelBody,
|
|
11
|
+
PanelRow,
|
|
12
|
+
RangeControl,
|
|
13
|
+
TextareaControl,
|
|
14
|
+
ToggleControl,
|
|
15
|
+
__experimentalUseCustomUnits as useCustomUnits,
|
|
16
|
+
__experimentalToolsPanelItem as ToolsPanelItem,
|
|
17
|
+
__experimentalUnitControl as UnitControl,
|
|
18
|
+
__experimentalParseQuantityAndUnitFromRawValue as parseQuantityAndUnitFromRawValue,
|
|
19
|
+
} from '@wordpress/components';
|
|
20
|
+
import { useInstanceId } from '@wordpress/compose';
|
|
21
|
+
import {
|
|
22
|
+
InspectorControls,
|
|
23
|
+
useSetting,
|
|
24
|
+
__experimentalUseGradient,
|
|
25
|
+
__experimentalPanelColorGradientSettings as PanelColorGradientSettings,
|
|
26
|
+
} from '@wordpress/block-editor';
|
|
27
|
+
import { __ } from '@wordpress/i18n';
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Internal dependencies
|
|
31
|
+
*/
|
|
32
|
+
import { COVER_MIN_HEIGHT, mediaPosition } from '../shared';
|
|
33
|
+
|
|
34
|
+
function CoverHeightInput( {
|
|
35
|
+
onChange,
|
|
36
|
+
onUnitChange,
|
|
37
|
+
unit = 'px',
|
|
38
|
+
value = '',
|
|
39
|
+
} ) {
|
|
40
|
+
const instanceId = useInstanceId( UnitControl );
|
|
41
|
+
const inputId = `block-cover-height-input-${ instanceId }`;
|
|
42
|
+
const isPx = unit === 'px';
|
|
43
|
+
|
|
44
|
+
const units = useCustomUnits( {
|
|
45
|
+
availableUnits: useSetting( 'spacing.units' ) || [
|
|
46
|
+
'px',
|
|
47
|
+
'em',
|
|
48
|
+
'rem',
|
|
49
|
+
'vw',
|
|
50
|
+
'vh',
|
|
51
|
+
],
|
|
52
|
+
defaultValues: { px: 430, '%': 20, em: 20, rem: 20, vw: 20, vh: 50 },
|
|
53
|
+
} );
|
|
54
|
+
|
|
55
|
+
const handleOnChange = ( unprocessedValue ) => {
|
|
56
|
+
const inputValue =
|
|
57
|
+
unprocessedValue !== ''
|
|
58
|
+
? parseFloat( unprocessedValue )
|
|
59
|
+
: undefined;
|
|
60
|
+
|
|
61
|
+
if ( isNaN( inputValue ) && inputValue !== undefined ) {
|
|
62
|
+
return;
|
|
63
|
+
}
|
|
64
|
+
onChange( inputValue );
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
const computedValue = useMemo( () => {
|
|
68
|
+
const [ parsedQuantity ] = parseQuantityAndUnitFromRawValue( value );
|
|
69
|
+
return [ parsedQuantity, unit ].join( '' );
|
|
70
|
+
}, [ unit, value ] );
|
|
71
|
+
|
|
72
|
+
const min = isPx ? COVER_MIN_HEIGHT : 0;
|
|
73
|
+
|
|
74
|
+
return (
|
|
75
|
+
<BaseControl label={ __( 'Minimum height of cover' ) } id={ inputId }>
|
|
76
|
+
<UnitControl
|
|
77
|
+
id={ inputId }
|
|
78
|
+
isResetValueOnUnitChange
|
|
79
|
+
min={ min }
|
|
80
|
+
onChange={ handleOnChange }
|
|
81
|
+
onUnitChange={ onUnitChange }
|
|
82
|
+
style={ { maxWidth: 80 } }
|
|
83
|
+
units={ units }
|
|
84
|
+
value={ computedValue }
|
|
85
|
+
/>
|
|
86
|
+
</BaseControl>
|
|
87
|
+
);
|
|
88
|
+
}
|
|
89
|
+
export default function CoverInspectorControls( {
|
|
90
|
+
attributes,
|
|
91
|
+
setAttributes,
|
|
92
|
+
clientId,
|
|
93
|
+
setOverlayColor,
|
|
94
|
+
coverRef,
|
|
95
|
+
currentSettings,
|
|
96
|
+
} ) {
|
|
97
|
+
const {
|
|
98
|
+
useFeaturedImage,
|
|
99
|
+
dimRatio,
|
|
100
|
+
focalPoint,
|
|
101
|
+
hasParallax,
|
|
102
|
+
isRepeated,
|
|
103
|
+
minHeight,
|
|
104
|
+
minHeightUnit,
|
|
105
|
+
alt,
|
|
106
|
+
} = attributes;
|
|
107
|
+
const {
|
|
108
|
+
isVideoBackground,
|
|
109
|
+
isImageBackground,
|
|
110
|
+
mediaElement,
|
|
111
|
+
url,
|
|
112
|
+
isImgElement,
|
|
113
|
+
overlayColor,
|
|
114
|
+
} = currentSettings;
|
|
115
|
+
|
|
116
|
+
const { gradientValue, setGradient } = __experimentalUseGradient();
|
|
117
|
+
|
|
118
|
+
const toggleParallax = () => {
|
|
119
|
+
setAttributes( {
|
|
120
|
+
hasParallax: ! hasParallax,
|
|
121
|
+
...( ! hasParallax ? { focalPoint: undefined } : {} ),
|
|
122
|
+
} );
|
|
123
|
+
};
|
|
124
|
+
|
|
125
|
+
const toggleIsRepeated = () => {
|
|
126
|
+
setAttributes( {
|
|
127
|
+
isRepeated: ! isRepeated,
|
|
128
|
+
} );
|
|
129
|
+
};
|
|
130
|
+
|
|
131
|
+
const showFocalPointPicker =
|
|
132
|
+
isVideoBackground ||
|
|
133
|
+
( isImageBackground && ( ! hasParallax || isRepeated ) );
|
|
134
|
+
|
|
135
|
+
const imperativeFocalPointPreview = ( value ) => {
|
|
136
|
+
const [ styleOfRef, property ] = mediaElement.current
|
|
137
|
+
? [ mediaElement.current.style, 'objectPosition' ]
|
|
138
|
+
: [ coverRef.current.style, 'backgroundPosition' ];
|
|
139
|
+
styleOfRef[ property ] = mediaPosition( value );
|
|
140
|
+
};
|
|
141
|
+
return (
|
|
142
|
+
<>
|
|
143
|
+
<InspectorControls>
|
|
144
|
+
{ !! url && (
|
|
145
|
+
<PanelBody title={ __( 'Media settings' ) }>
|
|
146
|
+
{ isImageBackground && (
|
|
147
|
+
<Fragment>
|
|
148
|
+
<ToggleControl
|
|
149
|
+
label={ __( 'Fixed background' ) }
|
|
150
|
+
checked={ hasParallax }
|
|
151
|
+
onChange={ toggleParallax }
|
|
152
|
+
/>
|
|
153
|
+
|
|
154
|
+
<ToggleControl
|
|
155
|
+
label={ __( 'Repeated background' ) }
|
|
156
|
+
checked={ isRepeated }
|
|
157
|
+
onChange={ toggleIsRepeated }
|
|
158
|
+
/>
|
|
159
|
+
</Fragment>
|
|
160
|
+
) }
|
|
161
|
+
{ showFocalPointPicker && (
|
|
162
|
+
<FocalPointPicker
|
|
163
|
+
label={ __( 'Focal point picker' ) }
|
|
164
|
+
url={ url }
|
|
165
|
+
value={ focalPoint }
|
|
166
|
+
onDragStart={ imperativeFocalPointPreview }
|
|
167
|
+
onDrag={ imperativeFocalPointPreview }
|
|
168
|
+
onChange={ ( newFocalPoint ) =>
|
|
169
|
+
setAttributes( {
|
|
170
|
+
focalPoint: newFocalPoint,
|
|
171
|
+
} )
|
|
172
|
+
}
|
|
173
|
+
/>
|
|
174
|
+
) }
|
|
175
|
+
{ ! useFeaturedImage &&
|
|
176
|
+
url &&
|
|
177
|
+
isImageBackground &&
|
|
178
|
+
isImgElement && (
|
|
179
|
+
<TextareaControl
|
|
180
|
+
label={ __(
|
|
181
|
+
'Alt text (alternative text)'
|
|
182
|
+
) }
|
|
183
|
+
value={ alt }
|
|
184
|
+
onChange={ ( newAlt ) =>
|
|
185
|
+
setAttributes( { alt: newAlt } )
|
|
186
|
+
}
|
|
187
|
+
help={
|
|
188
|
+
<>
|
|
189
|
+
<ExternalLink href="https://www.w3.org/WAI/tutorials/images/decision-tree">
|
|
190
|
+
{ __(
|
|
191
|
+
'Describe the purpose of the image'
|
|
192
|
+
) }
|
|
193
|
+
</ExternalLink>
|
|
194
|
+
{ __(
|
|
195
|
+
'Leave empty if the image is purely decorative.'
|
|
196
|
+
) }
|
|
197
|
+
</>
|
|
198
|
+
}
|
|
199
|
+
/>
|
|
200
|
+
) }
|
|
201
|
+
<PanelRow>
|
|
202
|
+
<Button
|
|
203
|
+
variant="secondary"
|
|
204
|
+
isSmall
|
|
205
|
+
className="block-library-cover__reset-button"
|
|
206
|
+
onClick={ () =>
|
|
207
|
+
setAttributes( {
|
|
208
|
+
url: undefined,
|
|
209
|
+
id: undefined,
|
|
210
|
+
backgroundType: undefined,
|
|
211
|
+
focalPoint: undefined,
|
|
212
|
+
hasParallax: undefined,
|
|
213
|
+
isRepeated: undefined,
|
|
214
|
+
useFeaturedImage: false,
|
|
215
|
+
} )
|
|
216
|
+
}
|
|
217
|
+
>
|
|
218
|
+
{ __( 'Clear Media' ) }
|
|
219
|
+
</Button>
|
|
220
|
+
</PanelRow>
|
|
221
|
+
</PanelBody>
|
|
222
|
+
) }
|
|
223
|
+
<PanelColorGradientSettings
|
|
224
|
+
__experimentalHasMultipleOrigins
|
|
225
|
+
__experimentalIsRenderedInSidebar
|
|
226
|
+
title={ __( 'Overlay' ) }
|
|
227
|
+
initialOpen={ true }
|
|
228
|
+
settings={ [
|
|
229
|
+
{
|
|
230
|
+
colorValue: overlayColor.color,
|
|
231
|
+
gradientValue,
|
|
232
|
+
onColorChange: setOverlayColor,
|
|
233
|
+
onGradientChange: setGradient,
|
|
234
|
+
label: __( 'Color' ),
|
|
235
|
+
},
|
|
236
|
+
] }
|
|
237
|
+
>
|
|
238
|
+
<RangeControl
|
|
239
|
+
label={ __( 'Opacity' ) }
|
|
240
|
+
value={ dimRatio }
|
|
241
|
+
onChange={ ( newDimRation ) =>
|
|
242
|
+
setAttributes( {
|
|
243
|
+
dimRatio: newDimRation,
|
|
244
|
+
} )
|
|
245
|
+
}
|
|
246
|
+
min={ 0 }
|
|
247
|
+
max={ 100 }
|
|
248
|
+
step={ 10 }
|
|
249
|
+
required
|
|
250
|
+
/>
|
|
251
|
+
</PanelColorGradientSettings>
|
|
252
|
+
</InspectorControls>
|
|
253
|
+
<InspectorControls __experimentalGroup="dimensions">
|
|
254
|
+
<ToolsPanelItem
|
|
255
|
+
hasValue={ () => !! minHeight }
|
|
256
|
+
label={ __( 'Minimum height' ) }
|
|
257
|
+
onDeselect={ () =>
|
|
258
|
+
setAttributes( {
|
|
259
|
+
minHeight: undefined,
|
|
260
|
+
minHeightUnit: undefined,
|
|
261
|
+
} )
|
|
262
|
+
}
|
|
263
|
+
resetAllFilter={ () => ( {
|
|
264
|
+
minHeight: undefined,
|
|
265
|
+
minHeightUnit: undefined,
|
|
266
|
+
} ) }
|
|
267
|
+
isShownByDefault={ true }
|
|
268
|
+
panelId={ clientId }
|
|
269
|
+
>
|
|
270
|
+
<CoverHeightInput
|
|
271
|
+
value={ minHeight }
|
|
272
|
+
unit={ minHeightUnit }
|
|
273
|
+
onChange={ ( newMinHeight ) =>
|
|
274
|
+
setAttributes( { minHeight: newMinHeight } )
|
|
275
|
+
}
|
|
276
|
+
onUnitChange={ ( nextUnit ) =>
|
|
277
|
+
setAttributes( {
|
|
278
|
+
minHeightUnit: nextUnit,
|
|
279
|
+
} )
|
|
280
|
+
}
|
|
281
|
+
/>
|
|
282
|
+
</ToolsPanelItem>
|
|
283
|
+
</InspectorControls>
|
|
284
|
+
</>
|
|
285
|
+
);
|
|
286
|
+
}
|