Uploaded image for project: 'Planet4'
  1. Planet4
  2. PLANET-6716

Use Block API version 2 to improve block markup


    • Icon: Task Task
    • Resolution: Unresolved
    • Icon: Could have Could have
    • None
    • None
    • Blocks (all), Maintenance, Technical Debt

      The original WP block API would output the editor component of each block in a wrapper div.

      In the V2 block registration API this wrapper div is removed, and instead the wrapper props are passed to the edit component to allow it managing its own wrapper.

      This has multiple benefits:

      • Much easier to use front end CSS in the editor.
      • Better block alignment behavior.
      • Less complex HTML tree is easier to work with and has better performance.

      However it could for some blocks be tricky to rewrite the code. The V1 API will keep being supported, so we can decide for each block whether it's worthwhile.

      For example in the carousel header block currently needs additional CSS on top of the ".alignfull" class for that one to work.

            Unassigned Unassigned
            pvincent Pieter Vincent (Inactive)
            0 Vote for this issue
            0 Start watching this issue