-
Notifications
You must be signed in to change notification settings - Fork 4.8k
Idea for block registry. #336
Copy link
Copy link
Closed
Labels
[Feature] Block APIAPI that allows to express the block paradigm.API that allows to express the block paradigm.[Type] QuestionQuestions about the design or development of the editor.Questions about the design or development of the editor.
Description
Hi, just throwing out some ideas on the block registering API.
- Currently block types are created via
wp.blocks.registerBlock( slug, settings )which returns the block and also adds the block as a key, value pair to the somewhat globalblocks. This is a coupling that I do not think should be made. I would recommend the creation of a block to be handled in a functionblockType( slug, settings )( or preferably just settings ). Then the registry of blocks can be another factory function that creates registries of blocks, which can have the methodregisterBlock( block )on them.
This will make testing a lot easier/cleaner and will also create a bit more flexibility in the code for unforeseen future needs.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
[Feature] Block APIAPI that allows to express the block paradigm.API that allows to express the block paradigm.[Type] QuestionQuestions about the design or development of the editor.Questions about the design or development of the editor.
Type
Fields
Give feedbackNo fields configured for issues without a type.