@wordpress/block-library 7.2.0 → 7.3.2
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 +2 -0
- package/README.md +1 -1
- package/build/archives/edit.js +21 -1
- package/build/archives/edit.js.map +1 -1
- package/build/archives/index.js +5 -1
- package/build/archives/index.js.map +1 -1
- package/build/audio/edit.js +1 -1
- package/build/audio/edit.js.map +1 -1
- package/build/audio/edit.native.js +0 -5
- package/build/audio/edit.native.js.map +1 -1
- package/build/avatar/edit.js +17 -11
- package/build/avatar/edit.js.map +1 -1
- package/build/block/edit.js +2 -1
- package/build/block/edit.js.map +1 -1
- package/build/column/index.js +1 -0
- package/build/column/index.js.map +1 -1
- package/build/comment-author-avatar/index.js +3 -3
- package/build/comment-author-name/index.js +7 -3
- package/build/comment-author-name/index.js.map +1 -1
- package/build/comment-content/index.js +1 -1
- package/build/comment-date/index.js +7 -3
- package/build/comment-date/index.js.map +1 -1
- package/build/comment-edit-link/index.js +5 -1
- package/build/comment-edit-link/index.js.map +1 -1
- package/build/comment-reply-link/index.js +5 -1
- package/build/comment-reply-link/index.js.map +1 -1
- package/build/comment-template/edit.js +10 -15
- package/build/comment-template/edit.js.map +1 -1
- package/build/comment-template/hooks.js +10 -24
- package/build/comment-template/hooks.js.map +1 -1
- package/build/comment-template/index.js +2 -2
- package/build/comments-pagination-next/index.js +2 -2
- package/build/comments-pagination-numbers/index.js +1 -1
- package/build/comments-pagination-previous/index.js +1 -1
- package/build/comments-query-loop/edit/comments-inspector-controls.js +2 -69
- package/build/comments-query-loop/edit/comments-inspector-controls.js.map +1 -1
- package/build/comments-query-loop/edit.js +22 -1
- package/build/comments-query-loop/edit.js.map +1 -1
- package/build/comments-query-loop/index.js +1 -23
- package/build/comments-query-loop/index.js.map +1 -1
- package/build/cover/edit.js +35 -6
- package/build/cover/edit.js.map +1 -1
- package/build/cover/index.js +5 -0
- package/build/cover/index.js.map +1 -1
- package/build/cover/save.js +3 -2
- package/build/cover/save.js.map +1 -1
- package/build/cover/transforms.js +33 -32
- package/build/cover/transforms.js.map +1 -1
- package/build/gallery/gap-styles.js +8 -2
- package/build/gallery/gap-styles.js.map +1 -1
- package/build/gallery/index.js +1 -0
- package/build/gallery/index.js.map +1 -1
- package/build/group/edit.js +3 -1
- package/build/group/edit.js.map +1 -1
- package/build/group/index.js +2 -4
- package/build/group/index.js.map +1 -1
- package/build/group/variations.js +31 -9
- package/build/group/variations.js.map +1 -1
- package/build/heading/edit.js +1 -1
- package/build/heading/edit.js.map +1 -1
- package/build/html/edit.js +3 -2
- package/build/html/edit.js.map +1 -1
- package/build/image/edit.native.js +8 -10
- package/build/image/edit.native.js.map +1 -1
- package/build/index.js +4 -4
- package/build/index.js.map +1 -1
- package/build/list/deprecated.js +2 -2
- package/build/list/deprecated.js.map +1 -1
- package/build/list/index.js +13 -2
- package/build/list/index.js.map +1 -1
- package/build/list/v2/deprecated.js +117 -0
- package/build/list/v2/deprecated.js.map +1 -0
- package/build/list/v2/edit.js +106 -3
- package/build/list/v2/edit.js.map +1 -1
- package/build/list/v2/index.js +4 -1
- package/build/list/v2/index.js.map +1 -1
- package/build/list/v2/migrate.js +85 -0
- package/build/list/v2/migrate.js.map +1 -0
- package/build/list-item/edit.js +59 -10
- package/build/list-item/edit.js.map +1 -1
- package/build/list-item/hooks/index.js +32 -0
- package/build/list-item/hooks/index.js.map +1 -0
- package/build/list-item/hooks/use-enter.js +93 -0
- package/build/list-item/hooks/use-enter.js.map +1 -0
- package/build/list-item/hooks/use-indent-list-item.js +74 -0
- package/build/list-item/hooks/use-indent-list-item.js.map +1 -0
- package/build/list-item/hooks/use-outdent-list-item.js +77 -0
- package/build/list-item/hooks/use-outdent-list-item.js.map +1 -0
- package/build/list-item/index.js +1 -1
- package/build/list-item/index.js.map +1 -1
- package/build/list-item/utils.js +16 -0
- package/build/list-item/utils.js.map +1 -0
- package/build/media-text/media-container.native.js +1 -16
- package/build/media-text/media-container.native.js.map +1 -1
- package/build/navigation/edit/index.js +36 -17
- package/build/navigation/edit/index.js.map +1 -1
- package/build/navigation/edit/navigation-menu-delete-control.js +1 -1
- package/build/navigation/edit/navigation-menu-delete-control.js.map +1 -1
- package/build/navigation/edit/unsaved-inner-blocks.js +34 -7
- package/build/navigation/edit/unsaved-inner-blocks.js.map +1 -1
- package/build/navigation/index.js +9 -1
- package/build/navigation/index.js.map +1 -1
- package/build/navigation/use-navigation-menu.js +1 -0
- package/build/navigation/use-navigation-menu.js.map +1 -1
- package/build/navigation-link/edit.js +9 -5
- package/build/navigation-link/edit.js.map +1 -1
- package/build/navigation-link/index.js +1 -1
- package/build/navigation-submenu/edit.js +5 -9
- package/build/navigation-submenu/edit.js.map +1 -1
- package/build/navigation-submenu/index.js +1 -1
- package/build/post-comment/edit.js +2 -2
- package/build/post-comment/edit.js.map +1 -1
- package/build/post-comments/index.js +4 -3
- package/build/post-comments/index.js.map +1 -1
- package/build/post-comments-form/edit.js +3 -2
- package/build/post-comments-form/edit.js.map +1 -1
- package/build/post-featured-image/edit.js +19 -7
- package/build/post-featured-image/edit.js.map +1 -1
- package/build/post-featured-image/index.js +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 +3 -1
- package/build/post-terms/edit.js.map +1 -1
- package/build/post-terms/variations.js +1 -1
- package/build/post-terms/variations.js.map +1 -1
- package/build/query/edit/index.js +84 -22
- package/build/query/edit/index.js.map +1 -1
- package/build/query/edit/query-placeholder.js +7 -14
- package/build/query/edit/query-placeholder.js.map +1 -1
- package/build/query/edit/query-toolbar.js +6 -1
- package/build/query/edit/query-toolbar.js.map +1 -1
- package/build/query-pagination/edit.js +1 -1
- package/build/query-pagination/edit.js.map +1 -1
- package/build/query-pagination-numbers/index.js +19 -1
- package/build/query-pagination-numbers/index.js.map +1 -1
- package/build/quote/index.js +20 -2
- package/build/quote/index.js.map +1 -1
- package/build/quote/v2/deprecated.js +133 -0
- package/build/quote/v2/deprecated.js.map +1 -0
- package/build/quote/v2/edit.js +131 -0
- package/build/quote/v2/edit.js.map +1 -0
- package/build/quote/v2/index.js +49 -0
- package/build/quote/v2/index.js.map +1 -0
- package/build/quote/v2/save.js +43 -0
- package/build/quote/v2/save.js.map +1 -0
- package/build/quote/v2/transforms.js +156 -0
- package/build/quote/v2/transforms.js.map +1 -0
- package/build/read-more/index.js +1 -1
- package/build/rss/edit.js +6 -1
- package/build/rss/edit.js.map +1 -1
- package/build/site-logo/edit.js +3 -2
- package/build/site-logo/edit.js.map +1 -1
- package/build/site-logo/index.js +1 -1
- package/build/social-links/index.js +1 -0
- package/build/social-links/index.js.map +1 -1
- package/build/spacer/controls.native.js +1 -1
- package/build/spacer/controls.native.js.map +1 -1
- package/build/template-part/edit/utils/hooks.js +5 -2
- package/build/template-part/edit/utils/hooks.js.map +1 -1
- package/build-module/archives/edit.js +22 -2
- package/build-module/archives/edit.js.map +1 -1
- package/build-module/archives/index.js +5 -1
- package/build-module/archives/index.js.map +1 -1
- package/build-module/audio/edit.js +1 -1
- package/build-module/audio/edit.js.map +1 -1
- package/build-module/audio/edit.native.js +0 -5
- package/build-module/audio/edit.native.js.map +1 -1
- package/build-module/avatar/edit.js +16 -11
- package/build-module/avatar/edit.js.map +1 -1
- package/build-module/block/edit.js +4 -3
- package/build-module/block/edit.js.map +1 -1
- package/build-module/column/index.js +1 -0
- package/build-module/column/index.js.map +1 -1
- package/build-module/comment-author-avatar/index.js +3 -3
- package/build-module/comment-author-name/index.js +7 -3
- package/build-module/comment-author-name/index.js.map +1 -1
- package/build-module/comment-content/index.js +1 -1
- package/build-module/comment-date/index.js +7 -3
- package/build-module/comment-date/index.js.map +1 -1
- package/build-module/comment-edit-link/index.js +5 -1
- package/build-module/comment-edit-link/index.js.map +1 -1
- package/build-module/comment-reply-link/index.js +5 -1
- package/build-module/comment-reply-link/index.js.map +1 -1
- package/build-module/comment-template/edit.js +10 -15
- package/build-module/comment-template/edit.js.map +1 -1
- package/build-module/comment-template/hooks.js +10 -24
- package/build-module/comment-template/hooks.js.map +1 -1
- package/build-module/comment-template/index.js +2 -2
- package/build-module/comments-pagination-next/index.js +2 -2
- package/build-module/comments-pagination-numbers/index.js +1 -1
- package/build-module/comments-pagination-previous/index.js +1 -1
- package/build-module/comments-query-loop/edit/comments-inspector-controls.js +4 -70
- package/build-module/comments-query-loop/edit/comments-inspector-controls.js.map +1 -1
- package/build-module/comments-query-loop/edit.js +22 -1
- package/build-module/comments-query-loop/edit.js.map +1 -1
- package/build-module/comments-query-loop/index.js +1 -23
- package/build-module/comments-query-loop/index.js.map +1 -1
- package/build-module/cover/edit.js +36 -8
- package/build-module/cover/edit.js.map +1 -1
- package/build-module/cover/index.js +5 -0
- package/build-module/cover/index.js.map +1 -1
- package/build-module/cover/save.js +3 -2
- package/build-module/cover/save.js.map +1 -1
- package/build-module/cover/transforms.js +33 -32
- package/build-module/cover/transforms.js.map +1 -1
- package/build-module/gallery/gap-styles.js +8 -2
- package/build-module/gallery/gap-styles.js.map +1 -1
- package/build-module/gallery/index.js +1 -0
- package/build-module/gallery/index.js.map +1 -1
- package/build-module/group/edit.js +3 -1
- package/build-module/group/edit.js.map +1 -1
- package/build-module/group/index.js +2 -4
- package/build-module/group/index.js.map +1 -1
- package/build-module/group/variations.js +30 -9
- package/build-module/group/variations.js.map +1 -1
- package/build-module/heading/edit.js +1 -1
- package/build-module/heading/edit.js.map +1 -1
- package/build-module/html/edit.js +4 -3
- package/build-module/html/edit.js.map +1 -1
- package/build-module/image/edit.native.js +8 -10
- package/build-module/image/edit.native.js.map +1 -1
- package/build-module/index.js +4 -4
- package/build-module/index.js.map +1 -1
- package/build-module/list/deprecated.js +2 -2
- package/build-module/list/deprecated.js.map +1 -1
- package/build-module/list/index.js +9 -3
- package/build-module/list/index.js.map +1 -1
- package/build-module/list/v2/deprecated.js +104 -0
- package/build-module/list/v2/deprecated.js.map +1 -0
- package/build-module/list/v2/edit.js +104 -5
- package/build-module/list/v2/edit.js.map +1 -1
- package/build-module/list/v2/index.js +3 -1
- package/build-module/list/v2/index.js.map +1 -1
- package/build-module/list/v2/migrate.js +77 -0
- package/build-module/list/v2/migrate.js.map +1 -0
- package/build-module/list-item/edit.js +59 -13
- package/build-module/list-item/edit.js.map +1 -1
- package/build-module/list-item/hooks/index.js +4 -0
- package/build-module/list-item/hooks/index.js.map +1 -0
- package/build-module/list-item/hooks/use-enter.js +77 -0
- package/build-module/list-item/hooks/use-enter.js.map +1 -0
- package/build-module/list-item/hooks/use-indent-list-item.js +62 -0
- package/build-module/list-item/hooks/use-indent-list-item.js.map +1 -0
- package/build-module/list-item/hooks/use-outdent-list-item.js +66 -0
- package/build-module/list-item/hooks/use-outdent-list-item.js.map +1 -0
- package/build-module/list-item/index.js +1 -1
- package/build-module/list-item/index.js.map +1 -1
- package/build-module/list-item/utils.js +8 -0
- package/build-module/list-item/utils.js.map +1 -0
- package/build-module/media-text/media-container.native.js +1 -14
- package/build-module/media-text/media-container.native.js.map +1 -1
- package/build-module/navigation/edit/index.js +37 -17
- package/build-module/navigation/edit/index.js.map +1 -1
- package/build-module/navigation/edit/navigation-menu-delete-control.js +1 -1
- package/build-module/navigation/edit/navigation-menu-delete-control.js.map +1 -1
- package/build-module/navigation/edit/unsaved-inner-blocks.js +35 -8
- package/build-module/navigation/edit/unsaved-inner-blocks.js.map +1 -1
- package/build-module/navigation/index.js +9 -1
- package/build-module/navigation/index.js.map +1 -1
- package/build-module/navigation/use-navigation-menu.js +1 -0
- package/build-module/navigation/use-navigation-menu.js.map +1 -1
- package/build-module/navigation-link/edit.js +9 -5
- package/build-module/navigation-link/edit.js.map +1 -1
- package/build-module/navigation-link/index.js +1 -1
- package/build-module/navigation-submenu/edit.js +6 -10
- package/build-module/navigation-submenu/edit.js.map +1 -1
- package/build-module/navigation-submenu/index.js +1 -1
- package/build-module/post-comment/edit.js +2 -2
- package/build-module/post-comment/edit.js.map +1 -1
- package/build-module/post-comments/index.js +4 -3
- package/build-module/post-comments/index.js.map +1 -1
- package/build-module/post-comments-form/edit.js +3 -2
- package/build-module/post-comments-form/edit.js.map +1 -1
- package/build-module/post-featured-image/edit.js +19 -7
- package/build-module/post-featured-image/edit.js.map +1 -1
- package/build-module/post-featured-image/index.js +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 +4 -2
- package/build-module/post-terms/edit.js.map +1 -1
- package/build-module/post-terms/variations.js +3 -3
- package/build-module/post-terms/variations.js.map +1 -1
- package/build-module/query/edit/index.js +87 -26
- package/build-module/query/edit/index.js.map +1 -1
- package/build-module/query/edit/query-placeholder.js +8 -15
- package/build-module/query/edit/query-placeholder.js.map +1 -1
- package/build-module/query/edit/query-toolbar.js +6 -1
- package/build-module/query/edit/query-toolbar.js.map +1 -1
- package/build-module/query-pagination/edit.js +1 -1
- package/build-module/query-pagination/edit.js.map +1 -1
- package/build-module/query-pagination-numbers/index.js +19 -1
- package/build-module/query-pagination-numbers/index.js.map +1 -1
- package/build-module/quote/index.js +19 -1
- package/build-module/quote/index.js.map +1 -1
- package/build-module/quote/v2/deprecated.js +116 -0
- package/build-module/quote/v2/deprecated.js.map +1 -0
- package/build-module/quote/v2/edit.js +115 -0
- package/build-module/quote/v2/edit.js.map +1 -0
- package/build-module/quote/v2/index.js +33 -0
- package/build-module/quote/v2/index.js.map +1 -0
- package/build-module/quote/v2/save.js +30 -0
- package/build-module/quote/v2/save.js.map +1 -0
- package/build-module/quote/v2/transforms.js +147 -0
- package/build-module/quote/v2/transforms.js.map +1 -0
- package/build-module/read-more/index.js +1 -1
- package/build-module/rss/edit.js +5 -1
- package/build-module/rss/edit.js.map +1 -1
- package/build-module/site-logo/edit.js +3 -2
- package/build-module/site-logo/edit.js.map +1 -1
- package/build-module/site-logo/index.js +1 -1
- package/build-module/social-links/index.js +1 -0
- package/build-module/social-links/index.js.map +1 -1
- package/build-module/spacer/controls.native.js +1 -1
- package/build-module/spacer/controls.native.js.map +1 -1
- package/build-module/template-part/edit/utils/hooks.js +5 -2
- package/build-module/template-part/edit/utils/hooks.js.map +1 -1
- package/build-style/avatar/editor-rtl.css +4 -0
- package/build-style/avatar/editor.css +4 -0
- package/build-style/avatar/style-rtl.css +79 -0
- package/build-style/avatar/style.css +79 -0
- package/build-style/editor-rtl.css +69 -9
- package/build-style/editor.css +69 -9
- package/build-style/group/editor-rtl.css +26 -0
- package/build-style/group/editor.css +26 -0
- package/build-style/heading/style-rtl.css +0 -8
- package/build-style/heading/style.css +0 -8
- package/build-style/list/style-rtl.css +1 -1
- package/build-style/list/style.css +1 -1
- package/build-style/navigation/style-rtl.css +11 -9
- package/build-style/navigation/style.css +11 -9
- package/build-style/navigation-link/style-rtl.css +3 -0
- package/build-style/navigation-link/style.css +3 -0
- package/build-style/paragraph/style-rtl.css +0 -4
- package/build-style/paragraph/style.css +0 -4
- package/build-style/query/editor-rtl.css +39 -0
- package/build-style/query/editor.css +39 -0
- package/build-style/quote/style-rtl.css +1 -0
- package/build-style/quote/style.css +1 -0
- package/build-style/reset-rtl.css +1 -1
- package/build-style/reset.css +1 -1
- package/build-style/style-rtl.css +20 -22
- package/build-style/style.css +20 -22
- package/build-style/template-part/editor-rtl.css +0 -9
- package/build-style/template-part/editor.css +0 -9
- package/package.json +28 -28
- package/src/archives/block.json +5 -1
- package/src/archives/edit.js +20 -2
- package/src/archives/index.php +4 -4
- package/src/audio/edit.js +1 -1
- package/src/audio/edit.native.js +0 -5
- package/src/avatar/edit.js +21 -13
- package/src/avatar/editor.scss +6 -0
- package/src/avatar/index.php +2 -2
- package/src/avatar/style.scss +5 -0
- package/src/block/edit.js +21 -11
- package/src/column/block.json +1 -0
- package/src/comment-author-avatar/block.json +3 -3
- package/src/comment-author-name/block.json +7 -3
- package/src/comment-author-name/index.php +3 -0
- package/src/comment-content/block.json +1 -1
- package/src/comment-date/block.json +7 -3
- package/src/comment-date/index.php +6 -1
- package/src/comment-edit-link/block.json +5 -1
- package/src/comment-edit-link/index.php +3 -0
- package/src/comment-reply-link/block.json +5 -1
- package/src/comment-reply-link/index.php +4 -1
- package/src/comment-template/block.json +2 -8
- package/src/comment-template/edit.js +17 -22
- package/src/comment-template/hooks.js +10 -25
- package/src/comment-template/index.php +15 -5
- package/src/comments-pagination-next/block.json +2 -9
- package/src/comments-pagination-numbers/block.json +2 -8
- package/src/comments-pagination-previous/block.json +2 -2
- package/src/comments-query-loop/block.json +1 -23
- package/src/comments-query-loop/edit/comments-inspector-controls.js +2 -83
- package/src/comments-query-loop/edit.js +54 -1
- package/src/cover/block.json +5 -0
- package/src/cover/edit.js +77 -29
- package/src/cover/index.php +85 -0
- package/src/cover/save.js +18 -14
- package/src/cover/transforms.js +51 -28
- package/src/gallery/block.json +1 -0
- package/src/gallery/gap-styles.js +9 -4
- package/src/gallery/index.php +7 -6
- package/src/group/block.json +2 -4
- package/src/group/edit.js +4 -1
- package/src/group/editor.scss +31 -0
- package/src/group/variations.js +21 -4
- package/src/heading/edit.js +1 -1
- package/src/heading/style.scss +0 -3
- package/src/html/edit.js +22 -30
- package/src/image/edit.native.js +7 -11
- package/src/index.js +19 -16
- package/src/list/deprecated.js +2 -2
- package/src/list/index.js +7 -3
- package/src/list/style.scss +1 -2
- package/src/list/test/migrate.js +159 -0
- package/src/list/v2/deprecated.js +89 -0
- package/src/list/v2/edit.js +110 -1
- package/src/list/v2/index.js +2 -0
- package/src/list/v2/migrate.js +87 -0
- package/src/list-item/edit.js +69 -23
- package/src/list-item/hooks/index.js +3 -0
- package/src/list-item/hooks/use-enter.js +94 -0
- package/src/list-item/hooks/use-indent-list-item.js +89 -0
- package/src/list-item/hooks/use-outdent-list-item.js +95 -0
- package/src/list-item/index.js +1 -1
- package/src/list-item/utils.js +14 -0
- package/src/media-text/media-container.native.js +1 -14
- package/src/navigation/block.json +9 -1
- package/src/navigation/edit/index.js +50 -14
- package/src/navigation/edit/navigation-menu-delete-control.js +1 -1
- package/src/navigation/edit/unsaved-inner-blocks.js +57 -8
- package/src/navigation/index.php +6 -1
- package/src/navigation/style.scss +15 -13
- package/src/navigation/use-navigation-menu.js +4 -0
- package/src/navigation-link/block.json +1 -0
- package/src/navigation-link/edit.js +43 -35
- package/src/navigation-link/index.php +8 -0
- package/src/navigation-link/style.scss +6 -0
- package/src/navigation-submenu/block.json +1 -0
- package/src/navigation-submenu/edit.js +7 -9
- package/src/paragraph/style.scss +0 -5
- package/src/post-author/index.php +0 -1
- package/src/post-comment/edit.js +2 -2
- package/src/post-comments/block.json +4 -3
- package/src/post-comments-form/edit.js +6 -3
- package/src/post-comments-form/index.php +12 -4
- package/src/post-featured-image/block.json +1 -1
- package/src/post-featured-image/edit.js +24 -12
- package/src/post-template/edit.js +7 -1
- package/src/post-terms/edit.js +4 -1
- package/src/post-terms/variations.js +3 -3
- package/src/query/edit/index.js +125 -26
- package/src/query/edit/query-placeholder.js +3 -13
- package/src/query/edit/query-toolbar.js +6 -0
- package/src/query/editor.scss +38 -0
- package/src/query-pagination/edit.js +1 -1
- package/src/query-pagination/index.php +9 -2
- package/src/query-pagination-numbers/block.json +19 -1
- package/src/quote/block.json +8 -0
- package/src/quote/index.js +10 -1
- package/src/quote/style.scss +1 -0
- package/src/quote/v2/deprecated.js +107 -0
- package/src/quote/v2/edit.js +136 -0
- package/src/quote/v2/index.js +36 -0
- package/src/quote/v2/save.js +26 -0
- package/src/quote/v2/test/migrate.js +92 -0
- package/src/quote/v2/transforms.js +155 -0
- package/src/read-more/block.json +1 -1
- package/src/reset.scss +1 -1
- package/src/rss/edit.js +3 -1
- package/src/rss/index.php +14 -1
- package/src/site-logo/block.json +1 -1
- package/src/site-logo/edit.js +2 -1
- package/src/site-logo/index.php +0 -4
- package/src/social-link/index.php +1 -2
- package/src/social-links/block.json +1 -0
- package/src/spacer/controls.native.js +1 -1
- package/src/spacer/test/__snapshots__/index.native.js.snap +31 -0
- package/src/spacer/test/index.native.js +180 -0
- package/src/style.scss +1 -0
- package/src/template-part/edit/utils/hooks.js +6 -1
- package/src/template-part/editor.scss +0 -10
- package/build/navigation/edit/use-list-view-modal.js +0 -73
- package/build/navigation/edit/use-list-view-modal.js.map +0 -1
- package/build-module/navigation/edit/use-list-view-modal.js +0 -63
- package/build-module/navigation/edit/use-list-view-modal.js.map +0 -1
- package/src/navigation/edit/use-list-view-modal.js +0 -72
package/src/block/edit.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* WordPress dependencies
|
|
3
3
|
*/
|
|
4
|
-
import { useDispatch } from '@wordpress/data';
|
|
4
|
+
import { useDispatch, useSelect } from '@wordpress/data';
|
|
5
5
|
import {
|
|
6
6
|
useEntityBlockEditor,
|
|
7
7
|
useEntityProp,
|
|
@@ -25,6 +25,7 @@ import {
|
|
|
25
25
|
InspectorControls,
|
|
26
26
|
useBlockProps,
|
|
27
27
|
Warning,
|
|
28
|
+
store as blockEditorStore,
|
|
28
29
|
} from '@wordpress/block-editor';
|
|
29
30
|
import { store as reusableBlocksStore } from '@wordpress/reusable-blocks';
|
|
30
31
|
import { ungroup } from '@wordpress/icons';
|
|
@@ -40,6 +41,11 @@ export default function ReusableBlockEdit( { attributes: { ref }, clientId } ) {
|
|
|
40
41
|
);
|
|
41
42
|
const isMissing = hasResolved && ! record;
|
|
42
43
|
|
|
44
|
+
const canRemove = useSelect(
|
|
45
|
+
( select ) => select( blockEditorStore ).canRemoveBlock( clientId ),
|
|
46
|
+
[ clientId ]
|
|
47
|
+
);
|
|
48
|
+
|
|
43
49
|
const {
|
|
44
50
|
__experimentalConvertBlockToStatic: convertBlockToStatic,
|
|
45
51
|
} = useDispatch( reusableBlocksStore );
|
|
@@ -103,16 +109,20 @@ export default function ReusableBlockEdit( { attributes: { ref }, clientId } ) {
|
|
|
103
109
|
return (
|
|
104
110
|
<RecursionProvider>
|
|
105
111
|
<div { ...blockProps }>
|
|
106
|
-
|
|
107
|
-
<
|
|
108
|
-
<
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
112
|
+
{ canRemove && (
|
|
113
|
+
<BlockControls>
|
|
114
|
+
<ToolbarGroup>
|
|
115
|
+
<ToolbarButton
|
|
116
|
+
onClick={ () =>
|
|
117
|
+
convertBlockToStatic( clientId )
|
|
118
|
+
}
|
|
119
|
+
label={ __( 'Convert to regular blocks' ) }
|
|
120
|
+
icon={ ungroup }
|
|
121
|
+
showTooltip
|
|
122
|
+
/>
|
|
123
|
+
</ToolbarGroup>
|
|
124
|
+
</BlockControls>
|
|
125
|
+
) }
|
|
116
126
|
<InspectorControls>
|
|
117
127
|
<PanelBody>
|
|
118
128
|
<TextControl
|
package/src/column/block.json
CHANGED
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
"$schema": "https://schemas.wp.org/trunk/block.json",
|
|
3
3
|
"apiVersion": 2,
|
|
4
4
|
"name": "core/comment-author-avatar",
|
|
5
|
-
"title": "Comment Author Avatar",
|
|
5
|
+
"title": "Comment Author Avatar (deprecated)",
|
|
6
6
|
"category": "theme",
|
|
7
|
-
"
|
|
8
|
-
"description": "
|
|
7
|
+
"ancestor": [ "core/comment-template" ],
|
|
8
|
+
"description": "This block is deprecated. Please use the Avatar block instead.",
|
|
9
9
|
"textdomain": "default",
|
|
10
10
|
"attributes": {
|
|
11
11
|
"width": {
|
|
@@ -4,13 +4,13 @@
|
|
|
4
4
|
"name": "core/comment-author-name",
|
|
5
5
|
"title": "Comment Author Name",
|
|
6
6
|
"category": "theme",
|
|
7
|
-
"
|
|
8
|
-
"description": "
|
|
7
|
+
"ancestor": [ "core/comment-template" ],
|
|
8
|
+
"description": "Displays the name of the author of the comment.",
|
|
9
9
|
"textdomain": "default",
|
|
10
10
|
"attributes": {
|
|
11
11
|
"isLink": {
|
|
12
12
|
"type": "boolean",
|
|
13
|
-
"default":
|
|
13
|
+
"default": true
|
|
14
14
|
},
|
|
15
15
|
"linkTarget": {
|
|
16
16
|
"type": "string",
|
|
@@ -18,6 +18,10 @@
|
|
|
18
18
|
},
|
|
19
19
|
"textAlign": {
|
|
20
20
|
"type": "string"
|
|
21
|
+
},
|
|
22
|
+
"fontSize": {
|
|
23
|
+
"type": "string",
|
|
24
|
+
"default": "small"
|
|
21
25
|
}
|
|
22
26
|
},
|
|
23
27
|
"usesContext": [ "commentId" ],
|
|
@@ -27,6 +27,9 @@ function render_block_core_comment_author_name( $attributes, $content, $block )
|
|
|
27
27
|
if ( isset( $attributes['textAlign'] ) ) {
|
|
28
28
|
$classes .= 'has-text-align-' . esc_attr( $attributes['textAlign'] );
|
|
29
29
|
}
|
|
30
|
+
if ( isset( $attributes['fontSize'] ) ) {
|
|
31
|
+
$classes .= 'has-' . esc_attr( $attributes['fontSize'] ) . '-font-size';
|
|
32
|
+
}
|
|
30
33
|
|
|
31
34
|
$wrapper_attributes = get_block_wrapper_attributes( array( 'class' => $classes ) );
|
|
32
35
|
$comment_author = get_comment_author( $comment );
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"name": "core/comment-content",
|
|
5
5
|
"title": "Comment Content",
|
|
6
6
|
"category": "theme",
|
|
7
|
-
"
|
|
7
|
+
"ancestor": [ "core/comment-template" ],
|
|
8
8
|
"description": "Displays the contents of a comment.",
|
|
9
9
|
"textdomain": "default",
|
|
10
10
|
"usesContext": [ "commentId" ],
|
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
"name": "core/comment-date",
|
|
5
5
|
"title": "Comment Date",
|
|
6
6
|
"category": "theme",
|
|
7
|
-
"
|
|
8
|
-
"description": "
|
|
7
|
+
"ancestor": [ "core/comment-template" ],
|
|
8
|
+
"description": "Displays the date on which the comment was posted.",
|
|
9
9
|
"textdomain": "default",
|
|
10
10
|
"attributes": {
|
|
11
11
|
"format": {
|
|
@@ -13,7 +13,11 @@
|
|
|
13
13
|
},
|
|
14
14
|
"isLink": {
|
|
15
15
|
"type": "boolean",
|
|
16
|
-
"default":
|
|
16
|
+
"default": true
|
|
17
|
+
},
|
|
18
|
+
"fontSize": {
|
|
19
|
+
"type": "string",
|
|
20
|
+
"default": "small"
|
|
17
21
|
}
|
|
18
22
|
},
|
|
19
23
|
"usesContext": [ "commentId" ],
|
|
@@ -23,7 +23,12 @@ function render_block_core_comment_date( $attributes, $content, $block ) {
|
|
|
23
23
|
return '';
|
|
24
24
|
}
|
|
25
25
|
|
|
26
|
-
$
|
|
26
|
+
$classes = '';
|
|
27
|
+
if ( isset( $attributes['fontSize'] ) ) {
|
|
28
|
+
$classes .= 'has-' . esc_attr( $attributes['fontSize'] ) . '-font-size';
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
$wrapper_attributes = get_block_wrapper_attributes( array( 'class' => $classes ) );
|
|
27
32
|
$formatted_date = get_comment_date(
|
|
28
33
|
isset( $attributes['format'] ) ? $attributes['format'] : '',
|
|
29
34
|
$comment
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"name": "core/comment-edit-link",
|
|
5
5
|
"title": "Comment Edit Link",
|
|
6
6
|
"category": "theme",
|
|
7
|
-
"
|
|
7
|
+
"ancestor": [ "core/comment-template" ],
|
|
8
8
|
"description": "Displays a link to edit the comment in the WordPress Dashboard. This link is only visible to users with the edit comment capability.",
|
|
9
9
|
"textdomain": "default",
|
|
10
10
|
"usesContext": [ "commentId" ],
|
|
@@ -15,6 +15,10 @@
|
|
|
15
15
|
},
|
|
16
16
|
"textAlign": {
|
|
17
17
|
"type": "string"
|
|
18
|
+
},
|
|
19
|
+
"fontSize": {
|
|
20
|
+
"type": "string",
|
|
21
|
+
"default": "small"
|
|
18
22
|
}
|
|
19
23
|
},
|
|
20
24
|
"supports": {
|
|
@@ -31,6 +31,9 @@ function render_block_core_comment_edit_link( $attributes, $content, $block ) {
|
|
|
31
31
|
if ( isset( $attributes['textAlign'] ) ) {
|
|
32
32
|
$classes .= 'has-text-align-' . esc_attr( $attributes['textAlign'] );
|
|
33
33
|
}
|
|
34
|
+
if ( isset( $attributes['fontSize'] ) ) {
|
|
35
|
+
$classes .= 'has-' . esc_attr( $attributes['fontSize'] ) . '-font-size';
|
|
36
|
+
}
|
|
34
37
|
|
|
35
38
|
$wrapper_attributes = get_block_wrapper_attributes( array( 'class' => $classes ) );
|
|
36
39
|
|
|
@@ -4,13 +4,17 @@
|
|
|
4
4
|
"name": "core/comment-reply-link",
|
|
5
5
|
"title": "Comment Reply Link",
|
|
6
6
|
"category": "theme",
|
|
7
|
-
"
|
|
7
|
+
"ancestor": [ "core/comment-template" ],
|
|
8
8
|
"description": "Displays a link to reply to a comment.",
|
|
9
9
|
"textdomain": "default",
|
|
10
10
|
"usesContext": [ "commentId" ],
|
|
11
11
|
"attributes": {
|
|
12
12
|
"textAlign": {
|
|
13
13
|
"type": "string"
|
|
14
|
+
},
|
|
15
|
+
"fontSize": {
|
|
16
|
+
"type": "string",
|
|
17
|
+
"default": "small"
|
|
14
18
|
}
|
|
15
19
|
},
|
|
16
20
|
"supports": {
|
|
@@ -53,7 +53,10 @@ function render_block_core_comment_reply_link( $attributes, $content, $block ) {
|
|
|
53
53
|
|
|
54
54
|
$classes = '';
|
|
55
55
|
if ( isset( $attributes['textAlign'] ) ) {
|
|
56
|
-
$classes .= 'has-text-align-' . $attributes['textAlign'];
|
|
56
|
+
$classes .= 'has-text-align-' . esc_attr( $attributes['textAlign'] );
|
|
57
|
+
}
|
|
58
|
+
if ( isset( $attributes['fontSize'] ) ) {
|
|
59
|
+
$classes .= 'has-' . esc_attr( $attributes['fontSize'] ) . '-font-size';
|
|
57
60
|
}
|
|
58
61
|
|
|
59
62
|
$wrapper_attributes = get_block_wrapper_attributes( array( 'class' => $classes ) );
|
|
@@ -5,15 +5,9 @@
|
|
|
5
5
|
"title": "Comment Template",
|
|
6
6
|
"category": "design",
|
|
7
7
|
"parent": [ "core/comments-query-loop" ],
|
|
8
|
-
"description": "Contains the block elements used to
|
|
8
|
+
"description": "Contains the block elements used to display a comment, like the title, date, author, avatar and more.",
|
|
9
9
|
"textdomain": "default",
|
|
10
|
-
"usesContext": [
|
|
11
|
-
"comments/defaultPage",
|
|
12
|
-
"comments/inherit",
|
|
13
|
-
"comments/order",
|
|
14
|
-
"comments/perPage",
|
|
15
|
-
"postId"
|
|
16
|
-
],
|
|
10
|
+
"usesContext": [ "postId" ],
|
|
17
11
|
"supports": {
|
|
18
12
|
"reusable": false,
|
|
19
13
|
"html": false,
|
|
@@ -229,36 +229,29 @@ const CommentsList = ( {
|
|
|
229
229
|
|
|
230
230
|
export default function CommentTemplateEdit( {
|
|
231
231
|
clientId,
|
|
232
|
-
context: {
|
|
233
|
-
postId,
|
|
234
|
-
'comments/perPage': perPage,
|
|
235
|
-
'comments/order': order,
|
|
236
|
-
'comments/defaultPage': defaultPage,
|
|
237
|
-
'comments/inherit': inherit,
|
|
238
|
-
},
|
|
232
|
+
context: { postId },
|
|
239
233
|
} ) {
|
|
240
234
|
const blockProps = useBlockProps();
|
|
241
235
|
|
|
242
236
|
const [ activeCommentId, setActiveCommentId ] = useState();
|
|
243
|
-
const {
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
)
|
|
237
|
+
const {
|
|
238
|
+
commentOrder,
|
|
239
|
+
threadCommentsDepth,
|
|
240
|
+
threadComments,
|
|
241
|
+
commentsPerPage,
|
|
242
|
+
} = useSelect( ( select ) => {
|
|
243
|
+
const { getSettings } = select( blockEditorStore );
|
|
244
|
+
return getSettings().__experimentalDiscussionSettings;
|
|
245
|
+
} );
|
|
249
246
|
|
|
250
247
|
const commentQuery = useCommentQueryArgs( {
|
|
251
248
|
postId,
|
|
252
|
-
perPage,
|
|
253
|
-
defaultPage,
|
|
254
|
-
inherit,
|
|
255
249
|
} );
|
|
256
250
|
|
|
257
251
|
const { topLevelComments, blocks } = useSelect(
|
|
258
252
|
( select ) => {
|
|
259
253
|
const { getEntityRecords } = select( coreStore );
|
|
260
254
|
const { getBlocks } = select( blockEditorStore );
|
|
261
|
-
|
|
262
255
|
return {
|
|
263
256
|
// Request only top-level comments. Replies are embedded.
|
|
264
257
|
topLevelComments: commentQuery
|
|
@@ -270,12 +263,10 @@ export default function CommentTemplateEdit( {
|
|
|
270
263
|
[ clientId, commentQuery ]
|
|
271
264
|
);
|
|
272
265
|
|
|
273
|
-
order = inherit || ! order ? commentOrder : order;
|
|
274
|
-
|
|
275
266
|
// Generate a tree structure of comment IDs.
|
|
276
267
|
let commentTree = useCommentTree(
|
|
277
268
|
// Reverse the order of top comments if needed.
|
|
278
|
-
|
|
269
|
+
commentOrder === 'desc' && topLevelComments
|
|
279
270
|
? [ ...topLevelComments ].reverse()
|
|
280
271
|
: topLevelComments
|
|
281
272
|
);
|
|
@@ -290,14 +281,18 @@ export default function CommentTemplateEdit( {
|
|
|
290
281
|
|
|
291
282
|
if ( ! postId ) {
|
|
292
283
|
commentTree = getCommentsPlaceholder( {
|
|
293
|
-
perPage,
|
|
284
|
+
perPage: commentsPerPage,
|
|
294
285
|
threadComments,
|
|
295
286
|
threadCommentsDepth,
|
|
296
287
|
} );
|
|
297
288
|
}
|
|
298
289
|
|
|
299
290
|
if ( ! commentTree.length ) {
|
|
300
|
-
return
|
|
291
|
+
return (
|
|
292
|
+
<p { ...blockProps } data-testid="noresults">
|
|
293
|
+
{ __( 'No results found.' ) }
|
|
294
|
+
</p>
|
|
295
|
+
);
|
|
301
296
|
}
|
|
302
297
|
|
|
303
298
|
return (
|
|
@@ -11,21 +11,13 @@ import apiFetch from '@wordpress/api-fetch';
|
|
|
11
11
|
* Return an object with the query args needed to fetch the default page of
|
|
12
12
|
* comments.
|
|
13
13
|
*
|
|
14
|
-
* @param {Object}
|
|
15
|
-
* @param {number}
|
|
16
|
-
*
|
|
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.
|
|
14
|
+
* @param {Object} props Hook props.
|
|
15
|
+
* @param {number} props.postId ID of the post that contains the comments.
|
|
16
|
+
* discussion settings.
|
|
20
17
|
*
|
|
21
18
|
* @return {Object} Query args to retrieve the comments.
|
|
22
19
|
*/
|
|
23
|
-
export const useCommentQueryArgs = ( {
|
|
24
|
-
postId,
|
|
25
|
-
perPage,
|
|
26
|
-
defaultPage,
|
|
27
|
-
inherit,
|
|
28
|
-
} ) => {
|
|
20
|
+
export const useCommentQueryArgs = ( { postId } ) => {
|
|
29
21
|
// Initialize the query args that are not going to change.
|
|
30
22
|
const queryArgs = {
|
|
31
23
|
status: 'approve',
|
|
@@ -36,23 +28,15 @@ export const useCommentQueryArgs = ( {
|
|
|
36
28
|
};
|
|
37
29
|
|
|
38
30
|
// Get the Discussion settings that may be needed to query the comments.
|
|
39
|
-
const {
|
|
31
|
+
const {
|
|
32
|
+
commentsPerPage: perPage,
|
|
33
|
+
defaultCommentsPage: defaultPage,
|
|
34
|
+
} = useSelect( ( select ) => {
|
|
40
35
|
const { getSettings } = select( blockEditorStore );
|
|
41
36
|
const { __experimentalDiscussionSettings } = getSettings();
|
|
42
37
|
return __experimentalDiscussionSettings;
|
|
43
38
|
} );
|
|
44
39
|
|
|
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
40
|
// Get the number of the default page.
|
|
57
41
|
const page = useDefaultPageIndex( {
|
|
58
42
|
defaultPage,
|
|
@@ -112,9 +96,10 @@ const useDefaultPageIndex = ( { defaultPage, postId, perPage, queryArgs } ) => {
|
|
|
112
96
|
method: 'HEAD',
|
|
113
97
|
parse: false,
|
|
114
98
|
} ).then( ( res ) => {
|
|
99
|
+
const pages = parseInt( res.headers.get( 'X-WP-TotalPages' ) );
|
|
115
100
|
setDefaultPages( {
|
|
116
101
|
...defaultPages,
|
|
117
|
-
[ key ]:
|
|
102
|
+
[ key ]: pages <= 1 ? 1 : pages, // If there are 0 pages, it means that there are no comments, but there is no 0th page.
|
|
118
103
|
} );
|
|
119
104
|
} );
|
|
120
105
|
}, [ defaultPage, postId, perPage, setDefaultPages ] );
|
|
@@ -8,11 +8,17 @@
|
|
|
8
8
|
/**
|
|
9
9
|
* Function that recursively renders a list of nested comments.
|
|
10
10
|
*
|
|
11
|
-
* @param WP_Comment[] $comments
|
|
11
|
+
* @param WP_Comment[] $comments The array of comments.
|
|
12
12
|
* @param WP_Block $block Block instance.
|
|
13
13
|
* @return string
|
|
14
14
|
*/
|
|
15
15
|
function block_core_comment_template_render_comments( $comments, $block ) {
|
|
16
|
+
global $comment_depth;
|
|
17
|
+
|
|
18
|
+
if ( empty( $comment_depth ) ) {
|
|
19
|
+
$comment_depth = 1;
|
|
20
|
+
}
|
|
21
|
+
|
|
16
22
|
$content = '';
|
|
17
23
|
foreach ( $comments as $comment ) {
|
|
18
24
|
|
|
@@ -28,14 +34,20 @@ function block_core_comment_template_render_comments( $comments, $block ) {
|
|
|
28
34
|
// If the comment has children, recurse to create the HTML for the nested
|
|
29
35
|
// comments.
|
|
30
36
|
if ( ! empty( $children ) ) {
|
|
37
|
+
$comment_depth += 1;
|
|
31
38
|
$inner_content = block_core_comment_template_render_comments(
|
|
32
39
|
$children,
|
|
33
40
|
$block
|
|
34
41
|
);
|
|
35
42
|
$block_content .= sprintf( '<ol>%1$s</ol>', $inner_content );
|
|
43
|
+
$comment_depth -= 1;
|
|
36
44
|
}
|
|
37
45
|
|
|
38
|
-
|
|
46
|
+
// The `false` parameter at the end means that we do NOT want the function to `echo` the output but to return a string.
|
|
47
|
+
// See https://developer.wordpress.org/reference/functions/comment_class/#parameters.
|
|
48
|
+
$comment_classes = comment_class( '', $comment->comment_ID, $comment->comment_post_ID, false );
|
|
49
|
+
|
|
50
|
+
$content .= sprintf( '<li id="comment-%1$s" %2$s>%3$s</li>', $comment->comment_ID, $comment_classes, $block_content );
|
|
39
51
|
}
|
|
40
52
|
|
|
41
53
|
return $content;
|
|
@@ -68,9 +80,7 @@ function render_block_core_comment_template( $attributes, $content, $block ) {
|
|
|
68
80
|
return '';
|
|
69
81
|
}
|
|
70
82
|
|
|
71
|
-
$comment_order =
|
|
72
|
-
? $block->context['comments/order']
|
|
73
|
-
: get_option( 'comment_order' );
|
|
83
|
+
$comment_order = get_option( 'comment_order' );
|
|
74
84
|
|
|
75
85
|
if ( 'desc' === $comment_order ) {
|
|
76
86
|
$comments = array_reverse( $comments );
|
|
@@ -5,21 +5,14 @@
|
|
|
5
5
|
"title": "Next Page",
|
|
6
6
|
"category": "theme",
|
|
7
7
|
"parent": [ "core/comments-pagination" ],
|
|
8
|
-
"description": "Displays the next
|
|
8
|
+
"description": "Displays the next comment's page link.",
|
|
9
9
|
"textdomain": "default",
|
|
10
10
|
"attributes": {
|
|
11
11
|
"label": {
|
|
12
12
|
"type": "string"
|
|
13
13
|
}
|
|
14
14
|
},
|
|
15
|
-
"usesContext": [
|
|
16
|
-
"postId",
|
|
17
|
-
"comments/perPage",
|
|
18
|
-
"comments/order",
|
|
19
|
-
"comments/inherit",
|
|
20
|
-
"comments/defaultPage",
|
|
21
|
-
"comments/paginationArrow"
|
|
22
|
-
],
|
|
15
|
+
"usesContext": [ "postId", "comments/paginationArrow" ],
|
|
23
16
|
"supports": {
|
|
24
17
|
"reusable": false,
|
|
25
18
|
"html": false,
|
|
@@ -3,17 +3,11 @@
|
|
|
3
3
|
"apiVersion": 2,
|
|
4
4
|
"name": "core/comments-pagination-numbers",
|
|
5
5
|
"title": "Page Numbers",
|
|
6
|
-
|
|
6
|
+
"category": "theme",
|
|
7
7
|
"parent": [ "core/comments-pagination" ],
|
|
8
8
|
"description": "Displays a list of page numbers for comments pagination.",
|
|
9
9
|
"textdomain": "default",
|
|
10
|
-
"usesContext": [
|
|
11
|
-
"postId",
|
|
12
|
-
"comments/perPage",
|
|
13
|
-
"comments/order",
|
|
14
|
-
"comments/inherit",
|
|
15
|
-
"comments/defaultPage"
|
|
16
|
-
],
|
|
10
|
+
"usesContext": [ "postId" ],
|
|
17
11
|
"supports": {
|
|
18
12
|
"reusable": false,
|
|
19
13
|
"html": false
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
"title": "Previous Page",
|
|
6
6
|
"category": "theme",
|
|
7
7
|
"parent": [ "core/comments-pagination" ],
|
|
8
|
-
"description": "Displays the previous
|
|
8
|
+
"description": "Displays the previous comment's page link.",
|
|
9
9
|
"textdomain": "default",
|
|
10
10
|
"attributes": {
|
|
11
11
|
"label": {
|
|
@@ -35,4 +35,4 @@
|
|
|
35
35
|
}
|
|
36
36
|
}
|
|
37
37
|
}
|
|
38
|
-
}
|
|
38
|
+
}
|
|
@@ -4,36 +4,14 @@
|
|
|
4
4
|
"name": "core/comments-query-loop",
|
|
5
5
|
"title": "Comments Query Loop",
|
|
6
6
|
"category": "theme",
|
|
7
|
-
"description": "An advanced block that allows displaying post comments
|
|
7
|
+
"description": "An advanced block that allows displaying post comments using different visual configurations.",
|
|
8
8
|
"textdomain": "default",
|
|
9
9
|
"attributes": {
|
|
10
|
-
"inherit": {
|
|
11
|
-
"type": "boolean",
|
|
12
|
-
"default": true
|
|
13
|
-
},
|
|
14
|
-
"order": {
|
|
15
|
-
"type": "string",
|
|
16
|
-
"default": null
|
|
17
|
-
},
|
|
18
|
-
"perPage": {
|
|
19
|
-
"type": "number",
|
|
20
|
-
"default": null
|
|
21
|
-
},
|
|
22
10
|
"tagName": {
|
|
23
11
|
"type": "string",
|
|
24
12
|
"default": "div"
|
|
25
|
-
},
|
|
26
|
-
"defaultPage": {
|
|
27
|
-
"type": "string",
|
|
28
|
-
"default": "oldest"
|
|
29
13
|
}
|
|
30
14
|
},
|
|
31
|
-
"providesContext": {
|
|
32
|
-
"comments/perPage": "perPage",
|
|
33
|
-
"comments/order": "order",
|
|
34
|
-
"comments/defaultPage": "defaultPage",
|
|
35
|
-
"comments/inherit": "inherit"
|
|
36
|
-
},
|
|
37
15
|
"supports": {
|
|
38
16
|
"align": [ "wide", "full" ],
|
|
39
17
|
"html": false,
|
|
@@ -1,97 +1,16 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* WordPress dependencies
|
|
3
3
|
*/
|
|
4
|
-
import {
|
|
5
|
-
PanelBody,
|
|
6
|
-
SelectControl,
|
|
7
|
-
ToggleControl,
|
|
8
|
-
__experimentalNumberControl as NumberControl,
|
|
9
|
-
} from '@wordpress/components';
|
|
4
|
+
import { SelectControl } from '@wordpress/components';
|
|
10
5
|
import { __ } from '@wordpress/i18n';
|
|
11
6
|
import { InspectorControls } from '@wordpress/block-editor';
|
|
12
7
|
|
|
13
|
-
const orderOptions = [
|
|
14
|
-
{
|
|
15
|
-
label: __( 'Newest to oldest' ),
|
|
16
|
-
value: 'desc',
|
|
17
|
-
},
|
|
18
|
-
{
|
|
19
|
-
label: __( 'Oldest to newest' ),
|
|
20
|
-
value: 'asc',
|
|
21
|
-
},
|
|
22
|
-
];
|
|
23
|
-
|
|
24
|
-
const defaultPageOptions = [
|
|
25
|
-
{
|
|
26
|
-
label: __( 'Newest' ),
|
|
27
|
-
value: 'newest',
|
|
28
|
-
},
|
|
29
|
-
{
|
|
30
|
-
label: __( 'Oldest' ),
|
|
31
|
-
value: 'oldest',
|
|
32
|
-
},
|
|
33
|
-
];
|
|
34
|
-
|
|
35
8
|
export default function CommentsInspectorControls( {
|
|
36
|
-
attributes: { TagName
|
|
9
|
+
attributes: { TagName },
|
|
37
10
|
setAttributes,
|
|
38
11
|
} ) {
|
|
39
12
|
return (
|
|
40
13
|
<InspectorControls>
|
|
41
|
-
<PanelBody title={ __( 'Settings' ) }>
|
|
42
|
-
<ToggleControl
|
|
43
|
-
label={ __( 'Inherit from Discussion Settings' ) }
|
|
44
|
-
checked={ inherit }
|
|
45
|
-
onChange={ () => {
|
|
46
|
-
setAttributes( {
|
|
47
|
-
inherit: ! inherit,
|
|
48
|
-
} );
|
|
49
|
-
} }
|
|
50
|
-
/>
|
|
51
|
-
{ ! inherit && (
|
|
52
|
-
<>
|
|
53
|
-
<SelectControl
|
|
54
|
-
label={ __( 'Order by' ) }
|
|
55
|
-
value={ order }
|
|
56
|
-
options={ orderOptions }
|
|
57
|
-
onChange={ ( value ) => {
|
|
58
|
-
setAttributes( {
|
|
59
|
-
order: value,
|
|
60
|
-
} );
|
|
61
|
-
} }
|
|
62
|
-
/>
|
|
63
|
-
<SelectControl
|
|
64
|
-
label={ __( 'Default page' ) }
|
|
65
|
-
value={ defaultPage }
|
|
66
|
-
options={ defaultPageOptions }
|
|
67
|
-
onChange={ ( value ) => {
|
|
68
|
-
setAttributes( {
|
|
69
|
-
defaultPage: value,
|
|
70
|
-
} );
|
|
71
|
-
} }
|
|
72
|
-
/>
|
|
73
|
-
<NumberControl
|
|
74
|
-
__unstableInputWidth="60px"
|
|
75
|
-
label={ __( 'Items per Page' ) }
|
|
76
|
-
labelPosition="edge"
|
|
77
|
-
min={ 1 }
|
|
78
|
-
max={ 100 }
|
|
79
|
-
onChange={ ( value ) => {
|
|
80
|
-
const num = parseInt( value, 10 );
|
|
81
|
-
if ( isNaN( num ) || num < 1 || num > 100 ) {
|
|
82
|
-
return;
|
|
83
|
-
}
|
|
84
|
-
setAttributes( {
|
|
85
|
-
perPage: num,
|
|
86
|
-
} );
|
|
87
|
-
} }
|
|
88
|
-
step="1"
|
|
89
|
-
value={ perPage }
|
|
90
|
-
isDragEnabled={ false }
|
|
91
|
-
/>
|
|
92
|
-
</>
|
|
93
|
-
) }
|
|
94
|
-
</PanelBody>
|
|
95
14
|
<InspectorControls __experimentalGroup="advanced">
|
|
96
15
|
<SelectControl
|
|
97
16
|
label={ __( 'HTML element' ) }
|