@wordpress/block-library 7.5.0 → 7.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +6 -0
- package/README.md +3 -2
- package/babel-plugin.js +154 -0
- package/build/audio/edit.js +1 -1
- 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/index.js +1 -0
- package/build/button/index.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/comment-author-avatar/index.js +1 -0
- package/build/comment-author-avatar/index.js.map +1 -1
- package/build/comments-title/deprecated.js +110 -0
- package/build/comments-title/deprecated.js.map +1 -0
- package/build/comments-title/edit.js +35 -37
- 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/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 +333 -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/{use-cover-is-dark.js → edit/use-cover-is-dark.js} +0 -0
- package/build/cover/edit/use-cover-is-dark.js.map +1 -0
- package/build/cover/edit.native.js +0 -1
- package/build/cover/edit.native.js.map +1 -1
- package/build/cover/focal-point-settings-button.native.js.map +1 -1
- package/build/cover/shared.js +9 -0
- package/build/cover/shared.js.map +1 -1
- package/build/embed/embed-preview.js +1 -1
- package/build/embed/embed-preview.js.map +1 -1
- package/build/file/edit.native.js +0 -1
- package/build/file/edit.native.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/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/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 +1 -0
- package/build/heading/transforms.js.map +1 -1
- package/build/image/edit.js +5 -2
- package/build/image/edit.js.map +1 -1
- package/build/image/edit.native.js +0 -1
- package/build/image/edit.native.js.map +1 -1
- package/build/image/image.js +1 -1
- package/build/image/image.js.map +1 -1
- package/build/index.js +46 -10
- 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/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 +30 -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 +86 -81
- package/build/navigation/edit/index.js.map +1 -1
- package/build/navigation/edit/inner-blocks.js +1 -5
- package/build/navigation/edit/inner-blocks.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-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/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/post-author/edit.js +1 -1
- package/build/post-author/edit.js.map +1 -1
- package/build/post-author-name/index.js +1 -0
- package/build/post-author-name/index.js.map +1 -1
- package/build/post-comment/index.js +1 -0
- package/build/post-comment/index.js.map +1 -1
- package/build/post-comments/edit.js +34 -16
- package/build/post-comments/edit.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/form.js +1 -1
- package/build/post-comments-form/form.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-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 +11 -2
- 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 +12 -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-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/v2/edit.js +1 -1
- package/build/quote/v2/edit.js.map +1 -1
- package/build/search/edit.js +1 -0
- package/build/search/edit.js.map +1 -1
- package/build/site-logo/edit.js +1 -1
- package/build/site-logo/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 +138 -66
- 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 +1 -1
- package/build/video/edit.js.map +1 -1
- package/build-module/audio/edit.js +2 -2
- 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/index.js +1 -0
- package/build-module/button/index.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/comment-author-avatar/index.js +1 -0
- package/build-module/comment-author-avatar/index.js.map +1 -1
- 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 -40
- 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/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 +307 -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/{use-cover-is-dark.js → edit/use-cover-is-dark.js} +0 -0
- package/build-module/cover/edit/use-cover-is-dark.js.map +1 -0
- package/build-module/cover/edit.native.js +0 -1
- 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/shared.js +7 -0
- package/build-module/cover/shared.js.map +1 -1
- package/build-module/embed/embed-preview.js +2 -2
- package/build-module/embed/embed-preview.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/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/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/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 +1 -0
- package/build-module/heading/transforms.js.map +1 -1
- package/build-module/image/edit.js +6 -3
- package/build-module/image/edit.js.map +1 -1
- package/build-module/image/edit.native.js +0 -1
- package/build-module/image/edit.native.js.map +1 -1
- package/build-module/image/image.js +2 -2
- package/build-module/image/image.js.map +1 -1
- package/build-module/index.js +42 -10
- 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/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 +19 -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 +87 -82
- package/build-module/navigation/edit/index.js.map +1 -1
- package/build-module/navigation/edit/inner-blocks.js +2 -6
- package/build-module/navigation/edit/inner-blocks.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-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/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/post-author/edit.js +1 -1
- package/build-module/post-author/edit.js.map +1 -1
- package/build-module/post-author-name/index.js +1 -0
- package/build-module/post-author-name/index.js.map +1 -1
- package/build-module/post-comment/index.js +1 -0
- package/build-module/post-comment/index.js.map +1 -1
- package/build-module/post-comments/edit.js +35 -16
- package/build-module/post-comments/edit.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/form.js +1 -1
- package/build-module/post-comments-form/form.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-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 +10 -3
- 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 +10 -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-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/v2/edit.js +2 -2
- package/build-module/quote/v2/edit.js.map +1 -1
- package/build-module/search/edit.js +1 -0
- package/build-module/search/edit.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/table/edit.js +17 -4
- package/build-module/table/edit.js.map +1 -1
- package/build-module/table-of-contents/edit.js +136 -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 +2 -2
- package/build-module/video/edit.js.map +1 -1
- package/build-style/editor-rtl.css +4 -6
- package/build-style/editor.css +4 -6
- package/build-style/image/editor-rtl.css +1 -1
- package/build-style/image/editor.css +1 -1
- package/build-style/post-comments/style-rtl.css +22 -0
- package/build-style/post-comments/style.css +22 -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/style-rtl.css +23 -3
- package/build-style/style.css +23 -3
- 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 +4 -2
- 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/categories/block.json +1 -1
- package/src/categories/edit.js +1 -1
- package/src/comment-author-avatar/block.json +1 -0
- package/src/comments-title/block.json +0 -6
- package/src/comments-title/deprecated.js +34 -0
- package/src/comments-title/edit.js +44 -100
- package/src/comments-title/index.js +3 -1
- package/src/comments-title/index.php +41 -23
- package/src/cover/controls.native.js +1 -2
- package/src/cover/edit/block-controls.js +119 -0
- package/src/cover/edit/cover-placeholder.js +39 -0
- package/src/cover/edit/index.js +381 -0
- package/src/cover/edit/inspector-controls.js +286 -0
- package/src/cover/edit/resizable-cover.js +55 -0
- package/src/cover/{use-cover-is-dark.js → edit/use-cover-is-dark.js} +0 -0
- package/src/cover/edit.native.js +0 -1
- 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/shared.js +4 -0
- package/src/cover/test/block-controls.js +62 -0
- package/src/embed/embed-preview.js +4 -2
- package/src/file/edit.native.js +0 -1
- package/src/gallery/edit.js +2 -1
- package/src/gallery/gallery.js +2 -2
- 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/heading/block.json +1 -0
- package/src/heading/edit.js +5 -2
- package/src/image/edit.js +9 -1
- package/src/image/edit.native.js +0 -1
- package/src/image/editor.scss +1 -1
- package/src/image/image.js +8 -2
- package/src/image/test/edit.native.js +7 -7
- package/src/index.js +50 -27
- package/src/is-block-metadata-experimental.js +19 -0
- package/src/latest-posts/edit.js +27 -2
- package/src/latest-posts/index.php +12 -6
- 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 +24 -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/edit/index.js +175 -169
- package/src/navigation/edit/inner-blocks.js +1 -8
- package/src/navigation/index.php +40 -0
- package/src/navigation/use-navigation-entities.js +1 -1
- 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/page-list/convert-to-links-modal.js +1 -1
- package/src/page-list/edit.js +1 -4
- package/src/post-author/edit.js +24 -22
- package/src/post-author-name/block.json +1 -0
- package/src/post-comment/block.json +1 -0
- package/src/post-comments/edit.js +54 -22
- package/src/post-comments/style.scss +26 -0
- package/src/post-comments-count/block.json +1 -0
- package/src/post-comments-form/form.js +1 -4
- package/src/post-comments-form/style.scss +1 -4
- package/src/post-comments-link/block.json +1 -0
- 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/edit.js +19 -0
- package/src/post-terms/hooks.js +27 -0
- package/src/post-terms/index.js +14 -7
- package/src/post-terms/index.php +40 -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-title/index.js +1 -1
- package/src/query-title/variations.js +2 -2
- package/src/quote/edit.js +5 -2
- package/src/quote/v2/edit.js +4 -2
- package/src/search/edit.js +1 -0
- package/src/search/index.php +1 -1
- package/src/separator/editor.scss +1 -0
- package/src/site-logo/edit.js +1 -1
- package/src/table/edit.js +19 -4
- package/src/table-of-contents/block.json +9 -2
- package/src/table-of-contents/edit.js +155 -75
- 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 +4 -2
- 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/cover/edit.js +0 -598
- package/build/cover/edit.js.map +0 -1
- package/build/cover/use-cover-is-dark.js.map +0 -1
- package/build/post-terms/variations.js +0 -37
- package/build/post-terms/variations.js.map +0 -1
- package/build-module/cover/edit.js +0 -575
- package/build-module/cover/edit.js.map +0 -1
- package/build-module/cover/use-cover-is-dark.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 -757
- 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 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-library/src/cover/use-cover-is-dark.js"],"names":["retrieveFastAverageColor","fastAverageColor","FastAverageColor","useCoverIsDark","url","dimRatio","overlayColor","elementRef","isDark","setIsDark","current","getColorAsync","color"],"mappings":";;;;;;;;;AAGA;;AACA;;AAKA;;AATA;AACA;AACA;;AAIA;AACA;AACA;AAGA,SAASA,wBAAT,GAAoC;AACnC,MAAK,CAAEA,wBAAwB,CAACC,gBAAhC,EAAmD;AAClDD,IAAAA,wBAAwB,CAACC,gBAAzB,GAA4C,IAAIC,yBAAJ,EAA5C;AACA;;AACD,SAAOF,wBAAwB,CAACC,gBAAhC;AACA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACe,SAASE,cAAT,CACdC,GADc,EAKb;AAAA,MAHDC,QAGC,uEAHU,EAGV;AAAA,MAFDC,YAEC;AAAA,MADDC,UACC;AACD,QAAM,CAAEC,MAAF,EAAUC,SAAV,IAAwB,uBAAU,KAAV,CAA9B;AACA,0BAAW,MAAM;AAChB;AACA;AACA,QAAKL,GAAG,IAAIC,QAAQ,IAAI,EAAnB,IAAyBE,UAAU,CAACG,OAAzC,EAAmD;AAClDV,MAAAA,wBAAwB,GAAGW,aAA3B,CACCJ,UAAU,CAACG,OADZ,EAEGE,KAAF,IAAa;AACZH,QAAAA,SAAS,CAAEG,KAAK,CAACJ,MAAR,CAAT;AACA,OAJF;AAMA;AACD,GAXD,EAWG,CAAEJ,GAAF,EAAOA,GAAG,IAAIC,QAAQ,IAAI,EAAnB,IAAyBE,UAAU,CAACG,OAA3C,EAAoDD,SAApD,CAXH;AAYA,0BAAW,MAAM;AAChB;AACA;AACA,QAAKJ,QAAQ,GAAG,EAAX,IAAiB,CAAED,GAAxB,EAA8B;AAC7B,UAAK,CAAEE,YAAP,EAAsB;AACrB;AACAG,QAAAA,SAAS,CAAE,IAAF,CAAT;AACA;AACA;;AACDA,MAAAA,SAAS,CAAE,oBAAQH,YAAR,EAAuBE,MAAvB,EAAF,CAAT;AACA;AACD,GAXD,EAWG,CAAEF,YAAF,EAAgBD,QAAQ,GAAG,EAAX,IAAiB,CAAED,GAAnC,EAAwCK,SAAxC,CAXH;AAYA,0BAAW,MAAM;AAChB,QAAK,CAAEL,GAAF,IAAS,CAAEE,YAAhB,EAA+B;AAC9B;AACAG,MAAAA,SAAS,CAAE,KAAF,CAAT;AACA;AACD,GALD,EAKG,CAAE,CAAEL,GAAF,IAAS,CAAEE,YAAb,EAA2BG,SAA3B,CALH;AAMA,SAAOD,MAAP;AACA","sourcesContent":["/**\n * External dependencies\n */\nimport FastAverageColor from 'fast-average-color';\nimport { colord } from 'colord';\n\n/**\n * WordPress dependencies\n */\nimport { useEffect, useState } from '@wordpress/element';\n\nfunction retrieveFastAverageColor() {\n\tif ( ! retrieveFastAverageColor.fastAverageColor ) {\n\t\tretrieveFastAverageColor.fastAverageColor = new FastAverageColor();\n\t}\n\treturn retrieveFastAverageColor.fastAverageColor;\n}\n\n/**\n * useCoverIsDark is a hook that returns a boolean variable specifying if the cover\n * background is dark or not.\n *\n * @param {?string} url Url of the media background.\n * @param {?number} dimRatio Transparency of the overlay color. If an image and\n * color are set, dimRatio is used to decide what is used\n * for background darkness checking purposes.\n * @param {?string} overlayColor String containing the overlay color value if one exists.\n * @param {?Object} elementRef If a media background is set, elementRef should contain a reference to a\n * dom element that renders that media.\n *\n * @return {boolean} True if the cover background is considered \"dark\" and false otherwise.\n */\nexport default function useCoverIsDark(\n\turl,\n\tdimRatio = 50,\n\toverlayColor,\n\telementRef\n) {\n\tconst [ isDark, setIsDark ] = useState( false );\n\tuseEffect( () => {\n\t\t// If opacity is lower than 50 the dominant color is the image or video color,\n\t\t// so use that color for the dark mode computation.\n\t\tif ( url && dimRatio <= 50 && elementRef.current ) {\n\t\t\tretrieveFastAverageColor().getColorAsync(\n\t\t\t\telementRef.current,\n\t\t\t\t( color ) => {\n\t\t\t\t\tsetIsDark( color.isDark );\n\t\t\t\t}\n\t\t\t);\n\t\t}\n\t}, [ url, url && dimRatio <= 50 && elementRef.current, setIsDark ] );\n\tuseEffect( () => {\n\t\t// If opacity is greater than 50 the dominant color is the overlay color,\n\t\t// so use that color for the dark mode computation.\n\t\tif ( dimRatio > 50 || ! url ) {\n\t\t\tif ( ! overlayColor ) {\n\t\t\t\t// If no overlay color exists the overlay color is black (isDark )\n\t\t\t\tsetIsDark( true );\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tsetIsDark( colord( overlayColor ).isDark() );\n\t\t}\n\t}, [ overlayColor, dimRatio > 50 || ! url, setIsDark ] );\n\tuseEffect( () => {\n\t\tif ( ! url && ! overlayColor ) {\n\t\t\t// Reset isDark.\n\t\t\tsetIsDark( false );\n\t\t}\n\t}, [ ! url && ! overlayColor, setIsDark ] );\n\treturn isDark;\n}\n"]}
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = void 0;
|
|
7
|
-
|
|
8
|
-
var _i18n = require("@wordpress/i18n");
|
|
9
|
-
|
|
10
|
-
var _icons = require("@wordpress/icons");
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* WordPress dependencies
|
|
14
|
-
*/
|
|
15
|
-
const variations = [{
|
|
16
|
-
name: 'category',
|
|
17
|
-
title: (0, _i18n.__)('Post Categories'),
|
|
18
|
-
description: (0, _i18n.__)("Display a post's categories."),
|
|
19
|
-
icon: _icons.postCategories,
|
|
20
|
-
isDefault: true,
|
|
21
|
-
attributes: {
|
|
22
|
-
term: 'category'
|
|
23
|
-
},
|
|
24
|
-
isActive: blockAttributes => blockAttributes.term === 'category'
|
|
25
|
-
}, {
|
|
26
|
-
name: 'post_tag',
|
|
27
|
-
title: (0, _i18n.__)('Post Tags'),
|
|
28
|
-
description: (0, _i18n.__)("Display a post's tags."),
|
|
29
|
-
icon: _icons.postTerms,
|
|
30
|
-
attributes: {
|
|
31
|
-
term: 'post_tag'
|
|
32
|
-
},
|
|
33
|
-
isActive: blockAttributes => blockAttributes.term === 'post_tag'
|
|
34
|
-
}];
|
|
35
|
-
var _default = variations;
|
|
36
|
-
exports.default = _default;
|
|
37
|
-
//# sourceMappingURL=variations.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-library/src/post-terms/variations.js"],"names":["variations","name","title","description","icon","postCategories","isDefault","attributes","term","isActive","blockAttributes","postTerms"],"mappings":";;;;;;;AAGA;;AACA;;AAJA;AACA;AACA;AAIA,MAAMA,UAAU,GAAG,CAClB;AACCC,EAAAA,IAAI,EAAE,UADP;AAECC,EAAAA,KAAK,EAAE,cAAI,iBAAJ,CAFR;AAGCC,EAAAA,WAAW,EAAE,cAAI,8BAAJ,CAHd;AAICC,EAAAA,IAAI,EAAEC,qBAJP;AAKCC,EAAAA,SAAS,EAAE,IALZ;AAMCC,EAAAA,UAAU,EAAE;AAAEC,IAAAA,IAAI,EAAE;AAAR,GANb;AAOCC,EAAAA,QAAQ,EAAIC,eAAF,IAAuBA,eAAe,CAACF,IAAhB,KAAyB;AAP3D,CADkB,EAWlB;AACCP,EAAAA,IAAI,EAAE,UADP;AAECC,EAAAA,KAAK,EAAE,cAAI,WAAJ,CAFR;AAGCC,EAAAA,WAAW,EAAE,cAAI,wBAAJ,CAHd;AAICC,EAAAA,IAAI,EAAEO,gBAJP;AAKCJ,EAAAA,UAAU,EAAE;AAAEC,IAAAA,IAAI,EAAE;AAAR,GALb;AAMCC,EAAAA,QAAQ,EAAIC,eAAF,IAAuBA,eAAe,CAACF,IAAhB,KAAyB;AAN3D,CAXkB,CAAnB;eAqBeR,U","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { postCategories, postTerms } from '@wordpress/icons';\n\nconst variations = [\n\t{\n\t\tname: 'category',\n\t\ttitle: __( 'Post Categories' ),\n\t\tdescription: __( \"Display a post's categories.\" ),\n\t\ticon: postCategories,\n\t\tisDefault: true,\n\t\tattributes: { term: 'category' },\n\t\tisActive: ( blockAttributes ) => blockAttributes.term === 'category',\n\t},\n\n\t{\n\t\tname: 'post_tag',\n\t\ttitle: __( 'Post Tags' ),\n\t\tdescription: __( \"Display a post's tags.\" ),\n\t\ticon: postTerms,\n\t\tattributes: { term: 'post_tag' },\n\t\tisActive: ( blockAttributes ) => blockAttributes.term === 'post_tag',\n\t},\n];\n\nexport default variations;\n"]}
|
|
@@ -1,575 +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 { extend } from 'colord';
|
|
9
|
-
import namesPlugin from 'colord/plugins/names';
|
|
10
|
-
/**
|
|
11
|
-
* WordPress dependencies
|
|
12
|
-
*/
|
|
13
|
-
|
|
14
|
-
import { useEntityProp, store as coreStore } from '@wordpress/core-data';
|
|
15
|
-
import { Fragment, useEffect, useRef, useState, useMemo } from '@wordpress/element';
|
|
16
|
-
import { BaseControl, Button, ExternalLink, FocalPointPicker, PanelBody, PanelRow, RangeControl, ResizableBox, Spinner, TextareaControl, ToggleControl, ToolbarButton, __experimentalUseCustomUnits as useCustomUnits, __experimentalToolsPanelItem as ToolsPanelItem, __experimentalUnitControl as UnitControl, __experimentalParseQuantityAndUnitFromRawValue as parseQuantityAndUnitFromRawValue } from '@wordpress/components';
|
|
17
|
-
import { compose, useInstanceId } from '@wordpress/compose';
|
|
18
|
-
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';
|
|
19
|
-
import { __ } from '@wordpress/i18n';
|
|
20
|
-
import { useSelect, useDispatch } from '@wordpress/data';
|
|
21
|
-
import { postFeaturedImage, cover as icon } from '@wordpress/icons';
|
|
22
|
-
import { isBlobURL } from '@wordpress/blob';
|
|
23
|
-
import { store as noticesStore } from '@wordpress/notices';
|
|
24
|
-
/**
|
|
25
|
-
* Internal dependencies
|
|
26
|
-
*/
|
|
27
|
-
|
|
28
|
-
import { ALLOWED_MEDIA_TYPES, attributesFromMedia, IMAGE_BACKGROUND_TYPE, VIDEO_BACKGROUND_TYPE, COVER_MIN_HEIGHT, backgroundImageStyles, dimRatioToClass, isContentPositionCenter, getPositionClassName } from './shared';
|
|
29
|
-
import useCoverIsDark from './use-cover-is-dark';
|
|
30
|
-
extend([namesPlugin]);
|
|
31
|
-
|
|
32
|
-
function getInnerBlocksTemplate(attributes) {
|
|
33
|
-
return [['core/paragraph', {
|
|
34
|
-
align: 'center',
|
|
35
|
-
placeholder: __('Write title…'),
|
|
36
|
-
...attributes
|
|
37
|
-
}]];
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
function CoverHeightInput(_ref) {
|
|
41
|
-
let {
|
|
42
|
-
onChange,
|
|
43
|
-
onUnitChange,
|
|
44
|
-
unit = 'px',
|
|
45
|
-
value = ''
|
|
46
|
-
} = _ref;
|
|
47
|
-
const instanceId = useInstanceId(UnitControl);
|
|
48
|
-
const inputId = `block-cover-height-input-${instanceId}`;
|
|
49
|
-
const isPx = unit === 'px';
|
|
50
|
-
const units = useCustomUnits({
|
|
51
|
-
availableUnits: useSetting('spacing.units') || ['px', 'em', 'rem', 'vw', 'vh'],
|
|
52
|
-
defaultValues: {
|
|
53
|
-
px: 430,
|
|
54
|
-
'%': 20,
|
|
55
|
-
em: 20,
|
|
56
|
-
rem: 20,
|
|
57
|
-
vw: 20,
|
|
58
|
-
vh: 50
|
|
59
|
-
}
|
|
60
|
-
});
|
|
61
|
-
|
|
62
|
-
const handleOnChange = unprocessedValue => {
|
|
63
|
-
const inputValue = unprocessedValue !== '' ? parseFloat(unprocessedValue) : undefined;
|
|
64
|
-
|
|
65
|
-
if (isNaN(inputValue) && inputValue !== undefined) {
|
|
66
|
-
return;
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
onChange(inputValue);
|
|
70
|
-
};
|
|
71
|
-
|
|
72
|
-
const computedValue = useMemo(() => {
|
|
73
|
-
const [parsedQuantity] = parseQuantityAndUnitFromRawValue(value);
|
|
74
|
-
return [parsedQuantity, unit].join('');
|
|
75
|
-
}, [unit, value]);
|
|
76
|
-
const min = isPx ? COVER_MIN_HEIGHT : 0;
|
|
77
|
-
return createElement(BaseControl, {
|
|
78
|
-
label: __('Minimum height of cover'),
|
|
79
|
-
id: inputId
|
|
80
|
-
}, createElement(UnitControl, {
|
|
81
|
-
id: inputId,
|
|
82
|
-
isResetValueOnUnitChange: true,
|
|
83
|
-
min: min,
|
|
84
|
-
onChange: handleOnChange,
|
|
85
|
-
onUnitChange: onUnitChange,
|
|
86
|
-
style: {
|
|
87
|
-
maxWidth: 80
|
|
88
|
-
},
|
|
89
|
-
units: units,
|
|
90
|
-
value: computedValue
|
|
91
|
-
}));
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
const RESIZABLE_BOX_ENABLE_OPTION = {
|
|
95
|
-
top: false,
|
|
96
|
-
right: false,
|
|
97
|
-
bottom: true,
|
|
98
|
-
left: false,
|
|
99
|
-
topRight: false,
|
|
100
|
-
bottomRight: false,
|
|
101
|
-
bottomLeft: false,
|
|
102
|
-
topLeft: false
|
|
103
|
-
};
|
|
104
|
-
|
|
105
|
-
function ResizableCover(_ref2) {
|
|
106
|
-
let {
|
|
107
|
-
className,
|
|
108
|
-
onResizeStart,
|
|
109
|
-
onResize,
|
|
110
|
-
onResizeStop,
|
|
111
|
-
...props
|
|
112
|
-
} = _ref2;
|
|
113
|
-
const [isResizing, setIsResizing] = useState(false);
|
|
114
|
-
return createElement(ResizableBox, _extends({
|
|
115
|
-
className: classnames(className, {
|
|
116
|
-
'is-resizing': isResizing
|
|
117
|
-
}),
|
|
118
|
-
enable: RESIZABLE_BOX_ENABLE_OPTION,
|
|
119
|
-
onResizeStart: (_event, _direction, elt) => {
|
|
120
|
-
onResizeStart(elt.clientHeight);
|
|
121
|
-
onResize(elt.clientHeight);
|
|
122
|
-
},
|
|
123
|
-
onResize: (_event, _direction, elt) => {
|
|
124
|
-
onResize(elt.clientHeight);
|
|
125
|
-
|
|
126
|
-
if (!isResizing) {
|
|
127
|
-
setIsResizing(true);
|
|
128
|
-
}
|
|
129
|
-
},
|
|
130
|
-
onResizeStop: (_event, _direction, elt) => {
|
|
131
|
-
onResizeStop(elt.clientHeight);
|
|
132
|
-
setIsResizing(false);
|
|
133
|
-
}
|
|
134
|
-
}, props));
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
function mediaPosition(_ref3) {
|
|
138
|
-
let {
|
|
139
|
-
x,
|
|
140
|
-
y
|
|
141
|
-
} = _ref3;
|
|
142
|
-
return `${Math.round(x * 100)}% ${Math.round(y * 100)}%`;
|
|
143
|
-
}
|
|
144
|
-
/**
|
|
145
|
-
* Is the URL a temporary blob URL? A blob URL is one that is used temporarily while
|
|
146
|
-
* the media (image or video) is being uploaded and will not have an id allocated yet.
|
|
147
|
-
*
|
|
148
|
-
* @param {number} id The id of the media.
|
|
149
|
-
* @param {string} url The url of the media.
|
|
150
|
-
*
|
|
151
|
-
* @return {boolean} Is the URL a Blob URL.
|
|
152
|
-
*/
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
const isTemporaryMedia = (id, url) => !id && isBlobURL(url);
|
|
156
|
-
|
|
157
|
-
function CoverPlaceholder(_ref4) {
|
|
158
|
-
let {
|
|
159
|
-
disableMediaButtons = false,
|
|
160
|
-
children,
|
|
161
|
-
onSelectMedia,
|
|
162
|
-
onError,
|
|
163
|
-
style
|
|
164
|
-
} = _ref4;
|
|
165
|
-
return createElement(MediaPlaceholder, {
|
|
166
|
-
icon: createElement(BlockIcon, {
|
|
167
|
-
icon: icon
|
|
168
|
-
}),
|
|
169
|
-
labels: {
|
|
170
|
-
title: __('Cover'),
|
|
171
|
-
instructions: __('Drag and drop onto this block, upload, or select existing media from your library.')
|
|
172
|
-
},
|
|
173
|
-
onSelect: onSelectMedia,
|
|
174
|
-
accept: "image/*,video/*",
|
|
175
|
-
allowedTypes: ALLOWED_MEDIA_TYPES,
|
|
176
|
-
disableMediaButtons: disableMediaButtons,
|
|
177
|
-
onError: onError,
|
|
178
|
-
style: style
|
|
179
|
-
}, children);
|
|
180
|
-
}
|
|
181
|
-
|
|
182
|
-
function CoverEdit(_ref5) {
|
|
183
|
-
var _useSetting;
|
|
184
|
-
|
|
185
|
-
let {
|
|
186
|
-
attributes,
|
|
187
|
-
clientId,
|
|
188
|
-
isSelected,
|
|
189
|
-
overlayColor,
|
|
190
|
-
setAttributes,
|
|
191
|
-
setOverlayColor,
|
|
192
|
-
toggleSelection,
|
|
193
|
-
context: {
|
|
194
|
-
postId,
|
|
195
|
-
postType
|
|
196
|
-
}
|
|
197
|
-
} = _ref5;
|
|
198
|
-
const {
|
|
199
|
-
contentPosition,
|
|
200
|
-
id,
|
|
201
|
-
useFeaturedImage,
|
|
202
|
-
dimRatio,
|
|
203
|
-
focalPoint,
|
|
204
|
-
hasParallax,
|
|
205
|
-
isDark,
|
|
206
|
-
isRepeated,
|
|
207
|
-
minHeight,
|
|
208
|
-
minHeightUnit,
|
|
209
|
-
alt,
|
|
210
|
-
allowedBlocks,
|
|
211
|
-
templateLock
|
|
212
|
-
} = attributes;
|
|
213
|
-
const [featuredImage] = useEntityProp('postType', postType, 'featured_media', postId);
|
|
214
|
-
const media = useSelect(select => featuredImage && select(coreStore).getMedia(featuredImage, {
|
|
215
|
-
context: 'view'
|
|
216
|
-
}), [featuredImage]);
|
|
217
|
-
const mediaUrl = media === null || media === void 0 ? void 0 : media.source_url; // instead of destructuring the attributes
|
|
218
|
-
// we define the url and background type
|
|
219
|
-
// depending on the value of the useFeaturedImage flag
|
|
220
|
-
// to preview in edit the dynamic featured image
|
|
221
|
-
|
|
222
|
-
const url = useFeaturedImage ? mediaUrl : attributes.url;
|
|
223
|
-
const backgroundType = useFeaturedImage ? IMAGE_BACKGROUND_TYPE : attributes.backgroundType;
|
|
224
|
-
const {
|
|
225
|
-
__unstableMarkNextChangeAsNotPersistent
|
|
226
|
-
} = useDispatch(blockEditorStore);
|
|
227
|
-
const {
|
|
228
|
-
createErrorNotice
|
|
229
|
-
} = useDispatch(noticesStore);
|
|
230
|
-
|
|
231
|
-
const {
|
|
232
|
-
gradientClass,
|
|
233
|
-
gradientValue,
|
|
234
|
-
setGradient
|
|
235
|
-
} = __experimentalUseGradient();
|
|
236
|
-
|
|
237
|
-
const onSelectMedia = attributesFromMedia(setAttributes, dimRatio);
|
|
238
|
-
const isUploadingMedia = isTemporaryMedia(id, url);
|
|
239
|
-
const [prevMinHeightValue, setPrevMinHeightValue] = useState(minHeight);
|
|
240
|
-
const [prevMinHeightUnit, setPrevMinHeightUnit] = useState(minHeightUnit);
|
|
241
|
-
const isMinFullHeight = minHeightUnit === 'vh' && minHeight === 100;
|
|
242
|
-
|
|
243
|
-
const toggleMinFullHeight = () => {
|
|
244
|
-
if (isMinFullHeight) {
|
|
245
|
-
// If there aren't previous values, take the default ones.
|
|
246
|
-
if (prevMinHeightUnit === 'vh' && prevMinHeightValue === 100) {
|
|
247
|
-
return setAttributes({
|
|
248
|
-
minHeight: undefined,
|
|
249
|
-
minHeightUnit: undefined
|
|
250
|
-
});
|
|
251
|
-
} // Set the previous values of height.
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
return setAttributes({
|
|
255
|
-
minHeight: prevMinHeightValue,
|
|
256
|
-
minHeightUnit: prevMinHeightUnit
|
|
257
|
-
});
|
|
258
|
-
}
|
|
259
|
-
|
|
260
|
-
setPrevMinHeightValue(minHeight);
|
|
261
|
-
setPrevMinHeightUnit(minHeightUnit); // Set full height.
|
|
262
|
-
|
|
263
|
-
return setAttributes({
|
|
264
|
-
minHeight: 100,
|
|
265
|
-
minHeightUnit: 'vh'
|
|
266
|
-
});
|
|
267
|
-
};
|
|
268
|
-
|
|
269
|
-
const toggleParallax = () => {
|
|
270
|
-
setAttributes({
|
|
271
|
-
hasParallax: !hasParallax,
|
|
272
|
-
...(!hasParallax ? {
|
|
273
|
-
focalPoint: undefined
|
|
274
|
-
} : {})
|
|
275
|
-
});
|
|
276
|
-
};
|
|
277
|
-
|
|
278
|
-
const toggleIsRepeated = () => {
|
|
279
|
-
setAttributes({
|
|
280
|
-
isRepeated: !isRepeated
|
|
281
|
-
});
|
|
282
|
-
};
|
|
283
|
-
|
|
284
|
-
const toggleUseFeaturedImage = () => {
|
|
285
|
-
setAttributes({
|
|
286
|
-
useFeaturedImage: !useFeaturedImage,
|
|
287
|
-
dimRatio: dimRatio === 100 ? 50 : dimRatio
|
|
288
|
-
});
|
|
289
|
-
};
|
|
290
|
-
|
|
291
|
-
const onUploadError = message => {
|
|
292
|
-
createErrorNotice(Array.isArray(message) ? message[2] : message, {
|
|
293
|
-
type: 'snackbar'
|
|
294
|
-
});
|
|
295
|
-
};
|
|
296
|
-
|
|
297
|
-
const isDarkElement = useRef();
|
|
298
|
-
const isCoverDark = useCoverIsDark(url, dimRatio, overlayColor.color, isDarkElement);
|
|
299
|
-
useEffect(() => {
|
|
300
|
-
// This side-effect should not create an undo level.
|
|
301
|
-
__unstableMarkNextChangeAsNotPersistent();
|
|
302
|
-
|
|
303
|
-
setAttributes({
|
|
304
|
-
isDark: isCoverDark
|
|
305
|
-
});
|
|
306
|
-
}, [isCoverDark]);
|
|
307
|
-
const isImageBackground = IMAGE_BACKGROUND_TYPE === backgroundType;
|
|
308
|
-
const isVideoBackground = VIDEO_BACKGROUND_TYPE === backgroundType;
|
|
309
|
-
const minHeightWithUnit = minHeight && minHeightUnit ? `${minHeight}${minHeightUnit}` : minHeight;
|
|
310
|
-
const isImgElement = !(hasParallax || isRepeated);
|
|
311
|
-
const style = { ...(isImageBackground && !isImgElement ? backgroundImageStyles(url) : undefined),
|
|
312
|
-
minHeight: minHeightWithUnit || undefined
|
|
313
|
-
};
|
|
314
|
-
const bgStyle = {
|
|
315
|
-
backgroundColor: overlayColor.color
|
|
316
|
-
};
|
|
317
|
-
const mediaStyle = {
|
|
318
|
-
objectPosition: focalPoint && isImgElement ? mediaPosition(focalPoint) : undefined
|
|
319
|
-
};
|
|
320
|
-
const hasBackground = !!(url || overlayColor.color || gradientValue);
|
|
321
|
-
const showFocalPointPicker = isVideoBackground || isImageBackground && (!hasParallax || isRepeated);
|
|
322
|
-
|
|
323
|
-
const imperativeFocalPointPreview = value => {
|
|
324
|
-
const [styleOfRef, property] = isDarkElement.current ? [isDarkElement.current.style, 'objectPosition'] : [ref.current.style, 'backgroundPosition'];
|
|
325
|
-
styleOfRef[property] = mediaPosition(value);
|
|
326
|
-
};
|
|
327
|
-
|
|
328
|
-
const hasInnerBlocks = useSelect(select => select(blockEditorStore).getBlock(clientId).innerBlocks.length > 0, [clientId]);
|
|
329
|
-
const controls = createElement(Fragment, null, createElement(BlockControls, {
|
|
330
|
-
group: "block"
|
|
331
|
-
}, createElement(BlockAlignmentMatrixControl, {
|
|
332
|
-
label: __('Change content position'),
|
|
333
|
-
value: contentPosition,
|
|
334
|
-
onChange: nextPosition => setAttributes({
|
|
335
|
-
contentPosition: nextPosition
|
|
336
|
-
}),
|
|
337
|
-
isDisabled: !hasInnerBlocks
|
|
338
|
-
}), createElement(FullHeightAlignmentControl, {
|
|
339
|
-
isActive: isMinFullHeight,
|
|
340
|
-
onToggle: toggleMinFullHeight,
|
|
341
|
-
isDisabled: !hasInnerBlocks
|
|
342
|
-
})), createElement(BlockControls, {
|
|
343
|
-
group: "other"
|
|
344
|
-
}, createElement(ToolbarButton, {
|
|
345
|
-
icon: postFeaturedImage,
|
|
346
|
-
label: __('Use featured image'),
|
|
347
|
-
isPressed: useFeaturedImage,
|
|
348
|
-
onClick: toggleUseFeaturedImage
|
|
349
|
-
}), !useFeaturedImage && createElement(MediaReplaceFlow, {
|
|
350
|
-
mediaId: id,
|
|
351
|
-
mediaURL: url,
|
|
352
|
-
allowedTypes: ALLOWED_MEDIA_TYPES,
|
|
353
|
-
accept: "image/*,video/*",
|
|
354
|
-
onSelect: onSelectMedia,
|
|
355
|
-
name: !url ? __('Add Media') : __('Replace')
|
|
356
|
-
})), createElement(InspectorControls, null, !!url && createElement(PanelBody, {
|
|
357
|
-
title: __('Media settings')
|
|
358
|
-
}, isImageBackground && createElement(Fragment, null, createElement(ToggleControl, {
|
|
359
|
-
label: __('Fixed background'),
|
|
360
|
-
checked: hasParallax,
|
|
361
|
-
onChange: toggleParallax
|
|
362
|
-
}), createElement(ToggleControl, {
|
|
363
|
-
label: __('Repeated background'),
|
|
364
|
-
checked: isRepeated,
|
|
365
|
-
onChange: toggleIsRepeated
|
|
366
|
-
})), showFocalPointPicker && createElement(FocalPointPicker, {
|
|
367
|
-
label: __('Focal point picker'),
|
|
368
|
-
url: url,
|
|
369
|
-
value: focalPoint,
|
|
370
|
-
onDragStart: imperativeFocalPointPreview,
|
|
371
|
-
onDrag: imperativeFocalPointPreview,
|
|
372
|
-
onChange: newFocalPoint => setAttributes({
|
|
373
|
-
focalPoint: newFocalPoint
|
|
374
|
-
})
|
|
375
|
-
}), !useFeaturedImage && url && isImageBackground && isImgElement && createElement(TextareaControl, {
|
|
376
|
-
label: __('Alt text (alternative text)'),
|
|
377
|
-
value: alt,
|
|
378
|
-
onChange: newAlt => setAttributes({
|
|
379
|
-
alt: newAlt
|
|
380
|
-
}),
|
|
381
|
-
help: createElement(Fragment, null, createElement(ExternalLink, {
|
|
382
|
-
href: "https://www.w3.org/WAI/tutorials/images/decision-tree"
|
|
383
|
-
}, __('Describe the purpose of the image')), __('Leave empty if the image is purely decorative.'))
|
|
384
|
-
}), createElement(PanelRow, null, createElement(Button, {
|
|
385
|
-
variant: "secondary",
|
|
386
|
-
isSmall: true,
|
|
387
|
-
className: "block-library-cover__reset-button",
|
|
388
|
-
onClick: () => setAttributes({
|
|
389
|
-
url: undefined,
|
|
390
|
-
id: undefined,
|
|
391
|
-
backgroundType: undefined,
|
|
392
|
-
focalPoint: undefined,
|
|
393
|
-
hasParallax: undefined,
|
|
394
|
-
isRepeated: undefined,
|
|
395
|
-
useFeaturedImage: false
|
|
396
|
-
})
|
|
397
|
-
}, __('Clear Media')))), createElement(PanelColorGradientSettings, {
|
|
398
|
-
__experimentalHasMultipleOrigins: true,
|
|
399
|
-
__experimentalIsRenderedInSidebar: true,
|
|
400
|
-
title: __('Overlay'),
|
|
401
|
-
initialOpen: true,
|
|
402
|
-
settings: [{
|
|
403
|
-
colorValue: overlayColor.color,
|
|
404
|
-
gradientValue,
|
|
405
|
-
onColorChange: setOverlayColor,
|
|
406
|
-
onGradientChange: setGradient,
|
|
407
|
-
label: __('Color')
|
|
408
|
-
}]
|
|
409
|
-
}, createElement(RangeControl, {
|
|
410
|
-
label: __('Opacity'),
|
|
411
|
-
value: dimRatio,
|
|
412
|
-
onChange: newDimRation => setAttributes({
|
|
413
|
-
dimRatio: newDimRation
|
|
414
|
-
}),
|
|
415
|
-
min: 0,
|
|
416
|
-
max: 100,
|
|
417
|
-
step: 10,
|
|
418
|
-
required: true
|
|
419
|
-
}))), createElement(InspectorControls, {
|
|
420
|
-
__experimentalGroup: "dimensions"
|
|
421
|
-
}, createElement(ToolsPanelItem, {
|
|
422
|
-
hasValue: () => !!minHeight,
|
|
423
|
-
label: __('Minimum height'),
|
|
424
|
-
onDeselect: () => setAttributes({
|
|
425
|
-
minHeight: undefined,
|
|
426
|
-
minHeightUnit: undefined
|
|
427
|
-
}),
|
|
428
|
-
resetAllFilter: () => ({
|
|
429
|
-
minHeight: undefined,
|
|
430
|
-
minHeightUnit: undefined
|
|
431
|
-
}),
|
|
432
|
-
isShownByDefault: true,
|
|
433
|
-
panelId: clientId
|
|
434
|
-
}, createElement(CoverHeightInput, {
|
|
435
|
-
value: minHeight,
|
|
436
|
-
unit: minHeightUnit,
|
|
437
|
-
onChange: newMinHeight => setAttributes({
|
|
438
|
-
minHeight: newMinHeight
|
|
439
|
-
}),
|
|
440
|
-
onUnitChange: nextUnit => setAttributes({
|
|
441
|
-
minHeightUnit: nextUnit
|
|
442
|
-
})
|
|
443
|
-
}))));
|
|
444
|
-
const ref = useRef();
|
|
445
|
-
const blockProps = useBlockProps({
|
|
446
|
-
ref
|
|
447
|
-
}); // Check for fontSize support before we pass a fontSize attribute to the innerBlocks.
|
|
448
|
-
|
|
449
|
-
const hasFontSizes = !!((_useSetting = useSetting('typography.fontSizes')) !== null && _useSetting !== void 0 && _useSetting.length);
|
|
450
|
-
const innerBlocksTemplate = getInnerBlocksTemplate({
|
|
451
|
-
fontSize: hasFontSizes ? 'large' : undefined
|
|
452
|
-
});
|
|
453
|
-
const innerBlocksProps = useInnerBlocksProps({
|
|
454
|
-
className: 'wp-block-cover__inner-container'
|
|
455
|
-
}, {
|
|
456
|
-
template: innerBlocksTemplate,
|
|
457
|
-
templateInsertUpdatesSelection: true,
|
|
458
|
-
allowedBlocks,
|
|
459
|
-
templateLock
|
|
460
|
-
});
|
|
461
|
-
|
|
462
|
-
if (!hasInnerBlocks && !hasBackground) {
|
|
463
|
-
return createElement(Fragment, null, controls, createElement("div", _extends({}, blockProps, {
|
|
464
|
-
className: classnames('is-placeholder', blockProps.className)
|
|
465
|
-
}), createElement(CoverPlaceholder, {
|
|
466
|
-
onSelectMedia: onSelectMedia,
|
|
467
|
-
onError: onUploadError,
|
|
468
|
-
style: {
|
|
469
|
-
minHeight: minHeightWithUnit || undefined
|
|
470
|
-
}
|
|
471
|
-
}, createElement("div", {
|
|
472
|
-
className: "wp-block-cover__placeholder-background-options"
|
|
473
|
-
}, createElement(ColorPalette, {
|
|
474
|
-
disableCustomColors: true,
|
|
475
|
-
value: overlayColor.color,
|
|
476
|
-
onChange: setOverlayColor,
|
|
477
|
-
clearable: false
|
|
478
|
-
}))), createElement(ResizableCover, {
|
|
479
|
-
className: "block-library-cover__resize-container",
|
|
480
|
-
onResizeStart: () => {
|
|
481
|
-
setAttributes({
|
|
482
|
-
minHeightUnit: 'px'
|
|
483
|
-
});
|
|
484
|
-
toggleSelection(false);
|
|
485
|
-
},
|
|
486
|
-
onResize: value => {
|
|
487
|
-
setAttributes({
|
|
488
|
-
minHeight: value
|
|
489
|
-
});
|
|
490
|
-
},
|
|
491
|
-
onResizeStop: newMinHeight => {
|
|
492
|
-
toggleSelection(true);
|
|
493
|
-
setAttributes({
|
|
494
|
-
minHeight: newMinHeight
|
|
495
|
-
});
|
|
496
|
-
},
|
|
497
|
-
showHandle: isSelected
|
|
498
|
-
})));
|
|
499
|
-
}
|
|
500
|
-
|
|
501
|
-
const classes = classnames({
|
|
502
|
-
'is-dark-theme': isDark,
|
|
503
|
-
'is-light': !isDark,
|
|
504
|
-
'is-transient': isUploadingMedia,
|
|
505
|
-
'has-parallax': hasParallax,
|
|
506
|
-
'is-repeated': isRepeated,
|
|
507
|
-
'has-custom-content-position': !isContentPositionCenter(contentPosition)
|
|
508
|
-
}, getPositionClassName(contentPosition));
|
|
509
|
-
return createElement(Fragment, null, controls, createElement("div", _extends({}, blockProps, {
|
|
510
|
-
className: classnames(classes, blockProps.className),
|
|
511
|
-
style: { ...style,
|
|
512
|
-
...blockProps.style
|
|
513
|
-
},
|
|
514
|
-
"data-url": url
|
|
515
|
-
}), createElement(ResizableCover, {
|
|
516
|
-
className: "block-library-cover__resize-container",
|
|
517
|
-
onResizeStart: () => {
|
|
518
|
-
setAttributes({
|
|
519
|
-
minHeightUnit: 'px'
|
|
520
|
-
});
|
|
521
|
-
toggleSelection(false);
|
|
522
|
-
},
|
|
523
|
-
onResize: value => {
|
|
524
|
-
setAttributes({
|
|
525
|
-
minHeight: value
|
|
526
|
-
});
|
|
527
|
-
},
|
|
528
|
-
onResizeStop: newMinHeight => {
|
|
529
|
-
toggleSelection(true);
|
|
530
|
-
setAttributes({
|
|
531
|
-
minHeight: newMinHeight
|
|
532
|
-
});
|
|
533
|
-
},
|
|
534
|
-
showHandle: isSelected
|
|
535
|
-
}), createElement("span", {
|
|
536
|
-
"aria-hidden": "true",
|
|
537
|
-
className: classnames('wp-block-cover__background', dimRatioToClass(dimRatio), {
|
|
538
|
-
[overlayColor.class]: overlayColor.class,
|
|
539
|
-
'has-background-dim': dimRatio !== undefined,
|
|
540
|
-
// For backwards compatibility. Former versions of the Cover Block applied
|
|
541
|
-
// `.wp-block-cover__gradient-background` in the presence of
|
|
542
|
-
// media, a gradient and a dim.
|
|
543
|
-
'wp-block-cover__gradient-background': url && gradientValue && dimRatio !== 0,
|
|
544
|
-
'has-background-gradient': gradientValue,
|
|
545
|
-
[gradientClass]: gradientClass
|
|
546
|
-
}),
|
|
547
|
-
style: {
|
|
548
|
-
backgroundImage: gradientValue,
|
|
549
|
-
...bgStyle
|
|
550
|
-
}
|
|
551
|
-
}), url && isImageBackground && isImgElement && createElement("img", {
|
|
552
|
-
ref: isDarkElement,
|
|
553
|
-
className: "wp-block-cover__image-background",
|
|
554
|
-
alt: alt,
|
|
555
|
-
src: url,
|
|
556
|
-
style: mediaStyle
|
|
557
|
-
}), url && isVideoBackground && createElement("video", {
|
|
558
|
-
ref: isDarkElement,
|
|
559
|
-
className: "wp-block-cover__video-background",
|
|
560
|
-
autoPlay: true,
|
|
561
|
-
muted: true,
|
|
562
|
-
loop: true,
|
|
563
|
-
src: url,
|
|
564
|
-
style: mediaStyle
|
|
565
|
-
}), isUploadingMedia && createElement(Spinner, null), createElement(CoverPlaceholder, {
|
|
566
|
-
disableMediaButtons: true,
|
|
567
|
-
onSelectMedia: onSelectMedia,
|
|
568
|
-
onError: onUploadError
|
|
569
|
-
}), createElement("div", innerBlocksProps)));
|
|
570
|
-
}
|
|
571
|
-
|
|
572
|
-
export default compose([withColors({
|
|
573
|
-
overlayColor: 'background-color'
|
|
574
|
-
})])(CoverEdit);
|
|
575
|
-
//# sourceMappingURL=edit.js.map
|