Why are the paragraph block inline styles different?
-
I’ve added a color control to the paragraph and heading blocks and it’s mostly working but the inline styles are not being shown in the editor. I’m using the blocks.getSaveContent.extraProps filter to add the props.style but that doesn’t seem to generate inline styles for the paragraph block in the editor. It does work as expected on the front end
Gistfunction applyOverlineStyle(props, blockType, attributes) { if( ! enableOverlineColorOnBlocks.includes( blockType.name ) ){ return props; } const { overlineColor, customOverlineColor } = attributes; props.style = { ...props.style, '--wp--custom--overline-color': overlineColor ?
var( --wp--preset--color--${ overlineColor } )
: customOverlineColor, } return props; } addFilter( 'blocks.getSaveContent.extraProps', 'pinwheel/overline-apply-style', applyOverlineStyle )How should I be adding the style to the paragraph?
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘Why are the paragraph block inline styles different?’ is closed to new replies.