Skip to content

Commit

Permalink
Only allow Numbers inside Comments Pagination
Browse files Browse the repository at this point in the history
  • Loading branch information
DAreRodz committed Nov 30, 2021
1 parent 497e260 commit d5b672a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"name": "core/comments-pagination-numbers",
"title": "Comments Pagination Numbers",
"category": "design",
"parent": [ "core/comments-query-loop" ],
"parent": [ "core/comments-pagination" ],
"description": "Displays a list of page numbers for comments pagination.",
"textdomain": "default",
"usesContext": [ "queryId", "queryPerPage", "postId" ],
Expand Down
8 changes: 8 additions & 0 deletions packages/block-library/src/comments-pagination/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ import { PanelBody } from '@wordpress/components';
*/
import { CommentsPaginationArrowControls } from './comments-pagination-arrow-controls';

// TODO: add pagination-previous/next blocks once they are implemented.
const TEMPLATE = [ [ 'core/comments-pagination-numbers' ] ];

const getDefaultBlockLayout = ( blockTypeOrName ) => {
const layoutBlockSupportConfig = getBlockSupport(
blockTypeOrName,
Expand Down Expand Up @@ -48,6 +51,11 @@ export default function QueryPaginationEdit( {
}, [] );
const blockProps = useBlockProps();
const innerBlocksProps = useInnerBlocksProps( blockProps, {
template: TEMPLATE,
allowedBlocks: [
// TODO: add pagination-previous/next blocks once they are implemented.
'core/comments-pagination-numbers',
],
__experimentalLayout: usedLayout,
} );
return (
Expand Down

0 comments on commit d5b672a

Please sign in to comment.