Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add new API to allow inserter items to be prioritised #50510

Merged
merged 35 commits into from
May 15, 2023
Merged
Changes from 1 commit
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
d3d0ed6
Proposing a way to sort items in the block inspector based on allowed…
scruffian May 10, 2023
1261536
Add inserterPriority API to inner blocks
getdave May 10, 2023
e8d2c78
Sort inserter based on inserterPriority prop from block list settings
getdave May 10, 2023
d72bb33
Use new inserterPriority API in Nav block
getdave May 10, 2023
66b4a02
Correct comment
getdave May 10, 2023
d987b29
Remove redundant prop
getdave May 10, 2023
4c1797e
Avoid stale inserterPriority
getdave May 11, 2023
d47e6c8
Make sorting function stable
getdave May 11, 2023
07aec20
Renaming
getdave May 11, 2023
25b18f2
Remove redundant comment
getdave May 11, 2023
264177a
remove spacer
scruffian May 11, 2023
509c362
Set prioritisedBlocks as empty array when no blockListSettings are fo…
jeryj May 11, 2023
1d81ef4
proritise -> prioritize for consistency
jeryj May 11, 2023
1523f1c
Update packages/block-editor/src/components/inner-blocks/use-nested-s…
scruffian May 11, 2023
eeb586d
Renaming constant to match updated name
jeryj May 11, 2023
be2e9d6
Add prioritizedKInnerBlocks to the inner-blocks README
jeryj May 11, 2023
5d6f1b5
lint fix
scruffian May 11, 2023
1162a72
update comment
scruffian May 11, 2023
51e5d3c
update comment
scruffian May 12, 2023
db4568f
pass the correct props to useNestedSettingsUpdate
scruffian May 12, 2023
96b70f3
Use stable ref
getdave May 12, 2023
21c12e1
Register the test Plugin for e2e tests
getdave May 12, 2023
9fde1a0
Register block with prioritzedInserterBlocks set
getdave May 12, 2023
ef93a6d
Add initial test scaffold
getdave May 12, 2023
b163447
Tidy up scaffolded test
getdave May 12, 2023
6bf6d37
Add test for new API
getdave May 12, 2023
8cb75c8
Try removing sort from helper
getdave May 12, 2023
d0ddf60
Fix test
getdave May 12, 2023
836b407
Add test to check does not override allowedBlocks when conflicted
getdave May 12, 2023
a954bae
Add additional assertion for retaining of correct number of results
getdave May 12, 2023
a787e9d
Ensure tests reflect target of Quick Inserter
getdave May 12, 2023
45bd5ac
sort allowed blocks on the tests that consume getAllBlockInserterItem…
MaggieCabrera May 12, 2023
01ad80a
Improve e2e test comment
getdave May 15, 2023
784bffb
Update packages/block-editor/src/components/inner-blocks/use-nested-s…
scruffian May 15, 2023
259a23d
Update packages/block-editor/src/components/inner-blocks/README.md
scruffian May 15, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
update comment
  • Loading branch information
scruffian authored and getdave committed May 12, 2023
commit 1162a72dd8106fac1e484b90e9adbe34a09eaf9c
Original file line number Diff line number Diff line change
Expand Up @@ -184,4 +184,4 @@ For example, a button block, deeply nested in several levels of block `X` that u
### `prioritizedInserterBlocks`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we need to document this somewhere else or is this enough?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's the official docs so I guess that's enough.


- **Type:** `Array`
- **Default:** - `undefined`. Determines which inner blocks should be returned first from the block inserter. For example, when inserting a block within the Navigation Block, `core/navigation-link/page` and `core/navigation-link` are the most common inner blocks. We can use `prioritizedInserterBlocks` to pass these `navigation-link` blocks as an array so they can be returned first by default from the Navigation Block inserter.
- **Default:** - `undefined`. Determines which inner blocks should be returned first from the block inserter. For example, when inserting a block within the Navigation Block, `core/navigation-link` and `core/navigation-link/page` are the most common inner blocks. We can use `prioritizedInserterBlocks` to pass these `navigation-link` blocks as an array so they can be returned first by default from the Navigation Block inserter.