Skip to content

Commit

Permalink
Merge pull request #201 from alleyinteractive/feature/issue-200/add-n…
Browse files Browse the repository at this point in the history
…ested-query-block-capability

Issue-200: Add a new block that can be nested or ability for Query Block to be nested
  • Loading branch information
mogmarsh authored Sep 17, 2024
2 parents dcf9298 + 4ffd42e commit c5052b3
Show file tree
Hide file tree
Showing 21 changed files with 19,554 additions and 368 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@

All notable changes to `WP Curate` will be documented in this file.

## 2.4.0 - 2024-08-28

- Enhancement: Subquery block added to allow a separate set of posts within a query block.
see https://github.com/alleyinteractive/wp-curate/issues/200

## 2.3.3 - 2024-09-16

- Bug Fix: Hold space on the front end for curated posts that were deleted.
Expand Down
8 changes: 6 additions & 2 deletions blocks/post/edit.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,20 +42,24 @@ export default function Edit({
isSelected,
}: PostEditProps) {
// @ts-ignore
const queryParentId = select('core/block-editor').getBlockParentsByBlockName(clientId, 'wp-curate/query')[0];
const queryParents = select('core/block-editor').getBlockParentsByBlockName(clientId, ['wp-curate/query', 'wp-curate/subquery']);
const queryParentId = queryParents.pop();

// @ts-ignore
const queryParent = select('core/block-editor').getBlock(queryParentId) ?? {
attributes: {
posts: [],
postTypes: [],
},
};

const queryBlocks = select('core/block-editor').getBlocksByName('wp-curate/query');
const {
attributes: {
posts = [],
postTypes = [],
} = {},
name: parentName,
} = queryParent;

const queryInclude = include.split(',').map((id: string) => parseInt(id, 10));
Expand Down Expand Up @@ -175,7 +179,7 @@ export default function Edit({
'wp-curate-post-block',
{ 'wp-curate-post-block--selected': isParentOfSelectedBlock },
{ 'wp-curate-post-block--backfill': !selected || postDeleted },
{ 'curate-droppable': moveData.postId && moveData.postId !== postId },
{ 'curate-droppable': parentName === 'wp-curate/query' && moveData.postId && moveData.postId !== postId },
{ 'wp-curate-error': postDeleted },
),
},
Expand Down
Loading

0 comments on commit c5052b3

Please sign in to comment.