@wordpress/block-library 7.0.1 → 7.1.0-next.e230fbab09.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/README.md +16 -0
- package/build/audio/edit.js +4 -4
- package/build/audio/edit.js.map +1 -1
- package/build/audio/edit.native.js +4 -4
- package/build/audio/edit.native.js.map +1 -1
- package/build/audio/transforms.js +1 -1
- package/build/audio/transforms.js.map +1 -1
- package/build/block/edit.js +3 -9
- package/build/block/edit.js.map +1 -1
- package/build/button/edit.js +3 -2
- package/build/button/edit.js.map +1 -1
- package/build/button/edit.native.js +4 -4
- package/build/button/edit.native.js.map +1 -1
- package/build/buttons/transforms.js +8 -8
- package/build/buttons/transforms.js.map +1 -1
- package/build/categories/edit.js +15 -26
- package/build/categories/edit.js.map +1 -1
- package/build/code/index.js +0 -1
- package/build/code/index.js.map +1 -1
- package/build/columns/columnCalculations.native.js +1 -1
- package/build/columns/columnCalculations.native.js.map +1 -1
- package/build/columns/edit.js +1 -1
- package/build/columns/edit.js.map +1 -1
- package/build/columns/edit.native.js +3 -3
- package/build/columns/edit.native.js.map +1 -1
- package/build/columns/index.js +12 -0
- package/build/columns/index.js.map +1 -1
- package/build/comment-author-avatar/edit.js +17 -4
- package/build/comment-author-avatar/edit.js.map +1 -1
- package/build/comment-template/edit.js +94 -36
- package/build/comment-template/edit.js.map +1 -1
- package/build/comment-template/hooks.js +175 -0
- package/build/comment-template/hooks.js.map +1 -0
- package/build/comment-template/index.js +1 -1
- package/build/comment-template/util.js.map +1 -1
- package/build/comments-pagination-next/index.js +1 -1
- package/build/comments-pagination-numbers/index.js +1 -1
- package/build/comments-query-loop/edit/comments-inspector-controls.js +20 -9
- package/build/comments-query-loop/edit/comments-inspector-controls.js.map +1 -1
- package/build/comments-query-loop/edit.js +1 -19
- package/build/comments-query-loop/edit.js.map +1 -1
- package/build/comments-query-loop/index.js +5 -0
- package/build/comments-query-loop/index.js.map +1 -1
- package/build/cover/controls.native.js +5 -5
- package/build/cover/controls.native.js.map +1 -1
- package/build/cover/deprecated.js +188 -17
- package/build/cover/deprecated.js.map +1 -1
- package/build/cover/edit.js +29 -33
- package/build/cover/edit.js.map +1 -1
- package/build/cover/edit.native.js +15 -13
- package/build/cover/edit.native.js.map +1 -1
- package/build/cover/overlay-color-settings.native.js +7 -6
- package/build/cover/overlay-color-settings.native.js.map +1 -1
- package/build/cover/save.js +1 -1
- package/build/cover/save.js.map +1 -1
- package/build/cover/shared.js +2 -2
- package/build/cover/shared.js.map +1 -1
- package/build/cover/transforms.js +4 -2
- package/build/cover/transforms.js.map +1 -1
- package/build/embed/edit.js +1 -1
- package/build/embed/edit.js.map +1 -1
- package/build/embed/edit.native.js +1 -1
- package/build/embed/edit.native.js.map +1 -1
- package/build/embed/util.js +2 -2
- package/build/embed/util.js.map +1 -1
- package/build/embed/variations.js +1 -1
- package/build/embed/variations.js.map +1 -1
- package/build/file/edit.js +20 -17
- package/build/file/edit.js.map +1 -1
- package/build/file/edit.native.js +1 -1
- package/build/file/edit.native.js.map +1 -1
- package/build/file/save.js +7 -3
- package/build/file/save.js.map +1 -1
- package/build/freeform/edit.js +2 -2
- package/build/freeform/edit.js.map +1 -1
- package/build/gallery/edit.js +1 -1
- package/build/gallery/edit.js.map +1 -1
- package/build/gallery/gallery.native.js +1 -1
- package/build/gallery/gallery.native.js.map +1 -1
- package/build/gallery/v1/edit.js +3 -3
- package/build/gallery/v1/edit.js.map +1 -1
- package/build/gallery/v1/gallery-image.native.js +3 -3
- package/build/gallery/v1/gallery-image.native.js.map +1 -1
- package/build/gallery/v1/gallery.native.js +2 -2
- package/build/gallery/v1/gallery.native.js.map +1 -1
- package/build/group/index.js +4 -37
- package/build/group/index.js.map +1 -1
- package/build/group/transforms.js +45 -0
- package/build/group/transforms.js.map +1 -0
- package/build/heading/edit.js +14 -2
- package/build/heading/edit.js.map +1 -1
- package/build/home-link/edit.js +1 -1
- package/build/home-link/edit.js.map +1 -1
- package/build/image/deprecated.js +89 -5
- package/build/image/deprecated.js.map +1 -1
- package/build/image/edit.js +7 -6
- package/build/image/edit.js.map +1 -1
- package/build/image/edit.native.js +25 -10
- package/build/image/edit.native.js.map +1 -1
- package/build/image/save.js +0 -7
- package/build/image/save.js.map +1 -1
- package/build/image/transforms.js +1 -1
- package/build/image/transforms.js.map +1 -1
- package/build/index.js +3 -4
- package/build/index.js.map +1 -1
- package/build/index.native.js +2 -2
- package/build/index.native.js.map +1 -1
- package/build/latest-posts/edit.js +1 -0
- package/build/latest-posts/edit.js.map +1 -1
- package/build/media-text/edit.js +21 -2
- package/build/media-text/edit.js.map +1 -1
- package/build/media-text/edit.native.js +2 -2
- package/build/media-text/edit.native.js.map +1 -1
- package/build/media-text/media-container.native.js +1 -1
- package/build/media-text/media-container.native.js.map +1 -1
- package/build/missing/edit.native.js +1 -1
- package/build/missing/edit.native.js.map +1 -1
- package/build/more/transforms.js +2 -2
- package/build/more/transforms.js.map +1 -1
- package/build/navigation/edit/index.js +144 -68
- package/build/navigation/edit/index.js.map +1 -1
- package/build/navigation/edit/inner-blocks.js +8 -3
- package/build/navigation/edit/inner-blocks.js.map +1 -1
- package/build/navigation/edit/navigation-menu-selector.js +82 -52
- package/build/navigation/edit/navigation-menu-selector.js.map +1 -1
- package/build/navigation/edit/placeholder/index.js +32 -61
- package/build/navigation/edit/placeholder/index.js.map +1 -1
- package/build/navigation/edit/placeholder/placeholder-preview.js +3 -12
- package/build/navigation/edit/placeholder/placeholder-preview.js.map +1 -1
- package/build/navigation/edit/unsaved-inner-blocks.js +3 -1
- package/build/navigation/edit/unsaved-inner-blocks.js.map +1 -1
- package/build/navigation/edit/use-convert-classic-menu-to-block-menu.js +120 -0
- package/build/navigation/edit/use-convert-classic-menu-to-block-menu.js.map +1 -0
- package/build/navigation/edit/use-create-navigation-menu.js +53 -4
- package/build/navigation/edit/use-create-navigation-menu.js.map +1 -1
- package/build/navigation/edit/use-navigation-notice.js +3 -3
- package/build/navigation/edit/use-navigation-notice.js.map +1 -1
- package/build/navigation/menu-items-to-blocks.js +1 -1
- package/build/navigation/menu-items-to-blocks.js.map +1 -1
- package/build/navigation/use-navigation-entities.js +25 -49
- package/build/navigation/use-navigation-entities.js.map +1 -1
- package/build/navigation/use-navigation-menu.js +8 -6
- package/build/navigation/use-navigation-menu.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 +2 -2
- package/build/navigation-link/hooks.js.map +1 -1
- package/build/navigation-submenu/edit.js +43 -11
- package/build/navigation-submenu/edit.js.map +1 -1
- package/build/page-list/convert-to-links-modal.js +13 -23
- package/build/page-list/convert-to-links-modal.js.map +1 -1
- package/build/page-list/edit.js +19 -39
- package/build/page-list/edit.js.map +1 -1
- package/build/post-author-name/edit.js +2 -1
- package/build/post-author-name/edit.js.map +1 -1
- package/build/post-comments-form/edit.js +3 -1
- package/build/post-comments-form/edit.js.map +1 -1
- package/build/post-excerpt/edit.js +7 -4
- package/build/post-excerpt/edit.js.map +1 -1
- package/build/post-terms/edit.js +3 -1
- package/build/post-terms/edit.js.map +1 -1
- package/build/query-title/edit.js +0 -1
- package/build/query-title/edit.js.map +1 -1
- package/build/search/edit.js +4 -1
- package/build/search/edit.js.map +1 -1
- package/build/search/edit.native.js +1 -1
- package/build/search/edit.native.js.map +1 -1
- package/build/separator/save.js +4 -4
- package/build/separator/save.js.map +1 -1
- package/build/separator/separator-settings.native.js +1 -1
- package/build/separator/separator-settings.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-link/edit.native.js +11 -3
- package/build/social-link/edit.native.js.map +1 -1
- package/build/social-links/deprecated.js +1 -62
- package/build/social-links/deprecated.js.map +1 -1
- package/build/spacer/controls.js +5 -5
- package/build/spacer/controls.js.map +1 -1
- package/build/spacer/controls.native.js +5 -5
- package/build/spacer/controls.native.js.map +1 -1
- package/build/table/edit.js +2 -2
- package/build/table/edit.js.map +1 -1
- package/build/template-part/edit/index.js +36 -64
- package/build/template-part/edit/index.js.map +1 -1
- package/build/template-part/edit/placeholder.js +64 -0
- package/build/template-part/edit/placeholder.js.map +1 -0
- package/build/template-part/edit/selection-modal.js +103 -0
- package/build/template-part/edit/selection-modal.js.map +1 -0
- package/build/template-part/edit/title-modal.js +54 -0
- package/build/template-part/edit/title-modal.js.map +1 -0
- package/build/template-part/edit/utils/hooks.js +156 -0
- package/build/template-part/edit/utils/hooks.js.map +1 -0
- package/build/template-part/index.js +3 -1
- package/build/template-part/index.js.map +1 -1
- package/build/video/edit.js +4 -4
- package/build/video/edit.js.map +1 -1
- package/build/video/edit.native.js +3 -3
- package/build/video/edit.native.js.map +1 -1
- package/build-module/audio/edit.js +4 -4
- package/build-module/audio/edit.js.map +1 -1
- package/build-module/audio/edit.native.js +4 -4
- package/build-module/audio/edit.native.js.map +1 -1
- package/build-module/audio/transforms.js +1 -1
- package/build-module/audio/transforms.js.map +1 -1
- package/build-module/block/edit.js +5 -11
- package/build-module/block/edit.js.map +1 -1
- package/build-module/button/edit.js +3 -2
- package/build-module/button/edit.js.map +1 -1
- package/build-module/button/edit.native.js +6 -6
- package/build-module/button/edit.native.js.map +1 -1
- package/build-module/buttons/transforms.js +8 -8
- package/build-module/buttons/transforms.js.map +1 -1
- package/build-module/categories/edit.js +15 -25
- package/build-module/categories/edit.js.map +1 -1
- package/build-module/code/index.js +0 -1
- package/build-module/code/index.js.map +1 -1
- package/build-module/columns/columnCalculations.native.js +1 -1
- package/build-module/columns/columnCalculations.native.js.map +1 -1
- package/build-module/columns/edit.js +1 -1
- package/build-module/columns/edit.js.map +1 -1
- package/build-module/columns/edit.native.js +3 -3
- package/build-module/columns/edit.native.js.map +1 -1
- package/build-module/columns/index.js +12 -0
- package/build-module/columns/index.js.map +1 -1
- package/build-module/comment-author-avatar/edit.js +18 -6
- package/build-module/comment-author-avatar/edit.js.map +1 -1
- package/build-module/comment-template/edit.js +95 -37
- package/build-module/comment-template/edit.js.map +1 -1
- package/build-module/comment-template/hooks.js +156 -0
- package/build-module/comment-template/hooks.js.map +1 -0
- package/build-module/comment-template/index.js +1 -1
- package/build-module/comment-template/util.js.map +1 -1
- package/build-module/comments-pagination-next/index.js +1 -1
- package/build-module/comments-pagination-numbers/index.js +1 -1
- package/build-module/comments-query-loop/edit/comments-inspector-controls.js +20 -9
- package/build-module/comments-query-loop/edit/comments-inspector-controls.js.map +1 -1
- package/build-module/comments-query-loop/edit.js +2 -19
- package/build-module/comments-query-loop/edit.js.map +1 -1
- package/build-module/comments-query-loop/index.js +5 -0
- package/build-module/comments-query-loop/index.js.map +1 -1
- package/build-module/cover/controls.native.js +5 -5
- package/build-module/cover/controls.native.js.map +1 -1
- package/build-module/cover/deprecated.js +190 -17
- package/build-module/cover/deprecated.js.map +1 -1
- package/build-module/cover/edit.js +31 -35
- package/build-module/cover/edit.js.map +1 -1
- package/build-module/cover/edit.native.js +18 -16
- package/build-module/cover/edit.native.js.map +1 -1
- package/build-module/cover/overlay-color-settings.native.js +7 -7
- package/build-module/cover/overlay-color-settings.native.js.map +1 -1
- package/build-module/cover/save.js +1 -1
- package/build-module/cover/save.js.map +1 -1
- package/build-module/cover/shared.js +2 -2
- package/build-module/cover/shared.js.map +1 -1
- package/build-module/cover/transforms.js +4 -2
- package/build-module/cover/transforms.js.map +1 -1
- package/build-module/embed/edit.js +1 -1
- package/build-module/embed/edit.js.map +1 -1
- package/build-module/embed/edit.native.js +1 -1
- package/build-module/embed/edit.native.js.map +1 -1
- package/build-module/embed/util.js +2 -2
- package/build-module/embed/util.js.map +1 -1
- package/build-module/embed/variations.js +1 -1
- package/build-module/embed/variations.js.map +1 -1
- package/build-module/file/edit.js +21 -18
- package/build-module/file/edit.js.map +1 -1
- package/build-module/file/edit.native.js +1 -1
- package/build-module/file/edit.native.js.map +1 -1
- package/build-module/file/save.js +7 -3
- package/build-module/file/save.js.map +1 -1
- package/build-module/freeform/edit.js +2 -2
- package/build-module/freeform/edit.js.map +1 -1
- package/build-module/gallery/edit.js +1 -1
- package/build-module/gallery/edit.js.map +1 -1
- package/build-module/gallery/gallery.native.js +1 -1
- package/build-module/gallery/gallery.native.js.map +1 -1
- package/build-module/gallery/v1/edit.js +3 -3
- package/build-module/gallery/v1/edit.js.map +1 -1
- package/build-module/gallery/v1/gallery-image.native.js +3 -3
- package/build-module/gallery/v1/gallery-image.native.js.map +1 -1
- package/build-module/gallery/v1/gallery.native.js +2 -2
- package/build-module/gallery/v1/gallery.native.js.map +1 -1
- package/build-module/group/index.js +3 -36
- package/build-module/group/index.js.map +1 -1
- package/build-module/group/transforms.js +36 -0
- package/build-module/group/transforms.js.map +1 -0
- package/build-module/heading/edit.js +15 -3
- package/build-module/heading/edit.js.map +1 -1
- package/build-module/home-link/edit.js +1 -1
- package/build-module/home-link/edit.js.map +1 -1
- package/build-module/image/deprecated.js +90 -7
- package/build-module/image/deprecated.js.map +1 -1
- package/build-module/image/edit.js +7 -6
- package/build-module/image/edit.js.map +1 -1
- package/build-module/image/edit.native.js +25 -10
- package/build-module/image/edit.native.js.map +1 -1
- package/build-module/image/save.js +0 -7
- package/build-module/image/save.js.map +1 -1
- package/build-module/image/transforms.js +1 -1
- package/build-module/image/transforms.js.map +1 -1
- package/build-module/index.js +4 -5
- package/build-module/index.js.map +1 -1
- package/build-module/index.native.js +2 -2
- package/build-module/index.native.js.map +1 -1
- package/build-module/latest-posts/edit.js +1 -0
- package/build-module/latest-posts/edit.js.map +1 -1
- package/build-module/media-text/edit.js +20 -2
- package/build-module/media-text/edit.js.map +1 -1
- package/build-module/media-text/edit.native.js +2 -2
- package/build-module/media-text/edit.native.js.map +1 -1
- package/build-module/media-text/media-container.native.js +1 -1
- package/build-module/media-text/media-container.native.js.map +1 -1
- package/build-module/missing/edit.native.js +1 -1
- package/build-module/missing/edit.native.js.map +1 -1
- package/build-module/more/transforms.js +2 -2
- package/build-module/more/transforms.js.map +1 -1
- package/build-module/navigation/edit/index.js +138 -68
- package/build-module/navigation/edit/index.js.map +1 -1
- package/build-module/navigation/edit/inner-blocks.js +8 -3
- package/build-module/navigation/edit/inner-blocks.js.map +1 -1
- package/build-module/navigation/edit/navigation-menu-selector.js +82 -48
- package/build-module/navigation/edit/navigation-menu-selector.js.map +1 -1
- package/build-module/navigation/edit/placeholder/index.js +33 -59
- package/build-module/navigation/edit/placeholder/index.js.map +1 -1
- package/build-module/navigation/edit/placeholder/placeholder-preview.js +3 -9
- package/build-module/navigation/edit/placeholder/placeholder-preview.js.map +1 -1
- package/build-module/navigation/edit/unsaved-inner-blocks.js +3 -1
- package/build-module/navigation/edit/unsaved-inner-blocks.js.map +1 -1
- package/build-module/navigation/edit/use-convert-classic-menu-to-block-menu.js +100 -0
- package/build-module/navigation/edit/use-convert-classic-menu-to-block-menu.js.map +1 -0
- package/build-module/navigation/edit/use-create-navigation-menu.js +48 -5
- package/build-module/navigation/edit/use-create-navigation-menu.js.map +1 -1
- package/build-module/navigation/edit/use-navigation-notice.js +3 -3
- package/build-module/navigation/edit/use-navigation-notice.js.map +1 -1
- package/build-module/navigation/menu-items-to-blocks.js +1 -1
- package/build-module/navigation/menu-items-to-blocks.js.map +1 -1
- package/build-module/navigation/use-navigation-entities.js +26 -50
- package/build-module/navigation/use-navigation-entities.js.map +1 -1
- package/build-module/navigation/use-navigation-menu.js +8 -6
- package/build-module/navigation/use-navigation-menu.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 +43 -12
- package/build-module/navigation-submenu/edit.js.map +1 -1
- package/build-module/page-list/convert-to-links-modal.js +15 -25
- package/build-module/page-list/convert-to-links-modal.js.map +1 -1
- package/build-module/page-list/edit.js +21 -41
- package/build-module/page-list/edit.js.map +1 -1
- package/build-module/post-author-name/edit.js +2 -1
- package/build-module/post-author-name/edit.js.map +1 -1
- package/build-module/post-comments-form/edit.js +4 -2
- package/build-module/post-comments-form/edit.js.map +1 -1
- package/build-module/post-excerpt/edit.js +9 -6
- package/build-module/post-excerpt/edit.js.map +1 -1
- package/build-module/post-terms/edit.js +2 -1
- package/build-module/post-terms/edit.js.map +1 -1
- package/build-module/query-title/edit.js +0 -1
- package/build-module/query-title/edit.js.map +1 -1
- package/build-module/search/edit.js +3 -1
- package/build-module/search/edit.js.map +1 -1
- package/build-module/search/edit.native.js +1 -1
- package/build-module/search/edit.native.js.map +1 -1
- package/build-module/separator/save.js +4 -4
- package/build-module/separator/save.js.map +1 -1
- package/build-module/separator/separator-settings.native.js +1 -1
- package/build-module/separator/separator-settings.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-link/edit.native.js +11 -3
- package/build-module/social-link/edit.native.js.map +1 -1
- package/build-module/social-links/deprecated.js +1 -62
- package/build-module/social-links/deprecated.js.map +1 -1
- package/build-module/spacer/controls.js +5 -5
- package/build-module/spacer/controls.js.map +1 -1
- package/build-module/spacer/controls.native.js +5 -5
- package/build-module/spacer/controls.native.js.map +1 -1
- package/build-module/table/edit.js +2 -2
- package/build-module/table/edit.js.map +1 -1
- package/build-module/template-part/edit/index.js +37 -65
- package/build-module/template-part/edit/index.js.map +1 -1
- package/build-module/template-part/edit/placeholder.js +52 -0
- package/build-module/template-part/edit/placeholder.js.map +1 -0
- package/build-module/template-part/edit/selection-modal.js +89 -0
- package/build-module/template-part/edit/selection-modal.js.map +1 -0
- package/build-module/template-part/edit/title-modal.js +46 -0
- package/build-module/template-part/edit/title-modal.js.map +1 -0
- package/build-module/template-part/edit/utils/hooks.js +135 -0
- package/build-module/template-part/edit/utils/hooks.js.map +1 -0
- package/build-module/template-part/index.js +2 -1
- package/build-module/template-part/index.js.map +1 -1
- package/build-module/video/edit.js +4 -4
- package/build-module/video/edit.js.map +1 -1
- package/build-module/video/edit.native.js +3 -3
- package/build-module/video/edit.native.js.map +1 -1
- package/build-style/button/editor-rtl.css +0 -3
- package/build-style/button/editor.css +0 -3
- package/build-style/code/style-rtl.css +2 -1
- package/build-style/code/style.css +2 -1
- package/build-style/code/theme-rtl.css +0 -3
- package/build-style/code/theme.css +0 -3
- package/build-style/comment-author-avatar/editor-rtl.css +83 -0
- package/build-style/comment-author-avatar/editor.css +83 -0
- package/build-style/common-rtl.css +1 -1
- package/build-style/common.css +1 -1
- package/build-style/cover/style-rtl.css +5 -5
- package/build-style/cover/style.css +5 -5
- package/build-style/editor-rtl.css +43 -84
- package/build-style/editor.css +43 -84
- package/build-style/image/editor-rtl.css +0 -16
- package/build-style/image/editor.css +0 -16
- package/build-style/image/style-rtl.css +4 -1
- package/build-style/image/style.css +4 -1
- package/build-style/navigation/editor-rtl.css +16 -0
- package/build-style/navigation/editor.css +16 -0
- package/build-style/navigation/style-rtl.css +14 -3
- package/build-style/navigation/style.css +14 -3
- package/build-style/page-list/editor-rtl.css +0 -9
- package/build-style/page-list/editor.css +0 -9
- package/build-style/style-rtl.css +32 -13
- package/build-style/style.css +32 -13
- package/build-style/tag-cloud/style-rtl.css +6 -2
- package/build-style/tag-cloud/style.css +6 -2
- package/build-style/template-part/editor-rtl.css +19 -56
- package/build-style/template-part/editor.css +19 -56
- package/build-style/theme-rtl.css +0 -3
- package/build-style/theme.css +0 -3
- package/package.json +32 -28
- package/src/archives/index.php +1 -1
- package/src/audio/edit.js +4 -4
- package/src/audio/edit.native.js +4 -4
- package/src/audio/transforms.js +1 -1
- package/src/block/edit.js +7 -22
- package/src/block/test/edit.native.js +9 -9
- package/src/button/edit.js +2 -1
- package/src/button/edit.native.js +5 -5
- package/src/button/editor.scss +0 -5
- package/src/buttons/test/edit.native.js +3 -3
- package/src/buttons/transforms.js +8 -8
- package/src/categories/edit.js +12 -22
- package/src/code/block.json +0 -1
- package/src/code/style.scss +4 -2
- package/src/code/theme.scss +0 -3
- package/src/columns/block.json +12 -0
- package/src/columns/columnCalculations.native.js +1 -1
- package/src/columns/edit.js +1 -1
- package/src/columns/edit.native.js +3 -3
- package/src/comment-author-avatar/edit.js +13 -8
- package/src/comment-author-avatar/editor.scss +7 -0
- package/src/comment-template/block.json +7 -1
- package/src/comment-template/edit.js +102 -40
- package/src/comment-template/hooks.js +151 -0
- package/src/comment-template/index.php +8 -0
- package/src/comment-template/util.js +1 -0
- package/src/comments-pagination-next/block.json +8 -1
- package/src/comments-pagination-next/index.php +6 -8
- package/src/comments-pagination-numbers/block.json +7 -1
- package/src/comments-pagination-numbers/index.php +3 -10
- package/src/comments-query-loop/block.json +5 -0
- package/src/comments-query-loop/edit/comments-inspector-controls.js +22 -4
- package/src/comments-query-loop/edit.js +1 -16
- package/src/common.scss +1 -1
- package/src/cover/controls.native.js +1 -1
- package/src/cover/deprecated.js +214 -1
- package/src/cover/edit.js +21 -36
- package/src/cover/edit.native.js +23 -15
- package/src/cover/overlay-color-settings.native.js +6 -7
- package/src/cover/save.js +4 -3
- package/src/cover/shared.js +2 -2
- package/src/cover/style.scss +5 -3
- package/src/cover/test/edit.native.js +39 -39
- package/src/cover/transforms.js +2 -0
- package/src/editor.scss +1 -0
- package/src/embed/edit.js +1 -1
- package/src/embed/edit.native.js +1 -1
- package/src/embed/test/index.native.js +105 -105
- package/src/embed/util.js +2 -2
- package/src/embed/variations.js +1 -1
- package/src/file/edit.js +19 -17
- package/src/file/edit.native.js +1 -1
- package/src/file/save.js +9 -3
- package/src/file/style.native.scss +1 -0
- package/src/freeform/edit.js +2 -2
- package/src/gallery/edit.js +1 -1
- package/src/gallery/gallery.native.js +1 -1
- package/src/gallery/index.php +1 -8
- package/src/gallery/test/__snapshots__/index.native.js.snap +164 -0
- package/src/gallery/test/helpers.native.js +293 -0
- package/src/gallery/test/index.native.js +583 -65
- package/src/gallery/v1/edit.js +3 -4
- package/src/gallery/v1/gallery-image.native.js +3 -3
- package/src/gallery/v1/gallery.native.js +2 -2
- package/src/group/block.json +1 -0
- package/src/group/index.js +2 -54
- package/src/group/transforms.js +52 -0
- package/src/heading/edit.js +18 -5
- package/src/home-link/edit.js +1 -1
- package/src/home-link/index.php +1 -19
- package/src/image/deprecated.js +105 -1
- package/src/image/edit.js +7 -6
- package/src/image/edit.native.js +25 -8
- package/src/image/editor.scss +0 -18
- package/src/image/save.js +0 -8
- package/src/image/style.scss +5 -1
- package/src/image/test/edit.native.js +1 -11
- package/src/image/transforms.js +1 -1
- package/src/index.js +2 -3
- package/src/index.native.js +2 -2
- package/src/latest-posts/edit.js +1 -0
- package/src/latest-posts/index.php +1 -1
- package/src/media-text/edit.js +20 -2
- package/src/media-text/edit.native.js +2 -2
- package/src/media-text/media-container.native.js +1 -1
- package/src/media-text/style.native.scss +1 -0
- package/src/missing/edit.native.js +1 -1
- package/src/missing/test/edit-integration.native.js +4 -4
- package/src/missing/test/edit.native.js +2 -2
- package/src/more/transforms.js +2 -2
- package/src/navigation/edit/index.js +212 -88
- package/src/navigation/edit/inner-blocks.js +11 -4
- package/src/navigation/edit/navigation-menu-selector.js +121 -58
- package/src/navigation/edit/placeholder/index.js +64 -111
- package/src/navigation/edit/placeholder/placeholder-preview.js +3 -10
- package/src/navigation/edit/unsaved-inner-blocks.js +3 -1
- package/src/navigation/edit/use-convert-classic-menu-to-block-menu.js +137 -0
- package/src/navigation/edit/use-create-navigation-menu.js +59 -8
- package/src/navigation/edit/use-navigation-notice.js +3 -3
- package/src/navigation/editor.scss +23 -1
- package/src/navigation/index.php +4 -4
- package/src/navigation/menu-items-to-blocks.js +1 -1
- package/src/navigation/style.scss +22 -3
- package/src/navigation/test/menu-items-to-blocks.js +1 -1
- package/src/navigation/use-navigation-entities.js +26 -60
- package/src/navigation/use-navigation-menu.js +11 -6
- package/src/navigation-link/fallback-variations.js +1 -1
- package/src/navigation-link/hooks.js +2 -2
- package/src/navigation-link/index.php +3 -22
- package/src/navigation-link/test/edit.js +5 -5
- package/src/navigation-submenu/edit.js +52 -14
- package/src/navigation-submenu/index.php +3 -21
- package/src/page-list/convert-to-links-modal.js +17 -31
- package/src/page-list/edit.js +35 -48
- package/src/page-list/editor.scss +0 -10
- package/src/page-list/index.php +4 -4
- package/src/post-author-name/edit.js +1 -0
- package/src/post-author-name/index.php +1 -1
- package/src/post-comments-form/edit.js +7 -3
- package/src/post-excerpt/edit.js +9 -12
- package/src/post-navigation-link/index.php +3 -3
- package/src/post-terms/edit.js +2 -1
- package/src/query-title/edit.js +0 -1
- package/src/search/edit.js +6 -0
- package/src/search/edit.native.js +1 -1
- package/src/search/index.php +8 -4
- package/src/search/test/edit.native.js +0 -1
- package/src/separator/save.js +4 -4
- package/src/separator/separator-settings.native.js +1 -1
- package/src/site-logo/edit.js +1 -1
- package/src/site-logo/index.php +1 -1
- package/src/social-link/edit.native.js +17 -8
- package/src/social-link/test/index.native.js +138 -0
- package/src/social-links/deprecated.js +0 -59
- package/src/spacer/controls.js +1 -1
- package/src/spacer/controls.native.js +1 -1
- package/src/table/edit.js +2 -2
- package/src/tag-cloud/style.scss +12 -7
- package/src/template-part/edit/index.js +61 -71
- package/src/template-part/edit/placeholder.js +78 -0
- package/src/template-part/edit/selection-modal.js +115 -0
- package/src/template-part/edit/title-modal.js +59 -0
- package/src/template-part/edit/utils/hooks.js +158 -0
- package/src/template-part/editor.scss +16 -74
- package/src/template-part/index.js +4 -1
- package/src/video/edit.js +4 -4
- package/src/video/edit.native.js +3 -3
- package/src/video/style.native.scss +1 -0
- package/build/navigation/edit/existing-menus-options.js +0 -62
- package/build/navigation/edit/existing-menus-options.js.map +0 -1
- package/build/navigation/use-convert-classic-menu.js +0 -59
- package/build/navigation/use-convert-classic-menu.js.map +0 -1
- package/build/template-part/edit/placeholder/index.js +0 -141
- package/build/template-part/edit/placeholder/index.js.map +0 -1
- package/build/template-part/edit/placeholder/patterns-setup.js +0 -100
- package/build/template-part/edit/placeholder/patterns-setup.js.map +0 -1
- package/build/template-part/edit/selection/index.js +0 -45
- package/build/template-part/edit/selection/index.js.map +0 -1
- package/build/template-part/edit/selection/template-part-previews.js +0 -317
- package/build/template-part/edit/selection/template-part-previews.js.map +0 -1
- package/build-module/navigation/edit/existing-menus-options.js +0 -53
- package/build-module/navigation/edit/existing-menus-options.js.map +0 -1
- package/build-module/navigation/use-convert-classic-menu.js +0 -47
- package/build-module/navigation/use-convert-classic-menu.js.map +0 -1
- package/build-module/template-part/edit/placeholder/index.js +0 -124
- package/build-module/template-part/edit/placeholder/index.js.map +0 -1
- package/build-module/template-part/edit/placeholder/patterns-setup.js +0 -91
- package/build-module/template-part/edit/placeholder/patterns-setup.js.map +0 -1
- package/build-module/template-part/edit/selection/index.js +0 -35
- package/build-module/template-part/edit/selection/index.js.map +0 -1
- package/build-module/template-part/edit/selection/template-part-previews.js +0 -298
- package/build-module/template-part/edit/selection/template-part-previews.js.map +0 -1
- package/src/navigation/edit/existing-menus-options.js +0 -70
- package/src/navigation/use-convert-classic-menu.js +0 -58
- package/src/template-part/edit/placeholder/index.js +0 -172
- package/src/template-part/edit/placeholder/patterns-setup.js +0 -124
- package/src/template-part/edit/selection/index.js +0 -37
- package/src/template-part/edit/selection/template-part-previews.js +0 -372
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WordPress dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { useState, useEffect, useMemo } from '@wordpress/element';
|
|
5
|
+
import { useSelect } from '@wordpress/data';
|
|
6
|
+
import { store as blockEditorStore } from '@wordpress/block-editor';
|
|
7
|
+
import { addQueryArgs } from '@wordpress/url';
|
|
8
|
+
import apiFetch from '@wordpress/api-fetch';
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Return an object with the query args needed to fetch the default page of
|
|
12
|
+
* comments.
|
|
13
|
+
*
|
|
14
|
+
* @param {Object} props Hook props.
|
|
15
|
+
* @param {number} props.postId ID of the post that contains the comments.
|
|
16
|
+
* @param {number} props.perPage The number of comments included per page.
|
|
17
|
+
* @param {string} props.defaultPage Page shown by default (newest/oldest).
|
|
18
|
+
* @param {boolean} props.inherit Overwrite props with values from WP
|
|
19
|
+
* discussion settings.
|
|
20
|
+
*
|
|
21
|
+
* @return {Object} Query args to retrieve the comments.
|
|
22
|
+
*/
|
|
23
|
+
export const useCommentQueryArgs = ( {
|
|
24
|
+
postId,
|
|
25
|
+
perPage,
|
|
26
|
+
defaultPage,
|
|
27
|
+
inherit,
|
|
28
|
+
} ) => {
|
|
29
|
+
// Initialize the query args that are not going to change.
|
|
30
|
+
const queryArgs = {
|
|
31
|
+
status: 'approve',
|
|
32
|
+
order: 'asc',
|
|
33
|
+
context: 'embed',
|
|
34
|
+
parent: 0,
|
|
35
|
+
_embed: 'children',
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
// Get the Discussion settings that may be needed to query the comments.
|
|
39
|
+
const { commentsPerPage, defaultCommentsPage } = useSelect( ( select ) => {
|
|
40
|
+
const { getSettings } = select( blockEditorStore );
|
|
41
|
+
const { __experimentalDiscussionSettings } = getSettings();
|
|
42
|
+
return __experimentalDiscussionSettings;
|
|
43
|
+
} );
|
|
44
|
+
|
|
45
|
+
// Overwrite the received attributes if `inherit` is true.
|
|
46
|
+
if ( inherit ) {
|
|
47
|
+
perPage = commentsPerPage;
|
|
48
|
+
defaultPage = defaultCommentsPage;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
// If a block props is not set, use the settings value to generate the
|
|
52
|
+
// appropriate query arg.
|
|
53
|
+
perPage = perPage || commentsPerPage;
|
|
54
|
+
defaultPage = defaultPage || defaultCommentsPage;
|
|
55
|
+
|
|
56
|
+
// Get the number of the default page.
|
|
57
|
+
const page = useDefaultPageIndex( {
|
|
58
|
+
defaultPage,
|
|
59
|
+
postId,
|
|
60
|
+
perPage,
|
|
61
|
+
queryArgs,
|
|
62
|
+
} );
|
|
63
|
+
|
|
64
|
+
// Merge, memoize and return all query arguments, unless the default page's
|
|
65
|
+
// number is not known yet.
|
|
66
|
+
return useMemo( () => {
|
|
67
|
+
return page
|
|
68
|
+
? {
|
|
69
|
+
...queryArgs,
|
|
70
|
+
post: postId,
|
|
71
|
+
per_page: perPage,
|
|
72
|
+
page,
|
|
73
|
+
}
|
|
74
|
+
: null;
|
|
75
|
+
}, [ postId, perPage, page ] );
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* Return the index of the default page, depending on whether `defaultPage` is
|
|
80
|
+
* `newest` or `oldest`. In the first case, the only way to know the page's
|
|
81
|
+
* index is by using the `X-WP-TotalPages` header, which forces to make an
|
|
82
|
+
* additional request.
|
|
83
|
+
*
|
|
84
|
+
* @param {Object} props Hook props.
|
|
85
|
+
* @param {string} props.defaultPage Page shown by default (newest/oldest).
|
|
86
|
+
* @param {number} props.postId ID of the post that contains the comments.
|
|
87
|
+
* @param {number} props.perPage The number of comments included per page.
|
|
88
|
+
* @param {Object} props.queryArgs Other query args.
|
|
89
|
+
*
|
|
90
|
+
* @return {number} Index of the default comments page.
|
|
91
|
+
*/
|
|
92
|
+
const useDefaultPageIndex = ( { defaultPage, postId, perPage, queryArgs } ) => {
|
|
93
|
+
// Store the default page indices.
|
|
94
|
+
const [ defaultPages, setDefaultPages ] = useState( {} );
|
|
95
|
+
const key = `${ postId }_${ perPage }`;
|
|
96
|
+
const page = defaultPages[ key ] || 0;
|
|
97
|
+
|
|
98
|
+
useEffect( () => {
|
|
99
|
+
// Do nothing if the page is already known or not the newest page.
|
|
100
|
+
if ( page || defaultPage !== 'newest' ) {
|
|
101
|
+
return;
|
|
102
|
+
}
|
|
103
|
+
// We need to fetch comments to know the index. Use HEAD and limit
|
|
104
|
+
// fields just to ID, to make this call as light as possible.
|
|
105
|
+
apiFetch( {
|
|
106
|
+
path: addQueryArgs( '/wp/v2/comments', {
|
|
107
|
+
...queryArgs,
|
|
108
|
+
post: postId,
|
|
109
|
+
per_page: perPage,
|
|
110
|
+
_fields: 'id',
|
|
111
|
+
} ),
|
|
112
|
+
method: 'HEAD',
|
|
113
|
+
parse: false,
|
|
114
|
+
} ).then( ( res ) => {
|
|
115
|
+
setDefaultPages( {
|
|
116
|
+
...defaultPages,
|
|
117
|
+
[ key ]: parseInt( res.headers.get( 'X-WP-TotalPages' ) ),
|
|
118
|
+
} );
|
|
119
|
+
} );
|
|
120
|
+
}, [ defaultPage, postId, perPage, setDefaultPages ] );
|
|
121
|
+
|
|
122
|
+
// The oldest one is always the first one.
|
|
123
|
+
return defaultPage === 'newest' ? page : 1;
|
|
124
|
+
};
|
|
125
|
+
|
|
126
|
+
/**
|
|
127
|
+
* Generate a tree structure of comment IDs from a list of comment entities. The
|
|
128
|
+
* children of each comment are obtained from `_embedded`.
|
|
129
|
+
*
|
|
130
|
+
* @typedef {{ commentId: number, children: CommentNode }} CommentNode
|
|
131
|
+
*
|
|
132
|
+
* @param {Object[]} topLevelComments List of comment entities.
|
|
133
|
+
* @return {{ commentTree: CommentNode[]}} Tree of comment IDs.
|
|
134
|
+
*/
|
|
135
|
+
export const useCommentTree = ( topLevelComments ) => {
|
|
136
|
+
const commentTree = useMemo(
|
|
137
|
+
() =>
|
|
138
|
+
topLevelComments?.map( ( { id, _embedded } ) => {
|
|
139
|
+
const [ children ] = _embedded?.children || [ [] ];
|
|
140
|
+
return {
|
|
141
|
+
commentId: id,
|
|
142
|
+
children: children.map( ( child ) => ( {
|
|
143
|
+
commentId: child.id,
|
|
144
|
+
} ) ),
|
|
145
|
+
};
|
|
146
|
+
} ),
|
|
147
|
+
[ topLevelComments ]
|
|
148
|
+
);
|
|
149
|
+
|
|
150
|
+
return commentTree;
|
|
151
|
+
};
|
|
@@ -68,6 +68,14 @@ function render_block_core_comment_template( $attributes, $content, $block ) {
|
|
|
68
68
|
return '';
|
|
69
69
|
}
|
|
70
70
|
|
|
71
|
+
$comment_order = empty( $block->context['comments/inherit'] ) && ! empty( $block->context['comments/order'] )
|
|
72
|
+
? $block->context['comments/order']
|
|
73
|
+
: get_option( 'comment_order' );
|
|
74
|
+
|
|
75
|
+
if ( 'desc' === $comment_order ) {
|
|
76
|
+
$comments = array_reverse( $comments );
|
|
77
|
+
}
|
|
78
|
+
|
|
71
79
|
$wrapper_attributes = get_block_wrapper_attributes();
|
|
72
80
|
|
|
73
81
|
return sprintf(
|
|
@@ -12,7 +12,14 @@
|
|
|
12
12
|
"type": "string"
|
|
13
13
|
}
|
|
14
14
|
},
|
|
15
|
-
"usesContext": [
|
|
15
|
+
"usesContext": [
|
|
16
|
+
"postId",
|
|
17
|
+
"comments/perPage",
|
|
18
|
+
"comments/order",
|
|
19
|
+
"comments/inherit",
|
|
20
|
+
"comments/defaultPage",
|
|
21
|
+
"comments/paginationArrow"
|
|
22
|
+
],
|
|
16
23
|
"supports": {
|
|
17
24
|
"reusable": false,
|
|
18
25
|
"html": false,
|
|
@@ -15,15 +15,13 @@
|
|
|
15
15
|
* @return string Returns the next comments link for the query pagination.
|
|
16
16
|
*/
|
|
17
17
|
function render_block_core_comments_pagination_next( $attributes, $content, $block ) {
|
|
18
|
-
|
|
19
|
-
if (
|
|
20
|
-
|
|
21
|
-
if ( 0 === $per_page ) {
|
|
22
|
-
$per_page = (int) get_option( 'comments_per_page' );
|
|
23
|
-
}
|
|
18
|
+
// Bail out early if the post ID is not set for some reason.
|
|
19
|
+
if ( empty( $block->context['postId'] ) ) {
|
|
20
|
+
return '';
|
|
24
21
|
}
|
|
25
|
-
|
|
26
|
-
$
|
|
22
|
+
|
|
23
|
+
$comment_vars = build_comment_query_vars_from_block( $block );
|
|
24
|
+
$max_page = ( new WP_Comment_Query( $comment_vars ) )->max_num_pages;
|
|
27
25
|
$default_label = __( 'Newer Comments' );
|
|
28
26
|
$label = isset( $attributes['label'] ) && ! empty( $attributes['label'] ) ? $attributes['label'] : $default_label;
|
|
29
27
|
$pagination_arrow = get_comments_pagination_arrow( $block, 'next' );
|
|
@@ -7,7 +7,13 @@
|
|
|
7
7
|
"parent": [ "core/comments-pagination" ],
|
|
8
8
|
"description": "Displays a list of page numbers for comments pagination.",
|
|
9
9
|
"textdomain": "default",
|
|
10
|
-
"usesContext": [
|
|
10
|
+
"usesContext": [
|
|
11
|
+
"postId",
|
|
12
|
+
"comments/perPage",
|
|
13
|
+
"comments/order",
|
|
14
|
+
"comments/inherit",
|
|
15
|
+
"comments/defaultPage"
|
|
16
|
+
],
|
|
11
17
|
"supports": {
|
|
12
18
|
"reusable": false,
|
|
13
19
|
"html": false
|
|
@@ -20,17 +20,10 @@ function render_block_core_comments_pagination_numbers( $attributes, $content, $
|
|
|
20
20
|
return '';
|
|
21
21
|
}
|
|
22
22
|
|
|
23
|
-
$
|
|
24
|
-
build_comment_query_vars_from_block( $block )
|
|
25
|
-
);
|
|
26
|
-
$total = $comments_query->max_num_pages;
|
|
23
|
+
$comment_vars = build_comment_query_vars_from_block( $block );
|
|
27
24
|
|
|
28
|
-
|
|
29
|
-
$current =
|
|
30
|
-
if ( ! $current ) {
|
|
31
|
-
// Get the number of the default page.
|
|
32
|
-
$current = 'newest' === get_option( 'default_comments_page' ) ? $total : 1;
|
|
33
|
-
}
|
|
25
|
+
$total = ( new WP_Comment_Query( $comment_vars ) )->max_num_pages;
|
|
26
|
+
$current = ! empty( $comment_vars['paged'] ) ? $comment_vars['paged'] : null;
|
|
34
27
|
|
|
35
28
|
// Render links.
|
|
36
29
|
$content = paginate_comments_links(
|
|
@@ -22,11 +22,16 @@
|
|
|
22
22
|
"tagName": {
|
|
23
23
|
"type": "string",
|
|
24
24
|
"default": "div"
|
|
25
|
+
},
|
|
26
|
+
"defaultPage": {
|
|
27
|
+
"type": "string",
|
|
28
|
+
"default": "oldest"
|
|
25
29
|
}
|
|
26
30
|
},
|
|
27
31
|
"providesContext": {
|
|
28
32
|
"comments/perPage": "perPage",
|
|
29
33
|
"comments/order": "order",
|
|
34
|
+
"comments/defaultPage": "defaultPage",
|
|
30
35
|
"comments/inherit": "inherit"
|
|
31
36
|
},
|
|
32
37
|
"supports": {
|
|
@@ -21,10 +21,20 @@ const orderOptions = [
|
|
|
21
21
|
},
|
|
22
22
|
];
|
|
23
23
|
|
|
24
|
+
const defaultPageOptions = [
|
|
25
|
+
{
|
|
26
|
+
label: __( 'Newest' ),
|
|
27
|
+
value: 'newest',
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
label: __( 'Oldest' ),
|
|
31
|
+
value: 'oldest',
|
|
32
|
+
},
|
|
33
|
+
];
|
|
34
|
+
|
|
24
35
|
export default function CommentsInspectorControls( {
|
|
25
|
-
attributes: { TagName, perPage, order, inherit },
|
|
36
|
+
attributes: { TagName, perPage, order, inherit, defaultPage },
|
|
26
37
|
setAttributes,
|
|
27
|
-
defaultSettings: { defaultPerPage, defaultOrder },
|
|
28
38
|
} ) {
|
|
29
39
|
return (
|
|
30
40
|
<InspectorControls>
|
|
@@ -35,8 +45,6 @@ export default function CommentsInspectorControls( {
|
|
|
35
45
|
onChange={ () => {
|
|
36
46
|
setAttributes( {
|
|
37
47
|
inherit: ! inherit,
|
|
38
|
-
order: inherit ? defaultOrder : null,
|
|
39
|
-
perPage: inherit ? defaultPerPage : null,
|
|
40
48
|
} );
|
|
41
49
|
} }
|
|
42
50
|
/>
|
|
@@ -52,6 +60,16 @@ export default function CommentsInspectorControls( {
|
|
|
52
60
|
} );
|
|
53
61
|
} }
|
|
54
62
|
/>
|
|
63
|
+
<SelectControl
|
|
64
|
+
label={ __( 'Default page' ) }
|
|
65
|
+
value={ defaultPage }
|
|
66
|
+
options={ defaultPageOptions }
|
|
67
|
+
onChange={ ( value ) => {
|
|
68
|
+
setAttributes( {
|
|
69
|
+
defaultPage: value,
|
|
70
|
+
} );
|
|
71
|
+
} }
|
|
72
|
+
/>
|
|
55
73
|
<NumberControl
|
|
56
74
|
__unstableInputWidth="60px"
|
|
57
75
|
label={ __( 'Items per Page' ) }
|
|
@@ -1,17 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* WordPress dependencies
|
|
3
3
|
*/
|
|
4
|
-
import {
|
|
5
|
-
useBlockProps,
|
|
6
|
-
useInnerBlocksProps,
|
|
7
|
-
store as blockEditorStore,
|
|
8
|
-
} from '@wordpress/block-editor';
|
|
4
|
+
import { useBlockProps, useInnerBlocksProps } from '@wordpress/block-editor';
|
|
9
5
|
|
|
10
6
|
/**
|
|
11
7
|
* Internal dependencies
|
|
12
8
|
*/
|
|
13
9
|
import CommentsInspectorControls from './edit/comments-inspector-controls';
|
|
14
|
-
import { useSelect } from '@wordpress/data';
|
|
15
10
|
|
|
16
11
|
const TEMPLATE = [
|
|
17
12
|
[ 'core/comment-template' ],
|
|
@@ -26,21 +21,11 @@ export default function CommentsQueryLoopEdit( { attributes, setAttributes } ) {
|
|
|
26
21
|
template: TEMPLATE,
|
|
27
22
|
} );
|
|
28
23
|
|
|
29
|
-
const { commentOrder, commentsPerPage } = useSelect( ( select ) => {
|
|
30
|
-
const { getSettings } = select( blockEditorStore );
|
|
31
|
-
const { __experimentalDiscussionSettings } = getSettings();
|
|
32
|
-
return __experimentalDiscussionSettings;
|
|
33
|
-
} );
|
|
34
|
-
|
|
35
24
|
return (
|
|
36
25
|
<>
|
|
37
26
|
<CommentsInspectorControls
|
|
38
27
|
attributes={ attributes }
|
|
39
28
|
setAttributes={ setAttributes }
|
|
40
|
-
defaultSettings={ {
|
|
41
|
-
defaultOrder: commentOrder,
|
|
42
|
-
defaultPerPage: commentsPerPage,
|
|
43
|
-
} }
|
|
44
29
|
/>
|
|
45
30
|
<TagName { ...innerBlocksProps } />
|
|
46
31
|
</>
|
package/src/common.scss
CHANGED
package/src/cover/deprecated.js
CHANGED
|
@@ -81,6 +81,219 @@ const blockAttributes = {
|
|
|
81
81
|
},
|
|
82
82
|
};
|
|
83
83
|
|
|
84
|
+
// Deprecation for blocks with `minHeightUnit` set but no `minHeight`.
|
|
85
|
+
const v9 = {
|
|
86
|
+
attributes: {
|
|
87
|
+
url: {
|
|
88
|
+
type: 'string',
|
|
89
|
+
},
|
|
90
|
+
id: {
|
|
91
|
+
type: 'number',
|
|
92
|
+
},
|
|
93
|
+
alt: {
|
|
94
|
+
type: 'string',
|
|
95
|
+
source: 'attribute',
|
|
96
|
+
selector: 'img',
|
|
97
|
+
attribute: 'alt',
|
|
98
|
+
default: '',
|
|
99
|
+
},
|
|
100
|
+
hasParallax: {
|
|
101
|
+
type: 'boolean',
|
|
102
|
+
default: false,
|
|
103
|
+
},
|
|
104
|
+
isRepeated: {
|
|
105
|
+
type: 'boolean',
|
|
106
|
+
default: false,
|
|
107
|
+
},
|
|
108
|
+
dimRatio: {
|
|
109
|
+
type: 'number',
|
|
110
|
+
default: 100,
|
|
111
|
+
},
|
|
112
|
+
overlayColor: {
|
|
113
|
+
type: 'string',
|
|
114
|
+
},
|
|
115
|
+
customOverlayColor: {
|
|
116
|
+
type: 'string',
|
|
117
|
+
},
|
|
118
|
+
backgroundType: {
|
|
119
|
+
type: 'string',
|
|
120
|
+
default: 'image',
|
|
121
|
+
},
|
|
122
|
+
focalPoint: {
|
|
123
|
+
type: 'object',
|
|
124
|
+
},
|
|
125
|
+
minHeight: {
|
|
126
|
+
type: 'number',
|
|
127
|
+
},
|
|
128
|
+
minHeightUnit: {
|
|
129
|
+
type: 'string',
|
|
130
|
+
},
|
|
131
|
+
gradient: {
|
|
132
|
+
type: 'string',
|
|
133
|
+
},
|
|
134
|
+
customGradient: {
|
|
135
|
+
type: 'string',
|
|
136
|
+
},
|
|
137
|
+
contentPosition: {
|
|
138
|
+
type: 'string',
|
|
139
|
+
},
|
|
140
|
+
isDark: {
|
|
141
|
+
type: 'boolean',
|
|
142
|
+
default: true,
|
|
143
|
+
},
|
|
144
|
+
allowedBlocks: {
|
|
145
|
+
type: 'array',
|
|
146
|
+
},
|
|
147
|
+
templateLock: {
|
|
148
|
+
type: [ 'string', 'boolean' ],
|
|
149
|
+
enum: [ 'all', 'insert', false ],
|
|
150
|
+
},
|
|
151
|
+
},
|
|
152
|
+
supports: {
|
|
153
|
+
anchor: true,
|
|
154
|
+
align: true,
|
|
155
|
+
html: false,
|
|
156
|
+
spacing: {
|
|
157
|
+
padding: true,
|
|
158
|
+
__experimentalDefaultControls: {
|
|
159
|
+
padding: true,
|
|
160
|
+
},
|
|
161
|
+
},
|
|
162
|
+
color: {
|
|
163
|
+
__experimentalDuotone:
|
|
164
|
+
'> .wp-block-cover__image-background, > .wp-block-cover__video-background',
|
|
165
|
+
text: false,
|
|
166
|
+
background: false,
|
|
167
|
+
},
|
|
168
|
+
},
|
|
169
|
+
save( { attributes } ) {
|
|
170
|
+
const {
|
|
171
|
+
backgroundType,
|
|
172
|
+
gradient,
|
|
173
|
+
contentPosition,
|
|
174
|
+
customGradient,
|
|
175
|
+
customOverlayColor,
|
|
176
|
+
dimRatio,
|
|
177
|
+
focalPoint,
|
|
178
|
+
hasParallax,
|
|
179
|
+
isDark,
|
|
180
|
+
isRepeated,
|
|
181
|
+
overlayColor,
|
|
182
|
+
url,
|
|
183
|
+
alt,
|
|
184
|
+
id,
|
|
185
|
+
minHeight: minHeightProp,
|
|
186
|
+
minHeightUnit,
|
|
187
|
+
} = attributes;
|
|
188
|
+
const overlayColorClass = getColorClassName(
|
|
189
|
+
'background-color',
|
|
190
|
+
overlayColor
|
|
191
|
+
);
|
|
192
|
+
const gradientClass = __experimentalGetGradientClass( gradient );
|
|
193
|
+
const minHeight = minHeightUnit
|
|
194
|
+
? `${ minHeightProp }${ minHeightUnit }`
|
|
195
|
+
: minHeightProp;
|
|
196
|
+
|
|
197
|
+
const isImageBackground = IMAGE_BACKGROUND_TYPE === backgroundType;
|
|
198
|
+
const isVideoBackground = VIDEO_BACKGROUND_TYPE === backgroundType;
|
|
199
|
+
|
|
200
|
+
const isImgElement = ! ( hasParallax || isRepeated );
|
|
201
|
+
|
|
202
|
+
const style = {
|
|
203
|
+
...( isImageBackground && ! isImgElement
|
|
204
|
+
? backgroundImageStyles( url )
|
|
205
|
+
: {} ),
|
|
206
|
+
minHeight: minHeight || undefined,
|
|
207
|
+
};
|
|
208
|
+
|
|
209
|
+
const bgStyle = {
|
|
210
|
+
backgroundColor: ! overlayColorClass
|
|
211
|
+
? customOverlayColor
|
|
212
|
+
: undefined,
|
|
213
|
+
background: customGradient ? customGradient : undefined,
|
|
214
|
+
};
|
|
215
|
+
|
|
216
|
+
const objectPosition =
|
|
217
|
+
// prettier-ignore
|
|
218
|
+
focalPoint && isImgElement
|
|
219
|
+
? `${ Math.round( focalPoint.x * 100 ) }% ${ Math.round( focalPoint.y * 100 ) }%`
|
|
220
|
+
: undefined;
|
|
221
|
+
|
|
222
|
+
const classes = classnames(
|
|
223
|
+
{
|
|
224
|
+
'is-light': ! isDark,
|
|
225
|
+
'has-parallax': hasParallax,
|
|
226
|
+
'is-repeated': isRepeated,
|
|
227
|
+
'has-custom-content-position': ! isContentPositionCenter(
|
|
228
|
+
contentPosition
|
|
229
|
+
),
|
|
230
|
+
},
|
|
231
|
+
getPositionClassName( contentPosition )
|
|
232
|
+
);
|
|
233
|
+
|
|
234
|
+
const gradientValue = gradient || customGradient;
|
|
235
|
+
|
|
236
|
+
return (
|
|
237
|
+
<div { ...useBlockProps.save( { className: classes, style } ) }>
|
|
238
|
+
<span
|
|
239
|
+
aria-hidden="true"
|
|
240
|
+
className={ classnames(
|
|
241
|
+
'wp-block-cover__background',
|
|
242
|
+
overlayColorClass,
|
|
243
|
+
dimRatioToClass( dimRatio ),
|
|
244
|
+
{
|
|
245
|
+
'has-background-dim': dimRatio !== undefined,
|
|
246
|
+
// For backwards compatibility. Former versions of the Cover Block applied
|
|
247
|
+
// `.wp-block-cover__gradient-background` in the presence of
|
|
248
|
+
// media, a gradient and a dim.
|
|
249
|
+
'wp-block-cover__gradient-background':
|
|
250
|
+
url && gradientValue && dimRatio !== 0,
|
|
251
|
+
'has-background-gradient': gradientValue,
|
|
252
|
+
[ gradientClass ]: gradientClass,
|
|
253
|
+
}
|
|
254
|
+
) }
|
|
255
|
+
style={ bgStyle }
|
|
256
|
+
/>
|
|
257
|
+
|
|
258
|
+
{ isImageBackground && isImgElement && url && (
|
|
259
|
+
<img
|
|
260
|
+
className={ classnames(
|
|
261
|
+
'wp-block-cover__image-background',
|
|
262
|
+
id ? `wp-image-${ id }` : null
|
|
263
|
+
) }
|
|
264
|
+
alt={ alt }
|
|
265
|
+
src={ url }
|
|
266
|
+
style={ { objectPosition } }
|
|
267
|
+
data-object-fit="cover"
|
|
268
|
+
data-object-position={ objectPosition }
|
|
269
|
+
/>
|
|
270
|
+
) }
|
|
271
|
+
{ isVideoBackground && url && (
|
|
272
|
+
<video
|
|
273
|
+
className={ classnames(
|
|
274
|
+
'wp-block-cover__video-background',
|
|
275
|
+
'intrinsic-ignore'
|
|
276
|
+
) }
|
|
277
|
+
autoPlay
|
|
278
|
+
muted
|
|
279
|
+
loop
|
|
280
|
+
playsInline
|
|
281
|
+
src={ url }
|
|
282
|
+
style={ { objectPosition } }
|
|
283
|
+
data-object-fit="cover"
|
|
284
|
+
data-object-position={ objectPosition }
|
|
285
|
+
/>
|
|
286
|
+
) }
|
|
287
|
+
<div
|
|
288
|
+
{ ...useInnerBlocksProps.save( {
|
|
289
|
+
className: 'wp-block-cover__inner-container',
|
|
290
|
+
} ) }
|
|
291
|
+
/>
|
|
292
|
+
</div>
|
|
293
|
+
);
|
|
294
|
+
},
|
|
295
|
+
};
|
|
296
|
+
|
|
84
297
|
// v8: deprecated to remove duplicated gradient classes and swap `wp-block-cover__gradient-background` for `wp-block-cover__background`.
|
|
85
298
|
const v8 = {
|
|
86
299
|
attributes: {
|
|
@@ -1018,4 +1231,4 @@ const v1 = {
|
|
|
1018
1231
|
},
|
|
1019
1232
|
};
|
|
1020
1233
|
|
|
1021
|
-
export default [ v8, v7, v6, v5, v4, v3, v2, v1 ];
|
|
1234
|
+
export default [ v9, v8, v7, v6, v5, v4, v3, v2, v1 ];
|