PRC's override/extension of the WordPress core/list block.
prc-block/core-list
- Enables
blockGapspacing support (not enabled by default in core) - Registers an "Unstyled List" block style that removes list bullets/numbers
- Applies a
--block-gapCSS custom property to control spacing between list items - Adds the
wp-block-listclass to the rendered list element on the frontend
| Support | Change |
|---|---|
spacing.blockGap |
Enabled (true) -- allows gap control between list items |
The blockGap support is added both in PHP (add_attributes filter on block_type_metadata) and in JS (blocks.registerBlockType filter).
None beyond core. The blockGap support is added via the supports API, not as a custom attribute.
| Style Name | Label | Description |
|---|---|---|
list-style-type-none |
Unstyled List | Removes bullets and ::before pseudo-element content |
Registered in index.js via registerBlockStyle.
File: style.scss
.is-style-list-style-type-none-- setslist-style-type: noneand removesli::beforecontent.wp-block-list li:first-child-- removesmargin-block-start.wp-block-list li:not(:first-child)-- usesvar(--block-gap)formargin-block-startspacing
File: index.js
- Adds a higher-order component (
editor.BlockListBlockfilter) that injects--block-gapas a CSS custom property on the block wrapper in the editor - Uses
getBlockGapSupportValuefrom@prc/functionsto compute the gap value
None. No view.js file.
File: class-core-list.php
add_attributes(block_type_metadatafilter) -- enablesspacing.blockGapsupport on the core/list block metadatarender(render_blockfilter) -- processescore/list-itemblocks to:- Add the
wp-block-listclass to the list element (ulorol) - Set a
--block-gapCSS custom property from the block's gap attribute
- Add the
Note: The render filter targets core/list-item (not core/list) to apply the gap styling.
<ul class="wp-block-list" style="--block-gap: 1em;">
<li>Item one</li>
<li>Item two</li>
<li>Item three</li>
</ul>With the unstyled style:
<ul class="wp-block-list is-style-list-style-type-none" style="--block-gap: 0.5em;">
<li>Item one</li>
<li>Item two</li>
</ul>None.