Feature : Inserter Priority for Custom Blocks#75006
Feature : Inserter Priority for Custom Blocks#75006Vrishabhsk wants to merge 3 commits intoWordPress:trunkfrom
Conversation
|
Warning: Type of PR label mismatch To merge this PR, it requires exactly 1 label indicating the type of PR. Other labels are optional and not being checked here.
Read more about Type labels in Gutenberg. Don't worry if you don't have the required permissions to add labels; the PR reviewer should be able to help with the task. |
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message. To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
|
Thanks for contributing, @Vrishabhsk! Closing this based on the discussion in the issue. |
What?
inserterPriorityproperty inblock.json, allowing custom blocks to influence their display order in the Block Inserter.Why?
Currently, block developers have no way to control where their blocks appear in the inserter relative to other blocks in the same category. This makes it difficult to surface important custom blocks prominently. The
inserterPriorityproperty gives developers control over block ordering within the inserter.How?
inserterPriorityproperty to the block.json schema (schemas/json/block.json)inserterPriorityto allowed fields in JS block registration (packages/blocks/src/api/registration.js)packages/blocks/src/store/reducer.js)getInserterItemsselector (packages/block-editor/src/store/selectors.js)inserterPriorityfrom server to client (lib/compat/wordpress-6.9/block-inserter-priority.php)Blocks with lower
inserterPriorityvalues appear first. Default is0.Testing Instructions
inserterPriorityin itsblock.json:{ "name": "my-plugin/priority-block", "title": "Priority Block", "category": "widgets", "inserterPriority": -10 }inserterPriority: -10appears before other blocks in the category.Testing Instructions for Keyboard
/to open the slash inserter.inserterPriorityvalue (lower values first).Screenshots or screencast
inserterPriority(lower values first)