Skip to content

Idea for block registry. #336

@BE-Webdesign

Description

@BE-Webdesign

Hi, just throwing out some ideas on the block registering API.

  1. 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 global blocks. 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 function blockType( 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 method registerBlock( 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    [Feature] Block APIAPI that allows to express the block paradigm.[Type] QuestionQuestions about the design or development of the editor.

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions