@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
|
@@ -1,642 +0,0 @@
|
|
|
1
|
-
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
-
import { createElement } from "@wordpress/element";
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* External dependencies
|
|
6
|
-
*/
|
|
7
|
-
import classnames from 'classnames';
|
|
8
|
-
import FastAverageColor from 'fast-average-color';
|
|
9
|
-
import { colord, extend } from 'colord';
|
|
10
|
-
import namesPlugin from 'colord/plugins/names';
|
|
11
|
-
/**
|
|
12
|
-
* WordPress dependencies
|
|
13
|
-
*/
|
|
14
|
-
|
|
15
|
-
import { useEntityProp, store as coreStore } from '@wordpress/core-data';
|
|
16
|
-
import { Fragment, useEffect, useRef, useState, useMemo } from '@wordpress/element';
|
|
17
|
-
import { BaseControl, Button, ExternalLink, FocalPointPicker, PanelBody, PanelRow, RangeControl, ResizableBox, Spinner, TextareaControl, ToggleControl, ToolbarButton, __experimentalUseCustomUnits as useCustomUnits, __experimentalBoxControl as BoxControl, __experimentalToolsPanelItem as ToolsPanelItem, __experimentalUnitControl as UnitControl, __experimentalParseQuantityAndUnitFromRawValue as parseQuantityAndUnitFromRawValue } from '@wordpress/components';
|
|
18
|
-
import { compose, useInstanceId } from '@wordpress/compose';
|
|
19
|
-
import { BlockControls, BlockIcon, InspectorControls, MediaPlaceholder, MediaReplaceFlow, withColors, ColorPalette, useBlockProps, useSetting, useInnerBlocksProps, __experimentalUseGradient, __experimentalPanelColorGradientSettings as PanelColorGradientSettings, __experimentalBlockAlignmentMatrixControl as BlockAlignmentMatrixControl, __experimentalBlockFullHeightAligmentControl as FullHeightAlignmentControl, store as blockEditorStore } from '@wordpress/block-editor';
|
|
20
|
-
import { __ } from '@wordpress/i18n';
|
|
21
|
-
import { useSelect, useDispatch } from '@wordpress/data';
|
|
22
|
-
import { postFeaturedImage, cover as icon } from '@wordpress/icons';
|
|
23
|
-
import { isBlobURL } from '@wordpress/blob';
|
|
24
|
-
import { store as noticesStore } from '@wordpress/notices';
|
|
25
|
-
/**
|
|
26
|
-
* Internal dependencies
|
|
27
|
-
*/
|
|
28
|
-
|
|
29
|
-
import { ALLOWED_MEDIA_TYPES, attributesFromMedia, IMAGE_BACKGROUND_TYPE, VIDEO_BACKGROUND_TYPE, COVER_MIN_HEIGHT, backgroundImageStyles, dimRatioToClass, isContentPositionCenter, getPositionClassName } from './shared';
|
|
30
|
-
extend([namesPlugin]);
|
|
31
|
-
const {
|
|
32
|
-
__Visualizer: BoxControlVisualizer
|
|
33
|
-
} = BoxControl;
|
|
34
|
-
|
|
35
|
-
function getInnerBlocksTemplate(attributes) {
|
|
36
|
-
return [['core/paragraph', {
|
|
37
|
-
align: 'center',
|
|
38
|
-
placeholder: __('Write title…'),
|
|
39
|
-
...attributes
|
|
40
|
-
}]];
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
function retrieveFastAverageColor() {
|
|
44
|
-
if (!retrieveFastAverageColor.fastAverageColor) {
|
|
45
|
-
retrieveFastAverageColor.fastAverageColor = new FastAverageColor();
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
return retrieveFastAverageColor.fastAverageColor;
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
function CoverHeightInput(_ref) {
|
|
52
|
-
let {
|
|
53
|
-
onChange,
|
|
54
|
-
onUnitChange,
|
|
55
|
-
unit = 'px',
|
|
56
|
-
value = ''
|
|
57
|
-
} = _ref;
|
|
58
|
-
const instanceId = useInstanceId(UnitControl);
|
|
59
|
-
const inputId = `block-cover-height-input-${instanceId}`;
|
|
60
|
-
const isPx = unit === 'px';
|
|
61
|
-
const units = useCustomUnits({
|
|
62
|
-
availableUnits: useSetting('spacing.units') || ['px', 'em', 'rem', 'vw', 'vh'],
|
|
63
|
-
defaultValues: {
|
|
64
|
-
px: 430,
|
|
65
|
-
'%': 20,
|
|
66
|
-
em: 20,
|
|
67
|
-
rem: 20,
|
|
68
|
-
vw: 20,
|
|
69
|
-
vh: 50
|
|
70
|
-
}
|
|
71
|
-
});
|
|
72
|
-
|
|
73
|
-
const handleOnChange = unprocessedValue => {
|
|
74
|
-
const inputValue = unprocessedValue !== '' ? parseFloat(unprocessedValue) : undefined;
|
|
75
|
-
|
|
76
|
-
if (isNaN(inputValue) && inputValue !== undefined) {
|
|
77
|
-
return;
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
onChange(inputValue);
|
|
81
|
-
};
|
|
82
|
-
|
|
83
|
-
const computedValue = useMemo(() => {
|
|
84
|
-
const [parsedQuantity] = parseQuantityAndUnitFromRawValue(value);
|
|
85
|
-
return [parsedQuantity, unit].join('');
|
|
86
|
-
}, [unit, value]);
|
|
87
|
-
const min = isPx ? COVER_MIN_HEIGHT : 0;
|
|
88
|
-
return createElement(BaseControl, {
|
|
89
|
-
label: __('Minimum height of cover'),
|
|
90
|
-
id: inputId
|
|
91
|
-
}, createElement(UnitControl, {
|
|
92
|
-
id: inputId,
|
|
93
|
-
isResetValueOnUnitChange: true,
|
|
94
|
-
min: min,
|
|
95
|
-
onChange: handleOnChange,
|
|
96
|
-
onUnitChange: onUnitChange,
|
|
97
|
-
style: {
|
|
98
|
-
maxWidth: 80
|
|
99
|
-
},
|
|
100
|
-
units: units,
|
|
101
|
-
value: computedValue
|
|
102
|
-
}));
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
const RESIZABLE_BOX_ENABLE_OPTION = {
|
|
106
|
-
top: false,
|
|
107
|
-
right: false,
|
|
108
|
-
bottom: true,
|
|
109
|
-
left: false,
|
|
110
|
-
topRight: false,
|
|
111
|
-
bottomRight: false,
|
|
112
|
-
bottomLeft: false,
|
|
113
|
-
topLeft: false
|
|
114
|
-
};
|
|
115
|
-
|
|
116
|
-
function ResizableCover(_ref2) {
|
|
117
|
-
let {
|
|
118
|
-
className,
|
|
119
|
-
onResizeStart,
|
|
120
|
-
onResize,
|
|
121
|
-
onResizeStop,
|
|
122
|
-
...props
|
|
123
|
-
} = _ref2;
|
|
124
|
-
const [isResizing, setIsResizing] = useState(false);
|
|
125
|
-
return createElement(ResizableBox, _extends({
|
|
126
|
-
className: classnames(className, {
|
|
127
|
-
'is-resizing': isResizing
|
|
128
|
-
}),
|
|
129
|
-
enable: RESIZABLE_BOX_ENABLE_OPTION,
|
|
130
|
-
onResizeStart: (_event, _direction, elt) => {
|
|
131
|
-
onResizeStart(elt.clientHeight);
|
|
132
|
-
onResize(elt.clientHeight);
|
|
133
|
-
},
|
|
134
|
-
onResize: (_event, _direction, elt) => {
|
|
135
|
-
onResize(elt.clientHeight);
|
|
136
|
-
|
|
137
|
-
if (!isResizing) {
|
|
138
|
-
setIsResizing(true);
|
|
139
|
-
}
|
|
140
|
-
},
|
|
141
|
-
onResizeStop: (_event, _direction, elt) => {
|
|
142
|
-
onResizeStop(elt.clientHeight);
|
|
143
|
-
setIsResizing(false);
|
|
144
|
-
}
|
|
145
|
-
}, props));
|
|
146
|
-
}
|
|
147
|
-
/**
|
|
148
|
-
* useCoverIsDark is a hook that returns a boolean variable specifying if the cover
|
|
149
|
-
* background is dark or not.
|
|
150
|
-
*
|
|
151
|
-
* @param {?string} url Url of the media background.
|
|
152
|
-
* @param {?number} dimRatio Transparency of the overlay color. If an image and
|
|
153
|
-
* color are set, dimRatio is used to decide what is used
|
|
154
|
-
* for background darkness checking purposes.
|
|
155
|
-
* @param {?string} overlayColor String containing the overlay color value if one exists.
|
|
156
|
-
* @param {?Object} elementRef If a media background is set, elementRef should contain a reference to a
|
|
157
|
-
* dom element that renders that media.
|
|
158
|
-
*
|
|
159
|
-
* @return {boolean} True if the cover background is considered "dark" and false otherwise.
|
|
160
|
-
*/
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
function useCoverIsDark(url) {
|
|
164
|
-
let dimRatio = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 50;
|
|
165
|
-
let overlayColor = arguments.length > 2 ? arguments[2] : undefined;
|
|
166
|
-
let elementRef = arguments.length > 3 ? arguments[3] : undefined;
|
|
167
|
-
const [isDark, setIsDark] = useState(false);
|
|
168
|
-
useEffect(() => {
|
|
169
|
-
// If opacity is lower than 50 the dominant color is the image or video color,
|
|
170
|
-
// so use that color for the dark mode computation.
|
|
171
|
-
if (url && dimRatio <= 50 && elementRef.current) {
|
|
172
|
-
retrieveFastAverageColor().getColorAsync(elementRef.current, color => {
|
|
173
|
-
setIsDark(color.isDark);
|
|
174
|
-
});
|
|
175
|
-
}
|
|
176
|
-
}, [url, url && dimRatio <= 50 && elementRef.current, setIsDark]);
|
|
177
|
-
useEffect(() => {
|
|
178
|
-
// If opacity is greater than 50 the dominant color is the overlay color,
|
|
179
|
-
// so use that color for the dark mode computation.
|
|
180
|
-
if (dimRatio > 50 || !url) {
|
|
181
|
-
if (!overlayColor) {
|
|
182
|
-
// If no overlay color exists the overlay color is black (isDark )
|
|
183
|
-
setIsDark(true);
|
|
184
|
-
return;
|
|
185
|
-
}
|
|
186
|
-
|
|
187
|
-
setIsDark(colord(overlayColor).isDark());
|
|
188
|
-
}
|
|
189
|
-
}, [overlayColor, dimRatio > 50 || !url, setIsDark]);
|
|
190
|
-
useEffect(() => {
|
|
191
|
-
if (!url && !overlayColor) {
|
|
192
|
-
// Reset isDark.
|
|
193
|
-
setIsDark(false);
|
|
194
|
-
}
|
|
195
|
-
}, [!url && !overlayColor, setIsDark]);
|
|
196
|
-
return isDark;
|
|
197
|
-
}
|
|
198
|
-
|
|
199
|
-
function mediaPosition(_ref3) {
|
|
200
|
-
let {
|
|
201
|
-
x,
|
|
202
|
-
y
|
|
203
|
-
} = _ref3;
|
|
204
|
-
return `${Math.round(x * 100)}% ${Math.round(y * 100)}%`;
|
|
205
|
-
}
|
|
206
|
-
/**
|
|
207
|
-
* Is the URL a temporary blob URL? A blob URL is one that is used temporarily while
|
|
208
|
-
* the media (image or video) is being uploaded and will not have an id allocated yet.
|
|
209
|
-
*
|
|
210
|
-
* @param {number} id The id of the media.
|
|
211
|
-
* @param {string} url The url of the media.
|
|
212
|
-
*
|
|
213
|
-
* @return {boolean} Is the URL a Blob URL.
|
|
214
|
-
*/
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
const isTemporaryMedia = (id, url) => !id && isBlobURL(url);
|
|
218
|
-
|
|
219
|
-
function CoverPlaceholder(_ref4) {
|
|
220
|
-
let {
|
|
221
|
-
disableMediaButtons = false,
|
|
222
|
-
children,
|
|
223
|
-
onSelectMedia,
|
|
224
|
-
onError,
|
|
225
|
-
style
|
|
226
|
-
} = _ref4;
|
|
227
|
-
return createElement(MediaPlaceholder, {
|
|
228
|
-
icon: createElement(BlockIcon, {
|
|
229
|
-
icon: icon
|
|
230
|
-
}),
|
|
231
|
-
labels: {
|
|
232
|
-
title: __('Cover'),
|
|
233
|
-
instructions: __('Drag and drop onto this block, upload, or select existing media from your library.')
|
|
234
|
-
},
|
|
235
|
-
onSelect: onSelectMedia,
|
|
236
|
-
accept: "image/*,video/*",
|
|
237
|
-
allowedTypes: ALLOWED_MEDIA_TYPES,
|
|
238
|
-
disableMediaButtons: disableMediaButtons,
|
|
239
|
-
onError: onError,
|
|
240
|
-
style: style
|
|
241
|
-
}, children);
|
|
242
|
-
}
|
|
243
|
-
|
|
244
|
-
function CoverEdit(_ref5) {
|
|
245
|
-
var _useSetting, _styleAttribute$spaci, _styleAttribute$visua;
|
|
246
|
-
|
|
247
|
-
let {
|
|
248
|
-
attributes,
|
|
249
|
-
clientId,
|
|
250
|
-
isSelected,
|
|
251
|
-
overlayColor,
|
|
252
|
-
setAttributes,
|
|
253
|
-
setOverlayColor,
|
|
254
|
-
toggleSelection,
|
|
255
|
-
context: {
|
|
256
|
-
postId,
|
|
257
|
-
postType
|
|
258
|
-
}
|
|
259
|
-
} = _ref5;
|
|
260
|
-
const {
|
|
261
|
-
contentPosition,
|
|
262
|
-
id,
|
|
263
|
-
useFeaturedImage,
|
|
264
|
-
dimRatio,
|
|
265
|
-
focalPoint,
|
|
266
|
-
hasParallax,
|
|
267
|
-
isDark,
|
|
268
|
-
isRepeated,
|
|
269
|
-
minHeight,
|
|
270
|
-
minHeightUnit,
|
|
271
|
-
style: styleAttribute,
|
|
272
|
-
alt,
|
|
273
|
-
allowedBlocks,
|
|
274
|
-
templateLock
|
|
275
|
-
} = attributes;
|
|
276
|
-
const [featuredImage] = useEntityProp('postType', postType, 'featured_media', postId);
|
|
277
|
-
const media = useSelect(select => featuredImage && select(coreStore).getMedia(featuredImage, {
|
|
278
|
-
context: 'view'
|
|
279
|
-
}), [featuredImage]);
|
|
280
|
-
const mediaUrl = media === null || media === void 0 ? void 0 : media.source_url; // instead of destructuring the attributes
|
|
281
|
-
// we define the url and background type
|
|
282
|
-
// depending on the value of the useFeaturedImage flag
|
|
283
|
-
// to preview in edit the dynamic featured image
|
|
284
|
-
|
|
285
|
-
const url = useFeaturedImage ? mediaUrl : attributes.url;
|
|
286
|
-
const backgroundType = useFeaturedImage ? IMAGE_BACKGROUND_TYPE : attributes.backgroundType;
|
|
287
|
-
const {
|
|
288
|
-
__unstableMarkNextChangeAsNotPersistent
|
|
289
|
-
} = useDispatch(blockEditorStore);
|
|
290
|
-
const {
|
|
291
|
-
createErrorNotice
|
|
292
|
-
} = useDispatch(noticesStore);
|
|
293
|
-
|
|
294
|
-
const {
|
|
295
|
-
gradientClass,
|
|
296
|
-
gradientValue,
|
|
297
|
-
setGradient
|
|
298
|
-
} = __experimentalUseGradient();
|
|
299
|
-
|
|
300
|
-
const onSelectMedia = attributesFromMedia(setAttributes, dimRatio);
|
|
301
|
-
const isUploadingMedia = isTemporaryMedia(id, url);
|
|
302
|
-
const [prevMinHeightValue, setPrevMinHeightValue] = useState(minHeight);
|
|
303
|
-
const [prevMinHeightUnit, setPrevMinHeightUnit] = useState(minHeightUnit);
|
|
304
|
-
const isMinFullHeight = minHeightUnit === 'vh' && minHeight === 100;
|
|
305
|
-
|
|
306
|
-
const toggleMinFullHeight = () => {
|
|
307
|
-
if (isMinFullHeight) {
|
|
308
|
-
// If there aren't previous values, take the default ones.
|
|
309
|
-
if (prevMinHeightUnit === 'vh' && prevMinHeightValue === 100) {
|
|
310
|
-
return setAttributes({
|
|
311
|
-
minHeight: undefined,
|
|
312
|
-
minHeightUnit: undefined
|
|
313
|
-
});
|
|
314
|
-
} // Set the previous values of height.
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
return setAttributes({
|
|
318
|
-
minHeight: prevMinHeightValue,
|
|
319
|
-
minHeightUnit: prevMinHeightUnit
|
|
320
|
-
});
|
|
321
|
-
}
|
|
322
|
-
|
|
323
|
-
setPrevMinHeightValue(minHeight);
|
|
324
|
-
setPrevMinHeightUnit(minHeightUnit); // Set full height.
|
|
325
|
-
|
|
326
|
-
return setAttributes({
|
|
327
|
-
minHeight: 100,
|
|
328
|
-
minHeightUnit: 'vh'
|
|
329
|
-
});
|
|
330
|
-
};
|
|
331
|
-
|
|
332
|
-
const toggleParallax = () => {
|
|
333
|
-
setAttributes({
|
|
334
|
-
hasParallax: !hasParallax,
|
|
335
|
-
...(!hasParallax ? {
|
|
336
|
-
focalPoint: undefined
|
|
337
|
-
} : {})
|
|
338
|
-
});
|
|
339
|
-
};
|
|
340
|
-
|
|
341
|
-
const toggleIsRepeated = () => {
|
|
342
|
-
setAttributes({
|
|
343
|
-
isRepeated: !isRepeated
|
|
344
|
-
});
|
|
345
|
-
};
|
|
346
|
-
|
|
347
|
-
const toggleUseFeaturedImage = () => {
|
|
348
|
-
setAttributes({
|
|
349
|
-
useFeaturedImage: !useFeaturedImage,
|
|
350
|
-
dimRatio: dimRatio === 100 ? 50 : dimRatio
|
|
351
|
-
});
|
|
352
|
-
};
|
|
353
|
-
|
|
354
|
-
const onUploadError = message => {
|
|
355
|
-
createErrorNotice(Array.isArray(message) ? message[2] : message, {
|
|
356
|
-
type: 'snackbar'
|
|
357
|
-
});
|
|
358
|
-
};
|
|
359
|
-
|
|
360
|
-
const isDarkElement = useRef();
|
|
361
|
-
const isCoverDark = useCoverIsDark(url, dimRatio, overlayColor.color, isDarkElement);
|
|
362
|
-
useEffect(() => {
|
|
363
|
-
// This side-effect should not create an undo level.
|
|
364
|
-
__unstableMarkNextChangeAsNotPersistent();
|
|
365
|
-
|
|
366
|
-
setAttributes({
|
|
367
|
-
isDark: isCoverDark
|
|
368
|
-
});
|
|
369
|
-
}, [isCoverDark]);
|
|
370
|
-
const isImageBackground = IMAGE_BACKGROUND_TYPE === backgroundType;
|
|
371
|
-
const isVideoBackground = VIDEO_BACKGROUND_TYPE === backgroundType;
|
|
372
|
-
const minHeightWithUnit = minHeight && minHeightUnit ? `${minHeight}${minHeightUnit}` : minHeight;
|
|
373
|
-
const isImgElement = !(hasParallax || isRepeated);
|
|
374
|
-
const style = { ...(isImageBackground && !isImgElement ? backgroundImageStyles(url) : undefined),
|
|
375
|
-
minHeight: minHeightWithUnit || undefined
|
|
376
|
-
};
|
|
377
|
-
const bgStyle = {
|
|
378
|
-
backgroundColor: overlayColor.color
|
|
379
|
-
};
|
|
380
|
-
const mediaStyle = {
|
|
381
|
-
objectPosition: focalPoint && isImgElement ? mediaPosition(focalPoint) : undefined
|
|
382
|
-
};
|
|
383
|
-
const hasBackground = !!(url || overlayColor.color || gradientValue);
|
|
384
|
-
const showFocalPointPicker = isVideoBackground || isImageBackground && (!hasParallax || isRepeated);
|
|
385
|
-
|
|
386
|
-
const imperativeFocalPointPreview = value => {
|
|
387
|
-
const [styleOfRef, property] = isDarkElement.current ? [isDarkElement.current.style, 'objectPosition'] : [ref.current.style, 'backgroundPosition'];
|
|
388
|
-
styleOfRef[property] = mediaPosition(value);
|
|
389
|
-
};
|
|
390
|
-
|
|
391
|
-
const hasInnerBlocks = useSelect(select => select(blockEditorStore).getBlock(clientId).innerBlocks.length > 0, [clientId]);
|
|
392
|
-
const controls = createElement(Fragment, null, createElement(BlockControls, {
|
|
393
|
-
group: "block"
|
|
394
|
-
}, createElement(BlockAlignmentMatrixControl, {
|
|
395
|
-
label: __('Change content position'),
|
|
396
|
-
value: contentPosition,
|
|
397
|
-
onChange: nextPosition => setAttributes({
|
|
398
|
-
contentPosition: nextPosition
|
|
399
|
-
}),
|
|
400
|
-
isDisabled: !hasInnerBlocks
|
|
401
|
-
}), createElement(FullHeightAlignmentControl, {
|
|
402
|
-
isActive: isMinFullHeight,
|
|
403
|
-
onToggle: toggleMinFullHeight,
|
|
404
|
-
isDisabled: !hasInnerBlocks
|
|
405
|
-
})), createElement(BlockControls, {
|
|
406
|
-
group: "other"
|
|
407
|
-
}, createElement(ToolbarButton, {
|
|
408
|
-
icon: postFeaturedImage,
|
|
409
|
-
label: __('Use featured image'),
|
|
410
|
-
isPressed: useFeaturedImage,
|
|
411
|
-
onClick: toggleUseFeaturedImage
|
|
412
|
-
}), !useFeaturedImage && createElement(MediaReplaceFlow, {
|
|
413
|
-
mediaId: id,
|
|
414
|
-
mediaURL: url,
|
|
415
|
-
allowedTypes: ALLOWED_MEDIA_TYPES,
|
|
416
|
-
accept: "image/*,video/*",
|
|
417
|
-
onSelect: onSelectMedia,
|
|
418
|
-
name: !url ? __('Add Media') : __('Replace')
|
|
419
|
-
})), createElement(InspectorControls, null, !!url && createElement(PanelBody, {
|
|
420
|
-
title: __('Media settings')
|
|
421
|
-
}, isImageBackground && createElement(Fragment, null, createElement(ToggleControl, {
|
|
422
|
-
label: __('Fixed background'),
|
|
423
|
-
checked: hasParallax,
|
|
424
|
-
onChange: toggleParallax
|
|
425
|
-
}), createElement(ToggleControl, {
|
|
426
|
-
label: __('Repeated background'),
|
|
427
|
-
checked: isRepeated,
|
|
428
|
-
onChange: toggleIsRepeated
|
|
429
|
-
})), showFocalPointPicker && createElement(FocalPointPicker, {
|
|
430
|
-
label: __('Focal point picker'),
|
|
431
|
-
url: url,
|
|
432
|
-
value: focalPoint,
|
|
433
|
-
onDragStart: imperativeFocalPointPreview,
|
|
434
|
-
onDrag: imperativeFocalPointPreview,
|
|
435
|
-
onChange: newFocalPoint => setAttributes({
|
|
436
|
-
focalPoint: newFocalPoint
|
|
437
|
-
})
|
|
438
|
-
}), !useFeaturedImage && url && isImageBackground && isImgElement && createElement(TextareaControl, {
|
|
439
|
-
label: __('Alt text (alternative text)'),
|
|
440
|
-
value: alt,
|
|
441
|
-
onChange: newAlt => setAttributes({
|
|
442
|
-
alt: newAlt
|
|
443
|
-
}),
|
|
444
|
-
help: createElement(Fragment, null, createElement(ExternalLink, {
|
|
445
|
-
href: "https://www.w3.org/WAI/tutorials/images/decision-tree"
|
|
446
|
-
}, __('Describe the purpose of the image')), __('Leave empty if the image is purely decorative.'))
|
|
447
|
-
}), createElement(PanelRow, null, createElement(Button, {
|
|
448
|
-
variant: "secondary",
|
|
449
|
-
isSmall: true,
|
|
450
|
-
className: "block-library-cover__reset-button",
|
|
451
|
-
onClick: () => setAttributes({
|
|
452
|
-
url: undefined,
|
|
453
|
-
id: undefined,
|
|
454
|
-
backgroundType: undefined,
|
|
455
|
-
focalPoint: undefined,
|
|
456
|
-
hasParallax: undefined,
|
|
457
|
-
isRepeated: undefined,
|
|
458
|
-
useFeaturedImage: false
|
|
459
|
-
})
|
|
460
|
-
}, __('Clear Media')))), createElement(PanelColorGradientSettings, {
|
|
461
|
-
__experimentalHasMultipleOrigins: true,
|
|
462
|
-
__experimentalIsRenderedInSidebar: true,
|
|
463
|
-
title: __('Overlay'),
|
|
464
|
-
initialOpen: true,
|
|
465
|
-
settings: [{
|
|
466
|
-
colorValue: overlayColor.color,
|
|
467
|
-
gradientValue,
|
|
468
|
-
onColorChange: setOverlayColor,
|
|
469
|
-
onGradientChange: setGradient,
|
|
470
|
-
label: __('Color')
|
|
471
|
-
}]
|
|
472
|
-
}, createElement(RangeControl, {
|
|
473
|
-
label: __('Opacity'),
|
|
474
|
-
value: dimRatio,
|
|
475
|
-
onChange: newDimRation => setAttributes({
|
|
476
|
-
dimRatio: newDimRation
|
|
477
|
-
}),
|
|
478
|
-
min: 0,
|
|
479
|
-
max: 100,
|
|
480
|
-
step: 10,
|
|
481
|
-
required: true
|
|
482
|
-
}))), createElement(InspectorControls, {
|
|
483
|
-
__experimentalGroup: "dimensions"
|
|
484
|
-
}, createElement(ToolsPanelItem, {
|
|
485
|
-
hasValue: () => !!minHeight,
|
|
486
|
-
label: __('Minimum height'),
|
|
487
|
-
onDeselect: () => setAttributes({
|
|
488
|
-
minHeight: undefined,
|
|
489
|
-
minHeightUnit: undefined
|
|
490
|
-
}),
|
|
491
|
-
resetAllFilter: () => ({
|
|
492
|
-
minHeight: undefined,
|
|
493
|
-
minHeightUnit: undefined
|
|
494
|
-
}),
|
|
495
|
-
isShownByDefault: true,
|
|
496
|
-
panelId: clientId
|
|
497
|
-
}, createElement(CoverHeightInput, {
|
|
498
|
-
value: minHeight,
|
|
499
|
-
unit: minHeightUnit,
|
|
500
|
-
onChange: newMinHeight => setAttributes({
|
|
501
|
-
minHeight: newMinHeight
|
|
502
|
-
}),
|
|
503
|
-
onUnitChange: nextUnit => setAttributes({
|
|
504
|
-
minHeightUnit: nextUnit
|
|
505
|
-
})
|
|
506
|
-
}))));
|
|
507
|
-
const ref = useRef();
|
|
508
|
-
const blockProps = useBlockProps({
|
|
509
|
-
ref
|
|
510
|
-
}); // Check for fontSize support before we pass a fontSize attribute to the innerBlocks.
|
|
511
|
-
|
|
512
|
-
const hasFontSizes = !!((_useSetting = useSetting('typography.fontSizes')) !== null && _useSetting !== void 0 && _useSetting.length);
|
|
513
|
-
const innerBlocksTemplate = getInnerBlocksTemplate({
|
|
514
|
-
fontSize: hasFontSizes ? 'large' : undefined
|
|
515
|
-
});
|
|
516
|
-
const innerBlocksProps = useInnerBlocksProps({
|
|
517
|
-
className: 'wp-block-cover__inner-container'
|
|
518
|
-
}, {
|
|
519
|
-
template: innerBlocksTemplate,
|
|
520
|
-
templateInsertUpdatesSelection: true,
|
|
521
|
-
allowedBlocks,
|
|
522
|
-
templateLock
|
|
523
|
-
});
|
|
524
|
-
|
|
525
|
-
if (!hasInnerBlocks && !hasBackground) {
|
|
526
|
-
return createElement(Fragment, null, controls, createElement("div", _extends({}, blockProps, {
|
|
527
|
-
className: classnames('is-placeholder', blockProps.className)
|
|
528
|
-
}), createElement(CoverPlaceholder, {
|
|
529
|
-
onSelectMedia: onSelectMedia,
|
|
530
|
-
onError: onUploadError,
|
|
531
|
-
style: {
|
|
532
|
-
minHeight: minHeightWithUnit || undefined
|
|
533
|
-
}
|
|
534
|
-
}, createElement("div", {
|
|
535
|
-
className: "wp-block-cover__placeholder-background-options"
|
|
536
|
-
}, createElement(ColorPalette, {
|
|
537
|
-
disableCustomColors: true,
|
|
538
|
-
value: overlayColor.color,
|
|
539
|
-
onChange: setOverlayColor,
|
|
540
|
-
clearable: false
|
|
541
|
-
}))), createElement(ResizableCover, {
|
|
542
|
-
className: "block-library-cover__resize-container",
|
|
543
|
-
onResizeStart: () => {
|
|
544
|
-
setAttributes({
|
|
545
|
-
minHeightUnit: 'px'
|
|
546
|
-
});
|
|
547
|
-
toggleSelection(false);
|
|
548
|
-
},
|
|
549
|
-
onResize: value => {
|
|
550
|
-
setAttributes({
|
|
551
|
-
minHeight: value
|
|
552
|
-
});
|
|
553
|
-
},
|
|
554
|
-
onResizeStop: newMinHeight => {
|
|
555
|
-
toggleSelection(true);
|
|
556
|
-
setAttributes({
|
|
557
|
-
minHeight: newMinHeight
|
|
558
|
-
});
|
|
559
|
-
},
|
|
560
|
-
showHandle: isSelected
|
|
561
|
-
})));
|
|
562
|
-
}
|
|
563
|
-
|
|
564
|
-
const classes = classnames({
|
|
565
|
-
'is-dark-theme': isDark,
|
|
566
|
-
'is-light': !isDark,
|
|
567
|
-
'is-transient': isUploadingMedia,
|
|
568
|
-
'has-parallax': hasParallax,
|
|
569
|
-
'is-repeated': isRepeated,
|
|
570
|
-
'has-custom-content-position': !isContentPositionCenter(contentPosition)
|
|
571
|
-
}, getPositionClassName(contentPosition));
|
|
572
|
-
return createElement(Fragment, null, controls, createElement("div", _extends({}, blockProps, {
|
|
573
|
-
className: classnames(classes, blockProps.className),
|
|
574
|
-
style: { ...style,
|
|
575
|
-
...blockProps.style
|
|
576
|
-
},
|
|
577
|
-
"data-url": url
|
|
578
|
-
}), createElement(BoxControlVisualizer, {
|
|
579
|
-
values: styleAttribute === null || styleAttribute === void 0 ? void 0 : (_styleAttribute$spaci = styleAttribute.spacing) === null || _styleAttribute$spaci === void 0 ? void 0 : _styleAttribute$spaci.padding,
|
|
580
|
-
showValues: styleAttribute === null || styleAttribute === void 0 ? void 0 : (_styleAttribute$visua = styleAttribute.visualizers) === null || _styleAttribute$visua === void 0 ? void 0 : _styleAttribute$visua.padding,
|
|
581
|
-
className: "block-library-cover__padding-visualizer"
|
|
582
|
-
}), createElement(ResizableCover, {
|
|
583
|
-
className: "block-library-cover__resize-container",
|
|
584
|
-
onResizeStart: () => {
|
|
585
|
-
setAttributes({
|
|
586
|
-
minHeightUnit: 'px'
|
|
587
|
-
});
|
|
588
|
-
toggleSelection(false);
|
|
589
|
-
},
|
|
590
|
-
onResize: value => {
|
|
591
|
-
setAttributes({
|
|
592
|
-
minHeight: value
|
|
593
|
-
});
|
|
594
|
-
},
|
|
595
|
-
onResizeStop: newMinHeight => {
|
|
596
|
-
toggleSelection(true);
|
|
597
|
-
setAttributes({
|
|
598
|
-
minHeight: newMinHeight
|
|
599
|
-
});
|
|
600
|
-
},
|
|
601
|
-
showHandle: isSelected
|
|
602
|
-
}), createElement("span", {
|
|
603
|
-
"aria-hidden": "true",
|
|
604
|
-
className: classnames('wp-block-cover__background', dimRatioToClass(dimRatio), {
|
|
605
|
-
[overlayColor.class]: overlayColor.class,
|
|
606
|
-
'has-background-dim': dimRatio !== undefined,
|
|
607
|
-
// For backwards compatibility. Former versions of the Cover Block applied
|
|
608
|
-
// `.wp-block-cover__gradient-background` in the presence of
|
|
609
|
-
// media, a gradient and a dim.
|
|
610
|
-
'wp-block-cover__gradient-background': url && gradientValue && dimRatio !== 0,
|
|
611
|
-
'has-background-gradient': gradientValue,
|
|
612
|
-
[gradientClass]: gradientClass
|
|
613
|
-
}),
|
|
614
|
-
style: {
|
|
615
|
-
backgroundImage: gradientValue,
|
|
616
|
-
...bgStyle
|
|
617
|
-
}
|
|
618
|
-
}), url && isImageBackground && isImgElement && createElement("img", {
|
|
619
|
-
ref: isDarkElement,
|
|
620
|
-
className: "wp-block-cover__image-background",
|
|
621
|
-
alt: alt,
|
|
622
|
-
src: url,
|
|
623
|
-
style: mediaStyle
|
|
624
|
-
}), url && isVideoBackground && createElement("video", {
|
|
625
|
-
ref: isDarkElement,
|
|
626
|
-
className: "wp-block-cover__video-background",
|
|
627
|
-
autoPlay: true,
|
|
628
|
-
muted: true,
|
|
629
|
-
loop: true,
|
|
630
|
-
src: url,
|
|
631
|
-
style: mediaStyle
|
|
632
|
-
}), isUploadingMedia && createElement(Spinner, null), createElement(CoverPlaceholder, {
|
|
633
|
-
disableMediaButtons: true,
|
|
634
|
-
onSelectMedia: onSelectMedia,
|
|
635
|
-
onError: onUploadError
|
|
636
|
-
}), createElement("div", innerBlocksProps)));
|
|
637
|
-
}
|
|
638
|
-
|
|
639
|
-
export default compose([withColors({
|
|
640
|
-
overlayColor: 'background-color'
|
|
641
|
-
})])(CoverEdit);
|
|
642
|
-
//# sourceMappingURL=edit.js.map
|